From b326ca1dc50f0af3742ba6b5484997738e02976b Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Fri, 20 May 2016 14:01:03 +0200 Subject: Implemented lock-button feature. --- README.md | 10 ++++++++++ gui/client/toolbar.ui | 12 +++++++++++- sample_configuration/lockDesktop.sh | 4 ++++ sample_configuration/switchBack.sh | 0 sample_configuration/switchToManager.sh | 0 src/client/toolbar/toolbar.cpp | 15 +++++++++++++++ src/client/toolbar/toolbar.h | 1 + 7 files changed, 41 insertions(+), 1 deletion(-) create mode 100755 sample_configuration/lockDesktop.sh mode change 100644 => 100755 sample_configuration/switchBack.sh mode change 100644 => 100755 sample_configuration/switchToManager.sh diff --git a/README.md b/README.md index e309922..c1bba45 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ A sample configuration can be found in `sample_configuration`. * allowClientQuit: If set to true, users can shut down the client by clicking on "Quit" in the toolbar of pvsclient. +* showLockDesktopButton: If set to true there will be a button "Lock" that when + clicks calls the script "lockDesktop.sh". + #### Room settings A room section represents a physical or virtual room where clients are @@ -69,6 +72,13 @@ To perform the window switching `pvsclient` calls the pair of shell scripts `switchToManager.sh` and `switchBack.sh`. See the sample configuration which uses `wmctrl` to perform the switching. +### Lock-Desktop-Script +To allow users to lock their workstations (and not just the VM) we add a button +"Lock" (when in [general]showLockDesktopButton=true) that when clicked causes +the script /opt/openslx/pvs2/lockDesktop.sh. In this script you should call +something like "xscreensaver-command --lock" or similar. + + ### Network Setup diff --git a/gui/client/toolbar.ui b/gui/client/toolbar.ui index b4ac3b2..cedecad 100644 --- a/gui/client/toolbar.ui +++ b/gui/client/toolbar.ui @@ -6,7 +6,7 @@ 0 0 - 358 + 503 39 @@ -177,6 +177,16 @@ p, li { white-space: pre-wrap; } + + + + <html><head/><body><p>Lock this workstation</p></body></html> + + + Lock + + + diff --git a/sample_configuration/lockDesktop.sh b/sample_configuration/lockDesktop.sh new file mode 100755 index 0000000..0e3c61a --- /dev/null +++ b/sample_configuration/lockDesktop.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# activate a locking scrensaver, xscreensaver, kscreensaver, etc... +xscreensaver-command --lock diff --git a/sample_configuration/switchBack.sh b/sample_configuration/switchBack.sh old mode 100644 new mode 100755 diff --git a/sample_configuration/switchToManager.sh b/sample_configuration/switchToManager.sh old mode 100644 new mode 100755 diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index 1f98a8b..f620609 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -113,6 +113,14 @@ void Toolbar::init() _ui->btnManager->setVisible(_isManagerPc); connect(_ui->btnManager, SIGNAL(clicked()), this, SLOT(onBtnManager())); + /* setup lock desktop button*/ + SYSTEM_SETTINGS(conf); + bool showLock = conf.value("allowClientQuit").toBool(); + if (showLock) { + connect(_ui->btnLockDesktop, SIGNAL(clicked()), this, SLOT(onBtnLockDesktop())); + } else { + _ui->btnLockDesktop->setVisible(false); + } /* Connect the signals from vnc server */ connect(VncServer::instance(), SIGNAL(started(int, QString&, QString&)), this, SLOT(onVncServerIsRunning(int))); @@ -123,6 +131,7 @@ void Toolbar::init() move(primaryScreen.left() + (primaryScreen.width() - this->width())/2 , primaryScreen.top()); qDebug() << primaryScreen.left() << primaryScreen.top() << primaryScreen.right() << primaryScreen.bottom(); + /* Setup hide timer */ _hideTimer.setInterval(500); _hideTimer.setSingleShot(true); @@ -454,3 +463,9 @@ void Toolbar::onBtnManager() { _onWorkspace2 = !_onWorkspace2; switchP.waitForFinished(); } + +void Toolbar::onBtnLockDesktop() { + QProcess lockP; + lockP.start("/bin/sh", QStringList() << "/opt/openslx/pvs2/lockDesktop.sh"); + lockP.waitForFinished(); +} diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h index 0980beb..0e118bf 100644 --- a/src/client/toolbar/toolbar.h +++ b/src/client/toolbar/toolbar.h @@ -67,6 +67,7 @@ private slots: void onConnected(ServerConnection* connection); void onDoDisconnect(); void onBtnManager(); + void onBtnLockDesktop(); void exit(); void cameraBlink(); void showBar(); -- cgit v1.2.3-55-g7522