kiran-control-panel/0002-fix-icon-add-KiranNew-icon-selector-in-ui.patch
liuxinhao 1e2c7f1a55 fix(launcher): compatible with older versions, launch plugins separately, and pull up the control center
- launcher已不再提供单独拉起插件的功能,兼容老版本接口单独启动插件,生成命令,拉起控制中心

Closes #3565
2023-04-28 11:51:38 +08:00

95 lines
4.0 KiB
Diff

From 141c91b449bb0c4b90b30b48cb36756e8c4b6ced Mon Sep 17 00:00:00 2001
From: yuanxing <yuanxing@kylinsec.com.cn>
Date: Thu, 13 Apr 2023 14:32:36 +0800
Subject: [PATCH 2/6] fix(icon):add KiranNew icon selector in ui
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在界面中添加KiranNew图标主题选择控件
---
.../pages/theme/icon-themes/icon-themes.cpp | 53 ++++++++++++++++++-
1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp b/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp
index 6e6f614..7dd60ac 100644
--- a/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp
+++ b/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp
@@ -39,6 +39,14 @@ static QStringList icons{"accessories-calculator",
"user-info",
"preferences-desktop-wallpaper"};
+static QStringList kiranNewIcons{"kc-calculator",
+ "smplayer",
+ "firefox",
+ "thunderbird",
+ "utilities-terminal",
+ "brasero",
+ "accessories-text-editor"};
+
IconThemes::IconThemes(QWidget *parent) : QWidget(parent),
ui(new Ui::IconThemes)
{
@@ -167,7 +175,7 @@ void IconThemes::createIconWidgets()
for (int i = 0; i < m_iconThemes.size(); i++)
{
- if (m_iconThemes.at(i).startsWith("Kiran", Qt::CaseInsensitive))
+ if (!m_iconThemes.at(i).compare("Kiran", Qt::CaseInsensitive))
{
QString path = m_iconThemesPath.at(i) + "/apps/scalable/";
QDir appsDir = QDir(path);
@@ -208,7 +216,48 @@ void IconThemes::createIconWidgets()
else
continue;
}
- else if (m_iconThemes.at(i).startsWith("Adwaita", Qt::CaseInsensitive))
+ else if (!m_iconThemes.at(i).compare("KiranNew", Qt::CaseInsensitive))
+ {
+ QString path = m_iconThemesPath.at(i) + "/48x48/apps/";
+ QDir appsDir = QDir(path);
+ QStringList iconList = appsDir.entryList(QDir::Files);
+ QStringList showIconsList;
+ if (appsDir.exists())
+ {
+ for (int i = 0; i < kiranNewIcons.size(); i++)
+ {
+ if (iconList.contains(kiranNewIcons.at(i) + ".png"))
+ showIconsList.append(path + kiranNewIcons.at(i) + ".png");
+ else
+ {
+ KLOG_INFO() << "not contain " << kiranNewIcons.at(i);
+ foreach (QString icon, iconList)
+ {
+ if (icon.startsWith(kiranNewIcons.at(i)))
+ {
+ showIconsList.append(path + icon);
+ break;
+ }
+ }
+ }
+ }
+ if (!showIconsList.isEmpty())
+ {
+ //new theme-widget
+ ThemeWidget *themeWidget = new ThemeWidget(QSize(40, 40), m_currentIconTheme,
+ m_iconThemes.at(i), showIconsList);
+ vLayout->addWidget(themeWidget, Qt::AlignRight);
+
+ if (m_iconThemes.at(i) == m_currentIconTheme)
+ m_iconThemeWidgetGroup->setCurrentWidget(themeWidget);
+ m_iconThemeWidgetGroup->addWidget(themeWidget);
+ themeWidget->setTheme(m_iconThemes.at(i));
+ }
+ }
+ else
+ continue;
+ }
+ else if (!m_iconThemes.at(i).compare("Adwaita", Qt::CaseInsensitive))
{
QString path = m_iconThemesPath.at(i) + "/48x48/apps/";
QDir appsDir = QDir(path);
--
2.33.0