From fd1e83d3d16bc46184d0781978a2f66284097a36 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 23 Aug 2016 08:07:26 -0400 Subject: Add in the pending updates detection for the shutdown/reboot options in the start menu. --- .../panel-plugins/systemstart/StartMenu.cpp | 26 ++++++++++++++++++++-- .../panel-plugins/systemstart/StartMenu.h | 2 ++ 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp index 50d084e3..60a313e8 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp @@ -11,6 +11,7 @@ #include #include "../../LSession.h" #include +#include #include "ItemWidget.h" //#define SSAVER QString("xscreensaver-demo") @@ -259,6 +260,21 @@ void StartMenu::do_search(QString search, bool force){ ui->stackedWidget->setCurrentWidget(ui->page_search); } +bool StartMenu::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; +} + // ======================== // PRIVATE SLOTS // ======================== @@ -571,12 +587,18 @@ void StartMenu::on_tool_logout_clicked(){ void StartMenu::on_tool_restart_clicked(){ emit CloseMenu(); - LSession::handle()->StartReboot(); + QCoreApplication::processEvents(); + bool skipupdates = false; + if( !promptAboutUpdates(skipupdates) ){ return; } + LSession::handle()->StartReboot(skipupdates); } void StartMenu::on_tool_shutdown_clicked(){ emit CloseMenu(); - LSession::handle()->StartShutdown(); + QCoreApplication::processEvents(); + bool skipupdates = false; + if( !promptAboutUpdates(skipupdates) ){ return; } + LSession::handle()->StartShutdown(skipupdates); } void StartMenu::on_tool_suspend_clicked(){ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h index 249709a8..9a629cc2 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h @@ -42,6 +42,8 @@ private: void SortScrollArea(QScrollArea *area); void do_search(QString search, bool force); + bool promptAboutUpdates(bool &skip); + private slots: void LaunchItem(QString path, bool fix = true); -- cgit