* @brief Return overall dashboard window status. */
| 202 | * @brief Return overall dashboard window status. |
| 203 | */ |
| 204 | API::CommandResponse API::Handlers::WindowHandler::getStatus(const QString& id, |
| 205 | const QJsonObject& params) |
| 206 | { |
| 207 | Q_UNUSED(params) |
| 208 | |
| 209 | auto* taskbar = UI::UISessionRegistry::instance().primaryTaskbar(); |
| 210 | auto* wm = UI::UISessionRegistry::instance().primaryWindowManager(); |
| 211 | |
| 212 | QJsonObject result; |
| 213 | |
| 214 | if (!taskbar) { |
| 215 | result[QStringLiteral("sessionActive")] = false; |
| 216 | result[QStringLiteral("activeGroupId")] = -1; |
| 217 | result[QStringLiteral("activeGroupIndex")] = -1; |
| 218 | result[QStringLiteral("groupCount")] = 0; |
| 219 | result[QStringLiteral("hasMaximizedWindow")] = false; |
| 220 | result[QStringLiteral("autoLayoutEnabled")] = false; |
| 221 | return CommandResponse::makeSuccess(id, result); |
| 222 | } |
| 223 | |
| 224 | const auto groups = taskbar->workspaceModel(); |
| 225 | |
| 226 | result[QStringLiteral("sessionActive")] = true; |
| 227 | result[QStringLiteral("activeGroupId")] = taskbar->activeGroupId(); |
| 228 | result[QStringLiteral("activeGroupIndex")] = taskbar->activeGroupIndex(); |
| 229 | result[QStringLiteral("groupCount")] = static_cast<int>(groups.size()); |
| 230 | result[QStringLiteral("hasMaximizedWindow")] = taskbar->hasMaximizedWindow(); |
| 231 | result[QStringLiteral("autoLayoutEnabled")] = wm ? wm->autoLayoutEnabled() : false; |
| 232 | |
| 233 | return CommandResponse::makeSuccess(id, result); |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * @brief Return all groups from the taskbar model. |
nothing calls this directly
no test coverage detected