[plasma/ksystemstats] plugins/osinfo: osinfo: Provide some fallbacks for the version property
David Redondo <[email protected]> Wed, 5 Aug 2026 07:33:43 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 6cef3eb77c09cb424a44b83eb961884ed5d6fb29 by David Redondo.
Committed on 04/08/2026 at 15:34.
Pushed by davidre into branch 'master'.
osinfo: Provide some fallbacks for the version property
depending on the OS, diferent set of keys can be set.
BUG:523727
M +11 -1 plugins/osinfo/osinfo.cpp
https://invent.kde.org/plasma/ksystemstats/-/commit/6cef3eb77c09cb424a44b83eb961884ed5d6fb29
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());