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

pk: Fix distro eol message

Use KOSRelease::versionId() to compare versions, ::version() does have
non-numerical values in Fedora (it says "35 (KDE Plasma)").

Pass the type as an int, the enum isn't being decoded properly by QML.
parent 98bf69b5
Pipeline #146581 passed with stage
in 1 minute and 50 seconds
......@@ -229,10 +229,14 @@ void PackageKitBackend::reloadPackageList()
acquireFetching(false);
const QList<AppStream::Component> distroComponents = m_appdata->componentsById(AppStream::Utils::currentDistroComponentId());
if (distroComponents.isEmpty()) {
qWarning() << "no component found for" << AppStream::Utils::currentDistroComponentId();
}
for (const AppStream::Component &dc : distroComponents) {
const auto releases = dc.releases();
for (auto r : releases) {
if (AppStream::Utils::vercmpSimple(r.version(), AppStreamIntegration::global()->osRelease()->version()) == 0) {
int cmp = AppStream::Utils::vercmpSimple(r.version(), AppStreamIntegration::global()->osRelease()->versionId());
if (cmp == 0) {
if (r.timestampEol() < QDateTime::currentDateTime()) {
const QString releaseDate = QLocale().toString(r.timestampEol());
Q_EMIT inlineMessage(InlineMessageType::Warning,
......
......@@ -59,7 +59,7 @@ private:
};
// Keep in sync with Kirigami's enums.h
enum class InlineMessageType {
enum InlineMessageType {
Information = 0,
Positive,
Warning,
......
......@@ -134,7 +134,7 @@ Q_SIGNALS:
void passiveMessage(const QString &message);
void currentApplicationBackendChanged(AbstractResourcesBackend *currentApplicationBackend);
void fetchingUpdatesProgressChanged(int fetchingUpdatesProgress);
void inlineMessage(InlineMessageType type, const QString &iconName, const QString &message);
void inlineMessage(int type, const QString &iconName, const QString &message);
private Q_SLOTS:
void callerFetchingChanged();
......
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