* @brief Flips the customizeWorkspaces flag. */
| 1040 | * @brief Flips the customizeWorkspaces flag. |
| 1041 | */ |
| 1042 | API::CommandResponse API::Handlers::WorkspacesHandler::customizeSet(const QString& id, |
| 1043 | const QJsonObject& params) |
| 1044 | { |
| 1045 | if (!inProjectFileMode()) |
| 1046 | return CommandResponse::makeError( |
| 1047 | id, ErrorCode::InvalidParam, QStringLiteral("Workspace mutations require ProjectFile mode")); |
| 1048 | |
| 1049 | if (!params.contains(QStringLiteral("enabled"))) |
| 1050 | return CommandResponse::makeError( |
| 1051 | id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: enabled")); |
| 1052 | |
| 1053 | const bool enabled = params.value(QStringLiteral("enabled")).toBool(); |
| 1054 | DataModel::ProjectModel::instance().setCustomizeWorkspaces(enabled); |
| 1055 | |
| 1056 | QJsonObject result; |
| 1057 | result[QStringLiteral("enabled")] = enabled; |
| 1058 | result[QStringLiteral("updated")] = true; |
| 1059 | return CommandResponse::makeSuccess(id, result); |
| 1060 | } |
| 1061 | |
| 1062 | //-------------------------------------------------------------------------------------------------- |
| 1063 | // Widget ref mutations |
nothing calls this directly
no test coverage detected