* @brief Installs an extension by setting the selected index and triggering install. */
| 216 | * @brief Installs an extension by setting the selected index and triggering install. |
| 217 | */ |
| 218 | API::CommandResponse API::Handlers::ExtensionHandler::installExtension(const QString& id, |
| 219 | const QJsonObject& params) |
| 220 | { |
| 221 | const int index = params.value("addonIndex").toInt(-1); |
| 222 | if (index < 0) |
| 223 | return CommandResponse::makeError( |
| 224 | id, QStringLiteral("INVALID_PARAMS"), "Missing or invalid addonIndex"); |
| 225 | |
| 226 | auto& mgr = Misc::ExtensionManager::instance(); |
| 227 | mgr.setSelectedIndex(index); |
| 228 | mgr.installExtension(); |
| 229 | return CommandResponse::makeSuccess(id, |
| 230 | QJsonObject{ |
| 231 | {"status", "installing"} |
| 232 | }); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * @brief Uninstalls an extension by selecting it and triggering an irreversible directory |
nothing calls this directly
no test coverage detected