Patch by Karl Vogel: add option to disable the kdesktop wallpaper

when a client connects.

(Also fixes a few problems with shortcuts in the KCM dialog)

svn path=/trunk/kdenetwork/krfb/; revision=200408
This commit is contained in:
Tim Jansen
2003-01-16 20:23:26 +00:00
parent 2c39f61d4d
commit fc0d25ee39
8 changed files with 125 additions and 13 deletions

10
TODO
View File

@@ -2,18 +2,18 @@
For 3.2: For 3.2:
- write SLP service template for remote desktop protocols - write SLP service template for remote desktop protocols
(documentation) (documentation)
- when krfb is started with URL arguments and without connection - extend VNC to enable/disable desktop wallpaper
quality, add some kind of smart algorithm to determine whether the
other host is local (maybe using SLP to announce the connectivity
of a LAN)
- enhance RFB with SASL authentication (Kerberos) - enhance RFB with SASL authentication (Kerberos)
- encrypted connections (using SASL and/or SSL/TLS) - encrypted connections (using SASL and/or SSL/TLS)
- with kerberos/ssl: display name of remote user in connection dialog, - with kerberos/ssl: display name of remote user in connection dialog,
kpassivepopup and systray (if name is available) kpassivepopup and systray (if name is available)
- try to solve the non-atomic KConfig changes problem
- mention that invitations are one-time on personal invitation dialog - mention that invitations are one-time on personal invitation dialog
Todo (unscheduled features): Todo (unscheduled features):
- when krfb is started with URL arguments and without connection
quality, add some kind of smart algorithm to determine whether the
other host is local (maybe using SLP to announce the connectivity
of a LAN)
- NAT traversal support if I can find an acceptable implementation - NAT traversal support if I can find an acceptable implementation
(probably using TURN, as soon as there is a server and newer spec for that) (probably using TURN, as soon as there is a server and newer spec for that)
- when OpenSLP supports this, allow scope configuration - when OpenSLP supports this, allow scope configuration

View File

@@ -1,4 +1,4 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> <!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>ConfigurationWidget</class> <class>ConfigurationWidget</class>
<widget class="QWidget"> <widget class="QWidget">
<property name="name"> <property name="name">
@@ -23,7 +23,7 @@
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<property name="margin"> <property name="margin">
<number>11</number> <number>0</number>
</property> </property>
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
@@ -148,7 +148,7 @@
<cstring>enableSLPCB</cstring> <cstring>enableSLPCB</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>Announce &amp;service on the network</string> <string>Announce service &amp;on the network</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@@ -162,7 +162,7 @@
<cstring>confirmConnectionsCB</cstring> <cstring>confirmConnectionsCB</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Confirm uninvited connections before accepting</string> <string>Confirm uninvited connections &amp;before accepting</string>
</property> </property>
<property name="whatsThis" stdset="0"> <property name="whatsThis" stdset="0">
<string>If enabled, a dialog will appear when somebody attempts to connect, asking you whether you want to accept the connection.</string> <string>If enabled, a dialog will appear when somebody attempts to connect, asking you whether you want to accept the connection.</string>
@@ -222,7 +222,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Password:</string> <string>Pass&amp;word:</string>
</property> </property>
<property name="buddy" stdset="0"> <property name="buddy" stdset="0">
<cstring>passwordInput</cstring> <cstring>passwordInput</cstring>
@@ -265,6 +265,75 @@
</spacer> </spacer>
</vbox> </vbox>
</widget> </widget>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>&amp;Session</string>
</attribute>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QGroupBox">
<property name="name">
<cstring>GroupBox4</cstring>
</property>
<property name="title">
<string>Session preferences</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="QCheckBox">
<property name="name">
<cstring>disableBackgroundCB</cstring>
</property>
<property name="text">
<string>Disable &amp;background image</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="whatsThis" stdset="0">
<string>Check this option to disable the background image during a remote session.</string>
</property>
</widget>
</vbox>
</widget>
<spacer>
<property name="name">
<cstring>Spacer4</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<widget class="QWidget"> <widget class="QWidget">
<property name="name"> <property name="name">
<cstring>tab</cstring> <cstring>tab</cstring>
@@ -304,7 +373,7 @@
<cstring>autoPortCB</cstring> <cstring>autoPortCB</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>A&amp;ssign port automatically</string> <string>Assi&amp;gn port automatically</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@@ -341,7 +410,7 @@
<cstring>TextLabel1_2</cstring> <cstring>TextLabel1_2</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Port:</string> <string>P&amp;ort:</string>
</property> </property>
<property name="buddy" stdset="0"> <property name="buddy" stdset="0">
<cstring>portInput</cstring> <cstring>portInput</cstring>
@@ -436,4 +505,8 @@ Most VNC clients use a display number instead of the actual port. This display n
<tabstop>portInput</tabstop> <tabstop>portInput</tabstop>
</tabstops> </tabstops>
<layoutdefaults spacing="6" margin="11"/> <layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>knuminput.h</includehint>
<includehint>knuminput.h</includehint>
</includehints>
</UI> </UI>

