Commit 01cd6a0f authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

flatpak: Properly fetch the version we are upgrading to

BUG: 447033
parent 9baf7a57
......@@ -1274,6 +1274,9 @@ ResultsStream *FlatpakBackend::search(const AbstractResourcesBackend::Filters &f
for (uint i = 0; i < refs->len; i++) {
FlatpakInstalledRef *ref = FLATPAK_INSTALLED_REF(g_ptr_array_index(refs, i));
auto resource = getAppForInstalledRef(installation, ref);
#if FLATPAK_CHECK_VERSION(1, 1, 2)
resource->setAvailableVersion(QString::fromUtf8(flatpak_installed_ref_get_appdata_version(ref)));
#endif
resource->setState(AbstractResource::Upgradeable);
updateAppSize(resource);
if (resource->resourceType() == FlatpakResource::Runtime) {
......
......@@ -97,9 +97,8 @@ QString FlatpakResource::availableVersion() const
theBranch = i18n("Unknown");
}
if (!m_appdata.releases().isEmpty()) {
auto release = m_appdata.releases().constFirst();
return i18n("%1 (%2)", release.version(), theBranch);
if (!m_availableVersion.isEmpty()) {
return i18nc("version (branch)", "%1 (%2)", m_availableVersion, theBranch);
}
return theBranch;
......
......@@ -158,6 +158,11 @@ public:
QString installPath() const;
void updateFromAppStream();
void setAvailableVersion(const QString &version)
{
m_availableVersion = version;
}
Q_SIGNALS:
void propertyStateChanged(FlatpakResource::PropertyKind kind, FlatpakResource::PropertyState state);
......@@ -181,6 +186,7 @@ private:
AbstractResource::State m_state;
FlatpakInstallation *const m_installation;
QString m_origin;
QString m_availableVersion;
FlatpakResource::ResourceType m_type = DesktopApp;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment