Permalink
Browse files

Warn before closing during package operations

  • Loading branch information...
1 parent 6dd9592 commit 426313bb2d3c77e519da5ac83f333965edf23875 @kmoore134 kmoore134 committed Aug 27, 2013
Showing with 26 additions and 0 deletions.
  1. +22 −0 src-qt4/pc-pkgmanager/mainWin.cpp
  2. +4 −0 src-qt4/pc-pkgmanager/mainWin.h
View
22 src-qt4/pc-pkgmanager/mainWin.cpp
@@ -1427,3 +1427,25 @@ void mainWin::slotCloseAdvClicked()
{
groupInfo->setVisible(false);
}
+
+void mainWin::closeEvent(QCloseEvent *event) {
+
+ if ( pkgCmdList.isEmpty() ) {
+ this->close();
+ return;
+ }
+ if ( pkgCmdList.at(0).at(0).isEmpty() ) {
+ this->close();
+ return;
+ }
+
+ //Verify that they want to continue
+ QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Processes Running"), tr("Packages are currently being changed. Are you sure you want to quit?"), QMessageBox::Yes | QMessageBox::Cancel,QMessageBox::Cancel);
+ if(button == QMessageBox::Yes) {
+ this->close();
+ } else {
+ event->ignore();
+ return;
+ }
+}
+
View
4 src-qt4/pc-pkgmanager/mainWin.h
@@ -1,6 +1,7 @@
#ifndef MAINWIN_H
#define MAINWIN_H
+#include <QCloseEvent>
#include <QDialog>
#include <QFile>
#include <QMenu>
@@ -38,6 +39,9 @@ public slots:
void ProgramInit(QString);
void slotSingleInstance();
+protected:
+ void closeEvent(QCloseEvent *event);
+
private slots:
// Generic pkgng handlers

0 comments on commit 426313b

Please sign in to comment.