1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-03 00:18:36 +00:00

Removed stand-alone modes, scrapping a lot of code and making testing easier (because now there is only one mode to test instead of three).

svn path=/trunk/kdenetwork/krfb/; revision=147645
This commit is contained in:
Tim Jansen 2002-04-07 15:33:52 +00:00
parent 7b67352885
commit a7f422dd98
19 changed files with 63 additions and 948 deletions

1
TODO
View File

@ -5,7 +5,6 @@ Known bugs:
Todo (soon):
- fix shutdown connection in kinetd nide
- remove the standalone & command line modes (="run on demand" in kcontrol)
Todo (unscheduled features):
- SLP support (or UPnP, or whatever KDE will use)

View File

@ -9,7 +9,7 @@
<x>0</x>
<y>0</y>
<width>394</width>
<height>345</height>
<height>260</height>
</rect>
</property>
<property name="caption">
@ -28,58 +28,6 @@
<property name="spacing">
<number>6</number>
</property>
<widget class="QButtonGroup">
<property name="name">
<cstring>runModeGroup</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Run Mode</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QRadioButton">
<property name="name">
<cstring>runInBackgroundRB</cstring>
</property>
<property name="text">
<string>Always run in &amp;background</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="whatsThis" stdset="0">
<string>Select this option to have Desktop Sharing always available. It will not accept connections unless you either enable uninvited connections or invite somebody. It will use less memory while waiting and you do not have to start or stop it in order to let somebody connect to you desktop.</string>
</property>
</widget>
<widget class="QRadioButton">
<property name="name">
<cstring>runOnDemandRB</cstring>
</property>
<property name="text">
<string>Run on &amp;demand</string>
</property>
<property name="whatsThis" stdset="0">
<string>Select this option to start and stop Desktop sharing manually.</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>GroupBox1</cstring>

View File

