1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-01 07:24:29 +00:00

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:
- write SLP service template for remote desktop protocols
(documentation)
- 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)
- extend VNC to enable/disable desktop wallpaper
- enhance RFB with SASL authentication (Kerberos)
- encrypted connections (using SASL and/or SSL/TLS)
- with kerberos/ssl: display name of remote user in connection dialog,
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
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
(probably using TURN, as soon as there is a server and newer spec for that)
- 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>
<widget class="QWidget">
<property name="name">
@ -23,7 +23,7 @@
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
@ -148,7 +148,7 @@
<cstring>enableSLPCB</cstring>
</property>
<property name="text">
<string>Announce &amp;service on the network</string>
<string>Announce service &amp;on the network</string>
</property>
<property name="checked">
<bool>true</bool>
@ -162,7 +162,7 @@
<cstring>confirmConnectionsCB</cstring>
</property>
<property name="text">
<string>&amp;Confirm uninvited connections before accepting</string>
<string>Confirm uninvited connections &amp;before accepting</string>
</property>
<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>
@ -222,7 +222,7 @@
</sizepolicy>
</property>
<property name="text">
<string>&amp;Password:</string>
<string>Pass&amp;word:</string>
</property>
<property name="buddy" stdset="0">
<cstring>passwordInput</cstring>
@ -265,6 +265,75 @@
</spacer>
</vbox>
</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">
<property name="name">
<cstring>tab</cstring>
@ -304,7 +373,7 @@
<cstring>autoPortCB</cstring>
</property>
<property name="text">
<string>A&amp;ssign port automatically</string>
<string>Assi&amp;gn port automatically</string>
</property>
<property name="checked">
<bool>true</bool>
@ -341,7 +410,7 @@
<cstring>TextLabel1_2</cstring>
</property>
<property name="text">
<string>&amp;Port:</string>
<string>P&amp;ort:</string>
</property>
<property name="buddy" stdset="0">
<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>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>knuminput.h</includehint>
<includehint>knuminput.h</includehint>
</includehints>
</UI>

View File

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

View File

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

View File

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

View File

@ -77,7 +77,7 @@ int main(int argc, char *argv[])
"(c) 2000-2001, Const Kaplinsky\n"
"(c) 2000, Tridia Corporation\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("Ian Reinhart Geiser", "DCOP interface", "geiseri@kde.org");
aboutData.addCredit("Johannes E. Schindelin",
@ -95,6 +95,8 @@ int main(int argc, char *argv[])
aboutData.addCredit("Jason Spisak",
I18N_NOOP("Connection side image"),
"kovalid@yahoo.com");
aboutData.addCredit("Karl Vogel",
I18N_NOOP("KDesktop background deactivation"));
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(options);

View File

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

View File

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