[PC-BSD Commits] r17973 - pcbsd-projects/PCDM
svn at pcbsd.org
svn at pcbsd.org
Fri Jul 27 10:10:51 PDT 2012
Author: kenmoore
Date: 2012-07-27 17:10:49 +0000 (Fri, 27 Jul 2012)
New Revision: 17973
Modified:
pcbsd-projects/PCDM/pcdm-gui.cpp
Log:
Add verification dialogs before PCDM shuts down or restarts the system
Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp 2012-07-27 16:40:44 UTC (rev 17972)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp 2012-07-27 17:10:49 UTC (rev 17973)
@@ -212,15 +212,35 @@
}
void PCDMgui::slotShutdownComputer(){
- qDebug() << "PCDM: Shutting down computer";
- system("shutdown -p now");
- close();
+ QMessageBox verify;
+ verify.setWindowTitle(tr("System Shutdown"));
+ verify.setText(tr("You are about to shut down the system."));
+ verify.setInformativeText(tr("Are you sure?"));
+ verify.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ verify.setDefaultButton(QMessageBox::No);
+ int ret = verify.exec();
+
+ if(ret == QMessageBox::Yes){
+ qDebug() << "PCDM: Shutting down computer";
+ system("shutdown -p now");
+ close();
+ }
}
void PCDMgui::slotRestartComputer(){
- qDebug() << "PCDM: Restarting computer";
- system("shutdown -r now");
- close();
+ QMessageBox verify;
+ verify.setWindowTitle(tr("System Restart"));
+ verify.setText(tr("You are about to restart the system."));
+ verify.setInformativeText(tr("Are you sure?"));
+ verify.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ verify.setDefaultButton(QMessageBox::No);
+ int ret = verify.exec();
+
+ if(ret == QMessageBox::Yes){
+ qDebug() << "PCDM: Restarting computer";
+ system("shutdown -r now");
+ close();
+ }
}
void PCDMgui::slotClosePCDM(){
More information about the Commits
mailing list