[plasma/union] src: Add a "hidden" flag to styles

Arjen Hiemstra <[email protected]> Wed, 5 Aug 2026 11:20:05 +0000 (UTC)
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 552e66351fed4190bfd7bb3cd780b6fa63c148cb by Arjen Hiemstra.
Committed on 05/08/2026 at 11:15.
Pushed by ahiemstra into branch 'master'.

Add a "hidden" flag to styles

For now it's a simple boolean that indicates whether or not a style
should be shown by default. This is mostly intended to hide "system"
styles that shouldn't be normally selectable such as
breeze-mobile/breeze-rtl.

M  +13   -0    src/StylePackage.cpp
M  +4    -0    src/StylePackage.h

https://invent.kde.org/plasma/union/-/commit/552e66351fed4190bfd7bb3cd780b6fa63c148cb

diff --git a/src/StylePackage.cpp b/src/StylePackage.cpp
index 2db46c7b..5788b5c0 100644
--- a/src/StylePackage.cpp
+++ b/src/StylePackage.cpp
@@ -23,6 +23,7 @@ struct StyleMetaData {
     QString license;
     QUrl url;
     QStringList authors;
+    bool hidden = false;
 };
 
 class UNION_NO_EXPORT StylePackage::Private
@@ -173,6 +174,17 @@ QStringList StylePackage::authors() const
     return {};
 }
 
+bool StylePackage::isHidden() const
+{
+    loadMetadata();
+
+    if (d->metaData) {
+        return d->metaData->hidden;
+    }
+
+    return false;
+}
+
 bool StylePackage::isValid() const
 {
     if (d->error != Error::None) {
@@ -273,6 +285,7 @@ void StylePackage::loadMetadata() const
     metaData.version = json.value(u"version").toString();
     metaData.license = json.value(u"license").toString();
     metaData.url = QUrl{json.value(u"url").toString()};
+    metaData.hidden = json.value(u"hidden").toBool();
 
     const auto authors = json.value(u"authors").toArray();
     std::ranges::transform(authors, std::back_inserter(metaData.authors), [](const QJsonValue &value) {
diff --git a/src/StylePackage.h b/src/StylePackage.h
index 6555f19e..0a826323 100644
--- a/src/StylePackage.h
+++ b/src/StylePackage.h
@@ -98,6 +98,10 @@ public:
      * This is just a list of author names.
      */
     QStringList authors() const;
+    /*!
+     * Returns if this package should be shown in listings of packages.
+     */
+    bool isHidden() const;
 
     /*!
      * Returns if the package is valid.