选择推迟后将复选框默认选项指向index 0
This commit is contained in:
parent
511a2df650
commit
eccc79a463
|
@ -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
|
||||
|
|
|
@ -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 |