Commit 162fedf9 authored by Nate Graham's avatar Nate Graham
Browse files

Show correct installed version number for fwupd updates



Currently we are simply re-using the version of the available update as
the installed version; instead we should set the installed version to
be the version of the currently-installed thing.

co-authored-by: Aleix Pol Gonzalez's avatarAleix Pol i Gonzalez <aleixpol@kde.org>

BUG: 411186
FIXED-IN: 5.25.5
parent 8d097168
Pipeline #223238 passed with stage
in 1 minute and 13 seconds
......@@ -128,6 +128,13 @@ void FwupdBackend::addUpdates()
}
}
res->setDescription(longdescription);
// Make sure to set the installed version of the current thing so
// they can both be shown in the update page UI
auto installedResource = m_resources[res->packageName()];
if (installedResource) {
res->setInstalledVersion(installedResource->availableVersion());
}
addResource(res);
}
} else {
......
......@@ -32,7 +32,7 @@ FwupdResource::FwupdResource(FwupdDevice *device, const QString &id, AbstractRes
QString FwupdResource::availableVersion() const
{
return m_version;
return m_availableVersion;
}
QStringList FwupdResource::categories()
......@@ -77,7 +77,7 @@ QVariant FwupdResource::icon() const
QString FwupdResource::installedVersion() const
{
return m_version;
return m_installedVersion;
}
QJsonArray FwupdResource::licenses()
......@@ -157,7 +157,7 @@ void FwupdResource::setReleaseDetails(FwupdRelease *release)
m_summary = QString::fromUtf8(fwupd_release_get_summary(release));
m_vendor = QString::fromUtf8(fwupd_release_get_vendor(release));
m_size = fwupd_release_get_size(release);
m_version = QString::fromUtf8(fwupd_release_get_version(release));
m_availableVersion = QString::fromUtf8(fwupd_release_get_version(release));
m_description = QString::fromUtf8((fwupd_release_get_description(release)));
m_homepage = QUrl(QString::fromUtf8(fwupd_release_get_homepage(release)));
m_license = QString::fromUtf8(fwupd_release_get_license(release));
......@@ -181,7 +181,7 @@ void FwupdResource::setDeviceDetails(FwupdDevice *dev)
m_summary = QString::fromUtf8(fwupd_device_get_summary(dev));
m_vendor = QString::fromUtf8(fwupd_device_get_vendor(dev));
m_releaseDate = QDateTime::fromSecsSinceEpoch(fwupd_device_get_created(dev)).date();
m_version = QString::fromUtf8(fwupd_device_get_version(dev));
m_availableVersion = QString::fromUtf8(fwupd_device_get_version(dev));
m_description = QString::fromUtf8((fwupd_device_get_description(dev)));
if (fwupd_device_get_icons(dev)->len >= 1)
......
......@@ -75,6 +75,10 @@ public:
{
m_description = description;
}
void setInstalledVersion(const QString &version)
{
m_installedVersion = version;
}
void setState(AbstractResource::State state);
void setReleaseDetails(FwupdRelease *release);
......@@ -128,7 +132,8 @@ private:
const QString m_deviceID;
QString m_summary;
QString m_description;
QString m_version;
QString m_installedVersion;
QString m_availableVersion;
QString m_vendor;
QStringList m_categories;
QString m_license;
......
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