* @brief Peels a lone top-level folder into its children, repeating until the level holds more * than one item or a non-folder leaf, so the switcher never opens on a single redundant * folder. */
| 1490 | * folder. |
| 1491 | */ |
| 1492 | static QVariantList collapseSingleFolderRoots(QVariantList level) |
| 1493 | { |
| 1494 | int guard = 0; |
| 1495 | while (level.size() == 1 && guard++ < 256) { |
| 1496 | const auto node = level.first().toMap(); |
| 1497 | if (!node.value(QStringLiteral("isFolder")).toBool()) |
| 1498 | break; |
| 1499 | |
| 1500 | const auto children = node.value(QStringLiteral("children")).toList(); |
| 1501 | if (children.isEmpty()) |
| 1502 | break; |
| 1503 | |
| 1504 | level = children; |
| 1505 | } |
| 1506 | |
| 1507 | return level; |
| 1508 | } |
| 1509 | |
| 1510 | /** |
| 1511 | * @brief Flattens the switcher tree into leaf workspaces, prefixing each label with its folder |
no test coverage detected