diff options
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/SystemWindow.cpp | 12 | ||||
-rw-r--r-- | lumina-desktop/SystemWindow.h | 4 | ||||
-rw-r--r-- | lumina-desktop/SystemWindow.ui | 65 |
3 files changed, 69 insertions, 12 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"); diff --git a/lumina-desktop/SystemWindow.h b/lumina-desktop/SystemWindow.h index 211de5fd..4b1fab44 100644 --- a/lumina-desktop/SystemWindow.h +++ b/lumina-desktop/SystemWindow.h @@ -38,6 +38,8 @@ private slots: void sysShutdown(); + void sysSuspend(); + void sysCancel(){ this->close(); } @@ -45,4 +47,4 @@ private slots: void sysLock(); }; -#endif
\ No newline at end of file +#endif diff --git a/lumina-desktop/SystemWindow.ui b/lumina-desktop/SystemWindow.ui index b03039f5..9e25509b 100644 --- a/lumina-desktop/SystemWindow.ui +++ b/lumina-desktop/SystemWindow.ui @@ -14,8 +14,17 @@ <string>System Options</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> - <number>0</number> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> + <number>2</number> </property> <item> <widget class="QFrame" name="frame"> @@ -47,8 +56,8 @@ </property> <property name="iconSize"> <size> - <width>60</width> - <height>60</height> + <width>64</width> + <height>64</height> </size> </property> <property name="toolButtonStyle"> @@ -63,8 +72,8 @@ </property> <property name="iconSize"> <size> - <width>60</width> - <height>60</height> + <width>64</width> + <height>64</height> </size> </property> <property name="toolButtonStyle"> @@ -79,8 +88,8 @@ </property> <property name="iconSize"> <size> - <width>60</width> - <height>60</height> + <width>64</width> + <height>64</height> </size> </property> <property name="toolButtonStyle"> @@ -113,10 +122,19 @@ <item> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <widget class="QPushButton" name="push_cancel"> + <widget class="QToolButton" name="push_cancel"> <property name="text"> <string>Cancel</string> </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> </widget> </item> <item> @@ -133,9 +151,34 @@ </spacer> </item> <item> - <widget class="QPushButton" name="push_lock"> + <widget class="QToolButton" name="push_lock"> <property name="text"> - <string>Lock Screen</string> + <string>Lock</string> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_suspend"> + <property name="text"> + <string>Suspend</string> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> </property> </widget> </item> |