选择推迟后将复选框默认选项指向index 0

This commit is contained in:
luoxueyi 2023-04-20 16:16:13 +08:00 committed by cckylin-cibot
parent 511a2df650
commit eccc79a463
3 changed files with 416 additions and 0 deletions

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
kylin-update-notify (1.3.2.1-ok4) yangtze; urgency=medium
*BUG号135671 【wayland】【更新升级】设置推迟时间不生效到推迟的时间后没有再次出现自动更新弹窗
*需求号:无
*其他改动说明:无
*影响域: 无
-- luoxueyi <luoxueyi@kylinos.cn> Tue, 18 Apr 2023 09:46:45 +0800
kylin-update-notify (1.3.2.1-ok3) yangtze; urgency=medium
* patch from zhangdongwei

406
debian/patches/0002-index-0.patch vendored Normal file
View File

@ -0,0 +1,406 @@
From: luoxueyi <luoxueyi@kylinos.cn>
Date: Thu, 20 Apr 2023 16:16:13 +0800
Subject: =?utf-8?b?6YCJ5oup5o6o6L+f5ZCO5bCG5aSN6YCJ5qGG6buY6K6k6YCJ6aG55oyH?=
=?utf-8?b?5ZCRaW5kZXggMA==?=
---
kylin-background-upgrade.pro.user | 11 ++--
src/main.cpp | 2 +-
src/updatehandle.cpp | 7 ++-
src/updatewidget.cpp | 82 +++++++++++--------------
src/updatewidget.h | 8 ++-
translations/kylin-background-upgrade_zh_CN.qm | Bin 1306 -> 1124 bytes
translations/kylin-background-upgrade_zh_CN.ts | 64 ++++---------------
7 files changed, 65 insertions(+), 109 deletions(-)
diff --git a/kylin-background-upgrade.pro.user b/kylin-background-upgrade.pro.user
index ffee34f..f026e3e 100644
--- a/kylin-background-upgrade.pro.user
+++ b/kylin-background-upgrade.pro.user
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.11.0, 2022-07-21T18:26:42. -->
+<!-- Written by QtCreator 4.11.0, 2022-08-23T14:03:45. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -282,10 +282,9 @@
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">kylin-background-upgrade2</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/kylin-background-upgrade/OpenKylin/make_deb/kylin-background-upgrade/kylin-background-upgrade.pro</value>
- <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/lxy/kylin-background-upgrade/OpenKylin/make_deb/kylin-background-upgrade/kylin-background-upgrade.pro</value>
- <value type="QString" key="RunConfiguration.Arguments"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro</value>
+ <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro</value>
+ <value type="QString" key="RunConfiguration.Arguments">--check-upgrade</value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
@@ -295,7 +294,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
- <value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
+ <value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
diff --git a/src/main.cpp b/src/main.cpp
index f7179b2..4ec6e8d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -149,6 +149,6 @@ int main(int argc, char *argv[])
qunsetenv("SESSION_MANAGER");
QApplication a(argc, argv);
core *m_core= new core(arg);
- QObject::connect(m_core,SIGNAL(execSignal()),&a,SLOT(quit()));
+// QObject::connect(m_core,SIGNAL(execSignal()),&a,SLOT(quit()));
return a.exec();
}
diff --git a/src/updatehandle.cpp b/src/updatehandle.cpp
index 8529333..e3a8eee 100644
--- a/src/updatehandle.cpp
+++ b/src/updatehandle.cpp
@@ -353,7 +353,7 @@ void updatehandle::UpdateDectCheck()
{
//判æ­æ˜¯å<C2AF>¦æœ‰ç³»ç»Ÿæ´æ°
// if(!checktime()){
- qDebug()<<"Detection update has been opened ...";
+ qDebug()<<"wait for upgrade ...";
// 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();
@@ -487,7 +487,10 @@ void updatehandle::InstallFinsih(bool state,QStringList pkgname,QString error,QS
*/
void updatehandle::execslots()
{
- emit execSignal();
+ choice_window->comboBox->setCurrentIndex(0);
+ choice_window->hide();
+ qDebug()<<"Hide choice_window.";
+// emit execSignal();
}
/**
diff --git a/src/updatewidget.cpp b/src/updatewidget.cpp
index 233e971..ebd7c81 100644
--- a/src/updatewidget.cpp
+++ b/src/updatewidget.cpp
@@ -50,7 +50,7 @@ updatewidget::updatewidget(QWidget *parent) :
comboBox = new QComboBox();
comboBox->clear();
- strList<<tr("In 30 minutes")<<tr("one hours later")<<tr("five hours later")<<tr("one day later")<<tr("three day later")<<tr("five day later");
+ strList<<tr("In 30 minutes")<<tr("three hours later")<<tr("one day later");
comboBox->addItems(strList);
labelwidget = new QWidget();
@@ -313,63 +313,53 @@ void updatewidget::set_window_position()
*/
char *updatewidget::insideTime()
{
- qDebug()<<comboBox->currentText();
+ qDebug()<<"Current index: "<<comboBox->currentText();
QDateTime time = QDateTime::currentDateTime(); //获å<C2B7>系统现在的时间
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格å¼<C3A5>
QByteArray str2char2 = str.toLatin1(); // must
char *nowtime = str2char2.data();
-
+ delayTimer = new QTimer();
+ delayTimer_Checker = new QTimer();
+ connect(delayTimer, SIGNAL(timeout()), this, SLOT(delayTimeout()));
+ connect(delayTimer_Checker, SIGNAL(timeout()), this, SLOT(delayTimeOutChecker()));
if(comboBox->currentText() == strList.at(0)) {
- QDateTime time = QDateTime::currentDateTime(); //获å<C2B7>系统现在的时间
- QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格å¼<C3A5>
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;
+ delaytime = 1800;
+ delayTimer->start(delaytime * 1000);
+ delayTimer_Checker->start(60 * 1000);
} else if (comboBox->currentText() == strList.at(1)) {
- QDateTime time = QDateTime::currentDateTime(); //获å<C2B7>系统现在的时间
- QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格å¼<C3A5>
- 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(); //获å<C2B7>系统现在的时间
- QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格å¼<C3A5>
- 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(); //获å<C2B7>系统现在的时间
- QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格å¼<C3A5>
- 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(); //获å<C2B7>系统现在的时间
- QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格å¼<C3A5>
- 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;
- } else if (comboBox->currentText() == strList.at(5)) {
- QDateTime time = QDateTime::currentDateTime(); //获å<C2B7>系统现在的时间
- QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格å¼<C3A5>
- QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addDays(5);
+ QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(3600 * 3);
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
QByteArray str2char2 = str1.toLatin1(); // must
nowtime = str2char2.data();
- return nowtime;
+ delaytime = 3600 * 3;
+ delayTimer->start(delaytime * 1000);
+ delayTimer_Checker->start(60 * 1000);
}
+ qDebug()<<"delay trigger for: "<<delaytime;
return nowtime;
+}
+
+/**
+ * @brief updatehandle::delayTimeout
+ * 延时超时函数
+ */
+void updatewidget::delayTimeout()
+{
+ qDebug() << "delayTimeout, Redetect the update ...";
+ delayTimer->stop();
+ delayTimer_Checker->stop();
+ QProcess p(0);
+ p.startDetached("/usr/share/kylin-update-notify/checkUpdate.py");
+ p.waitForStarted();
+}
+void updatewidget::delayTimeOutChecker()
+{
+ qDebug()<< qSetFieldWidth(0) << "delayTimeoutChecker remainingTime: "<<delayTimer->remainingTime()/1000<<"s";
}
/**
@@ -379,12 +369,11 @@ char *updatewidget::insideTime()
void updatewidget::agreeBtnClicked()
{
emit agreeBtnSignals();
- qDebug()<<"WifiButtonClickSlot is running";
+// qDebug()<<"WifiButtonClickSlot is running";
QProcess p(0);
p.startDetached("update-manager");
p.waitForStarted();
qDebug()<<"Open the control panel and start updating immediately, exit tray program!";
-// exit(0);
this->hide();
}
@@ -417,8 +406,8 @@ void updatewidget::disAgreeBtnClicked()
timersettings->endGroup();
}
emit disAgreeBtnSignals();
- qDebug()<<"Users do not update, exit tray program!";
- exit(0);
+ qDebug()<<"Delay updating the system.";
+// exit(0);
}
/**
@@ -500,4 +489,3 @@ void updateTip::paintEvent(QPaintEvent *e)
QWidget::paintEvent(e);
}
-
diff --git a/src/updatewidget.h b/src/updatewidget.h
index c27b470..77f3983 100644
--- a/src/updatewidget.h
+++ b/src/updatewidget.h
@@ -19,6 +19,7 @@
#include <QScreen>
#include <QDBusReply>
#include <QSettings>
+#include <QTimer>
#include <sys/stat.h>
#include <unistd.h>
@@ -45,6 +46,9 @@ public:
QLabel *update_lab;
QLabel *tip_lab;
QLabel *tip_lab1;
+ QTimer *delayTimer;
+ QTimer *delayTimer_Checker;
+ unsigned int delaytime;
QPushButton *agreebtn;
QPushButton *disagreebtn;
@@ -78,7 +82,9 @@ public:
void initset_window_position();
void listenPanelChange();
void initPanelDbusGsetting(); // åˆ<C3A5>å§åŒä¸Žä»»åŠ¡æ <C3A6>gsettingåŒdbus
-
+public slots:
+ void delayTimeout();
+ void delayTimeOutChecker();
private:
Ui::Form *ui;
void paintEvent(QPaintEvent *e);
diff --git a/translations/kylin-background-upgrade_zh_CN.qm b/translations/kylin-background-upgrade_zh_CN.qm
index 99232f2..c9d0fd6 100644
--- a/translations/kylin-background-upgrade_zh_CN.qm
+++ b/translations/kylin-background-upgrade_zh_CN.qm
@@ -1,2 +1,2 @@
-<¸dÊÍ!¿`¡½ÝB<00>AJ‰{ª1ÂF³Ò*y*yL*y6<1D>åš²<¨ƒ¥ƨ¥µÔSÛƨ¥(G^à µæ’f Ô5à2Òip|û~ßkcW(—YžØfôe°The system is updating silentlytrayicon|û~ßkcW(—YžØfôe°The system is updating silently updateTiphÀmKR0g |û~ßfôe°System update detected updatehandle$|û~ß[ŒbN˜yQs•.fôe°ÿ ^ú‹®`¨zËSsÍT/]The system has completed an important update, It is recommended that you restart immediately. updatehandle|û~ßkcW(—YžØfôe°The system is updating silently updatehandle TSðfôe°z ^<5E>kylin-background-upgrade updatehandle|û~ßSG~§update updatehandleSG~§Y1<59>% update error updatehandle<63>ßDelay updatewidgetN SAR”Ÿ In 30 minutes updatewidget
-Q…N Q<EFBFBD> No reminders updatewidgetzËSsfôe°Update updatewidgetW(at updatewidgetN”Y)five day later updatewidgetN”N*\five hours later updatewidgetNY) one day later updatewidgetNN*\one hours later updatewidgetN Y)three day later updatewidget
\ No newline at end of file
+<¸dÊÍ!¿`¡½ÝBxAJ‰{ª1ÂF³Ò*y*yL*y☨ƒ¥ƨ¥µÔSÛƨ¥(G^à Ô5à2fiÒ|û~ßkcW(—YžØfôe°The system is updating silentlytrayicon|û~ßkcW(—YžØfôe°The system is updating silently updateTiphÀmKR0g |û~ßfôe°System update detected updatehandle$|û~ß[ŒbN˜yQs•.fôe°ÿ ^ú‹®`¨zËSsÍT/]The system has completed an important update, It is recommended that you restart immediately. updatehandle|û~ßkcW(—YžØfôe°The system is updating silently updatehandle TSðfôe°z ^<5E>kylin-background-upgrade updatehandle|û~ßSG~§update updatehandleSG~§Y1<59>% update error updatehandle<63>ßDelay updatewidgetN SAR”Ÿ In 30 minutes updatewidget
+Q…N Q<EFBFBD> No reminders updatewidgetzËSsfôe°Update updatewidgetW(at updatewidgetNY) one day later updatewidgetN N*\three hours later updatewidget
\ No newline at end of file
diff --git a/translations/kylin-background-upgrade_zh_CN.ts b/translations/kylin-background-upgrade_zh_CN.ts
index 2e07623..baec187 100644
--- a/translations/kylin-background-upgrade_zh_CN.ts
+++ b/translations/kylin-background-upgrade_zh_CN.ts
@@ -27,7 +27,7 @@
<context>
<name>updateTip</name>
<message>
- <location filename="../src/updatewidget.cpp" line="464"/>
+ <location filename="../src/updatewidget.cpp" line="445"/>
<source>The system is updating silently</source>
<translation>系统正在é<C2A8>™é»˜æ´æ°</translation>
</message>
@@ -39,9 +39,9 @@
<translation type="vanished">系统已ç»<C3A7>完æˆ<C3A6>一项关键æ´æ°ï¼Œå»ºè®®æ¨ç«å<E280B9>³é‡<C3A9>å<EFBFBD>¯</translation>
</message>
<message>
- <location filename="../src/updatehandle.cpp" line="303"/>
- <location filename="../src/updatehandle.cpp" line="310"/>
- <location filename="../src/updatehandle.cpp" line="315"/>
+ <location filename="../src/updatehandle.cpp" line="298"/>
+ <location filename="../src/updatehandle.cpp" line="306"/>
+ <location filename="../src/updatehandle.cpp" line="312"/>
<source>The system is updating silently</source>
<translation>系统正在é<C2A8>™é»˜æ´æ°</translation>
</message>
@@ -50,8 +50,8 @@
<translation type="vanished">检测到有系统更新</translation>
</message>
<message>
- <location filename="../src/updatehandle.cpp" line="105"/>
- <location filename="../src/updatehandle.cpp" line="336"/>
+ <location filename="../src/updatehandle.cpp" line="100"/>
+ <location filename="../src/updatehandle.cpp" line="334"/>
<source>System update detected</source>
<translation>检测到有系统更新</translation>
</message>
@@ -60,42 +60,33 @@
<translation type="obsolete">系统完æˆ<C3A6>一项关键æ´æ°ï¼Œéƒ¨åˆ†è½¯ä»¶åŒ…æ´æ°å¤±è´¥ï¼Œå»ºè®®æ¨ç«å<E280B9>³é‡<C3A9>å<EFBFBD>¯</translation>
</message>
<message>
- <location filename="../src/updatehandle.cpp" line="482"/>
- <location filename="../src/updatehandle.cpp" line="483"/>
+ <location filename="../src/updatehandle.cpp" line="471"/>
<source>The system has completed an important update, It is recommended that you restart immediately.</source>
<translation>系统完æˆ<C3A6>一项关键æ´æ°ï¼Œå»ºè®®æ¨ç«å<E280B9>³é‡<C3A9>å<EFBFBD>¯</translation>
</message>
<message>
- <location filename="../src/updatehandle.cpp" line="485"/>
+ <location filename="../src/updatehandle.cpp" line="473"/>
<source>update error</source>
<translation>å<>‡çº§å¤±è´¥</translation>
</message>
<message>
- <location filename="../src/updatehandle.cpp" line="518"/>
+ <location filename="../src/updatehandle.cpp" line="508"/>
<source>kylin-background-upgrade</source>
<translation>å<>Žå<C5BD>°æ´æ°ç¨åº<C3A5></translation>
</message>
<message>
- <location filename="../src/updatehandle.cpp" line="521"/>
+ <location filename="../src/updatehandle.cpp" line="511"/>
<source>update</source>
<translation>系统å<C5B8>‡çº§</translation>
</message>
</context>
<context>
<name>updatewidget</name>
- <message>
- <source>Please remind me later</source>
- <translation type="vanished">请在以ä¸æ—¶é—´æ®µä¹å<E280B9>Žæ<C5BD><C3A6>é†æˆ</translation>
- </message>
<message>
<location filename="../src/updatewidget.cpp" line="40"/>
<source>at</source>
<translation>在</translation>
</message>
- <message>
- <source>No more reminders</source>
- <translation type="vanished">内ä¸<C3A4>å†<C3A5>æ<EFBFBD><C3A6>é†</translation>
- </message>
<message>
<location filename="../src/updatewidget.cpp" line="42"/>
<source>No reminders</source>
@@ -108,18 +99,8 @@
</message>
<message>
<location filename="../src/updatewidget.cpp" line="53"/>
- <source>one hours later</source>
- <translation>一个å°<C3A5>æ—¶</translation>
- </message>
- <message>
- <location filename="../src/updatewidget.cpp" line="53"/>
- <source>three day later</source>
- <translation>三天</translation>
- </message>
- <message>
- <location filename="../src/updatewidget.cpp" line="53"/>
- <source>five day later</source>
- <translation>五天</translation>
+ <source>three hours later</source>
+ <translation>三个å°<C3A5>æ—¶</translation>
</message>
<message>
<location filename="../src/updatewidget.cpp" line="60"/>
@@ -131,31 +112,10 @@
<source>Delay</source>
<translation>推迟</translation>
</message>
- <message>
- <source>Two hours later</source>
- <translation type="vanished">两个å°<C3A5>æ—¶</translation>
- </message>
- <message>
- <location filename="../src/updatewidget.cpp" line="53"/>
- <source>five hours later</source>
- <translation>五个å°<C3A5>æ—¶</translation>
- </message>
<message>
<location filename="../src/updatewidget.cpp" line="53"/>
<source>one day later</source>
<translation>一天</translation>
</message>
- <message>
- <source>two day later</source>
- <translation type="vanished">两天</translation>
- </message>
- <message>
- <source>Agree</source>
- <translation type="vanished">ç«å<E280B9>³æ´æ°</translation>
- </message>
- <message>
- <source>Disagree</source>
- <translation type="vanished">推迟</translation>
- </message>
</context>
</TS>

View File

@ -1 +1,2 @@
0001-patch-from-zhangdongwei.patch
0002-index-0.patch