diff --git a/src/Lib/client.cpp b/src/Lib/client.cpp
index fb0d1d1..3680dc2 100755
--- a/src/Lib/client.cpp
+++ b/src/Lib/client.cpp
@@ -246,7 +246,7 @@ void lc::Client::Shutdown() {
GotStatusChanged( state_t::SHUTTING_DOWN );
}
-void lc::Client::StartZLeaf( const QString * const argFakeName ) {
+void lc::Client::StartZLeaf( const QString * argFakeName ) {
if ( state < state_t::RESPONDING || zLeafVersion.isEmpty() || GetSessionPort() < 7000 ) {
return;
}
@@ -304,16 +304,49 @@ void lc::Client::StartZLeaf( const QString * const argFakeName ) {
}
}
-void lc::Client::StartClientBrowser( const QString * const argURL ) {
+void lc::Client::StartClientBrowser( const QString * const argURL, const bool * const argFullscreen ) {
//Declarations
QStringList arguments;
+ // Output message via the debug messages tab
+ qDebug() << settings->sshCmd << arguments.join( " " );
+
+ //Build arguments list for SSH command
+ arguments << "-i" << settings->pkeyPathUser
+ << QString{ settings->userNameOnClients + "@" + ip }
+ << "DISPLAY=:0.0"
+ << settings->clientBrowserCmd
+ << *argURL;
+
+ // Start the process
+ QProcess startClientBrowserProcess;
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ startClientBrowserProcess.setProcessEnvironment( env );
+ startClientBrowserProcess.startDetached( settings->sshCmd, arguments );
+
+ // Output message via the debug messages tab
+ qDebug() << settings->sshCmd << arguments.join( " " );
+}
+
+void lc::Client::StopClientBrowser() {
+ //Declarations
+ QStringList arguments;
+
+ //Build arguments list
+ arguments << "-i" << settings->pkeyPathUser
+ << QString{ settings->userNameOnClients + "@" + ip }
+ << "DISPLAY=:0.0"
+ << "killall"
+ << settings->clientBrowserCmd
+ << "&& sleep 1"
+ << "&& rm -R /home/ewfuser/.mozilla/firefox/*";
+
// Start the process
QProcess startClientBrowserProcess;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
startClientBrowserProcess.setProcessEnvironment( env );
- startClientBrowserProcess.startDetached( settings->clientBrowserCmd, arguments );
+ startClientBrowserProcess.startDetached( settings->sshCmd, arguments );
// Output message via the debug messages tab
- qDebug() << settings->clientBrowserCmd << arguments.join( " " );
+ qDebug() << settings->sshCmd << arguments.join( " " );
}
diff --git a/src/Lib/client.h b/src/Lib/client.h
index cad1ffc..22f78fe 100755
--- a/src/Lib/client.h
+++ b/src/Lib/client.h
@@ -112,11 +112,16 @@ public:
/*!
@param argFakeName The name the zLeaf instance shall have (if not the default, which is the hostname of the client)
*/
- void StartZLeaf( const QString * const argFakeName = nullptr );
+ void StartZLeaf(const QString *argFakeName = nullptr );
/*!
- @param argURL URL to open in clients browser
+ * \brief Opens a browser window on the client
+ * @param argURL URL to open in clients browser
*/
- void StartClientBrowser( const QString * const argURL = nullptr );
+ void StartClientBrowser( const QString *argURL = nullptr, const bool *argFullscreen = nullptr );
+ /*!
+ * \brief Closes all browser instances
+ */
+ void StopClientBrowser();
private:
const QString &GetzLeafVersion() const { return zLeafVersion; }
diff --git a/src/Lib/settings.cpp b/src/Lib/settings.cpp
index fb26344..5da9d4b 100755
--- a/src/Lib/settings.cpp
+++ b/src/Lib/settings.cpp
@@ -31,6 +31,9 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
browserCmd{ ReadSettingsItem( "browser_command",
"Opening ORSEE in a browser will not work.",
argSettings, true ) },
+ clientBrowserCmd{ ReadSettingsItem( "client_browser_command",
+ "Opening a browser window on clients will not work.",
+ argSettings, false ) },
dvipsCmd{ ReadSettingsItem( "dvips_command",
"Receipts creation will not work.",
argSettings, true ) },
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 30196e2..d467e91 100755
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -758,17 +758,37 @@ void lc::MainWindow::on_PBKillzTree_clicked()
// Output message via the debug messages tab
qDebug() << program << arguments;
} else {
- qDebug() << "Canceled killing all z-Tree processes";
+ qDebug() << "Canceled stopping all z-Tree processes";
}
}
void lc::MainWindow::on_PBstartBrowser_clicked()
{
+ QString argURL = ui->LEURL->text();
+ bool argFullscreen = ui->CBFullscreen->checkState();
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() );
- client->StartZLeaf( nullptr );
+ client->StartClientBrowser( &argURL, &argFullscreen );
}
}
}
+
+void lc::MainWindow::on_PBstopBrowser_clicked()
+{
+ // Confirmation dialog
+ QMessageBox::StandardButton reply;
+ reply = QMessageBox::question(this, "Confirm", "Really kill all selected browser instances?", QMessageBox::Yes|QMessageBox::No);
+ if (reply == QMessageBox::Yes) {
+ QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
+ for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) {
+ if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
+ Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() );
+ client->StopClientBrowser( );
+ }
+ }
+ } else {
+ qDebug() << "Canceled stopping all selected browser processes";
+ }
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 58f4734..2761216 100755
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -116,6 +116,7 @@ private slots:
void on_PBrestartCrashedSession_clicked();
void on_PBKillzTree_clicked();
void on_PBstartBrowser_clicked();
+ void on_PBstopBrowser_clicked();
};
}
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index e9fba06..066a1af 100755
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -6,7 +6,7 @@
0
0
- 800
+ 658
900
@@ -163,6 +163,9 @@
true
+
+ Choose the name z-Leaf shall have
+
-
Choose the name the z-Leaf shall have
@@ -201,7 +204,7 @@
-
-
+
Qt::Vertical
@@ -383,10 +386,13 @@
-
-
+
Fullscreen
+
+ true
+
-
@@ -399,7 +405,7 @@
-
-
+
Stop browser
@@ -408,7 +414,7 @@
-
-
+
Qt::Vertical
@@ -438,9 +444,9 @@
9
- 79
- 371
- 381
+ 69
+ 311
+ 391
@@ -458,6 +464,12 @@
-
+
+
+ 50
+ false
+
+
New session
@@ -554,29 +566,24 @@
-
-
-
- 390
- 140
- 381
- 321
-
-
-
-
10
10
- 761
- 57
+ 621
+ 55
-
+
+
+ 50
+ false
+
+
Cleanup / recover last session
@@ -612,10 +619,10 @@
- 388
- 108
- 381
- 321
+ 330
+ 100
+ 301
+ 361