@ -61,7 +61,6 @@ KcmKRfb::KcmKRfb(QWidget *p, const char *name, const QStringList &) :
load();
connect(m_confWidget.passwordInput, SIGNAL(textChanged(const QString&)), SLOT(configChanged()) );
connect(m_confWidget.runOnDemandRB, SIGNAL(toggled(bool)), SLOT(configChanged()) );
connect(m_confWidget.allowUninvitedCB, SIGNAL(clicked()), SLOT(configChanged()) );
connect(m_confWidget.confirmConnectionsCB, SIGNAL(clicked()), SLOT(configChanged()) );
connect(m_confWidget.allowDesktopControlCB, SIGNAL(clicked()), SLOT(configChanged()) );
@ -104,15 +103,6 @@ void KcmKRfb::load() {
bool kinetdAvailable, krfbAvailable;
checkKInetd(kinetdAvailable, krfbAvailable);
if (!krfbAvailable) {
m_confWidget.runInBackgroundRB->setEnabled(false);
m_confWidget.runOnDemandRB->setChecked(true);
}
else {
bool daemonMode = m_configuration.daemonMode();
m_confWidget.runInBackgroundRB->setChecked(daemonMode);
m_confWidget.runOnDemandRB->setChecked(!daemonMode);
}
m_confWidget.allowUninvitedCB->setChecked(m_configuration.allowUninvitedConnections());
m_confWidget.confirmConnectionsCB->setChecked(m_configuration.askOnConnect());
m_confWidget.allowDesktopControlCB->setChecked(m_configuration.allowDesktopControl());
@ -121,9 +111,8 @@ void KcmKRfb::load() {
void KcmKRfb::save() {
m_configuration.update();
bool allowUninvited = m_confWidget.allowUninvitedCB->isChecked();
bool daemonMode = !m_confWidget.runOnDemandRB->isChecked();
m_configuration.setDaemonMode(daemonMode);
m_configuration.setAllowUninvited(allowUninvited);
m_configuration.setAskOnConnect(m_confWidget.confirmConnectionsCB->isChecked());
m_configuration.setAllowDesktopControl(m_confWidget.allowDesktopControlCB->isChecked());
@ -135,15 +124,6 @@ void KcmKRfb::defaults() {
bool kinetdAvailable, krfbAvailable;
checkKInetd(kinetdAvailable, krfbAvailable);
if (!krfbAvailable) {
m_confWidget.runInBackgroundRB->setEnabled(false);
m_confWidget.runOnDemandRB->setChecked(true);
}
else {
m_confWidget.runInBackgroundRB->setEnabled(true);
m_confWidget.runInBackgroundRB->setChecked(true);
m_confWidget.runOnDemandRB->setChecked(false);
}
m_confWidget.allowUninvitedCB->setChecked(false);
m_confWidget.confirmConnectionsCB->setChecked(false);
m_confWidget.allowDesktopControlCB->setChecked(false);
@ -157,7 +137,7 @@ const KAboutData *KcmKRfb::aboutData() const
QString KcmKRfb::quickHelp() const
{
return i18n("<h1>desktop sharing</h1> This module allows you to configure"
return i18n("<h1>Desktop Sharing Configuration</h1> This module allows you to configure"
" the KDE desktop sharing.");
}

View File

@ -2,7 +2,7 @@ METASOURCES = AUTO
noinst_LIBRARIES = libkrfbconfig.a
libkrfbconfig_a_SOURCES = configuration.cc configurationdialog.ui manageinvitations.ui personalinvitation.ui \
libkrfbconfig_a_SOURCES = configuration.cc manageinvitations.ui personalinvitation.ui \
invite.ui invitation.cc configuration_hostname.cpp
@ -17,7 +17,7 @@ kde_services_DATA = kinetd_krfb.desktop
EXTRA_DIST = $(krfb_SOURCES) $(kde_services_DATA) krfb.desktop \
lo32-app-krfb.png lo16-app-krfb.png rfbcontroller.h \
eyes-closed24.png eyes-open24.png xupdatescanner.h trayicon.h \
eyes-open24.png xupdatescanner.h trayicon.h \
configuration.h invitation.h krfbiface.h krfbiface.kidl eventsrc
install-data-local:
@ -26,7 +26,6 @@ install-data-local:
$(mkinstalldirs) $(kde_datadir)/krfb
$(INSTALL_DATA) $(srcdir)/eventsrc $(kde_datadir)/krfb/eventsrc
$(mkinstalldirs) $(kde_datadir)/krfb/pics
$(INSTALL_DATA) $(srcdir)/eyes-closed24.png $(kde_datadir)/krfb/pics/eyes-closed24.png
$(INSTALL_DATA) $(srcdir)/eyes-open24.png $(kde_datadir)/krfb/pics/eyes-open24.png
$(INSTALL_DATA) $(srcdir)/connection-side-image.png $(kde_datadir)/krfb/pics/connection-side-image.png
@ -34,7 +33,6 @@ uninstall-local:
-rm -f $(kde_appsdir)/Applications/krfb.desktop
-rm -f $(kde_datadir)/krfb/eventsrc
-rm -f $(kde_datadir)/krfb/pics/eyes-open24.png
-rm -f $(kde_datadir)/krfb/pics/eyes-closed24.png
KDE_ICON = krfb

View File

@ -30,8 +30,6 @@
#include <qlineedit.h>
#include <qcheckbox.h>
void ConfigurationDialog2::closeEvent(QCloseEvent *)
{ emit closed(); }
void ManageInvitationsDialog2::closeEvent(QCloseEvent *)
{ emit closed(); }
void InvitationDialog2::closeEvent(QCloseEvent *)
@ -41,23 +39,12 @@ void PersonalInvitationDialog2::closeEvent(QCloseEvent *)
Configuration::Configuration(krfb_mode mode) :
m_mode(mode),
oneConnectionFlag(false),
portNum(-1)
{
loadFromKConfig();
saveToDialogs();
doKinetdConf();
connect(confDlg.okButton, SIGNAL(clicked()), SLOT(configOkPressed()));
connect(confDlg.cancelButton, SIGNAL(clicked()), SLOT(configCancelPressed()));
connect(confDlg.applyButton, SIGNAL(clicked()), SLOT(configApplyPressed()));
connect(&confDlg, SIGNAL(closed()), SLOT(configCancelPressed()));
connect(confDlg.passwordInput, SIGNAL(textChanged(const QString&)), SLOT(configChanged()) );
connect(confDlg.allowUninvitedCB, SIGNAL(clicked()), SLOT(configChanged()) );
connect(confDlg.askOnConnectCB, SIGNAL(clicked()), SLOT(configChanged()) );
connect(confDlg.allowDesktopControlCB, SIGNAL(clicked()), SLOT(configChanged()) );
connect(invMngDlg.closeButton, SIGNAL(clicked()), SLOT(invMngDlgClosed()));
connect(&invMngDlg, SIGNAL(closed()), SLOT(invMngDlgClosed()));
connect(invMngDlg.newButton, SIGNAL(clicked()), SLOT(showInvitationDialog()));
@ -72,39 +59,16 @@ Configuration::Configuration(krfb_mode mode) :
SLOT(showPersonalInvitationDialog()));
connect(invDlg.createInvitationEMailButton, SIGNAL(clicked()),
SLOT(inviteEmail()));
if (m_mode != KRFB_STAND_ALONE)
invDlg.dontShowOnStartupButton->hide();
connect(persInvDlg.closeButton, SIGNAL(clicked()), SLOT(persInvDlgClosed()));
connect(&persInvDlg, SIGNAL(closed()), SLOT(persInvDlgClosed()));
if ((m_mode == KRFB_STAND_ALONE) ||
(m_mode == KRFB_KINETD_MODE) ||
(m_mode == KRFB_CONFIGURATION_MODE)) {
connect(&expirationTimer, SIGNAL(timeout()), SLOT(invalidateOldInvitations()));
expirationTimer.start(1000*60);
}
}
Configuration::Configuration(bool oneConnection, bool askOnConnect,
bool allowDesktopControl, QString password) :
m_mode(KRFB_STAND_ALONE_CMDARG),
askOnConnectFlag(askOnConnect),
allowDesktopControlFlag(allowDesktopControl),
oneConnectionFlag(oneConnection),
portNum(-1),
passwordString(password)
{
connect(&expirationTimer, SIGNAL(timeout()), SLOT(invalidateOldInvitations()));
expirationTimer.start(1000*60);
}
Configuration::~Configuration() {
}
// special static method to determine daemon mode before constructor was invoked
bool Configuration::earlyDaemonMode() {
KConfig c("krfbrc");
return c.readBoolEntry("daemonMode", true);
save();
}
void Configuration::setKInetd(bool enabled) {
@ -146,14 +110,10 @@ void Configuration::setPortKInetd() {
void Configuration::removeInvitation(QValueList<Invitation>::iterator it) {
invitationList.remove(it);
doKinetdConf();
save();
}
void Configuration::doKinetdConf() {
if (!daemonFlag) {
setKInetd(false);
return;
}
if (allowUninvitedFlag) {
setKInetd(true);
@ -181,14 +141,11 @@ void Configuration::doKinetdConf() {
}
void Configuration::loadFromKConfig() {
if (KRFB_STAND_ALONE_CMDARG == mode())
return;
KConfig c("krfbrc");
daemonFlag = c.readBoolEntry("daemonMode", true);
allowUninvitedFlag = c.readBoolEntry("allowUninvited", false);
askOnConnectFlag = c.readBoolEntry("confirmUninvitedConnection", true);
allowDesktopControlFlag = c.readBoolEntry("allowDesktopControl", false);
showInvDlgOnStartupFlag = c.readBoolEntry("shovInvDlgOnStartup", false);
passwordString = c.readEntry("uninvitedPassword", "");
invitationList.clear();
@ -197,39 +154,15 @@ void Configuration::loadFromKConfig() {
for (int i = 0; i < num; i++)
invitationList.push_back(Invitation(&c, i));
confDlg.applyButton->setEnabled(false);
invalidateOldInvitations();
}
void Configuration::loadFromDialogs() {
bool oldAllowUninvitedFlag = allowUninvitedFlag;
allowUninvitedFlag = confDlg.allowUninvitedCB->isChecked();
askOnConnectFlag = confDlg.askOnConnectCB->isChecked();
allowDesktopControlFlag = confDlg.allowDesktopControlCB->isChecked();
showInvDlgOnStartupFlag = !invDlg.dontShowOnStartupButton->isChecked();
QString newPassword = confDlg.passwordInput->text();
if (passwordString != newPassword) {
passwordString = newPassword;
emit passwordChanged();
}
if (oldAllowUninvitedFlag != allowUninvitedFlag)
doKinetdConf();
}
void Configuration::saveToKConfig() {
if (KRFB_STAND_ALONE_CMDARG == mode())
return;
KConfig c("krfbrc");
c.writeEntry("daemonMode", daemonFlag);
c.writeEntry("confirmUninvitedConnection", askOnConnectFlag);
c.writeEntry("allowDesktopControl", allowDesktopControlFlag);
c.writeEntry("allowUninvited", allowUninvitedFlag);
c.writeEntry("shovInvDlgOnStartup", showInvDlgOnStartupFlag);
c.writeEntry("uninvitedPassword", passwordString);
c.setGroup("invitations");
@ -239,17 +172,9 @@ void Configuration::saveToKConfig() {
while (i < num)
invitationList[i++].save(&c, i);
confDlg.applyButton->setEnabled(false);
}
void Configuration::saveToDialogs() {
confDlg.allowUninvitedCB->setChecked(allowUninvitedFlag);
confDlg.askOnConnectCB->setChecked(askOnConnectFlag);
confDlg.allowDesktopControlCB->setChecked(allowDesktopControlFlag);
confDlg.passwordInput->setText(passwordString);
invDlg.dontShowOnStartupButton->setChecked(!showInvDlgOnStartupFlag);
invalidateOldInvitations();
QValueList<Invitation>::iterator it = invitationList.begin();
while (it != invitationList.end()) {
@ -263,38 +188,32 @@ void Configuration::saveToDialogs() {
invMngDlg.adjustSize();
}
void Configuration::reload() {
loadFromKConfig();
saveToDialogs();
}
void Configuration::save() {
saveToKConfig();
saveToDialogs();
doKinetdConf();
}
void Configuration::update() {
loadFromKConfig();
saveToDialogs();
}
Invitation Configuration::createInvitation() {
Invitation inv;
invitationList.push_back(inv);
emit passwordChanged();
doKinetdConf();
return inv;
}
void Configuration::invalidateOldInvitations() {
bool changed = false;
QValueList<Invitation>::iterator it = invitationList.begin();
while (it != invitationList.end()) {
if (!(*it).isValid()) {
if (!(*it).isValid())
it = invitationList.remove(it);
changed = true;
}
else
it++;
}
if (changed)
emit passwordChanged();
}
///////// properties ///////////////////////////
@ -303,10 +222,6 @@ krfb_mode Configuration::mode() const {
return m_mode;
}
bool Configuration::oneConnection() const {
return oneConnectionFlag;
}
bool Configuration::askOnConnect() const {
return askOnConnectFlag;
}
@ -319,14 +234,6 @@ bool Configuration::allowUninvitedConnections() const {
return allowUninvitedFlag;
}
bool Configuration::showInvitationDialogOnStartup() const {
return showInvDlgOnStartupFlag;
}
bool Configuration::daemonMode() const {
return daemonFlag;
}
QString Configuration::password() const {
return passwordString;
}
@ -335,19 +242,10 @@ QValueList<Invitation> &Configuration::invitations() {
return invitationList;
}
void Configuration::setDaemonMode(bool daemonMode) {
daemonFlag = daemonMode;
}
void Configuration::setAllowUninvited(bool allowUninvited) {
allowUninvitedFlag = allowUninvited;
}
void Configuration::setOnceConnection(bool oneConnection)
{
oneConnectionFlag = oneConnection;
}
void Configuration::setAskOnConnect(bool askOnConnect)
{
askOnConnectFlag = askOnConnect;
@ -361,7 +259,6 @@ void Configuration::setAllowDesktopControl(bool allowDesktopControl)
void Configuration::setPassword(QString password)
{
passwordString = password;
emit passwordChanged();
}
int Configuration::port() const
@ -372,58 +269,20 @@ int Configuration::port() const
return portNum - 5900;
}
void Configuration::setPort(int p) {
portNum = p;
}
// hostname is implemented in configuration_hostname.cpp
// QString Configuration::hostname()
////////////// config dialog //////////////////////////
void Configuration::showConfigDialog() {
if (m_mode == KRFB_KINETD_MODE) {
KProcess p;
p << "kcmshell" << "kcmkrfb";
p.start(KProcess::DontCare);
}
else {
loadFromKConfig();
saveToDialogs();
confDlg.show();
}
}
void Configuration::configOkPressed() {
loadFromDialogs();
saveToKConfig();
confDlg.hide();
}
void Configuration::configCancelPressed() {
saveToDialogs();
confDlg.hide();
}
void Configuration::configApplyPressed() {
loadFromDialogs();
saveToKConfig();
}
void Configuration::configChanged() {
confDlg.applyButton->setEnabled(true);
}
////////////// invitation manage dialog //////////////////////////
void Configuration::showManageInvitationsDialog() {
loadFromKConfig();
saveToDialogs();
invMngDlg.show();
}
void Configuration::invMngDlgClosed() {
invMngDlg.hide();
saveToKConfig();
}
void Configuration::invMngDlgDeleteOnePressed() {
@ -436,14 +295,13 @@ void Configuration::invMngDlgDeleteOnePressed() {
else
it++;
}
emit passwordChanged();
saveToKConfig();
doKinetdConf();
}
void Configuration::invMngDlgDeleteAllPressed() {
invitationList.clear();
saveToKConfig();
emit passwordChanged();
doKinetdConf();
}
@ -460,7 +318,6 @@ void Configuration::invDlgClosed() {
}
void Configuration::closeInvDlg() {
loadFromDialogs();
saveToKConfig();
invDlg.hide();
invMngDlg.newButton->setEnabled(true);

View File

@ -20,7 +20,6 @@
#include "invitation.h"
#include "configurationdialog.h"
#include "manageinvitations.h"
#include "personalinvitation.h"
#include "invite.h"
@ -33,20 +32,11 @@
enum krfb_mode {
KRFB_UNKNOWN_MODE = 0,
KRFB_STAND_ALONE,
KRFB_STAND_ALONE_CMDARG,
KRFB_KINETD_MODE,
KRFB_INVITATION_MODE,
KRFB_CONFIGURATION_MODE
};
class ConfigurationDialog2 : public ConfigurationDialog {
Q_OBJECT
public:
virtual void closeEvent(QCloseEvent *);
signals:
void closed();
};
class ManageInvitationsDialog2 : public ManageInvitationsDialog {
Q_OBJECT
public:
@ -78,47 +68,35 @@ class Configuration : public QObject {
Q_OBJECT
public:
Configuration(krfb_mode mode);
Configuration(bool oneConnection, bool askOnConnect,
bool allowDesktopControl, QString password);
~Configuration();
static bool earlyDaemonMode();
krfb_mode mode() const;
bool oneConnection() const;
bool askOnConnect() const;
bool allowDesktopControl() const;
bool allowUninvitedConnections() const;
bool showInvitationDialogOnStartup() const;
bool daemonMode() const;
QString password() const;
QString hostname() const;
int port() const;
void setDaemonMode(bool daemonMode);
void setAllowUninvited(bool allowUninvited);
void setOnceConnection(bool oneConnection);
void setAskOnConnect(bool askOnConnect);
void setAllowDesktopControl(bool allowDesktopControl);
void setPassword(QString password);
void reload();
void save();
void update();
QValueList<Invitation> &invitations();
void removeInvitation(QValueList<Invitation>::iterator it);
signals:
void passwordChanged();
void invitationFinished();
public slots:
void showConfigDialog();
void showManageInvitationsDialog();
void showInvitationDialog();
void showPersonalInvitationDialog();
void inviteEmail();
void invalidateOldInvitations();
void setPort(int);
private:
void loadFromKConfig();
void loadFromDialogs();
@ -133,7 +111,6 @@ private:
krfb_mode m_mode;
ConfigurationDialog2 confDlg;
ManageInvitationsDialog2 invMngDlg;
InvitationDialog2 invDlg;
PersonalInvitationDialog2 persInvDlg;
@ -142,20 +119,12 @@ private:
bool askOnConnectFlag;
bool allowDesktopControlFlag;
bool allowUninvitedFlag;
bool oneConnectionFlag;
bool daemonFlag;
bool showInvDlgOnStartupFlag;
int portNum;
QString passwordString;
QValueList<Invitation> invitationList;
private slots:
void configOkPressed();
void configCancelPressed();
void configApplyPressed();
void configChanged();
void invMngDlgClosed();
void invMngDlgDeleteOnePressed();
void invMngDlgDeleteAllPressed();

View File

@ -1,279 +0,0 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>ConfigurationDialog</class>
<widget class="QDialog">
<property name="name">
<cstring>ConfigurationDialog</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>255</height>
</rect>
</property>
<property name="caption">
<string>Configuration - Desktop Sharing</string>
</property>
<property name="icon">
<pixmap>image0</pixmap>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QFrame">
<property name="name">
<cstring>Frame7</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property name="layoutMargin" stdset="0">
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>allowUninvitedCB</cstring>
</property>
<property name="text">
<string>Allow &amp;uninvited connections</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="toolTip" stdset="0">
<string></string>
</property>
<property name="whatsThis" stdset="0">
<string>Allow connections that do not follow a previous invitation. Be careful to protect your computer when you allow this.</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>askOnConnectCB</cstring>
</property>
<property name="text">
<string>Confirm connection &amp;before accepting</string>
</property>
<property name="whatsThis" stdset="0">
<string>If this option is enabled, you will be asked whenever a remote user tries to connect to your display. This allows you to deny the request or to remove things that the remote user should not see before he connects. It is highly recommended to turn this on while you are working on this computer. If you do not enable this option, your only hint that somebody is connected is the small icon in your panel, showing an open eye.</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>allowDesktopControlCB</cstring>
</property>
<property name="text">
<string>Allow &amp;remote client to control the desktop</string>
</property>
<property name="whatsThis" stdset="0">
<string>If you turn this option on, the remote user can enter keystrokes and use your mouse pointer. This gives him full control over your computer, so be careful. When the option is disabled the remote user can only watch your screen.</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QFrame">
<property name="name">
<cstring>Frame4</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property name="layoutMargin" stdset="0">
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QLabel">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Password:</string>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>passwordInput</cstring>
</property>
<property name="maxLength">
<number>9</number>
</property>
<property name="echoMode">
<enum>Password</enum>
</property>
<property name="whatsThis" stdset="0">
<string>If you want to protect your system with a password, enter one here. It is highly recommended that you either do this or enable "ask before remote client connects".</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QFrame">
<property name="name">
<cstring>Frame6</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property name="layoutMargin" stdset="0">
</property>
<property name="layoutSpacing" stdset="0">
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>4</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>applyButton</cstring>
</property>
<property name="text">
<string>&amp;Apply</string>
</property>
<property name="whatsThis" stdset="0">
<string>Click this to apply the changes immediately.</string>
</property>
</widget>
<spacer>
<property name="name" stdset="0">
<cstring>Spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>okButton</cstring>
</property>
<property name="text">
<string>&amp;Ok</string>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="whatsThis" stdset="0">
<string>Apply changes and close window.</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>cancelButton</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="whatsThis" stdset="0">
<string>Discard all changes and close window.</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<images>
<image name="image0">
<data format="XPM.GZ" length="8078">789cdd98c7721cc91186ef7c0a04f3c650d4b637a1d001de5b8200880d1db2da604038c29b0dbdbb32ffeceec582b30448015a85fa2726e69b32592633ab9abf7c98d8db589df8f0cbbbcb2bbe3aac26aa115f4c7ca8af4f4eee7ffde73f7e7bf73e2926e45f144413d1fbbfbd7bbf7935514dac9d9d360a540a50204f91827707f6e09d9ecb045c0c8c726e7be600e579cfde787960eb7f69e01cbc38b08d67a6e7cadaef0d8cc15336b0f5b73270095e1898c1d33dd7d65f3a30ca997b6eac7c75e00a3cdf738bf9f36dc789f5cfdd78c3a8e3bb9ebbfa67c651d0b4e059e3b4ecca0fc06110e636ff29701224b5958fc07990e7982f1f838ba0c863d4bfeb990bf06dcfb65eecc0555065980faff45cdafc6e94c57c5085e0497012266cfd7f06a761da98fd7be3346d6d3e042ec222857d5eee39afc14b3d97369e4d30879cc31e1f82abb04a8dbf2847611426d6df09b8888a18fdd145cf564ee7039bbd4fe0322a131baf0773c4dd78578de3dcfc81bf1a6741577e04aea22a36ffb4f2366a538cdf61be71a002c37f623c688f7889b3986d3c740dce55ca1efb19972a947f04b30a7c05ae5460ac775cabd0ff3eb851c13ee697a8c398ff263d77fe760ad60db5f5c57e26910aed2b70ac42f95ec789ad1f617f123c28dfedd8a7660ff3497215cae14f89ec4e6bf383ff279cb0ad1f617f13af427dc46bd2a850bedf73b71f5bc659d2f9f38331e7564e985faa0e6af35b372eb8b6f961fc69a44239e22b8d55e035e33ca96dbf108f291e30fc2fcd5560c45f5aa49dbfd343cfa5cd7f71602b877fa4a50ae3413e49598572f853ea5528477e936013a11cf34f5b1518fb95052ad4477916aac073e04805463ece6215da07e04485f20d70aa02637db24285f94c0f0cfb0ef3cd4a15fac3fa659c716bf9cfec3377f1e642709575f9c7213eb24605b6f1b42af477a98c70c1781dfc01ee65feb7615c8a03a17c1b8c0d427bc4439ea9c0c87f391eb4afc1850aede17f79a902233fe75e0546fce5950a6ced1b1518f92c6f5560c46fa109d8e263aee7ce5fd1bed08465fb83f82f621518fe05f7b2fd803f633b301f1781310130fcadc083fe91bfc4f94428473e90c34104463e2abc0aeb61e5f5b01e8db10a8cfd281a15ea6f1bcbf6dbfa20df16ad0a8c7c50062a30e2bfd4846cf385bf20fd59fc7d34f67965ed11cf65a2c27c62b0844fe74fc83f703fac8747fc9479ef1fd41aabd03fe683e5b0f9e1bc2ef18011dfa55781719e9655d99d8f0ef9a0ac55b067fd377dff0ee74fd9aac028e780bbfb9047bc72d8f7478db10af5b15fac0794e527c4030febe30f3aeec7931aab501ff1cdc9b0bf38df905ecc7f70bf630d50ac175bfba2efdf4d1b73777f7038afb954c13efc957def8fdec65f0dfe3569ac42ff8877ae5311eab3f130be0b631518e7918f5460ecb78f55609cbf382e2cfe71fff4591cc6b67e386fe0ce367e9c5fd84e1b1fee239e55606b5fa9c0b82ff95a85fe111fbef56d63fb8178ab8234b0f3cee1fe54e985c5ce1b8cb78afaf3c0e17cc3f16dfb83f8a9121518f9bd2afaf561ac078663f1087fa9e5f6d79d7fe71db71d633feb34f4a1ddcf118f75a502aff7dcd59f346eea8e919f6a3cd81fe4c7bad11b0f18f9b389faf5a559631518ebd170d3e577c27e3778c0c8cf4807666fbe63dfd547be40b8d8f981fcd9e251debc7a5bfd3fd970f4b6ea6cb0f3ae7a1379c79d0def6ad7bc896ae73b1b9550fb266a5cf5071b076ef48a3318497fdfda18b9c357dc8943e9ef5b1bc2afe84f439fdfda18efe3eecb78fd594cfc6fd9403f47eed89db85377e6beba737c5ec86f47ee12ba72d7eee65b7b2fb1d18df356dadfc1c6bd7b7093d2df949b76336e56becdb979b720658b6ec92dbb15b7ea7ecec68d5b73eb9d8d0de97bd36db98f6e5b2cad49ff7332ab4f52b2e376dd9eb4fe211bd2fb9e8cebb3accb2c32c0a6db7781f4baef42c8beebe7ba8bc4eeb1cc65512c0d6bf6021bb72e76898c3b95fe16e4db9cacd4becb9e7c6ebb5c4a75fd1624166a996d2163bb79a18d52685dfa08c9c96865e5895c46fce433971a819b222f9f3955549346f7f5f33630df496aa5fd9cf4f3209f0734a2c331fa227bd4d721cc6ec10574841ebe6fe356b4a4eb43c774e20ee994cee82b9dd3c5139dcbaf67526a3aa64bf7402c6b78891ebe6fa3141d637d8ec5c2155d4b5f37744b774f742bbf7e9552d3bd58913594b98cd0c3f76d8c44fbb63e92d7127aa0499aa2699a79a269f975524a5b95ccbb5fbd7df1e6fbefdba04b99f59c3b84029aa5399aa705e973919668b9d392d00cadd02aadd13a6dd026cdcabea38dcc678bb69eb1712ffa28b557685b2c7c1a6c2cd10eed76da119aa13db1f299f6c5caa6d49ba56d8976b1213bbff0cc5a8928704b144acb88624a28a58c722aa864c7e2b4eca814ca75c5e4a5de7325354da15be25a6672fcbc0d6eac8dbc257866f4d5f2018ff810a587f2ed80db3136b44df3fcf9f1a73646fc858f507a24df466f62e3984ffa338e4f84feaa79c8ce4b0efa791b2fd90ff1603e7d990dc955f0abdf6d8cf5ab8c523ee3af7cde8de8c2ad0f169ecfbb44a77cc9577ccd3712012b120963e2836ff98eeff98127bb55bab4de5f98dbe517b132c5d37c2d91bc2a56c6c439cff02ccff124cf77abb4f023365047577ec15df2222ff132af3ccd57bcca6bbcce1bac2f5f8dd45b787cdff8817bc97023e3cda77997b7f823eb4938d4f9c9bbcfef363e3d3d3f788777794f6efcffa18d71d69eeaf5ee893faabfdec6ab69bc0dbc7ff067de7f95b7c3f1ef1f788fa223b9535db9377a8fe280438e38e6c48d38e54cbe871cd87b1d37b84b8ce49e7b80d1ac0ddf1f973eae33f67d90732eb8f4ce935bf3ec3d97c27957774dee43aa44eef1adfc25c3f7c7a58feb8cb5e12bce7ded1b2fe3f40762a516aebaba07729b55ddc93b482b7f77c3f7c7a58feb3cb1e147725b997a0bd1961ffd17ff2fe36d6dfcebefeffe0dd22dc353</data>
</image>
</images>
<connections>
<connection>
<sender>allowUninvitedCB</sender>
<signal>toggled(bool)</signal>
<receiver>askOnConnectCB</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>allowUninvitedCB</sender>
<signal>toggled(bool)</signal>
<receiver>allowDesktopControlCB</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>allowUninvitedCB</sender>
<signal>toggled(bool)</signal>
<receiver>Frame4</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
<layoutdefaults spacing="6" margin="11"/>
</UI>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 B

View File

@ -170,17 +170,6 @@
<string>This button will start your email application with a pre-configured text that explains to the recipient how to connect to your computer. </string>
</property>
</widget>
<widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>dontShowOnStartupButton</cstring>
</property>
<property name="text">
<string>&amp;Do not show this dialog on startup</string>
</property>
<property name="whatsThis" stdset="0">
<string>If you enable this option, this screen will not be shown at each startup in the future.</string>
</property>
</widget>
<widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>TextLabel1</cstring>

View File

@ -8,55 +8,11 @@ class krfbIface : virtual public DCOPObject
K_DCOP
k_dcop:
/**
* If a client is connected it will be disconnected.
*/
virtual void disconnect() = 0;
/**
* Quits krfb, connected clients will be disconnected.
*/
virtual void exit() = 0;
/**
* Tells krfb to re-load the configuration. This is usually
* called by the KControl module.
*/
virtual void reloadConfig() = 0;
/**
* If true krfb will disconnect after a client disconnected.
* @return true if oneConnection feature is turned on
*/
virtual bool oneConnection() = 0;
/**
* If set to true krfb will disconnect after a client disconnected.
* @param o true to turn oneConnection feature on.
*/
virtual void setOneConnection(bool o) = 0;
/**
* If this feature is activated krfb will ask the user before an incomning
* connection will be accepted.
* @return true if askOnConnect is activated
*/
virtual bool askOnConnect() = 0;
/**
* If this feature is activated krfb will ask the user before an incomning
* connection will be accepted.
* @param a true to turn the askOnConnect feature on.
*/
virtual void setAskOnConnect(bool a) = 0;
/**
* If this feature is activated krfb allows the connecting client to
* control the desktop (pointer & keyboard).
* @return true if desktop control is activated
*/
virtual bool allowDesktopControl() = 0;
/**
* If this feature is activated krfb allows the connecting client to
* control the desktop (pointer & keyboard).
@ -64,18 +20,5 @@ k_dcop:
*/
virtual void setAllowDesktopControl(bool a) = 0;
/**
* Sets the password for uninvited sessions. An empty password can be used
* to deactivate the password authentication, but only if krfb is in
* stand-alone mode.
* @param p the password to set
*/
virtual void setPassword(QString p) = 0;
/**
* Returns the port the server is listening on.
* @return the tcp port of the server
*/
virtual int port() = 0;
};
#endif

View File

@ -9,96 +9,26 @@
#include "./krfbiface.h"
#include <kdatastream.h>
#include <qasciidict.h>
static const int krfbIface_fhash = 13;
static const char* const krfbIface_ftable[12][3] = {
{ "void", "disconnect()", "disconnect()" },
static const char* const krfbIface_ftable[3][3] = {
{ "void", "exit()", "exit()" },
{ "void", "reloadConfig()", "reloadConfig()" },
{ "bool", "oneConnection()", "oneConnection()" },
{ "void", "setOneConnection(bool)", "setOneConnection(bool o)" },
{ "bool", "askOnConnect()", "askOnConnect()" },
{ "void", "setAskOnConnect(bool)", "setAskOnConnect(bool a)" },
{ "bool", "allowDesktopControl()", "allowDesktopControl()" },
{ "void", "setAllowDesktopControl(bool)", "setAllowDesktopControl(bool a)" },
{ "void", "setPassword(QString)", "setPassword(QString p)" },
{ "int", "port()", "port()" },
{ 0, 0, 0 }
};
bool krfbIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
{
static QAsciiDict<int>* fdict = 0;
if ( !fdict ) {
fdict = new QAsciiDict<int>( krfbIface_fhash, TRUE, FALSE );
for ( int i = 0; krfbIface_ftable[i][1]; i++ )
fdict->insert( krfbIface_ftable[i][1], new int( i ) );
}
int* fp = fdict->find( fun );
switch ( fp?*fp:-1) {
case 0: { // void disconnect()
if ( fun == krfbIface_ftable[0][1] ) { // void exit()
replyType = krfbIface_ftable[0][0];
disconnect( );
} break;
case 1: { // void exit()
replyType = krfbIface_ftable[1][0];
exit( );
} break;
case 2: { // void reloadConfig()
replyType = krfbIface_ftable[2][0];
reloadConfig( );
} break;
case 3: { // bool oneConnection()
replyType = krfbIface_ftable[3][0];
QDataStream _replyStream( replyData, IO_WriteOnly );
_replyStream << oneConnection( );
} break;
case 4: { // void setOneConnection(bool)
} else if ( fun == krfbIface_ftable[1][1] ) { // void setAllowDesktopControl(bool)
bool arg0;
QDataStream arg( data, IO_ReadOnly );
arg >> arg0;
replyType = krfbIface_ftable[4][0];
setOneConnection(arg0 );
} break;
case 5: { // bool askOnConnect()
replyType = krfbIface_ftable[5][0];
QDataStream _replyStream( replyData, IO_WriteOnly );
_replyStream << askOnConnect( );
} break;
case 6: { // void setAskOnConnect(bool)
bool arg0;
QDataStream arg( data, IO_ReadOnly );
arg >> arg0;
replyType = krfbIface_ftable[6][0];
setAskOnConnect(arg0 );
} break;
case 7: { // bool allowDesktopControl()
replyType = krfbIface_ftable[7][0];
QDataStream _replyStream( replyData, IO_WriteOnly );
_replyStream << allowDesktopControl( );
} break;
case 8: { // void setAllowDesktopControl(bool)
bool arg0;
QDataStream arg( data, IO_ReadOnly );
arg >> arg0;
replyType = krfbIface_ftable[8][0];
replyType = krfbIface_ftable[1][0];
setAllowDesktopControl(arg0 );
} break;
case 9: { // void setPassword(QString)
QString arg0;
QDataStream arg( data, IO_ReadOnly );
arg >> arg0;
replyType = krfbIface_ftable[9][0];
setPassword(arg0 );
} break;
case 10: { // int port()
replyType = krfbIface_ftable[10][0];
QDataStream _replyStream( replyData, IO_WriteOnly );
_replyStream << port( );
} break;
default:
} else {
return DCOPObject::process( fun, data, replyType, replyData );
}
return TRUE;

View File

@ -11,75 +11,18 @@
KRfbIfaceImpl::KRfbIfaceImpl(Configuration *c) :
DCOPObject("krfbIface"),
configuration(c),
portNum(0)
{
}
void KRfbIfaceImpl::disconnect()
{
emit connectionClosed();
}
/*
void KRfbIfaceImpl::setWindowID(int)
configuration(c)
{
}
*/
void KRfbIfaceImpl::exit()
{
emit exitApp();
}
void KRfbIfaceImpl::reloadConfig()
{
return configuration->reload();
}
bool KRfbIfaceImpl::oneConnection()
{
return configuration->oneConnection();
}
void KRfbIfaceImpl::setOneConnection(bool b)
{
configuration->setOnceConnection(b);
configuration->save();
}
bool KRfbIfaceImpl::askOnConnect()
{
return configuration->askOnConnect();
}
void KRfbIfaceImpl::setAskOnConnect(bool b)
{
configuration->setAskOnConnect(b);
configuration->save();
}
bool KRfbIfaceImpl::allowDesktopControl()
{
return configuration->allowDesktopControl();
}
void KRfbIfaceImpl::setAllowDesktopControl(bool b)
{
configuration->setAllowDesktopControl(b);
configuration->save();
}
void KRfbIfaceImpl::setPassword(QString password)
{
configuration->setPassword(password);
configuration->save();
}
int KRfbIfaceImpl::port()
{
return portNum;
}
/*
* Note that setPort() is not a DCOP function, but a slot that's
* connected to RFBController to get the autoprobed port.
*/
void KRfbIfaceImpl::setPort(int p)
{
portNum = p;
}
#include "krfbifaceimpl.moc"

View File

@ -10,29 +10,13 @@ class KRfbIfaceImpl : public QObject, public virtual krfbIface
Q_OBJECT
private:
Configuration *configuration;
int portNum;
public:
KRfbIfaceImpl(Configuration *c);
signals:
void connectionClosed();
void exitApp();
public slots:
void setPort(int p);
public:
void disconnect();
// void setWindowID(int);
void exit();
void reloadConfig();
bool oneConnection();
void setOneConnection(bool);
bool askOnConnect();
void setAskOnConnect(bool);
bool allowDesktopControl();
void setAllowDesktopControl(bool);
void setPassword(QString);
int port();
};
#endif

View File

@ -43,51 +43,16 @@
static const char *description = I18N_NOOP("VNC-compatible server to share "
"KDE desktops");
#define ARG_ONE_SESSION "one-session"
#define ARG_PASSWORD "password"
#define ARG_DONT_CONFIRM_CONNECT "dont-confirm-connect"
#define ARG_REMOTE_CONTROL "remote-control"
#define ARG_STAND_ALONE "stand-alone"
#define ARG_KINETD "kinetd"
static KCmdLineOptions options[] =
{
{ "o", 0, 0},
{ ARG_ONE_SESSION, I18N_NOOP("Terminate when the first session is finished."), 0},
{ "w", 0, 0},
{ ARG_PASSWORD " ", I18N_NOOP("Set the password."), ""},
{ "d", 0, 0},
{ ARG_DONT_CONFIRM_CONNECT, I18N_NOOP("Allow connections without asking the user."), 0},
{ "c", 0, 0},
{ ARG_REMOTE_CONTROL, I18N_NOOP("Allow remote side to control this computer."), 0},
{ "s", 0, 0},
{ ARG_STAND_ALONE, I18N_NOOP("Standalone mode: do not use daemon."), 0},
{ ARG_KINETD " ", I18N_NOOP("Used for calling from kinetd."), 0},
{ 0, 0, 0 }
};
/*
* KRfb can run in 4 different modes:
* - stand-alone
* + To get there call KRfb with kinetd disabled in KConfig (use KControl module)
* + traditional mode like <0.7 versions
* + uses non-kcm configuration dialog
* + invitation on start-up can be disabled
* - stand-alone with command line args
* + to get there call krfb any cmd line args (except --kinetd)
* + behaves like stand-alone, but without configuration & invitations
* - kinetd mode
* + started using the --kinetd argument
* + used for starting from kinetd
* + takes socket fd from cmd args
* + exits after connection is finished
* + config option calls kcontrol module
* - invitation mode
* + started when krfb is called while kinetd is enabled and no cmd line arg is given
* + displays only invitation dialog and finishs then
* + does not accept connections, no tray icon
*
* TODO:
* - fix bug on 'close connection' in kinetd mode
*/
@ -115,8 +80,6 @@ void checkKInetd(bool &kinetdAvailable, bool &krfbAvailable) {
int main(int argc, char *argv[])
{
enum krfb_mode mode = KRFB_UNKNOWN_MODE;
KAboutData aboutData( "krfb", I18N_NOOP("Desktop Sharing"),
VERSION, description, KAboutData::License_GPL,
"(c) 2001-2002, Tim Jansen\n"
@ -151,68 +114,38 @@ int main(int argc, char *argv[])
Configuration *config;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QString fdString;
if (args->isSet(ARG_ONE_SESSION) ||
args->isSet(ARG_PASSWORD) ||
args->isSet(ARG_REMOTE_CONTROL) ||
args->isSet(ARG_DONT_CONFIRM_CONNECT)) {
bool oneConnection = args->isSet(ARG_ONE_SESSION);
bool askOnConnect = !args->isSet(ARG_DONT_CONFIRM_CONNECT);
bool allowDesktopControl = args->isSet(ARG_REMOTE_CONTROL);
QString password = args->getOption(ARG_PASSWORD);
mode = KRFB_STAND_ALONE_CMDARG;
config = new Configuration(oneConnection, askOnConnect,
allowDesktopControl, password);
}
else {
if (args->isSet(ARG_STAND_ALONE)) {
mode = KRFB_STAND_ALONE;
}
else if (args->isSet(ARG_KINETD)) {
fdString = args->getOption(ARG_KINETD);
mode = KRFB_KINETD_MODE;
}
if (mode == KRFB_UNKNOWN_MODE) {
if (Configuration::earlyDaemonMode()) {
bool kinetdA, krfbA;
mode = KRFB_INVITATION_MODE;
checkKInetd(kinetdA, krfbA);
if (!kinetdA) {
KMessageBox::error(0,
i18n("Cannot find KInetD. "
"Have you restarted KDE after installation?"),
i18n("Desktop Sharing Error"));
return 1;
}
if (!krfbA) {
KMessageBox::error(0,
i18n("Cannot find KInetD service for Desktop Sharing (KRfb). "
"Have you restarted KDE after installation?"),
i18n("Desktop Sharing Error"));
return 1;
}
}
else
mode = KRFB_STAND_ALONE;
}
config = new Configuration(mode);
if ((mode == KRFB_KINETD_MODE) &&
(!config->allowUninvitedConnections()) &&
(config->invitations().size() == 0)) {
KNotifyClient::event("UnexpectedConnection");
if (!args->isSet(ARG_KINETD)) {
bool kinetdA, krfbA;
checkKInetd(kinetdA, krfbA);
if (!kinetdA) {
KMessageBox::error(0,
i18n("Cannot find KInetD. "
"Have you restarted KDE after installation?"),
i18n("Desktop Sharing Error"));
return 1;
}
if (!krfbA) {
KMessageBox::error(0,
i18n("Cannot find KInetD service for Desktop Sharing (KRfb). "
"Have you restarted KDE after installation?"),
i18n("Desktop Sharing Error"));
return 1;
}
}
args->clear();
if (mode == KRFB_INVITATION_MODE) {
config = new Configuration(KRFB_INVITATION_MODE);
config->showInvitationDialog();
QObject::connect(config, SIGNAL(invitationFinished()),
&app, SLOT(quit()));
return app.exec();
}
fdString = args->getOption(ARG_KINETD);
config = new Configuration(KRFB_KINETD_MODE);
args->clear();
if ((!config->allowUninvitedConnections()) && (config->invitations().size() == 0)) {
KNotifyClient::event("UnexpectedConnection");
return 1;
}
if (!RFBController::checkX11Capabilities())
return 1;
@ -228,59 +161,29 @@ int main(int argc, char *argv[])
QObject::connect(&app, SIGNAL(lastWindowClosed()),
&app, SLOT(quit()));
QObject::connect(&trayicon, SIGNAL(connectionClosed()),
&controller, SLOT(closeConnection()));
QObject::connect(&trayicon, SIGNAL(showConfigure()),
config, SLOT(showConfigDialog()));
QObject::connect(&trayicon, SIGNAL(showManageInvitations()),
config, SLOT(showManageInvitationsDialog()));
QObject::connect(&controller, SIGNAL(portProbed(int)),
config, SLOT(setPort(int)));
QObject::connect(&dcopiface, SIGNAL(connectionClosed()),
&controller, SLOT(closeConnection()));
QObject::connect(&dcopiface, SIGNAL(exitApp()),
&app, SLOT(quit()));
QObject::connect(config, SIGNAL(passwordChanged()),
&controller, SLOT(passwordChanged()));
QObject::connect(&controller, SIGNAL(portProbed(int)),
&dcopiface, SLOT(setPort(int)));
QObject::connect(&controller, SIGNAL(sessionEstablished()),
&trayicon, SLOT(openConnection()));
if (config->oneConnection() || (mode == KRFB_KINETD_MODE)) {
QObject::connect(&controller, SIGNAL(sessionRefused()),
&app, SLOT(quit()));
QObject::connect(&controller, SIGNAL(sessionFinished()),
&app, SLOT(quit()));
} else {
QObject::connect(&controller, SIGNAL(sessionFinished()),
&trayicon, SLOT(closeConnection()));
}
QObject::connect(&controller, SIGNAL(sessionRefused()),
&app, SLOT(quit()));
QObject::connect(&controller, SIGNAL(sessionFinished()),
&app, SLOT(quit()));
sigset_t sigs;
sigemptyset(&sigs);
sigaddset(&sigs, SIGPIPE);
sigprocmask(SIG_BLOCK, &sigs, 0);
if (mode == KRFB_KINETD_MODE) {
bool ok;
int fdNum = fdString.toInt(&ok);
if (!ok) {
kdError() << "kinetd fd was not numeric." << endl;
return 2;
}
controller.startServer(fdNum);
bool ok;
int fdNum = fdString.toInt(&ok);
if (!ok) {
kdError() << "kinetd fd was not numeric." << endl;
return 2;
}
else
controller.startServer();
if (config->showInvitationDialogOnStartup())
config->showInvitationDialog();
controller.startServer(fdNum);
return app.exec();
}

View File

@ -324,9 +324,7 @@ void RFBController::startServer(int inetdFd, bool xtestGrab)
server->frameBuffer = fb;
server->autoPort = TRUE;
if (inetdFd >= 0)
server->inetdSock = inetdFd;
server->inetdSock = inetdFd;
server->kbdAddEvent = keyboardHook;
server->ptrAddEvent = pointerHook;
@ -344,9 +342,6 @@ void RFBController::startServer(int inetdFd, bool xtestGrab)
rfbInitServer(server);
state = RFB_WAITING;
if (inetdFd < 0)
emit portProbed(server->rfbPort);
if (xtestGrab) {
disabler.disable = false;
XTestGrabControl(qt_xdisplay(), true);
@ -369,12 +364,6 @@ void RFBController::stopServer(bool xtestUngrab)
}
}
void RFBController::rebind()
{
stopServer(false);
startServer(-1, false);
}
void RFBController::connectionAccepted(bool aRC)
{
if (state != RFB_CONNECTING)
@ -447,10 +436,7 @@ void RFBController::connectionClosed()
void RFBController::closeConnection()
{
if (state == RFB_CONNECTED) {
if (server->inetdSock >= 0) {
close(server->inetdSock);
emit sessionFinished();
}
emit sessionFinished();
if (!checkAsyncEvents()) {
asyncMutex.lock();
if (!closePending)
@ -642,11 +628,6 @@ void RFBController::passwordChanged() {
server->rfbAuthPasswdData = (void*) (authRequired ? 1 : 0);
}
int RFBController::getPort()
{
return server->rfbPort;
}
void RFBController::sendKNotifyEvent(const QString &n, const QString &d)
{
asyncMutex.lock();

View File

@ -134,7 +134,6 @@ public:
static bool checkX11Capabilities();
public slots:
void rebind();
void passwordChanged();
void closeConnection();
@ -142,7 +141,6 @@ signals:
void sessionEstablished();
void sessionFinished();
void sessionRefused();
void portProbed(int);
private:
void stopServer(bool xtestUngrab = true);

View File

@ -31,19 +31,10 @@ TrayIcon::TrayIcon(KDialog *d, Configuration *c) :
{
KIconLoader *loader = KGlobal::iconLoader();
trayIconOpen = loader->loadIcon("eyes-open24", KIcon::User);
trayIconClosed = loader->loadIcon("eyes-closed24", KIcon::User);
setPixmap(trayIconClosed);
setPixmap(trayIconOpen);
configureAction = KStdAction::preferences(this, SIGNAL(showConfigure()), &actionCollection);
manageInvitationsAction = new KAction(i18n("Manage &invitations"), QString::null, 0, this, SIGNAL(showManageInvitations()), &actionCollection);
if (c->mode() != KRFB_STAND_ALONE_CMDARG) {
configureAction->plug(contextMenu());
manageInvitationsAction->plug(contextMenu());
}
closeConnectionAction = new KAction(i18n("Cl&ose connection"), QString::null, 0, this, SLOT(connectionClose), &actionCollection);
closeConnectionAction->plug(contextMenu());
closeConnectionAction->setEnabled(false);
manageInvitationsAction->plug(contextMenu());
contextMenu()->insertSeparator();
aboutAction = KStdAction::aboutApp(this, SLOT(showAbout()), &actionCollection);
@ -55,16 +46,6 @@ TrayIcon::TrayIcon(KDialog *d, Configuration *c) :
TrayIcon::~TrayIcon(){
}
void TrayIcon::openConnection(){
setPixmap(trayIconOpen);
closeConnectionAction->setEnabled(true);
}
void TrayIcon::closeConnection(){
setPixmap(trayIconClosed);
closeConnectionAction->setEnabled(false);
}
void TrayIcon::showAbout() {
aboutDialog->show();
}

View File

@ -37,22 +37,13 @@ public:
TrayIcon(KDialog*, Configuration*);
~TrayIcon();
public slots:
void closeConnection();
void openConnection();
signals:
void connectionClosed();
void showConfigure();
void showManageInvitations();
private:
KPixmap trayIconOpen;
KPixmap trayIconClosed;
KDialog* aboutDialog;
KActionCollection actionCollection;
KAction* closeConnectionAction;
KAction* configureAction;
KAction* manageInvitationsAction;
KAction* aboutAction;