diff options
Diffstat (limited to 'src/pvsgui.cpp')
-rw-r--r-- | src/pvsgui.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index 4294206..5359449 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -26,12 +26,6 @@ PVSGUI::PVSGUI(QWidget *parent) : { setupUi(this); - if (!QFile::exists(_settings.fileName())) - { - QDir::root().mkpath(QFileInfo(_settings.fileName()).path()); - QFile::copy("/etc/openslx/pvsgui.conf", _settings.fileName()); - } - // stop running pvs qDebug("[%s] Stopping pvs daemon.", metaObject()->className()); QProcess::execute("pvs -c stop"); @@ -48,8 +42,6 @@ PVSGUI::PVSGUI(QWidget *parent) : _hostMenu->setEnabled(false); hostButton->setEnabled(false); - setupMenu(); - _trayIcon = new QSystemTrayIcon(QIcon(":cam_off32.svg"), this); _trayIcon->setContextMenu(_menu); _trayIcon->setVisible(true); @@ -72,19 +64,26 @@ PVSGUI::PVSGUI(QWidget *parent) : else qDebug("[%s] ERROR: Could not connect to PVS daemon!", metaObject()->className()); - // get available hosts - QDBusPendingReply<QStringList> reply1 = _ifaceDBus->getAvailableHosts(); + // ask if restricted mode is on + QDBusPendingReply<bool> reply1 = _ifaceDBus->isRestricted(); reply1.waitForFinished(); - QStringList hosts = reply1.value(); - if (reply1.isValid() && !hosts.isEmpty()) + _restricted = reply1.value(); + + setupMenu(); + + // get available hosts + QDBusPendingReply<QStringList> reply2 = _ifaceDBus->getAvailableHosts(); + reply2.waitForFinished(); + QStringList hosts = reply2.value(); + if (reply2.isValid() && !hosts.isEmpty()) foreach (QString host, hosts) addHost(host); // already connected? - QDBusPendingReply<QString> reply2 = _ifaceDBus->isConnected(); - reply2.waitForFinished(); - QString host = reply2.value(); - if (reply2.isValid() && host != "") + QDBusPendingReply<QString> reply3 = _ifaceDBus->isConnected(); + reply3.waitForFinished(); + QString host = reply3.value(); + if (reply3.isValid() && host != "") connected(host); else disconnected(); @@ -239,17 +238,17 @@ void PVSGUI::setupMenu() // setup menu _menu->addAction(_showAction); - _menu->addMenu(_hostMenu); - _menu->addAction(_disconnectAction); + if (!_restricted) _menu->addMenu(_hostMenu); + if (!_restricted) _menu->addAction(_disconnectAction); _menu->addAction(_showInfoAction); _menu->addSeparator(); _menu->addAction(_startChatAction); _menu->addAction(_sendFileAction); _menu->addSeparator(); - _menu->addAction(_configAction); + if (!_restricted) _menu->addAction(_configAction); _menu->addAction(_aboutAction); _menu->addSeparator(); - _menu->addAction(_quitAction); + if (!_restricted) _menu->addAction(_quitAction); pvsButton->setMenu(_menu); hostButton->setMenu(_hostMenu); |