fix 135671 【wayland】【更新升级】设置推迟时间不生效,到推迟的时间后没有再次出现自动更新弹窗

This commit is contained in:
luoxueyi 2023-04-18 09:45:37 +08:00
parent 0bf343f852
commit e070b09a94
2 changed files with 14 additions and 3 deletions

View File

@ -319,7 +319,9 @@ char *updatewidget::insideTime()
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 bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(1800);
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
@ -327,7 +329,7 @@ char *updatewidget::insideTime()
nowtime = str2char2.data();
delaytime = 1800;
delayTimer->start(delaytime * 1000);
qDebug()<<"Delay trigger for: "<<delaytime;
delayTimer_Checker->start(60 * 1000);
} else if (comboBox->currentText() == strList.at(1)) {
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(3600 * 3);
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
@ -335,8 +337,9 @@ char *updatewidget::insideTime()
nowtime = str2char2.data();
delaytime = 3600 * 3;
delayTimer->start(delaytime * 1000);
qDebug()<<"Delay trigger for: "<<delaytime;
delayTimer_Checker->start(60 * 1000);
}
qDebug()<<"delay trigger for: "<<delaytime;
return nowtime;
}
@ -346,13 +349,19 @@ char *updatewidget::insideTime()
*/
void updatewidget::delayTimeout()
{
qDebug() << "delayTimeout, Retest the update.";
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";
}
/**
* @brief updatewidget::agreeBtnClicked
*

View File

@ -47,6 +47,7 @@ public:
QLabel *tip_lab;
QLabel *tip_lab1;
QTimer *delayTimer;
QTimer *delayTimer_Checker;
unsigned int delaytime;
QPushButton *agreebtn;
@ -83,6 +84,7 @@ public:
void initPanelDbusGsetting(); // 初始化与任务栏gsetting和dbus
public slots:
void delayTimeout();
void delayTimeOutChecker();
private:
Ui::Form *ui;
void paintEvent(QPaintEvent *e);