diff options
author | Ken Moore <moorekou@gmail.com> | 2016-08-18 15:50:49 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-08-18 15:50:49 -0400 |
commit | bd87d69b5c64a80a209e5cd8e3f0c7fac608c87c (patch) | |
tree | 1c3717afdba77275ad9b2028ee9eefae71682442 /src-qt5/core/lumina-desktop | |
parent | Oops - NOW the OS-detect.pri file is fixed for the LIBPREFIX variable (also c... (diff) | |
download | lumina-bd87d69b5c64a80a209e5cd8e3f0c7fac608c87c.tar.gz lumina-bd87d69b5c64a80a209e5cd8e3f0c7fac608c87c.tar.bz2 lumina-bd87d69b5c64a80a209e5cd8e3f0c7fac608c87c.zip |
Add in pending update detection/skipping ability to the main logout window (not the start menu options yet).
Diffstat (limited to 'src-qt5/core/lumina-desktop')
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.h | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/SystemWindow.cpp | 30 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/SystemWindow.h | 3 |
4 files changed, 33 insertions, 12 deletions
diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 28b7eb2d..434bfd2d 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -299,15 +299,15 @@ void LSession::StartLogout(){ QCoreApplication::exit(0); } -void LSession::StartShutdown(){ +void LSession::StartShutdown(bool skipupdates){ CleanupSession(); - LOS::systemShutdown(); + LOS::systemShutdown(skipupdates); QCoreApplication::exit(0); } -void LSession::StartReboot(){ +void LSession::StartReboot(bool skipupdates){ CleanupSession(); - LOS::systemRestart(); + LOS::systemRestart(skipupdates); QCoreApplication::exit(0); } diff --git a/src-qt5/core/lumina-desktop/LSession.h b/src-qt5/core/lumina-desktop/LSession.h index f9e2acb3..c19b3f09 100644 --- a/src-qt5/core/lumina-desktop/LSession.h +++ b/src-qt5/core/lumina-desktop/LSession.h @@ -140,8 +140,8 @@ private: public slots: void StartLogout(); - void StartShutdown(); - void StartReboot(); + void StartShutdown(bool skipupdates = false); + void StartReboot(bool skipupdates = false); void reloadIconTheme(); diff --git a/src-qt5/core/lumina-desktop/SystemWindow.cpp b/src-qt5/core/lumina-desktop/SystemWindow.cpp index 74538404..1c0b59a5 100644 --- a/src-qt5/core/lumina-desktop/SystemWindow.cpp +++ b/src-qt5/core/lumina-desktop/SystemWindow.cpp @@ -8,6 +8,7 @@ #include <QDebug> #include <QProcess> #include <QDesktopWidget> +#include <QMessageBox> SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){ ui->setupUi(this); //load the designer file @@ -49,22 +50,41 @@ void SystemWindow::updateWindow(){ this->move(center.x() - this->width()/2, center.y() - this->height()/2); } +bool SystemWindow::promptAboutUpdates(bool &skip){ + QString pending = LOS::systemPendingUpdates(); + if(pending.isEmpty()){ skip = false; } //continue without skip + else{ + QMessageBox dlg(QMessageBox::Question, tr("Apply Updates?"), tr("You have system updates waiting to be applied! Do you wish to install them now?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this); + dlg.setDetailedText(pending); + dlg.setDefaultButton(QMessageBox::Yes); + dlg.show(); + int ret = dlg.exec(); + if(ret == QMessageBox::Cancel){ return false; } //do not continue + else{ skip = (ret==QMessageBox::No); } + } + return true; +} + void SystemWindow::sysLogout(){ - this->hide(); + this->close(); LSession::processEvents(); QTimer::singleShot(0, LSession::handle(), SLOT(StartLogout()) ); } void SystemWindow::sysRestart(){ - this->hide(); + bool skip = false; + if(!promptAboutUpdates(skip)){ this->close(); return; } //cancelled + this->close(); LSession::processEvents(); - QTimer::singleShot(0, LSession::handle(), SLOT(StartReboot()) ); + LSession::handle()->StartReboot(skip); } void SystemWindow::sysShutdown(){ - this->hide(); + bool skip = false; + if(!promptAboutUpdates(skip)){ this->close(); return; } //cancelled + this->close(); LSession::processEvents(); - QTimer::singleShot(0, LSession::handle(), SLOT(StartShutdown()) ); + LSession::handle()->StartShutdown(skip); } void SystemWindow::sysSuspend(){ diff --git a/src-qt5/core/lumina-desktop/SystemWindow.h b/src-qt5/core/lumina-desktop/SystemWindow.h index 98617f79..bbef36a3 100644 --- a/src-qt5/core/lumina-desktop/SystemWindow.h +++ b/src-qt5/core/lumina-desktop/SystemWindow.h @@ -25,7 +25,8 @@ private: Ui::SystemWindow *ui; //void closeAllWindows(); - + bool promptAboutUpdates(bool &skip); //main bool return: continue/cancel, skip: skip updates or not + private slots: void sysLogout(); |