* @brief Returns whether a newer version is available for the given addon. */
| 270 | * @brief Returns whether a newer version is available for the given addon. |
| 271 | */ |
| 272 | bool Misc::ExtensionManager::hasUpdate(const QString& id) const |
| 273 | { |
| 274 | if (!isInstalled(id)) |
| 275 | return false; |
| 276 | |
| 277 | const auto installed = m_installedExtensions.value(id).toObject(); |
| 278 | const auto localVer = installed.value("version").toString(); |
| 279 | |
| 280 | for (const auto& entry : std::as_const(m_allExtensions)) { |
| 281 | const auto obj = entry.toObject(); |
| 282 | if (obj.value("id").toString() == id) |
| 283 | return obj.value("version").toString() != localVer; |
| 284 | } |
| 285 | |
| 286 | return false; |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * @brief Returns the installed version string for the given addon, or empty. |