aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/SystemWindow.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-04-19 15:22:37 -0400
committerKen Moore <ken@pcbsd.org>2015-04-19 15:22:37 -0400
commit1b3a24268a6b3e030550a00c0ddfdcee37db56ff (patch)
tree54076649ef31a1fd9d3eb0ae5425e24d4808b507 /lumina-desktop/SystemWindow.cpp
parentAdd support to LuminaOS for checking/starting the system suspend functionality. (diff)
downloadlumina-1b3a24268a6b3e030550a00c0ddfdcee37db56ff.tar.gz
lumina-1b3a24268a6b3e030550a00c0ddfdcee37db56ff.tar.bz2
lumina-1b3a24268a6b3e030550a00c0ddfdcee37db56ff.zip
Clean up the new suspend support in Lumina, and add it to the system "log out" menu as an option (if supported on that system).
Diffstat (limited to 'lumina-desktop/SystemWindow.cpp')
-rw-r--r--lumina-desktop/SystemWindow.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lumina-desktop/SystemWindow.cpp b/lumina-desktop/SystemWindow.cpp
index 0540a5d9..02de54b9 100644
--- a/lumina-desktop/SystemWindow.cpp
+++ b/lumina-desktop/SystemWindow.cpp
@@ -17,19 +17,23 @@ SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){
ui->tool_logout->setIcon( LXDG::findIcon("system-log-out","") );
ui->tool_restart->setIcon( LXDG::findIcon("system-reboot","") );
ui->tool_shutdown->setIcon( LXDG::findIcon("system-shutdown","") );
+ ui->tool_suspend->setIcon( LXDG::findIcon("system-suspend","") );
ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") );
ui->push_lock->setIcon( LXDG::findIcon("system-lock-screen","") );
//Connect the signals/slots
connect(ui->tool_logout, SIGNAL(clicked()), this, SLOT(sysLogout()) );
connect(ui->tool_restart, SIGNAL(clicked()), this, SLOT(sysRestart()) );
connect(ui->tool_shutdown, SIGNAL(clicked()), this, SLOT(sysShutdown()) );
+ connect(ui->tool_suspend, SIGNAL(clicked()), this, SLOT(sysSuspend()) );
connect(ui->push_cancel, SIGNAL(clicked()), this, SLOT(sysCancel()) );
connect(ui->push_lock, SIGNAL(clicked()), this, SLOT(sysLock()) );
//Disable the shutdown/restart buttons if necessary
if( !LOS::userHasShutdownAccess() ){
ui->tool_restart->setEnabled(false);
ui->tool_shutdown->setEnabled(false);
+
}
+ ui->tool_suspend->setVisible(LOS::systemCanSuspend());
//Center this window on the screen
QPoint center = QApplication::desktop()->screenGeometry(QCursor::pos()).center(); //get the center of the current screen
this->move(center.x() - this->width()/2, center.y() - this->height()/2);
@@ -55,6 +59,14 @@ void SystemWindow::sysShutdown(){
this->close();
}
+void SystemWindow::sysSuspend(){
+ //Make sure to lock the system first (otherwise anybody can access it again)
+ LUtils::runCmd("xscreensaver-command -lock");
+ //Now suspend the system
+ LOS::systemSuspend();
+ this->close();
+}
+
void SystemWindow::sysLock(){
qDebug() << "Locking the desktop...";
QProcess::startDetached("xscreensaver-command -lock");
bgstack15