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

flatpak: Let FlatpakResource::availableVersion figure itself out

Otherwise we are depending on the sequence of requests to FlatpakBackend
(i.e. an update search) which is not something that always happens.
FlatpakResource::isOlderThan relies on that.
parent 2f72e7e9
......@@ -1393,10 +1393,6 @@ ResultsStream *FlatpakBackend::search(const AbstractResourcesBackend::Filters &f
for (auto ref : qAsConst(it.value())) {
bool fresh;
auto resource = getAppForInstalledRef(it.key(), ref, &fresh);
const auto releases = resource->appdata().releases();
if (!releases.isEmpty()) {
resource->setAvailableVersion(releases.constFirst().version());
}
g_object_unref(ref);
resource->setState(AbstractResource::Upgradeable, !fresh);
updateAppSize(resource);
......
......@@ -105,10 +105,15 @@ QList<PackageState> FlatpakResource::addonsInformation()
QString FlatpakResource::availableVersion() const
{
if (!m_availableVersion.isEmpty()) {
if (m_availableVersion.isEmpty()) {
const auto releases = m_appdata.releases();
if (!releases.isEmpty()) {
m_availableVersion = releases.constFirst().version();
return m_availableVersion;
}
} else {
return m_availableVersion;
}
return branch();
}
......
......@@ -176,10 +176,6 @@ public:
QString attentionText() const;
QString dataLocation() const;
bool hasDataButUninstalled() const;
void setAvailableVersion(const QString &version)
{
m_availableVersion = version;
}
Q_INVOKABLE QAbstractListModel *permissionsModel();
void setTemporarySource(const QSharedPointer<FlatpakSource> &temp)
......@@ -230,7 +226,7 @@ private:
FlatpakInstallation *const m_installation;
QString m_origin;
QString m_displayOrigin;
QString m_availableVersion;
mutable QString m_availableVersion;
FlatpakResource::ResourceType m_type = DesktopApp;
QSharedPointer<FlatpakSource> m_temp;
QVector<FlatpakPermission> m_permissions;
......
Supports Markdown
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