diff options
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-Debian.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-DragonFly.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp | 16 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-Gentoo.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-Linux.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-NetBSD.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-template.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS.h | 6 | ||||
-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 |
14 files changed, 104 insertions, 34 deletions
diff --git a/src-qt5/core/libLumina/LuminaOS-Debian.cpp b/src-qt5/core/libLumina/LuminaOS-Debian.cpp index 8794928a..4acbe7d8 100644 --- a/src-qt5/core/libLumina/LuminaOS-Debian.cpp +++ b/src-qt5/core/libLumina/LuminaOS-Debian.cpp @@ -152,15 +152,20 @@ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("dbus-send --system --print-reply \ --dest=org.freedesktop.login1 /org/freedesktop/login1 \ org.freedesktop.login1.Manager.PowerOff boolean:true"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("dbus-send --system --print-reply \ --dest=org.freedesktop.login1 /org/freedesktop/login1 \ org.freedesktop.login1.Manager.Reboot boolean:true"); diff --git a/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp b/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp index c23cc5d7..ac25815f 100644 --- a/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp +++ b/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp @@ -228,13 +228,18 @@ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("shutdown -p now"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("shutdown -r now"); } diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp index e0706a98..10216f92 100644 --- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp @@ -210,14 +210,22 @@ bool LOS::systemPerformingUpdates(){ return (QProcess::execute("pgrep -F /tmp/.updateInProgress")==0); //this is 0 if updating right now } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + if(QFile::exists("/tmp/.rebootRequired")){ return LUtils::readFile("/tmp/.rebootRequired").join("\n"); } + else{ return ""; } +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence - QProcess::startDetached("shutdown -p now"); +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence + if(skipupdates){QProcess::startDetached("shutdown -po now"); } + else{ QProcess::startDetached("shutdown -p now"); } } //System Restart -void LOS::systemRestart(){ //start reboot sequence - QProcess::startDetached("shutdown -r now"); +void LOS::systemRestart(bool skipupdates){ //start reboot sequence + if(skipupdates){QProcess::startDetached("shutdown -ro now"); } + else{ QProcess::startDetached("shutdown -r now"); } } //Check for suspend support diff --git a/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp b/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp index 3ec01dde..b92d1b02 100644 --- a/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp +++ b/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp @@ -152,15 +152,20 @@ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("dbus-send --system --print-reply \ --dest=org.freedesktop.login1 /org/freedesktop/login1 \ org.freedesktop.login1.Manager.PowerOff boolean:true"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("dbus-send --system --print-reply \ --dest=org.freedesktop.login1 /org/freedesktop/login1 \ org.freedesktop.login1.Manager.Reboot boolean:true"); diff --git a/src-qt5/core/libLumina/LuminaOS-Linux.cpp b/src-qt5/core/libLumina/LuminaOS-Linux.cpp index 2e9b1e18..9d5980eb 100644 --- a/src-qt5/core/libLumina/LuminaOS-Linux.cpp +++ b/src-qt5/core/libLumina/LuminaOS-Linux.cpp @@ -144,13 +144,18 @@ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("shutdown -P -h now"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("shutdown -r now"); } diff --git a/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp b/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp index 2183eb93..75feb345 100644 --- a/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp @@ -85,13 +85,18 @@ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("shutdown -p now"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("shutdown -r now"); } diff --git a/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp b/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp index a0d6d1a0..b208c314 100644 --- a/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp @@ -164,13 +164,18 @@ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("shutdown -p now"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("shutdown -r now"); } diff --git a/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp index b3721e7d..62bbdb1c 100644 --- a/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp @@ -131,13 +131,18 @@ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} + //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("shutdown -h now"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("shutdown -r now"); } diff --git a/src-qt5/core/libLumina/LuminaOS-template.cpp b/src-qt5/core/libLumina/LuminaOS-template.cpp index 00bbae52..c6dedf3b 100644 --- a/src-qt5/core/libLumina/LuminaOS-template.cpp +++ b/src-qt5/core/libLumina/LuminaOS-template.cpp @@ -78,14 +78,18 @@ bool LOS::userHasShutdownAccess(){ bool LOS::systemPerformingUpdates(){ return false; //Not implemented yet } +//Return the details of any updates which are waiting to apply on shutdown +QString LOS::systemPendingUpdates(){ + return ""; +} //System Shutdown -void LOS::systemShutdown(){ //start poweroff sequence +void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence QProcess::startDetached("shutdown -p now"); } //System Restart -void LOS::systemRestart(){ //start reboot sequence +void LOS::systemRestart(bool skipupdates){ //start reboot sequence QProcess::startDetached("shutdown -r now"); } diff --git a/src-qt5/core/libLumina/LuminaOS.h b/src-qt5/core/libLumina/LuminaOS.h index a18f2909..50d6baec 100644 --- a/src-qt5/core/libLumina/LuminaOS.h +++ b/src-qt5/core/libLumina/LuminaOS.h @@ -61,10 +61,12 @@ public: //Check for user system permission (shutdown/restart) static bool userHasShutdownAccess(); static bool systemPerformingUpdates(); + static QString systemPendingUpdates(); //returns nothing if no updates waiting to install at shutdown + //System Shutdown - static void systemShutdown(); //start poweroff sequence + static void systemShutdown(bool skipupdates = false); //start poweroff sequence //System Restart - static void systemRestart(); //start reboot sequence + static void systemRestart(bool skipupdates = false); //start reboot sequence //Check for suspend support static bool systemCanSuspend(); //Put the system into the suspend state 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(); |