[plasma/ksystemstats/Plasma/6.7] plugins/osinfo: osinfo: Provide some fallbacks for the version property
David Redondo <[email protected]> Wed, 5 Aug 2026 12:06:23 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 320421ab382ef045d3785d973921f5356ad79845 by David Redondo. Committed on 05/08/2026 at 12:02. Pushed by davidre into branch 'Plasma/6.7'. osinfo: Provide some fallbacks for the version property depending on the OS, diferent set of keys can be set. BUG:523727 (cherry picked from commit 6cef3eb77c09cb424a44b83eb961884ed5d6fb29) Co-authored-by: David Redondo <[email protected]> M +11 -1 plugins/osinfo/osinfo.cpp https://invent.kde.org/plasma/ksystemstats/-/commit/320421ab382ef045d3785d973921f5356ad79845 diff --git a/plugins/osinfo/osinfo.cpp b/plugins/osinfo/osinfo.cpp index b6d6f32..97672c2 100644 --- a/plugins/osinfo/osinfo.cpp +++ b/plugins/osinfo/osinfo.cpp @@ -27,6 +27,8 @@ #include "debug.h" +using namespace Qt::StringLiterals; + // Uppercase the first letter of each word. QString upperCaseFirst(const QString &input) { @@ -143,7 +145,15 @@ void OSInfoPrivate::init() KOSRelease os; osNameProperty->setValue(os.name()); - osVersionProperty->setValue(os.version()); + if (auto version = os.version(); !version.isEmpty()) { + osVersionProperty->setValue(version); + } else if (auto versionId = os.versionId(); !versionId.isEmpty()) { + osVersionProperty->setValue(versionId); + } else if (auto versionCodeName = os.versionCodename(); !versionCodeName.isEmpty()) { + osVersionProperty->setValue(versionCodeName); + } else if (auto imageVersion = os.extraValue(u"IMAGE_VERSION"_s); !imageVersion.isEmpty()) { + osVersionProperty->setValue(imageVersion); + } osPrettyNameProperty->setValue(os.prettyName()); osLogoProperty->setValue(os.logo()); osUrlProperty->setValue(os.homeUrl());