diff --git a/Makefile b/Makefile
index e804a8c..4f49f91 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,8 @@
CC = g++
-all: plugins notify
+all: origin immutability
-plugins:
- cd plugin && qmake .
- cd plugin && make -j8
-notify:
- cd notification && cmake .
- cd notification && make -j8
+origin:
+ cd initial && make -j4
+immutability:
+ cd immutable && make -j4
diff --git a/immutable/Makefile b/immutable/Makefile
new file mode 100644
index 0000000..5459265
--- /dev/null
+++ b/immutable/Makefile
@@ -0,0 +1,16 @@
+CC = g++
+
+all: plugins notify newnotify send
+
+plugins:
+ cd plugin && qmake .
+ cd plugin && make -j8
+notify:
+ cd notification && cmake .
+ cd notification && make -j8
+newnotify:
+ cd upgradenote/RebootAttention && qmake .
+ cd upgradenote/RebootAttention && make -j8
+send:
+ cd NotifySend && qmake .
+ cd NotifySend && make -j8
diff --git a/immutable/NotifySend/Config/NotifySendStart b/immutable/NotifySend/Config/NotifySendStart
new file mode 100755
index 0000000..5ef07ae
--- /dev/null
+++ b/immutable/NotifySend/Config/NotifySendStart
@@ -0,0 +1,2 @@
+#! /bin/bash
+systemctl --user start kylin-stepinstall-notify.service
diff --git a/immutable/NotifySend/Config/UpgradeRebootNotify b/immutable/NotifySend/Config/UpgradeRebootNotify
new file mode 100755
index 0000000..e3d9a4f
--- /dev/null
+++ b/immutable/NotifySend/Config/UpgradeRebootNotify
@@ -0,0 +1,3 @@
+#! /bin/bash
+NotifySend --PowercheckNotify
+gdbus call --system --dest com.kylin.systemupgrade --object-path /com/kylin/systemupgrade --method com.kylin.systemupgrade.interface.TriggerInstallOnShutdown "reboot"
diff --git a/immutable/NotifySend/Config/kylin-reboot-installnotify.desktop b/immutable/NotifySend/Config/kylin-reboot-installnotify.desktop
new file mode 100644
index 0000000..8f53767
--- /dev/null
+++ b/immutable/NotifySend/Config/kylin-reboot-installnotify.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=kylin-reboot-installlnotify
+X-UKUI-Autostart-Phase=Notification
+Exec=/usr/bin/NotifySend --DesktopNotify
+Type=Application
+NoDisplay=true
+Comment=kylin-DesktopNotify-notify
+Name[zh_CN]=重启立即检测是否弹窗
diff --git a/immutable/NotifySend/Config/kylin-stepinstall-notify.desktop b/immutable/NotifySend/Config/kylin-stepinstall-notify.desktop
new file mode 100644
index 0000000..43560bb
--- /dev/null
+++ b/immutable/NotifySend/Config/kylin-stepinstall-notify.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=kylin-stepinstall-notify
+X-UKUI-Autostart-Phase=Notification
+Exec=/usr/bin/NotifySendStart
+Type=Application
+NoDisplay=true
+Comment=kylin-stepinstall-notify
+Name[zh_CN]=分步更新重启提示
diff --git a/immutable/NotifySend/Config/kylin-stepinstall-notify.service b/immutable/NotifySend/Config/kylin-stepinstall-notify.service
new file mode 100644
index 0000000..1981342
--- /dev/null
+++ b/immutable/NotifySend/Config/kylin-stepinstall-notify.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Daily update attention when user login
+#ConditionACPower=true
+After=systemd-user-sessions.service
+[Service]
+ExecStart=/usr/bin/NotifySend --WaitSignalNotify
+[Install]
+WantedBy=graphical-session.target
diff --git a/immutable/NotifySend/NotifySend.pro b/immutable/NotifySend/NotifySend.pro
new file mode 100644
index 0000000..851de71
--- /dev/null
+++ b/immutable/NotifySend/NotifySend.pro
@@ -0,0 +1,52 @@
+QT += core dbus gui widgets
+#CONFIG += console
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+MOC_DIR = ./moctmp
+UI_DIR = ./uitmp
+RCC_DIR = ./rcctmp
+OBJECTS_DIR = ./objtmp
+
+!contains(QMAKE_HOST.arch, sw_64){
+ LIBS += -L$$[QT_INSTALL_LIBS] -lukui-log4qt
+}
+DEFINES+=WITHKYSEC KYDEBUG
+#DEFINES+=WITHKYSEC KYDEBUG
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+ checkpower.cpp \
+ desktopnotify.cpp \
+ main.cpp \
+ mainwindow.cpp \
+ rebootinstallnotify.cpp
+
+HEADERS += \
+ checkpower.h \
+ desktopnotify.h \
+ mainwindow.h \
+ rebootinstallnotify.h
+
+TRANSLATIONS += \
+ translations/zh_CN.ts \
+ translations/tr.ts \
+ translations/bo.ts \
+ translations/en_US.ts \
+ translations/bo_CN.ts \
+ translations/mn.ts
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
diff --git a/immutable/NotifySend/NotifySend.pro.user b/immutable/NotifySend/NotifySend.pro.user
new file mode 100644
index 0000000..6250c8f
--- /dev/null
+++ b/immutable/NotifySend/NotifySend.pro.user
@@ -0,0 +1,314 @@
+
+
+
+
+
+ EnvironmentId
+ {e2626406-5b30-4653-bbdc-5f44d69e770a}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ 桌面
+ 桌面
+ {3206ba71-3ff7-4f65-a816-e5c227657c1c}
+ 0
+ 0
+ 0
+
+ /home/hechengyuan/project/study/demo/NotifySend/build-NotifySend-unknown-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/hechengyuan/project/study/demo/NotifySend/build-NotifySend-unknown-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ /home/hechengyuan/project/study/demo/NotifySend/build-NotifySend-unknown-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ Qt4ProjectManager.Qt4RunConfiguration:/home/hechengyuan/project/study/demo/NotifySend/NotifySend/NotifySend.pro
+ /home/hechengyuan/project/study/demo/NotifySend/NotifySend/NotifySend.pro
+
+ false
+
+ false
+ true
+ true
+ false
+ false
+ true
+
+
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/immutable/NotifySend/checkpower.cpp b/immutable/NotifySend/checkpower.cpp
new file mode 100644
index 0000000..76ef5a1
--- /dev/null
+++ b/immutable/NotifySend/checkpower.cpp
@@ -0,0 +1,16 @@
+#include "checkpower.h"
+
+CheckPower::CheckPower()
+{
+ QDBusInterface upgrade_interface( "com.kylin.systemupgrade",
+ "/com/kylin/systemupgrade",
+ "com.kylin.systemupgrade.interface",
+ QDBusConnection::systemBus() );
+ QDBusMessage rebootresult = upgrade_interface.call("DeployLatestUpdate","reboot");
+ int reboot =rebootresult.arguments().value(0).toInt();
+ QString reason = rebootresult.arguments().value(1).toString();
+ if(!reboot)
+ {
+ qInfo()<<"reboot success!";
+ }
+}
diff --git a/immutable/NotifySend/checkpower.h b/immutable/NotifySend/checkpower.h
new file mode 100644
index 0000000..9be2045
--- /dev/null
+++ b/immutable/NotifySend/checkpower.h
@@ -0,0 +1,24 @@
+#ifndef CHECKPOWER_H
+#define CHECKPOWER_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+class CheckPower: public QWidget
+{
+ Q_OBJECT
+public:
+ CheckPower();
+};
+
+#endif // CHECKPOWER_H
diff --git a/immutable/NotifySend/desktopnotify.cpp b/immutable/NotifySend/desktopnotify.cpp
new file mode 100644
index 0000000..de761f7
--- /dev/null
+++ b/immutable/NotifySend/desktopnotify.cpp
@@ -0,0 +1,226 @@
+#include "desktopnotify.h"
+
+DesktopNotify::DesktopNotify(QWidget *parent) : QWidget(parent)
+{
+ version=getVersion();
+ QDBusInterface iface("com.kylin.systemupgrade",
+ "/com/kylin/systemupgrade",
+ "com.kylin.systemupgrade.interface",
+ QDBusConnection::systemBus());
+ QDBusMessage result = iface.call("CheckInstallRequired");
+ int reboot =result.arguments().value(0).toInt();
+ qInfo()<<"reboot result is"< args;
+ QVariantMap hints;
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ < args;
+ QVariantMap hints;
+ hints.insert("sound-name","Complete");
+ hints.insert("x-ukui-popup-timeout",-1);
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ <start(24*60*60*1000);
+// timer->start(2*60*1000);
+ return;
+ }
+ }
+}
+
+void DesktopNotify::timenotification_2309()
+{
+ timer->stop();
+ qInfo()<<"[INFO]timenotification_2309 timeout";
+ qInfo()<<"DesktopNotify timenotification_2309";
+ QStringList actions;
+ actions.append("NotifySend --PowercheckNotify");
+ actions.append(QObject::tr("Reboot"));
+ actions.append("NotifySend --RebootInstallNotify");
+ actions.append(QObject::tr("Later"));
+ QDBusInterface iface("org.freedesktop.Notifications",
+ "/org/freedesktop/Notifications",
+ "org.freedesktop.Notifications",
+ QDBusConnection::sessionBus());
+ QList args;
+ QVariantMap hints;
+ hints.insert("sound-name","Complete");
+ hints.insert("x-ukui-popup-timeout",-1);
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ <
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+class DesktopNotify : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit DesktopNotify(QWidget *parent = nullptr);
+ ~DesktopNotify();
+ int ID=0;
+ QTimer *timer;
+ QString getVersion();
+ QString version_t = "";
+ QString version;
+signals:
+
+public Q_SLOTS:
+ void RebootNotify();
+
+public slots:
+ void ButtonAction_2309(uint id, QString key);
+ void timenotification_2309();
+};
+
+#endif // DESKTOPNOTIFY_H
diff --git a/immutable/NotifySend/getversion.cpp b/immutable/NotifySend/getversion.cpp
new file mode 100644
index 0000000..32eac2c
--- /dev/null
+++ b/immutable/NotifySend/getversion.cpp
@@ -0,0 +1,6 @@
+#include "getversion.h"
+
+GetVersion::GetVersion()
+{
+
+}
diff --git a/immutable/NotifySend/getversion.h b/immutable/NotifySend/getversion.h
new file mode 100644
index 0000000..9b617eb
--- /dev/null
+++ b/immutable/NotifySend/getversion.h
@@ -0,0 +1,13 @@
+#ifndef GETVERSION_H
+#define GETVERSION_H
+
+#include
+
+class GetVersion
+{
+ Q_OBJECT
+public:
+ GetVersion();
+};
+
+#endif // GETVERSION_H
diff --git a/immutable/NotifySend/main.cpp b/immutable/NotifySend/main.cpp
new file mode 100644
index 0000000..c660c2c
--- /dev/null
+++ b/immutable/NotifySend/main.cpp
@@ -0,0 +1,103 @@
+#include "mainwindow.h"
+#include "rebootinstallnotify.h"
+#include "desktopnotify.h"
+#include "checkpower.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#ifdef KYDEBUG
+#ifndef __sw_64__
+#include
+#endif
+#endif
+int main(int argc, char *argv[])
+{
+ setenv("QT_DEBUG_PLUGINS", "1", 0);
+ QApplication a(argc, argv);
+ /*mainwindows为service弹窗
+ desktopnotify为desktop弹窗
+ 其余类别为执行命令的弹窗(各种功能)*/
+#ifdef KYDEBUG
+#ifndef __sw_64__
+ initUkuiLog4qt("kylin-update-frontend-notifysend");
+#endif
+#endif
+
+
+ /*以后需要写配置文件,通过标志位判断某个弹窗是否弹窗*/
+
+/*此部分为demo
+ QCommandLineOption op1("a");// 短名称,无参数
+ QCommandLineOption op2("BBB");// 长名称,无参数
+ QCommandLineOption op3(QStringList() << "c" << "CCC");// 多个名称,无参数
+ QCommandLineOption op4("D", "", "Name");// 短名称,有参数,无默认值
+ QCommandLineOption op5("Age", "", "", "18");// 长名称,有参数,有默认值
+ QCommandLineOption op6("m", "", "."); // 短名称,有参数,无默认值
+ QCommandLineParser parser;
+ parser.addOption(op1);
+ parser.addOption(op2);
+ parser.addOption(op3);
+ parser.addOption(op4);
+ parser.addOption(op5);
+ parser.addOption(op6);
+ parser.process(a);
+ qInfo() << parser.isSet(op1); // true
+ qInfo() << parser.isSet("BBB"); // true
+ qInfo() << parser.isSet("CCC"); // true
+ qInfo() << parser.value(op4); // "Jack"
+ qInfo() << parser.value(op5); // "18"
+ qInfo() << parser.values(op6);// ("Hello", "World")
+ qInfo() << parser.helpText();
+*/
+ QTranslator translator ;
+ qInfo()<<"the system.name is "< args;
+ QVariantMap hints;
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ < args;
+ QVariantMap hints;
+ hints.insert("sound-name","Complete");
+ hints.insert("x-ukui-popup-timeout",-1);
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ <start(24*60*60*1000);
+// timer->start(2*60*1000);
+ return;
+ }
+ }
+
+}
+
+void MainWindow::RebootResult(bool success,QString error_code, QString reason)
+{
+ if(!success)
+ {
+ if(error_code == "#0208")
+ {
+ QDBusInterface iface("org.freedesktop.Notifications",
+ "/org/freedesktop/Notifications",
+ "org.freedesktop.Notifications",
+ QDBusConnection::sessionBus());
+ QList args;
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ < args;
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ < args;
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ <stop();
+ qInfo()<<"[INFO]timenotification timeout";
+ qInfo()<<"mainwindow timenotification_2309";
+ QStringList actions;
+ actions.append("NotifySend --PowercheckNotify");
+ actions.append(QObject::tr("Reboot"));
+ actions.append("NotifySend --RebootInstallNotify");
+ actions.append(QObject::tr("Later"));
+ QDBusInterface iface("org.freedesktop.Notifications",
+ "/org/freedesktop/Notifications",
+ "org.freedesktop.Notifications",
+ QDBusConnection::sessionBus());
+ QList args;
+ QVariantMap hints;
+ hints.insert("sound-name","Complete");
+ hints.insert("x-ukui-popup-timeout",-1);
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ <
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = nullptr);
+ ~MainWindow();
+ int ID=0;
+ QTimer *timer;
+ QString getVersion();
+ QString version_t = "";
+ QString version;
+public Q_SLOTS:
+ void RebootNotify(bool success);
+ void RebootResult(bool success,QString error_code,QString reason);
+
+public slots:
+ void ButtonAction_2309(uint id, QString key);
+ void timenotification_2309();
+};
+#endif // MAINWINDOW_H
diff --git a/immutable/NotifySend/rebootinstallnotify.cpp b/immutable/NotifySend/rebootinstallnotify.cpp
new file mode 100644
index 0000000..9b51a18
--- /dev/null
+++ b/immutable/NotifySend/rebootinstallnotify.cpp
@@ -0,0 +1,95 @@
+#include "rebootinstallnotify.h"
+/*2309以下版本使用(不含)*/
+RebootInstallNotify::RebootInstallNotify(QWidget *parent) : QWidget(parent)
+{
+ qInfo()<<"[INFO]get in RebootInstallNotify";
+ timer = new QTimer(this);
+ timer1 = new QTimer(this);
+// timer->setInterval(10);
+ qInfo()<start(24*60*60*1000);
+// timer->start(2*60*1000);
+ timer1->start(60*60*1000);
+}
+
+void RebootInstallNotify::timenotification_2107()
+{
+ timer->stop();
+ qInfo()<<"[INFO]timenotification_2107 timeout";
+ qInfo()<<"RebootInstallNotify timenotification_2107";
+ QStringList actions;
+ actions.append("NotifySend --PowercheckNotify");
+ actions.append(QObject::tr("Reboot"));
+ actions.append("NotifySend --RebootInstallNotify");
+ actions.append(QObject::tr("Later"));
+ QDBusInterface iface("org.freedesktop.Notifications",
+ "/org/freedesktop/Notifications",
+ "org.freedesktop.Notifications",
+ QDBusConnection::sessionBus());
+ QList args;
+ QVariantMap hints;
+ args<<(QObject::tr("System-Upgrade"))
+ <<((unsigned int) 0)
+ <<("ukui-control-center")
+ <stop();
+ timer1->start(60*60*1000);
+}
diff --git a/immutable/NotifySend/rebootinstallnotify.h b/immutable/NotifySend/rebootinstallnotify.h
new file mode 100644
index 0000000..a411b7a
--- /dev/null
+++ b/immutable/NotifySend/rebootinstallnotify.h
@@ -0,0 +1,35 @@
+#ifndef REBOOTINSTALLNOTIFY_H
+#define REBOOTINSTALLNOTIFY_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+class RebootInstallNotify : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit RebootInstallNotify(QWidget *parent = nullptr);
+ QTimer *timer;
+ QTimer *timer1;
+ int ID = 0;
+public slots:
+ void timenotification_2107();
+ void hourdebug();
+ void ButtonAction(int id ,QString key);
+signals:
+
+};
+
+#endif // REBOOTINSTALLNOTIFY_H
diff --git a/plugin/shell/res/i18n/bo.qm b/immutable/NotifySend/translations/bo.qm
similarity index 100%
rename from plugin/shell/res/i18n/bo.qm
rename to immutable/NotifySend/translations/bo.qm
diff --git a/immutable/NotifySend/translations/bo.ts b/immutable/NotifySend/translations/bo.ts
new file mode 100644
index 0000000..e3c5ddf
--- /dev/null
+++ b/immutable/NotifySend/translations/bo.ts
@@ -0,0 +1,75 @@
+
+
+
+
+ QObject
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/immutable/NotifySend/translations/bo_CN.qm b/immutable/NotifySend/translations/bo_CN.qm
new file mode 100644
index 0000000..f8e8ad0
Binary files /dev/null and b/immutable/NotifySend/translations/bo_CN.qm differ
diff --git a/immutable/NotifySend/translations/bo_CN.ts b/immutable/NotifySend/translations/bo_CN.ts
new file mode 100644
index 0000000..b6db2fb
--- /dev/null
+++ b/immutable/NotifySend/translations/bo_CN.ts
@@ -0,0 +1,87 @@
+
+
+
+
+ QObject
+
+
+
+
+
+
+ བསྐྱར་སློང་།
+
+
+
+
+
+
+
+ རྗེས་སུ།
+
+
+
+
+
+
+
+
+
+
+ མ་ལག་རིམ་སྤར།
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ukui-control-center-update
+
+
+
+
+
+
+
+
+
+
+
+ གློག་ཚད་དམའ་ཞིང་ཡང་བསྐྱར་ཕམ་ཁ་བྱུང་།
+
+
+
+ གྲབས་གཤོམ་བྱེད་པའི་བར་སྟོང་མི་འདང་བ།
+
+
+
+
+ བསྐྱར་སློང་ཕམ་པ།
+
+
+
+ གྲོས་འགོ་ཡང་བསྐྱར་ཕྱེ་ཡོད།
+
+
+
diff --git a/plugin/shell/res/i18n/en_US.qm b/immutable/NotifySend/translations/en_US.qm
similarity index 100%
rename from plugin/shell/res/i18n/en_US.qm
rename to immutable/NotifySend/translations/en_US.qm
diff --git a/immutable/NotifySend/translations/en_US.ts b/immutable/NotifySend/translations/en_US.ts
new file mode 100644
index 0000000..e3c5ddf
--- /dev/null
+++ b/immutable/NotifySend/translations/en_US.ts
@@ -0,0 +1,75 @@
+
+
+
+
+ QObject
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/immutable/NotifySend/translations/mn.ts b/immutable/NotifySend/translations/mn.ts
new file mode 100644
index 0000000..5aedaf4
--- /dev/null
+++ b/immutable/NotifySend/translations/mn.ts
@@ -0,0 +1,87 @@
+
+
+
+
+ QObject
+
+
+
+
+
+
+ ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠭᠦᠯᠦᠨᠡ᠃
+
+
+
+
+
+
+
+ ᠤᠳᠠᠰᠬᠢᠭᠠᠳ ᠤᠭᠰᠠᠷᠬᠤ
+
+
+
+
+
+
+
+
+
+
+ ᠰᠢᠰᠲ᠋ᠧᠮ ᠰᠢᠨᠡᠴᠢᠯᠡᠬᠦ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ- ᠰᠢᠨᠡᠴᠢᠯᠡᠬᠦ ᠰᠠᠨᠠᠭᠤᠯᠤᠮᠵᠢ
+
+
+
+
+
+
+
+
+
+
+
+ ᠴᠠᠬᠢᠯᠭᠠᠨ ᠤ ᠬᠡᠮᠵᠢᠶᠡ ᠳᠣᠣᠷᠠ ᠂ ᠳᠠᠬᠢᠨ ᠰᠡᠩᠬᠡᠷᠡᠭᠦᠯᠵᠦ ᠪᠣᠯᠬᠤ ᠦᠭᠡᠶ ᠃
+
+
+
+ ᠪᠡᠯᠡᠳᠬᠡᠯ ᠦᠨ ᠣᠷᠣᠨ ᠵᠠᠶ ᠬᠦᠷᠦᠯᠴᠡᠬᠦ ᠦᠭᠡᠶ ᠃
+
+
+
+
+ ᠢᠯᠠᠭᠳᠠᠯ ᠢ ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠭᠦᠯᠦᠨᠡ ᠃
+
+
+
+ ᠳᠠᠷᠤᠢ ᠲᠦᠷᠭᠡᠨ ᠳᠠᠬᠢᠨ ᠰᠡᠩᠭᠡᠷᠡᠭᠦᠯᠬᠦ ᠶᠢ ᠰᠠᠨᠠᠭᠤᠯᠵᠠᠢ ᠃
+
+
+
diff --git a/plugin/shell/res/i18n/tr.qm b/immutable/NotifySend/translations/tr.qm
similarity index 100%
rename from plugin/shell/res/i18n/tr.qm
rename to immutable/NotifySend/translations/tr.qm
diff --git a/immutable/NotifySend/translations/tr.ts b/immutable/NotifySend/translations/tr.ts
new file mode 100644
index 0000000..e3c5ddf
--- /dev/null
+++ b/immutable/NotifySend/translations/tr.ts
@@ -0,0 +1,75 @@
+
+
+
+
+ QObject
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/immutable/NotifySend/translations/zh_CN.qm b/immutable/NotifySend/translations/zh_CN.qm
new file mode 100644
index 0000000..9198fc6
Binary files /dev/null and b/immutable/NotifySend/translations/zh_CN.qm differ
diff --git a/immutable/NotifySend/translations/zh_CN.ts b/immutable/NotifySend/translations/zh_CN.ts
new file mode 100644
index 0000000..e6f5b63
--- /dev/null
+++ b/immutable/NotifySend/translations/zh_CN.ts
@@ -0,0 +1,87 @@
+
+
+
+
+ QObject
+
+
+
+
+
+
+ 立即重启
+
+
+
+
+
+
+
+ 稍后重启
+
+
+
+
+
+
+
+
+
+
+ 系统更新
+
+
+
+
+
+
+
+ 将在重启后使用新系统。
+
+
+
+
+ 电池电量过低,系统更新已终止。
+
+
+
+
+ 系统更新在电池电量不低于50%时进行。
+
+
+
+
+ 系统磁盘空间不足,无法完成更新。
+
+
+
+
+ 设置-更新
+
+
+
+
+
+
+
+ 更新下载完成,是否重启系统?
+
+
+
+ 电池电量低于50%,升级失败。
+
+
+
+ 系统磁盘空间不足,无法完成更新。
+
+
+
+
+ 重启失败!
+
+
+
+ 建议立即重启进行系统更新
+
+
+
diff --git a/README.MD b/immutable/README.MD
similarity index 100%
rename from README.MD
rename to immutable/README.MD
diff --git a/immutable/kylin_release_id_2209.py b/immutable/kylin_release_id_2209.py
new file mode 100755
index 0000000..3dd1ee9
--- /dev/null
+++ b/immutable/kylin_release_id_2209.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python3
+import os
+import sys
+import apt_pkg
+import apt
+
+def ReadOsReleaseFile():
+ file = ''
+ os_release_info={}
+ try:
+ if os.path.exists('/etc/os-release'):
+ file = '/etc/os-release'
+ elif os.path.exists('/usr/lib/os-release'):
+ file = '/usr/lib/os-release'
+ else:
+ return os_release_info
+ with open(file) as f:
+ lines = f.readlines()
+ for line in lines:
+ ls = line.strip().split('=',1)
+ os_release_info.update({ls[0]:ls[1].strip('\"').strip()})
+ except Exception:
+ pass
+ return os_release_info
+
+def get_package_version(packagename):
+ cache = apt.Cache()
+ if packagename in cache:
+ pkg = cache[packagename]
+ return pkg.installed.version
+ else:
+ return ''
+
+def compare_package_version(v1,v2):
+ return apt_pkg.version_compare(v1,v2)
+
+if __name__ == "__main__":
+ os_release_info = ReadOsReleaseFile()
+ kylin_release_id = ''
+ ret = 0
+ try:
+ if 'KYLIN_RELEASE_ID' in os_release_info:
+ kylin_release_id = os_release_info['KYLIN_RELEASE_ID']
+ ukui_control_center_version = get_package_version('ukui-control-center')
+ res = compare_package_version(ukui_control_center_version,sys.argv[1])#'3.1.1+2022-0324'
+ if kylin_release_id in ["2203","2209"] or res >= 0:
+ ret = 1
+ else:
+ pass
+ except Exception as e:
+ print(e)
+ print(ret)
diff --git a/immutable/notification/CMakeLists.txt b/immutable/notification/CMakeLists.txt
new file mode 100644
index 0000000..b23cb79
--- /dev/null
+++ b/immutable/notification/CMakeLists.txt
@@ -0,0 +1,56 @@
+# CMake 最低版本号要求
+cmake_minimum_required (VERSION 2.8)
+
+#项目信息
+project (kylin-update-notify)
+
+#添加第三方函数库
+find_package(PkgConfig)
+
+#增加指定头文件
+pkg_check_modules(GLib REQUIRED glib-2.0)
+if(GLib_FOUND)
+include_directories(${GLib_INCLUDE_DIRS})
+link_libraries(${GLib_LIBRARIES})
+endif(GLib_FOUND)
+
+pkg_check_modules(DBus REQUIRED dbus-1)
+if(DBus_FOUND)
+include_directories(${DBus_INCLUDE_DIRS})
+link_libraries(${DBus_LIBRARIES})
+endif(DBus_FOUND)
+
+pkg_check_modules(GObject REQUIRED gobject-2.0)
+if(GObject_FOUND)
+include_directories(${GObject_INCLUDE_DIRS})
+link_libraries(${GObject_LIBRARIES})
+endif(GObject_FOUND)
+
+pkg_check_modules(Libnotify REQUIRED libnotify)
+if(Libnotify_FOUND)
+include_directories(${Libnotify_INCLUDE_DIRS})
+link_libraries(${Libnotify_LIBRARIES})
+endif(Libnotify_FOUND)
+
+aux_source_directory(./src SRC_MAIN)
+aux_source_directory(./kylin-updateresult-notify/src SRC_MAIN1)
+
+add_definitions("-Wall -g")
+
+#指定生成目标
+add_executable(kylin-updatefinish-notify-new ${SRC_MAIN})
+add_executable(kylin-updateresult-notify-new ${SRC_MAIN1})
+#链接动态库
+target_link_libraries(kylin-updatefinish-notify-new libglib-2.0.so libnotify.so libgobject-2.0.so)
+target_link_libraries(kylin-updateresult-notify-new libglib-2.0.so libnotify.so libgobject-2.0.so)
+#确定执行文件生成路径
+set_target_properties(
+kylin-updatefinish-notify-new
+PROPERTIES
+RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../"
+)
+set_target_properties(
+kylin-updateresult-notify-new
+PROPERTIES
+RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../"
+)
diff --git a/notification/kylin-system-updater-notify-new.mo b/immutable/notification/kylin-system-updater-notify-new.mo
similarity index 100%
rename from notification/kylin-system-updater-notify-new.mo
rename to immutable/notification/kylin-system-updater-notify-new.mo
diff --git a/immutable/notification/kylin-updatefinish-notify1.desktop b/immutable/notification/kylin-updatefinish-notify1.desktop
new file mode 100644
index 0000000..42847f3
--- /dev/null
+++ b/immutable/notification/kylin-updatefinish-notify1.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=kylin-updatefinish-notify-new
+Exec=/usr/bin/kylin-updatefinish-notify-new
+Type=Application
+NoDisplay=true
+Comment=kylin-updatefinish-notify
+Name[zh_CN]=更新重启提示
+Name[bo_CN]=གསར་བརྗེ་བསྐྱར་དུ་བྱེད་མགོ་བཙུགས་སྣེ་སྟོན།
diff --git a/immutable/notification/kylin-updateresult-notify.desktop b/immutable/notification/kylin-updateresult-notify.desktop
new file mode 100644
index 0000000..caec928
--- /dev/null
+++ b/immutable/notification/kylin-updateresult-notify.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=kylin-updateresult-notify
+Exec=kylin-updateresult-notify-new
+Type=Application
+X-UKUI-Autostart-Phase=Notification
+NoDisplay=true
+Comment=kylin-updateresult-notify
+Name[zh_CN]=更新结果提示
diff --git a/immutable/notification/kylin-updateresult-notify.mo b/immutable/notification/kylin-updateresult-notify.mo
new file mode 100644
index 0000000..a93d85f
Binary files /dev/null and b/immutable/notification/kylin-updateresult-notify.mo differ
diff --git a/immutable/notification/kylin-updateresult-notify/.vscode/settings.json b/immutable/notification/kylin-updateresult-notify/.vscode/settings.json
new file mode 100644
index 0000000..01dac6e
--- /dev/null
+++ b/immutable/notification/kylin-updateresult-notify/.vscode/settings.json
@@ -0,0 +1,8 @@
+{
+ "files.associations": {
+ "notify.h": "c",
+ "notify-enum-types.h": "c",
+ "dbus.h": "c",
+ "system_error": "c"
+ }
+}
\ No newline at end of file
diff --git a/notification/src/gcc.txt b/immutable/notification/kylin-updateresult-notify/src/gcc.txt
similarity index 100%
rename from notification/src/gcc.txt
rename to immutable/notification/kylin-updateresult-notify/src/gcc.txt
diff --git a/immutable/notification/kylin-updateresult-notify/src/main.c b/immutable/notification/kylin-updateresult-notify/src/main.c
new file mode 100644
index 0000000..cdf27f7
--- /dev/null
+++ b/immutable/notification/kylin-updateresult-notify/src/main.c
@@ -0,0 +1,105 @@
+#include
+#include
+// #include
+// #include
+// #include
+// #include
+// #include
+#include "notifications.h"
+#include
+#include
+int main(void)
+{
+ FILE *fp;
+ if( (fp=fopen("/tmp/kylin-updateresult-notify.log","a+")) == NULL )
+ {
+ fprintf(fp,"Fail to open file!\n");
+ return -2;
+ }
+ fprintf (fp,"prepare to popup notification in 50s\n");
+ sleep(50);
+ // DBusConnection *connection;
+ // DBusError error;
+ // DBusMessage *message;
+ // DBusMessageIter iter;
+ // DBusPendingCall *call;
+ // char *sigvalue;
+ // dbus_error_init(&error);
+ GDBusProxy *login_proxy = NULL;
+ GVariant *listsession_var = NULL;
+ GError *error = NULL;
+
+ login_proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "com.kylin.systemupgrade",
+ "/com/kylin/systemupgrade",
+ "com.kylin.systemupgrade.interface",
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ fprintf(fp,"error!\n");
+ g_error_free(error);
+ notifications("error");
+ return 1;
+ }
+
+ error = NULL;
+
+ listsession_var = g_dbus_proxy_call_sync (login_proxy,
+ "CheckPopupOnPoweroffInstalled",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+
+ if (listsession_var == NULL) {
+ g_object_unref(login_proxy);
+ fprintf(fp,"error2!\n");
+ notifications("error");
+ return 1;
+ }
+ // GVariantIter *iter;
+ // g_variant_get(listsession_var, "(a(susso))", &iter);
+ // gchar *sessionId, *userName, *seatId;
+ // guint32 userId;
+ // GObject *objectPath;
+
+
+ gchar* content;
+ gboolean type = TRUE;
+ content = g_variant_print(listsession_var,type);
+ fprintf (fp,"the type is %d\n", type);
+ fprintf (fp,"the content is %s\n", content);
+
+ //gboolean result;
+ gchar* result;
+ // result = g_variant_get_boolean(listsession_var);
+ // while (g_variant_iter_loop (iter, "(susso)", &sessionId, &userId, &userName, &seatId, &objectPath))
+ // {
+ // printf ("the result is %d\n", g_variant_get_boolean(listsession_var));
+ g_variant_get(listsession_var, "(s)", &result);
+ // g_variant_iter_loop (iter, "(b)", result);
+ fprintf (fp,"the result is %s\n", result);
+ // }
+ // while (g_variant_iter_loop (iter, "b", &result))
+ // {
+ // qCritical() << sessionId << userName << seatId << userId;
+ // }
+ g_object_unref(login_proxy);
+ //g_variant_iter_free (iter);
+ g_variant_unref(listsession_var);
+ if(strcmp(result,"success") == 0)
+ notifications("success");
+ else if(strcmp(result,"none") == 0)
+ return 0;
+ else
+ notifications(result);
+ fflush(fp);
+ fclose(fp);
+ return 0;
+}
+
+
diff --git a/immutable/notification/kylin-updateresult-notify/src/messages.po b/immutable/notification/kylin-updateresult-notify/src/messages.po
new file mode 100644
index 0000000..ef2eeff
--- /dev/null
+++ b/immutable/notification/kylin-updateresult-notify/src/messages.po
@@ -0,0 +1,46 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2023-07-31 09:33+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"Language: zh_CN\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: notifications.c:17
+msgid "System Update"
+msgstr "系统更新"
+
+#: notifications.c:25
+msgid "Download finish, do you want to reboot?"
+msgstr "更新下载完成,是否重启系统?"
+
+#: notifications.c:26
+msgid "The system will use the new system after restarting."
+msgstr "系统将在重启后使用更新应用。"
+
+#: notifications.c:29 notifications.c:39 notifications.c:50 notifications.c:63
+msgid "OK"
+msgstr "确定"
+
+#: notifications.c:36
+msgid "Update Failed!"
+msgstr "更新失败!"
+
+#: notifications.c:47
+msgid "The backend is abnormal,please check for updates on settings."
+msgstr "后台程序异常,请手动打开更新-设置查找问题"
+
+#: notifications.c:55
+msgid "upgrade fail! Error code("
+msgstr "更新失败!错误码("
diff --git a/immutable/notification/kylin-updateresult-notify/src/notification.po b/immutable/notification/kylin-updateresult-notify/src/notification.po
new file mode 100644
index 0000000..b04decb
--- /dev/null
+++ b/immutable/notification/kylin-updateresult-notify/src/notification.po
@@ -0,0 +1,42 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2023-07-31 09:49+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"Language:zh_CN \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: notifications.c:17
+msgid "System Update"
+msgstr "系统更新"
+
+#: notifications.c:28
+msgid "Update Success!"
+msgstr "更新成功!"
+
+#: notifications.c:31 notifications.c:41 notifications.c:52 notifications.c:65
+msgid "OK"
+msgstr "确定"
+
+#: notifications.c:38
+msgid "Update Failed!"
+msgstr "更新失败!"
+
+#: notifications.c:49
+msgid "The backend is abnormal,please check for updates on settings."
+msgstr "后台程序异常,请手动检查更新确定升级是否成功。"
+
+#: notifications.c:57
+msgid "upgrade fail! Error code("
+msgstr "更新失败!错误码("
diff --git a/immutable/notification/kylin-updateresult-notify/src/notifications.c b/immutable/notification/kylin-updateresult-notify/src/notifications.c
new file mode 100644
index 0000000..32232b5
--- /dev/null
+++ b/immutable/notification/kylin-updateresult-notify/src/notifications.c
@@ -0,0 +1,104 @@
+#include "notifications.h"
+
+int notifications (char *sigvalue)
+{
+ FILE *fp;
+ if( (fp=fopen("/tmp/kylin-updateresult-notify.log","a+")) == NULL )
+ {
+ fprintf(fp,"Fail to open file!\n");
+ return -2;
+ }
+ setlocale(LC_ALL, "");
+ bindtextdomain("kylin-updateresult-notify","/usr/share/locale");
+ textdomain("kylin-updateresult-notify");
+ NotifyNotification* notification;
+ gboolean success;
+ GError* error = NULL;
+ if (!notify_init (gettext("System Update")))
+ {
+ fprintf(fp,"notify_init failed!\n");
+ return 1;
+ }
+ if(strcmp(sigvalue,"success") == 0){
+ fprintf(fp,"upgrade success!\n");
+ notification = notify_notification_new (
+ // gettext("Download finish, do you want to reboot?"),
+ // gettext("The system will use the new system after restarting."),
+ NULL,
+ gettext("Update Success!"),
+ "/usr/share/icons/ukui-icon-theme-default/16x16/apps/ukui-control-center.png");
+ notify_notification_set_timeout(notification, 0);
+ notify_notification_add_action(notification, "OK", gettext("OK"),
+ (NotifyActionCallback)actionClose ,NULL, NULL);
+ notify_notification_set_hint_int32(notification,"x-ukui-popup-timeout",-1);
+ }
+ else if(strcmp(sigvalue,"failed") == 0){
+ fprintf(fp,"upgrade fail!\n");
+ notification = notify_notification_new (
+ NULL,
+ gettext("Update Failed!"),
+ "/usr/share/icons/ukui-icon-theme-default/16x16/apps/ukui-control-center.png");
+ notify_notification_set_timeout(notification, 0);
+ notify_notification_add_action(notification, "OK", gettext("OK"),
+ (NotifyActionCallback)actionClose ,NULL, NULL);
+ notify_notification_set_hint_int32(notification,"x-ukui-popup-timeout",-1);
+ }
+ else if(strcmp(sigvalue,"error") == 0){
+ fprintf(fp,"upgrade error!\n");
+ notification = notify_notification_new (
+ //gettext("System Update"),
+ NULL,
+ gettext("The backend is abnormal,please check for updates on settings."),
+ "/usr/share/icons/ukui-icon-theme-default/16x16/apps/ukui-control-center.png");
+ notify_notification_set_timeout(notification, 0);
+ notify_notification_add_action(notification, "OK", gettext("OK"),
+ (NotifyActionCallback)actionClose ,NULL, NULL);
+ }
+ else{
+ fprintf(fp,"upgrade fail!\n");
+ char str[50];
+ memset(str,0,sizeof(str));
+ char *str1 = gettext("upgrade fail! Error code(");
+ fprintf(fp,"error code is %s\n",sigvalue);
+ strcat(str,str1);
+ strcat(str,sigvalue);
+ strcat(str,")");
+ notification = notify_notification_new (
+ NULL,
+ gettext(str),
+ "/usr/share/icons/ukui-icon-theme-default/16x16/apps/ukui-control-center.png");
+ notify_notification_set_timeout(notification, 0);
+ notify_notification_add_action(notification, "OK", gettext("OK"),
+ (NotifyActionCallback)actionClose ,NULL, NULL);
+ notify_notification_set_hint_int32(notification,"x-ukui-popup-timeout",-1);
+ }
+ error = NULL;
+ success = notify_notification_show (notification, &error);
+ if (!success){
+ //g_print ("That did not work ... \"%s\".\n", error->message);
+ fprintf (fp,"That did not work ... \"%s\".\n", error->message);
+ g_error_free (error);
+ }
+ g_signal_connect (G_OBJECT (notification),
+ "closed",
+ G_CALLBACK (closed_handler),
+ NULL);
+ mainloop=g_main_loop_new(NULL, false);
+ g_main_loop_run(mainloop);
+ notify_uninit ();
+ return 0;
+}
+
+
+void closed_handler(NotifyNotification* notification, gpointer data){
+ notify_uninit ();
+ g_print ("closed_handler() called\n");
+ g_main_loop_quit(mainloop);
+ return;
+}
+
+void actionClose(NotifyNotification* notification,char *action, gpointer data){
+ g_print("Closed\n");
+ g_print ("dbus_method_called to change the sigvalue");
+ return;
+}
\ No newline at end of file
diff --git a/immutable/notification/kylin-updateresult-notify/src/notifications.h b/immutable/notification/kylin-updateresult-notify/src/notifications.h
new file mode 100644
index 0000000..feb4ed5
--- /dev/null
+++ b/immutable/notification/kylin-updateresult-notify/src/notifications.h
@@ -0,0 +1,26 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include //for mainloop
+#include
+#include
+#include
+#include //gettext
+#include
+#include
+#define false 0
+
+int notifications(char *sigvalue);
+void closed_handler(NotifyNotification* notification,gpointer data);
+void actionClose(NotifyNotification* notification,char *action, gpointer data);
+GMainLoop* mainloop;
\ No newline at end of file
diff --git a/immutable/notification/src/gcc.txt b/immutable/notification/src/gcc.txt
new file mode 100644
index 0000000..b6c63bc
--- /dev/null
+++ b/immutable/notification/src/gcc.txt
@@ -0,0 +1 @@
+gcc `pkg-config --cflags --libs dbus-1` main.c -o main -ldbus-1
diff --git a/notification/src/main.c b/immutable/notification/src/main.c
similarity index 100%
rename from notification/src/main.c
rename to immutable/notification/src/main.c
diff --git a/immutable/notification/src/notifications.c b/immutable/notification/src/notifications.c
new file mode 100644
index 0000000..520d88e
--- /dev/null
+++ b/immutable/notification/src/notifications.c
@@ -0,0 +1,174 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include //for mainloop
+#include
+#include
+#include
+
+#include //gettext
+#include
+#include
+
+
+#define false 0
+//#define _(string) gettext(string)
+
+void closed_handler(NotifyNotification* notification,gpointer data);
+void actionClose(NotifyNotification* notification,char *action, gpointer data);
+void actionReboot(NotifyNotification* notification,char *action, gpointer data);
+void actionLogout(NotifyNotification* notification,char *action, gpointer data);
+
+
+GMainLoop* mainloop;
+
+int notifications (char *sigvalue)
+{
+
+ setlocale(LC_ALL, "");//yuyanshezhi
+ bindtextdomain("kylin-system-updater-notify","/usr/share/locale");
+ textdomain("kylin-system-updater-notify");
+
+ NotifyNotification* notification;
+ gboolean success;
+ GError* error = NULL;
+ printf("2\n");
+ if (!notify_init (gettext("Update Finished!")))//zhuti
+ return 1;
+
+ // /* try the icon-summary-body case */
+ // notification = notify_notification_new (
+ // gettext("Update Finished!"),//biaoti
+ // gettext("It's suggested to reboot immediately."),//neirong
+ // "");//icon
+
+ // notify_notification_set_timeout(notification, 10*1000);//shijian yijing bei xiesi
+
+ if(strcmp(sigvalue,"reboot") == 0)
+ {
+ printf("It should reboot\n");
+ /* try the icon-summary-body case */
+ notification = notify_notification_new (
+ gettext("Update Finished!"),//biaoti
+ gettext("It's suggested to reboot immediately."),//neirong
+ "/usr/share/icons/ukui-icon-theme-default/16x16/apps/ukui-control-center.png");//icon
+
+ notify_notification_set_timeout(notification, 0);//shijian yijing bei xiesi
+ notify_notification_add_action(notification, "Reboot", gettext("Reboot") , (NotifyActionCallback)actionReboot , NULL, NULL);
+ notify_notification_add_action(notification, "Closed", gettext("Closed"), (NotifyActionCallback)actionClose , NULL, NULL);
+ notify_notification_set_hint_string(notification,"Reboot","reboot");
+ //notify_notification_set_hint(notification,"","");
+ }
+
+ if(strcmp(sigvalue,"logout") == 0)
+ {
+
+ /* try the icon-summary-body case */
+ notification = notify_notification_new (
+ gettext("Update Finished!"),//title
+ gettext("It's suggested to logout immediately."),//content
+ "");//icon
+
+ notify_notification_set_timeout(notification, 0);//shijian yijing bei xiesi
+
+ notify_notification_add_action(notification, "Logout", gettext("Logout") , (NotifyActionCallback)actionLogout , NULL, NULL);
+ notify_notification_add_action(notification, "Closed", gettext("Closed"), (NotifyActionCallback)actionClose , NULL, NULL);
+ notify_notification_set_hint_string(notification,"Logout","logout");
+ //notify_notification_set_hint(notification,"","");
+ }
+
+ error = NULL;
+ success = notify_notification_show (notification, &error);
+ if (!success)
+ {
+ g_print ("That did not work ... \"%s\".\n", error->message);
+ g_error_free (error);
+ }
+
+ g_signal_connect (G_OBJECT (notification),
+ "closed",
+ G_CALLBACK (closed_handler),
+ NULL);
+
+ mainloop=g_main_loop_new(NULL, false);
+ g_main_loop_run(mainloop);
+
+ notify_uninit ();
+
+ return 0;
+}
+
+
+void closed_handler(NotifyNotification* notification, gpointer data)
+{ notify_uninit ();
+ g_print ("closed_handler() called\n");
+ g_main_loop_quit(mainloop);
+ return;
+}
+
+void actionClose(NotifyNotification* notification,char *action, gpointer data)
+{
+ g_print("Closed\n");
+ return;
+}
+
+void actionReboot(NotifyNotification* notification,char *action, gpointer data)
+{
+ g_print ("get signal to reboot\n");
+ system("ukui-session-tools --reboot");
+ return;
+ // g_print("Reboot\n");
+ // //dbus_reboot_method_call();
+ // DBusConnection *connection;
+ // DBusMessage *message;
+ // DBusError err ;
+ // DBusMessageIter iter;
+
+ // dbus_bool_t reboot=false;//dbus 内部bool型
+
+ // dbus_error_init(&err);
+ // connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+
+ // if(!connection)
+ // {
+ // fprintf(stderr, "Fail to get a system dbus connection: %s\n", err.message);
+ // exit(1);
+ // }
+
+ // message = dbus_message_new_method_call("org.freedesktop.login1",
+ // "/org/freedesktop/login1", //object
+ // "org.freedesktop.login1.Manager",//interface
+ // "Reboot");//method name
+
+
+ // if (NULL == message)
+ // {
+ // fprintf(stderr, "Message Null\n");
+ // exit(1);
+ // }
+
+ // dbus_message_iter_init_append(message, &iter);
+ // if( !dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &reboot))
+ // {
+ // fprintf(stderr, "Out of Memory!\n");
+ // exit(1);
+ // }
+
+ // dbus_connection_send(connection,message,NULL);
+ // dbus_connection_flush(connection);
+ // dbus_message_unref(message);
+ // return;
+}
+
+void actionLogout(NotifyNotification* notification,char *action, gpointer data)
+{
+ g_print("Logout\n");
+ system("ukui-session-tools --logout");
+ return;
+}
diff --git a/notification/src/notifications.h b/immutable/notification/src/notifications.h
similarity index 100%
rename from notification/src/notifications.h
rename to immutable/notification/src/notifications.h
diff --git a/notification/src/notify.po b/immutable/notification/src/notify.po
similarity index 100%
rename from notification/src/notify.po
rename to immutable/notification/src/notify.po
diff --git a/plugin/config_file/kylin-need-logout-new.conf b/immutable/plugin/config_file/kylin-need-logout-new.conf
similarity index 100%
rename from plugin/config_file/kylin-need-logout-new.conf
rename to immutable/plugin/config_file/kylin-need-logout-new.conf
diff --git a/plugin/config_file/kylin-need-reboot-new.conf b/immutable/plugin/config_file/kylin-need-reboot-new.conf
similarity index 100%
rename from plugin/config_file/kylin-need-reboot-new.conf
rename to immutable/plugin/config_file/kylin-need-reboot-new.conf
diff --git a/plugin/image/close.png b/immutable/plugin/image/close.png
similarity index 100%
rename from plugin/image/close.png
rename to immutable/plugin/image/close.png
diff --git a/plugin/image/refresh.png b/immutable/plugin/image/refresh.png
similarity index 100%
rename from plugin/image/refresh.png
rename to immutable/plugin/image/refresh.png
diff --git a/plugin/image/search.png b/immutable/plugin/image/search.png
similarity index 100%
rename from plugin/image/search.png
rename to immutable/plugin/image/search.png
diff --git a/plugin/shell/interface.h b/immutable/plugin/shell/interface.h
similarity index 100%
rename from plugin/shell/interface.h
rename to immutable/plugin/shell/interface.h
diff --git a/plugin/translations/bo.qm b/immutable/plugin/shell/res/i18n/bo.qm
similarity index 100%
rename from plugin/translations/bo.qm
rename to immutable/plugin/shell/res/i18n/bo.qm
diff --git a/plugin/shell/res/i18n/bo.ts b/immutable/plugin/shell/res/i18n/bo.ts
similarity index 100%
rename from plugin/shell/res/i18n/bo.ts
rename to immutable/plugin/shell/res/i18n/bo.ts
diff --git a/plugin/shell/res/i18n/zh_CN.qm b/immutable/plugin/shell/res/i18n/en_US.qm
similarity index 100%
rename from plugin/shell/res/i18n/zh_CN.qm
rename to immutable/plugin/shell/res/i18n/en_US.qm
diff --git a/plugin/shell/res/i18n/en_US.ts b/immutable/plugin/shell/res/i18n/en_US.ts
similarity index 100%
rename from plugin/shell/res/i18n/en_US.ts
rename to immutable/plugin/shell/res/i18n/en_US.ts
diff --git a/plugin/translations/tr.qm b/immutable/plugin/shell/res/i18n/tr.qm
similarity index 100%
rename from plugin/translations/tr.qm
rename to immutable/plugin/shell/res/i18n/tr.qm
diff --git a/plugin/shell/res/i18n/tr.ts b/immutable/plugin/shell/res/i18n/tr.ts
similarity index 100%
rename from plugin/shell/res/i18n/tr.ts
rename to immutable/plugin/shell/res/i18n/tr.ts
diff --git a/immutable/plugin/shell/res/i18n/zh_CN.qm b/immutable/plugin/shell/res/i18n/zh_CN.qm
new file mode 100644
index 0000000..be651ee
--- /dev/null
+++ b/immutable/plugin/shell/res/i18n/zh_CN.qm
@@ -0,0 +1 @@
+
+
+ upgrade/kylin-update-desktop-app.png
+ upgrade/kylin-update-desktop-kernel-3a4000.png
+ upgrade/kylin-update-desktop-kernel.png
+ upgrade/kylin-update-desktop-security.png
+ upgrade/kylin-update-desktop-support.png
+ upgrade/kylin-update-desktop-ukui.png
+ upgrade/linux-generic.png
+ upgrade/loading10.svg
+ upgrade/loading11.svg
+ upgrade/loading12.svg
+ upgrade/loading13.svg
+ upgrade/loading14.svg
+ upgrade/loading15.svg
+ upgrade/loading16.svg
+ upgrade/loading17.svg
+ upgrade/normal.png
+ upgrade/refresh.png
+ upgrade/update.png
+ upgrade/no_content_light.svg
+ upgrade/no_content_dark.svg
+
+
+ upgrade/no_content_light.svg
+ upgrade/no_content_dark.svg
+
+
diff --git a/plugin/shell/res/upgrade/kylin-update-desktop-app.png b/immutable/plugin/shell/res/upgrade/kylin-update-desktop-app.png
similarity index 100%
rename from plugin/shell/res/upgrade/kylin-update-desktop-app.png
rename to immutable/plugin/shell/res/upgrade/kylin-update-desktop-app.png
diff --git a/plugin/shell/res/upgrade/kylin-update-desktop-kernel-3a4000.png b/immutable/plugin/shell/res/upgrade/kylin-update-desktop-kernel-3a4000.png
similarity index 100%
rename from plugin/shell/res/upgrade/kylin-update-desktop-kernel-3a4000.png
rename to immutable/plugin/shell/res/upgrade/kylin-update-desktop-kernel-3a4000.png
diff --git a/plugin/shell/res/upgrade/kylin-update-desktop-kernel.png b/immutable/plugin/shell/res/upgrade/kylin-update-desktop-kernel.png
similarity index 100%
rename from plugin/shell/res/upgrade/kylin-update-desktop-kernel.png
rename to immutable/plugin/shell/res/upgrade/kylin-update-desktop-kernel.png
diff --git a/plugin/shell/res/upgrade/kylin-update-desktop-security.png b/immutable/plugin/shell/res/upgrade/kylin-update-desktop-security.png
similarity index 100%
rename from plugin/shell/res/upgrade/kylin-update-desktop-security.png
rename to immutable/plugin/shell/res/upgrade/kylin-update-desktop-security.png
diff --git a/plugin/shell/res/upgrade/kylin-update-desktop-support.png b/immutable/plugin/shell/res/upgrade/kylin-update-desktop-support.png
similarity index 100%
rename from plugin/shell/res/upgrade/kylin-update-desktop-support.png
rename to immutable/plugin/shell/res/upgrade/kylin-update-desktop-support.png
diff --git a/plugin/shell/res/upgrade/kylin-update-desktop-ukui.png b/immutable/plugin/shell/res/upgrade/kylin-update-desktop-ukui.png
similarity index 100%
rename from plugin/shell/res/upgrade/kylin-update-desktop-ukui.png
rename to immutable/plugin/shell/res/upgrade/kylin-update-desktop-ukui.png
diff --git a/plugin/shell/res/upgrade/linux-generic.png b/immutable/plugin/shell/res/upgrade/linux-generic.png
similarity index 100%
rename from plugin/shell/res/upgrade/linux-generic.png
rename to immutable/plugin/shell/res/upgrade/linux-generic.png
diff --git a/plugin/shell/res/upgrade/loading10.svg b/immutable/plugin/shell/res/upgrade/loading10.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading10.svg
rename to immutable/plugin/shell/res/upgrade/loading10.svg
diff --git a/plugin/shell/res/upgrade/loading11.svg b/immutable/plugin/shell/res/upgrade/loading11.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading11.svg
rename to immutable/plugin/shell/res/upgrade/loading11.svg
diff --git a/plugin/shell/res/upgrade/loading12.svg b/immutable/plugin/shell/res/upgrade/loading12.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading12.svg
rename to immutable/plugin/shell/res/upgrade/loading12.svg
diff --git a/plugin/shell/res/upgrade/loading13.svg b/immutable/plugin/shell/res/upgrade/loading13.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading13.svg
rename to immutable/plugin/shell/res/upgrade/loading13.svg
diff --git a/plugin/shell/res/upgrade/loading14.svg b/immutable/plugin/shell/res/upgrade/loading14.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading14.svg
rename to immutable/plugin/shell/res/upgrade/loading14.svg
diff --git a/plugin/shell/res/upgrade/loading15.svg b/immutable/plugin/shell/res/upgrade/loading15.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading15.svg
rename to immutable/plugin/shell/res/upgrade/loading15.svg
diff --git a/plugin/shell/res/upgrade/loading16.svg b/immutable/plugin/shell/res/upgrade/loading16.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading16.svg
rename to immutable/plugin/shell/res/upgrade/loading16.svg
diff --git a/plugin/shell/res/upgrade/loading17.svg b/immutable/plugin/shell/res/upgrade/loading17.svg
similarity index 100%
rename from plugin/shell/res/upgrade/loading17.svg
rename to immutable/plugin/shell/res/upgrade/loading17.svg
diff --git a/immutable/plugin/shell/res/upgrade/no_content_dark.svg b/immutable/plugin/shell/res/upgrade/no_content_dark.svg
new file mode 100644
index 0000000..2a198f5
--- /dev/null
+++ b/immutable/plugin/shell/res/upgrade/no_content_dark.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/immutable/plugin/shell/res/upgrade/no_content_light.svg b/immutable/plugin/shell/res/upgrade/no_content_light.svg
new file mode 100644
index 0000000..550ca2b
--- /dev/null
+++ b/immutable/plugin/shell/res/upgrade/no_content_light.svg
@@ -0,0 +1,17 @@
+
+
\ No newline at end of file
diff --git a/plugin/shell/res/upgrade/normal.png b/immutable/plugin/shell/res/upgrade/normal.png
similarity index 100%
rename from plugin/shell/res/upgrade/normal.png
rename to immutable/plugin/shell/res/upgrade/normal.png
diff --git a/plugin/shell/res/upgrade/refresh.png b/immutable/plugin/shell/res/upgrade/refresh.png
similarity index 100%
rename from plugin/shell/res/upgrade/refresh.png
rename to immutable/plugin/shell/res/upgrade/refresh.png
diff --git a/plugin/shell/res/upgrade/update.png b/immutable/plugin/shell/res/upgrade/update.png
similarity index 100%
rename from plugin/shell/res/upgrade/update.png
rename to immutable/plugin/shell/res/upgrade/update.png
diff --git a/immutable/plugin/src/AddFunction/datetimeutils.cpp b/immutable/plugin/src/AddFunction/datetimeutils.cpp
new file mode 100644
index 0000000..badf208
--- /dev/null
+++ b/immutable/plugin/src/AddFunction/datetimeutils.cpp
@@ -0,0 +1,136 @@
+#include "datetimeutils.h"
+
+#include
+#include
+#include
+#include
+DateTimeUtils* DateTimeUtils::m_dataTimeInstance = nullptr;
+DateTimeUtils *DateTimeUtils::get_instance()
+{
+ if(m_dataTimeInstance == nullptr){
+ m_dataTimeInstance = new DateTimeUtils;
+ }
+ return m_dataTimeInstance;
+}
+
+
+DateTimeUtils::DateTimeUtils(QObject *parent /*= nullptr*/): QObject(parent)
+{
+ WatchingTimeFormat();
+}
+
+void DateTimeUtils::WatchingTimeFormat()
+{
+ //监听系统时间格式转换
+ m_dateSessionDbus = new QDBusInterface("com.kylin.kysdk.DateServer",
+ "/com/kylin/kysdk/Date",
+ "com.kylin.kysdk.DateInterface",
+ QDBusConnection::sessionBus(),
+ this);
+ if (m_dateSessionDbus->isValid()) {
+ connect(m_dateSessionDbus, SIGNAL(DateSignal(QString)), this, SLOT(TranslationTime(QString)));
+ connect(m_dateSessionDbus, SIGNAL(ShortDateSignal(QString)), this, SLOT(TranslationTime(QString)));
+ connect(m_dateSessionDbus, SIGNAL(LongDateSignal(QString)), this, SLOT(TranslationTime(QString)));
+ connect(m_dateSessionDbus, SIGNAL(TimeSignal(QString)), this, SLOT(TranslationTime(QString)));
+ }
+// m_dateFormatOld = "yyyy-MM-dd";
+// m_dateFormatNow = kdk_system_get_shortformat();
+// m_timeFormatOld = "hh:mm:ss";
+// QString newTimeFormat(kdk_system_get_now_timeformat());//这个接口会影响安全中心翻译
+// setLanguage(); //重新加载翻译
+// if (newTimeFormat.contains("12")) {
+// m_timeFormatNow = "ap hh:mm:ss";
+// } else {
+// m_timeFormatNow = "hh:mm:ss";
+// }
+}
+
+//void DateTimeUtils::DateFormatChange(QString dateFormat)
+//{
+// Q_UNUSED(dateFormat)
+// QString shortDateFormat(kdk_system_get_shortformat());
+// if (m_dateFormatNow != shortDateFormat) {
+// m_dateFormatOld = m_dateFormatNow;
+// m_dateFormatNow = shortDateFormat;
+// emit this->ShortDateSignal();
+// qDebug()<<"emit ShortDateSignal";
+// }
+//}
+
+//struct tm DateTimeUtils::QDateTimeToCtm(const QDateTime &datetime)
+//{
+// struct tm c_time;
+// c_time.tm_year = datetime.date().year();
+// c_time.tm_mon = datetime.date().month();
+// c_time.tm_mday = datetime.date().day();
+// c_time.tm_hour = datetime.time().hour();
+// c_time.tm_min = datetime.time().minute();
+// c_time.tm_sec = datetime.time().second();
+
+// return c_time;
+//}
+
+QString DateTimeUtils::TranslationTime(QString time)
+{
+ qInfo()<<"sdk====>TranslationTime function";
+ if(time == tr("No information!"))
+ {
+ return time;
+ }
+ if(time == NULL)
+ {
+ return time;
+ }
+ if(!time.contains(" "))
+ {
+ return time;
+ }
+ if(!time.contains("-"))
+ {
+ return time;
+ }
+ if(!time.contains(":"))
+ {
+ return time;
+ }
+ struct tm timestruct;
+// time = "2022-08-01 22:00:00";
+ QStringList timelist = time.split(" ");
+ qDebug()<<"timelist is"<time;
+ qDebug()<timesec;
+ QString sdktime = kdk_timestruct->timesec;
+ QString sdk_time = sdkdatestring + " " +sdktime;
+ qInfo()<<"finish tanslationtime";
+ return sdk_time;
+}
+
+DateTimeUtils::~DateTimeUtils()
+{
+// if (m_dateSessionDbus)
+// delete m_dateSessionDbus;
+}
diff --git a/immutable/plugin/src/AddFunction/datetimeutils.h b/immutable/plugin/src/AddFunction/datetimeutils.h
new file mode 100644
index 0000000..7a7c448
--- /dev/null
+++ b/immutable/plugin/src/AddFunction/datetimeutils.h
@@ -0,0 +1,35 @@
+#ifndef DATETIMEUTILS_H
+#define DATETIMEUTILS_H
+
+#include
+#include
+#include
+#include
+class DateTimeUtils : public QObject
+{
+ Q_OBJECT
+public:
+ DateTimeUtils(QObject *parent = nullptr);
+ virtual ~DateTimeUtils();
+ void WatchingTimeFormat();
+ static DateTimeUtils* get_instance();
+ QString TranslationTime(QString time);
+public slots:
+ void DateFormatChange(QString dateFormat);
+ void TimeFormatChange(QString timeFormat);
+// QString TranslationTime(QString time);
+private:
+ static DateTimeUtils *m_dataTimeInstance;
+ QString m_dateFormatNow;
+ QString m_dateFormatOld;
+ QString m_timeFormatNow;
+ QString m_timeFormatOld;
+ struct tm QDateTimeToCtm(const QDateTime &datetime);
+
+
+ QDBusInterface * m_dateSessionDbus = nullptr;
+signals:
+ void ShortDateSignal();
+};
+
+#endif // DATETIMEUTILS_H
diff --git a/immutable/plugin/src/Data/global.cpp b/immutable/plugin/src/Data/global.cpp
new file mode 100644
index 0000000..4f2f951
--- /dev/null
+++ b/immutable/plugin/src/Data/global.cpp
@@ -0,0 +1,15 @@
+#include "global.h"
+
+Global::Global()
+{
+
+}
+
+Global::~Global()
+{
+
+}
+
+QString Global::UpdateMode = "True";
+QString Global::Version ="";
+int Global::ServerNum = 0;
diff --git a/immutable/plugin/src/Data/global.h b/immutable/plugin/src/Data/global.h
new file mode 100644
index 0000000..76c0b70
--- /dev/null
+++ b/immutable/plugin/src/Data/global.h
@@ -0,0 +1,19 @@
+#ifndef GLOBAL_H
+#define GLOBAL_H
+
+#include
+
+
+class Global
+{
+public:
+ Global();
+ ~Global();
+
+public:
+ static QString UpdateMode;
+ static QString Version;
+ static int ServerNum;
+};
+
+#endif // GLOBAL_H
diff --git a/immutable/plugin/src/SecondaryWidget/setwidget.cpp b/immutable/plugin/src/SecondaryWidget/setwidget.cpp
new file mode 100644
index 0000000..9af0862
--- /dev/null
+++ b/immutable/plugin/src/SecondaryWidget/setwidget.cpp
@@ -0,0 +1,342 @@
+#include "setwidget.h"
+#include "src/xatom-helper.h"
+SetWidget::SetWidget(QWidget* parent):QDialog(parent)
+{
+ this->setAutoFillBackground(true);
+ this->setBackgroundRole(QPalette::Base);
+ this->setWindowModality(Qt::ApplicationModal);
+ this->setWindowFlag(Qt::Tool);
+ this->setFixedWidth(550);
+ MotifWmHints hints;
+ hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
+ hints.functions = MWM_FUNC_ALL;
+ hints.decorations = MWM_DECOR_BORDER;
+ XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
+// this->setFixedSize(450,560);
+ showAreaWidget = new QWidget(this);
+ showAreaWidget->setObjectName("showArea");
+ scrollArea = new QScrollArea(this);
+ scrollArea->setObjectName("scroll");
+ this->setFixedHeight(560);
+// this->setFixedSize(450,560);
+ scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ scrollArea->horizontalScrollBar()->setEnabled(false);
+ scrollArea->setFixedHeight(this->height());
+ scrollArea->setWidget(showAreaWidget);
+ scrollArea->setWidgetResizable(true);
+// scrollArea->viewport()->setAttribute(Qt::WA_TranslucentBackground);
+ scrollArea->setStyleSheet("QScrollArea#scroll{background-color: transparent;}");
+ scrollArea->viewport()->setStyleSheet("QWidget#showArea{background-color: transparent;}");
+ scrollArea->verticalScrollBar()->setProperty("drawScrollBarGroove",false);
+ QVBoxLayout *mainlyt = new QVBoxLayout();
+ QHBoxLayout *titleLyt = initTitleBar();
+ QVBoxLayout *bodylyt = initBody();
+ QHBoxLayout *btnlyt = initButton();
+ mainlyt->setMargin(0);
+ mainlyt->addLayout(titleLyt);
+ mainlyt->addWidget(scrollArea);
+ mainlyt->addLayout(btnlyt);
+ mainlyt->addSpacing(25);
+ mainlyt->addStretch();
+ mainlyt->setSpacing(0);
+ mainlyt->setContentsMargins(0,0,0,0);
+ this->setLayout(mainlyt);
+ showAreaWidget->setLayout(bodylyt);
+// showAreaWidget->setFixedWidth(this->width());
+ scrollArea->setFixedHeight(this->height() - cancelBtn->height() - 30 -10- 25);
+ getInitialData();
+}
+
+
+QHBoxLayout* SetWidget::initTitleBar()
+{
+ titleText = new QLabel(showAreaWidget);
+ titleIcon = new QPushButton(showAreaWidget);
+ titleBtnClose = new QPushButton(showAreaWidget);
+ titleBtnClose->setToolTip(tr("Close"));
+ titleIcon->setObjectName("titleIcon");
+ titleIcon->setFixedSize(24,24);
+ titleIcon->setIconSize(QSize(25,25));
+ //TODO:直接从主题调图标,不会QIcon转qpixmap所以暂时从本地拿
+// titleIcon->setPixmap(QPixmap::fromImage(QImage(iconPath)));
+ titleIcon->setIcon(QIcon::fromTheme("ukui-control-center"));
+ titleIcon->setFlat(true);
+// titleIcon->setProperty("useButtonPalette", true);
+ titleIcon->setFocusPolicy(Qt::NoFocus);
+ titleIcon->setStyleSheet("QPushButton#titleIcon{border:0px;border-radius:4px;background:transparent;}"
+ "QPushButton#titleIcon::hover{border:0px;border-radius:4px;background:transparent;}"
+ "QPushButton#titleIcon::pressed{border:0px;border-radius:4px;background:transparent;}");
+ titleBtnClose->setFixedSize(30,30);
+ titleBtnClose->setToolTip(tr("Close"));
+ titleBtnClose->setIcon(QIcon::fromTheme("window-close-symbolic"));
+ titleBtnClose->setProperty("isWindowButton",0x2);
+ titleBtnClose->setProperty("useIconHighlightEffect",0x8);
+ titleBtnClose->setFlat(true);
+ connect(titleBtnClose,&QPushButton::clicked,[=](){this->close();});
+ QHBoxLayout *hlyt = new QHBoxLayout;
+ titleText->setText(tr("Advanced Option"));
+ hlyt->setSpacing(0);
+ hlyt->setMargin(4);
+ hlyt->addSpacing(4);
+ hlyt->addWidget(titleIcon); //居下显示
+ hlyt->addSpacing(8);
+ hlyt->addWidget(titleText);//,0,Qt::AlignBottom
+ hlyt->addStretch();
+ hlyt->addWidget(titleBtnClose);
+ return hlyt;
+}
+
+QVBoxLayout* SetWidget::initBody()
+{
+ QVBoxLayout *vLayout4 = initServerAddress();
+ QVBoxLayout *vlyt = new QVBoxLayout;
+ vlyt->setMargin(0);
+ vlyt->setSpacing(0);
+ vlyt->addLayout(vLayout4);
+ vlyt->addStretch();
+ vlyt->setContentsMargins(24,10,24,10);
+ return vlyt;
+}
+
+QVBoxLayout* SetWidget::initServerAddress()
+{
+ serverAddressTitleLabel = new QLabel(showAreaWidget);
+ serverAddressTitleLabel->setAlignment(Qt::AlignLeft);
+ serverAddressTitleLabel->setText(tr("Server address settings"));
+ tipsTextLabel = new QLabel(showAreaWidget);
+ tipsTextLabel->setAlignment(Qt::AlignLeft);
+ tipsTextLabel->setText(tr("If internal services, change the server address."));
+// ProtocolLabel = new QLabel(showAreaWidget);
+// ProtocolLabel->setAlignment(Qt::AlignLeft);
+// ProtocolLabel->setFixedWidth(80);
+// ProtocolLabel->setText(tr("Protocal"));
+ ProtocolComboBox = new QComboBox(showAreaWidget);
+ ProtocolComboBox->setFixedWidth(112);
+ ProtocolComboBox->setEditable(false);
+ ProtocolComboBox->setObjectName("comboBox1");
+ ProtocolComboBox->addItem("https://");
+ ProtocolComboBox->addItem("http://");
+ PortLabel = new QLabel(showAreaWidget);
+ PortLabel->setAlignment(Qt::AlignLeft);
+ PortLabel->setFixedWidth(80);
+ PortLabel->setText(tr("Port ID "));
+ PortEdit = new QLineEdit(showAreaWidget);
+ PortEdit->setFixedWidth(112);
+ PortEdit->setObjectName("PortEdit");
+ QRegExp regx("[0-9]+$");
+ QValidator* validator = new QRegExpValidator(regx, PortEdit);
+ PortEdit->setValidator(validator);
+ AddressLabel = new QLabel(showAreaWidget);
+ AddressLabel->setAlignment(Qt::AlignLeft);
+ AddressLabel->setText(tr("Address"));
+ AddressLabel->setFixedWidth(80);
+ IPEdit = new QLineEdit(showAreaWidget);
+ IPEdit->setObjectName("IPEdit");
+ IPEdit->setFixedWidth(250);
+
+ QHBoxLayout *hlayout1 = new QHBoxLayout();
+ hlayout1->addWidget(serverAddressTitleLabel,0,Qt::AlignLeft);
+ hlayout1->addStretch();
+ hlayout1->setSpacing(0);
+ hlayout1->setContentsMargins(0,0,0,0);
+
+ QHBoxLayout *hlayout2 = new QHBoxLayout();
+ hlayout2->addWidget(tipsTextLabel,0,Qt::AlignLeft);
+ hlayout2->addStretch();
+ hlayout2->setSpacing(0);
+ hlayout2->setContentsMargins(0,0,0,0);
+
+ QHBoxLayout *hlayout3 = new QHBoxLayout();
+ hlayout3->addWidget(AddressLabel,0,Qt::AlignLeft);
+ hlayout3->addSpacing(4);
+// hlayout3->addWidget(ProtocolLabel,0,Qt::AlignLeft);
+// hlayout3->addSpacing(4);
+ hlayout3->addWidget(ProtocolComboBox,0,Qt::AlignLeft);
+ hlayout3->addSpacing(4);
+ hlayout3->addWidget(IPEdit);
+ hlayout3->addStretch();
+ hlayout3->setSpacing(0);
+ hlayout3->setContentsMargins(0,0,0,0);
+
+ QHBoxLayout *hlayout4 = new QHBoxLayout();
+ hlayout4->addWidget(PortLabel);
+ hlayout4->addSpacing(4);
+ hlayout4->addWidget(PortEdit);
+ hlayout4->setSpacing(0);
+ hlayout4->addStretch();
+ hlayout4->setContentsMargins(0,0,0,0);
+
+// QHBoxLayout *hlayout5 = new QHBoxLayout();
+// hlayout5->addWidget(AddressLabel);
+// hlayout5->addSpacing(4);
+// hlayout5->addWidget(IPEdit);
+// hlayout5->addStretch();
+// hlayout5->setSpacing(0);
+// hlayout5->setContentsMargins(0,0,0,0);
+
+ QVBoxLayout *vlayout = new QVBoxLayout();
+ vlayout->addLayout(hlayout1);
+ vlayout->addSpacing(12);
+ vlayout->addLayout(hlayout2);
+ vlayout->addSpacing(8);
+ vlayout->addLayout(hlayout3);
+ vlayout->addSpacing(8);
+ vlayout->addLayout(hlayout4);
+// vlayout->addSpacing(8);
+// vlayout->addLayout(hlayout5);
+ vlayout->setSpacing(0);
+ vlayout->setContentsMargins(0,0,0,0);
+ return vlayout;
+}
+
+
+QHBoxLayout *SetWidget::initButton()
+{
+ resetBtn = new QPushButton(this);
+ resetBtn->setText(tr("reset"));
+// resetBtn->setFlat(true);
+// resetBtn->setText(tr("Restore default settings"));
+ resetBtn->setObjectName("resetBtn");
+ connect(resetBtn,SIGNAL(clicked()),this,SLOT(slotRestoreDefaultSettings()));
+ cancelBtn = new QPushButton(this);
+ cancelBtn->setText(tr("Cancel"));
+ connect(cancelBtn,&QPushButton::clicked,[=](){this->close();});
+ determineBtn = new QPushButton(this);
+ determineBtn->setText(tr("OK"));
+ connect(determineBtn,SIGNAL(clicked(bool)),this,SLOT(slotModifysettings()));
+ QHBoxLayout *hlayout = new QHBoxLayout();
+ hlayout->addWidget(resetBtn,0,Qt::AlignVCenter);
+ hlayout->addStretch();
+ hlayout->addWidget(cancelBtn,0,Qt::AlignVCenter);
+ hlayout->addSpacing(10);
+ hlayout->addWidget(determineBtn,0,Qt::AlignVCenter);
+ hlayout->setSpacing(0);
+ hlayout->setContentsMargins(24,0,24,0);
+
+ return hlayout;
+
+}
+
+
+/*****************获取数据********************/
+void SetWidget::getInitialData()
+{
+ QString filename = "/var/lib/kylin-software-properties/template/kylin-source-update.conf";
+ QSettings *setting = new QSettings(filename, QSettings::IniFormat);
+ setting->setIniCodec("utf8");
+ QStringList group = setting->childGroups();
+ int num = group.count();
+ int Priority;
+ int tmp = 0;
+ int i;
+ for(i=0; ibeginGroup(Service);
+ Priority = setting->value("Priority").toInt();
+ qDebug()<<"the Priority is "<endGroup();
+ if(Priority > tmp)
+ {
+ tmp = Priority;
+ flag = Service;
+ }
+ i++;
+ }
+ if(Priority == 0)
+ {
+ qInfo()<<"Priority is 0,find priority";
+ qInfo()<<"==================";
+ for(i=0; ibeginGroup(Service);
+ Priority = setting->value("priority").toInt();
+ qDebug()<<"the priority is "<endGroup();
+ if(Priority > tmp)
+ {
+ tmp = Priority;
+ flag = Service;
+ }
+ i++;
+ }
+ qInfo()<<"==================";
+ }
+ qDebug()<<"the tmp is" <beginGroup(flag);
+ QString Port = setting->value("Port").toString();
+ qDebug()<<"the Port is "<< Port;
+ PortEdit->setText(Port);
+ /*IP Address initial*/
+ QString fullname = setting->value("Address").toString();
+ qDebug()<<"the fullname is "<setCurrentText("https://");
+ }
+ else
+ {
+ ProtocolComboBox->setCurrentText(networkprotocal+"://");
+ }
+ QString domainname = namelist.at(1);
+ qDebug()<<"the domainname is "<< domainname;
+ IPEdit->setText(domainname);
+}
+
+
+
+/**********************************槽函数***********************************/
+void SetWidget::slotRestoreDefaultSettings()
+{
+ qDebug()<<"reset the default setting";
+// QDBusInterface modify_interface( "com.kylin.software.properties",
+// "/com/kylin/software/properties",
+// "com.kylin.software.properties.interface",
+// QDBusConnection::systemBus() );
+ ProtocolComboBox->setCurrentText("http://");
+ PortEdit->setText("59546");
+ IPEdit->setText("archive1.kylinos.cn");
+// QDBusMessage modelist = modify_interface.call("setServerAddressConf","Server","http://archive1.kylinos.cn","59546");
+// QDBusMessage modelist1 = modify_interface.call("setServerAddressConf","Server1","https://archive1.kylinos.cn","59546");
+}
+
+void SetWidget::slotModifysettings()
+{
+ QString group = flag;
+ QString protocol = ProtocolComboBox->currentText();
+ QString domainname = IPEdit->text();
+ QString IP = protocol+domainname;
+ QString port = PortEdit->text();
+ qDebug()<activeModalWidget());
+ msgBox.setText(tr("Modification failed!"));
+ msgBox.setWindowTitle(tr("Attention"));
+ msgBox.setIcon(QMessageBox::Icon::Warning);
+ msgBox.addButton(tr("OK"), QMessageBox::YesRole);
+ }
+ else
+ {
+ this->close();
+ }
+}
diff --git a/immutable/plugin/src/SecondaryWidget/setwidget.h b/immutable/plugin/src/SecondaryWidget/setwidget.h
new file mode 100644
index 0000000..2395cae
--- /dev/null
+++ b/immutable/plugin/src/SecondaryWidget/setwidget.h
@@ -0,0 +1,80 @@
+#ifndef SETWIDGET_H
+#define SETWIDGET_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+class SetWidget : public QDialog
+{
+ Q_OBJECT
+public:
+
+ QMap serverMap;
+
+ QString flag = nullptr;
+
+ QWidget *showAreaWidget = nullptr;
+ QScrollArea *scrollArea = nullptr;
+
+ QLabel *titleText = nullptr;
+ QPushButton* titleIcon = nullptr;
+ QPushButton *titleBtnClose = nullptr;
+
+ QLabel *serverAddressTitleLabel = nullptr;
+ QLabel *tipsTextLabel = nullptr;
+// QLabel *ProtocolLabel = nullptr;
+ QComboBox *ProtocolComboBox = nullptr;
+ QLabel *PortLabel = nullptr;
+ QLineEdit *PortEdit = nullptr;
+ QLabel *AddressLabel = nullptr;
+ QLineEdit *IPEdit = nullptr;
+
+
+
+ QPushButton *resetBtn = nullptr;
+ QPushButton *cancelBtn = nullptr;
+ QPushButton *determineBtn = nullptr;
+
+ QHBoxLayout* initTitleBar();
+ QVBoxLayout* initBody();
+ QVBoxLayout* initDownloadDir(); //初始化设置界面下载路径模块
+ QVBoxLayout* initPackageClean(); //初始化设置界面包清理模块
+ QVBoxLayout* initUpdatePackage(); //初始化设置界面包清理模块
+ QVBoxLayout* initServerAddress(); //初始化服务器地址
+ QHBoxLayout* initButton();
+ void getInitialData(); //获取初始数据
+ void slotClickComboBox1(); //combox1添加item
+ void slotClickLineEdit1(); //combox1添加item
+ SetWidget(QWidget* parent = nullptr);
+
+public Q_SLOTS:
+ void slotSoftUpdateCheckBox5(); //处理应用更新处按钮的点击
+ void slotSoftUpdateCheckBox6(); //处理应用更新处按钮的点击
+ void slotRestoreDefaultSettings(); //恢复默认设置
+ void slotModifysettings(); //修改设置
+
+};
+
+#endif // SETWIDGET_H
diff --git a/immutable/plugin/src/appupdate.cpp b/immutable/plugin/src/appupdate.cpp
new file mode 100644
index 0000000..234aee2
--- /dev/null
+++ b/immutable/plugin/src/appupdate.cpp
@@ -0,0 +1,238 @@
+#include "appupdate.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+using namespace std;
+
+#define JSON_FILE_PATH "/var/cache/kylin-system-updater/json/"
+
+AppUpdateWid::AppUpdateWid(AppAllMsg msg,QWidget *parent):QWidget(parent)
+{
+ m_updateMutual = UpdateDbus::getInstance(this);
+ qRegisterMetaType("AppMsg"); //注册信号槽类型
+ qRegisterMetaType("AppAllMsg"); //注册信号槽类型
+ appAllMsg = msg;
+ updateAppUi(appAllMsg.name);
+ this->setObjectName("AppUpdateWid");
+ initConnect();
+}
+
+void AppUpdateWid::updateAppUi(QString name)
+{
+ this->setFixedHeight(60);
+ appname.clear();
+ appname = name;
+ frameLayout = new QHBoxLayout();
+ frameLayout->setContentsMargins(0,0,0,0); //更新信息之间的间距
+ frameLayout->setSpacing(0);
+ this->setLayout(frameLayout);
+
+ AppFrame = new QFrame(this); //最外层窗口适配主题样式
+ AppFrame->setFrameShape(QFrame::Box);
+ AppFrame->setMaximumSize(QSize(16777215, 16777215));
+ frameLayout->addWidget(AppFrame);
+
+ mainVLayout = new QHBoxLayout();
+// smallHLayout = new QHBoxLayout();
+ appTitleWid = new QWidget();
+
+ iconNameLayout = new QHBoxLayout();
+ appIconName = new QLabel(this);
+ appIconName->setFixedWidth(200);
+ appIcon = new QLabel(appIconName);
+ appNameLab = new MyLabel(appIconName);
+ appIconName->setLayout(iconNameLayout);
+ appIcon->setFixedSize(32,32);
+ iconNameLayout->addSpacing(6);
+ iconNameLayout->addWidget(appIcon,1);
+ iconNameLayout->addSpacing(8);
+ iconNameLayout->addWidget(appNameLab,10);
+
+ appVersion = new FixLabel(this);
+ appVersion ->setFixedWidth(250);
+
+ detaileInfo = new KBorderlessButton(this);
+ // detaileInfo->setText(tr("详情"));
+ detaileInfo->setText(tr("details"));
+
+ QPalette palette_datailInfo = detaileInfo->palette();
+ palette_datailInfo.setColor(QPalette::ButtonText,QColor(55,144,250));
+ detaileInfo->setPalette(palette_datailInfo);
+
+ updateAPPBtn = new QPushButton(this);
+ // updateAPPBtn->setText(tr("更新"));
+ updateAPPBtn->setText(tr("Update"));
+ updateAPPBtn->setFixedWidth(95);
+ updateAPPBtn->hide();
+
+ mainVLayout->addWidget(appIconName,1,Qt::AlignLeft);
+ mainVLayout->addWidget(appVersion,1,Qt::AlignLeft);
+ mainVLayout->addWidget(detaileInfo,0,Qt::AlignHCenter);
+ mainVLayout->addSpacing(60);
+ mainVLayout->addWidget(updateAPPBtn,0,Qt::AlignHCenter);
+ mainVLayout->setContentsMargins(0,0,10,0);
+// appTitleWid->setLayout(smallHLayout);
+// mainVLayout->addWidget(appTitleWid);
+ mainVLayout->setMargin(0);
+ mainVLayout->setSpacing(0);
+
+ AppFrame->setLayout(mainVLayout);
+ QMap map = getNameAndIconFromJson(name);
+ if (!map.value("name").isNull())
+ {
+ dispalyName = map.value("name");
+ qInfo()<<"map.value.isNull()"<setText(dispalyName);
+ /*判断图标,优先级: JSON文件指定 > qrc资源文件中 > 主题 > 默认*/
+ if (!map.value("icon").isNull()) {
+ haveThemeIcon = true;
+ appIcon->setPixmap(QPixmap(map.value("icon")));
+ } else if (name.contains("kylin-update-desktop-")||name == "linux-generic") {
+ qInfo()<<"app exsist icon";
+ haveThemeIcon = true;
+ pkgIconPath = QString(":/img/upgrade/%1.png").arg(name);
+ appIcon->setPixmap(QPixmap(pkgIconPath));
+ } else if (QIcon::fromTheme(name).hasThemeIcon(name)) { //判断是否有主题图标并输出
+ haveThemeIcon = true;
+ qInfo()<<"theme exsist icon";
+ QIcon icon = QIcon::fromTheme(name);
+ QPixmap pixmap = icon.pixmap(icon.actualSize(QSize(32, 32)));
+ appIcon->setPixmap(pixmap);
+ } else {
+ qInfo()<<"else exsist icon";
+ QIcon icon = QIcon::fromTheme("application-x-desktop");
+ QPixmap pixmap = icon.pixmap(icon.actualSize(QSize(32, 32)));
+ appIcon->setPixmap(pixmap);
+ }
+ QString newStrMsg = appAllMsg.availableVersion;
+
+ if(newStrMsg.size()>16)
+ {
+ appVersion->setText(tr("Version:")+newStrMsg);
+ appVersion->setToolTip(tr("Version:")+newStrMsg);
+ }
+ else
+ {
+ // appVersion->setText(tr("最新:")+newStrMsg);
+ appVersion->setText(tr("Version:")+newStrMsg);
+ appVersion->setToolTip("");
+ }
+}
+
+
+AppUpdateWid::~AppUpdateWid()
+{
+}
+
+void AppUpdateWid::initConnect()
+{
+ connect(detaileInfo,&QPushButton::clicked,this,&AppUpdateWid::showDetails);
+}
+
+QMap AppUpdateWid::getNameAndIconFromJson(QString pkgname)
+{
+ QMap nameIconList;
+ /*判断json文件是否存在*/
+ QString filename = QString(JSON_FILE_PATH) +pkgname +".json";
+ qInfo()<<"getNameAndIconFromJson's filename is "<setFixedSize(420,314);
+ detaillog->logContent->clear();
+ detaillog->setContentsMargins(24,24,24,24);
+ QPoint detail_pos = detaileInfo->mapToGlobal(detaileInfo->pos());
+ detaillog->move(QCursor().pos().x()-detaillog->width(),detail_pos.y()+detaileInfo->height());
+ QString appname_lab = appNameLab->text();
+ qInfo()<<"the appname_lab is"<< appname_lab;
+ QString filename = "/var/cache/kylin-system-updater/json/"+appname+".json";
+ qInfo()<<"file name is: "<logContent->append(description);
+// msg->shortDescription=description;
+ }
+ else
+ {
+ detaillog->logContent->append(tr("Cumulative updates"));
+ }
+ }
+ else
+ {
+ QString name = object.value("name").toObject().value("en_US").toString();
+ QString description = object.value("description").toObject().value("en_US").toString();
+ if (!description.isNull()) {
+// msg->shortDescription=description;
+ detaillog->logContent->append(description);
+ }
+ else
+ {
+ detaillog->logContent->append(tr("Cumulative updates"));
+ }
+ }
+ }
+ }
+ file.close();
+ detaillog->show();
+}
diff --git a/immutable/plugin/src/appupdate.h b/immutable/plugin/src/appupdate.h
new file mode 100644
index 0000000..85ff04d
--- /dev/null
+++ b/immutable/plugin/src/appupdate.h
@@ -0,0 +1,148 @@
+#ifndef APPUPDATE_H
+#define APPUPDATE_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "utils.h"
+#include "updatelog.h"
+#include
+#include
+#include "updatedbus.h"
+#include
+#include "mylabel.h"
+#include "src/Data/global.h"
+#include
+#include
+#include
+#include "detaildialog.h"
+
+#include
+#include
+#include
+#include
+//#include
+#include "ukcc/interface/upgradeukcccommon.h"
+//#include
+#include "ukcc/widgets/lightlabel.h"
+class Detaildialog;
+class UpdateLog;
+using namespace kdk;
+class AppUpdateWid : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit AppUpdateWid(AppAllMsg msg, QWidget *parent = nullptr);
+ ~AppUpdateWid();
+// Detaildialog *detaillog;
+
+ QString appname = nullptr;
+
+ QFrame *AppFrame;
+ UpdateLog *updatelog1;
+ UpdateDbus *m_updateMutual;
+ //缩略界面
+ QLabel *appIcon;
+ QLabel *appIconName;
+ MyLabel *appNameLab;
+ FixLabel *appVersion;
+ QLabel *appVersionIcon;
+
+ QLabel *progressLab; //进度
+ QLabel *otherBtnLab;
+ QLabel *versionLab;
+ KBorderlessButton *detaileInfo;
+ QPushButton *updateAPPBtn;
+ QWidget *appTitleWid;
+ QHBoxLayout *frameLayout;
+ QHBoxLayout *iconNameLayout;
+ QHBoxLayout *smallHLayout;
+ QVBoxLayout *largeVLayout;
+ QHBoxLayout *versionlabLayout;
+ QHBoxLayout *otherBtnLayout;
+ QWidget *largeWidget;
+ QHBoxLayout *mainVLayout;
+ //展开界面
+ QTextEdit *someInfoEdit; //详情内容
+ QPushButton *updatelogBtn;
+// AppMsg *thisAppMessage;
+ QString chlog; //更新日志完整内容
+ QString description; //更新包描述
+ QString setDefaultDescription(QString str); //将虚包包名汉化
+ void updateOneApp(bool status); //控制更新单个app
+ QString dispalyName;
+ QString modifySpeedUnit(long size, float time);
+ void distUpgradePartial(bool status);
+ void updateaccept();
+ void updatecancel();
+private:
+ bool isCancel = false;
+ int connectTimes = 0;
+ bool downloadFinish = false;
+ bool stopTimer = false;
+ UrlMsg urlmsg;
+ QString path;
+ QString currentPackage;
+ QStringList downloadList;
+ QStringList downloadPackages;
+ AppAllMsg appAllMsg;
+ QProcess *downloadProcess;
+ QProcess *workProcess;
+ QTimer *timer;
+ QString downloadPath;
+
+ bool execFun = true;
+
+public:
+ bool isUpdateAll = false;
+ bool isAutoUpgrade = false;
+ bool haveThemeIcon = false;
+ bool downloadstart = false;
+ bool shutdown_install = false;
+
+public slots:
+ void showDetails();
+
+ void updateAllApp();
+private:
+ void wgetDownload(UrlMsg msg, QString path); //断点续传下载
+ bool getDownloadSpeed(QString appName, QString fullName, int fileSize); //获取下载速度
+ void initConnect(); //初始化信号槽
+ void changeDownloadState(int state);
+ type checkSourcesType();
+ QStringList analysis_config_file(char *p_file_path);
+ void remove_last_enter(char *p_src_in_out);
+ void enableupdateAPPBtn(bool enabled);//取消按钮是否置灰
+
+ QMap getNameAndIconFromJson(QString pkgname);
+
+ enum Environment{
+ en,
+ zh_cn
+ }environment;
+
+signals:
+ void startWork(QString appName);
+ void startMove(QStringList list, QString appName);
+ void oneappUpdateResultSignal(bool state,QStringList pkgname,QString error,QString reason);
+ void changeUpdateAllSignal(bool isUpdate);
+ void downloadFailedSignal(int exitCode); //网络异常或者其他情况下下载失败时
+ void appupdateiscancel();
+ void sendProgress(QString pkgName, int Progress, QString type);
+ void changeupdateall();
+ void allappupdatefinishsignal();
+ void startoneappupdate();
+ void ShutdowninstallFinishSignal();//shutdownfinishsignal
+
+private:
+ void updateAppUi(QString name);
+ QString translationVirtualPackage(QString str);
+ QString pkgIconPath = "";
+};
+
+#endif // APPUPDATE_H
diff --git a/plugin/src/checkbutton.cpp b/immutable/plugin/src/checkbutton.cpp
similarity index 100%
rename from plugin/src/checkbutton.cpp
rename to immutable/plugin/src/checkbutton.cpp
diff --git a/plugin/src/checkbutton.h b/immutable/plugin/src/checkbutton.h
similarity index 100%
rename from plugin/src/checkbutton.h
rename to immutable/plugin/src/checkbutton.h
diff --git a/plugin/src/connection.h b/immutable/plugin/src/connection.h
similarity index 100%
rename from plugin/src/connection.h
rename to immutable/plugin/src/connection.h
diff --git a/plugin/src/daemonipcdbus.cpp b/immutable/plugin/src/daemonipcdbus.cpp
similarity index 100%
rename from plugin/src/daemonipcdbus.cpp
rename to immutable/plugin/src/daemonipcdbus.cpp
diff --git a/plugin/src/daemonipcdbus.h b/immutable/plugin/src/daemonipcdbus.h
similarity index 100%
rename from plugin/src/daemonipcdbus.h
rename to immutable/plugin/src/daemonipcdbus.h
diff --git a/immutable/plugin/src/detaildialog.cpp b/immutable/plugin/src/detaildialog.cpp
new file mode 100644
index 0000000..d21f505
--- /dev/null
+++ b/immutable/plugin/src/detaildialog.cpp
@@ -0,0 +1,53 @@
+#include "detaildialog.h"
+/*点击appwidget详情的弹窗*/
+Detaildialog::Detaildialog(QWidget *parent) : QDialog(parent)
+//Detaildialog::Detaildialog(QWidget *parent,AppAllMsg msg) : QDialog(parent)
+{
+
+ qRegisterMetaType("AppMsg"); //注册信号槽类型
+ qRegisterMetaType("AppAllMsg"); //注册信号槽类型
+
+ MotifWmHints hints;
+ hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
+ hints.functions = MWM_FUNC_ALL;
+ hints.decorations = MWM_DECOR_BORDER;
+ XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
+
+ logUi();
+
+}
+void Detaildialog::logUi()
+{
+// this->setWindowFlags(Qt::Popup);
+// |Qt::FramelessWindowHint|Qt::NoDropShadowWindowHint
+ logContent = new QTextEdit(this);
+ logContent->setReadOnly(true);
+ logContent->lineWrapMode();
+ installContent = new FixLabel(this);
+ installContent->setFixedHeight(26);
+ logMainLayout = new QVBoxLayout(this);
+
+ this->setLayout(logMainLayout);
+ logMainLayout->addWidget(logContent,Qt::AlignCenter);
+ logMainLayout->addStretch(1);
+ logMainLayout->addWidget(installContent,Qt::AlignLeft|Qt::AlignBottom);
+}
+
+bool Detaildialog::event(QEvent *event)
+{
+ if(QEvent::WindowDeactivate == event->type())
+ {
+ qDebug()<<"焦点在窗口之外";
+ this->close();
+ }
+ else
+ {
+ qDebug()<<"焦点在窗口里面";
+ }
+ return QWidget::event(event);
+}
+
+
+Detaildialog::~Detaildialog()
+{
+}
diff --git a/immutable/plugin/src/detaildialog.h b/immutable/plugin/src/detaildialog.h
new file mode 100644
index 0000000..791c3f9
--- /dev/null
+++ b/immutable/plugin/src/detaildialog.h
@@ -0,0 +1,53 @@
+#ifndef DETAILDIALOG_H
+#define DETAILDIALOG_H
+/*点击appwidget详情的弹窗*/
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+//#include
+#include "ukcc/widgets/fixlabel.h"
+#include "appupdate.h"
+
+class Detaildialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit Detaildialog(QWidget *parent = nullptr);
+
+ void logUi();
+ ~Detaildialog();
+
+ QLabel *logAppIcon;
+ QLabel *logAppName;
+ QLabel *logAppVerson;
+
+ QWidget *logWidget;
+ QWidget *logAppWidget;
+
+ QHBoxLayout *logAppHLayout;
+ QVBoxLayout *logAppVLayout;
+
+ QVBoxLayout *logVLayout;
+
+ QVBoxLayout *logMainLayout;
+
+ QTextEdit *logContent;
+ FixLabel *installContent;
+ QFrame *contentFrame;
+
+protected:
+// void mousePressEvent(QMouseEvent *event) override;
+ bool event(QEvent *event) override;
+// bool eventFilter(QObject *, QEvent *);
+// bool eventFilter(QObject *obj,QEvent *event);
+};
+
+
+
+#endif // DETAILDIALOG_H
diff --git a/immutable/plugin/src/historyupdatelistwig.cpp b/immutable/plugin/src/historyupdatelistwig.cpp
new file mode 100644
index 0000000..0df621d
--- /dev/null
+++ b/immutable/plugin/src/historyupdatelistwig.cpp
@@ -0,0 +1,295 @@
+#include "historyupdatelistwig.h"
+#include
+#include
+#include
+#define ORG_UKUI_STYLE "org.ukui.style"
+#define GSETTING_KEY "systemFontSize"
+
+const QString FIND_UPDATE_LABLE_TYPE = "FIND_UPDATE_LABLE_TYPE";//历史更新模块标签
+const QString FIND_DES_LABLE_TYPE = "FIND_DES_LABLE_TYPE";//历史更新模块标签
+const QString FIND_CLG_LABLE_TYPE = "FIND_CLG_LABLE_TYPE";//历史更新模块标签
+const QString IS_SELECT = "IS_SELECT";//历史更新模块标签
+const int WIDTH = 296 - 2;
+const int LINE_SPACING = 2;
+const int TOP_MARGIN = 5;//上(下)边距
+const int RIGHT_MARGIN = 3;//右边距
+const int LEFT_MARGIN = 9;//左边距文字和lable本身有边距
+/*hcy仅维护,未处理过历史界面,继承自2107部分*/
+HistoryUpdateListWig::HistoryUpdateListWig(QLabel* destab)
+{
+ /*sdk 时间格式接口*/
+ m_dateSessionDbus = new QDBusInterface("com.kylin.kysdk.DateServer",
+ "/com/kylin/kysdk/Date",
+ "com.kylin.kysdk.DateInterface",
+ QDBusConnection::sessionBus(),
+ this);
+ if (m_dateSessionDbus->isValid()) {
+ connect(m_dateSessionDbus,SIGNAL(ShortDateSignal(QString)),this,SLOT(UpdateSdkTime(QString)));
+ connect(m_dateSessionDbus,SIGNAL(TimeSignal(QString)), this, SLOT(UpdateSdkTime(QString)));
+ }
+ this->mDesTab = destab;
+ datetimeutils = DateTimeUtils::get_instance();
+ initUI();
+ gsettingInit();
+}
+HistoryUpdateListWig::~HistoryUpdateListWig()
+{
+ debName->deleteLater();
+ debStatue->deleteLater();
+ hl1->deleteLater();
+ hl2->deleteLater();
+ vl1->deleteLater();
+}
+void HistoryUpdateListWig::initUI()
+{
+ font.setBold(true);
+
+ /* 窗口初始化 */
+ this->setFrameStyle(QFrame::Box);
+// this->setStyleSheet("QFrame{border-radius:4px;}");
+ QPalette palette = qApp->palette();
+ QColor listcolor = palette.button().color();
+ palette.setBrush(QPalette::Base,listcolor);
+ this->setPalette(palette);
+ /* 实例化控件 */
+ debName = new QLabel;
+ debName->setWordWrap(true);
+ debName->setFixedWidth(WIDTH - LEFT_MARGIN - LEFT_MARGIN);//
+ debName->setFont(font);
+
+ debStatue = new QLabel;
+ debStatue->setWordWrap(true);
+ debStatue->setFixedWidth(WIDTH - LEFT_MARGIN - LEFT_MARGIN);//
+
+ /* 布局 */
+ hl1 = new QHBoxLayout;
+ hl2 = new QHBoxLayout;
+ vl1 = new QVBoxLayout;
+
+ hl1->setSpacing(0);
+ hl1->setMargin(0);
+ hl2->setSpacing(0);
+ hl2->setMargin(0);
+ vl1->setSpacing(0);
+ vl1->setMargin(0);
+
+ hl1->addSpacing(LEFT_MARGIN);
+ hl1->addWidget(debName);
+ hl1->addSpacing(RIGHT_MARGIN);
+
+ hl2->addSpacing(LEFT_MARGIN);
+ hl2->addWidget(debStatue);
+ hl2->addSpacing(RIGHT_MARGIN);
+
+ vl1->addSpacing(TOP_MARGIN);
+ vl1->addLayout(hl1);
+ vl1->addLayout(hl2);
+ vl1->addSpacing(TOP_MARGIN);
+
+ this->setLayout(vl1);
+ this->layout()->setSizeConstraint(QLayout::SetFixedSize);
+}
+
+void HistoryUpdateListWig::setAttribute(const QString &mname,const QString &mstatue, const QString &mtime,const QString &mdescription,const QString &mchangelog,const QString &merrorcode,const int &myid)
+{
+ this->mNameLabel = mname;
+
+ /* 单行显示 , 超出范围加... 和悬浮框 */
+ QFontMetrics nameFontMetrics(debName->font());
+ int nameFontSize = nameFontMetrics.width(mname);
+ int nameLableWidth = debName->width();
+ QString nameFormatBody = mname;
+ if (nameFontSize > (nameLableWidth - 10)) {
+ nameFormatBody = nameFontMetrics.elidedText(nameFormatBody , Qt::ElideRight , nameLableWidth - 10);
+ debName->setText(nameFormatBody);
+ this->nameTipStatus = true;
+ debName->setToolTip(mname);
+ } else {
+ this->nameTipStatus = false;
+ debName->setText(nameFormatBody);
+ }
+
+ QString str = "";
+ if(mstatue == "success" | mstatue == "Success")
+ {
+ str=tr("Success"); //更新成功
+ debDescription=mchangelog;
+ }
+ else
+ {
+ str=tr("Failed"); //更新失败
+ debDescription=merrorcode;
+ }
+ debChangelog=mchangelog;
+ QString checkedtime = datetimeutils->TranslationTime(mtime);
+ str+=" "+checkedtime;
+
+ this->mStatusLabel = str;
+
+ QFontMetrics statueFontMetrics(debStatue->font());
+ int statueFontSize = statueFontMetrics.width(str);
+ int statueLableWidth = debStatue->width();
+ QString statueFormatBody = str;
+ if (statueFontSize > (statueLableWidth - 10)) {
+ statueFormatBody = statueFontMetrics.elidedText(statueFormatBody , Qt::ElideRight , statueLableWidth - 10);
+ debStatue->setText(statueFormatBody);
+ debStatue->setToolTip(str);
+ this->statusTipStatus = true;
+ } else {
+ debStatue->setText(statueFormatBody);
+ this->statusTipStatus = false;
+ }
+ id = myid;
+}
+
+QSize HistoryUpdateListWig::getTrueSize()
+{
+ QSize lsize =this->layout()->sizeHint();
+ //lsize.setHeight(lsize.rheight()+LINE_SPACING*2);
+ return lsize;
+}
+
+//鼠标 点击
+void HistoryUpdateListWig::mousePressEvent(QMouseEvent * e)
+{
+ if(e->button() == Qt::LeftButton)
+ {
+ setDescription();
+ selectStyle();
+ }
+ if(e->button() == Qt::RightButton)
+ {
+ clearStyleSheet();
+ }
+}
+
+void HistoryUpdateListWig::selectStyle()
+{
+ //如果上次选中的也是自身
+ if(this->statusTip()==IS_SELECT)
+ return;
+ //清除其他item选中样式及标签
+ QList list = this->parent()->findChildren();
+ for(HistoryUpdateListWig *tmp : list)
+ {
+ if(tmp->statusTip()==IS_SELECT)
+ {
+ qInfo()<<"all clear";
+ tmp->clearStyleSheet();
+ /* 重设tips */
+ if (tmp->nameTipStatus == true) {
+ tmp->debName->setToolTip(tmp->mNameLabel);
+ } else {
+ tmp->debName->setToolTip(QString(""));
+ }
+
+ if (tmp->statusTipStatus == true) {
+ tmp->debStatue->setToolTip(tmp->mStatusLabel);
+ } else {
+ tmp->debStatue->setToolTip(QString(""));
+ }
+ }
+ }
+
+ //设置选中样式及标签
+ qInfo()<<"选中标签样式";
+// debName->setToolTip(QString(""));
+// debStatue->setToolTip(QString(""));
+ debName->setStyleSheet("QLabel{color:#fff;}");
+ debStatue->setStyleSheet("QLabel{color:#fff;}");
+ int r = qApp->palette().highlight().color().red();
+ int g = qApp->palette().highlight().color().green();
+ int b = qApp->palette().highlight().color().blue();
+ qDebug()<setStyleSheet("QFrame{background-color:rgba(55, 144, 250, 1);border-radius:4px}");
+ QString style = "QFrame{background-color:rgba(%1,%2, %3, 1);border-radius:4px;}";
+ this->setStyleSheet(style.arg(r).arg(g).arg(b));
+ this->setStatusTip(IS_SELECT);
+
+ //详细内容
+ setDescription();
+}
+
+void HistoryUpdateListWig::clearStyleSheet()
+{
+ qInfo()<<"clearStyleSheet";
+ debName->setStyleSheet("");
+ debStatue->setStyleSheet("");
+// this->setStyleSheet("QFrame{border-radius:4px;}");
+ QPalette palette = qApp->palette();
+ QColor listcolor = palette.button().color();
+ palette.setBrush(QPalette::Base,listcolor);
+ this->setPalette(palette);
+ this->setStyleSheet("");
+ this->setStatusTip("");
+}
+
+void HistoryUpdateListWig::setDescription()
+{
+ if (this->mDesTab != nullptr) {
+ this->mDesTab->setFont(this->font);
+ this->mDesTab->setText(this->mNameLabel);
+ }
+
+ QObject *findwig = this->parent();
+ while(findwig != nullptr)
+ {
+ if(findwig->objectName()==FIND_UPDATE_LABLE_TYPE)
+ {
+ QTextEdit *dsc = findwig->findChild(FIND_DES_LABLE_TYPE,Qt::FindChildrenRecursively);
+ if(dsc==nullptr)
+ qDebug()<<"找不到要赋值的窗口1";
+ else
+ dsc->setText(debDescription);
+
+ QTextEdit *changelog = findwig->findChild(FIND_CLG_LABLE_TYPE,Qt::FindChildrenRecursively);
+ if(changelog==nullptr)
+ qDebug()<<"找不到要赋值的窗口2";
+ else
+ changelog->setText(debChangelog);
+ }
+ findwig = findwig->parent();
+ }
+
+}
+
+void HistoryUpdateListWig::gsettingInit()
+{
+ const QByteArray style_id(ORG_UKUI_STYLE);
+ m_pGsettingFontSize = new QGSettings(style_id);
+ connect(m_pGsettingFontSize, &QGSettings::changed, this, [=] (const QString &key){
+ if (key==GSETTING_KEY) {
+ QFontMetrics nameFontMetrics(debName->font());
+ int nameFontSize = nameFontMetrics.width(this->mNameLabel);
+ int nameLableWidth = debName->width();
+ QString nameFormatBody = this->mNameLabel;
+ if (nameFontSize > (nameLableWidth - 10)) {
+ nameFormatBody = nameFontMetrics.elidedText(nameFormatBody , Qt::ElideRight , nameLableWidth - 10);
+ debName->setFont(this->font);
+ debName->setText(nameFormatBody);
+ debName->setToolTip(this->mNameLabel);
+ this->nameTipStatus = true;
+ } else {
+ debName->setFont(this->font);
+ debName->setToolTip(QString(""));
+ this->nameTipStatus = false;
+ debName->setText(nameFormatBody);
+ }
+
+ QFontMetrics statueFontMetrics(debStatue->font());
+ int statueFontSize = statueFontMetrics.width(this->mStatusLabel);
+ int statueLableWidth = debStatue->width();
+ QString statueFormatBody = this->mStatusLabel;
+ if (statueFontSize > (statueLableWidth - 10)) {
+ statueFormatBody = statueFontMetrics.elidedText(statueFormatBody , Qt::ElideRight , statueLableWidth - 10);
+ debStatue->setText(statueFormatBody);
+ debStatue->setToolTip(this->mStatusLabel);
+ this->statusTipStatus = true;
+ } else {
+ debStatue->setToolTip(QString(""));
+ debStatue->setText(statueFormatBody);
+ this->statusTipStatus = false;
+ }
+ }
+ });
+}
diff --git a/immutable/plugin/src/historyupdatelistwig.h b/immutable/plugin/src/historyupdatelistwig.h
new file mode 100644
index 0000000..b105cd0
--- /dev/null
+++ b/immutable/plugin/src/historyupdatelistwig.h
@@ -0,0 +1,57 @@
+#ifndef HISTORYUPDATELISTWIG_H
+#define HISTORYUPDATELISTWIG_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "AddFunction/datetimeutils.h"
+
+class HistoryUpdateListWig : public QFrame
+{
+ Q_OBJECT
+public:
+ HistoryUpdateListWig(QLabel *);
+ ~HistoryUpdateListWig();
+ void setAttribute(const QString &mname, const QString &mstatue, const QString &mtime, const QString &mdescription, const QString &mchangelog, const QString &merrorcode,const int &myid);//赋值
+ QSize getTrueSize();//获取真实大小
+ void selectStyle();//选中样式
+ void clearStyleSheet();//取消选中样式
+ int id = 0;
+ void gsettingInit();
+ DateTimeUtils *datetimeutils;
+ QDBusInterface * m_dateSessionDbus = nullptr;
+protected:
+ void mousePressEvent(QMouseEvent * event);
+
+private:
+ QHBoxLayout *hl1 = nullptr;
+ QHBoxLayout *hl2 = nullptr;
+ QVBoxLayout *vl1 = nullptr;
+ QLabel *debName = nullptr;//app名字&版本号
+ QLabel *debStatue = nullptr;//更新状态
+ QString debDescription = "";//描述
+ QString debChangelog = "";//修改日志
+ //int code = 0 ;//编码
+ void initUI();//初始化UI
+ void setDescription();//赋值事件
+ QFont font;
+
+ /* 监听主题字体变化 */
+ QGSettings *m_pGsettingFontSize;
+ QString mNameLabel;
+ QString mStatusLabel;
+
+ /* 控制悬浮框 */
+ bool nameTipStatus = false;
+ bool statusTipStatus = false;
+
+ /* 右侧顶部标签 */
+ QLabel *mDesTab = nullptr;
+};
+
+#endif // HISTORYUPDATELISTWIG_H
diff --git a/plugin/src/kylin-update-frontend.desktop b/immutable/plugin/src/kylin-update-frontend.desktop
similarity index 100%
rename from plugin/src/kylin-update-frontend.desktop
rename to immutable/plugin/src/kylin-update-frontend.desktop
diff --git a/immutable/plugin/src/m_updatelog.cpp b/immutable/plugin/src/m_updatelog.cpp
new file mode 100644
index 0000000..f86993b
--- /dev/null
+++ b/immutable/plugin/src/m_updatelog.cpp
@@ -0,0 +1,687 @@
+#include "m_updatelog.h"
+
+#include
+#include
+#include "xatom-helper.h"
+
+const QString FIND_UPDATE_LABLE_TYPE = "FIND_UPDATE_LABLE_TYPE";//历史更新模块标签
+const QString FIND_DES_LABLE_TYPE = "FIND_DES_LABLE_TYPE";//历史更新描述模块标签
+const QString FIND_CLG_LABLE_TYPE = "FIND_CLG_LABLE_TYPE";//历史更新日志模块标签
+const int WIDTH = 880;//窗口宽度
+const int HEIGHT = 610 -40;//窗口高度 注:QFram实际高度比setFixedSize指定的高度高40像素,故减去40
+const int LINE_SPACING = 2;//行间距
+const int TOP_MARGIN = 18;//上边距
+const int BOTTOM_MARGIN = 24;//下边距
+const int LEFT_MARGIN = 32;//左(右)边距
+
+const int LIST_LEFT = 8;//列表对于其背景,左侧边距
+const int LIST_TOP = 8;//列表对于其背景,顶(底)部边距
+const int LIST_BACKGROUND_WIDTH = 320 + 6;//列表背景宽度
+const int SLIDER_WIDTH = 6;//滑块宽度
+//const int LIST_WIDTH = LIST_BACKGROUND_WIDTH - LIST_LEFT*2 + SLIDER_WIDTH;//列表宽度
+//const int LIST_HEIGHT = 524 - LIST_TOP*2;//列表高度
+
+const int TEXT_TAB_LEFT = 16;//更新详情lable对于其背景,左侧边距
+const int TEXT_TAB_RIGHT = 2;//更新详情lable对于其背景,左侧边距
+const int TEXT_DSC_LEFT_SPACING = 5;//QTextEdit左侧有边距
+const int TEXT_TAB_TOP = 17;//更新详情lable对于其背景,顶部边距
+const int TEXT_TAB_SPACING = 18;//更新详情lable对于内容框的间距
+
+const QString OBJECT_NAME = "OBJECT_NAME";
+
+m_updatelog * m_updatelog::m_instance(nullptr);
+
+m_updatelog::m_updatelog(QWidget* parent) : QDialog(parent)
+{
+ /*添加窗管协议*/
+ MotifWmHints hints;
+ hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
+ hints.functions = MWM_FUNC_ALL;
+ hints.decorations = MWM_DECOR_BORDER;
+ XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
+ //日志数量
+ lognum=0;
+ this->setWindowModality(Qt::WindowModal);
+ initGsettings();//初始化Gsettings
+ initUI();//初始化UI
+ dynamicLoadingInit();//动态加载
+ updatesql();//更新列表
+ if(lognum!=0)
+ {
+ nocontent->hide();
+ content->show();
+ }
+// defaultItem();//设置默认选中
+ //监听更新完成信号
+// UpdateDbus *uddbus = UpdateDbus::getInstance();
+// connect(uddbus->interface,SIGNAL(update_sqlite_signal(QString,QString)),this,SLOT(historyUpdateNow(QString,QString)));
+
+}
+
+QString m_updatelog::setDefaultDescription(QString str)
+{
+ if(str == "")
+ str = tr("No content."); //暂无内容
+ return str;
+}
+
+m_updatelog * m_updatelog::GetInstance(QWidget *parent)
+{
+ if(m_instance==nullptr)
+ {
+ m_instance = new m_updatelog(parent);
+ return m_instance;
+ }
+ if(m_instance->isHidden())
+ {
+ m_instance->deleteLater();
+ m_instance = new m_updatelog(parent);
+ }
+ return m_instance;
+}
+
+void m_updatelog::closeUpdateLog()
+{
+ m_instance->close();
+ m_instance->deleteLater();
+}
+
+void m_updatelog::initUI()
+{
+ /* 初始化窗口属性 */
+ this->setFixedSize(WIDTH,HEIGHT + 40);//(880,610)
+ this->setObjectName("FIND_UPDATE_LABLE_TYPE");
+
+ /* 实例化控件 */
+ /* 实例化标题栏 */
+ updateTitleWidget();
+
+ QFrame *listBackground = new QFrame;
+ listBackground->setFrameStyle(QFrame::Box);
+ listBackground->setFixedWidth(326);
+ /*mainlistwidget 是frame listbackground 的内部内容*/
+ mainListwidget = new QListWidget;
+// QPalette palette = mainListwidget->palette();
+// palette.setBrush(QPalette::Base, QColor (0, 0 , 0, 0));
+// QPalette palette = qApp->palette();
+// QColor listcolor = palette.button().color();
+// palette.setBrush(QPalette::Base,listcolor);
+// mainListwidget->setPalette(palette);
+ mainListwidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); /* 滑块平滑滚动 */
+ mainListwidget->verticalScrollBar()->setProperty("drawScrollBarGroove" , false);
+ mainListwidget->setSpacing(2);
+
+ QFrame *desBackground = new QFrame;
+ desBackground->setFrameStyle(QFrame::Box);
+
+ /* 更新详情 */
+ updateDesTab = new QLabel;
+ /*QFont font;
+ font.setBold(true);
+ updateDesTab->setFont(font);
+ updateDesTab->setWordWrap(true);
+ updateDesTab->setText(tr("No Contents"));*/
+
+ /* 描述文本框 */
+ des = new QTextEdit;
+// QPalette palette2 = des->palette();
+// palette2.setBrush(QPalette::Base, QColor (0, 0 , 0, 0));
+ des->verticalScrollBar()->setProperty("drawScrollBarGroove" , false);
+// des->setPalette(palette2);
+ des->setReadOnly(true);
+ des->setObjectName(FIND_DES_LABLE_TYPE);
+
+ /* 日志文本框 */
+ clg = new QTextEdit;
+// QPalette palette3 = clg->palette();
+// palette3.setBrush(QPalette::Base, QColor (0, 0 , 0, 0));
+ clg->verticalScrollBar()->setProperty("drawScrollBarGroove" , false);
+// clg->setPalette(palette3);
+ clg->setReadOnly(true);
+ clg->setObjectName(FIND_CLG_LABLE_TYPE);
+
+ /* 布局 */
+ /* 布局外边框 */
+ QHBoxLayout *contentlayout = new QHBoxLayout;
+ contentlayout->setSpacing(0);
+ contentlayout->setMargin(0);
+ contentlayout->addSpacing(28);
+ contentlayout->addWidget(listBackground);
+ contentlayout->addSpacing(2);
+ contentlayout->addWidget(desBackground);
+ contentlayout->addSpacing(28);
+ content = new QWidget(this);
+ content->setLayout(contentlayout);
+
+ nocontent=new QLabel(this);
+ QVBoxLayout *nocontentlayout = new QVBoxLayout;
+ QLabel *nocontentpicture = new QLabel(this);
+ QVariant stylename = qtSettings->get("style-name");
+ qDebug()<<"style name"<setPixmap(QPixmap(nocontentpicturepath).scaled(QSize(120,120)));
+ nocontentpicture->setAlignment(Qt::AlignCenter);
+ QLabel *nocontenttext = new QLabel(this);
+ nocontenttext->setText(tr("no content"));
+ nocontenttext->setStyleSheet("QLabel{color:grey;}");
+ nocontenttext->setAlignment(Qt::AlignCenter);
+ nocontentlayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Minimum,QSizePolicy::Expanding));
+ nocontentlayout->addWidget(nocontentpicture);
+ nocontentlayout->addSpacing(10);
+ nocontentlayout->addWidget(nocontenttext);
+ nocontentlayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Minimum,QSizePolicy::Expanding));
+ nocontent->setLayout(nocontentlayout);
+ nocontent->setAlignment(Qt::AlignCenter);
+
+ QVBoxLayout *Mainlayout = new QVBoxLayout;
+ Mainlayout->setContentsMargins(0,0,0,0);
+ Mainlayout->addWidget(this->title);
+ Mainlayout->addSpacing(18);
+ Mainlayout->addWidget(nocontent);
+// Mainlayout->addLayout(contentlayout);
+ Mainlayout->addWidget(content);
+ content->hide();
+ Mainlayout->addSpacing(18);
+
+ this->setLayout(Mainlayout);
+
+ /* 布局列表 */
+ hll = new QHBoxLayout;
+ hll->setSpacing(0);
+ hll->setMargin(0);
+ hll->addSpacing(LIST_LEFT);
+ hll->addWidget(mainListwidget);
+ QVBoxLayout *vll = new QVBoxLayout;
+ vll->setSpacing(0);
+ vll->setMargin(0);
+ vll->addSpacing(LIST_TOP);
+ vll->addLayout(hll);
+ vll->addSpacing(LIST_TOP);
+ listBackground->setLayout(vll);
+
+ /* 布局更新详情标签 */
+ QHBoxLayout *hlrt = new QHBoxLayout;
+ hlrt->setSpacing(0);
+ hlrt->setMargin(0);
+ hlrt->addSpacing(TEXT_DSC_LEFT_SPACING);
+ hlrt->addWidget(updateDesTab);
+
+ /* 布局标签及文本框 */
+ QVBoxLayout *vlr = new QVBoxLayout;
+ vlr->setSpacing(0);
+ vlr->setMargin(0);
+ vlr->addSpacing(TEXT_TAB_TOP);
+ vlr->addLayout(hlrt);
+ vlr->addSpacing(TEXT_TAB_SPACING);
+ vlr->addWidget(des);
+// vlr->addSpacing(TEXT_TAB_SPACING);
+// vlr->addWidget(clg);
+ vlr->addSpacing(TEXT_TAB_TOP);
+
+ QHBoxLayout *hlr = new QHBoxLayout;
+ hlr->setSpacing(0);
+ hlr->setMargin(0);
+ hlr->addSpacing(TEXT_TAB_LEFT - TEXT_DSC_LEFT_SPACING);
+ hlr->addLayout(vlr);
+ hlr->addSpacing(TEXT_TAB_RIGHT);
+ desBackground->setLayout(hlr);
+ this->installEventFilter(this);
+}
+
+void m_updatelog::initGsettings()
+{
+ timer = new QTimer;
+ timer->setSingleShot(true);
+ connect(timer,&QTimer::timeout,this,&m_updatelog::changeListWidgetItemHeight);
+ const QByteArray iid(THEME_QT_SCHEMA);
+ qtSettings = new QGSettings(iid, QByteArray(), this);
+
+ connect(qtSettings,&QGSettings::changed,this,[=] (const QString &key) {
+ if(key == "systemFontSize") {
+ timer->start(100);
+ }
+ });
+}
+
+void m_updatelog::changeListWidgetItemHeight()
+{
+ if(mainListwidget->count()<1)
+ return;
+ int row=0;
+ while(row<(mainListwidget->count()))
+ {
+ QListWidgetItem * item = mainListwidget->item(row);
+ HistoryUpdateListWig * hulw = qobject_cast(mainListwidget->itemWidget(item));
+ item->setSizeHint(hulw->getTrueSize());
+ row++;
+ }
+}
+
+void m_updatelog::updatesql( const int &start,const int &num,const QString &intop)
+{
+ HistoryUpdateListWig *firstWidget = NULL;
+ bool flag = true;
+
+ //sql 拼接
+ QString sqlCmd = "SELECT * FROM updateinfos";
+ if(intop!="")
+ sqlCmd+=" where `date` = '"+intop+"'";
+ else if(start>0)
+ sqlCmd+=" where `id` < "+QString::number(start);
+ sqlCmd+=" order by `id` desc limit ";
+ sqlCmd+=QString::number(num);
+ //载入数据库数据
+ QSqlQuery query(QSqlDatabase::database("A"));
+ query.exec(sqlCmd);
+ while(query.next()){
+ QString statusType = query.value("keyword").toString();
+ if(statusType!=""&&statusType!="1")
+ continue;
+ HistoryUpdateListWig *hulw = new HistoryUpdateListWig(updateDesTab);
+ lognum++;
+ if (flag == true) {
+ firstWidget = hulw;
+ flag = false;
+ }
+ hulw->setAttribute(translationVirtualPackage(query.value("appname").toString())+" "+query.value("version").toString(),
+ query.value("status").toString(),
+ query.value("date").toString(),
+ setDefaultDescription(query.value("description").toString()),
+ setDefaultDescription(query.value("changelog").toString()),
+ query.value("errorcode").toString(),
+ query.value("id").toInt());
+ QListWidgetItem *item = new QListWidgetItem();
+ item->setFlags(Qt::NoItemFlags);
+ item->setSizeHint(hulw->getTrueSize());
+ if(intop!="")
+ {
+ if(hulw->id<=firstCode)
+ {
+ hulw->deleteLater();
+ delete item;
+ item = nullptr;
+ return;
+ }
+ firstCode=hulw->id;
+ mainListwidget->insertItem(0,item);
+ }
+ else
+ {
+ loadingCode = hulw->id;//记录加载到哪个位置
+ mainListwidget->addItem(item);
+ }
+ mainListwidget->setItemWidget(item,hulw);
+ if(intop!="")
+ hulw->selectStyle();//设置选中样式
+ }
+
+ /* 选中第一条记录 */
+ if (firstWidget != NULL && start == 0) {
+ firstWidget->selectStyle();
+ }
+}
+
+void m_updatelog::defaultItem()
+{
+ //默认选中第一个
+ HistoryUpdateListWig *first = mainListwidget->findChild();
+ if(first!=nullptr)
+ {
+ first->selectStyle();//设置选中样式
+ firstCode = first->id;//记录id
+ }
+}
+
+QString m_updatelog::translationVirtualPackage(QString str)
+{
+ QString retStr = str;
+ /*判断json文件是否存在*/
+ QString filename = QString("/usr/share/kylin-update-desktop-config/config/") +str +".json";
+ QFile file(filename);
+ if (!file.open(QIODevice::ReadOnly)){
+ qDebug() << "JSON file open failed! ";
+ } else {
+ QByteArray jsonData = file.readAll();
+ QJsonParseError err_rpt;
+ QJsonDocument root_Doc = QJsonDocument::fromJson(jsonData, &err_rpt); // 字符串格式化为JSON
+
+ if (!root_Doc.isNull() && (err_rpt.error == QJsonParseError::NoError)) { // 解析未发生错误
+ if (root_Doc.isObject()) { // JSON 文档为对象
+ QJsonObject object = root_Doc.object(); // 转化为对象
+ if (QLocale::system().name() == "zh_CN"){
+ QString name = object.value("name").toObject().value("zh_CN").toString();
+ if (!name.isNull()) {
+ retStr = name;
+ return retStr;
+ }
+ }else {
+ QString name = object.value("name").toObject().value("en_US").toString();
+ if (!name.isNull()) {
+ retStr = name;
+ return retStr;
+ }
+ }
+ }
+ }else{
+ qDebug() << "JSON文件格式错误!";
+ }
+ }
+
+ if(QLocale::system().name()!="zh_CN")
+ return str;
+ if(str == "kylin-update-desktop-app")
+ return "基本应用";
+ if(str == "kylin-update-desktop-security")
+ return "安全更新";
+ if(str == "kylin-update-desktop-support")
+ return "系统基础组件";
+ if(str == "kylin-update-desktop-ukui")
+ return "桌面环境组件";
+ if(str == "linux-generic")
+ return "系统内核组件";
+ if(str == "kylin-update-desktop-kernel")
+ return "系统内核组件";
+ if(str == "kylin-update-desktop-kernel-3a4000")
+ return "系统内核组件";
+ if(str == "kylin-update-desktop-kydroid")
+ return "kydroid补丁包";
+ if(str == "kylin-update-desktop")
+ return "麒麟系统升级";
+
+ /* 从软件商店数据库根据包名获取应用中文名 */
+ QString dst;
+ dst.clear();
+
+ QSqlQuery query(QSqlDatabase::database("B"));
+ bool ret = query.exec(QString("SELECT display_name_cn FROM application WHERE app_name IS '%1'").arg(str)); //执行
+ if (ret == false) {
+ qDebug() << "Error : exec select sql fail , switch chinese pkg name fail";
+ return retStr;
+ }
+
+ while (query.next()) {
+ dst = query.value(0).toString();
+ qDebug() << "Info : switch chinese pkg name is [" << dst << "]";
+ }
+
+ if (!dst.isEmpty()) {
+ retStr = dst;
+ }
+ return retStr;
+}
+
+
+void m_updatelog::dynamicLoadingInit()
+{
+ //绑定信号和槽
+ connect(mainListwidget->verticalScrollBar(),&QScrollBar::valueChanged, this,&m_updatelog::dynamicLoading );
+}
+
+void m_updatelog::dynamicLoading(int i)
+{
+ if(mainListwidget->verticalScrollBar()->maximum()==i)
+ {
+ qDebug()<<"动态加载";
+ updatesql(loadingCode);
+ }
+}
+
+void m_updatelog::historyUpdateNow(QString str1,QString str2)
+{
+ qDebug()<<"动态更新:"<setAttribute(translationVirtualPackage(appName) + " " + version , status , time , description , changelog , errorcode , id);
+ QListWidgetItem *item = new QListWidgetItem();
+ item->setFlags(Qt::NoItemFlags);
+ item->setSizeHint(updateItem->getTrueSize());
+
+ mainListwidget->addItem(item);
+ mainListwidget->setItemWidget(item , updateItem);
+
+ appName.clear();
+ version.clear();
+ status.clear();
+ time.clear();
+ description.clear();
+ changelog.clear();
+ errorcode.clear();
+ id = 0;
+ keyword.clear();
+ appname_cn.clear();
+ status_cn.clear();
+ }
+
+ /* 选中第一条记录 */
+ if (firstWidget != NULL) {
+ firstWidget->selectStyle();
+ } else {
+ if (this->des != NULL) {
+ des->setText(QString(""));
+ }
+ if (this->updateDesTab != NULL) {
+ updateDesTab->setText(QString(""));
+ }
+ if (this->clg != NULL) {
+ clg->setText(QString(""));
+ }
+ }
+ return;
+}
+
+void m_updatelog::cacheDynamicLoad(void)
+{
+ disconnect(mainListwidget->verticalScrollBar() , &QScrollBar::valueChanged , this , &m_updatelog::dynamicLoading);
+}
+
+void m_updatelog::clearList(void)
+{
+ int sum = mainListwidget->count();
+
+ for (int i = sum ; i >= 0 ; i--) {
+ QListWidgetItem *item = mainListwidget->takeItem(i);
+ delete item;
+ }
+
+ return;
+}
+
+QString m_updatelog::conversionPackageName(QString package)
+{
+ if (QLocale::system().name() != "zh_CN")
+ return package;
+ if (package == "基本应用")
+ return "kylin-update-desktop-app";
+ if (package == "安全更新")
+ return "kylin-update-desktop-security";
+ if (package == "系统基础组件")
+ return "kylin-update-desktop-support";
+ if (package == "桌面环境组件")
+ return "kylin-update-desktop-ukui";
+ if (package == "系统内核组件")
+ return "linux-generic";
+ if (package == "系统内核组件")
+ return "kylin-update-desktop-kernel";
+ if (package == "系统内核组件")
+ return "kylin-update-desktop-kernel-3a4000";
+ if (package == "kydroid补丁包")
+ return "kylin-update-desktop-kydroid";
+
+ /* 从软件商店数据库根据包名获取应用英文名 */
+ QString dst;
+ dst.clear();
+
+ QSqlQuery query(QSqlDatabase::database("B"));
+ bool ret = query.exec(QString("SELECT `app_name` FROM application WHERE `display_name_cn` = '%1'").arg(package)); //执行
+ if (ret == false) {
+ qDebug() << "Error : exec select sql fail , switch pkg name fail";
+ return package;
+ }
+
+ while (query.next()) {
+ dst = query.value(0).toString();
+ qDebug() << "Info : switch chinese pkg name is [" << dst << "]";
+ }
+
+ if (dst.isEmpty()) {
+ return package;
+ } else {
+ return dst;
+ }
+
+ return package;
+}
+
+
+bool m_updatelog::eventFilter(QObject *watch , QEvent *e)
+{
+ if ((e->type() == QEvent::MouseButtonPress && watch != searchBox)) {
+ if (this->searchBox->text() == "") {
+ qDebug()<<"QEvent::MouseButtonPress && watch != searchBox, searchBox->text() == NULL";
+ this->searchBox->setAlignment(Qt::AlignLeft);
+// this->searchBox->setPlaceholderText(tr("Search content"));
+// this->searchBox->setTextMargins(this->searchBox->width()/ 2 - 60 , 0 , 0 , 1);
+// this->searchBox->setFocus();
+ this->searchBox->clearFocus();
+ }
+ }
+
+ if (e->type() == QEvent::MouseButtonPress && watch == searchBox) {
+ qDebug()<<"QEvent::MouseButtonPress && watch == searchBox";
+ this->searchBox->setAlignment(Qt::AlignLeft);
+// this->searchBox->setPlaceholderText(tr(""));
+// this->searchBox->setTextMargins(this->searchBox->width()/ 2 - 60 , 0 , 0 , 1);
+ }
+
+ if (e->type() == 6 && watch == searchBox) {
+ QKeyEvent *key = static_cast(e);
+ if (key->key() == Qt::Key_Enter || key->key() == Qt::Key_Return) {
+ if (this->searchBox->text() != "") {
+ QString appName = this->searchBox->text();
+ slotSearch(appName);
+ }
+ if (this->searchBox->text() == "") {
+ clearList();
+ connect(mainListwidget->verticalScrollBar() , &QScrollBar::valueChanged , this , &m_updatelog::dynamicLoading);
+ updatesql();
+ }
+ }
+ }
+
+ return QObject::eventFilter(watch , e);
+}
+
+void m_updatelog::updateTitleWidget(void)
+{
+ this->title = new QWidget(this);
+ this->title->setFixedHeight(40);
+ this->title->setObjectName("titleWidget");
+ titlewidget = new QWidget(this);
+ titlewidget->setFixedHeight(40);
+
+ /* 标题栏图标 */
+ this->titleIcon = new QLabel(this);
+ this->titleIcon->setFixedSize(24 , 24);
+ this->titleIcon->setPixmap(QIcon::fromTheme("ukui-control-center").pixmap(QSize(24 , 24)));
+ /* 标题栏名字 */
+ this->titleName = new QLabel(this);
+ this->titleName->resize(56 , 20);
+ //this->titleName->setText(tr("历史更新"));
+ this->titleName->setText(tr("History Log"));
+ /*标题整体*/
+ titlewidgetlayout = new QHBoxLayout(titlewidget);
+ titlewidgetlayout->setContentsMargins(3,8,0,8);
+ titlewidgetlayout->addWidget(titleIcon);
+ titlewidgetlayout->addSpacing(4);
+ titlewidgetlayout->addWidget(titleName);
+ titlewidget->setLayout(titlewidgetlayout);
+ /* 搜索框 */
+ this->searchBox = new KSearchLineEdit(this);
+ this->searchBox->setFixedSize(300 , 31);
+ this->searchBox->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
+ this->searchBox->installEventFilter(this);
+// this->searchBox->setTextMargins(this->searchBox->width()/ 2 - 60 , 0 , 0 , 1);
+ /* 关闭按钮 */
+ this->titleClose = new QPushButton(this);
+ titleClose->setToolTip(tr("Close"));
+ this->titleClose->setFixedSize(30 , 30);
+ this->titleClose->setFlat(true);
+ this->titleClose->setProperty("isWindowButton" , 0x2);
+ this->titleClose->setProperty("useIconHighlightEffect" , 0x8);
+ this->titleClose->setIcon(QIcon::fromTheme("window-close-symbolic"));
+ this->titleClose->setFocusPolicy(Qt::NoFocus);
+ this->titleClose->setToolTip(tr("Close"));
+ connect(this->titleClose , &QPushButton::clicked , this , &m_updatelog::slotClose);
+
+ /* 布局 */
+ titlelayout = new QHBoxLayout(title);
+ titlelayout->setContentsMargins(5,0,5,0);
+ title->setLayout(titlelayout);
+ titlelayout->addWidget(titlewidget);
+ titlelayout->addSpacing(4);
+ titlelayout->addStretch();
+ titlelayout->addWidget(searchBox);
+ titlelayout->addStretch();
+ titlelayout->addSpacing(this->titlewidget->width()+4);
+ titlelayout->addWidget(titleClose);
+}
+
+void m_updatelog::slotClose(void)
+{
+ this->close();
+}
diff --git a/immutable/plugin/src/m_updatelog.h b/immutable/plugin/src/m_updatelog.h
new file mode 100644
index 0000000..1ac4377
--- /dev/null
+++ b/immutable/plugin/src/m_updatelog.h
@@ -0,0 +1,92 @@
+#ifndef M_UPDATELOG_H
+#define M_UPDATELOG_H
+//窗体
+#include
+#include
+//布局
+#include
+//控件
+#include
+#include
+#include
+#include
+#include