!70 launcher已不再提供单独拉起插件的功能,兼容老版本接口单独启动插件,生成命令,拉起控制中心
From: @liubuguiii Reviewed-by: @tangjie02 Signed-off-by: @tangjie02
This commit is contained in:
commit
eed1ff4c61
@ -1,7 +1,7 @@
|
||||
From e2344f8e42bdf83d99062f03e44b6ec719af1487 Mon Sep 17 00:00:00 2001
|
||||
From: wangyucheng <wangyucheng@kylinsec.com.cn>
|
||||
Date: Mon, 27 Mar 2023 16:56:40 +0800
|
||||
Subject: [PATCH] fix(translate):add some translation
|
||||
Subject: [PATCH 1/6] fix(translate):add some translation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
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 1/2] fix(icon):add KiranNew icon selector in ui
|
||||
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
|
||||
@ -1,7 +1,7 @@
|
||||
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 2/2] feature(options.cmake):Add compilation option switch,
|
||||
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
|
||||
@ -1,7 +1,7 @@
|
||||
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] fix(*):Compatible for versions below 5.14
|
||||
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
|
||||
@ -1,7 +1,7 @@
|
||||
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] fix(network):Fix the issue of ineffective cloning of MAC
|
||||
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
|
||||
176
0006-fix-launcher-compatible-with-older-versions-launch-p.patch
Normal file
176
0006-fix-launcher-compatible-with-older-versions-launch-p.patch
Normal file
@ -0,0 +1,176 @@
|
||||
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
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
Name: kiran-control-panel
|
||||
Version: 2.5.0
|
||||
Release: 6
|
||||
Release: 8
|
||||
Summary: Kiran Control Panel
|
||||
Summary(zh_CN): Kiran桌面控制面板
|
||||
|
||||
License: MulanPSL-2.0
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Patch0: 0001-fix-translate-add-some-translation.patch
|
||||
Patch1: 0001-fix-icon-add-KiranNew-icon-selector-in-ui.patch
|
||||
Patch2: 0002-feature-options.cmake-Add-compilation-option-switch-.patch
|
||||
Patch3: 0003-fix-Compatible-for-versions-below-5.14.patch
|
||||
Patch4: 0001-fix-network-Fix-the-issue-of-ineffective-cloning-of-.patch
|
||||
|
||||
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
|
||||
@ -160,6 +162,12 @@ make %{?_smp_mflags}
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%changelog
|
||||
* 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)
|
||||
|
||||
* Wed Apr 26 2023 kpkg <kpkg.kylinsec.com.cn> - 2.5.0-7
|
||||
- rebuild for KiranUI-2.5-next
|
||||
|
||||
* Wed Apr 26 2023 luoqing <luoqing@kylinsec.om.cn> - 2.5.0-6
|
||||
- KYOS-F: Fix the issue of ineffective cloning of MAC addresses, compatible with the lower version of kf5 networkmanager qt5
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user