From 25305a6ef01120bf3b0d929bae0ba7693f41c46b Mon Sep 17 00:00:00 2001
From: Johann Latocha
Date: Sat, 10 Jul 2010 01:54:35 +0200
Subject: Configuration by pvs via D-Bus. Old .allow ist now deprecated, config
file: .config/openslx/pvs.conf
---
i18n/pvs_ar_JO.ts | 6 +--
i18n/pvs_de_DE.ts | 6 +--
i18n/pvs_es_MX.ts | 6 +--
i18n/pvs_fr_FR.ts | 6 +--
i18n/pvs_pl_PL.ts | 6 +--
i18n/pvsgui_ar_JO.ts | 58 ++++++++++++-----------------
i18n/pvsgui_de_DE.ts | 54 +++++++++++++--------------
i18n/pvsgui_es_MX.ts | 54 +++++++++++++--------------
i18n/pvsgui_fr_FR.ts | 58 ++++++++++++-----------------
i18n/pvsgui_pl_PL.ts | 58 ++++++++++++-----------------
src/gui/clientConfigDialog.cpp | 84 ++++++++++++++++++++++++++----------------
src/gui/clientConfigDialog.h | 2 +
src/gui/ui/clientToolbar.ui | 31 +---------------
src/pvs.cpp | 33 ++++++++---------
src/pvs.h | 7 +++-
src/pvsgui.cpp | 30 ---------------
src/pvsgui.h | 1 -
17 files changed, 215 insertions(+), 285 deletions(-)
diff --git a/i18n/pvs_ar_JO.ts b/i18n/pvs_ar_JO.ts
index 0b4c72f..022cf92 100644
--- a/i18n/pvs_ar_JO.ts
+++ b/i18n/pvs_ar_JO.ts
@@ -9,17 +9,17 @@
-
+
VNC connection
-
+
The host
-
+
requested your screen!
diff --git a/i18n/pvs_de_DE.ts b/i18n/pvs_de_DE.ts
index 0b4c72f..022cf92 100644
--- a/i18n/pvs_de_DE.ts
+++ b/i18n/pvs_de_DE.ts
@@ -9,17 +9,17 @@
-
+
VNC connection
-
+
The host
-
+
requested your screen!
diff --git a/i18n/pvs_es_MX.ts b/i18n/pvs_es_MX.ts
index 0b4c72f..022cf92 100644
--- a/i18n/pvs_es_MX.ts
+++ b/i18n/pvs_es_MX.ts
@@ -9,17 +9,17 @@
-
+
VNC connection
-
+
The host
-
+
requested your screen!
diff --git a/i18n/pvs_fr_FR.ts b/i18n/pvs_fr_FR.ts
index 0b4c72f..022cf92 100644
--- a/i18n/pvs_fr_FR.ts
+++ b/i18n/pvs_fr_FR.ts
@@ -9,17 +9,17 @@
-
+
VNC connection
-
+
The host
-
+
requested your screen!
diff --git a/i18n/pvs_pl_PL.ts b/i18n/pvs_pl_PL.ts
index 0b4c72f..022cf92 100644
--- a/i18n/pvs_pl_PL.ts
+++ b/i18n/pvs_pl_PL.ts
@@ -9,17 +9,17 @@
-
+
VNC connection
-
+
The host
-
+
requested your screen!
diff --git a/i18n/pvsgui_ar_JO.ts b/i18n/pvsgui_ar_JO.ts
index f3e6d65..04d9717 100644
--- a/i18n/pvsgui_ar_JO.ts
+++ b/i18n/pvsgui_ar_JO.ts
@@ -331,42 +331,32 @@
ClientToolbarClass
-
+
Form
-
+
Menu
-
+
Host:
-
+
Click to connect
-
+
-
-
- Enable/Disable VNC only for this session
-
-
-
-
- Allow VNC
-
-
-
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -409,77 +399,77 @@ p, li { white-space: pre-wrap; }
-
+
&Disconnect
-
+
C&hat
-
+
&Send File
-
+
&Config
-
+
&Information
-
+
&About
-
+
&Quit
-
-
-
+
+
+
PVS Connection
-
+
Please enter password (If not needed leave blank):
-
+
Are you sure you want to disconnect?
-
-
+
+
PVS connection
+
-
Connected to
-
-
+
+
Disconnected
-
+
New host available:
diff --git a/i18n/pvsgui_de_DE.ts b/i18n/pvsgui_de_DE.ts
index 9acab81..544ebff 100644
--- a/i18n/pvsgui_de_DE.ts
+++ b/i18n/pvsgui_de_DE.ts
@@ -331,42 +331,40 @@
ClientToolbarClass
-
+
Form
-
+
Menu
Menü
-
+
Host:
-
+
Click to connect
Zum Verbinden Klicken
-
+
-
-
Enable/Disable VNC only for this session
- VNC nur für diese Sitzung ein- und ausschalten
+ VNC nur für diese Sitzung ein- und ausschalten
-
Allow VNC
- VNC erlauben
+ VNC erlauben
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -409,77 +407,77 @@ p, li { white-space: pre-wrap; }
Verbinden
-
+
&Disconnect
&Trennen
-
+
C&hat
-
+
&Send File
Datei &Senden
-
+
&Config
&Konfiguration
-
+
&Information
&Information
-
+
&About
&Über
-
+
&Quit
&Beenden
-
-
-
+
+
+
PVS Connection
PVS Verbindung
-
+
Please enter password (If not needed leave blank):
Bitte geben sie ein Passwor ein (Falls nicht erforderlich einfach leer lassen):
-
+
Are you sure you want to disconnect?
Sind sie sicher dass sie die Verbindung trennen möchten?
-
-
+
+
PVS connection
PVS Verbindung
+
-
Connected to
Verbunden mit
-
-
+
+
Disconnected
Getrennt
-
+
New host available:
Neuer Host verfügbar:
diff --git a/i18n/pvsgui_es_MX.ts b/i18n/pvsgui_es_MX.ts
index 32b6195..855ee9b 100644
--- a/i18n/pvsgui_es_MX.ts
+++ b/i18n/pvsgui_es_MX.ts
@@ -331,42 +331,40 @@
ClientToolbarClass
-
+
Form
de
-
+
Menu
Menu
-
+
Host:
Host:
-
+
Click to connect
Click para conectar
-
+
-
-
-
Enable/Disable VNC only for this session
- Avilitar/Desavilitar VNC solamente para esta sesión
+ Avilitar/Desavilitar VNC solamente para esta sesión
-
Allow VNC
- Permitir VNC
+ Permitir VNC
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -421,77 +419,77 @@ p, li { white-space: pre-wrap; }
Conectar
-
+
&Disconnect
&Desconectar
-
+
C&hat
???
-
+
&Send File
&Enviar archivo
-
+
&Config
&Configuración
-
+
&Information
&Información
-
+
&About
&Acerca de
-
+
&Quit
&Cerrar
-
-
-
+
+
+
PVS Connection
PVS Connección
-
+
Please enter password (If not needed leave blank):
Porfavor ingrese una contraseña (Deje la seccion vacia si no lo necesita):
-
+
Are you sure you want to disconnect?
Realmente desea desconectarse?
-
-
+
+
PVS connection
PVS Connección
+
-
Connected to
Connectar a
-
-
+
+
Disconnected
Desconectado
-
+
New host available:
Nuevo Host disponible:
diff --git a/i18n/pvsgui_fr_FR.ts b/i18n/pvsgui_fr_FR.ts
index f3e6d65..04d9717 100644
--- a/i18n/pvsgui_fr_FR.ts
+++ b/i18n/pvsgui_fr_FR.ts
@@ -331,42 +331,32 @@
ClientToolbarClass
-
+
Form
-
+
Menu
-
+
Host:
-
+
Click to connect
-
+
-
-
- Enable/Disable VNC only for this session
-
-
-
-
- Allow VNC
-
-
-
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -409,77 +399,77 @@ p, li { white-space: pre-wrap; }
-
+
&Disconnect
-
+
C&hat
-
+
&Send File
-
+
&Config
-
+
&Information
-
+
&About
-
+
&Quit
-
-
-
+
+
+
PVS Connection
-
+
Please enter password (If not needed leave blank):
-
+
Are you sure you want to disconnect?
-
-
+
+
PVS connection
+
-
Connected to
-
-
+
+
Disconnected
-
+
New host available:
diff --git a/i18n/pvsgui_pl_PL.ts b/i18n/pvsgui_pl_PL.ts
index f3e6d65..04d9717 100644
--- a/i18n/pvsgui_pl_PL.ts
+++ b/i18n/pvsgui_pl_PL.ts
@@ -331,42 +331,32 @@
ClientToolbarClass
-
+
Form
-
+
Menu
-
+
Host:
-
+
Click to connect
-
+
-
-
- Enable/Disable VNC only for this session
-
-
-
-
- Allow VNC
-
-
-
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -409,77 +399,77 @@ p, li { white-space: pre-wrap; }
-
+
&Disconnect
-
+
C&hat
-
+
&Send File
-
+
&Config
-
+
&Information
-
+
&About
-
+
&Quit
-
-
-
+
+
+
PVS Connection
-
+
Please enter password (If not needed leave blank):
-
+
Are you sure you want to disconnect?
-
-
+
+
PVS connection
+
-
Connected to
-
-
+
+
Disconnected
-
+
New host available:
diff --git a/src/gui/clientConfigDialog.cpp b/src/gui/clientConfigDialog.cpp
index 76b4f5e..3e1ee50 100644
--- a/src/gui/clientConfigDialog.cpp
+++ b/src/gui/clientConfigDialog.cpp
@@ -26,6 +26,12 @@ ClientConfigDialog::ClientConfigDialog(QWidget *parent) :
connect(radioButtonOtherRO, SIGNAL(clicked()), this,
SLOT(checkPermissions()));
+ // connect to D-Bus and get interface
+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ dbus.registerObject("/config", this);
+ dbus.registerService("org.openslx.pvsgui");
+ _ifaceDBus = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this);
+
}
ClientConfigDialog::~ClientConfigDialog()
@@ -49,50 +55,66 @@ void ClientConfigDialog::readSettings()
else
comboBox->setCurrentIndex(_settings.value("Display/location").toInt());
- if (_settings.value("Permissions/vnc_lecturer").toString() == "rw")
- radioButtonLecturerRW->setChecked(true);
- else if (_settings.value("Permissions/vnc_lecturer").toString() == "ro")
- radioButtonLecturerRO->setChecked(true);
- else
- radioButtonLecturerNO->setChecked(true);
- if (_settings.value("Permissions/vnc_other").toString() == "rw")
- radioButtonOtherRW->setChecked(true);
- else if (_settings.value("Permissions/vnc_other").toString() == "ro")
- radioButtonOtherRO->setChecked(true);
- else
- radioButtonOtherNO->setChecked(true);
- checkBoxAllowChat->setChecked(
- _settings.value("Permissions/allow_chat").toBool());
- checkBoxAllowFiletransfer->setChecked(_settings.value(
- "Permissions/allow_filetransfer").toBool());
-
- qDebug("[%s] Setting read from: '%s'", metaObject()->className(),
- qPrintable(_settings.fileName()));
+ QDBusPendingReply reply = _ifaceDBus->getConfigValue("Permissions/vnc_lecturer");
+ reply.waitForFinished();
+ if (reply.isValid())
+ {
+ if (reply.value() == "rw")
+ radioButtonLecturerRW->setChecked(true);
+ else if (reply.value() == "ro")
+ radioButtonLecturerRO->setChecked(true);
+ else
+ radioButtonLecturerNO->setChecked(true);
+ }
+
+ reply = _ifaceDBus->getConfigValue("Permissions/vnc_other");
+ reply.waitForFinished();
+ if (reply.isValid())
+ {
+ if (reply.value() == "rw")
+ radioButtonOtherRW->setChecked(true);
+ else if (reply.value() == "ro")
+ radioButtonOtherRO->setChecked(true);
+ else
+ radioButtonOtherNO->setChecked(true);
+ }
+
+ reply = _ifaceDBus->getConfigValue("Permissions/allow_chat");
+ reply.waitForFinished();
+ if (reply.isValid())
+ checkBoxAllowChat->setChecked(reply.value() == "T");
+
+ reply = _ifaceDBus->getConfigValue("Permissions/allow_filetransfer");
+ reply.waitForFinished();
+ if (reply.isValid())
+ checkBoxAllowFiletransfer->setChecked(reply.value() == "T");
+
}
void ClientConfigDialog::writeSettings()
{
_settings.setValue("Display/location", comboBox->currentIndex());
+
if (radioButtonLecturerRW->isChecked())
- _settings.setValue("Permissions/vnc_lecturer", "rw");
+ _ifaceDBus->setConfigValue("Permissions/vnc_lecturer", "rw");
else if (radioButtonLecturerRO->isChecked())
- _settings.setValue("Permissions/vnc_lecturer", "ro");
+ _ifaceDBus->setConfigValue("Permissions/vnc_lecturer", "ro");
else
- _settings.setValue("Permissions/vnc_lecturer", "no");
+ _ifaceDBus->setConfigValue("Permissions/vnc_lecturer", "no");
if (radioButtonOtherRW->isChecked())
- _settings.setValue("Permissions/vnc_other", "rw");
+ _ifaceDBus->setConfigValue("Permissions/vnc_other", "rw");
else if (radioButtonOtherRO->isChecked())
- _settings.setValue("Permissions/vnc_other", "ro");
+ _ifaceDBus->setConfigValue("Permissions/vnc_other", "ro");
else
- _settings.setValue("Permissions/vnc_other", "no");
- _settings.setValue("Permissions/allow_chat", checkBoxAllowChat->isChecked());
- _settings.setValue("Permissions/allow_filetransfer",
- checkBoxAllowFiletransfer->isChecked());
+ _ifaceDBus->setConfigValue("Permissions/vnc_other", "no");
+
+ _ifaceDBus->setConfigValue("Permissions/allow_chat",
+ QString(checkBoxAllowChat->isChecked() ? "T" : "F"));
+ _ifaceDBus->setConfigValue("Permissions/allow_filetransfer",
+ QString(checkBoxAllowFiletransfer->isChecked() ? "T" : "F"));
+
_settings.sync();
emit configChanged();
-
- qDebug("[%s] Settings written to: '%s'.", metaObject()->className(),
- qPrintable(_settings.fileName()));
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gui/clientConfigDialog.h b/src/gui/clientConfigDialog.h
index 706bd8a..98da54f 100644
--- a/src/gui/clientConfigDialog.h
+++ b/src/gui/clientConfigDialog.h
@@ -15,6 +15,7 @@
#define CLIENTCONFIGDIALOG_H_
#include
+#include "pvsinterface.h"
#include "ui_clientConfigDialog.h"
class ClientConfigDialog: public QDialog, private Ui::ClientConfigDialogClass
@@ -37,6 +38,7 @@ private Q_SLOTS:
void checkPermissions();
private:
+ OrgOpenslxPvsInterface *_ifaceDBus;
QSettings _settings;
};
diff --git a/src/gui/ui/clientToolbar.ui b/src/gui/ui/clientToolbar.ui
index 5a59c5f..51cb62e 100644
--- a/src/gui/ui/clientToolbar.ui
+++ b/src/gui/ui/clientToolbar.ui
@@ -6,7 +6,7 @@
0
0
- 577
+ 463
28
@@ -143,35 +143,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
- 0
- 0
-
-
-
- Enable/Disable VNC only for this session
-
-
- Allow VNC
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 20
- 20
-
-
-
-
-
diff --git a/src/pvs.cpp b/src/pvs.cpp
index 2069e36..124b257 100644
--- a/src/pvs.cpp
+++ b/src/pvs.cpp
@@ -317,24 +317,9 @@ bool PVS::allowExists()
*/
bool PVS::getVNCAllow()
{
- if (allowExists())
- {
- if (getAllowed())
- {
- _vncAllowed = true;
- }
- else
- {
- _vncAllowed = false;
- }
- }
- else
- {
- ConsoleLog writeError("No .allow file found.");
- _vncAllowed = false;
- //make sure the vncsever is off
- ConsoleLog writeError("Shutting down vnc-server because we have no .allow file.");
- }
+
+ QString value = getConfigValue("Permissions/vnc_lecturer");
+ _vncAllowed = (value == "rw" || value == "ro");
if (_vncAllowed && _vncRequested)
{
@@ -627,3 +612,15 @@ void PVS::signalHandler(int signal)
}
+void PVS::setConfigValue(QString key, QString value)
+{
+ _settings.setValue(key, value);
+ _settings.sync();
+ getVNCAllow();
+}
+
+QString PVS::getConfigValue(QString key)
+{
+ return _settings.value(key).toString();
+}
+
diff --git a/src/pvs.h b/src/pvs.h
index 4b1e29e..ba696d8 100644
--- a/src/pvs.h
+++ b/src/pvs.h
@@ -80,6 +80,9 @@ public Q_SLOTS:
QStringList getAvailableHosts();
QString getIpByNick(QString nick);
+ void setConfigValue(QString key, QString value);
+ QString getConfigValue(QString key);
+
Q_SIGNALS:
void project(QString host, int port, QString passwd, bool fullscreen,
bool smoothTransformation, int quality);
@@ -131,8 +134,6 @@ private:
PVSServerConnection* _pvsServerConnection; ///< our tcp connection object to the pvsserver
- QSettings _settings;
-
PVSServiceDiscovery *_sdClient;
PVSChatClient *_chat;
@@ -142,5 +143,7 @@ private:
int _timerLockTest;
int _timerLockDelay;
+ QSettings _settings;
+
};
#endif /* PVSCLIENT_H_ */
diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp
index 25f1cd6..6fdd673 100644
--- a/src/pvsgui.cpp
+++ b/src/pvsgui.cpp
@@ -76,18 +76,6 @@ PVSGUI::PVSGUI(QWidget *parent) :
if (dbus.isConnected())
qDebug("[%s] Connection to DBus successful!", metaObject()->className());
- // TODO: perhaps this can go if fadi does his work
- // check if vnc is allowed and setup checkbox
- QFile file(QDir::toNativeSeparators(QDir::homePath() + "/.pvs/.allow"));
- if (file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- QTextStream in(&file);
- QString line = in.readLine();
- if (line == "1")
- vncCheckBox->setChecked(true);
- file.close();
- }
-
// listen on port 29481 for incoming file transfers
_serverSocket = new QTcpServer();
_serverSocket->listen(QHostAddress::Any, 29481);
@@ -108,8 +96,6 @@ PVSGUI::PVSGUI(QWidget *parent) :
connect(_hostMenu, SIGNAL(aboutToHide()), this, SLOT(hide()));
connect(_hostMenu, SIGNAL(triggered(QAction*)), this,
SLOT(pvsConnect(QAction*)));
- connect(vncCheckBox, SIGNAL(stateChanged(int)), this,
- SLOT(setVncAllow(int)));
// signals & slots - dbus
connect(_ifaceDBus, SIGNAL(showMessage(QString, QString, bool)), this,
@@ -392,22 +378,6 @@ void PVSGUI::delHost(QString host)
}
}
-// TODO: perhaps this can go if fadi does his work
-void PVSGUI::setVncAllow(int i)
-{
- QFile file(QDir::toNativeSeparators(QDir::homePath() + "/.pvs/.allow"));
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
- return;
-
- QTextStream out(&file);
- if (i == 0)
- out << 0;
- else
- out << 1;
-
- file.close();
-}
-
void PVSGUI::sendFile()
{
ClientFileSendDialog *d = new ClientFileSendDialog();
diff --git a/src/pvsgui.h b/src/pvsgui.h
index f9a0ab8..90fe50e 100644
--- a/src/pvsgui.h
+++ b/src/pvsgui.h
@@ -62,7 +62,6 @@ private Q_SLOTS:
void delHost(QString host);
void pvsConnect(QAction *action);
void pvsDisconnect();
- void setVncAllow(int i);
void sendFile();
void receiveFile();
--
cgit v1.2.3-55-g7522