fix(plugins):Fix the issue of disabled plugins displaying in the side function bar classification;Fix the issue of user groups without icons in the side function bar

- 修复被禁用的插件在侧边功能栏分类中显示的问题
  修复用户组在侧边功能栏无图标的问题

Closes #69189
This commit is contained in:
luoqing 2023-05-09 14:00:35 +08:00
parent eed1ff4c61
commit e3708a4bba
8 changed files with 6 additions and 53349 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,94 +0,0 @@
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

View File

@ -1,84 +0,0 @@
From 4b93ca3e5b8eed92c1dfc4468780733ded46a886 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Mon, 17 Apr 2023 10:20:11 +0800
Subject: [PATCH 3/6] feature(options.cmake):Add compilation option switch,
whether to enable network, volume, and user group plugins
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 增加编译选项开关,是否开启网络、音量和用户组插件
---
CMakeLists.txt | 1 +
kcp_variables.cmake | 1 -
options.cmake | 3 +++
plugins/CMakeLists.txt | 10 ++++++++--
4 files changed, 12 insertions(+), 3 deletions(-)
create mode 100644 options.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d053430..a437b57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,7 @@ pkg_search_module(QGSETTINGS REQUIRED gsettings-qt)
include(kcp_variables.cmake)
include(kcp-qdbus-wrapper.cmake)
+include(options.cmake)
configure_file(${CMAKE_SOURCE_DIR}/data/config.h.in ${CMAKE_BINARY_DIR}/config.h)
configure_file(${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.desktop.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.desktop)
diff --git a/kcp_variables.cmake b/kcp_variables.cmake
index 0709a11..ae01d40 100644
--- a/kcp_variables.cmake
+++ b/kcp_variables.cmake
@@ -10,7 +10,6 @@ set(KCP_INSTALL_INCLUDE ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PR
set(SYSCONFDIR "/etc" CACHE PATH "Installation directory for configurations")
set(KCP_PLUGIN_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
-OPTION(ENABLE_USER_GROUP "Enable user group" OFF)
#根级分类安装路径
set(CATEGORY_INSTALL_DIR ${INSTALL_DATADIR}/${PROJECT_NAME}/category)
diff --git a/options.cmake b/options.cmake
new file mode 100644
index 0000000..1776e21
--- /dev/null
+++ b/options.cmake
@@ -0,0 +1,3 @@
+OPTION(ENABLE_USER_GROUP "Enable user group" OFF)
+OPTION(ENABLE_NETWORK "Enable network plugin" ON)
+OPTION(ENABLE_AUDIO "Enable audio plugin" ON)
\ No newline at end of file
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index a55e816..c471259 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -3,16 +3,22 @@ cmake_minimum_required(VERSION 3.2)
add_subdirectory(system)
add_subdirectory(power)
add_subdirectory(mouse)
-add_subdirectory(audio)
# add_subdirectory(greeter)
add_subdirectory(account)
add_subdirectory(keyboard)
add_subdirectory(timedate)
-add_subdirectory(network)
add_subdirectory(display)
add_subdirectory(keybinding)
add_subdirectory(appearance)
add_subdirectory(authentication)
+if(ENABLE_NETWORK)
+ add_subdirectory(network)
+endif()
+
+if(ENABLE_AUDIO)
+ add_subdirectory(audio)
+endif()
+
if(ENABLE_USER_GROUP)
add_subdirectory(group)
endif()
--
2.33.0

View File

@ -1,329 +0,0 @@
From 1c20cbda6f9dda373f77bbb5525b1ffd9ff9af13 Mon Sep 17 00:00:00 2001
From: yuanxing <yuanxing@kylinsec.com.cn>
Date: Sun, 23 Apr 2023 10:07:32 +0800
Subject: [PATCH 4/6] fix(*):Compatible for versions below 5.14
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 兼容5.14以下版本
去掉对 QPixmap pixmap(Qt::ReturnByValueConstant) 接口的使用
---
launcher/src/main.cpp | 6 +-
lib/plugin-framework/category.h | 3 +-
lib/plugin-framework/plugin-manager.cpp | 3 +-
plugins/appearance/src/appearance-subitem.h | 1 +
.../dbus-interface/appearance-global-info.cpp | 5 +-
plugins/appearance/src/pages/font/fonts.cpp | 136 +++++++++++++-----
plugins/authentication/src/auth-subitem.h | 2 +
plugins/keybinding/src/keycode-translator.cpp | 4 +
.../src/plugin/connection-itemwidget.cpp | 6 +-
plugins/network/src/tray/tray-itemwidget.cpp | 2 +-
10 files changed, 123 insertions(+), 45 deletions(-)
diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp
index eaeee99..1c6d6c6 100644
--- a/launcher/src/main.cpp
+++ b/launcher/src/main.cpp
@@ -60,7 +60,11 @@ int main(int argc, char *argv[])
QString lang = qgetenv("LANG");
if(lang.contains("."))
{
- QStringList splitRes = lang.split(".",Qt::SkipEmptyParts);
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+ QStringList splitRes = lang.split(".", QString::SkipEmptyParts);
+#else
+ QStringList splitRes = lang.split(".", Qt::SkipEmptyParts);
+#endif
if(splitRes.size() == 2 && splitRes.at(1)!="UTF-8" )
{
splitRes.replace(1,"UTF-8");
diff --git a/lib/plugin-framework/category.h b/lib/plugin-framework/category.h
index 1e48a64..723c601 100644
--- a/lib/plugin-framework/category.h
+++ b/lib/plugin-framework/category.h
@@ -17,6 +17,7 @@
#include <QMap>
#include <QObject>
#include <QReadWriteLock>
+#include <QVector>
#include "plugin-subitem-interface.h"
@@ -74,4 +75,4 @@ private:
QVector<KiranControlPanel::SubItemPtr> m_subitems;
// 维系子功能项ID和功能项之前的映射关键
QMap<QString, KiranControlPanel::SubItemPtr> m_subitemIDMap;
-};
\ No newline at end of file
+};
diff --git a/lib/plugin-framework/plugin-manager.cpp b/lib/plugin-framework/plugin-manager.cpp
index 4444a55..3a8c50b 100644
--- a/lib/plugin-framework/plugin-manager.cpp
+++ b/lib/plugin-framework/plugin-manager.cpp
@@ -15,6 +15,7 @@
#include "plugin-loader.h"
#include <QMutex>
+#include <QVector>
PluginManager* PluginManager::_instance = nullptr;
@@ -71,4 +72,4 @@ void PluginManager::dump()
QList<Plugin*> PluginManager::getPlugins()
{
return m_plugins;
-}
\ No newline at end of file
+}
diff --git a/plugins/appearance/src/appearance-subitem.h b/plugins/appearance/src/appearance-subitem.h
index bbec7d8..97b79f0 100644
--- a/plugins/appearance/src/appearance-subitem.h
+++ b/plugins/appearance/src/appearance-subitem.h
@@ -2,6 +2,7 @@
#define __APPEARANCE_SUBITEM_H__
#include <QObject>
+#include <QVector>
#include "panel-interface.h"
#include "plugin-subitem-interface.h"
diff --git a/plugins/appearance/src/dbus-interface/appearance-global-info.cpp b/plugins/appearance/src/dbus-interface/appearance-global-info.cpp
index ab033d6..6913197 100644
--- a/plugins/appearance/src/dbus-interface/appearance-global-info.cpp
+++ b/plugins/appearance/src/dbus-interface/appearance-global-info.cpp
@@ -206,8 +206,11 @@ bool AppearanceGlobalInfo::getFont(int type, QStringList &fontList)
fontInfo = reply.argumentAt(0).toString();
KLOG_INFO() << "Font type is: " << type
<< " Font info is:" << fontInfo;
-
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+ fontInfoList = fontInfo.split(" ", QString::SkipEmptyParts);
+#else
fontInfoList = fontInfo.split(" ", Qt::SkipEmptyParts);
+#endif
if (!fontInfoList.isEmpty())
{
fontSize = fontInfoList.takeLast();
diff --git a/plugins/appearance/src/pages/font/fonts.cpp b/plugins/appearance/src/pages/font/fonts.cpp
index 41c184e..65e1b82 100644
--- a/plugins/appearance/src/pages/font/fonts.cpp
+++ b/plugins/appearance/src/pages/font/fonts.cpp
@@ -150,42 +150,100 @@ void Fonts::connectSignals()
{
connect(AppearanceGlobalInfo::instance(), &AppearanceGlobalInfo::fontChanged, this, &Fonts::handleFontChanged);
- connect(ui->cbox_application_font_name, &QComboBox::textActivated, [=](QString text) {
- m_applicationFontInfo.replace(0, text);
- KLOG_INFO() << "select applicationFont name = " << m_applicationFontInfo.at(0);
- KLOG_INFO() << "select applicationFont size = " << m_applicationFontInfo.at(1);
- setFont(APPEARANCE_FONT_TYPE_APPLICATION, m_applicationFontInfo);
- });
- connect(ui->cbox_application_font_size, &QComboBox::textActivated, [=](QString text) {
- m_applicationFontInfo.replace(1, text);
- KLOG_INFO() << "select applicationFont name = " << m_applicationFontInfo.at(0);
- KLOG_INFO() << "select applicationFont size = " << m_applicationFontInfo.at(1);
- setFont(APPEARANCE_FONT_TYPE_APPLICATION, m_applicationFontInfo);
- });
- connect(ui->cbox_monospace_font_name, &QComboBox::textActivated, [=](QString text) {
- m_monospaceFontInfo.replace(0, text);
- KLOG_INFO() << "monospaceFontInfo name = " << m_monospaceFontInfo.at(0);
- KLOG_INFO() << "monospaceFontInfo size = " << m_monospaceFontInfo.at(1);
- setFont(APPEARANCE_FONT_TYPE_MONOSPACE, m_monospaceFontInfo);
- });
- connect(ui->cbox_monospace_font_size, &QComboBox::textActivated, [=](QString text) {
- m_monospaceFontInfo.replace(1, text);
- KLOG_INFO() << "monospaceFontInfo name = " << m_monospaceFontInfo.at(0);
- KLOG_INFO() << "monospaceFontInfo size = " << m_monospaceFontInfo.at(1);
- setFont(APPEARANCE_FONT_TYPE_MONOSPACE, m_monospaceFontInfo);
- });
- connect(ui->cbox_titlebar_font_name, &QComboBox::textActivated, [=](QString text) {
- m_windowTitleFontInfo.replace(0, text);
- KLOG_INFO() << "windowTitleFontInfo name = " << m_windowTitleFontInfo.at(0);
- KLOG_INFO() << "windowTitleFontInfo size = " << m_windowTitleFontInfo.at(1);
- setFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE, m_windowTitleFontInfo);
- });
- connect(ui->cbox_titlebar_font_size, &QComboBox::textActivated, [=](QString text) {
- m_windowTitleFontInfo.replace(1, text);
- KLOG_INFO() << "windowTitleFont name = " << m_windowTitleFontInfo.at(0);
- KLOG_INFO() << "windowTitleFont size = " << m_windowTitleFontInfo.at(1);
- setFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE, m_windowTitleFontInfo);
- });
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ connect(ui->cbox_application_font_name, &QComboBox::textActivated, [=](QString text)
+ {
+ m_applicationFontInfo.replace(0, text);
+ KLOG_INFO() << "select applicationFont name = " << m_applicationFontInfo.at(0);
+ KLOG_INFO() << "select applicationFont size = " << m_applicationFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_APPLICATION, m_applicationFontInfo);
+ });
+ connect(ui->cbox_application_font_size, &QComboBox::textActivated, [=](QString text)
+ {
+ m_applicationFontInfo.replace(1, text);
+ KLOG_INFO() << "select applicationFont name = " << m_applicationFontInfo.at(0);
+ KLOG_INFO() << "select applicationFont size = " << m_applicationFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_APPLICATION, m_applicationFontInfo);
+ });
+ connect(ui->cbox_monospace_font_name, &QComboBox::textActivated, [=](QString text)
+ {
+ m_monospaceFontInfo.replace(0, text);
+ KLOG_INFO() << "monospaceFontInfo name = " << m_monospaceFontInfo.at(0);
+ KLOG_INFO() << "monospaceFontInfo size = " << m_monospaceFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_MONOSPACE, m_monospaceFontInfo);
+ });
+ connect(ui->cbox_monospace_font_size, &QComboBox::textActivated, [=](QString text)
+ {
+ m_monospaceFontInfo.replace(1, text);
+ KLOG_INFO() << "monospaceFontInfo name = " << m_monospaceFontInfo.at(0);
+ KLOG_INFO() << "monospaceFontInfo size = " << m_monospaceFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_MONOSPACE, m_monospaceFontInfo);
+ });
+ connect(ui->cbox_titlebar_font_name, &QComboBox::textActivated, [=](QString text)
+ {
+ m_windowTitleFontInfo.replace(0, text);
+ KLOG_INFO() << "windowTitleFontInfo name = " << m_windowTitleFontInfo.at(0);
+ KLOG_INFO() << "windowTitleFontInfo size = " << m_windowTitleFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE, m_windowTitleFontInfo);
+ });
+ connect(ui->cbox_titlebar_font_size, &QComboBox::textActivated, [=](QString text)
+ {
+ m_windowTitleFontInfo.replace(1, text);
+ KLOG_INFO() << "windowTitleFont name = " << m_windowTitleFontInfo.at(0);
+ KLOG_INFO() << "windowTitleFont size = " << m_windowTitleFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE, m_windowTitleFontInfo);
+ });
+#else
+ connect(ui->cbox_application_font_name, QOverload<const QString &>::of(&QComboBox::activated),
+ [=](const QString text)
+ {
+ m_applicationFontInfo.replace(0, text);
+ KLOG_INFO() << "select applicationFont name = " << m_applicationFontInfo.at(0);
+ KLOG_INFO() << "select applicationFont size = " << m_applicationFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_APPLICATION, m_applicationFontInfo);
+ });
+ connect(ui->cbox_application_font_size, QOverload<const QString &>::of(&QComboBox::activated),
+ [=](const QString text)
+ {
+ m_applicationFontInfo.replace(1, text);
+ KLOG_INFO() << "select applicationFont name = " << m_applicationFontInfo.at(0);
+ KLOG_INFO() << "select applicationFont size = " << m_applicationFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_APPLICATION, m_applicationFontInfo);
+ });
+ connect(ui->cbox_monospace_font_name, QOverload<const QString &>::of(&QComboBox::activated),
+ [=](const QString text)
+ {
+ m_monospaceFontInfo.replace(0, text);
+ KLOG_INFO() << "monospaceFontInfo name = " << m_monospaceFontInfo.at(0);
+ KLOG_INFO() << "monospaceFontInfo size = " << m_monospaceFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_MONOSPACE, m_monospaceFontInfo);
+
+ });
+ connect(ui->cbox_monospace_font_size, QOverload<const QString &>::of(&QComboBox::activated),
+ [=](const QString text)
+ {
+ m_monospaceFontInfo.replace(1, text);
+ KLOG_INFO() << "monospaceFontInfo name = " << m_monospaceFontInfo.at(0);
+ KLOG_INFO() << "monospaceFontInfo size = " << m_monospaceFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_MONOSPACE, m_monospaceFontInfo);
+ });
+ connect(ui->cbox_titlebar_font_name, QOverload<const QString &>::of(&QComboBox::activated),
+ [=](const QString text)
+ {
+ m_windowTitleFontInfo.replace(0, text);
+ KLOG_INFO() << "windowTitleFontInfo name = " << m_windowTitleFontInfo.at(0);
+ KLOG_INFO() << "windowTitleFontInfo size = " << m_windowTitleFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE, m_windowTitleFontInfo);
+ });
+ connect(ui->cbox_titlebar_font_size, QOverload<const QString &>::of(&QComboBox::activated),
+ [=](const QString text)
+ {
+ m_windowTitleFontInfo.replace(1, text);
+ KLOG_INFO() << "windowTitleFont name = " << m_windowTitleFontInfo.at(0);
+ KLOG_INFO() << "windowTitleFont size = " << m_windowTitleFontInfo.at(1);
+ setFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE, m_windowTitleFontInfo);
+ });
+#endif
}
void Fonts::showFontInfo(QComboBox* nameParent, QComboBox* sizeParent, QString name, QString size)
@@ -222,7 +280,11 @@ void Fonts::showFontInfo(QComboBox* nameParent, QComboBox* sizeParent, QString n
void Fonts::handleFontChanged(int type, QString fontInfo)
{
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+ QStringList fontInfoList = fontInfo.split(" ", QString::SkipEmptyParts);
+#else
QStringList fontInfoList = fontInfo.split(" ", Qt::SkipEmptyParts);
+#endif
QString fontSize = fontInfoList.takeLast();
QString fontName = fontInfoList.join(" ");
KLOG_INFO() << "font changed : " << type << ",name: " << fontName << ",size: " << fontSize;
@@ -267,5 +329,5 @@ void Fonts::handleFontChanged(int type, QString fontInfo)
QSize Fonts::sizeHint() const
{
- return {500,657};
+ return {500, 657};
}
diff --git a/plugins/authentication/src/auth-subitem.h b/plugins/authentication/src/auth-subitem.h
index e09a3c8..3aa7f1f 100644
--- a/plugins/authentication/src/auth-subitem.h
+++ b/plugins/authentication/src/auth-subitem.h
@@ -1,6 +1,8 @@
#pragma once
#include <QObject>
+#include <functional>
+#include <QVector>
#include "panel-interface.h"
#include "plugin-subitem-interface.h"
diff --git a/plugins/keybinding/src/keycode-translator.cpp b/plugins/keybinding/src/keycode-translator.cpp
index c75ee07..f692fef 100644
--- a/plugins/keybinding/src/keycode-translator.cpp
+++ b/plugins/keybinding/src/keycode-translator.cpp
@@ -146,7 +146,11 @@ QString KeycodeTranslator::backendKeyString2Readable(const QString &keyString)
QString temp = keyString;
temp = temp.replace("<","");
temp = temp.replace(">","-");
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+ QStringList keyList = temp.split("-", QString::SkipEmptyParts);
+#else
QStringList keyList = temp.split("-",Qt::SkipEmptyParts);
+#endif
for(int i=0;i<keyList.size();i++)
{
if( SpecialKeyMap.contains(keyList.at(i).toLower()) )
diff --git a/plugins/network/src/plugin/connection-itemwidget.cpp b/plugins/network/src/plugin/connection-itemwidget.cpp
index 57503f7..6735e7b 100644
--- a/plugins/network/src/plugin/connection-itemwidget.cpp
+++ b/plugins/network/src/plugin/connection-itemwidget.cpp
@@ -168,9 +168,9 @@ void ConnectionItemWidget::setOtherNetworkIcon()
void ConnectionItemWidget::handleThemeChanged(Kiran::PaletteType paletteType)
{
- QPixmap pixmap = NetworkUtils::trayIconColorSwitch(m_connectionTypeIcon->pixmap(Qt::ReturnByValue));
- if (!pixmap.isNull())
- m_connectionTypeIcon->setPixmap(pixmap);
+ QImage image = m_connectionTypeIcon->pixmap()->toImage();
+ image.invertPixels(QImage::InvertRgb);
+ m_connectionTypeIcon->setPixmap(QPixmap::fromImage(image));
m_editButton->setIcon(NetworkUtils::trayIconColorSwitch(":/kcp-network-images/details-info.svg"));
}
diff --git a/plugins/network/src/tray/tray-itemwidget.cpp b/plugins/network/src/tray/tray-itemwidget.cpp
index 2f85842..19c79af 100644
--- a/plugins/network/src/tray/tray-itemwidget.cpp
+++ b/plugins/network/src/tray/tray-itemwidget.cpp
@@ -297,7 +297,7 @@ void TrayItemWidget::paintEvent(QPaintEvent *event)
void TrayItemWidget::handleThemeChanged(Kiran::PaletteType paletteType)
{
- QImage image = ui->connectionTypeIcon->pixmap(Qt::ReturnByValue).toImage();
+ QImage image = ui->connectionTypeIcon->pixmap()->toImage();
image.invertPixels(QImage::InvertRgb);
QPixmap pixmap = QPixmap::fromImage(image);
ui->connectionTypeIcon->setPixmap(pixmap);
--
2.33.0

View File

@ -1,68 +0,0 @@
From 20bce602db4eae6cb6d21429054916dbc8393113 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Wed, 26 Apr 2023 14:12:21 +0800
Subject: [PATCH 5/6] fix(network):Fix the issue of ineffective cloning of MAC
addresses after saving the network settings of the control center, and then
modify and clear them. It is also compatible with the lower version of kf5
networkmanager qt5
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复控制中心网络设置克隆MAC地址设置保存之后,再修改清空清空克隆MAC地址不生效的问题同时兼容低版本的kf5-networkmanager-qt5
---
.../plugin/setting-widget/ethernet-widget.cpp | 2 +-
.../src/plugin/settings/setting-page.cpp | 23 +++++++++++++++++--
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
index 9d5dfe7..7e09a54 100644
--- a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
+++ b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
@@ -104,7 +104,7 @@ void EthernetWidget::saveSettings()
* Note that this property only exists in D-Bus API.
* libnm and nmcli continue to call this property "cloned-mac-address".
*/
- m_wiredSetting->setAssignedMacAddress(QString());
+ // m_wiredSetting->setAssignedMacAddress(QString());
m_wiredSetting->setClonedMacAddress(QByteArray());
}
else
diff --git a/plugins/network/src/plugin/settings/setting-page.cpp b/plugins/network/src/plugin/settings/setting-page.cpp
index 464e646..3aa9201 100644
--- a/plugins/network/src/plugin/settings/setting-page.cpp
+++ b/plugins/network/src/plugin/settings/setting-page.cpp
@@ -96,9 +96,28 @@ void SettingPage::handleSaveButtonClicked(ConnectionSettings::ConnectionType con
else
{
saveSettingPage();
- //只有无线网络使用自定义settingUpdated信号因为未连接无线网络前不存在本地Setting无法在初始化时监听信号
+ // 只有无线网络使用自定义settingUpdated信号因为未连接无线网络前不存在本地Setting无法在初始化时监听信号
connect(m_connection.data(), &NetworkManager::Connection::updated, this, &SettingPage::settingUpdated, Qt::UniqueConnection);
- QDBusPendingReply<> replyUpdate = m_connection->update(m_connectionSettings->toMap());
+ /**
+ * NOTE:
+ * 这里是为了修复控制中心网络设置克隆MAC地址设置保存之后,再修改清空清空克隆MAC地址不生效的问题同时兼容低版本的kf5-networkmanager-qt5
+ * 问题原因高版本的NetworkManager成功设置克隆MAC地址后会有两个属性assigned-mac-addres (新属性)cloned-mac-address(即将被废弃)
+ * 两个属性作用是一样的低版本的kf5-networkmanager-qt5只有对cloned-mac-address(即将被废弃)进行设置的接口,
+ * 无法对assigned-mac-addres(新属性)进行操作。需要将这个两个属性都清空才能清空克隆MAC地址
+ * 因此这里手动将assigned-mac-addres相关的设置进行清空。
+ */
+ NMVariantMapMap settingsMap = m_connectionSettings->toMap();
+ if (settingsMap.contains("802-3-ethernet"))
+ {
+ QVariantMap varMap = settingsMap.value("802-3-ethernet");
+ if (!varMap.contains("cloned-mac-address") && varMap.contains("assigned-mac-address"))
+ {
+ varMap.remove("assigned-mac-address");
+ settingsMap.insert("802-3-ethernet", varMap);
+ }
+ }
+
+ QDBusPendingReply<> replyUpdate = m_connection->update(settingsMap);
replyUpdate.waitForFinished();
if (replyUpdate.isError())
{
--
2.33.0

View File

@ -1,176 +0,0 @@
From 7325100bfd5e40e4904178870a2d9de09296f33a Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Thu, 27 Apr 2023 14:49:22 +0800
Subject: [PATCH 6/6] fix(launcher): compatible with older versions, launch
plugins separately, and pull up the control center
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- launcher已不再提供单独拉起插件的功能兼容老版本接口单独启动插件生成命令拉起控制中心。
---
launcher/src/main.cpp | 88 ++++++++++++++++++++++++-------------------
1 file changed, 50 insertions(+), 38 deletions(-)
diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp
index 1c6d6c6..2e5905a 100644
--- a/launcher/src/main.cpp
+++ b/launcher/src/main.cpp
@@ -16,30 +16,36 @@
#include "launcher.h"
#include "plugin-v1-subitem-wrapper.h"
#include "plugin-v1.h"
+#include "plugin-v2.h"
#include <kiran-single-application.h>
+#include <locale.h>
#include <qt5-log-i.h>
#include <QCommandLineParser>
#include <QDesktopWidget>
#include <QEvent>
#include <QIcon>
#include <QLayout>
+#include <QProcess>
#include <QLoggingCategory>
+#include <QScreen>
+#include <QStyleFactory>
#include <QTranslator>
#include <iostream>
-#include <locale.h>
-#include <QStyleFactory>
-#include <QScreen>
-int main(int argc, char *argv[])
+// NOTE:
+// 2.4版本之后kiran-cpanel-launcher已不提供单独启动控制中心插件的功能
+// 保留launcher只是为了兼容转发拉起控制中心
+
+int main(int argc, char* argv[])
{
- ///先将插件选项从参数中提取出来,作为校验进程单例的一部分
+ /// 先将插件选项从参数中提取出来,作为校验进程单例的一部分
QStringList arguments;
for (int i = 0; i < argc; i++)
{
arguments << argv[i];
}
- QString pluginDesktopName;
+ QString pluginName;
QCommandLineOption pluginOption("cpanel-plugin", "plugin desktop filename", "plugin", "");
QCommandLineParser parser;
parser.setApplicationDescription("kiran control panel module runalone");
@@ -48,17 +54,18 @@ int main(int argc, char *argv[])
parser.parse(arguments);
if (parser.isSet(pluginOption))
{
- pluginDesktopName = parser.value(pluginOption);
- KiranSingleApplication::addApplicationIDUserData(pluginDesktopName);
+ pluginName = parser.value(pluginOption);
+ KiranSingleApplication::addApplicationIDUserData(pluginName);
}
- KiranSingleApplication app(argc, argv,false,
- KiranSingleApplication::Mode::User|KiranSingleApplication::Mode::SecondaryNotification);
+ KiranSingleApplication app(argc, argv, false,
+ KiranSingleApplication::Mode::User |
+ KiranSingleApplication::Mode::SecondaryNotification);
- ///NOTE: 由于strftime获取系统locale进行格式化Qt使用UTF8,若编码设置不为UTF8中文环境下会导致乱码
- ///所以LANG后面的编码若不为UTF-8,修改成UTF-8,使获取时间都为UTF-8格式
+ /// NOTE: 由于strftime获取系统locale进行格式化Qt使用UTF8,若编码设置不为UTF8中文环境下会导致乱码
+ /// 所以LANG后面的编码若不为UTF-8,修改成UTF-8,使获取时间都为UTF-8格式
QString lang = qgetenv("LANG");
- if(lang.contains("."))
+ if (lang.contains("."))
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList splitRes = lang.split(".", QString::SkipEmptyParts);
@@ -67,20 +74,20 @@ int main(int argc, char *argv[])
#endif
if(splitRes.size() == 2 && splitRes.at(1)!="UTF-8" )
{
- splitRes.replace(1,"UTF-8");
+ splitRes.replace(1, "UTF-8");
QString newLocale = splitRes.join(".");
- setlocale(LC_TIME,newLocale.toStdString().c_str());
+ setlocale(LC_TIME, newLocale.toStdString().c_str());
}
}
- //为了保持插件使用启动器进行启动后,底部面板不堆叠,插件图标显示正常,
- //设置ApplicationName,更新窗口WM_CLASS属性为插件desktop名称
- if( !pluginDesktopName.isEmpty() )
+ // 为了保持插件使用启动器进行启动后,底部面板不堆叠,插件图标显示正常,
+ // 设置ApplicationName,更新窗口WM_CLASS属性为插件desktop名称
+ if (!pluginName.isEmpty())
{
- QApplication::setApplicationName(pluginDesktopName);
+ QApplication::setApplicationName(pluginName);
}
- ///再次解析命令行参数是为了处理--help选项得到正确的输出
+ /// 再次解析命令行参数是为了处理--help选项得到正确的输出
parser.addHelpOption();
parser.process(app);
@@ -100,34 +107,39 @@ int main(int argc, char *argv[])
KLOG_ERROR() << "can't load translator!" << qmFile;
}
- QString pluginDesktopPath = QString("%1/%2").arg(PLUGIN_DESKTOP_DIR).arg(pluginDesktopName);
+ QVector<KiranControlPanel::SubItemPtr> pluginSubItems;
+
+
+ //兼容两个版本
+ // plugin v1接口通过desktop文件拿到信息再找so
+ QString pluginDesktopPath = QString("%1/%2").arg(PLUGIN_DESKTOP_DIR).arg(pluginName);
if (!pluginDesktopPath.endsWith(".desktop"))
{
pluginDesktopPath.append(".desktop");
}
- if (klog_qt5_init("", "kylinsec-session","kiran-cpanel-launcher", pluginDesktopName) != 0)
+ // plugin v2接口直接加载so读取信息
+ QString pluginV2LibraryPath = QString("%1/lib%2.so").arg(PLUGIN_LIBRARY_DIR).arg(pluginName);
+
+ PluginV1 plugin;
+ PluginV2 pluginV2;
+ if (plugin.load(pluginDesktopPath))
{
- KLOG_CERR("kiran log init error");
+ pluginSubItems = plugin.getSubItems();
+ }
+ else if (pluginV2.load(pluginV2LibraryPath))
+ {
+ pluginSubItems = pluginV2.getSubItems();
}
- PluginV1 plugin;
- if (!plugin.load(pluginDesktopPath))
+
+ if( pluginSubItems.isEmpty() )
{
exit(EXIT_FAILURE);
}
- Launcher w;
- w.setTitle(plugin.getName());
- QIcon titleIcon = QIcon::fromTheme(plugin.getIcon());
- w.setIcon(titleIcon);
- w.setSubItems(plugin.getSubItems());
- w.resize(w.sizeHint());
-
- QScreen* screen = QApplication::screenAt(QCursor::pos());
- QRect screenGeometry = screen->geometry();
- w.move(screenGeometry.x() + (screenGeometry.width() - w.width()) / 2,
- screenGeometry.y() + (screenGeometry.height() - w.height()) / 2);
- w.show();
- return KiranApplication::exec();
+ auto category = pluginSubItems.at(0)->getCategory();
+ auto subitemName = pluginSubItems.at(0)->getName();
+ QString cmdline = QString("kiran-control-panel -c %1 -s %2").arg(category).arg(subitemName);
+ return QProcess::startDetached(cmdline);
}
--
2.33.0

View File

@ -1,18 +1,12 @@
Name: kiran-control-panel
Version: 2.5.0
Release: 8
Version: 2.5.1
Release: 1
Summary: Kiran Control Panel
Summary(zh_CN): Kiran桌面控制面板
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-translate-add-some-translation.patch
Patch0002: 0002-fix-icon-add-KiranNew-icon-selector-in-ui.patch
Patch0003: 0003-feature-options.cmake-Add-compilation-option-switch-.patch
Patch0004: 0004-fix-Compatible-for-versions-below-5.14.patch
Patch0005: 0005-fix-network-Fix-the-issue-of-ineffective-cloning-of-.patch
Patch0006: 0006-fix-launcher-compatible-with-older-versions-launch-p.patch
BuildRequires: gcc-c++
BuildRequires: cmake >= 3.2
@ -162,6 +156,10 @@ make %{?_smp_mflags}
rm -rf %{buildroot}
%changelog
* Tue May 09 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.1-1
- KYOS-F: Fix the issue of disabled plugins displaying in the side function bar classification
- KYOS-F: Fix the issue of user groups without icons in the side function bar(#69189)
* Fri Apr 28 2023 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.5.0-8
- KYOS-F: compatible with older versions, launch plugins separately, and pull up the control center(#3565)