* @brief Return all groups from the taskbar model. */
| 237 | * @brief Return all groups from the taskbar model. |
| 238 | */ |
| 239 | API::CommandResponse API::Handlers::WindowHandler::getGroups(const QString& id, |
| 240 | const QJsonObject& params) |
| 241 | { |
| 242 | Q_UNUSED(params) |
| 243 | |
| 244 | auto* taskbar = UI::UISessionRegistry::instance().primaryTaskbar(); |
| 245 | if (!taskbar) |
| 246 | return noSession(id); |
| 247 | |
| 248 | const auto model = taskbar->workspaceModel(); |
| 249 | QJsonArray groups; |
| 250 | for (const auto& entry : model) { |
| 251 | const auto map = entry.toMap(); |
| 252 | QJsonObject g; |
| 253 | g[QStringLiteral("id")] = map.value(QStringLiteral("id")).toInt(); |
| 254 | g[QStringLiteral("text")] = map.value(QStringLiteral("text")).toString(); |
| 255 | g[QStringLiteral("icon")] = map.value(QStringLiteral("icon")).toString(); |
| 256 | groups.append(g); |
| 257 | } |
| 258 | |
| 259 | QJsonObject result; |
| 260 | result[QStringLiteral("groups")] = groups; |
| 261 | return CommandResponse::makeSuccess(id, result); |
| 262 | } |
| 263 | |
| 264 | //-------------------------------------------------------------------------------------------------- |
| 265 | // Active group setters |
nothing calls this directly
no test coverage detected