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 @@ - + EnvironmentId @@ -282,10 +282,9 @@ 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 - + Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro + /home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro + --check-upgrade false false @@ -295,7 +294,7 @@ false true - + /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Debug 1 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..446de30 100644 --- a/src/updatehandle.cpp +++ b/src/updatehandle.cpp @@ -353,7 +353,7 @@ void updatehandle::UpdateDectCheck() { //判断是否有系统更新 // 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,6 +487,8 @@ void updatehandle::InstallFinsih(bool state,QStringList pkgname,QString error,QS */ void updatehandle::execslots() { + choice_window->hide(); + qDebug()<<"Hide choice_window."; emit execSignal(); } diff --git a/src/updatewidget.cpp b/src/updatewidget.cpp index 233e971..55216d5 100644 --- a/src/updatewidget.cpp +++ b/src/updatewidget.cpp @@ -50,7 +50,7 @@ updatewidget::updatewidget(QWidget *parent) : comboBox = new QComboBox(); comboBox->clear(); - strList<addItems(strList); labelwidget = new QWidget(); @@ -313,63 +313,44 @@ void updatewidget::set_window_position() */ char *updatewidget::insideTime() { - qDebug()<currentText(); + qDebug()<<"Current index: "<currentText(); QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间 QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式 QByteArray str2char2 = str.toLatin1(); // must char *nowtime = str2char2.data(); - + delayTimer = new QTimer(); + connect(delayTimer, SIGNAL(timeout()), this, SLOT(delayTimeout())); 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; + delaytime = 1800; + delayTimer->start(delaytime * 1000); + qDebug()<<"Delay trigger for: "<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); + 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; - } 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; - } 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; + delaytime = 3600 * 3; + delayTimer->start(delaytime * 1000); + qDebug()<<"Delay trigger for: "<stop(); + QProcess p(0); + p.startDetached("/usr/share/kylin-update-notify/checkUpdate.py"); + p.waitForStarted(); } /** @@ -379,12 +360,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 +397,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 +480,3 @@ void updateTip::paintEvent(QPaintEvent *e) QWidget::paintEvent(e); } - diff --git a/src/updatewidget.h b/src/updatewidget.h index c27b470..21b2e35 100644 --- a/src/updatewidget.h +++ b/src/updatewidget.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,8 @@ public: QLabel *update_lab; QLabel *tip_lab; QLabel *tip_lab1; + QTimer *delayTimer; + unsigned int delaytime; QPushButton *agreebtn; QPushButton *disagreebtn; @@ -78,7 +81,8 @@ public: void initset_window_position(); void listenPanelChange(); void initPanelDbusGsetting(); // 初始化与任务栏gsetting和dbus - +public slots: + void delayTimeout(); 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 Binary files a/translations/kylin-background-upgrade_zh_CN.qm and b/translations/kylin-background-upgrade_zh_CN.qm differ 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 @@ updateTip - + The system is updating silently 系统正在静默更新 @@ -39,9 +39,9 @@ 系统已经完成一项关键更新,建议您立即重启 - - - + + + The system is updating silently 系统正在静默更新 @@ -50,8 +50,8 @@ 检测到有系统更新 - - + + System update detected 检测到有系统更新 @@ -60,42 +60,33 @@ 系统完成一项关键更新,部分软件包更新失败,建议您立即重启 - - + 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 @@ -108,18 +99,8 @@ - one hours later - 一个小时 - - - - three day later - 三天 - - - - five day later - 五天 + three hours later + 三个小时 @@ -131,31 +112,10 @@ Delay 推迟 - - Two hours later - 两个小时 - - - - five hours later - 五个小时 - one day later 一天 - - two day later - 两天 - - - Agree - 立即更新 - - - Disagree - 推迟 -