aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2016-08-23 08:07:26 -0400
committerKen Moore <ken@pcbsd.org>2016-08-23 08:07:26 -0400
commitfd1e83d3d16bc46184d0781978a2f66284097a36 (patch)
tree942ff96bca42f4acf338596aadc90ac6527b6bfe /src-qt5/core/lumina-desktop
parentFix up the right-click terminal launcher - don't check for a valid binary if ... (diff)
downloadlumina-fd1e83d3d16bc46184d0781978a2f66284097a36.tar.gz
lumina-fd1e83d3d16bc46184d0781978a2f66284097a36.tar.bz2
lumina-fd1e83d3d16bc46184d0781978a2f66284097a36.zip
Add in the pending updates detection for the shutdown/reboot options in the start menu.
Diffstat (limited to 'src-qt5/core/lumina-desktop')
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp26
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h2
2 files changed, 26 insertions, 2 deletions
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 <LuminaOS.h>
#include "../../LSession.h"
#include <QtConcurrent>
+#include <QMessageBox>
#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);
bgstack15