diff --git a/kcms/desktoptheme/kcm.h b/kcms/desktoptheme/kcm.h --- a/kcms/desktoptheme/kcm.h +++ b/kcms/desktoptheme/kcm.h @@ -55,6 +55,7 @@ PluginNameRole = Qt::UserRole + 1, ThemeNameRole, DescriptionRole, + FollowsSystemColorsRole, IsLocalRole, PendingDeletionRole }; diff --git a/kcms/desktoptheme/kcm.cpp b/kcms/desktoptheme/kcm.cpp --- a/kcms/desktoptheme/kcm.cpp +++ b/kcms/desktoptheme/kcm.cpp @@ -68,6 +68,7 @@ roles[PluginNameRole] = QByteArrayLiteral("pluginName"); roles[ThemeNameRole] = QByteArrayLiteral("themeName"); roles[DescriptionRole] = QByteArrayLiteral("description"); + roles[FollowsSystemColorsRole] = QByteArrayLiteral("followsSystemColors"); roles[IsLocalRole] = QByteArrayLiteral("isLocal"); roles[PendingDeletionRole] = QByteArrayLiteral("pendingDeletion"); m_model->setItemRoleNames(roles); @@ -258,13 +259,16 @@ name = packageName; } const bool isLocal = QFileInfo(theme).isWritable(); + // Plasma Theme creates a KColorScheme out of the "color" file and falls back to system colors if there is none + const bool followsSystemColors = !QFileInfo::exists(themeRoot + QLatin1String("/colors")); if (m_model->findItems(packageName).isEmpty()) { QStandardItem *item = new QStandardItem; item->setText(packageName); item->setData(packageName, PluginNameRole); item->setData(name, ThemeNameRole); item->setData(df.readComment(), DescriptionRole); + item->setData(followsSystemColors, FollowsSystemColorsRole); item->setData(isLocal, IsLocalRole); item->setData(false, PendingDeletionRole); m_model->appendRow(item); diff --git a/kcms/desktoptheme/package/contents/ui/ThemePreview.qml b/kcms/desktoptheme/package/contents/ui/ThemePreview.qml --- a/kcms/desktoptheme/package/contents/ui/ThemePreview.qml +++ b/kcms/desktoptheme/package/contents/ui/ThemePreview.qml @@ -17,6 +17,7 @@ */ import QtQuick 2.4 import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.5 as QQC2 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kirigami 2.4 as Kirigami import org.kde.plasma.components 2.0 as PlasmaComponents @@ -52,6 +53,7 @@ RowLayout { id: contents + spacing: 0 anchors { fill: parent topMargin: background.generalMargin @@ -84,16 +86,13 @@ } } - Item { - Layout.fillWidth: true - } - // Analog clock Item { id: clock Layout.fillHeight: true + Layout.fillWidth: true Layout.preferredWidth: height - + Layout.alignment: Qt.AlignHCenter property int hours: 9 property int minutes: 5 @@ -177,6 +176,13 @@ height: naturalSize.height * clock.svgScale } } + Kirigami.Icon { + visible: model.followsSystemColors + source: "color-profile" + width: Kirigami.Units.iconSizes.smallMedium + height: width + Layout.alignment: Qt.AlignRight && Qt.AlignTop + } } Component.onCompleted: { diff --git a/kcms/desktoptheme/package/contents/ui/main.qml b/kcms/desktoptheme/package/contents/ui/main.qml --- a/kcms/desktoptheme/package/contents/ui/main.qml +++ b/kcms/desktoptheme/package/contents/ui/main.qml @@ -49,6 +49,7 @@ id: delegate text: model.themeName + subtitle: model.followsSystemColors ? i18n("Follows color scheme") : undefined toolTip: model.description || model.themeName opacity: model.pendingDeletion ? 0.3 : 1