From 0caef669992747013d331f957a155ce9a188e95c Mon Sep 17 00:00:00 2001 From: yafeng shen Date: Tue, 23 Jul 2024 09:46:41 +0800 Subject: [PATCH] sync file changes --- data/update.png | Bin 715 -> 0 bytes debian/changelog | 9 + kylin-background-upgrade.pro | 73 -- kylin-background-upgrade.pro.user | 315 -------- kylin-update-notify-immutable/README.md | 36 + .../checkUpdate.py | 0 .../checkUpdate.pyc | Bin .../data}/Resources.qrc | 2 + .../data/background_upgrade_icon.png | Bin 0 -> 5225 bytes kylin-update-notify-immutable/data/close.png | Bin 0 -> 957 bytes .../kylin-background-upgrade-manul.service | 10 + .../data/kylin-background-upgrade-manul.timer | 12 + .../kylin-background-upgrade-template.conf | 0 .../data}/kylin-background-upgrade.desktop | 2 +- .../data}/kylin-update.timer.conf | 0 ...og4qt.kylin-background-upgrade.gschema.xml | 0 kylin-update-notify-immutable/data/update.png | Bin 0 -> 8074 bytes .../debian/changelog | 300 +++++++ kylin-update-notify-immutable/debian/control | 31 + kylin-update-notify-immutable/debian/install | 2 + kylin-update-notify-immutable/debian/postinst | 5 + kylin-update-notify-immutable/debian/postrm | 7 + kylin-update-notify-immutable/debian/rules | 8 + .../debian/source/format | 1 + .../debian/source/options | 1 + kylin-update-notify-immutable/env.pri | 4 + .../kylin-update-notify-immutable.pro | 42 + .../kylin-update-notify-immutable.pro.user | 314 -------- .../kylin-update-notify.desktop | 2 +- .../src}/core.cpp | 2 +- .../src}/core.h | 0 .../src}/main.cpp | 108 ++- .../src}/traydbus.cpp | 20 +- .../src}/traydbus.h | 2 +- .../src}/trayicon.cpp | 0 .../src}/trayicon.h | 0 .../src}/updatehandle.cpp | 191 +++-- .../src}/updatehandle.h | 6 +- .../src}/updatewidget.cpp | 265 +++++-- .../src}/updatewidget.h | 24 +- .../src}/updatewidget.ui | 0 .../translations}/UapLBi.json | 0 .../kylin-background-upgrade_bo_CN.qm | Bin 0 -> 2003 bytes .../kylin-background-upgrade_bo_CN.ts | 112 +++ .../kylin-background-upgrade_zh_CN.qm | Bin 0 -> 1305 bytes .../kylin-background-upgrade_zh_CN.ts | 110 ++- .../widgets/Button/button.pri | 6 + .../widgets/Button/fixbutton.cpp | 36 + .../widgets/Button/fixbutton.h | 21 + .../widgets/widgets.pri | 4 + kylin-update-notify.pro | 4 + kylin-update-notify/checkUpdate.py | 20 + kylin-update-notify/checkUpdate.pyc | Bin 0 -> 897 bytes kylin-update-notify/data/Resources.qrc | 8 + .../data/background_upgrade_icon.png | Bin 0 -> 5225 bytes kylin-update-notify/data/close.png | Bin 0 -> 957 bytes .../kylin-background-upgrade-manul.service | 2 +- .../kylin-background-upgrade-manul.timer | 0 .../kylin-background-upgrade-silent.service | 10 + .../kylin-background-upgrade-silent.timer | 12 + .../kylin-background-upgrade-template.conf | 9 + .../data/kylin-background-upgrade.desktop | 10 + .../data/kylin-update.timer.conf | 6 + ...og4qt.kylin-background-upgrade.gschema.xml | 39 + kylin-update-notify/data/update.png | Bin 0 -> 8074 bytes kylin-update-notify/env.pri | 4 + .../kylin-update-notify.desktop | 6 + kylin-update-notify/kylin-update-notify.pro | 42 + .../kylin-update-notify.pro.user | 314 -------- kylin-update-notify/src/core.cpp | 22 + kylin-update-notify/src/core.h | 23 + kylin-update-notify/src/main.cpp | 206 +++++ kylin-update-notify/src/traydbus.cpp | 450 +++++++++++ kylin-update-notify/src/traydbus.h | 160 ++++ kylin-update-notify/src/trayicon.cpp | 35 + kylin-update-notify/src/trayicon.h | 33 + kylin-update-notify/src/updatehandle.cpp | 750 ++++++++++++++++++ kylin-update-notify/src/updatehandle.h | 105 +++ kylin-update-notify/src/updatewidget.cpp | 661 +++++++++++++++ kylin-update-notify/src/updatewidget.h | 131 +++ kylin-update-notify/src/updatewidget.ui | 21 + kylin-update-notify/translations/UapLBi.json | 1 + .../kylin-background-upgrade_bo_CN.qm | Bin 0 -> 2003 bytes .../kylin-background-upgrade_bo_CN.ts | 112 +++ .../kylin-background-upgrade_zh_CN.qm | Bin 0 -> 1305 bytes .../kylin-background-upgrade_zh_CN.ts | 151 ++++ kylin-update-notify/widgets/Button/button.pri | 6 + .../widgets/Button/fixbutton.cpp | 36 + .../widgets/Button/fixbutton.h | 21 + kylin-update-notify/widgets/widgets.pri | 4 + .../kylin-background-upgrade_bo_CN.qm | Bin 2535 -> 0 bytes .../kylin-background-upgrade_bo_CN.ts | 92 --- .../kylin-background-upgrade_zh_CN.qm | Bin 1306 -> 0 bytes 93 files changed, 4259 insertions(+), 1330 deletions(-) delete mode 100644 data/update.png delete mode 100644 kylin-background-upgrade.pro delete mode 100644 kylin-background-upgrade.pro.user create mode 100644 kylin-update-notify-immutable/README.md rename checkUpdate.py => kylin-update-notify-immutable/checkUpdate.py (100%) rename checkUpdate.pyc => kylin-update-notify-immutable/checkUpdate.pyc (100%) rename {data => kylin-update-notify-immutable/data}/Resources.qrc (60%) create mode 100644 kylin-update-notify-immutable/data/background_upgrade_icon.png create mode 100644 kylin-update-notify-immutable/data/close.png create mode 100644 kylin-update-notify-immutable/data/kylin-background-upgrade-manul.service create mode 100644 kylin-update-notify-immutable/data/kylin-background-upgrade-manul.timer rename {data => kylin-update-notify-immutable/data}/kylin-background-upgrade-template.conf (100%) rename {data => kylin-update-notify-immutable/data}/kylin-background-upgrade.desktop (78%) rename {data => kylin-update-notify-immutable/data}/kylin-update.timer.conf (100%) rename {data => kylin-update-notify-immutable/data}/org.ukui.log4qt.kylin-background-upgrade.gschema.xml (100%) create mode 100644 kylin-update-notify-immutable/data/update.png create mode 100644 kylin-update-notify-immutable/debian/changelog create mode 100644 kylin-update-notify-immutable/debian/control create mode 100644 kylin-update-notify-immutable/debian/install create mode 100755 kylin-update-notify-immutable/debian/postinst create mode 100644 kylin-update-notify-immutable/debian/postrm create mode 100755 kylin-update-notify-immutable/debian/rules create mode 100644 kylin-update-notify-immutable/debian/source/format create mode 100644 kylin-update-notify-immutable/debian/source/options create mode 100644 kylin-update-notify-immutable/env.pri create mode 100644 kylin-update-notify-immutable/kylin-update-notify-immutable.pro delete mode 100644 kylin-update-notify-immutable/kylin-update-notify-immutable.pro.user rename kylin-update-notify.desktop => kylin-update-notify-immutable/kylin-update-notify.desktop (64%) rename {src => kylin-update-notify-immutable/src}/core.cpp (89%) rename {src => kylin-update-notify-immutable/src}/core.h (100%) rename {src => kylin-update-notify-immutable/src}/main.cpp (53%) rename {src => kylin-update-notify-immutable/src}/traydbus.cpp (94%) rename {src => kylin-update-notify-immutable/src}/traydbus.h (99%) rename {src => kylin-update-notify-immutable/src}/trayicon.cpp (100%) rename {src => kylin-update-notify-immutable/src}/trayicon.h (100%) rename {src => kylin-update-notify-immutable/src}/updatehandle.cpp (76%) rename {src => kylin-update-notify-immutable/src}/updatehandle.h (94%) rename {src => kylin-update-notify-immutable/src}/updatewidget.cpp (64%) rename {src => kylin-update-notify-immutable/src}/updatewidget.h (81%) rename {src => kylin-update-notify-immutable/src}/updatewidget.ui (100%) rename {translations => kylin-update-notify-immutable/translations}/UapLBi.json (100%) create mode 100644 kylin-update-notify-immutable/translations/kylin-background-upgrade_bo_CN.qm create mode 100644 kylin-update-notify-immutable/translations/kylin-background-upgrade_bo_CN.ts create mode 100644 kylin-update-notify-immutable/translations/kylin-background-upgrade_zh_CN.qm rename {translations => kylin-update-notify-immutable/translations}/kylin-background-upgrade_zh_CN.ts (60%) create mode 100644 kylin-update-notify-immutable/widgets/Button/button.pri create mode 100644 kylin-update-notify-immutable/widgets/Button/fixbutton.cpp create mode 100644 kylin-update-notify-immutable/widgets/Button/fixbutton.h create mode 100644 kylin-update-notify-immutable/widgets/widgets.pri create mode 100644 kylin-update-notify.pro create mode 100755 kylin-update-notify/checkUpdate.py create mode 100644 kylin-update-notify/checkUpdate.pyc create mode 100644 kylin-update-notify/data/Resources.qrc create mode 100644 kylin-update-notify/data/background_upgrade_icon.png create mode 100644 kylin-update-notify/data/close.png rename {data => kylin-update-notify/data}/kylin-background-upgrade-manul.service (62%) rename {data => kylin-update-notify/data}/kylin-background-upgrade-manul.timer (100%) create mode 100644 kylin-update-notify/data/kylin-background-upgrade-silent.service create mode 100644 kylin-update-notify/data/kylin-background-upgrade-silent.timer create mode 100644 kylin-update-notify/data/kylin-background-upgrade-template.conf create mode 100644 kylin-update-notify/data/kylin-background-upgrade.desktop create mode 100644 kylin-update-notify/data/kylin-update.timer.conf create mode 100644 kylin-update-notify/data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml create mode 100644 kylin-update-notify/data/update.png create mode 100644 kylin-update-notify/env.pri create mode 100644 kylin-update-notify/kylin-update-notify.desktop create mode 100644 kylin-update-notify/kylin-update-notify.pro delete mode 100644 kylin-update-notify/kylin-update-notify.pro.user create mode 100644 kylin-update-notify/src/core.cpp create mode 100644 kylin-update-notify/src/core.h create mode 100644 kylin-update-notify/src/main.cpp create mode 100644 kylin-update-notify/src/traydbus.cpp create mode 100644 kylin-update-notify/src/traydbus.h create mode 100644 kylin-update-notify/src/trayicon.cpp create mode 100644 kylin-update-notify/src/trayicon.h create mode 100644 kylin-update-notify/src/updatehandle.cpp create mode 100644 kylin-update-notify/src/updatehandle.h create mode 100644 kylin-update-notify/src/updatewidget.cpp create mode 100644 kylin-update-notify/src/updatewidget.h create mode 100644 kylin-update-notify/src/updatewidget.ui create mode 100644 kylin-update-notify/translations/UapLBi.json create mode 100644 kylin-update-notify/translations/kylin-background-upgrade_bo_CN.qm create mode 100644 kylin-update-notify/translations/kylin-background-upgrade_bo_CN.ts create mode 100644 kylin-update-notify/translations/kylin-background-upgrade_zh_CN.qm create mode 100644 kylin-update-notify/translations/kylin-background-upgrade_zh_CN.ts create mode 100644 kylin-update-notify/widgets/Button/button.pri create mode 100644 kylin-update-notify/widgets/Button/fixbutton.cpp create mode 100644 kylin-update-notify/widgets/Button/fixbutton.h create mode 100644 kylin-update-notify/widgets/widgets.pri delete mode 100644 translations/kylin-background-upgrade_bo_CN.qm delete mode 100644 translations/kylin-background-upgrade_bo_CN.ts delete mode 100644 translations/kylin-background-upgrade_zh_CN.qm diff --git a/data/update.png b/data/update.png deleted file mode 100644 index a28e913243c91874881e9b93cdabdf95a8e18d21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 715 zcmV;+0yO=JP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&0$@o*K~y+TZBk25 z6Hyo){{&*i|DtH(#s$Vi9hVq6$WOjI_mlo+E#k=6noG(`%1Nz0?o zP+oPI4xK*ev@=r{dc5Z%jVNDo($n+!W^Q{G{4=_)Bce_sm(yUEYZBzt=*7n)C|$WF zLEc`_YPCd2MZMv{Y5E6(o_ni!Ez+X146qjyiC!-O39HOc9rnhI4pY`JyYVz!yb+VUCbLb+!(fTxW6btPK_Qj zXGNBs@Yn>DWGV~Os-a65%8-wzSqInO+BkH_#Hm3`f}9#XW&-a#*Vp<%Q7>iSESCaGCiBZYGDh3L29mn_-Q#MPD;X=L;ha?6H9I8}slyLBMcZ)Q99QFJ)%s~j3rv7i+Y zoilLyNgaVc523^+g7Hms-1Vgv%NjBh3{T2VdjW^ShmjC6i|fcPZR|s4aqn|oW_EUV x{5Dknisjo$tNeghO5NixqE2k8I+002ovPDHLkV1j>-K#%|c diff --git a/debian/changelog b/debian/changelog index 49a5958..bc8f275 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +kylin-update-notify (1.3.2.1-ok17) nile; urgency=medium + + *BUG号:#I9U7MP【次要】【主要】【gg-不可变】【在线更新】右下角更新通知,点击桌面右下角立即更新没有打开控制面板 + *需求号:无 + *其他改动说明:无 + *影响域: 无 + + -- luoxueyi Fri, 19 Jul 2024 10:27:47 +0800 + kylin-update-notify (1.3.2.1-ok16) nile; urgency=medium *BUG号:205057 【wlcom】【控制面板】【更新】开启控制面板-更新-有更新应用时通知按钮,系统更新弹窗没有显示在右下角 diff --git a/kylin-background-upgrade.pro b/kylin-background-upgrade.pro deleted file mode 100644 index 0c28cdf..0000000 --- a/kylin-background-upgrade.pro +++ /dev/null @@ -1,73 +0,0 @@ -QT += core gui dbus network KWindowSystem sql -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -CONFIG += c++11 link_pkgconfig - -# 项目名 -TARGET = kylin-background-upgrade -TEMPLATE = app - -LIBS +=-lukui-log4qt -lpython2.7 - -# 执行文件装载 -target.path = /usr/bin -target.source += $$TARGET - -SOURCES += \ - ./src/core.cpp \ - ./src/main.cpp \ - ./src/traydbus.cpp \ - ./src/trayicon.cpp \ - ./src/updatehandle.cpp \ - ./src/updatewidget.cpp - -HEADERS += \ - ./src/core.h \ - ./src/traydbus.h \ - ./src/trayicon.h \ - ./src/updatehandle.h \ - ./src/updatewidget.h - -# service文件装载 manul -service_manul.files = ./data/kylin-background-upgrade-manul.service -service_manul.path = /usr/lib/systemd/user/ - -# timer文件装载 -timer_manul.files = ./data/kylin-background-upgrade-manul.timer -timer_manul.path = /usr/lib/systemd/user/ - - -# desktop文件装载 -desktop.files = ./data/kylin-background-upgrade.desktop -desktop.path = /usr/share/applications/ - -conf.files = ./data/kylin-background-upgrade-template.conf -conf.path = /var/lib/kylin-background-upgrade/ - -# 日志配置文件 -schemes.files += data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml -schemes.path = /usr/share/glib-2.0/schemas/ - - -TRANSLATIONS += translations/kylin-background-upgrade_zh_CN.ts - translations/kylin-background-upgrade_bo_CN.ts - translation.path = /usr/share/kylin-background-upgrade - translation.files += translations/kylin-background-upgrade_zh_CN.qm - translation.files += translations/kylin-background-upgrade_bo_CN.qm - - -INSTALLS += target desktop conf translation schemes service_manul timer_manul - -PKGCONFIG += gsettings-qt - -FORMS += \ - ./src/updatewidget.ui - -RESOURCES += \ - ./data/Resources.qrc - -DISTFILES += \ - ./data/update.png - -DISTFILES += \ - checkUpdate.py diff --git a/kylin-background-upgrade.pro.user b/kylin-background-upgrade.pro.user deleted file mode 100644 index c7c7ba3..0000000 --- a/kylin-background-upgrade.pro.user +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - EnvironmentId - {3d34bcf0-6a81-46d0-90d9-4cc7667111f8} - - - 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 - - 桌面 - 桌面 - {fb955230-392d-4c01-8fb0-8bfc9c0d7279} - 0 - 0 - 0 - - /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-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/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Release - - - true - QtProjectManager.QMakeBuildStep - false - - 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 - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - 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 - - 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 - - kylin-background-upgrade2 - Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/kylin-background-upgrade/OpenKylin/make_deb/kylin-background-upgrade/kylin-background-upgrade.pro - /home/lxy/kylin-background-upgrade/OpenKylin/make_deb/kylin-background-upgrade/kylin-background-upgrade.pro - - false - - false - true - true - false - false - true - - /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/kylin-update-notify-immutable/README.md b/kylin-update-notify-immutable/README.md new file mode 100644 index 0000000..2620f7b --- /dev/null +++ b/kylin-update-notify-immutable/README.md @@ -0,0 +1,36 @@ +# kylin-background-upgrade + +## 主要功能: + +> 由后台定时器定时调起,访问源服务器检测是否有强制更新与可选更新 +> +> 检测到强制更新内容在后台升级,托盘不显示 +> +> 如果控制面板的自动检测更新关闭,则后台托盘程序不提醒用户更新 +> +> 检测到可选更新弹出交互界面 +> +> 点击同意更新按钮,调到控制面板更新页面,托盘程序退出 +> +> 点击暂不更新按钮,退出托盘程序 + +## 注意事项: + +> 如果托盘应该出现的情况下没出现,请查看是否收纳。在控制面板>个性化>显示在托盘上的图标中,把更新管理器托盘程序改成显示。 +> +> 如果托盘打印信息为:“源管理器updateSource is failed,连接失败,程序退出”,请查看源管理器是否启动,如已启动,请执行: sudo pkill -f start_dbus sudo +> +> killall kylin-software-properties-service sudo kylin-software-properties-service 后,再启动托盘程序。 +> +> 静默升级时,会在命令行打印信息 +> +> 右下角提示,在不进行其他操作时,不退出 +> + +## 启动定时器: + +> 定时器与托盘服务名称: kylin-background-upgrade-timer.timer kylin-background-upgrade.service +> +> 查看定时器是否工作: systemctl --user status kylin-background-upgrade-timer.timer + + diff --git a/checkUpdate.py b/kylin-update-notify-immutable/checkUpdate.py similarity index 100% rename from checkUpdate.py rename to kylin-update-notify-immutable/checkUpdate.py diff --git a/checkUpdate.pyc b/kylin-update-notify-immutable/checkUpdate.pyc similarity index 100% rename from checkUpdate.pyc rename to kylin-update-notify-immutable/checkUpdate.pyc diff --git a/data/Resources.qrc b/kylin-update-notify-immutable/data/Resources.qrc similarity index 60% rename from data/Resources.qrc rename to kylin-update-notify-immutable/data/Resources.qrc index 6859cf5..d68938f 100644 --- a/data/Resources.qrc +++ b/kylin-update-notify-immutable/data/Resources.qrc @@ -2,5 +2,7 @@ update.png + background_upgrade_icon.png + close.png diff --git a/kylin-update-notify-immutable/data/background_upgrade_icon.png b/kylin-update-notify-immutable/data/background_upgrade_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..19fb6d0bc3ccd3c74f1f7caa323e1d65ac2e6f1d GIT binary patch literal 5225 zcmV-v6qf6WP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&6aGm=K~z{rOgwv8Bz07hX(A8DvopVtk zR1xBSq;wfk{uU|7{t9Bn6~rY<=aHB?kI99Lm|DDw+2#K$$N8Tyvvdv9JXe^%jQrdc zq!a)#HQ z#rV`B(u_p$JR$;I#WDdBJju~XMu5k``~^jx0{ye72okV>*2$n=;z)}e9rq0ZNU#P0 z8adv)xUASrmllzmTSkN+BB=sGu?a+?DMaHLga|eoOTh?55soAf3df*_qXDo`F7bmPD-}GE*kY$gdDI2g0p!V|xJ=2Ehgh&`+R#f-HkB z%R#?B`j9Znn@!A~M>0PJA0Mtq;xNJjicI zU=8kvI4zOs3%p=a{V_9ljS^Udp2!hw9Iil+%*Egjh6#?02FaoxK{ymglwiUf&??|a zJccks00%h`V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dR1OY~ z`$L&8B%WX#Le@aFY{t0nWnL@U=KdjA9SKuT!W^8ud?gF6rckD!v~y+(9xljIn%q0Y z4W&L!qJ8l3`Ag|cED6TgO1rxqt{ex;dDz&cOwfK?AAFt zQd^phG!znYv+00000NkvXXu0mjf*!RB^ literal 0 HcmV?d00001 diff --git a/kylin-update-notify-immutable/data/kylin-background-upgrade-manul.service b/kylin-update-notify-immutable/data/kylin-background-upgrade-manul.service new file mode 100644 index 0000000..1eab582 --- /dev/null +++ b/kylin-update-notify-immutable/data/kylin-background-upgrade-manul.service @@ -0,0 +1,10 @@ +[Unit] +Description=Kylin Background Upgrade + + +[Service] +Type=forking +TimeoutStartSec=infinity +ExecStart=/usr/bin/kylin-background-upgrade --check-upgrade + + diff --git a/kylin-update-notify-immutable/data/kylin-background-upgrade-manul.timer b/kylin-update-notify-immutable/data/kylin-background-upgrade-manul.timer new file mode 100644 index 0000000..9455699 --- /dev/null +++ b/kylin-update-notify-immutable/data/kylin-background-upgrade-manul.timer @@ -0,0 +1,12 @@ +[Unit] +Description=系统升级定时检测 + +[Timer] +OnStartupSec=10min +OnUnitInactiveSec=10min +AccuracySec=5s +Unit=kylin-background-upgrade-manul.service + +[Install] +WantedBy=default.target + diff --git a/data/kylin-background-upgrade-template.conf b/kylin-update-notify-immutable/data/kylin-background-upgrade-template.conf similarity index 100% rename from data/kylin-background-upgrade-template.conf rename to kylin-update-notify-immutable/data/kylin-background-upgrade-template.conf diff --git a/data/kylin-background-upgrade.desktop b/kylin-update-notify-immutable/data/kylin-background-upgrade.desktop similarity index 78% rename from data/kylin-background-upgrade.desktop rename to kylin-update-notify-immutable/data/kylin-background-upgrade.desktop index f592f81..2e53db2 100644 --- a/data/kylin-background-upgrade.desktop +++ b/kylin-update-notify-immutable/data/kylin-background-upgrade.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Name=kylin-background-upgrade Name[zh_CN]=更新管理器托盘程序 -Exec=/usr/bin/kylin-background-upgrade %u +Exec=/usr/bin/kylin-background-upgrade --check-immediately Icon=kylin-update-manager Type=Application X-UKUI-AutoRestart=true diff --git a/data/kylin-update.timer.conf b/kylin-update-notify-immutable/data/kylin-update.timer.conf similarity index 100% rename from data/kylin-update.timer.conf rename to kylin-update-notify-immutable/data/kylin-update.timer.conf diff --git a/data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml b/kylin-update-notify-immutable/data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml similarity index 100% rename from data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml rename to kylin-update-notify-immutable/data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml diff --git a/kylin-update-notify-immutable/data/update.png b/kylin-update-notify-immutable/data/update.png new file mode 100644 index 0000000000000000000000000000000000000000..fe222a39f346935d1812c4d08822de6a12e23932 GIT binary patch literal 8074 zcmV;5A9dh~P)9v;syjqgi zFICmmorugi|K+^XMY{Secfa@DSH;P)jQ@w95BUGb{m%=||E9@091hOvdr=hs>%{q- zR6z+4ZS|e$V$N0KoD&3S-n= z3#7|bgTb`|KQ}SXIsq8han=YxA>Ih# zJaf$({GBr(1Pw-rmZ(PlFEW2Ol9ID36+bxv3=nUGXb1IK*Y@t)fA@KLc|$#3PkX1s z*_`M3be`uNR^!RCEQ+EO6h)yT9Elz-KXYbHmoA-O(-1CbM9>K!nh--~C1TpNX?#IJ zfupRf%vn}e=IGL;i_p4tYhlQcA>yoAvr#5)Wcafh87H*UJ2Q|C^jeOXzT zIi1dCP!S4AmLW?}KNHNC=Q$|ogTqI&+~Bb92^c_A&4Z)VpV0; z*Y7NRXXZmwrj%&Jh-sgSWaQ@NqP)Dk`TYK)Cf?S*`ybuBBh6|YQI-QI!?hE>x}pD~ zJMOr{_N<$f01VgbdfP!ET}Qn8!;cmZyn58A=hD)=?Z_MiQ9?|R5^{KBfe^su1p14!sW4;sBrwx0YoBPE{7r=gb-`juAMS^^shHWqtUGAE*|p0)NcJI zr82FP;oz<3FL`;9oqHQi00Ujm8zFw?u`Ef>5r(R<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~yN`uG{M`C_c zCrwS^;n;znoB%o)5JJCZpVY-R_H==j1jvjeuv{$~AY5kD*iX*&G@La8=s-WT)Z|ev zEV9}E!+-!Z0$H12M3@HmH#VS370x;Vbf7#Y0!BokuZ<9|U$YBfk!waA1 Fri, 01 Dec 2023 14:16:50 +0800 + +kylin-update-notify (1.3.2.1-ok7) yangtze; urgency=medium + + * remove depend kylin-software-properties . + + -- luoxueyi Mon, 12 Jun 2023 14:08:00 +0800 + +kylin-update-notify (1.3.2.1-ok6) yangtze; urgency=medium + + * Fix the upload error. + + -- handsome_feng Fri, 09 Jun 2023 15:55:18 +0800 + +kylin-update-notify (1.3.2.1-ok5) yangtze; urgency=medium + + *BUG号:#issues/I784B9 【arm】【树莓派】【系统更新】控制面板“有更新应用时通知”是关闭的,会自动弹出“检测到有系统更新”弹窗 + #issues/I7847A 【arm】【树莓派】【系统更新】点击“检测到有系统更新”弹窗的“立即更新”按钮,无法跳转到控制面板系统更新页面 + #issues/I76LO5 【wayland】【控制面板】【更新】更新提示弹窗未显示在屏幕右下角 + #issues/I768RV 【控制面板】【更新】推迟提醒计时器时间错乱,在未到推迟时间又重新出现弹窗 + #issues/I74KO7 【控制面板】【更新】开启"有更新应用时通知",在通知弹窗中点击"立即更新"无法跳转到控制面板-更新界面 + + *需求号:无 + *其他改动说明:无 + *影响域: 无 + + -- luoxueyi Fri, 09 Jun 2023 10:13:18 +0800 + +kylin-update-notify (1.3.2.1-ok4) yangtze; urgency=medium + + *BUG号:135671 【wayland】【更新升级】设置推迟时间不生效,到推迟的时间后没有再次出现自动更新弹窗 + *需求号:无 + *其他改动说明:无 + *影响域: 无 + + -- luoxueyi Tue, 18 Apr 2023 09:46:45 +0800 + +kylin-update-notify (1.3.2.1-ok3) yangtze; urgency=medium + + * patch from zhangdongwei + + -- Xie Wei Thu, 21 Jul 2022 19:41:21 +0800 + +kylin-update-notify (1.3.2.1-ok2) yangtze; urgency=medium + + * add BR: python2.7-dev + + -- Xie Wei Thu, 21 Jul 2022 18:26:14 +0800 + +kylin-update-notify (1.3.2.1-ok1) yangtze; urgency=medium + + * build for openKylin + * 修改为quilt格式 + + -- Xie Wei Thu, 21 Jul 2022 18:08:51 +0800 + +kylin-update-notify (1.3.2.1) yangtze; urgency=medium + + *BUG号:无 + *需求号:无 + *其他改动说明:无 + *影响域: 系统更新-静默升级 + + -- luoxueyi Thu, 21 Jul 2022 17:57:12 +0800 + +kylin-background-upgrade (1.3.2.1) v101; urgency=medium + + *BUG号:121781 【在线更新】中文环境下,静默更新完成后,右上角及侧边栏通知未汉化 + 122046 【更新升级】配置静默推送,但是仓库源不存在推送的包,后台日志有报错,功能未见异常 + 122183 【在线更新】上午8-12点外仍会弹出更新通知 + 122425 【在线更新】设置每隔1min38s弹出通知,在弹出的通知弹窗中点击推迟,1min38s后再次弹出更新通知 + *需求号:无 + *其他改动说明:无 + *影响域: 系统更新-静默升级 + + -- luoxueyi Thu, 07 Jul 2022 18:34:30 +0800 + +kylin-background-upgrade (1.3.2.0) v101; urgency=medium + + *BUG号:无 + *需求号:# 12723 【更新升级】静默升级接口重构 + # 13511 【更新升级】系统可选更新通知机制优化 + *其他改动说明:更新kylin-system-updater后端接口 + *影响域: 系统更新-静默升级 + + -- luoxueyi Mon, 06 Jun 2022 16:24:14 +0800 + +kylin-background-upgrade (1.3.1+0527kord0) v101; urgency=medium + + *BUG号:无 + *需求号:无 + *其他改动说明:更新kylin-system-updater后端接口 + + -- luoxueyi Fri, 20 May 2022 15:58:48 +0800 + +kylin-background-upgrade (1.3.1+0520) v101; urgency=medium + + *BUG号:无 + *需求号:无 + *其他改动说明:更新kylin-system-updater后端接口 + + -- luoxueyi Fri, 20 May 2022 15:58:48 +0800 + +kylin-background-upgrade (1.3.1+0125.2) v101; urgency=medium + + *BUG号:104479 + *需求号:无 + *其他改动说明:无 + + -- wanghailiang Tue, 25 Jan 2022 10:11:46 +0800 + +kylin-background-upgrade (1.3.1+0111.1) v101; urgency=medium + + *BUG 号: 102451 + *需求号:无 + *其他改动说明:无 + + -- liyanda Tue, 11 Jan 2022 18:05:55 +0800 + +kylin-background-upgrade (1.2.1+0830.4hw1) v101.hw; urgency=medium + + *BUG 号:无 + *需求号:无 + *其他改动说明:测试设置固定值的窗口出现位置 + + -- liyanda Thu, 29 Apr 2021 19:24:32 +0800 + +kylin-background-upgrade (1.2.1+0331.1) v101; urgency=medium + + * 更新界面拉起控制面板异常问题 + + -- liyanda Wed, 31 Mar 2021 19:26:45 +0800 + +kylin-background-upgrade (1.2.1+0324.1) v101; urgency=medium + + * 适配高分屏 + + -- liyanda Wed, 24 Mar 2021 18:53:48 +0800 + +kylin-background-upgrade (1.2.1+0320.5) v101; urgency=medium + + * 优化弹窗布局 + + -- liyanda Sat, 20 Mar 2021 16:23:38 +0800 + +kylin-background-upgrade (1.2.1+0316.3) v101; urgency=medium + + * 更改定时器生成机制 + + -- liyanda Mon, 15 Mar 2021 12:37:14 +0800 + +kylin-background-upgrade (1.2.1+0312.2) v101; urgency=medium + + * 增加推迟提醒功能 + + -- liyanda Fri, 12 Mar 2021 15:07:45 +0800 + +kylin-background-upgrade (1.2.1+0303.1) v101; urgency=medium + + * 更新文件锁内容 + + -- liyanda Wed, 03 Mar 2021 13:49:46 +0800 + +kylin-background-upgrade (1.2.1+0204.2) v101; urgency=medium + + * 更改托盘图标提示方式 + + -- liyanda1234 Thu, 04 Feb 2021 11:32:41 +0800 + +kylin-background-upgrade (1.2.1+0201.1) v101; urgency=medium + + * Change file lock path + * 更改文件锁路径 + + -- liyanda1234 Mon, 01 Feb 2021 15:46:09 +0800 + +kylin-background-upgrade (1.2.1+0129.1) v101; urgency=medium + + * Modify the problem of abnormal installation + * 修改安装异常的问题 + + -- liyanda1234 Fri, 29 Jan 2021 13:48:21 +0800 + +kylin-background-upgrade (1.2.1+0126.1) v101; urgency=medium + + * 更改后台更新错误处理机制 + + -- liyanda1234 Tue, 26 Jan 2021 16:42:59 +0800 + +kylin-background-upgrade (1.2.1+0122.1) v101; urgency=medium + + * 更改托盘选择页面的ui + + -- liyanda1234 Fri, 22 Jan 2021 15:13:40 +0800 + +kylin-background-upgrade (1.2.1+0120.4) v101; urgency=medium + + * 更改消息通知逻辑 + * 更改环境变量 + * 更改托盘图标右键内容 + + -- liyanda1234 Wed, 20 Jan 2021 11:40:40 +0800 + +kylin-background-upgrade (1.2.1+0119.3) v101; urgency=medium + + * Modify message notification icon + * 修改消息通知图标 + + * Standardize message notification content + * 规范消息通知内容 + + * Increase the focus on source management + * 增加对源管理器重连机制 + + -- liyanda1234 Tue, 19 Jan 2021 11:05:27 +0800 + +kylin-background-upgrade (1.2.1+0118.1) v101; urgency=medium + + * 增加对更新管理器的启动的判断 + + -- liyanda1234 Mon, 18 Jan 2021 17:41:38 +0800 + +kylin-background-upgrade (1.2.1+0115.3) v101; urgency=medium + + * 增加中英文翻译 + * 更改单例方式 + * 更改连接dbus的方式 + * 修改server参数,调整定时器调用方式 + + -- liyanda1234 Fri, 15 Jan 2021 11:13:31 +0800 + +kylin-background-upgrade (1.2.1+0112.1) v101; urgency=medium + + * 修改读取更新管理器数据库地址 + * 修改获取源管理器返回值类型 + + -- liyanda1234 Tue, 12 Jan 2021 17:27:38 +0800 + +kylin-background-upgrade (1.2.1+0111.1) v101; urgency=medium + + * 增加电量与包大小的判断 + + -- liyanda1234 Mon, 11 Jan 2021 13:38:20 +0800 + +kylin-background-upgrade (1.2.1+0109.4) v101; urgency=medium + + * 修改了电量错误处理 + + -- liyanda1234 Sat, 09 Jan 2021 13:26:51 +0800 + +kylin-background-upgrade (1.2.1+0108.1) v101; urgency=medium + + * 重新命名托盘 + + -- liyanda1234 Fri, 08 Jan 2021 12:15:37 +0800 + +kylin-background-upgrade (1.2.1+0106.3) v101; urgency=medium + + * 增加文件锁的错误处理 + + -- liyanda1234 Wed, 06 Jan 2021 14:29:43 +0800 + +kylin-background-upgrade (1.2.1+0104.8) v101; urgency=medium + + * 增加文件锁 + * 增加消息通知功能 + + -- liyanda1234 Mon, 04 Jan 2021 10:18:57 +0800 + +kylin-background-upgrade (1.1.1+1231.2) v101; urgency=medium + + * 新增托盘静默更新气泡提示 + * 重构dbus连接代码 + + -- liyanda1234 Thu, 31 Dec 2020 14:43:43 +0800 + +kylin-background-upgrade (1.1.1+1230.5) v101; urgency=medium + + * 更改获取包列表的方式 + + -- liyanda1234 Wed, 30 Dec 2020 20:53:18 +0800 + +kylin-background-upgrade (1.1.1+1229.6) v101; urgency=medium + + * 更改任务栏显示的问题 + + -- liyanda1234 Tue, 29 Dec 2020 17:00:00 +0800 + +kylin-background-upgrade (1.1.1+1229.1) v101; urgency=medium + + * firstlog + + -- liyanda1234 Wed, 23 Dec 2020 15:18:22 +0800 diff --git a/kylin-update-notify-immutable/debian/control b/kylin-update-notify-immutable/debian/control new file mode 100644 index 0000000..dd7c4ea --- /dev/null +++ b/kylin-update-notify-immutable/debian/control @@ -0,0 +1,31 @@ +Source: kylin-update-notify +Maintainer: kylin +Section: universe/admin +Priority: optional +Build-Depends: debhelper-compat(=12), + qtbase5-dev, + libxml2-dev, + libxml2, + libqt5svg5-dev, + libglib2.0-dev, + qttools5-dev-tools, + qtchooser, + libgsettings-qt-dev, + libqt5dbus5, + nvme-cli, + libqapt-dev, + libkf5windowsystem-data, + libkf5windowsystem-dev, + libkf5windowsystem5, + libkf5windowsystem-doc, + libukui-log4qt-dev, +Standards-Version: 4.1.3 + +Package: kylin-update-notify +Architecture: any +Section: universe/admin +Priority: optional +Depends: ${shlibs:Depends}, + kylin-system-updater ( >= 2.0.5.1 ) +Breaks: kylin-update-tray +Description: kylin background upgrade diff --git a/kylin-update-notify-immutable/debian/install b/kylin-update-notify-immutable/debian/install new file mode 100644 index 0000000..2d1cc74 --- /dev/null +++ b/kylin-update-notify-immutable/debian/install @@ -0,0 +1,2 @@ +kylin-update-notify.desktop /etc/xdg/autostart/ +checkUpdate.py /usr/share/kylin-update-notify diff --git a/kylin-update-notify-immutable/debian/postinst b/kylin-update-notify-immutable/debian/postinst new file mode 100755 index 0000000..18fefff --- /dev/null +++ b/kylin-update-notify-immutable/debian/postinst @@ -0,0 +1,5 @@ +#!/bin/bash + +systemctl --user daemon-reload +systemctl --global enable kylin-background-upgrade-silent.timer +systemctl --global enable kylin-background-upgrade-manul.timer \ No newline at end of file diff --git a/kylin-update-notify-immutable/debian/postrm b/kylin-update-notify-immutable/debian/postrm new file mode 100644 index 0000000..c9010ea --- /dev/null +++ b/kylin-update-notify-immutable/debian/postrm @@ -0,0 +1,7 @@ +#!/bin/bash + +#if [ ! -f "/etc/systemd/user/kylin-background-upgrade-timer.timer" ];then +#echo "remove_timer" +#else +#rm /etc/systemd/user/kylin-background-upgrade-timer.timer +#fi diff --git a/kylin-update-notify-immutable/debian/rules b/kylin-update-notify-immutable/debian/rules new file mode 100755 index 0000000..9e47e96 --- /dev/null +++ b/kylin-update-notify-immutable/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export QT_SELECT := qt5 + +%: + dh $@ + diff --git a/kylin-update-notify-immutable/debian/source/format b/kylin-update-notify-immutable/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/kylin-update-notify-immutable/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/kylin-update-notify-immutable/debian/source/options b/kylin-update-notify-immutable/debian/source/options new file mode 100644 index 0000000..06e1ae9 --- /dev/null +++ b/kylin-update-notify-immutable/debian/source/options @@ -0,0 +1 @@ +include-binaries diff --git a/kylin-update-notify-immutable/env.pri b/kylin-update-notify-immutable/env.pri new file mode 100644 index 0000000..673db9f --- /dev/null +++ b/kylin-update-notify-immutable/env.pri @@ -0,0 +1,4 @@ +PROJECT_ROOTDIR = $$PWD + +INCLUDEPATH = ./widgets +include(./widgets/widgets.pri) diff --git a/kylin-update-notify-immutable/kylin-update-notify-immutable.pro b/kylin-update-notify-immutable/kylin-update-notify-immutable.pro new file mode 100644 index 0000000..450bff3 --- /dev/null +++ b/kylin-update-notify-immutable/kylin-update-notify-immutable.pro @@ -0,0 +1,42 @@ +QT += core gui dbus network KWindowSystem sql +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 link_pkgconfig + +# 项目名 +TARGET = kylin-background-upgrade +TEMPLATE = app + +LIBS +=-lukui-log4qt + +include(env.pri) +INCLUDEPATH +=./widgets + +SOURCES += \ + ./src/core.cpp \ + ./src/main.cpp \ + ./src/traydbus.cpp \ + ./src/trayicon.cpp \ + ./src/updatehandle.cpp \ + ./src/updatewidget.cpp + +HEADERS += \ + ./src/core.h \ + ./src/traydbus.h \ + ./src/trayicon.h \ + ./src/updatehandle.h \ + ./src/updatewidget.h + +TRANSLATIONS += translations/kylin-background-upgrade_zh_CN.ts \ + translations/kylin-background-upgrade_bo_CN.ts + +PKGCONFIG += gsettings-qt kysdk-waylandhelper + +FORMS += \ + ./src/updatewidget.ui + +RESOURCES += \ + ./data/Resources.qrc + +DISTFILES += \ + ./data/update.png diff --git a/kylin-update-notify-immutable/kylin-update-notify-immutable.pro.user b/kylin-update-notify-immutable/kylin-update-notify-immutable.pro.user deleted file mode 100644 index 8a39f79..0000000 --- a/kylin-update-notify-immutable/kylin-update-notify-immutable.pro.user +++ /dev/null @@ -1,314 +0,0 @@ - - - - - - EnvironmentId - {d046ac2c-d866-413d-b1bb-19624e2982b6} - - - 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 - - 桌面 - 桌面 - {aec71f56-69fb-48e2-9c09-f1e33c937a53} - 0 - 0 - 0 - - /home/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-immutable-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/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-immutable-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/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-immutable-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/kylin/openkylin/kylin-update-notify/kylin-update-notify-immutable/kylin-update-notify-immutable.pro - /home/kylin/openkylin/kylin-update-notify/kylin-update-notify-immutable/kylin-update-notify-immutable.pro - - false - - false - true - true - false - false - true - - /home/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-immutable-unknown-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/kylin-update-notify.desktop b/kylin-update-notify-immutable/kylin-update-notify.desktop similarity index 64% rename from kylin-update-notify.desktop rename to kylin-update-notify-immutable/kylin-update-notify.desktop index 662e431..72d60c6 100644 --- a/kylin-update-notify.desktop +++ b/kylin-update-notify-immutable/kylin-update-notify.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=update-notify-force -Exec=/usr/bin/kylin-background-upgrade --check-upgrade +Exec=/usr/bin/kylin-update-notify --check-upgrade Type=Application NoDisplay=true Comment=update-notify-force diff --git a/src/core.cpp b/kylin-update-notify-immutable/src/core.cpp similarity index 89% rename from src/core.cpp rename to kylin-update-notify-immutable/src/core.cpp index 00dc303..269318f 100644 --- a/src/core.cpp +++ b/kylin-update-notify-immutable/src/core.cpp @@ -11,7 +11,7 @@ core::core(QString getnum, QWidget *parent) core::~core() { - + qDebug() << Q_FUNC_INFO << __LINE__; } void core::execSlots() diff --git a/src/core.h b/kylin-update-notify-immutable/src/core.h similarity index 100% rename from src/core.h rename to kylin-update-notify-immutable/src/core.h diff --git a/src/main.cpp b/kylin-update-notify-immutable/src/main.cpp similarity index 53% rename from src/main.cpp rename to kylin-update-notify-immutable/src/main.cpp index f7179b2..e3c717b 100644 --- a/src/main.cpp +++ b/kylin-update-notify-immutable/src/main.cpp @@ -6,42 +6,50 @@ #include #include #include +#include #define PROGRAM_NAME "kylin-background-upgrade" +#define LOG_NAME "/.config/kylin-background-upgrade/kylin-background-upgrade.log" +#define LOG_SILENT_NAME "/.config/kylin-background-upgrade/kylin-background-upgrade-silent.log" +#define LOG_MANUL_NAME "/.config/kylin-background-upgrade/kylin-background-upgrade-manul.log" static FILE *fp = NULL; +QString toDir; +static bool _silentOrManul = true; void msgHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) { static char logPath[255] = {0}; - static int uid = -1; + int uid = -1; + static int pid = 0; Q_UNUSED(context); QDateTime currentTime = QDateTime::currentDateTime(); QString timeStr = currentTime.toString("yy.MM.dd hh:mm:ss +zzz"); - + pid = (int)getpid(); + uid = (int)getuid(); // 获取用于控制命令行输出的环境变量 - char *ctrlEnv = getenv("XXXX_DEBUG"); + char *ctrlEnv = getenv("BACKGROUND_UPGRADE_DEBUG"); QString env; // 格式化输出字符串,添加消息发生时间、消息等级 QString outMsg; switch (type) { case QtDebugMsg: - outMsg = QString("[%1 D]: %2").arg(timeStr).arg(msg); + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); break; case QtInfoMsg: - outMsg = QString("[%1 I]: %2").arg(timeStr).arg(msg); + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); break; case QtWarningMsg: - outMsg = QString("[%1 W]: %2").arg(timeStr).arg(msg); + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); break; case QtCriticalMsg: - outMsg = QString("[%1 C]: %2").arg(timeStr).arg(msg); + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); break; case QtFatalMsg: - outMsg = QString("[%1 F]: %2").arg(timeStr).arg(msg); + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); } if (fp != NULL) { @@ -64,31 +72,43 @@ void msgHandler(QtMsgType type, const QMessageLogContext& context, const QString abort(); } -void log_env_init(){ +void log_env_init(QString arg){ static int uid = -1; - static char logPath[255] = {0}; + static char logPath[98] = {0}; bool _is_root = false; + toDir = QDir::homePath(); + toDir += "/.config/kylin-background-upgrade/"; + QDir dir(toDir); + if(!dir.exists()) { + dir.mkdir(toDir); + } // 初始执行时,设置log文件路径 if (uid == -1) { uid = getuid(); - } if (uid == 0) { // root user - sprintf(logPath, "/var/log/kylin-background-upgrade/kylin-background-upgrade.log", uid, PROGRAM_NAME); + sprintf(logPath, "/var/log/kylin-background-upgrade/kylin-background-upgrade.log"); _is_root = true; } else { // normal user - sprintf(logPath, "/run/user/%d/%s.log", uid, PROGRAM_NAME); + // sprintf(logPath, "/run/user/%d/%s.log", uid, PROGRAM_NAME); + //QString 转 const char* + std::string str = QDir::homePath().toStdString(); + const char* ch = str.c_str(); + if (arg == "--check-upgrade" || arg == "--check-immediately") { + sprintf(logPath, "%s%s", ch, LOG_MANUL_NAME); + } else { + sprintf(logPath, "%s%s", ch, LOG_SILENT_NAME); + } } - printf("Logfile path: %s\n", logPath); if (access(logPath, F_OK|W_OK) == 0) { // log文件存在且可写 if (fp == NULL) fp = fopen(logPath, "a+"); QFileInfo info(logPath); - if (info.size() > 1024*1024*200) { //200MB + if (info.size() > 1024*1024*20) { //20MB fclose(fp); fp = NULL; QFile fileclean(logPath); fileclean.open(QIODevice::WriteOnly | QIODevice::Text | QFile::Truncate); @@ -120,35 +140,67 @@ void log_env_init(){ } } +bool _is_openkylin() +{ + QString OPENKYLIN_DISTTRIBUTOR = "Openkylin"; + QString command = "lsb_release -i -s"; + QProcess process; + process.start(command); + process.waitForFinished(); + + QString result = process.readAllStandardOutput(); + int ret = result.left(OPENKYLIN_DISTTRIBUTOR.length()).compare(OPENKYLIN_DISTTRIBUTOR.left(OPENKYLIN_DISTTRIBUTOR.length())); + return (0 == ret)?true:false; +} + int main(int argc, char *argv[]) { QString arg=QString::fromLatin1(argv[1]); -// initUkuiLog4qt("kylin-background-upgrade"); - log_env_init(); + log_env_init(arg); qInstallMessageHandler(msgHandler); - char *x=getenv("DISPLAY"); + char *dis_env=getenv("DISPLAY"); + QString display_env(dis_env); + if(display_env != NULL){ + qDebug()<<"The desktop graphics environment is normal, DISPLAY="<= QT_VERSION_CHECK(5, 6, 0)) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #endif -// callPyFunc *lxy = new callPyFunc(); setenv("QT_QPA_PLATFORMTHEME","ukui",true); qunsetenv("SESSION_MANAGER"); QApplication a(argc, argv); - core *m_core= new core(arg); - QObject::connect(m_core,SIGNAL(execSignal()),&a,SLOT(quit())); + core m_core(arg); +// QObject::connect(m_core,SIGNAL(execSignal()),&a,SLOT(quit())); return a.exec(); } diff --git a/src/traydbus.cpp b/kylin-update-notify-immutable/src/traydbus.cpp similarity index 94% rename from src/traydbus.cpp rename to kylin-update-notify-immutable/src/traydbus.cpp index 9d44cd5..7618f0d 100644 --- a/src/traydbus.cpp +++ b/kylin-update-notify-immutable/src/traydbus.cpp @@ -70,12 +70,12 @@ source_dbus::source_dbus(QObject *parent) :QObject(parent) { connectTimer = new QTimer(this); -// connect(connectTimer, SIGNAL(timeout()), this, SLOT(connectDbus())); + connect(connectTimer, SIGNAL(timeout()), this, SLOT(connectDbus())); } source_dbus::~source_dbus() { - + qDebug() << Q_FUNC_INFO << __LINE__; } /** @@ -164,7 +164,7 @@ update_dbus* update_dbus::getInstance() update_dbus::update_dbus(QObject *parent) :QObject(parent) { -// initUpdate_Dbus(); + initUpdate_Dbus(); } @@ -270,17 +270,9 @@ QStringList update_dbus::checkForUpdates(QStringList arg) bool update_dbus::checkForUpdateDect() { qDebug()<<"Start to check system upgrade ..."; -// connect(interface,SIGNAL(UpdateDetectFinished(bool, QStringList, QString, QString)),this,SLOT(UpdateDectSlot(bool, QStringList, QString, QString))); -// QDBusReply res = interface->call("UpdateDetect"); -// QProcess process; -// process.start("/home/lxy/kylin-background-upgrade/OpenKylin/kylin-background-upgrade/checkUpdate.py"); -// process.waitForStarted(); -// process.waitForFinished();//以阻塞的方式等待释放 -// QStringList updatelists; -// updatelists.append("kylin-video"); -// QString errorcode = ""; -// QString errorstring = ""; -// UpdateDectSlot(true,updatelists,errorcode, errorstring); + connect(interface,SIGNAL(UpdateDetectFinished(bool, QStringList, QString, QString)),this,SLOT(UpdateDectSlot(bool, QStringList, QString, QString))); + QDBusReply res = interface->asyncCall("UpdateDetect"); + qDebug() << "UpdateDetect (mode: MODE_UPDATE_DETECT) ..."; return true; } diff --git a/src/traydbus.h b/kylin-update-notify-immutable/src/traydbus.h similarity index 99% rename from src/traydbus.h rename to kylin-update-notify-immutable/src/traydbus.h index 4772831..795f869 100644 --- a/src/traydbus.h +++ b/kylin-update-notify-immutable/src/traydbus.h @@ -11,7 +11,7 @@ #include #include #include -#include + #include #include diff --git a/src/trayicon.cpp b/kylin-update-notify-immutable/src/trayicon.cpp similarity index 100% rename from src/trayicon.cpp rename to kylin-update-notify-immutable/src/trayicon.cpp diff --git a/src/trayicon.h b/kylin-update-notify-immutable/src/trayicon.h similarity index 100% rename from src/trayicon.h rename to kylin-update-notify-immutable/src/trayicon.h diff --git a/src/updatehandle.cpp b/kylin-update-notify-immutable/src/updatehandle.cpp similarity index 76% rename from src/updatehandle.cpp rename to kylin-update-notify-immutable/src/updatehandle.cpp index 2559021..8e04ed5 100644 --- a/src/updatehandle.cpp +++ b/kylin-update-notify-immutable/src/updatehandle.cpp @@ -1,5 +1,6 @@ #include "updatehandle.h" #include +#include updatehandle::updatehandle(QString getnum1,QWidget *parent) : QWidget(parent) { @@ -14,7 +15,7 @@ updatehandle::updatehandle(QString getnum1,QWidget *parent) : QWidget(parent) updatehandle::~updatehandle() { - + qDebug() << Q_FUNC_INFO << __LINE__; } /** @@ -73,16 +74,31 @@ void updatehandle::initUI(QString argnum) timerDownload = new QTimer(this); connect(timerDownload, SIGNAL(timeout()), this, SLOT(downloadTimeout())); + if(argnum.contains("--check-immediately")){ + qDebug()<<"exec --check-immediately"; + } else if(argnum.contains("--check-upgrade")) { + qDebug()<<"exec --check-upgrade"; + } else { + qDebug()<<"exec slient."; + } + trayIcon = new trayicon(this); - choice_window = new updatewidget();//更新选择页面 + bool ignore_or_delay = ignoreOrDelay(argnum.contains("--check-immediately",Qt::CaseInsensitive)); + choice_window = new updatewidget(ignore_or_delay);//更新选择页面 tip_window = new updateTip(); //静默升级提示 - if (argnum.contains("--check-upgrade",Qt::CaseInsensitive)) { + if (argnum == "") { + //监听连接源管理器d-bus + //监听托盘点击事件,3:单击,2:双击,1:右键 + connect(trayIcon,&trayicon::activated, this,&updatehandle::onActivated); + connect(m_sourceMutual,&source_dbus::ready,this,&updatehandle::getTemplateList); + m_sourceMutual->connectDbus(); + } else if (argnum.contains("--check-upgrade",Qt::CaseInsensitive)||ignore_or_delay) { //连接关闭功能槽函数 connect(choice_window,&updatewidget::disAgreeBtnSignals,this,&updatehandle::execslots); - UpdateDectCheck(); + UpdateDectCheck(ignore_or_delay); } else { - qDebug()<<"no --check-upgrade, exit."; + qDebug()<<"No update,exit!"; exit(0); } } @@ -97,9 +113,9 @@ void updatehandle::tray_Show() if (!m_updateMutual->listenState()) { if (m_getsql()) { qDebug()<<"m_getsql 的值为true"; - choice_window->update_lab->setText(tr("System update detected")); + choice_window->update_lab->setText(tr("System update")); if (argnum != "update") { - choice_window->show(); + choice_window->updateWidgetShow(); } } else { qDebug()<<"更新管理器关闭检测更新,托盘程序结束"; @@ -203,8 +219,10 @@ void updatehandle::getTemplateList() QString str2; QStringList m_crucial; QFile file1("/var/lib/kylin-software-properties/template/crucial.list"); - if (!file1.open(QIODevice::ReadOnly | QIODevice::Text)) - return ; + if (!file1.open(QIODevice::ReadOnly | QIODevice::Text)){ + qDebug()<<"cat not open file crucial.list"; + exit(0); + } while (!file1.atEnd()) { QByteArray line = file1.readLine(); str1 += QString(line); @@ -216,8 +234,10 @@ void updatehandle::getTemplateList() QStringList m_important; QFile file2("/var/lib/kylin-software-properties/template/important.list"); - if (!file2.open(QIODevice::ReadOnly | QIODevice::Text)) - return ; + if (!file2.open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug()<<"cat not open file important.list"; + exit(0); + } while (!file2.atEnd()) { QByteArray line = file2.readLine(); str2 += QString(line); @@ -289,6 +309,7 @@ void updatehandle::handleCrucial(QStringList checkCrucialAll) for (int i=1;istart(20*60*1000); if (powerState) { //判断是否获取到电量 @@ -312,31 +333,31 @@ void updatehandle::handleCrucial(QStringList checkCrucialAll) notify_send(tr("The system is updating silently")); trayIcon->setVisible(true); qDebug()<<"The system is updating silently ..."; -// m_updateMutual->installAndUpgrade(crucialPackage); + m_updateMutual->installAndUpgrade(crucialPackage); } } } /** - * @brief updatehandle::handleImportant + * @brief updatehandle::UpdateDectSlot * 处理可选升级包 */ -void updatehandle::UpdateDectSlot() +void updatehandle::UpdateDectSlot(bool status,QStringList list,QString errorstring,QString errorcode) { -// if (!status) { -//// qDebug() << "Update Detect failed: " << QString("%1 %2").arg(errorstring).arg(errorcode); -// exit(0); -// } else { -// if (list.length() == 0) { -// qDebug() << "The software on this computer is up to date, exit!"; -// exit(0); -// } else { - choice_window->update_lab->setText(tr("System update detected")); + if (!status) { + qDebug() << "Update Detect failed: " << QString("%1 %2").arg(errorstring).arg(errorcode); + exit(0); + } else { + if (list.length() == 0) { + qDebug() << "The software on this computer is up to date, exit!"; + exit(0); + } else { + choice_window->update_lab->setText(tr("System update")); if (argnum != "update") { - choice_window->show(); + choice_window->updateWidgetShow(); } -// } -// } + } + } //完成检测,刷新下次更新标志位 timersetting->beginGroup(QString::fromLocal8Bit("Timer")); timersetting->setValue("GeneratRandomTime",true); @@ -349,31 +370,11 @@ void updatehandle::UpdateDectSlot() * @brief updatehandle::UpdateDectCheck * 处理可选升级包 */ -void updatehandle::UpdateDectCheck() +void updatehandle::UpdateDectCheck(bool _check_immediately) { //判断是否有系统更新 - if(!checktime()){ - qDebug()<<"Detection update has been opened ..."; -// connect(m_updateMutual,&update_dbus::UpdateDectFinished,this,&updatehandle::UpdateDectSlot); - QDBusConnection::systemBus().connect(QString(),QString("/"),"com.kylin.update.notification","DownloadFinish",this,SLOT(UpdateDectSlot())); -// bool ret= m_updateMutual->checkForUpdateDect(); - } else { - qDebug()<<"The scheduled time is not reached, exit."; - exit(0); - } -} - -/** - * @brief updatehandle::handleImportant - * 处理可选升级包 - */ -void updatehandle::handleImportant() -{ - //判断是否需要检查系统更新 - - if(checktime()){ - if (!m_updateMutual->listenState()) { - if (m_getsql()) { + if(checktime() || !RandomizedExecute || _check_immediately){ + if (m_getsql() || _check_immediately) { qDebug()<<"Detection update has been opened ..."; connect(m_updateMutual,&update_dbus::UpdateDectFinished,this,&updatehandle::UpdateDectSlot); bool ret= m_updateMutual->checkForUpdateDect(); @@ -382,13 +383,48 @@ void updatehandle::handleImportant() exit(0); } } else { - qDebug()<<"更新管理器已运行,程序退出"; + qDebug()<<"The scheduled time is not reached, exit."; exit(0); } +} + + +/** + * @brief updatehandle::ignoreOrDelays + * 处理可选升级包 + */ +bool updatehandle::ignoreOrDelay(bool mode) +{ + static char flagPath[64] = {0}; + sprintf(flagPath, "/var/cache/kylin-update-manager/ignoreOrDelay"); + bool ignore_or_delay = false; + QFile file(flagPath); + + //判断是否完成第一步更新 + if (access(flagPath, F_OK) == 0) { // flag文件存在且可写 + qDebug()<stop(); - if(state){ + //apt返回失败时判断是否安装成功 + if (!state) + _check_status = package_installation_status(checkCrucial); + + if(state || _check_status){ qDebug() << "Silent upgrade is complete, exit."; -// qDebug() << (tr("The system has completed an important update, It is recommended that you restart immediately.")); notify_send(tr("The system has completed an important update, It is recommended that you restart immediately.")); }else{ QString errorstate = tr("update error"); @@ -481,12 +521,55 @@ void updatehandle::InstallFinsih(bool state,QStringList pkgname,QString error,QS exit(0); } +bool updatehandle::package_installation_status(QStringList pkgs) +{ + QString pkgname; + QString cmd; + QProcess process; + bool status,status_single; + for (QStringList::iterator it = pkgs.begin(); it != pkgs.end(); ++it) { + pkgname = *it; + status_single = false; + cmd = QString("dpkg -l %1").arg(pkgname); + process.start(cmd); + process.waitForFinished(); + QByteArray result_ = process.readAllStandardOutput(); + if (QString::fromLocal8Bit(result_) != "") { + QStringList rets = QString::fromLocal8Bit(result_).split(QRegExp("[\n]"),QString::SkipEmptyParts); + for (QStringList::iterator it_ret = rets.begin(); it_ret != rets.end(); ++it_ret) { + QString ret; + ret = *it_ret; + if (ret.contains(pkgname) && ret.startsWith("ii")) { + status_single = true; + qDebug() << "pkg "<beginGroup(QString::fromLocal8Bit("Timer")); + timersetting->setValue("CheckCompleted",false); + timersetting->setValue("GeneratRandomTime",false); + timersetting->sync(); + timersetting->endGroup(); emit execSignal(); } diff --git a/src/updatehandle.h b/kylin-update-notify-immutable/src/updatehandle.h similarity index 94% rename from src/updatehandle.h rename to kylin-update-notify-immutable/src/updatehandle.h index 49ebe77..9eb4250 100644 --- a/src/updatehandle.h +++ b/kylin-update-notify-immutable/src/updatehandle.h @@ -86,7 +86,9 @@ public: void readconf(); //读取配置文件 int _secsTo(QString,QString); //时间差 void getpower(); //获取电量值 - void UpdateDectCheck(); //调用后端UpdateDetect + void UpdateDectCheck(bool); //调用后端UpdateDetect + bool ignoreOrDelay(bool mode); //是否开机检查检查弹窗 + bool package_installation_status(QStringList); signals: void execSignal(); //关闭窗口信号 @@ -97,7 +99,7 @@ protected slots: void d_busStatus(QString,int32_t,QString); //判断下载状态的槽函数 void InstallFinsih(bool,QStringList,QString,QString); //状态槽函数 void downloadTimeout(); //延时检测下载状态 - void UpdateDectSlot(); //updatedetect回调函数 + void UpdateDectSlot(bool,QStringList,QString,QString); //updatedetect回调函数 }; #endif // TRAY_H diff --git a/src/updatewidget.cpp b/kylin-update-notify-immutable/src/updatewidget.cpp similarity index 64% rename from src/updatewidget.cpp rename to kylin-update-notify-immutable/src/updatewidget.cpp index 5babafa..ef46e46 100644 --- a/src/updatewidget.cpp +++ b/kylin-update-notify-immutable/src/updatewidget.cpp @@ -1,6 +1,11 @@ #include "updatewidget.h" #include "ui_updatewidget.h" #include +#include +#include +#include "ukuistylehelper/ukuistylehelper.h" +#include "windowmanager/windowmanager.h" + #define PANEL_DBUS_SERVICE "com.ukui.panel.desktop" #define PANEL_DBUS_PATH "/" #define PANEL_DBUS_INTERFACE "com.ukui.panel.desktop" @@ -10,7 +15,7 @@ #define DBUS_PATH "/org/ukui/SettingsDaemon/wayland" #define DBUS_INTERFACE "org.ukui.SettingsDaemon.wayland" -updatewidget::updatewidget(QWidget *parent) : +updatewidget::updatewidget(bool check_Tips, QWidget *parent) : QWidget(parent), ui(new Ui::Form) { @@ -22,6 +27,7 @@ updatewidget::updatewidget(QWidget *parent) : initPanelDbusGsetting(); GetsAvailableAreaScreen(); qDebug()<<"not wayland"; + bIsWayland = false; } else { //注释掉的是原先的接口,已经废除。采用原本的获取方式 // initset_window_position(); @@ -29,69 +35,179 @@ updatewidget::updatewidget(QWidget *parent) : initPanelDbusGsetting(); GetsAvailableAreaScreen(); qDebug()<<"wayland"; + bIsWayland = true; } - + _check_Tips = check_Tips; //设置任务栏无显示 setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); update_lab = new QLabel(); + icon_lab = new QLabel(); + tip_lab = new QLabel(); - tip_lab->setText(tr("at")); - tip_lab1 = new QLabel(); - tip_lab1->setText(tr("No reminders")); - agreebtn = new QPushButton(); - disagreebtn = new QPushButton(); + tip_lab->setText(tr(" Updatable app detected on your system!")); + agreebtn = new FixButton(); + delaybtn = new FixButton(); + window_close = new QPushButton(this); + + window_close->setIcon(QIcon::fromTheme("window-close-symbolic")); + window_close->setProperty("isWindowButton", 0x2); + window_close->setProperty("useIconHighlightEffect", 0x8); + window_close->setFlat(true); + window_close->setToolTip(tr("Close")); + window_close->installEventFilter(this); + connect(window_close, &QPushButton::clicked, this, &updatewidget::onClick_close_btn); + + QPixmap icon(QIcon::fromTheme("ukui-control-center").pixmap(QSize(26,26))); m_pfirstlayout = new QVBoxLayout(); m_labellayout = new QHBoxLayout(); m_psecondlayout = new QHBoxLayout(); m_pselectlayout = new QHBoxLayout(); - comboBox = new QComboBox(); comboBox->clear(); - strList<addItems(strList); + comboBox->installEventFilter(this); labelwidget = new QWidget(); - statwidget = new QWidget(); selectWidget = new QWidget(); + statwidget = new QWidget(); - agreebtn->setText(tr("Update")); - disagreebtn->setText(tr("Delay")); + agreebtn->setText(tr("Update"),1); + agreebtn->installEventFilter(this); + delaybtn->setText(tr("Delay"),1); + delaybtn->installEventFilter(this); connect(agreebtn,&QPushButton::clicked,this,&updatewidget::agreeBtnClicked); - connect(disagreebtn,&QPushButton::clicked,this,&updatewidget::disAgreeBtnClicked); - + connect(comboBox,SIGNAL(activated(int)),this,SLOT(comboBoxClicked(int))); + connect(delaybtn,&QPushButton::clicked,this,&updatewidget::delayBtnClicked); + icon_lab->setPixmap(icon); + icon_lab->setScaledContents(true); + icon_lab->setMaximumSize(26,26); + update_lab->setMaximumHeight(26); + update_lab->setContentsMargins(0,0,0,3); + window_close->setFixedSize(24,24); + window_close->setContentsMargins(0,0,0,3); + m_labellayout->addWidget(icon_lab); m_labellayout->addWidget(update_lab); + m_labellayout->addStretch(); + m_labellayout->addWidget(window_close); + m_labellayout->setContentsMargins(0,0,0,20); labelwidget->setLayout(m_labellayout); m_pselectlayout->addWidget(tip_lab); - m_pselectlayout->addWidget(comboBox); - m_pselectlayout->addWidget(tip_lab1); - m_pselectlayout->addStretch(); + m_pselectlayout->setContentsMargins(0,0,0,25); selectWidget->setLayout(m_pselectlayout); - - m_psecondlayout->addWidget(disagreebtn); + m_psecondlayout->addStretch(); + comboBox->setFixedHeight(35); + comboBox->setMinimumWidth(135); + comboBox->setMaximumWidth(155); + agreebtn->setFixedSize(100,35); + if (_check_Tips) + m_psecondlayout->addWidget(delaybtn); + else + m_psecondlayout->addWidget(comboBox); m_psecondlayout->addWidget(agreebtn); + m_psecondlayout->setSpacing(15); //set space between comboBox and btn + m_psecondlayout->setContentsMargins(0,0,12,12); statwidget->setLayout(m_psecondlayout); m_pfirstlayout->addWidget(labelwidget); m_pfirstlayout->addWidget(selectWidget); m_pfirstlayout->addWidget(statwidget); - this->setLayout(m_pfirstlayout); - this->setAttribute(Qt::WA_TranslucentBackground); - this->setFixedSize(330,180); + m_pfirstlayout->setSpacing(2); + this->setLayout(m_pfirstlayout); + this->setFixedSize(435,160); + +// QGSettings *settings; +// if(QGSettings::isSchemaInstalled("org.ukui.style")){ +// settings = new QGSettings("org.ukui.style"); +// connect(settings,&QGSettings::changed,this,&ActiveConnectionWidget::GSettingsChanges); +// } + +// const QByteArray transparency_id(TRANSPARENCY_SETTINGS); +// if(QGSettings::isSchemaInstalled(transparency_id)) { +// transparency = new QGSettings(transparency_id); +// } +// if(QGSettings::isSchemaInstalled(transparency_id)) { +// getTransparency(); +// connect(transparency,&QGSettings::changed,this,&ActiveConnectionWidget::GSettingsChanges); +// } + + this->setProperty("useStyleWindowManager", false); + this->setProperty("useSystemStyleBlur", true); + this->setAttribute(Qt::WA_TranslucentBackground, true); + this->setWindowOpacity(0.9); + +// labelwidget->setStyleSheet("background-color:green;"); +// update_lab->setStyleSheet("background-color:blue;"); +// selectWidget->setStyleSheet("background-color:red;"); +// statwidget->setStyleSheet("background-color:orange;"); +// comboBox->setStyleSheet("background-color:violet;"); +// agreebtn->setStyleSheet("background-color:yellow;"); } updatewidget::~updatewidget() { + qDebug() << Q_FUNC_INFO << __LINE__; delete ui; } +void updatewidget::updateWidgetShow() +{ + this->show(); + qDebug()<<"should show:"<windowHandle(), updateWidgetRect); + else + this->setGeometry(updateWidgetRect); +} + +void updatewidget::onClick_close_btn() +{ + // emit disAgreeBtnSignals(); + qDebug()<<"User Cancel reminder, exit tray program!"; + // exit(0); + qApp->quit(); +} + +/** + * @brief updatewidget::eventFilter + * 事件过滤器 + */ +bool updatewidget::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == this->window_close) { //指定window_close + if (event->type() == QEvent::HoverMove) { + QPushButton *close_btn = qobject_cast(obj); + if (close_btn) { + QToolTip::showText(QCursor::pos(), close_btn->toolTip()); + } + } + } else if (obj == this->agreebtn || obj == this->delaybtn) { + if (event->type() == QEvent::HoverMove) { + FixButton *btn = qobject_cast(obj); + if (btn) { + QToolTip::showText(QCursor::pos(), btn->toolTip()); + } + } + } else if (obj == this->comboBox) { + if (event->type() == QEvent::HoverMove) { + QComboBox *comboBox = qobject_cast(obj); + if (comboBox) { + QToolTip::showText(QCursor::pos(), comboBox->toolTip()); + } + } + } + return QWidget::eventFilter(obj, event); +} + /** * @brief updatewidget::initPanelDbusGsetting * 初始化与任务栏gsetting和dbus @@ -181,26 +297,26 @@ void updatewidget::GetsAvailableAreaScreen() { case updatewidget::PanelDown : { - this->setGeometry(m_nScreenWidth - 340,m_nScreenHeight - h - 190,300,150-100); - qDebug()<<"Taskbar coordinates: [ '"<setGeometry(m_nScreenWidth - 340,m_nScreenHeight - 190,300,150-100); - qDebug()<<"任务栏在上方: 显示坐标为: "<setGeometry(m_nScreenWidth - 340,m_nScreenHeight - 190,300,150-100); - qDebug()<<"任务栏在左侧: 显示坐标为: "<setGeometry(m_nScreenWidth - 340 - h,m_nScreenHeight - 190,300,150-100); - qDebug()<<"任务栏在右侧: 显示坐标为: "<setGeometry(priWid-330-distance,availableHeight-180-m-distance,this->width(),this->height()); - qDebug()<<"任务栏在下侧"<width()<<" "<height(); + this->setGeometry(priWid-435-distance,availableHeight-160-m-distance,this->width(),this->height()); + qDebug()<<"任务栏在下侧"<width()<<" "<height(); }else if(n == 1){ //任务栏在上侧 - this->setGeometry(priWid-330-distance,availableHeight-180-distance,this->width(),this->height()); - qDebug()<<"任务栏在上侧"<width()<<" "<height(); + this->setGeometry(priWid-435-distance,availableHeight-160-distance,this->width(),this->height()); + qDebug()<<"任务栏在上侧"<width()<<" "<height(); } else if (n == 2){ //任务栏在左侧 - this->setGeometry(priWid-330-distance,availableHeight-180-distance,this->width(),this->height()); - qDebug()<<"任务栏在左侧"<width()<<" "<height(); + this->setGeometry(priWid-435-distance,availableHeight-160-distance,this->width(),this->height()); + qDebug()<<"任务栏在左侧"<width()<<" "<height(); } else if (n == 3){ //任务栏在右侧 - this->setGeometry(availableWidth-330-m-distance,availableHeight-180-distance,this->width(),this->height()); - qDebug()<<"任务栏在右侧"<width()<<" "<height(); + this->setGeometry(availableWidth-435-m-distance,availableHeight-160-distance,this->width(),this->height()); + qDebug()<<"任务栏在右侧"<width()<<" "<height(); } } @@ -313,7 +429,7 @@ void updatewidget::set_window_position() */ char *updatewidget::insideTime() { - qDebug()<currentText(); + qDebug()<<"current select: "<comboBox->currentText(); QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 QByteArray str2char2 = str.toLatin1(); // must @@ -359,19 +475,24 @@ char *updatewidget::insideTime() QByteArray str2char2 = str1.toLatin1(); // must nowtime = str2char2.data(); return nowtime; - } else if (comboBox->currentText() == strList.at(5)) { - QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 - QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 - QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addDays(5); - QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss"); - QByteArray str2char2 = str1.toLatin1(); // must - nowtime = str2char2.data(); - return nowtime; } return nowtime; } +bool updatewidget::_is_openkylin() +{ + QString OPENKYLIN_DISTTRIBUTOR = "Openkylin"; + QString command = "lsb_release -i -s"; + QProcess process; + process.start(command); + process.waitForFinished(); + + QString result = process.readAllStandardOutput(); + int ret = result.left(OPENKYLIN_DISTTRIBUTOR.length()).compare(OPENKYLIN_DISTTRIBUTOR.left(OPENKYLIN_DISTTRIBUTOR.length())); + return (0 == ret)?true:false; +} + /** * @brief updatewidget::agreeBtnClicked * 同意更新按钮槽函数 @@ -379,19 +500,35 @@ char *updatewidget::insideTime() void updatewidget::agreeBtnClicked() { emit agreeBtnSignals(); - qDebug()<<"WifiButtonClickSlot is running"; + bool _is_2107 = true; + QFile file("/etc/os-release"); + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QString line; + QTextStream in(&file); + line = in.readLine(); + while(!line.isNull()) { + line = in.readLine(); + if(line.contains("KYLIN_RELEASE_ID")) { + _is_2107 = false; + } + } + } + file.close(); QProcess p(0); + p.startDetached("ukui-control-center -m upgrade"); + qDebug()<<"exec -m upgrade"; + p.waitForStarted(); qDebug()<<"Open the control panel and start updating immediately, exit tray program!"; exit(0); } /** - * @brief updatewidget::disAgreeBtnClicked - * 延迟提醒按钮槽函数 + * @brief updatewidget::comboBoxClicked + * 推迟框槽函数 */ -void updatewidget::disAgreeBtnClicked() +void updatewidget::comboBoxClicked(int num) { //判断是否有kylin-background-upgrade目录,没有则创建 QString toDir = QDir::homePath(); @@ -408,7 +545,7 @@ void updatewidget::disAgreeBtnClicked() exit(0); } else { char *nowtime=insideTime(); - qDebug() << "nowtime "<beginGroup(QString::fromLocal8Bit("Timer")); timersettings->setValue("CheckUpgradeTime",nowtime); @@ -420,6 +557,16 @@ void updatewidget::disAgreeBtnClicked() exit(0); } +/** + * @brief updatewidget::delayBtnClicked + * 延迟提醒,退出 + */ +void updatewidget::delayBtnClicked() +{ + qDebug() << "User deferred updates, exit!"; + exit(0); +} + /** * @brief updatewidget::paintEvent * 样式绘画画家 @@ -444,6 +591,16 @@ void updatewidget::paintEvent(QPaintEvent *e) p.drawRoundedRect(opt.rect,12,12); setProperty("blurRegion",QRegion(path.toFillPolygon().toPolygon())); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + QFontMetrics fontMetrics(this->font()); + QString current_str = comboBox->currentText(); + int fontSize = fontMetrics.width(current_str); + int showTextSize = comboBox->width() - 32; + if (fontSize > showTextSize) { + QString elidedText = fontMetrics.elidedText(comboBox->currentText(), Qt::ElideRight, showTextSize); + comboBox->setItemText(comboBox->currentIndex(), elidedText); + comboBox->setToolTip(current_str); + } QWidget::paintEvent(e); } @@ -464,7 +621,9 @@ updateTip::updateTip(QWidget *parent) : tipLabel->setText(tr("The system is updating silently")); m_layout->addWidget(tipLabel); this->setLayout(m_layout); - this->setAttribute(Qt::WA_TranslucentBackground); + this->setProperty("useSystemStyleBlur", true); + this->setAttribute(Qt::WA_TranslucentBackground, true); + this->setWindowOpacity(0.9); } updateTip::~updateTip() diff --git a/src/updatewidget.h b/kylin-update-notify-immutable/src/updatewidget.h similarity index 81% rename from src/updatewidget.h rename to kylin-update-notify-immutable/src/updatewidget.h index c27b470..15f0c30 100644 --- a/src/updatewidget.h +++ b/kylin-update-notify-immutable/src/updatewidget.h @@ -21,6 +21,8 @@ #include #include #include +#include +#include "Button/fixbutton.h" namespace Ui { class Form; @@ -31,7 +33,7 @@ class updatewidget : public QWidget Q_OBJECT public: - explicit updatewidget(QWidget *parent = nullptr); + explicit updatewidget(bool check_Tips, QWidget *parent = nullptr); ~updatewidget(); enum PanelStatePosition @@ -42,16 +44,20 @@ public: PanelRight }; + bool _check_Tips; QLabel *update_lab; + QLabel *icon_lab; QLabel *tip_lab; - QLabel *tip_lab1; + QLabel *close_lab; - QPushButton *agreebtn; - QPushButton *disagreebtn; + FixButton *agreebtn; + FixButton *delaybtn; + QPushButton *window_close; QWidget *labelwidget; QWidget *statwidget; QWidget *selectWidget; QStringList strList; + QPixmap *icon; QVBoxLayout *m_pfirstlayout = nullptr; QHBoxLayout *m_labellayout = nullptr; @@ -66,6 +72,8 @@ public: int m_nScreenHeight; // 屏幕分辨率的高 int m_pPeonySite; // 任务栏位置 QSettings *timersettings; //读取timer配置文件 + QRect updateWidgetRect; + bool bIsWayland = false; int connectTaskBarDbus(); int getPanelSite(); @@ -78,6 +86,9 @@ public: void initset_window_position(); void listenPanelChange(); void initPanelDbusGsetting(); // 初始化与任务栏gsetting和dbus + bool eventFilter(QObject *, QEvent *); // 添加事件过滤器声明 + bool _is_openkylin(); + void updateWidgetShow(); private: Ui::Form *ui; @@ -89,8 +100,9 @@ signals: protected slots: void agreeBtnClicked(); - void disAgreeBtnClicked(); - + void comboBoxClicked(int); + void delayBtnClicked(); + void onClick_close_btn(); }; diff --git a/src/updatewidget.ui b/kylin-update-notify-immutable/src/updatewidget.ui similarity index 100% rename from src/updatewidget.ui rename to kylin-update-notify-immutable/src/updatewidget.ui diff --git a/translations/UapLBi.json b/kylin-update-notify-immutable/translations/UapLBi.json similarity index 100% rename from translations/UapLBi.json rename to kylin-update-notify-immutable/translations/UapLBi.json diff --git a/kylin-update-notify-immutable/translations/kylin-background-upgrade_bo_CN.qm b/kylin-update-notify-immutable/translations/kylin-background-upgrade_bo_CN.qm new file mode 100644 index 0000000000000000000000000000000000000000..535b5f598f2ccb2f465ddce9b5d0c408cc5ef980 GIT binary patch literal 2003 zcmd5-&1(}u6rUvKLy|HgC_Pv@)gmQWX($yBA~eQId#nAR2$sz5PLidY-LN}Rw-mhU zMWoP^qKFFBTic5l5qj{T_D>Kzc@V^Z!S`l2$!gc&O;f_W%)HOv`@PpoZ;ZhYKOS!# zjGTH`efIWqnGkZ1%w5E&frX&pz!R2O2*d`r4NEA$+X_ZK1lJ8AMW{9U z3gE??m>6^wUQkO1$nhPucA*i=Ak7EhgIo)nG^29V;cdFxBu!~m=@QuC%Zk!Ln}?u- zHB}=m?X~h|q?HZsG2LmlEFp!#xXsLF%W);QWzb@Aj?GGJxGO-dDQpAOWP?lQJ8ii1 zBzNH*UJR2Z@vhOQkuDtKgF>-0GCdpz*L=&g$2G36)m^7; z8{_R(-Q|XehhQuW`1^ErCb33ez>GrMy7bHRjI`neo~sosIAJALici?fY)5Q0pSiAep&CMQ_awA)hj zbv*hj2xO{nrUO%|_`V)b!uV_gq&OfrP-T!7BP>o|u^cZt6Ooo2KNP)3*>pu%T>W1O Z$s4g_u<#J&np%M|% + + + + Form + + + Form + + + + + trayicon + + + The system is updating silently + རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། + + + + updateTip + + + The system is updating silently + རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། + + + + updatehandle + + + + System update + རྒྱུད་ཁོངས་གསར་སྒྱུར་ + + + + + + The system is updating silently + རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། + + + + The system has completed an important update, It is recommended that you restart immediately. + མ་ལག་གི་འགག་རྩའི་གསར་སྒྱུར་ཞིག་ལེགས་གྲུབ་དང་།བསམ་འཆར་ལ་ཁྱེད་རང་འཕྲལ་མར་བསྐྱར་འབྱེད་། + + + + update error + རིམ་འཕར་འགྲུབ་མེད། + + + + kylin-background-upgrade + རྒྱབ་སྟེགས་གསར་སྒྱུར་བྱ་རིམ། + + + + update + རྒྱུད་ཁོངས་རིམ་སྤོར་ + + + + updatewidget + + + Updatable app detected on your system! + རྒྱུད་ཁོངས་གསར་སྒྱུར་རྣམ་གྲངས་ + + + + Close + སྒོ་རྒྱག་པ་ + + + + 30 minutes later + ཕྱིར་འགྱངས་སྐར་མ་30། + + + + 1 hour later + ཆུ་ཚོད་གཅིག་ནར་འགྱངས་། + + + + 5 hours later + ཆུ་ཚོད་5ནར་འགྱངས་། + + + + 1 day later + ཉིན་གཅིག་ནར་འགྱངས་། + + + + 3 days later + ཉིན་གསུམ་ནར་འགྱངས་། + + + + Update + ལམ་སང་གསར་སྒྱུར་ + + + + Delay + ནར་འགྱངས། + + + diff --git a/kylin-update-notify-immutable/translations/kylin-background-upgrade_zh_CN.qm b/kylin-update-notify-immutable/translations/kylin-background-upgrade_zh_CN.qm new file mode 100644 index 0000000000000000000000000000000000000000..1025f13b5cf7d4eb987ac30a13f2dc1b3134be4d GIT binary patch literal 1305 zcmbtTO=uHA6rTKTwq#p#QF`!a>JQXlYeR@9@lXrZB0^0>f*Ly69g{Vi-F0_j*i!0M zQ7MAK3Zi%rg9j0M=|#jIJXniYFH%q5{5cd4deAq!>2`x5m+rF6@b>%O_r3RKjxQ^N z?|(dMt_|&eGxPNI=W&G4O*D0^iBMz%O|9HQD7qKDNUtCi&W6~23*wE?(v6)6h2Dly z$^krTuV=h9bS=E+YYA}6v3IR!z&|BS8~}dgL|mB*!y1XZ@vtBcPZojxQA{mOLzb%v z@?{*>Rp~<{2Jwd~kQ))$CFlOkuUF*@!w(9NKV8|NuS5tU0lt0t3dOc#Gg`x{jq9dD zn5vhtt!h+fniB_%$SmThvZ05zpR3PRpn27FlZo6|hoSzQXU4;EdCA*Wh^}bVWgXX&#qP-2DHST<^=Mj2Hw(Xm=H4T}+- zd8N}M_%!2~P-9Zl6oN<^-fEu*e0BXzTE5ruX)GAoS|8$f1Sw-9tXS?F&=OGOX?z zyAbwXKB96Tx4h_F|L&(qVR+8-Q$|V}#l$qR0<)0$I1HV4*=irhp@2X`RmzmPvzO%7 z!a7K#5iT6|(Y;i5gLo06FhNh!l6?Ow!WTQh^k z5I!f|f8whqGh?`>>UBnYCfGEcMYzLsf7UhKlN*JL@y!>Eozx6FcrF61iE^7;$O) updateTip - + The system is updating silently 系统正在静默更新 @@ -39,9 +39,9 @@ 系统已经完成一项关键更新,建议您立即重启 - - - + + + The system is updating silently 系统正在静默更新 @@ -50,33 +50,36 @@ 检测到有系统更新 - - System update detected - 检测到有系统更新 + 检测到有系统更新 The system has completed a critical update, and some software packages failed to update. It is recommended that you restart immediately 系统完成一项关键更新,部分软件包更新失败,建议您立即重启 - - + + + System update + 系统更新 + + + The system has completed an important update, It is recommended that you restart immediately. 系统完成一项关键更新,建议您立即重启 - + update error 升级失败 - + kylin-background-upgrade 后台更新程序 - + update 系统升级 @@ -88,74 +91,61 @@ 请在以下时间段之后提醒我 - at - + No more reminders 内不再提醒 - No reminders - 内不再提醒 + 内不再提醒 - - In 30 minutes - 三十分钟 + + Updatable app detected on your system! + 系统有更新项目 - - one hours later - 一个小时 + + Close + 关闭 - - three day later - 三天 + + 30 minutes later + 推迟 30 分钟 - - five day later - 五天 + + 1 hour later + 推迟 1 小时 - + + 3 days later + 推迟 3 天 + + + + Delay + 推迟 + + + + 5 hours later + 推迟 5 小时 + + + + 1 day later + 推迟 1 天 + + + Update 立即更新 - - - Delay - 推迟 - - - Two hours later - 两个小时 - - - - five hours later - 五个小时 - - - - one day later - 一天 - - - two day later - 两天 - - - Agree - 立即更新 - - - Disagree - 推迟 - diff --git a/kylin-update-notify-immutable/widgets/Button/button.pri b/kylin-update-notify-immutable/widgets/Button/button.pri new file mode 100644 index 0000000..ded778b --- /dev/null +++ b/kylin-update-notify-immutable/widgets/Button/button.pri @@ -0,0 +1,6 @@ +SOURCES += \ + $$PWD/fixbutton.cpp \ + +HEADERS += \ + $$PWD/fixbutton.h \ + diff --git a/kylin-update-notify-immutable/widgets/Button/fixbutton.cpp b/kylin-update-notify-immutable/widgets/Button/fixbutton.cpp new file mode 100644 index 0000000..fed4aad --- /dev/null +++ b/kylin-update-notify-immutable/widgets/Button/fixbutton.cpp @@ -0,0 +1,36 @@ +#include "fixbutton.h" +#include +#include + +FixButton::FixButton(QWidget *parent): + QPushButton(parent) +{ + +} + +FixButton::~FixButton() +{ + +} + +void FixButton::paintEvent(QPaintEvent *event) +{ + QFontMetrics fontMetrics(this->font()); + int fontSize = fontMetrics.width(mStr); + int showTextSize = this->width() - 32; + if (fontSize > showTextSize) { + this->setText(fontMetrics.elidedText(mStr, Qt::ElideRight, showTextSize), false); + this->setToolTip(mStr); + } else { + this->setText(mStr, false); + this->setToolTip(""); + } + QPushButton::paintEvent(event); +} + +void FixButton::setText(const QString & text, bool saveTextFlag) +{ + if (saveTextFlag) + mStr = text; + QPushButton::setText(text); +} diff --git a/kylin-update-notify-immutable/widgets/Button/fixbutton.h b/kylin-update-notify-immutable/widgets/Button/fixbutton.h new file mode 100644 index 0000000..2f30dbe --- /dev/null +++ b/kylin-update-notify-immutable/widgets/Button/fixbutton.h @@ -0,0 +1,21 @@ +#ifndef _FIXBUTTON_H_ +#define _FIXBUTTON_H_ +#include + +class FixButton : public QPushButton +{ + Q_OBJECT +public: + FixButton(QWidget *parent = nullptr); + ~FixButton(); + void setText(const QString &text, bool saveTextFlag = true); +private: + void paintEvent(QPaintEvent *event); + +private: + QString mStr; +}; + + + +#endif diff --git a/kylin-update-notify-immutable/widgets/widgets.pri b/kylin-update-notify-immutable/widgets/widgets.pri new file mode 100644 index 0000000..da4ea4f --- /dev/null +++ b/kylin-update-notify-immutable/widgets/widgets.pri @@ -0,0 +1,4 @@ +INCLUDEPATH += $$PWD + +include(Button/button.pri) +#include(ComboBox/comboBox.pri) diff --git a/kylin-update-notify.pro b/kylin-update-notify.pro new file mode 100644 index 0000000..2206f0c --- /dev/null +++ b/kylin-update-notify.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = \ + kylin-update-notify \ + kylin-update-notify-immutable \ No newline at end of file diff --git a/kylin-update-notify/checkUpdate.py b/kylin-update-notify/checkUpdate.py new file mode 100755 index 0000000..23ce81a --- /dev/null +++ b/kylin-update-notify/checkUpdate.py @@ -0,0 +1,20 @@ +#!/usr/bin/python3 +import apt +import subprocess + +def calculate_upgradable_pkgs(): + cache = apt.Cache() + pkgs_to_upgrade = [] + + for pkg in cache: + if pkg.is_installed and pkg.is_upgradable : + pkgs_to_upgrade.append(pkg.name) + + if cache.get_changes(): + cache.clear() + + if len(pkgs_to_upgrade) != 0: + subprocess.Popen('dbus-send --system --type=signal / com.kylin.update.notification.DownloadFinish', shell=True) + +if __name__ == "__main__": + calculate_upgradable_pkgs() diff --git a/kylin-update-notify/checkUpdate.pyc b/kylin-update-notify/checkUpdate.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d168620b274bb1adf61330a3835fcfc695a16e4d GIT binary patch literal 897 zcmcIiO^e$w5FN?c?54G8cMmPO^;SdK=1_Vllu}4x7YZpPErmiciY*-5itV*zNFX_F z|73qhe?a?23FOq{3TgCaG#_sy1%IMPFQ5HhrgR(<`$sJM4kE)8WQcwMNcsgJC<{E0 zqyx$ZR7vXIk`{DNbaPw#h(&yc=;ANN%x4au@|t2<4dIANAF?OPiS~jvZ)ivK>E|oj zOWH{)k$3Dt;DMlW;MFs_7bNb+g!vsI<&aBvio?ru#sVyMf)=qrrCEHz^|-ofonvBC zm9Df4feM=xwROrEow?{>=-a$gnOYj{hCZm(b>;?uwOVWU7$Da!Nmr`Qwe<;8qg5Ak ziG%9%KY`j-xlLS?9CB*U0=5`OoVXkN6oN!3hB6XY;<*e(BvZEW;H#Tr z*%1Uj!Obl`!y@MIF|${YD^(ok3)457UT=$2S10sv{c#Hp_kW4qGA$DB0y0U~s;HAB rW`{Z3=lo=Ie(s|Kzat#@>?9tJDYJUNZnEC!4@}guA(W$N6old*X&BY( literal 0 HcmV?d00001 diff --git a/kylin-update-notify/data/Resources.qrc b/kylin-update-notify/data/Resources.qrc new file mode 100644 index 0000000..d68938f --- /dev/null +++ b/kylin-update-notify/data/Resources.qrc @@ -0,0 +1,8 @@ + + + + update.png + background_upgrade_icon.png + close.png + + diff --git a/kylin-update-notify/data/background_upgrade_icon.png b/kylin-update-notify/data/background_upgrade_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..19fb6d0bc3ccd3c74f1f7caa323e1d65ac2e6f1d GIT binary patch literal 5225 zcmV-v6qf6WP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&6aGm=K~z{rOgwv8Bz07hX(A8DvopVtk zR1xBSq;wfk{uU|7{t9Bn6~rY<=aHB?kI99Lm|DDw+2#K$$N8Tyvvdv9JXe^%jQrdc zq!a)#HQ z#rV`B(u_p$JR$;I#WDdBJju~XMu5k``~^jx0{ye72okV>*2$n=;z)}e9rq0ZNU#P0 z8adv)xUASrmllzmTSkN+BB=sGu?a+?DMaHLga|eoOTh?55soAf3df*_qXDo`F7bmPD-}GE*kY$gdDI2g0p!V|xJ=2Ehgh&`+R#f-HkB z%R#?B`j9Znn@!A~M>0PJA0Mtq;xNJjicI zU=8kvI4zOs3%p=a{V_9ljS^Udp2!hw9Iil+%*Egjh6#?02FaoxK{ymglwiUf&??|a zJccks00%h`VcQ=x7$JmX9CS2+cqWhB=|$>%8JU?SCAlyqBG1>Ub)CmLkM%NO(aj}- z6?Vxcr#{Sxaz8zH8QJ-3(2~<|=t+1&DY*GCUoZ&G2w{98i}CS1VgxOKb+R0xexn>r zlnjbA(wPi_k>zj*$xIrlObW3?lrjoK*EMJX9YNkRnn+`!ID>3y9;xD4M2SJjGMJdb z+=>D#x~7H+c8Vb*Dp3M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service similarity index 62% rename from data/kylin-background-upgrade-manul.service rename to kylin-update-notify/data/kylin-background-upgrade-manul.service index d5e9c63..34f7c2a 100644 --- a/data/kylin-background-upgrade-manul.service +++ b/kylin-update-notify/data/kylin-background-upgrade-manul.service @@ -5,6 +5,6 @@ Description=系统升级后台检测程序 [Service] Type=forking TimeoutStartSec=infinity -ExecStart=/usr/share/kylin-update-notify/checkUpdate.py +ExecStart=/usr/bin/kylin-background-upgrade --check-upgrade diff --git a/data/kylin-background-upgrade-manul.timer b/kylin-update-notify/data/kylin-background-upgrade-manul.timer similarity index 100% rename from data/kylin-background-upgrade-manul.timer rename to kylin-update-notify/data/kylin-background-upgrade-manul.timer diff --git a/kylin-update-notify/data/kylin-background-upgrade-silent.service b/kylin-update-notify/data/kylin-background-upgrade-silent.service new file mode 100644 index 0000000..d10f47f --- /dev/null +++ b/kylin-update-notify/data/kylin-background-upgrade-silent.service @@ -0,0 +1,10 @@ +[Unit] +Description=自动更新托盘更新程序 + + +[Service] +Type=forking +TimeoutStartSec=infinity +ExecStart=/usr/bin/kylin-background-upgrade + + diff --git a/kylin-update-notify/data/kylin-background-upgrade-silent.timer b/kylin-update-notify/data/kylin-background-upgrade-silent.timer new file mode 100644 index 0000000..89a2a70 --- /dev/null +++ b/kylin-update-notify/data/kylin-background-upgrade-silent.timer @@ -0,0 +1,12 @@ +[Unit] +Description=静默更新定时检测 + +[Timer] +OnStartupSec=30min +OnUnitInactiveSec=2h +AccuracySec=20s +Unit=kylin-background-upgrade-silent.service + +[Install] +WantedBy=default.target + diff --git a/kylin-update-notify/data/kylin-background-upgrade-template.conf b/kylin-update-notify/data/kylin-background-upgrade-template.conf new file mode 100644 index 0000000..0ac8fb8 --- /dev/null +++ b/kylin-update-notify/data/kylin-background-upgrade-template.conf @@ -0,0 +1,9 @@ +[Settings] +powersize=1 +setpackagesize=999999999 + +[Timer] +checkUpgradeTime= +checkUpgradeTimeSlot=9:30-11:30 +RandomizedExecute=True + diff --git a/kylin-update-notify/data/kylin-background-upgrade.desktop b/kylin-update-notify/data/kylin-background-upgrade.desktop new file mode 100644 index 0000000..2e53db2 --- /dev/null +++ b/kylin-update-notify/data/kylin-background-upgrade.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=kylin-background-upgrade +Name[zh_CN]=更新管理器托盘程序 +Exec=/usr/bin/kylin-background-upgrade --check-immediately +Icon=kylin-update-manager +Type=Application +X-UKUI-AutoRestart=true +OnlyShowIn=UKUI +X-UKUI-Autostart-Phase=Application +NoDisplay=true diff --git a/kylin-update-notify/data/kylin-update.timer.conf b/kylin-update-notify/data/kylin-update.timer.conf new file mode 100644 index 0000000..09880ea --- /dev/null +++ b/kylin-update-notify/data/kylin-update.timer.conf @@ -0,0 +1,6 @@ +[Timer] +CheckUpgradeTime= +CheckCompleted=false +CheckUpgradeTimeSlot=09:30:00-11:30:00 +GeneratRandomTime=true +RandomizedExecute=true \ No newline at end of file diff --git a/kylin-update-notify/data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml b/kylin-update-notify/data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml new file mode 100644 index 0000000..cc35fcd --- /dev/null +++ b/kylin-update-notify/data/org.ukui.log4qt.kylin-background-upgrade.gschema.xml @@ -0,0 +1,39 @@ + + + + "true" + hook qt messages + Control if hook qt messages + + + "DEBUG,console,daily" + config rootLogger's level and appenders + config rootLogger's level and appenders:"level,appender" + + + ".yyyy-MM-dd" + daily log file pattern + set daily log file pattern format:one day + + + "%d{yyyy-MM-dd HH:mm:ss,zzz}(%-4r)[%t]|%-5p| - %m%n" + set log message's format + set log message's format + + + 3600 + set check log files delay time + set check log files delay time + + + 7 + set log files count + set log files count,unit s + + + 512 + set log files total size + set log files total size, unit M + + + diff --git a/kylin-update-notify/data/update.png b/kylin-update-notify/data/update.png new file mode 100644 index 0000000000000000000000000000000000000000..fe222a39f346935d1812c4d08822de6a12e23932 GIT binary patch literal 8074 zcmV;5A9dh~P)9v;syjqgi zFICmmorugi|K+^XMY{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CK2+Bbjv$-mstum8X+|I6^Mzz^HDe*Ndi|MWp|@xfCJ@`EORe^SUt zG6eAXd|V(9fC&*ilwF{ufn2AJ8~?jrzn?hy_RP#?IgP-_S%ca@pkn?TufDlp{=6SF zWCtj|}pRC@kE)>E#!nU%YX{+GA9#6Qp7uHrEpuY?(b3F%hKn8Y_zz_&BNUOtz&{|M&Lm zKcM9U=KvuJ_w4@ebNuVV)7Wqh(05B&4`)&c z=C{kb_rA%OUpaL6kh5hYh>l;kZq4d{{$uXiBS#MVskoa(c*tUdML~XJUxVAI7rEJe zkC;XPFGC200MtFMQP+&_aQWaNT`&GcpWbcSae}Zi)yl>QmWTzir%IUHkSMaA9tX7P&b&xy`eD zzMMo-5(w1ztE;OjD*Y7|C5MZT6&CJ3^4`J)g;YW@M&-4l>~0_RcRH;=XE#&wcFdru z-z5o#2s}dw7sL4;Mp9f*Yn&YdEaL=>n^r5J_SD1+=ULm*n$)5veq z7d|)X+f)r+Wy>>pBnQLkE(7j&F^~FkQUv7~BIrO9K(ZhJjbQfwtasDkV8u`IrtP2P zh0Z2wi8j&5lb+b~yN`uG{M`C_c zCrwS^;n;znoB%o)5JJCZpVY-R_H==j1jvjeuv{$~AY5kD*iX*&G@La8=s-WT)Z|ev zEV9}E!+-!Z0$H12M3@HmH#VS370x;Vbf7#Y0!BokuZ<9|U$YBfk!waA1 - - - - - EnvironmentId - {d046ac2c-d866-413d-b1bb-19624e2982b6} - - - 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 - - 桌面 - 桌面 - {aec71f56-69fb-48e2-9c09-f1e33c937a53} - 0 - 0 - 0 - - /home/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-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/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-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/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-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/kylin/openkylin/kylin-update-notify/kylin-update-notify/kylin-update-notify.pro - /home/kylin/openkylin/kylin-update-notify/kylin-update-notify/kylin-update-notify.pro - - false - - false - true - true - false - false - true - - /home/kylin/openkylin/kylin-update-notify/build-kylin-update-notify-unknown-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/kylin-update-notify/src/core.cpp b/kylin-update-notify/src/core.cpp new file mode 100644 index 0000000..269318f --- /dev/null +++ b/kylin-update-notify/src/core.cpp @@ -0,0 +1,22 @@ +#include "core.h" + +core::core(QString getnum, QWidget *parent) + : QMainWindow(parent) +{ + updateHandle = new updatehandle(getnum,this); + connect(updateHandle,&updatehandle::execSignal,this,&core::execSlots); + this->setWindowFlags(Qt::SubWindow); + +} + +core::~core() +{ + qDebug() << Q_FUNC_INFO << __LINE__; +} + +void core::execSlots() +{ + emit execSignal(); +} + + diff --git a/kylin-update-notify/src/core.h b/kylin-update-notify/src/core.h new file mode 100644 index 0000000..9647b0e --- /dev/null +++ b/kylin-update-notify/src/core.h @@ -0,0 +1,23 @@ +#ifndef CORE_H +#define CORE_H + +#include +#include "updatehandle.h" + +class core : public QMainWindow +{ + Q_OBJECT + +public: + core(QString getnum, QWidget *parent = nullptr); + ~core(); + updatehandle *updateHandle; + +signals: + void execSignal(); + +protected slots: + void execSlots(); + +}; +#endif // CORE_H diff --git a/kylin-update-notify/src/main.cpp b/kylin-update-notify/src/main.cpp new file mode 100644 index 0000000..e3c717b --- /dev/null +++ b/kylin-update-notify/src/main.cpp @@ -0,0 +1,206 @@ +#include "core.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#define PROGRAM_NAME "kylin-background-upgrade" +#define LOG_NAME "/.config/kylin-background-upgrade/kylin-background-upgrade.log" +#define LOG_SILENT_NAME "/.config/kylin-background-upgrade/kylin-background-upgrade-silent.log" +#define LOG_MANUL_NAME "/.config/kylin-background-upgrade/kylin-background-upgrade-manul.log" + +static FILE *fp = NULL; +QString toDir; +static bool _silentOrManul = true; + +void msgHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) +{ + static char logPath[255] = {0}; + int uid = -1; + static int pid = 0; + + Q_UNUSED(context); + + QDateTime currentTime = QDateTime::currentDateTime(); + QString timeStr = currentTime.toString("yy.MM.dd hh:mm:ss +zzz"); + pid = (int)getpid(); + uid = (int)getuid(); + // 获取用于控制命令行输出的环境变量 + char *ctrlEnv = getenv("BACKGROUND_UPGRADE_DEBUG"); + QString env; + + // 格式化输出字符串,添加消息发生时间、消息等级 + QString outMsg; + switch (type) { + case QtDebugMsg: + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); + break; + case QtInfoMsg: + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); + break; + case QtWarningMsg: + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); + break; + case QtCriticalMsg: + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); + break; + case QtFatalMsg: + outMsg = QString("[%1 D .%2 :%4]: %3").arg(timeStr).arg(pid).arg(msg).arg(uid); + } + + if (fp != NULL) { + // 日志文件存在,则输出到日志文件中 + fprintf(fp, "%s\n", outMsg.toUtf8().data()); + fflush(fp); + } + + if (ctrlEnv != NULL) { + // 环境变量为true或者1,则将信息输出到命令行 + env = QString(ctrlEnv).toLower(); + if ((env == "true") || (env == "1")) { + fprintf(stdout, "%s\n", outMsg.toStdString().c_str()); + fflush(stdout); + } + } + + // 遇到致命错误,需要终止程序(这里终止程序是可选的) + if (type == QtFatalMsg) + abort(); +} + +void log_env_init(QString arg){ + static int uid = -1; + static char logPath[98] = {0}; + bool _is_root = false; + toDir = QDir::homePath(); + toDir += "/.config/kylin-background-upgrade/"; + QDir dir(toDir); + if(!dir.exists()) { + dir.mkdir(toDir); + } + + // 初始执行时,设置log文件路径 + if (uid == -1) { + uid = getuid(); + } + if (uid == 0) { + // root user + sprintf(logPath, "/var/log/kylin-background-upgrade/kylin-background-upgrade.log"); + _is_root = true; + } else { + // normal user + // sprintf(logPath, "/run/user/%d/%s.log", uid, PROGRAM_NAME); + //QString 转 const char* + std::string str = QDir::homePath().toStdString(); + const char* ch = str.c_str(); + if (arg == "--check-upgrade" || arg == "--check-immediately") { + sprintf(logPath, "%s%s", ch, LOG_MANUL_NAME); + } else { + sprintf(logPath, "%s%s", ch, LOG_SILENT_NAME); + } + } + + if (access(logPath, F_OK|W_OK) == 0) { // log文件存在且可写 + if (fp == NULL) + fp = fopen(logPath, "a+"); + QFileInfo info(logPath); + if (info.size() > 1024*1024*20) { //20MB + fclose(fp); fp = NULL; + QFile fileclean(logPath); + fileclean.open(QIODevice::WriteOnly | QIODevice::Text | QFile::Truncate); + fileclean.close(); + if (fp == NULL) + fp = fopen(logPath, "a+"); + } + } else if (access(logPath, F_OK) != 0){ //文件不存在 + if (fp == NULL) { + if (_is_root) { //root用户日志文件 + QDir* dir = new QDir(); + if(!dir->exists("/var/log/kylin-background-upgrade/")){ + dir->mkpath("/var/log/kylin-background-upgrade/"); + } + fp = fopen(logPath, "a+"); + if (fp == NULL) + printf("Can't open logfile!\n"); + } else { + fp = fopen(logPath, "a+"); + if (fp == NULL) + printf("Can't open logfile!\n"); + } + } + } else { + // log文件不可写,则需要判断是否被打开过,被打开过就需要关闭 + if (fp != NULL) + fclose(fp); + fp = NULL; + } +} + +bool _is_openkylin() +{ + QString OPENKYLIN_DISTTRIBUTOR = "Openkylin"; + QString command = "lsb_release -i -s"; + QProcess process; + process.start(command); + process.waitForFinished(); + + QString result = process.readAllStandardOutput(); + int ret = result.left(OPENKYLIN_DISTTRIBUTOR.length()).compare(OPENKYLIN_DISTTRIBUTOR.left(OPENKYLIN_DISTTRIBUTOR.length())); + return (0 == ret)?true:false; +} + +int main(int argc, char *argv[]) +{ + QString arg=QString::fromLatin1(argv[1]); + log_env_init(arg); + qInstallMessageHandler(msgHandler); + char *dis_env=getenv("DISPLAY"); + QString display_env(dis_env); + if(display_env != NULL){ + qDebug()<<"The desktop graphics environment is normal, DISPLAY="<= QT_VERSION_CHECK(5, 6, 0)) + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +#endif + + setenv("QT_QPA_PLATFORMTHEME","ukui",true); + qunsetenv("SESSION_MANAGER"); + QApplication a(argc, argv); + core m_core(arg); +// QObject::connect(m_core,SIGNAL(execSignal()),&a,SLOT(quit())); + return a.exec(); +} diff --git a/kylin-update-notify/src/traydbus.cpp b/kylin-update-notify/src/traydbus.cpp new file mode 100644 index 0000000..7618f0d --- /dev/null +++ b/kylin-update-notify/src/traydbus.cpp @@ -0,0 +1,450 @@ +#include "traydbus.h" +#include +#include +#include + +//托盘d-bus 服务 +traydbusservice::traydbusservice() +{ + +} + +QStringList traydbusservice::getCrucial() +{ + QFile file("/var/lib/kylin-software-properties/template/crucial.list"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + return crucial; + while (!file.atEnd()) { + QByteArray line = file.readLine(); + QString str = QString(line); + qDebug()<isValid()) { + qDebug() << qPrintable(QDBusConnection::systemBus().lastError().message()); + exit(1); + } + + interface1->setTimeout(123456789); + //调用远程的value方法,源管理器update + qDebug()<<"Start updateSourceTemplate ..."; + QDBusReply reply1 = interface1->call(QDBus::Block, "updateSourceTemplate"); + if (reply1.isValid()) { + if (reply1.value()) { +// QDBusReply reply2 = interface1->call(QDBus::Block, "updateSourcePackages","kylin-background-upgrade"); +// if (reply2.isValid()) { +// qDebug()<<"updateSourcePackages return value:"<start(3000); + if (initSource_Dbus()) { + connectTimer->stop(); + } else { + num ++; + if (num >2) { + qDebug()<<"updateSourceTemplate failed, exit."; + exit(0); + } + qDebug()<<"updateSourceTemplate failed,Retries are in progress for the "<isValid()) { + qDebug() << qPrintable(QDBusConnection::systemBus().lastError().message()); + qDebug() << "Failed to connect /com/kylin/systemupgrade "; + exit(1); + } + interface_utils = new QDBusInterface("com.kylin.systemupgrade", "/com/kylin/systemupgrade/utils", + "com.kylin.systemupgrade.interface", + QDBusConnection::systemBus()); + if (!interface_utils->isValid()) { + qDebug() << qPrintable(QDBusConnection::systemBus().lastError().message()); + qDebug() << "Failed to connect /com/kylin/systemupgrade "; + exit(1); + } + + //监听D-bus信号,获取安装信息与进度 +// connect(interface,SIGNAL(UpdateDloadAndInstStaChanged(QStringList, int, QString, QString)),this,SLOT(getsignal(QStringList, int, QString, QString))); +// QDBusConnection::systemBus().connect(QString("com.kylin.systemupgrade"), QString("/com/kylin/systemupgrade"), +// QString("com.kylin.systemupgrade.interface"), +// QString("UpdateDloadAndInstStaChanged"), this, SLOT(getsignal(QStringList, int32_t, QString, QString))); + +} + +/** + * @brief update_dbus::getsignal + * 获取下载进度 + */ +void update_dbus::getsignal(QStringList pkgs, int progess, QString status, QString current_details) +{ + QString aptStatus = ""; +// QString aptAppName; + int aptPercent = 0; + +// QVariant dateQVariant; +// aptStatus = arg; + +// QVariantMap::Iterator it; +// for (it = key.begin(); it != key.end(); ++it) { +// if (it.key() == "apt_appname") { +// dateQVariant = it.value(); +// aptAppName = dateQVariant.toString(); +// } +// if (it.key() == "apt_percent") { +// dateQVariant = it.value(); +// aptPercent = dateQVariant.toFloat(); +// } +// } + +// if (arg == "apt_start" && aptD_busStatus == true) { +// aptD_busStatus =false; +// } +// if ((arg == "apt_start" || arg == "apt_finish") && (aptPercent == 0 || aptPercent == 100)) { +// emit aptAppNames_Percentsignal(aptAppName,aptPercent,true); +// } else if (arg == "apt_error" ) { +// emit aptAppNames_Percentsignal(aptAppName,aptPercent,false); +// } + if (aptPercent != progess) { + aptPercent = progess; + emit aptAppNames_Percentsignal(pkgs.at(0),aptPercent,status); + } + +} + +/** + * @brief update_dbus::checkForUpdates + * 检测强制推送列表 + */ +QStringList update_dbus::checkForUpdates(QStringList arg) +{ + QDBusReply reply = interface_utils->call("CheckInstalledOrUpgrade",arg); + if (reply.isValid()) + { + qDebug()<<"The upgradeable list:"< res = interface->asyncCall("UpdateDetect"); + qDebug() << "UpdateDetect (mode: MODE_UPDATE_DETECT) ..."; + return true; +} + +/** + * @brief update_dbus::installAndUpgrade + * 静默升级入口 + */ +bool update_dbus::installAndUpgrade(QStringList pkgNames) +{ + installpkgs = pkgNames; + + //调用D-bus接口,安装软件 + connect(interface,SIGNAL(UpdateDetectFinished(bool,QStringList,QString,QString)),this,SLOT(slotUpdateCache(bool,QStringList,QString,QString))); +// QDBusPendingCall call = interface_utils->asyncCall("InstallPackages","kylin-background-upgrade", installpkgs); + QDBusPendingCall call = interface->asyncCall("UpdateCache"); + qDebug() << "UpdateCache (mode: MODE_UPDATE_CACHE) ..."; //MODE_UPDATE_CACHE + return true; +} + +void update_dbus::slotInstallFinish(bool status, QStringList pkgs,QString error,QString details) +{ + emit UpdateInstallFinished(status,pkgs,error,details); +} + +void update_dbus::UpdateDectSlot(bool status, QStringList pkgs,QString error,QString details) +{ + emit UpdateDectFinished(status,pkgs,error,details); +} + +void update_dbus::slotUpdateCache(bool status,QStringList pkgslist,QString errorstring,QString errorcode) +{ + if (status) { + qDebug() << "MODE_UPDATE_CACHE finish ."; + connect(interface,SIGNAL(UpdateInstallFinished(bool,QStringList,QString,QString)),this,SLOT(slotInstallFinish(bool,QStringList,QString,QString))); + interface->asyncCall("InstallPackages", installpkgs); + } else { + qDebug() << "Call UpdateCache (mode: MODE_UPDATE_CACHE) failed, exit!"; + exit(0); + } +} + +/** + * @brief update_dbus::listenState + * 监听状态 + * @return + */ +bool update_dbus::listenState() +{ + QDBusReply r4eply = interface->call("get_important_status"); + return r4eply; +} + + +//连接电源的d-bus································ + +power_dbus::power_dbus(QObject *parent) + :QObject(parent) +{ + +} + +power_dbus::~power_dbus() +{ + +} + +/** + * @brief power_dbus::initDbusaddrest + * 连接电源管理器的dbus,获取dbus路径 + * @return + */ +bool power_dbus::initDbusaddrest() +{ + + QStringList users; + QDBusInterface m_interface1( "org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + QDBusConnection::systemBus() ); + if (!m_interface1.isValid()) { + qDebug() << "< org.freedesktop.UPower > initialization failed!"; + return false; + } + + QDBusReply> obj_reply = m_interface1.call("EnumerateDevices"); + + + if (obj_reply.isValid()) { + for (QDBusObjectPath op : obj_reply.value()) + users << op.path(); + if (users.size()==1 || users.isEmpty()) { + qDebug()<<"Failed to obtain the remaining battery capacity, The built-in power supply cannot be detected ..."; + return false; + } + powerpath=users.at(1); + return true; + } + return true; +} + +/** + * @brief power_dbus::getPower_Dbus + * 连接电源管理器的dbus + * @return + */ +QString power_dbus::getPower_Dbus() +{ + QDBusInterface m_interface( "org.freedesktop.UPower", + powerpath, + "org.freedesktop.DBus.Properties", + QDBusConnection::systemBus()); + + if (!m_interface.isValid()) { + qDebug() << "电源管理器dbus接口初始化失败"; + return "false"; + } + + QDBusReply obj_reply = m_interface.call("Get","org.freedesktop.UPower.Device","Percentage"); + QString Ele_surplus=obj_reply.value().toString(); + return Ele_surplus; +} + +//判断是否为活跃用户的dbus······························· + +UserIdStatus::UserIdStatus(QObject *parent) + :QObject(parent) +{ + initUserIdStatus(); +} + +UserIdStatus::~UserIdStatus() +{ + +} + + +void UserIdStatus::initConnectionInfo() +{ +// qRegisterMetaType("MyClass"); +// QDBusInterface m_interface1("org.freedesktop.login1", +// "/org/freedesktop/login1", +// "org.freedesktop.login1.Manager", +// QDBusConnection::systemBus() ); +// if (!m_interface1.isValid()) { +// qDebug() << "dbus接口初始化失败"; +// return; +// } + +// QDBusMessage res = m_interface1.call("ListUsers"); + +// qDebug() << res.arguments().at(0).value().IDName; +// qDebug()< res = m_interface1.call("Get","org.freedesktop.login1.User","State"); + UIDStatus = res.value().toString(); +} + + + + diff --git a/kylin-update-notify/src/traydbus.h b/kylin-update-notify/src/traydbus.h new file mode 100644 index 0000000..795f869 --- /dev/null +++ b/kylin-update-notify/src/traydbus.h @@ -0,0 +1,160 @@ +#ifndef TRAYDBUSSERVICE_H +#define TRAYDBUSSERVICE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include + +class traydbusservice : public QObject +{ + Q_OBJECT + //定义Interface名称为com.scorpio.test.value + Q_CLASSINFO("D-Bus Interface", "com.scorpio.test.value") +public: + traydbusservice(); + + QStringList crucial; + QStringList important; + +public slots: + QStringList getCrucial(); + QStringList getImportant(); + + void connectSuccessslots(); + void quitslots(); + +private: + +Q_SIGNALS: // SIGNALS + QString ready(QString ret); + QString connectSuccessSignal(); + QString quitsignal(); + +}; + +//连接源管理器的d-bus································ + +class source_dbus: public QObject +{ + Q_OBJECT + +public: + explicit source_dbus(QObject *parent = nullptr); + ~source_dbus(); + QString serialNumber; + QTimer *connectTimer; + int num=0; + static source_dbus *getInstance(); + QDBusInterface *interface1; //连接源更新管理器的D-bus + + bool initSource_Dbus(); + static source_dbus *sourceMutual; //UpdateDbus类静态对象 + +public slots: + void connectDbus(); + +Q_SIGNALS: + void ready(); +}; + +//连接更新管理器的d-bus································ + +class update_dbus: public QObject +{ + Q_OBJECT + +public: + explicit update_dbus(QObject *parent = nullptr); + ~update_dbus(); + static update_dbus *getInstance(); + QDBusInterface *interface; //连接更新管理器的D-bus + QDBusInterface *interface_utils; //kylin-system-updater utils + void initUpdate_Dbus(); + static update_dbus *updateMutual; //UpdateDbus类静态对象 + QStringList checkForUpdates(QStringList arg); //检测是否有更新 + bool checkForUpdateDect(); //检测系统更新 + bool installAndUpgrade(QStringList pkgNames); //静默升级入口 + QTimer *timer; + + bool aptD_busStatus=true; //发送状态的标志位 + + bool listenState(); + QStringList installpkgs; +Q_SIGNALS: + void ready(); + void aptAppNames_Percentsignal(QString arg,int32_t args,QString state); //发送正在下载安装的包名以及进度 + void dowloadStart(); + void UpdateInstallFinished(bool,QStringList,QString,QString); + void UpdateDectFinished(bool,QStringList,QString,QString); + +protected slots: + void getsignal(QStringList, int, QString, QString); + void slotUpdateCache(bool,QStringList,QString,QString); + void slotInstallFinish(bool,QStringList,QString,QString); + void UpdateDectSlot(bool,QStringList,QString,QString); +}; + +//连接电源的d-bus································ + +class power_dbus: public QObject +{ + Q_OBJECT +public: + power_dbus(QObject *parent = nullptr); + ~power_dbus(); + QDBusInterface *interface; //连接更新管理器的D-bus + bool initDbusaddrest(); + QString getPower_Dbus(); + QString powerpath; + + +Q_SIGNALS: + void ready(); + +protected slots: + +}; + +//判断是否为活跃用户的dbus······························· + + +class MyClass +{ +public: + uint32_t uidnum; + QString IDName; + QDBusObjectPath address; +}; +Q_DECLARE_METATYPE(MyClass) + +class UserIdStatus: public QObject +{ + Q_OBJECT +public: + UserIdStatus(QObject *parent = nullptr); + ~UserIdStatus(); + QString UIDStatus; + void initConnectionInfo(); + void initUserIdStatus(); + +Q_SIGNALS: + void ready(); + +protected slots: + +}; + + +#endif // TRAYDBUSSERVICE_H diff --git a/kylin-update-notify/src/trayicon.cpp b/kylin-update-notify/src/trayicon.cpp new file mode 100644 index 0000000..612e126 --- /dev/null +++ b/kylin-update-notify/src/trayicon.cpp @@ -0,0 +1,35 @@ +#include "trayicon.h" + +trayicon::trayicon(QWidget *parent) : QSystemTrayIcon(parent) +{ + initAction(); +} + +void trayicon::initAction() +{ + this->setToolTip(tr("The system is updating silently")); + this->setIcon(QIcon(":/update.png")); + + m_trayMenu = new QMenu(); + m_topWidget = new QWidget(); + m_topWidget->setFixedSize(30,30); + m_topWidget->installEventFilter(this); + m_topWidgetAction = new QWidgetAction(this); + +} + +/** + * @brief trayicon::eventFilter + * 事件过滤器 + */ +bool trayicon::eventFilter(QObject *obj, QEvent *event) +{ +// if (obj == m_topWidget && event->type() == QEvent::MouseButtonPress) +// { +// QPainter painter(m_topWidget); +// painter.setPen(Qt::NoPen); +// painter.setBrush(QColor(42,120,192)); +// painter.drawRect(m_topWidget->rect()); +// } + return QSystemTrayIcon::eventFilter(obj,event); +} diff --git a/kylin-update-notify/src/trayicon.h b/kylin-update-notify/src/trayicon.h new file mode 100644 index 0000000..6e49374 --- /dev/null +++ b/kylin-update-notify/src/trayicon.h @@ -0,0 +1,33 @@ +#ifndef TRAYICON_H +#define TRAYICON_H + +#include +#include +#include +#include +#include +#include +#include +#include + +class trayicon : public QSystemTrayIcon +{ + Q_OBJECT +public: + explicit trayicon(QWidget *parent = nullptr); + void initAction(); + + QAction *action_show; + QMenu *m_trayMenu; + QWidget *m_topWidget; + QWidgetAction *m_topWidgetAction; + QMenu* trayIconMenu; + QAction* OpenSetUp; +protected: + bool eventFilter(QObject *obj, QEvent *event); + +signals: + +}; + +#endif // TRAYICON_H diff --git a/kylin-update-notify/src/updatehandle.cpp b/kylin-update-notify/src/updatehandle.cpp new file mode 100644 index 0000000..8e04ed5 --- /dev/null +++ b/kylin-update-notify/src/updatehandle.cpp @@ -0,0 +1,750 @@ +#include "updatehandle.h" +#include +#include + +updatehandle::updatehandle(QString getnum1,QWidget *parent) : QWidget(parent) +{ + argnum = getnum1; + + initTranslator(); //加载翻译文件 + getpower(); //获取电量值 + readconf(); //读取配置文件设定值 + initDbus(); //初始化dbus + initUI(argnum); //初始化托盘程序 +} + +updatehandle::~updatehandle() +{ + qDebug() << Q_FUNC_INFO << __LINE__; +} + +/** + * @brief updatehandle::initTranslator + * 加载翻译文件 + */ +void updatehandle::initTranslator() +{ + QTranslator *translator = new QTranslator; + if (translator->load(QLocale(), QLatin1String("kylin-background-upgrade"), QLatin1String("_"), QLatin1String("/usr/share/kylin-background-upgrade"))) { + QApplication::installTranslator(translator); + } else { + qDebug() << "cannot load translator kylin-background-upgrade_" << QLocale::system().name() << ".qm!"; + } + +} + +/** + * @brief updatehandle::getpower + * 获取电量值 + */ +void updatehandle::getpower() +{ + //获取电量信息 + Power_dbus = new power_dbus(this); + powerState = Power_dbus->initDbusaddrest(); + if (powerState) { + powerNum = Power_dbus->getPower_Dbus(); + qDebug()<<"电脑电量值为:"<UIDStatus == "online") { + qDebug()<<"非活跃窗口,禁止启动"; + exit(0); + } + m_updateMutual = update_dbus::getInstance(); //初始化更新管理器d-bus + m_sourceMutual = source_dbus::getInstance(); //初始化源管理器d-bus + +} + + +/** + * @brief updatehandle::initUI + * 初始化界面类 + */ +void updatehandle::initUI(QString argnum) +{ + timerDownload = new QTimer(this); + connect(timerDownload, SIGNAL(timeout()), this, SLOT(downloadTimeout())); + + if(argnum.contains("--check-immediately")){ + qDebug()<<"exec --check-immediately"; + } else if(argnum.contains("--check-upgrade")) { + qDebug()<<"exec --check-upgrade"; + } else { + qDebug()<<"exec slient."; + } + + trayIcon = new trayicon(this); + bool ignore_or_delay = ignoreOrDelay(argnum.contains("--check-immediately",Qt::CaseInsensitive)); + choice_window = new updatewidget(ignore_or_delay);//更新选择页面 + tip_window = new updateTip(); //静默升级提示 + + if (argnum == "") { + //监听连接源管理器d-bus + //监听托盘点击事件,3:单击,2:双击,1:右键 + connect(trayIcon,&trayicon::activated, this,&updatehandle::onActivated); + connect(m_sourceMutual,&source_dbus::ready,this,&updatehandle::getTemplateList); + m_sourceMutual->connectDbus(); + } else if (argnum.contains("--check-upgrade",Qt::CaseInsensitive)||ignore_or_delay) { + //连接关闭功能槽函数 + connect(choice_window,&updatewidget::disAgreeBtnSignals,this,&updatehandle::execslots); + UpdateDectCheck(ignore_or_delay); + } else { + qDebug()<<"No update,exit!"; + exit(0); + } +} + +/** + * @brief updatehandle::tray_Show + * 启动托盘选择页面 + */ +void updatehandle::tray_Show() +{ + if(checktime()){ + if (!m_updateMutual->listenState()) { + if (m_getsql()) { + qDebug()<<"m_getsql 的值为true"; + choice_window->update_lab->setText(tr("System update")); + if (argnum != "update") { + choice_window->updateWidgetShow(); + } + } else { + qDebug()<<"更新管理器关闭检测更新,托盘程序结束"; + exit(0); + } + } else { + qDebug()<<"更新管理器已运行,程序退出"; + exit(0); + } + } else { + qDebug()<<"配置文件设定时间未到,程序退出"; + exit(0); + } +} + +/** + * @brief updatehandle::checktime + * 进行当前时间与配置文件时间比对 + * @return + * true: 当前时间大于配置文件时间 + * false: 当前时间小于配置文件时间 + */ +bool updatehandle::checktime() +{ + timersetting->beginGroup(QString::fromLocal8Bit("Timer")); + CheckUpgradeTime = timersetting->value("CheckUpgradeTime").toString(); + QDateTime datetime = QDateTime::fromString(CheckUpgradeTime, "yyyy-MM-dd hh:mm:ss"); + //结束组 + timersetting->endGroup(); + QDateTime Nowtime = QDateTime::currentDateTime(); //获取系统现在的时间 + qint64 nSecs = Nowtime.secsTo(datetime); //对比 + qDebug()<<"Get timing time: "<isHidden()){ + QPoint pt=cursor().pos(); + tip_window->move(pt.x(),pt.y()-45); + tip_window->show(); + } else { + tip_window->hide(); + } +} + +/** + * @brief updatehandle::getTemplateList + * 获取源管理器文件中的可选更新与强制更新列表 + */ +void updatehandle::getTemplateList() +{ + qDebug()<<"Parses the optional update list and the mandatory update list ..."; + QMap updatedata; + QString str1; + QString str2; + QStringList m_crucial; + QFile file1("/var/lib/kylin-software-properties/template/crucial.list"); + if (!file1.open(QIODevice::ReadOnly | QIODevice::Text)){ + qDebug()<<"cat not open file crucial.list"; + exit(0); + } + while (!file1.atEnd()) { + QByteArray line = file1.readLine(); + str1 += QString(line); + } + str1.replace(QString("\n"), QString("")); + m_crucial = str1.split(QRegExp("[ ]")); + m_crucial.removeAll(QString("")); + qDebug()<<"The crucial lists: "< data) +{ + qDebug()<<"Monitor the installation progress and status signal ..."; + //ksu获取进度,状态 + connect(m_updateMutual,&update_dbus::UpdateInstallFinished,this,&updatehandle::InstallFinsih); + QStringList crucial; + QMap::iterator it; + for (it = data.begin();it != data.end();it++) { + if (it.key() == "crucial") { + crucial = it.value(); + } else if (it.key() == "important") { + important = it.value(); + } + } + qDebug()<<"Checking silent upgrade list: "<checkForUpdates(crucial); + if (!checkCrucialAll.isEmpty()) { + handleCrucial(checkCrucialAll); + } else { + qDebug() << "Silent upgrade list is empty, exit!"; + exit(0); + } +} + +/** + * @brief updatehandle::handleCrucial + * 处理静默升级包 + * @param checkCrucialAll + * 传入包列表 + */ +void updatehandle::handleCrucial(QStringList checkCrucialAll) +{ + QStringList crucialPackageSize; + QStringList crucialPackage; + + if (checkCrucialAll.count()%2 != 0) { + qDebug()<<"The format of the silent upgrade list is incorrect, exit!"; + exit(0); + } + if (argnum != "update") { + //提取包名与大小信息 + for (int i=0;istart(20*60*1000); + if (powerState) { //判断是否获取到电量 + if (powerNum.toInt()setVisible(true); + qDebug()<<"The system is updating silently ..."; + m_updateMutual->installAndUpgrade(crucialPackage); + } else { + exit(0); + } + } else { + notify_send(tr("The system is updating silently")); + trayIcon->setVisible(true); + qDebug()<<"The system is updating silently ..."; + m_updateMutual->installAndUpgrade(crucialPackage); + } + } else { + notify_send(tr("The system is updating silently")); + trayIcon->setVisible(true); + qDebug()<<"The system is updating silently ..."; + m_updateMutual->installAndUpgrade(crucialPackage); + } + } +} + +/** + * @brief updatehandle::UpdateDectSlot + * 处理可选升级包 + */ +void updatehandle::UpdateDectSlot(bool status,QStringList list,QString errorstring,QString errorcode) +{ + if (!status) { + qDebug() << "Update Detect failed: " << QString("%1 %2").arg(errorstring).arg(errorcode); + exit(0); + } else { + if (list.length() == 0) { + qDebug() << "The software on this computer is up to date, exit!"; + exit(0); + } else { + choice_window->update_lab->setText(tr("System update")); + if (argnum != "update") { + choice_window->updateWidgetShow(); + } + } + } + //完成检测,刷新下次更新标志位 + timersetting->beginGroup(QString::fromLocal8Bit("Timer")); + timersetting->setValue("GeneratRandomTime",true); + timersetting->setValue("CheckCompleted",true); + timersetting->sync(); + timersetting->endGroup(); +} + +/** + * @brief updatehandle::UpdateDectCheck + * 处理可选升级包 + */ +void updatehandle::UpdateDectCheck(bool _check_immediately) +{ + //判断是否有系统更新 + if(checktime() || !RandomizedExecute || _check_immediately){ + if (m_getsql() || _check_immediately) { + qDebug()<<"Detection update has been opened ..."; + connect(m_updateMutual,&update_dbus::UpdateDectFinished,this,&updatehandle::UpdateDectSlot); + bool ret= m_updateMutual->checkForUpdateDect(); + } else { + qDebug()<<"Detection updates have been disabled, exit!"; + exit(0); + } + } else { + qDebug()<<"The scheduled time is not reached, exit."; + exit(0); + } +} + + +/** + * @brief updatehandle::ignoreOrDelays + * 处理可选升级包 + */ +bool updatehandle::ignoreOrDelay(bool mode) +{ + static char flagPath[64] = {0}; + sprintf(flagPath, "/var/cache/kylin-update-manager/ignoreOrDelay"); + bool ignore_or_delay = false; + QFile file(flagPath); + + //判断是否完成第一步更新 + if (access(flagPath, F_OK) == 0) { // flag文件存在且可写 + qDebug()< setPackageSize) { + qDebug()<<"包大小超出设定大小,程序退出"; + return false; + } + } + qDebug()<<"包大小符合预定大小"; + return true; +} + +/** + * @brief updatehandle::register_dbus + */ +void updatehandle::register_dbus() +{ + //建立到session bus的连接 + QDBusConnection connection = QDBusConnection::sessionBus(); + + //在session bus上注册名为com.scorpio.test的服务 + if (!connection.registerService("com.scorpio.test")) { + qDebug() << "error:" << connection.lastError().message(); + exit(-1); + } + object = new traydbusservice(); + + //注册名为/test/objects的对象,把类Object所有槽函数导出为object的method + connection.registerObject("/test/objectsd", object,QDBusConnection::ExportAllSlots| QDBusConnection :: ExportAllSignals); + + connect(object,&traydbusservice::quitsignal,[=](){ + emit execSignal(); + }); + + connect(object,&traydbusservice::connectSuccessSignal,[=](){ + dbusConnectStatus = true; + emit object->ready("success"); + }); + +} + +/** + * @brief updatehandle::d_busStatus + * 判断下载状态的槽函数 + * @param arg : Appname + * @param args : aptpercent + * @param state : state + */ +void updatehandle::d_busStatus(QString arg,int32_t args,QString state) +{ + if (!checkCrucial.isEmpty() && messstate2) { + messstate2=false; + trayIcon->setVisible(true); + } + +// qDebug()<<"下载进度:"; +// qDebug()<<"Appname:"<stop(); + //apt返回失败时判断是否安装成功 + if (!state) + _check_status = package_installation_status(checkCrucial); + + if(state || _check_status){ + qDebug() << "Silent upgrade is complete, exit."; + notify_send(tr("The system has completed an important update, It is recommended that you restart immediately.")); + }else{ + QString errorstate = tr("update error"); + QString errorName; + errorName = QString("%1 %2").arg(error).arg(errorstate); + qDebug() << "Silent update failed: "<setVisible(false); + tip_window->hide(); + exit(0); +} + +bool updatehandle::package_installation_status(QStringList pkgs) +{ + QString pkgname; + QString cmd; + QProcess process; + bool status,status_single; + for (QStringList::iterator it = pkgs.begin(); it != pkgs.end(); ++it) { + pkgname = *it; + status_single = false; + cmd = QString("dpkg -l %1").arg(pkgname); + process.start(cmd); + process.waitForFinished(); + QByteArray result_ = process.readAllStandardOutput(); + if (QString::fromLocal8Bit(result_) != "") { + QStringList rets = QString::fromLocal8Bit(result_).split(QRegExp("[\n]"),QString::SkipEmptyParts); + for (QStringList::iterator it_ret = rets.begin(); it_ret != rets.end(); ++it_ret) { + QString ret; + ret = *it_ret; + if (ret.contains(pkgname) && ret.startsWith("ii")) { + status_single = true; + qDebug() << "pkg "<beginGroup(QString::fromLocal8Bit("Timer")); + timersetting->setValue("CheckCompleted",false); + timersetting->setValue("GeneratRandomTime",false); + timersetting->sync(); + timersetting->endGroup(); + emit execSignal(); +} + +/** + * @brief updatehandle::notify_send + * 发送消息通知函数 + * @param arg + * 发送的正文 + */ +void updatehandle::notify_send(QString arg) +{ + QDBusInterface iface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", + QDBusConnection::sessionBus()); + QList args; + args< time2Slot.at(0)) { + return 1; + } else if (time1Slot.at(0) == time2Slot.at(0)) { + if (time1Slot.at(1) > time2Slot.at(1)) { + return 1; + } else if (time1Slot.at(1) == time2Slot.at(1)) { + return 0; + } else if (time1Slot.at(1) < time2Slot.at(1)) { + return -1; + } + } else if (time1Slot.at(0) < time2Slot.at(0)) { + return -1; + } +} + +/** + * @brief updatehandle::readconf + * 读取配置文件 + */ +void updatehandle::readconf() +{ + QMap Timer; + Timer.insert("CheckCompleted", bool(false)); + Timer.insert("CheckUpgradeTime", " "); + Timer.insert("CheckUpgradeTimeSlot", "14:30:00-16:30:00"); + Timer.insert("GeneratRandomTime", bool(true)); + Timer.insert("RandomizedExecute", bool(true)); + QMap Settings; + Settings.insert("powersize", int(1)); + Settings.insert("setpackagesize", "999999999"); +// qDebug()<<"Settings "< ir_timer(Timer); + QMapIterator ir_settings(Settings); + QSettings *code_conf = new QSettings(confPath,QSettings::IniFormat); + code_conf->beginGroup(QString::fromLocal8Bit("Timer")); + while(ir_timer.hasNext()){ + ir_timer.next(); + code_conf->setValue(ir_timer.key(), ir_timer.value()); + } + code_conf->sync(); + code_conf->endGroup(); + code_conf->beginGroup(QString::fromLocal8Bit("Settings")); + while(ir_settings.hasNext()){ + ir_settings.next(); + code_conf->setValue(ir_settings.key(), ir_settings.value()); + } + code_conf->sync(); + code_conf->endGroup(); + } + + timersetting = new QSettings(confPath,QSettings::IniFormat); + timersetting->beginGroup(QString::fromLocal8Bit("Timer")); + CheckUpgradeTime = timersetting->value("CheckUpgradeTime").toString(); + CheckUpgradeTimeSlot = timersetting->value("CheckUpgradeTimeSlot").toString(); + RandomizedExecute = timersetting->value("RandomizedExecute").toBool(); + GeneratRandomTime = timersetting->value("GeneratRandomTime").toBool(); + CheckCompleted = timersetting->value("CheckCompleted").toBool(); + qDebug()<<"[ CheckUpgradeTime: "<endGroup(); + + timersetting->beginGroup(QString::fromLocal8Bit("Settings")); + powerSize = timersetting->value("powersize").toInt(); + setPackageSize = timersetting->value("setpackagesize").toFloat(); + timersetting->endGroup(); + + QStringList timeSlot = CheckUpgradeTimeSlot.split("-"); + qDebug()<<"timeSlot "<beginGroup(QString::fromLocal8Bit("Timer")); + QString timing = current_date+' '+timeSlot.at(0); + QString start_timing = timeSlot.at(0); + QString end_timing = timeSlot.at(1); + QStringList start_timingSlot,end_timingSlot; + QString time0,time1,time2,time3; + if (start_timing.contains(":")){ + start_timingSlot = start_timing.split(":"); + time0 = start_timingSlot.at(0); + time1 = start_timingSlot.at(1); + } + if (end_timing.contains(":")){ + end_timingSlot = end_timing.split(":"); + time2 = end_timingSlot.at(0); + time3 = end_timingSlot.at(1); + } + int strayParameter = (time2.toInt()*60+time3.toInt())-(time0.toInt()*60+time1.toInt()); + a = 0; + if (strayParameter<0){ + qDebug() << "Time format error."; + }else if (strayParameter==0) { + qDebug() << "strayParameter: "<< strayParameter << ", a "<setValue("CheckCompleted",false); + } + QString timing_time = bojb.toString("yyyy-MM-dd hh:mm:ss").toLatin1().data(); + + timersetting->setValue("CheckUpgradeTime",timing_time); + timersetting->setValue("GeneratRandomTime",false); + qDebug()<< "CheckUpgradeTime "<sync(); + timersetting->endGroup(); + } +} + diff --git a/kylin-update-notify/src/updatehandle.h b/kylin-update-notify/src/updatehandle.h new file mode 100644 index 0000000..9eb4250 --- /dev/null +++ b/kylin-update-notify/src/updatehandle.h @@ -0,0 +1,105 @@ +#ifndef TRAY_H +#define TRAY_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "traydbus.h" +#include "trayicon.h" +#include "updatewidget.h" + + +class updatehandle : public QWidget +{ + Q_OBJECT +public: + updatehandle(QString getnum1,QWidget *parent = nullptr); + ~updatehandle(); + trayicon *trayIcon; //托盘实例化 + QStringList important; //保存重要更新包名 + QString argnum; //得到命令行输入参数 + traydbusservice *object; //托盘dbus服务 + bool powerState; //保存电量是否可获取 + QString powerNum = "0"; //保存电量值 + QString confPath = ""; //保存配置文件位置 + + bool dbusConnectStatus=false; //d-bus连接状态 + bool messstate1=true; + bool messstate2=true; + int powerSize; //电源设定值 + float setPackageSize; //包大小设定值 + QString CheckUpgradeTime; //检查更新时间 + QString CheckUpgradeTimeSlot; //检查更新时间段 + bool CheckCompleted; //是否检查完成 + bool RandomizedExecute; //是否随机执行 + bool GeneratRandomTime; //是否刷新随机时间 + bool errorStatus=false; //是否完整下载安装的状态值 + + updatewidget *choice_window; //托盘选择框 + updateTip *tip_window; //托盘提示框框 + QStringList checkCrucial; //保存静默升级包以及大小信息 + + source_dbus *m_sourceMutual; //源管理器dbus + update_dbus *m_updateMutual; //更新管理器dbus + power_dbus *Power_dbus; + QTimer *timerDownload; //托盘下载时间错误延时处理 + QTimer *timerLock; //文件锁定时检测 + QSettings *mqsetting; //读取配置文件 + QSettings *timersetting; //读取timer配置文件 + + + void initUI(QString); //初始化界面 + void initDbus(); //初始化dbus + void initTranslator(); //初始化翻译加载 + void getTemplateList(); //获取源管理器文件中的可选更新与强制更新 + void processData(QMap data); //处理获取的更新数据 + void handleCrucial(QStringList checkCrucialAll); //处理静默升级包 + void handleImportant(); //处理可选升级包 + void register_dbus(); //注册D-bus服务 + bool checktime(); //检查设定更新时间 + + //数据库相关 + QSqlDatabase db; + QSqlQueryModel model; + + bool m_getsql(); //获取更新管理器数据库信息 + void notify_send(QString arg); //向notification发送信息显示 + + bool packageDownOrNot(QStringList arg); + void readconf(); //读取配置文件 + int _secsTo(QString,QString); //时间差 + void getpower(); //获取电量值 + void UpdateDectCheck(bool); //调用后端UpdateDetect + bool ignoreOrDelay(bool mode); //是否开机检查检查弹窗 + bool package_installation_status(QStringList); +signals: + void execSignal(); //关闭窗口信号 + +protected slots: + void onActivated(trayicon::ActivationReason reason); //更新选择页面 + void tray_Show(); //启动托盘显示 + void execslots(); //关闭窗口槽函数 + void d_busStatus(QString,int32_t,QString); //判断下载状态的槽函数 + void InstallFinsih(bool,QStringList,QString,QString); //状态槽函数 + void downloadTimeout(); //延时检测下载状态 + void UpdateDectSlot(bool,QStringList,QString,QString); //updatedetect回调函数 +}; + +#endif // TRAY_H diff --git a/kylin-update-notify/src/updatewidget.cpp b/kylin-update-notify/src/updatewidget.cpp new file mode 100644 index 0000000..ef46e46 --- /dev/null +++ b/kylin-update-notify/src/updatewidget.cpp @@ -0,0 +1,661 @@ +#include "updatewidget.h" +#include "ui_updatewidget.h" +#include +#include +#include +#include "ukuistylehelper/ukuistylehelper.h" +#include "windowmanager/windowmanager.h" + +#define PANEL_DBUS_SERVICE "com.ukui.panel.desktop" +#define PANEL_DBUS_PATH "/" +#define PANEL_DBUS_INTERFACE "com.ukui.panel.desktop" +#define UKUI_PANEL_SETTING "org.ukui.panel.settings" + +#define DBUS_NAME "org.ukui.SettingsDaemon" +#define DBUS_PATH "/org/ukui/SettingsDaemon/wayland" +#define DBUS_INTERFACE "org.ukui.SettingsDaemon.wayland" + +updatewidget::updatewidget(bool check_Tips, QWidget *parent) : + QWidget(parent), + ui(new Ui::Form) +{ + ui->setupUi(this); + //设置出现在屏幕的位置以及大小 + listenPanelChange(); + QString xdg_session_type = qgetenv("XDG_SESSION_TYPE"); + if (xdg_session_type != "wayland"){ + initPanelDbusGsetting(); + GetsAvailableAreaScreen(); + qDebug()<<"not wayland"; + bIsWayland = false; + } else { + //注释掉的是原先的接口,已经废除。采用原本的获取方式 +// initset_window_position(); +// set_window_position(); + initPanelDbusGsetting(); + GetsAvailableAreaScreen(); + qDebug()<<"wayland"; + bIsWayland = true; + } + _check_Tips = check_Tips; + //设置任务栏无显示 + setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); + setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); + + update_lab = new QLabel(); + icon_lab = new QLabel(); + + tip_lab = new QLabel(); + tip_lab->setText(tr(" Updatable app detected on your system!")); + agreebtn = new FixButton(); + delaybtn = new FixButton(); + window_close = new QPushButton(this); + + window_close->setIcon(QIcon::fromTheme("window-close-symbolic")); + window_close->setProperty("isWindowButton", 0x2); + window_close->setProperty("useIconHighlightEffect", 0x8); + window_close->setFlat(true); + window_close->setToolTip(tr("Close")); + window_close->installEventFilter(this); + connect(window_close, &QPushButton::clicked, this, &updatewidget::onClick_close_btn); + + QPixmap icon(QIcon::fromTheme("ukui-control-center").pixmap(QSize(26,26))); + + m_pfirstlayout = new QVBoxLayout(); + m_labellayout = new QHBoxLayout(); + m_psecondlayout = new QHBoxLayout(); + m_pselectlayout = new QHBoxLayout(); + comboBox = new QComboBox(); + comboBox->clear(); + strList<addItems(strList); + comboBox->installEventFilter(this); + + labelwidget = new QWidget(); + selectWidget = new QWidget(); + statwidget = new QWidget(); + + agreebtn->setText(tr("Update"),1); + agreebtn->installEventFilter(this); + delaybtn->setText(tr("Delay"),1); + delaybtn->installEventFilter(this); + + connect(agreebtn,&QPushButton::clicked,this,&updatewidget::agreeBtnClicked); + connect(comboBox,SIGNAL(activated(int)),this,SLOT(comboBoxClicked(int))); + connect(delaybtn,&QPushButton::clicked,this,&updatewidget::delayBtnClicked); + + icon_lab->setPixmap(icon); + icon_lab->setScaledContents(true); + icon_lab->setMaximumSize(26,26); + update_lab->setMaximumHeight(26); + update_lab->setContentsMargins(0,0,0,3); + window_close->setFixedSize(24,24); + window_close->setContentsMargins(0,0,0,3); + m_labellayout->addWidget(icon_lab); + m_labellayout->addWidget(update_lab); + m_labellayout->addStretch(); + m_labellayout->addWidget(window_close); + m_labellayout->setContentsMargins(0,0,0,20); + labelwidget->setLayout(m_labellayout); + + m_pselectlayout->addWidget(tip_lab); + m_pselectlayout->setContentsMargins(0,0,0,25); + selectWidget->setLayout(m_pselectlayout); + + m_psecondlayout->addStretch(); + comboBox->setFixedHeight(35); + comboBox->setMinimumWidth(135); + comboBox->setMaximumWidth(155); + agreebtn->setFixedSize(100,35); + if (_check_Tips) + m_psecondlayout->addWidget(delaybtn); + else + m_psecondlayout->addWidget(comboBox); + m_psecondlayout->addWidget(agreebtn); + m_psecondlayout->setSpacing(15); //set space between comboBox and btn + m_psecondlayout->setContentsMargins(0,0,12,12); + statwidget->setLayout(m_psecondlayout); + + m_pfirstlayout->addWidget(labelwidget); + m_pfirstlayout->addWidget(selectWidget); + m_pfirstlayout->addWidget(statwidget); + + m_pfirstlayout->setSpacing(2); + this->setLayout(m_pfirstlayout); + this->setFixedSize(435,160); + +// QGSettings *settings; +// if(QGSettings::isSchemaInstalled("org.ukui.style")){ +// settings = new QGSettings("org.ukui.style"); +// connect(settings,&QGSettings::changed,this,&ActiveConnectionWidget::GSettingsChanges); +// } + +// const QByteArray transparency_id(TRANSPARENCY_SETTINGS); +// if(QGSettings::isSchemaInstalled(transparency_id)) { +// transparency = new QGSettings(transparency_id); +// } +// if(QGSettings::isSchemaInstalled(transparency_id)) { +// getTransparency(); +// connect(transparency,&QGSettings::changed,this,&ActiveConnectionWidget::GSettingsChanges); +// } + + this->setProperty("useStyleWindowManager", false); + this->setProperty("useSystemStyleBlur", true); + this->setAttribute(Qt::WA_TranslucentBackground, true); + this->setWindowOpacity(0.9); + +// labelwidget->setStyleSheet("background-color:green;"); +// update_lab->setStyleSheet("background-color:blue;"); +// selectWidget->setStyleSheet("background-color:red;"); +// statwidget->setStyleSheet("background-color:orange;"); +// comboBox->setStyleSheet("background-color:violet;"); +// agreebtn->setStyleSheet("background-color:yellow;"); +} + +updatewidget::~updatewidget() +{ + qDebug() << Q_FUNC_INFO << __LINE__; + delete ui; +} + +void updatewidget::updateWidgetShow() +{ + this->show(); + qDebug()<<"should show:"<windowHandle(), updateWidgetRect); + else + this->setGeometry(updateWidgetRect); +} + +void updatewidget::onClick_close_btn() +{ + // emit disAgreeBtnSignals(); + qDebug()<<"User Cancel reminder, exit tray program!"; + // exit(0); + qApp->quit(); +} + +/** + * @brief updatewidget::eventFilter + * 事件过滤器 + */ +bool updatewidget::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == this->window_close) { //指定window_close + if (event->type() == QEvent::HoverMove) { + QPushButton *close_btn = qobject_cast(obj); + if (close_btn) { + QToolTip::showText(QCursor::pos(), close_btn->toolTip()); + } + } + } else if (obj == this->agreebtn || obj == this->delaybtn) { + if (event->type() == QEvent::HoverMove) { + FixButton *btn = qobject_cast(obj); + if (btn) { + QToolTip::showText(QCursor::pos(), btn->toolTip()); + } + } + } else if (obj == this->comboBox) { + if (event->type() == QEvent::HoverMove) { + QComboBox *comboBox = qobject_cast(obj); + if (comboBox) { + QToolTip::showText(QCursor::pos(), comboBox->toolTip()); + } + } + } + return QWidget::eventFilter(obj, event); +} + +/** + * @brief updatewidget::initPanelDbusGsetting + * 初始化与任务栏gsetting和dbus + */ +void updatewidget::initPanelDbusGsetting() +{ + /* 链接任务栏Dbus接口,获取任务栏高度和位置 */ + m_pServiceInterface = new QDBusInterface(PANEL_DBUS_SERVICE, PANEL_DBUS_PATH, PANEL_DBUS_INTERFACE, QDBusConnection::sessionBus()); + m_pServiceInterface->setTimeout(2147483647); + connect(m_pPanelSetting, &QGSettings::changed,[=](QString key){ + if ("panelposition" == key | "panelsize" == key) { + GetsAvailableAreaScreen(); + } + }); +} + +void updatewidget::listenPanelChange() +{ + /* 链接任务栏dgsetting接口 */ + if(QGSettings::isSchemaInstalled(UKUI_PANEL_SETTING)) + m_pPanelSetting = new QGSettings(UKUI_PANEL_SETTING); +} + +/** + * @brief updatewidget::connectTaskBarDbus + * 链接任务栏dbus获取高度的接口 + * @return + */ +int updatewidget::connectTaskBarDbus() +{ + int panelHeight = 46; + if (m_pPanelSetting != nullptr) { + QStringList keys = m_pPanelSetting->keys(); + if (keys.contains("panelsize")) { + panelHeight = m_pPanelSetting->get("panelsize").toInt(); + } + } else { + QDBusMessage msg = m_pServiceInterface->call("GetPanelSize", QVariant("Hight")); + panelHeight = msg.arguments().at(0).toInt(); + return panelHeight; + } + return panelHeight; +} + +/** + * @brief updatewidget::getPanelSite + * 获取任务栏状态位置下上左右 + * @return + * 返回任务栏位置 + */ +int updatewidget::getPanelSite() +{ + int panelPosition = 0; + if (m_pPanelSetting != nullptr) { + QStringList keys = m_pPanelSetting->keys(); + if (keys.contains("panelposition")) { + panelPosition = m_pPanelSetting->get("panelposition").toInt(); + } + } else { + QDBusMessage msg = m_pServiceInterface->call("GetPanelPosition", QVariant("Site")); + panelPosition = msg.arguments().at(0).toInt(); + } + qDebug() << "Current Position of ukui panel: " << panelPosition; + return panelPosition; +} + +/** + * @brief updatewidget::GetsAvailableAreaScreen + * 获取屏幕的可用区域高度和宽度并设置位置 + */ +void updatewidget::GetsAvailableAreaScreen() +{ + //如果取不到任务栏的高度,还是优先获取桌面分辨率,可用区域 + if ((0 == connectTaskBarDbus()) && (0 == getPanelSite())) { + QScreen* pScreen = QGuiApplication::primaryScreen(); + QRect DeskSize = pScreen->availableGeometry(); + m_nScreenWidth = DeskSize.width(); //桌面分辨率的宽 + m_nScreenHeight = DeskSize.height(); //桌面分辨率的高 + } else { + //如果取到任务栏的高度,则取屏幕分辨率的高度 + int h = connectTaskBarDbus(); + QRect screenRect = QGuiApplication::primaryScreen()->geometry(); + m_nScreenWidth = screenRect.width(); + m_nScreenHeight = screenRect.height(); + m_pPeonySite = getPanelSite(); + switch (m_pPeonySite) + { + case updatewidget::PanelDown : + { + qDebug()<<"Taskbar coordinates: [ '"< reply = interface.call("GetPanelPosition", str); + return reply; +} + +int updatewidget::getTaskbarHeight(QString str) +{ + QDBusInterface interface( "com.ukui.panel.desktop", + "/", + "com.ukui.panel.desktop", + QDBusConnection::sessionBus() ); + + QDBusReply reply = interface.call("GetPanelSize", str); + return reply; +} + + +int updatewidget::getScreenGeometry(QString methodName) +{ + int res = 0; + QDBusMessage message = QDBusMessage::createMethodCall(DBUS_NAME, + DBUS_PATH, + DBUS_INTERFACE, + methodName); + QDBusMessage response = QDBusConnection::sessionBus().call(message); + if (response.type() == QDBusMessage::ReplyMessage) { + if(response.arguments().isEmpty() == false) { + int value = response.arguments().takeFirst().toInt(); + res = value; + } + } else { + qDebug()<geometry(); + int priX = getScreenGeometry("x"); + int priY = getScreenGeometry("y"); + int priWid = getScreenGeometry("width"); + int priHei = getScreenGeometry("height"); + QRect screenGeometry = qApp->primaryScreen()->geometry(); + + availableWidth = priX + priWid; + availableHeight = priY + priHei; + totalHeight = screenGeometry.height(); + totalWidth = screenGeometry.width(); + + int distance = 4; + int n = 0; + int m = 46; + + n = getTaskbarPos("position"); + m = getTaskbarHeight("height"); + if(n == 0){ + //任务栏在下侧 + this->setGeometry(priWid-435-distance,availableHeight-160-m-distance,this->width(),this->height()); + qDebug()<<"任务栏在下侧"<width()<<" "<height(); + }else if(n == 1){ + //任务栏在上侧 + this->setGeometry(priWid-435-distance,availableHeight-160-distance,this->width(),this->height()); + qDebug()<<"任务栏在上侧"<width()<<" "<height(); + } else if (n == 2){ + //任务栏在左侧 + this->setGeometry(priWid-435-distance,availableHeight-160-distance,this->width(),this->height()); + qDebug()<<"任务栏在左侧"<width()<<" "<height(); + } else if (n == 3){ + //任务栏在右侧 + this->setGeometry(availableWidth-435-m-distance,availableHeight-160-distance,this->width(),this->height()); + qDebug()<<"任务栏在右侧"<width()<<" "<height(); + } +} + +/** + * @brief updatewidget::insideTime + * 获取时间 + * @return + */ +char *updatewidget::insideTime() +{ + qDebug()<<"current select: "<comboBox->currentText(); + QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 + QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 + QByteArray str2char2 = str.toLatin1(); // must + char *nowtime = str2char2.data(); + + if(comboBox->currentText() == strList.at(0)) { + QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 + QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 + QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(1800); + QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss"); + QByteArray str2char2 = str1.toLatin1(); // must + nowtime = str2char2.data(); + return nowtime; + } else if (comboBox->currentText() == strList.at(1)) { + QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 + QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 + QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(3600); + QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss"); + QByteArray str2char2 = str1.toLatin1(); // must + nowtime = str2char2.data(); + return nowtime; + } else if (comboBox->currentText() == strList.at(2)) { + QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 + QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 + QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(18000); + QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss"); + QByteArray str2char2 = str1.toLatin1(); // must + nowtime = str2char2.data(); + return nowtime; + } else if (comboBox->currentText() == strList.at(3)) { + QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 + QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 + QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addDays(1); + QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss"); + QByteArray str2char2 = str1.toLatin1(); // must + nowtime = str2char2.data(); + return nowtime; + } else if (comboBox->currentText() == strList.at(4)) { + QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 + QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 + QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addDays(3); + QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss"); + QByteArray str2char2 = str1.toLatin1(); // must + nowtime = str2char2.data(); + return nowtime; + } + return nowtime; + +} + +bool updatewidget::_is_openkylin() +{ + QString OPENKYLIN_DISTTRIBUTOR = "Openkylin"; + QString command = "lsb_release -i -s"; + QProcess process; + process.start(command); + process.waitForFinished(); + + QString result = process.readAllStandardOutput(); + int ret = result.left(OPENKYLIN_DISTTRIBUTOR.length()).compare(OPENKYLIN_DISTTRIBUTOR.left(OPENKYLIN_DISTTRIBUTOR.length())); + return (0 == ret)?true:false; +} + +/** + * @brief updatewidget::agreeBtnClicked + * 同意更新按钮槽函数 + */ +void updatewidget::agreeBtnClicked() +{ + emit agreeBtnSignals(); + bool _is_2107 = true; + QFile file("/etc/os-release"); + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QString line; + QTextStream in(&file); + line = in.readLine(); + while(!line.isNull()) { + line = in.readLine(); + if(line.contains("KYLIN_RELEASE_ID")) { + _is_2107 = false; + } + } + } + file.close(); + QProcess p(0); + + p.startDetached("ukui-control-center -m upgrade"); + qDebug()<<"exec -m upgrade"; + + p.waitForStarted(); + qDebug()<<"Open the control panel and start updating immediately, exit tray program!"; + exit(0); +} + +/** + * @brief updatewidget::comboBoxClicked + * 推迟框槽函数 + */ +void updatewidget::comboBoxClicked(int num) +{ + //判断是否有kylin-background-upgrade目录,没有则创建 + QString toDir = QDir::homePath(); + toDir += "/.config/kylin-background-upgrade/"; + QDir dir(toDir); + if(! dir.exists()) { + dir.mkdir(toDir);//只创建一级子目录,即必须保证上级目录存在 + } + + toDir += "kylin-background-upgrade-conf.ini"; + QFileInfo fileInfo(toDir); + if (!fileInfo.exists()) { + qDebug()<<"The periodic configuration file fails to be opened, exit!"; + exit(0); + } else { + char *nowtime=insideTime(); + qDebug() << "current timing: "<beginGroup(QString::fromLocal8Bit("Timer")); + timersettings->setValue("CheckUpgradeTime",nowtime); + timersettings->sync(); + timersettings->endGroup(); + } + emit disAgreeBtnSignals(); + qDebug()<<"Users do not update, exit tray program!"; + exit(0); +} + +/** + * @brief updatewidget::delayBtnClicked + * 延迟提醒,退出 + */ +void updatewidget::delayBtnClicked() +{ + qDebug() << "User deferred updates, exit!"; + exit(0); +} + +/** + * @brief updatewidget::paintEvent + * 样式绘画画家 + * @param e + */ +void updatewidget::paintEvent(QPaintEvent *e) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + /* 获取当前剪贴板中字体的颜色,作为背景色; + * 白字体 --> 黑背景 + * 黑字体 --> 白字体 + */ + p.setBrush(opt.palette.color(QPalette::Base)); + p.setOpacity(1); + p.setPen(QPen(QColor(220,220,220))); + QPainterPath path; + opt.rect.adjust(0,0,0,0); + path.addRoundedRect(opt.rect,12,12); + p.setRenderHint(QPainter::Antialiasing); //反锯齿 + p.drawRoundedRect(opt.rect,12,12); + setProperty("blurRegion",QRegion(path.toFillPolygon().toPolygon())); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + QFontMetrics fontMetrics(this->font()); + QString current_str = comboBox->currentText(); + int fontSize = fontMetrics.width(current_str); + int showTextSize = comboBox->width() - 32; + if (fontSize > showTextSize) { + QString elidedText = fontMetrics.elidedText(comboBox->currentText(), Qt::ElideRight, showTextSize); + comboBox->setItemText(comboBox->currentIndex(), elidedText); + comboBox->setToolTip(current_str); + } + QWidget::paintEvent(e); +} + +/** + * @brief updateTip::updateTip + * 提示框 + * @param parent + */ +updateTip::updateTip(QWidget *parent) : + QWidget(parent) +{ + //设置任务栏无显示 + setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); + setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint | Qt::Popup); + + m_layout = new QVBoxLayout(); + tipLabel = new QLabel(); + tipLabel->setText(tr("The system is updating silently")); + m_layout->addWidget(tipLabel); + this->setLayout(m_layout); + this->setProperty("useSystemStyleBlur", true); + this->setAttribute(Qt::WA_TranslucentBackground, true); + this->setWindowOpacity(0.9); +} + +updateTip::~updateTip() +{ + +} + +/** + * @brief updateTip::paintEvent + * 样式绘画画家 + * @param e + */ +void updateTip::paintEvent(QPaintEvent *e) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + /* 获取当前剪贴板中字体的颜色,作为背景色; + * 白字体 --> 黑背景 + * 黑字体 --> 白字体 + */ + p.setBrush(opt.palette.color(QPalette::Base)); + p.setOpacity(1); + p.setPen(QPen(QColor(220,220,220))); + QPainterPath path; + opt.rect.adjust(0,0,0,0); + path.addRoundedRect(opt.rect,4,4); + p.setRenderHint(QPainter::Antialiasing); //反锯齿 + p.drawRoundedRect(opt.rect,4,4); + setProperty("blurRegion",QRegion(path.toFillPolygon().toPolygon())); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + QWidget::paintEvent(e); +} + + diff --git a/kylin-update-notify/src/updatewidget.h b/kylin-update-notify/src/updatewidget.h new file mode 100644 index 0000000..15f0c30 --- /dev/null +++ b/kylin-update-notify/src/updatewidget.h @@ -0,0 +1,131 @@ +#ifndef TRAYWIDGET_H +#define TRAYWIDGET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Button/fixbutton.h" + +namespace Ui { +class Form; +} + +class updatewidget : public QWidget +{ + Q_OBJECT + +public: + explicit updatewidget(bool check_Tips, QWidget *parent = nullptr); + ~updatewidget(); + + enum PanelStatePosition + { + PanelDown = 0, + PanelUp, + PanelLeft, + PanelRight + }; + + bool _check_Tips; + QLabel *update_lab; + QLabel *icon_lab; + QLabel *tip_lab; + QLabel *close_lab; + + FixButton *agreebtn; + FixButton *delaybtn; + QPushButton *window_close; + QWidget *labelwidget; + QWidget *statwidget; + QWidget *selectWidget; + QStringList strList; + QPixmap *icon; + + QVBoxLayout *m_pfirstlayout = nullptr; + QHBoxLayout *m_labellayout = nullptr; + QHBoxLayout *m_psecondlayout = nullptr; + QHBoxLayout *m_pselectlayout = nullptr; + + QDBusInterface* m_pServiceInterface; // 获取任务栏的高度 + QGSettings *m_pPanelSetting = nullptr; + QComboBox *comboBox; + + int m_nScreenWidth; // 屏幕分辨率的宽 + int m_nScreenHeight; // 屏幕分辨率的高 + int m_pPeonySite; // 任务栏位置 + QSettings *timersettings; //读取timer配置文件 + QRect updateWidgetRect; + bool bIsWayland = false; + + int connectTaskBarDbus(); + int getPanelSite(); + void GetsAvailableAreaScreen(); + char *insideTime(); + int getTaskbarPos(QString str); + int getTaskbarHeight(QString str); + int getScreenGeometry(QString methodName); + void set_window_position(); + void initset_window_position(); + void listenPanelChange(); + void initPanelDbusGsetting(); // 初始化与任务栏gsetting和dbus + bool eventFilter(QObject *, QEvent *); // 添加事件过滤器声明 + bool _is_openkylin(); + void updateWidgetShow(); + +private: + Ui::Form *ui; + void paintEvent(QPaintEvent *e); + +signals: + void agreeBtnSignals(); + void disAgreeBtnSignals(); + +protected slots: + void agreeBtnClicked(); + void comboBoxClicked(int); + void delayBtnClicked(); + void onClick_close_btn(); +}; + + + + + +class updateTip : public QWidget +{ + Q_OBJECT +public: + explicit updateTip(QWidget *parent = nullptr); + ~updateTip(); + QLabel *tipLabel; + QVBoxLayout *m_layout = nullptr; + + +private: + void paintEvent(QPaintEvent *e); + + +signals: + +protected slots: +}; + +#endif // TRAYWIDGET_H diff --git a/kylin-update-notify/src/updatewidget.ui b/kylin-update-notify/src/updatewidget.ui new file mode 100644 index 0000000..d527737 --- /dev/null +++ b/kylin-update-notify/src/updatewidget.ui @@ -0,0 +1,21 @@ + + + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/kylin-update-notify/translations/UapLBi.json b/kylin-update-notify/translations/UapLBi.json new file mode 100644 index 0000000..c82f587 --- /dev/null +++ b/kylin-update-notify/translations/UapLBi.json @@ -0,0 +1 @@ +[{"excluded":[],"includePaths":["/usr/include/x86_64-linux-gnu/qt5/QGSettings","/usr/include/KF5/KWindowSystem","/usr/include/x86_64-linux-gnu/qt5","/usr/include/x86_64-linux-gnu/qt5/QtWidgets","/usr/include/x86_64-linux-gnu/qt5/QtGui","/usr/include/x86_64-linux-gnu/qt5/QtDBus","/usr/include/x86_64-linux-gnu/qt5/QtNetwork","/usr/include/x86_64-linux-gnu/qt5/QtSql","/usr/include/x86_64-linux-gnu/qt5/QtCore","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade"],"projectFile":"/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/kylin-background-upgrade.pro","sources":["/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/core.cpp","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/core.h","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/main.cpp","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/traydbus.cpp","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/traydbus.h","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/trayicon.cpp","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/trayicon.h","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/updatehandle.cpp","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/updatehandle.h","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/updatewidget.cpp","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/updatewidget.h","/home/li/ukui/kylin-background-upgrade/kylin-background-upgrade/updatewidget.ui"]}] diff --git a/kylin-update-notify/translations/kylin-background-upgrade_bo_CN.qm b/kylin-update-notify/translations/kylin-background-upgrade_bo_CN.qm new file mode 100644 index 0000000000000000000000000000000000000000..535b5f598f2ccb2f465ddce9b5d0c408cc5ef980 GIT binary patch literal 2003 zcmd5-&1(}u6rUvKLy|HgC_Pv@)gmQWX($yBA~eQId#nAR2$sz5PLidY-LN}Rw-mhU zMWoP^qKFFBTic5l5qj{T_D>Kzc@V^Z!S`l2$!gc&O;f_W%)HOv`@PpoZ;ZhYKOS!# zjGTH`efIWqnGkZ1%w5E&frX&pz!R2O2*d`r4NEA$+X_ZK1lJ8AMW{9U z3gE??m>6^wUQkO1$nhPucA*i=Ak7EhgIo)nG^29V;cdFxBu!~m=@QuC%Zk!Ln}?u- zHB}=m?X~h|q?HZsG2LmlEFp!#xXsLF%W);QWzb@Aj?GGJxGO-dDQpAOWP?lQJ8ii1 zBzNH*UJR2Z@vhOQkuDtKgF>-0GCdpz*L=&g$2G36)m^7; z8{_R(-Q|XehhQuW`1^ErCb33ez>GrMy7bHRjI`neo~sosIAJALici?fY)5Q0pSiAep&CMQ_awA)hj zbv*hj2xO{nrUO%|_`V)b!uV_gq&OfrP-T!7BP>o|u^cZt6Ooo2KNP)3*>pu%T>W1O Z$s4g_u<#J&np%M|% + + + + Form + + + Form + + + + + trayicon + + + The system is updating silently + རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། + + + + updateTip + + + The system is updating silently + རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། + + + + updatehandle + + + + System update + རྒྱུད་ཁོངས་གསར་སྒྱུར་ + + + + + + The system is updating silently + རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། + + + + The system has completed an important update, It is recommended that you restart immediately. + མ་ལག་གི་འགག་རྩའི་གསར་སྒྱུར་ཞིག་ལེགས་གྲུབ་དང་།བསམ་འཆར་ལ་ཁྱེད་རང་འཕྲལ་མར་བསྐྱར་འབྱེད་། + + + + update error + རིམ་འཕར་འགྲུབ་མེད། + + + + kylin-background-upgrade + རྒྱབ་སྟེགས་གསར་སྒྱུར་བྱ་རིམ། + + + + update + རྒྱུད་ཁོངས་རིམ་སྤོར་ + + + + updatewidget + + + Updatable app detected on your system! + རྒྱུད་ཁོངས་གསར་སྒྱུར་རྣམ་གྲངས་ + + + + Close + སྒོ་རྒྱག་པ་ + + + + 30 minutes later + ཕྱིར་འགྱངས་སྐར་མ་30། + + + + 1 hour later + ཆུ་ཚོད་གཅིག་ནར་འགྱངས་། + + + + 5 hours later + ཆུ་ཚོད་5ནར་འགྱངས་། + + + + 1 day later + ཉིན་གཅིག་ནར་འགྱངས་། + + + + 3 days later + ཉིན་གསུམ་ནར་འགྱངས་། + + + + Update + ལམ་སང་གསར་སྒྱུར་ + + + + Delay + ནར་འགྱངས། + + + diff --git a/kylin-update-notify/translations/kylin-background-upgrade_zh_CN.qm b/kylin-update-notify/translations/kylin-background-upgrade_zh_CN.qm new file mode 100644 index 0000000000000000000000000000000000000000..1025f13b5cf7d4eb987ac30a13f2dc1b3134be4d GIT binary patch literal 1305 zcmbtTO=uHA6rTKTwq#p#QF`!a>JQXlYeR@9@lXrZB0^0>f*Ly69g{Vi-F0_j*i!0M zQ7MAK3Zi%rg9j0M=|#jIJXniYFH%q5{5cd4deAq!>2`x5m+rF6@b>%O_r3RKjxQ^N z?|(dMt_|&eGxPNI=W&G4O*D0^iBMz%O|9HQD7qKDNUtCi&W6~23*wE?(v6)6h2Dly z$^krTuV=h9bS=E+YYA}6v3IR!z&|BS8~}dgL|mB*!y1XZ@vtBcPZojxQA{mOLzb%v z@?{*>Rp~<{2Jwd~kQ))$CFlOkuUF*@!w(9NKV8|NuS5tU0lt0t3dOc#Gg`x{jq9dD zn5vhtt!h+fniB_%$SmThvZ05zpR3PRpn27FlZo6|hoSzQXU4;EdCA*Wh^}bVWgXX&#qP-2DHST<^=Mj2Hw(Xm=H4T}+- zd8N}M_%!2~P-9Zl6oN<^-fEu*e0BXzTE5ruX)GAoS|8$f1Sw-9tXS?F&=OGOX?z zyAbwXKB96Tx4h_F|L&(qVR+8-Q$|V}#l$qR0<)0$I1HV4*=irhp@2X`RmzmPvzO%7 z!a7K#5iT6|(Y;i5gLo06FhNh!l6?Ow!WTQh^k z5I!f|f8whqGh?`>>UBnYCfGEcMYzLsf7UhKlN*JL@y!>Eozx6FcrF61iE^7;$O) + + + + Form + + + Form + + + + + QObject + + The system is updating silently + 系统正在静默更新 + + + + trayicon + + + The system is updating silently + 系统正在静默更新 + + + + updateTip + + + The system is updating silently + 系统正在静默更新 + + + + updatehandle + + The system has completed an important update. It is recommended that you restart immediately. + 系统已经完成一项关键更新,建议您立即重启 + + + + + + The system is updating silently + 系统正在静默更新 + + + System update detected + 检测到有系统更新 + + + System update detected + 检测到有系统更新 + + + The system has completed a critical update, and some software packages failed to update. It is recommended that you restart immediately + 系统完成一项关键更新,部分软件包更新失败,建议您立即重启 + + + + + System update + 系统更新 + + + + The system has completed an important update, It is recommended that you restart immediately. + 系统完成一项关键更新,建议您立即重启 + + + + update error + 升级失败 + + + + kylin-background-upgrade + 后台更新程序 + + + + update + 系统升级 + + + + updatewidget + + Please remind me later + 请在以下时间段之后提醒我 + + + at + + + + No more reminders + 内不再提醒 + + + No reminders + 内不再提醒 + + + + Updatable app detected on your system! + 系统有更新项目 + + + + Close + 关闭 + + + + 30 minutes later + 推迟 30 分钟 + + + + 1 hour later + 推迟 1 小时 + + + + 3 days later + 推迟 3 天 + + + + Delay + 推迟 + + + + 5 hours later + 推迟 5 小时 + + + + 1 day later + 推迟 1 天 + + + + Update + 立即更新 + + + diff --git a/kylin-update-notify/widgets/Button/button.pri b/kylin-update-notify/widgets/Button/button.pri new file mode 100644 index 0000000..ded778b --- /dev/null +++ b/kylin-update-notify/widgets/Button/button.pri @@ -0,0 +1,6 @@ +SOURCES += \ + $$PWD/fixbutton.cpp \ + +HEADERS += \ + $$PWD/fixbutton.h \ + diff --git a/kylin-update-notify/widgets/Button/fixbutton.cpp b/kylin-update-notify/widgets/Button/fixbutton.cpp new file mode 100644 index 0000000..fed4aad --- /dev/null +++ b/kylin-update-notify/widgets/Button/fixbutton.cpp @@ -0,0 +1,36 @@ +#include "fixbutton.h" +#include +#include + +FixButton::FixButton(QWidget *parent): + QPushButton(parent) +{ + +} + +FixButton::~FixButton() +{ + +} + +void FixButton::paintEvent(QPaintEvent *event) +{ + QFontMetrics fontMetrics(this->font()); + int fontSize = fontMetrics.width(mStr); + int showTextSize = this->width() - 32; + if (fontSize > showTextSize) { + this->setText(fontMetrics.elidedText(mStr, Qt::ElideRight, showTextSize), false); + this->setToolTip(mStr); + } else { + this->setText(mStr, false); + this->setToolTip(""); + } + QPushButton::paintEvent(event); +} + +void FixButton::setText(const QString & text, bool saveTextFlag) +{ + if (saveTextFlag) + mStr = text; + QPushButton::setText(text); +} diff --git a/kylin-update-notify/widgets/Button/fixbutton.h b/kylin-update-notify/widgets/Button/fixbutton.h new file mode 100644 index 0000000..2f30dbe --- /dev/null +++ b/kylin-update-notify/widgets/Button/fixbutton.h @@ -0,0 +1,21 @@ +#ifndef _FIXBUTTON_H_ +#define _FIXBUTTON_H_ +#include + +class FixButton : public QPushButton +{ + Q_OBJECT +public: + FixButton(QWidget *parent = nullptr); + ~FixButton(); + void setText(const QString &text, bool saveTextFlag = true); +private: + void paintEvent(QPaintEvent *event); + +private: + QString mStr; +}; + + + +#endif diff --git a/kylin-update-notify/widgets/widgets.pri b/kylin-update-notify/widgets/widgets.pri new file mode 100644 index 0000000..da4ea4f --- /dev/null +++ b/kylin-update-notify/widgets/widgets.pri @@ -0,0 +1,4 @@ +INCLUDEPATH += $$PWD + +include(Button/button.pri) +#include(ComboBox/comboBox.pri) diff --git a/translations/kylin-background-upgrade_bo_CN.qm b/translations/kylin-background-upgrade_bo_CN.qm deleted file mode 100644 index ced5ae65599d9983068fb2f55cf94d8ea9c26eeb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2535 zcmd5-&ubJ(6s}3kBq13q1P#GoTgrM_R#}yZ2M=b5fhY*sOhO2YYo)tprg5fwsIE~) z0v;4ZghgCMQBgcB$if~>5cVR12M>Zb4_;)w=+%S&fZwa`OgBjcNvYMaI}I#_|^#>%Ps7J-dwSyX^0M&tQ+|md)F<^{puj>Kb`MxFT#G@kbigq{;#{9Kl}^0zvmynnt~PG z_MG3)x9cMCI`8#8eh>fd|N8F?ykac3y|Cj-FYIDrSMuyihb7t~8!s5usO8zNxjk@lKD?vgJ8}pZgxz^jeOp(jXqC&_?>^f0g)KFTmABKNJ_8MzGB9w?{K;xM+lyM>}ci;nS^}=kJ+E zb5?ZF^xZwpMny|kWo{Hq-l&~(T1&JAXo9HvQRmI4rX?S3qimQT;kf*Pn6@D4Wio5W zH{lrPEtJ-Q&ITOfG`G49^~ipk5{RxbRg?BB5`&%f+=?=Gb#DRxtJae?N*Vc)Jqnxn z7bbjh;1^N%{H9T1ibD!#5W8j3ZXm*=Nl5(rPXricxVuWP;l8OYXr`Rg^hr!tB^7xW z*e}_-P*tX|&u9;h$NRU0bHb!Unr!+Tv9O~h>hS9+hmB?Lj1sPFi5du`^krPCauPqN+2ZST+{Ogz;Gp SgDDPCV - - - - updatewidget - - at - རླུང་གནོན་ཆེན་པོ། - - - Delay - ཕྱིར་འགྱངས། - - - five hours later - རྗེས་སུ་དུས་ཚོད%d - - - one hours later - ཆུ་ཚོད་གཅིག - - - three day later - ཉིན་གསུམ། - - - In 30 minutes - སྐར་མ་སུམ་ཅུ། - - - Update - གསར་སྒྱུར། - - - No reminders - དྲན་སྐུལ། - - - five day later - ཉིན་ལྔ། - - - one day later - ཉིན་གཅིག - - - - updatehandle - - update error - རིམ་འཕར་འགྲུབ་མེད། - - - kylin-background-upgrade - རྒྱབ་སྟེགས་རིམ་འགྱུར་བྱ་རིམ། - - - The system is updating silently - རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། - - - update - ཁུངས་གསར་བསྒྱུར། - - - The system has completed an important update. It is recommended that you restart immediately - རྒྱུད་ཁོངས་ཀྱིས་གནད་འགག་གི་རིམ་འགྱུར་ཞིག་ལེགས་འགྲུབ་བྱུང་བས། བསམ་ཚུལ་ཡིན་ན་ཁྱེད་ཀྱིས་མྱུར་དུ་འཁོར་སྒོ་སླར་ཕྱེ་བྱོས། - - - System update detected - རྒྱུད་ཁོངས་རིམ་འགྱུར་ཞིག་ཞིབ་དཔྱད་ཚད་ལེན་བྱས་པ། - - - The system has completed a critical update, and some software packages failed to update. It is recommended that you restart immediately - རྒྱུད་ཁོངས་ཀྱིས་གནད་འགག་གི་རིམ་འགྱུར་ཞིག་ལེགས་འགྲུབ་བྱུང་བས། མཉེན་ཆས་ཁག་གཅིག་རིམ་འགྱུར་ལེགས་འགྲུབ་མ་བྱུང་་། བསམ་འཆར་ཡིན་ན་ཁྱེད་ཀྱིས་མྱུར་དུ་འཁོར་སྒོ་སླར་ཕྱེ་བྱོས། - - - - trayicon - - The system is updating silently - རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། - - - - updateTip - - The system is updating silently - རྒྱུད་ཁོངས་ཁ་རོག་གེར་རིམ་འགྱུར་བྱེད་སྒང་། - - - diff --git a/translations/kylin-background-upgrade_zh_CN.qm b/translations/kylin-background-upgrade_zh_CN.qm deleted file mode 100644 index 99232f2a03815338f03a5b4fa911733d4b2e17af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1306 zcmbtSO=uHA6rOC-?ZzfeD5wP$M^K2x)>hF|FBP#=Wg$(Z1T}QJGs!O5>@K?#Wvf*1 z=O9}8LyA^K@lXsNM3jOTsr2AMDM;x-5NR)Z)q{A@gU)8dvemQ{dKez>&G+-(o9TXq zTi<E7YPrK$>JP~+#Wh(%IMGmyt3O9gxgAF*8E=}~HQoY1C=~p1?*)t9A--~rp=TQ2R%Y0J3qQM*V)>`WYR+vJ61`a_ zx6(BG)#2wN_v1?}pN<|`ImGfsg^3tJR*7H!J+fSo1`>BN4?pI9kmmv`0-l}SX_-LF zwkRn=#eyXRBdTb5XelbusA@Mdj6h9fE0V4SHm?<~I*_ztxMK2~;;H`5eAsDlRb$&y zZc{EEVnT^T33mF4xHTDRSS3}Ny$=2C?V-2`?%GLfs>6}`6UqL%^=z;*{61w(ETj*5 zGoSa(EF%j_deKmsK88qxO3~0wiZtr(f*gQ-)Y*(l7_3M%%wSYT6xw=;6)lQPcF%6G zf+$h#j`|&L?gjpzIFfEoeRrlDZpw~%leHFXRngjqkW|QLUtbIMvh7 zmmhiPXrBfTcfz8gl_;@%`aaf{B3SwDoI~OBAJzBgd!wGCK-f2?8-YXeSUpHqy=CRx|(FVj|OAOHXW