View File

@@ -84,6 +84,7 @@ KcmKRfb::KcmKRfb(QWidget *p, const char *name, const QStringList &) :
connect(&m_configuration, SIGNAL(invitationNumChanged(int)), connect(&m_configuration, SIGNAL(invitationNumChanged(int)),
this, SLOT(setInvitationNum(int))); this, SLOT(setInvitationNum(int)));
setInvitationNum(m_configuration.invitations().size()); setInvitationNum(m_configuration.invitations().size());
connect(m_confWidget->disableBackgroundCB, SIGNAL(clicked()), SLOT(configChanged()) );
} }
KcmKRfb::~KcmKRfb() { KcmKRfb::~KcmKRfb() {
delete m_about; delete m_about;
@@ -133,6 +134,7 @@ void KcmKRfb::load() {
m_confWidget->autoPortCB->setChecked(m_configuration.preferredPort()<0); m_confWidget->autoPortCB->setChecked(m_configuration.preferredPort()<0);
m_confWidget->portInput->setValue(m_configuration.preferredPort()> 0 ? m_confWidget->portInput->setValue(m_configuration.preferredPort()> 0 ?
m_configuration.preferredPort() : 5900); m_configuration.preferredPort() : 5900);
m_confWidget->disableBackgroundCB->setChecked(m_configuration.disableBackground());
} }
void KcmKRfb::save() { void KcmKRfb::save() {
@@ -148,6 +150,7 @@ void KcmKRfb::save() {
m_configuration.setPreferredPort(-1); m_configuration.setPreferredPort(-1);
else else
m_configuration.setPreferredPort(m_confWidget->portInput->value()); m_configuration.setPreferredPort(m_confWidget->portInput->value());
m_configuration.setDisableBackground(m_confWidget->disableBackgroundCB->isChecked());
m_configuration.save(); m_configuration.save();
} }
@@ -162,6 +165,7 @@ void KcmKRfb::defaults() {
m_confWidget->passwordInput->setText(""); m_confWidget->passwordInput->setText("");
m_confWidget->autoPortCB->setChecked(true); m_confWidget->autoPortCB->setChecked(true);
m_confWidget->portInput->setValue(5900); m_confWidget->portInput->setValue(5900);
m_confWidget->disableBackgroundCB->setChecked(false);
} }
const KAboutData *KcmKRfb::aboutData() const const KAboutData *KcmKRfb::aboutData() const

View File

@@ -144,6 +144,7 @@ void Configuration::loadFromKConfig() {
askOnConnectFlag = c.readBoolEntry("confirmUninvitedConnection", true); askOnConnectFlag = c.readBoolEntry("confirmUninvitedConnection", true);
allowDesktopControlFlag = c.readBoolEntry("allowDesktopControl", false); allowDesktopControlFlag = c.readBoolEntry("allowDesktopControl", false);
preferredPortNum = c.readNumEntry("preferredPort", -1); preferredPortNum = c.readNumEntry("preferredPort", -1);
disableBackgroundFlag = c.readBoolEntry("disableBackground", false);
if (c.hasKey("uninvitedPasswordCrypted")) if (c.hasKey("uninvitedPasswordCrypted"))
passwordString = cryptStr(c.readEntry("uninvitedPasswordCrypted", "")); passwordString = cryptStr(c.readEntry("uninvitedPasswordCrypted", ""));
else else
@@ -159,6 +160,7 @@ void Configuration::loadFromKConfig() {
invalidateOldInvitations(); invalidateOldInvitations();
if (invNum != invitationList.size()) if (invNum != invitationList.size())
emit invitationNumChanged(invitationList.size()); emit invitationNumChanged(invitationList.size());
} }
void Configuration::saveToKConfig() { void Configuration::saveToKConfig() {
@@ -169,6 +171,7 @@ void Configuration::saveToKConfig() {
c.writeEntry("allowUninvited", allowUninvitedFlag); c.writeEntry("allowUninvited", allowUninvitedFlag);
c.writeEntry("enableSLP", enableSLPFlag); c.writeEntry("enableSLP", enableSLPFlag);
c.writeEntry("preferredPort", preferredPortNum); c.writeEntry("preferredPort", preferredPortNum);
c.writeEntry("disableBackground", disableBackgroundFlag);
c.writeEntry("uninvitedPasswordCrypted", cryptStr(passwordString)); c.writeEntry("uninvitedPasswordCrypted", cryptStr(passwordString));
c.deleteEntry("uninvitedPassword"); c.deleteEntry("uninvitedPassword");
@@ -274,6 +277,10 @@ QValueList<Invitation> &Configuration::invitations() {
return invitationList; return invitationList;
} }
bool Configuration::disableBackground() const {
return disableBackgroundFlag;
}
void Configuration::setAllowUninvited(bool allowUninvited) { void Configuration::setAllowUninvited(bool allowUninvited) {
allowUninvitedFlag = allowUninvited; allowUninvitedFlag = allowUninvited;
} }
@@ -316,6 +323,9 @@ int Configuration::preferredPort() const
return preferredPortNum; return preferredPortNum;
} }
void Configuration::setDisableBackground(bool disable) {
disableBackgroundFlag = disable;
}
////////////// invitation manage dialog ////////////////////////// ////////////// invitation manage dialog //////////////////////////

View File

@@ -59,12 +59,14 @@ public:
QString hostname() const; QString hostname() const;
int port() const; int port() const;
int preferredPort() const; int preferredPort() const;
bool disableBackground() const;
void setAllowUninvited(bool allowUninvited); void setAllowUninvited(bool allowUninvited);
void setEnableSLP(bool e); void setEnableSLP(bool e);
void setAskOnConnect(bool askOnConnect); void setAskOnConnect(bool askOnConnect);
void setPassword(QString password); void setPassword(QString password);
void setPreferredPort(int p); void setPreferredPort(int p);
void setDisableBackground(bool disable);
void save(); void save();
void update(); void update();
@@ -114,6 +116,8 @@ private:
QString passwordString; QString passwordString;
QValueList<Invitation> invitationList; QValueList<Invitation> invitationList;
bool disableBackgroundFlag;
private slots: private slots:
void refreshTimeout(); void refreshTimeout();

View File

@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
"(c) 2000-2001, Const Kaplinsky\n" "(c) 2000-2001, Const Kaplinsky\n"
"(c) 2000, Tridia Corporation\n" "(c) 2000, Tridia Corporation\n"
"(c) 1999, AT&T Laboratories Cambridge\n", "(c) 1999, AT&T Laboratories Cambridge\n",
0, "", "ml@tjansen.de"); 0, "", "tim@tjansen.de");
aboutData.addAuthor("Tim Jansen", "", "tim@tjansen.de"); aboutData.addAuthor("Tim Jansen", "", "tim@tjansen.de");
aboutData.addAuthor("Ian Reinhart Geiser", "DCOP interface", "geiseri@kde.org"); aboutData.addAuthor("Ian Reinhart Geiser", "DCOP interface", "geiseri@kde.org");
aboutData.addCredit("Johannes E. Schindelin", aboutData.addCredit("Johannes E. Schindelin",
@@ -95,6 +95,8 @@ int main(int argc, char *argv[])
aboutData.addCredit("Jason Spisak", aboutData.addCredit("Jason Spisak",
I18N_NOOP("Connection side image"), I18N_NOOP("Connection side image"),
"kovalid@yahoo.com"); "kovalid@yahoo.com");
aboutData.addCredit("Karl Vogel",
I18N_NOOP("KDesktop background deactivation"));
KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs::addCmdLineOptions(options);

View File

@@ -499,6 +499,15 @@ bool RFBController::checkAsyncEvents()
return closed; return closed;
} }
void RFBController::restoreBackground() {
if (configuration->disableBackground()) {
DCOPRef ref("kdesktop", "KBackgroundIface");
ref.setDCOPClient(KApplication::dcopClient());
ref.send("setBackgroundEnabled(bool)", bool(true));
}
}
void RFBController::connectionClosed() void RFBController::connectionClosed()
{ {
KNotifyClient::event("ConnectionClosed", KNotifyClient::event("ConnectionClosed",
@@ -506,6 +515,7 @@ void RFBController::connectionClosed()
.arg(remoteIp)); .arg(remoteIp));
idleTimer.stop(); idleTimer.stop();
restoreBackground();
state = RFB_WAITING; state = RFB_WAITING;
if (forcedClose) if (forcedClose)
emit quitApp(); emit quitApp();
@@ -517,6 +527,8 @@ void RFBController::closeConnection()
{ {
forcedClose = true; forcedClose = true;
if (state == RFB_CONNECTED) { if (state == RFB_CONNECTED) {
restoreBackground();
if (!checkAsyncEvents()) { if (!checkAsyncEvents()) {
asyncMutex.lock(); asyncMutex.lock();
if (!closePending) if (!closePending)
@@ -735,6 +747,12 @@ void RFBController::sendKNotifyEvent(const QString &n, const QString &d)
void RFBController::sendSessionEstablished() void RFBController::sendSessionEstablished()
{ {
if (configuration->disableBackground()) {
DCOPRef ref("kdesktop", "KBackgroundIface");
ref.setDCOPClient(KApplication::dcopClient());
ref.send("setBackgroundEnabled(bool)", bool(false));
}
emit sessionEstablished(remoteIp); emit sessionEstablished(remoteIp);
} }

View File

@@ -160,6 +160,7 @@ private:
void sendKNotifyEvent(const QString &name, const QString &desc); void sendKNotifyEvent(const QString &name, const QString &desc);
bool checkAsyncEvents(); bool checkAsyncEvents();
void sendSessionEstablished(); void sendSessionEstablished();
void restoreBackground();
QString remoteIp; QString remoteIp;
bool allowDesktopControl; bool allowDesktopControl;