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

preparation for 0.6.0; knotify commit (not working yet)

svn path=/trunk/kdenetwork/krfb/; revision=136908
This commit is contained in:
Tim Jansen 2002-02-17 00:33:31 +00:00
parent c5f8d389b8
commit 617167cae5
22 changed files with 458 additions and 301 deletions

View File

@ -1,3 +1,7 @@
2002-02-17 Tim Jansen <tjansen@tjansen.de>
* rfbcontroller.cc: added KNotify support
2002-02-14 Tim Jansen <tjansen@tjansen.de>
* integrated DCOP interface patch by Ian Reinhart

24
DCOP-INTERFACE Normal file
View File

@ -0,0 +1,24 @@
DCOP Interfaces:
// Disconnects the current session
void disconnect()
// Exits the application
void exit()
// Will the application quit after one connection
bool oneConnection()
// Set the application to quite after one connection
void setOneConnection(bool)
// Will the application ask the user for permission
// when a new connection arrives
bool askOnConnect()
// Set the application to ask for permission on new connections
void setAskOnConnect(bool)
// Is the desktop controlable from remote clients
bool allowDesktopControl()
// Set the desktop to be controlable from remote clients
void setAllowDesktopControl(bool)
// Set the password to connect to your system
void setPassword(QString)
// What port will clients connect on
int port()

6
NOTES
View File

@ -15,14 +15,14 @@ Some comments on various aspects of KRfb:
issues like setting a password
- design goal of KRfb is to make it as easy to use as possible. I tried to
limit functionality whereever possible.
- the original x0rfbserver has a features for selecting the port number
automatically. I skipped that because it is too complicated on the client
side, but I this will change when there are mechanisms for inviting people.
- the command line args are intended for starting KRfb from a system like
Jabber, thats the reason why there is no preferences dialog when
command line args have been used and it's also the reason
for --one-connection
- the newconnection-dialog is extra large and has the pixmap on the left
side to capture the attention of the user before allowing a connection.
- the auto-port-selection feature is somewhat inconvenient when you have
more than one VNC server running (you cannot know the port). Problems
willbe solved in a future version when there is an invitation feature.
tim@tjansen.de

12
README
View File

@ -2,18 +2,20 @@ KRfb
====
KRfb is a small server for the RFB protocol, better known as VNC. Unlike most
other Unix/Linux RFB servers, KRfb (and x0rfbserver) allows you
to share your X11 session instead of creating a new X11 session.
It is based on x0rfbserver, available from
http://www.hexonet.de/software/x0rfbserver/.
other Unix/Linux RFB servers, KRfb allows you to share your X11 session
instead of creating a new X11 session.
It was originally based on x0rfbserver
(ttp://www.hexonet.de/software/x0rfbserver/), but there is not much code of
x0rfbserver left. Since version 0.6 it uses libvncserver
(http://libvncserver.sf.net) as backend.
For the latest information about KRfb visit http://www.tjansen.de/krfb
Guide to documentation:
README_KDE3 - docs for using it under KDE3
ROADMAP - KRfb roadmap, progress and future features
TODO - unscheduled things to be done
NOTES - reasons for various decisions
DCOP-INTERFACE - short documentation of the DCOP interface
ChangeLog - more detailed changes with dates

14
ROADMAP
View File

@ -2,19 +2,19 @@ Version 0.5 (2002/01/02): First release
- first release
- port x0rfbserver with simplified KDE/Qt interface
Version 0.6 (2002/02/20): Improve RFB backend
Version 0.6 (2002/02/17): Improved RFB backend
- replace x0rfbserver's backend with libvncserver
<- knotify
- knotify
Version 0.7 (2002/??/??): Better integration with KDE, more end-user friendly
Version 0.7: Better integration with KDE, improved GUI
- i18n
- kded module 'kinetd' to listening on the Rfb port that then starts KRfb
- kcontrol module to configure the kded thing
- kded module 'kinetd' that listens on the Rfb port and starts KRfb
- kcontrol module
- on startup a dialog appears that allows the user to invite somebody
using email (and later other mechanisms). Dialog can be turned off forever,
of course
- remove STDOUT/STDERR logging
Version 0.8 (2002/??/??):
Version 0.8:
- docs

2
TODO
View File

@ -1,6 +1,4 @@
Todo:
- big endian support (testers needed)
- write screen recording app using the lib
- SLP support (or UPnP, or whatever KDE will use)
- look into adding extension to xfree to improve speed (get noticed of
screen updates)

61
kinetd/kinetd.cpp Normal file
View File

@ -0,0 +1,61 @@
/***************************************************************************
kinetd.cpp
--------------
begin : Mon Feb 11 2002
copyright : (C) 2002 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "kinetd.h"
#include <kservicetype.h>
#include <kservice.h>
PortListener::PortListener(KService::Ptr s) {
}
class KInetD : public KDEDModule {
KInetD::KInetD(QCString &n) :
KDEDModule(n)
{
portListeners.setAutoDelete(true);
loadServiceList();
}
void KInetD::loadServiceList()
{
portListeners.clear();
KService::List kinetdModules =
KServiceType::offers("KInetDModule");
for(KService::List::ConstIterator it = kinetdModules.begin();
it != kinetdModules.end();
it++) {
KService::Ptr s = *it;
portListeners.append(new PortListener(s));
}
}
}
extern "C" {
KDEDModule *create_kinetd(QCString *name)
{
return new KInetD(name);
}
}

13
kinetd/kinetd.desktop Normal file
View File

@ -0,0 +1,13 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
ServiceTypes=KDEDModule
X-KDE-ModuleType=Library
X-KDE-Library=kinetd
X-KDE-FactoryName=kinetd
X-KDE-Kded-autoload=true
X-KDE-Kded-load-on-demand=false
Name=KDE Print Deamon
Comment=A Print Daemon for KDE

44
kinetd/kinetd.h Normal file
View File

@ -0,0 +1,44 @@
/***************************************************************************
kinetd.h
------------
begin : Mon Feb 11 2002
copyright : (C) 2002 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _KINETD_H_
#define _KINETD_H_
#include <kdedmodule.h>
#include "portlistener.h"
class KInetD : public KDEDModule {
Q_OBJECT
K_DCOP
private:
QPtrList<PortListener> portListeners;
public:
KInetD(QCString &n);
loadServiceList();
k_dcop:
void reloadPortListenerList();
PortListener *findPortListener(QString name);
}
#endif

44
kinetd/portlistener.h Normal file
View File

@ -0,0 +1,44 @@
/***************************************************************************
kinetd.h
------------
begin : Mon Feb 11 2002
copyright : (C) 2002 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _KINETD_H_
#define _KINETD_H_
#include <kservice.h>
class PortListener : public DCOPObject {
K_DCOP
private:
QString serviceName;
int port;
QCString execPath;
public:
PortListener(KService::Ptr s);
k_dcop:
}
#endif

View File

@ -9,11 +9,13 @@ krfb_LDADD = ../libvncserver/libvncserver.a -lz -lpthread -ljpeg -lXtst \
EXTRA_DIST = $(krfb_SOURCES) krfb.desktop lo32-app-krfb.png \
lo16-app-krfb.png rfbcontroller.h eyes-closed24.png eyes-open24.png \
XUpdateScanner.h trayicon.h configuration.h krfbiface.h krfbiface.kidl
XUpdateScanner.h trayicon.h configuration.h krfbiface.h krfbiface.kidl \
eventsrc
install-data-local:
$(mkinstalldirs) $(kde_appsdir)/Applications/
$(INSTALL_DATA) $(srcdir)/krfb.desktop $(kde_appsdir)/Applications/krfb.desktop
$(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
@ -21,6 +23,7 @@ install-data-local:
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

View File

@ -36,10 +36,6 @@ Configuration::Configuration() :
loadFromKConfig();
saveToDialog();
portValidator = new QIntValidator(0, 65535,
confDlg.displayNumberInput);
confDlg.displayNumberInput->setValidator(portValidator);
connect(confDlg.okButton, SIGNAL(clicked()),
SLOT(okPressed()));
connect(confDlg.cancelButton, SIGNAL(clicked()),
@ -50,18 +46,13 @@ Configuration::Configuration() :
}
Configuration::Configuration(bool oneConnection, bool askOnConnect,
bool allowDesktopControl, QString password,
int port) :
bool allowDesktopControl, QString password) :
preconfiguredFlag(true),
askOnConnectFlag(askOnConnect),
allowDesktopControlFlag(allowDesktopControl),
oneConnectionFlag(oneConnection),
passwordString(password)
{
if ((port >= 5900) && (port < 6000))
portNumber = port-5900;
else
portNumber = port;
}
@ -76,7 +67,6 @@ void Configuration::loadFromKConfig() {
allowDesktopControlFlag = config->readBoolEntry("allowDesktopControl",
false);
passwordString = config->readEntry("password", "");
portNumber = config->readNumEntry("port", 0);
}
void Configuration::loadFromDialog() {
@ -87,11 +77,6 @@ void Configuration::loadFromDialog() {
passwordString = newPassword;
emit passwordChanged();
}
int p = confDlg.displayNumberInput->text().toInt();
if (p != portNumber) {
portNumber = p;
emit portChanged();
}
}
void Configuration::saveToKConfig() {
@ -101,14 +86,12 @@ void Configuration::saveToKConfig() {
config->writeEntry("askOnConnect", askOnConnectFlag);
config->writeEntry("allowDesktopControl", allowDesktopControlFlag);
config->writeEntry("password", passwordString);
config->writeEntry("port", portNumber);
}
void Configuration::saveToDialog() {
confDlg.askOnConnectCB->setChecked(askOnConnectFlag);
confDlg.allowDesktopControlCB->setChecked(allowDesktopControlFlag);
confDlg.passwordInput->setText(passwordString);
confDlg.displayNumberInput->setText(QString().setNum(portNumber));
}
bool Configuration::preconfigured() const {
@ -131,10 +114,6 @@ QString Configuration::password() const {
return passwordString;
}
int Configuration::port() const {
return (portNumber < 100) ? (portNumber + 5900) : portNumber;
}
void Configuration::setOnceConnection(bool oneConnection)
{
oneConnectionFlag = oneConnection;
@ -164,19 +143,6 @@ void Configuration::setPassword(QString password)
saveToDialog();
}
void Configuration::setPort(int port)
{
int oldPort = portNumber;
if ((port >= 5900) && (port < 6000))
portNumber = port-5900;
else
portNumber = port;
if (oldPort != portNumber)
emit portChanged();
saveToKConfig();
saveToDialog();
}
void Configuration::showDialog() {
confDlg.show();
}

View File

@ -42,7 +42,7 @@ class Configuration : public QObject {
public:
Configuration();
Configuration(bool oneConnection, bool askOnConnect,
bool allowDesktopControl, QString password, int port);
bool allowDesktopControl, QString password);
~Configuration();
bool preconfigured() const;
@ -50,16 +50,13 @@ public:
bool askOnConnect() const;
bool allowDesktopControl() const;
QString password() const;
int port() const;
void setOnceConnection(bool oneConnection);
void setAskOnConnect(bool askOnConnect);
void setAllowDesktopControl(bool allowDesktopControl);
void setPassword(QString password);
void setPort(int port);
signals:
void portChanged();
void passwordChanged();
public slots:
@ -79,7 +76,6 @@ private:
bool allowDesktopControlFlag;
bool oneConnectionFlag;
QString passwordString;
int portNumber;
private slots:
void okPressed();

View File

@ -1,357 +1,239 @@
<!DOCTYPE UI><UI>
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>ConfigurationDialog</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<widget class="QDialog">
<property name="name">
<cstring>ConfigurationDialog</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>321</width>
<height>257</height>
<width>360</width>
<height>236</height>
</rect>
</property>
<property stdset="1">
<name>sizePolicy</name>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property stdset="1">
<name>caption</name>
<property name="caption">
<string>Desktop Sharing: Configuration</string>
</property>
<property stdset="1">
<name>icon</name>
<property name="icon">
<pixmap>image0</pixmap>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<property name="spacing">
<number>6</number>
</property>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<widget class="QFrame">
<property name="name">
<cstring>Frame7</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
<property name="layoutMargin" stdset="0">
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>6</number>
</property>
<property stdset="1">
<name>spacing</name>
<property name="spacing">
<number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<widget class="QCheckBox">
<property name="name">
<cstring>askOnConnectCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<property name="text">
<string>Confirm connection &amp;before accepting</string>
</property>
<property>
<name>whatsThis</name>
<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</class>
<property stdset="1">
<name>name</name>
<widget class="QCheckBox">
<property name="name">
<cstring>allowDesktopControlCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<property name="text">
<string>Allow &amp;remote client to control the desktop</string>
</property>
<property>
<name>whatsThis</name>
<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</class>
<property stdset="1">
<name>name</name>
<cstring>Frame5</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>6</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>Display number:</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>displayNumberInput</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>5</number>
</property>
<property>
<name>toolTip</name>
<string>Display number</string>
</property>
<property>
<name>whatsThis</name>
<string>Enter the display number/port here. Unless you have more than one server running on the machine just enter 0.
Regular RFB/VNC port numbers are between 0 and 99. If you enter a higher number it will be used as TCP port. Note that ports below 1024 require root privileges.</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<widget class="QFrame">
<property name="name">
<cstring>Frame4</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
<property name="layoutMargin" stdset="0">
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>6</number>
</property>
<property stdset="1">
<name>spacing</name>
<property name="spacing">
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<widget class="QLabel">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<property name="text">
<string>Password:</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<widget class="QLineEdit">
<property name="name">
<cstring>passwordInput</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<property name="maxLength">
<number>9</number>
</property>
<property stdset="1">
<name>echoMode</name>
<property name="echoMode">
<enum>Password</enum>
</property>
<property>
<name>whatsThis</name>
<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</class>
<property stdset="1">
<name>name</name>
<widget class="QFrame">
<property name="name">
<cstring>Frame6</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
<property name="layoutMargin" stdset="0">
</property>
<property>
<name>layoutSpacing</name>
<property name="layoutSpacing" stdset="0">
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>4</number>
</property>
<property stdset="1">
<name>spacing</name>
<property name="spacing">
<number>6</number>
</property>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<widget class="QPushButton">
<property name="name">
<cstring>applyButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<property name="text">
<string>&amp;Apply</string>
</property>
<property>
<name>whatsThis</name>
<property name="whatsThis" stdset="0">
<string>Click this to apply the changes immediately.</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<property name="name" stdset="0">
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<widget class="QPushButton">
<property name="name">
<cstring>okButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<property name="text">
<string>&amp;Ok</string>
</property>
<property stdset="1">
<name>default</name>
<property name="default">
<bool>true</bool>
</property>
<property>
<name>whatsThis</name>
<property name="whatsThis" stdset="0">
<string>Apply changes and close window.</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<widget class="QPushButton">
<property name="name">
<cstring>cancelButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property>
<name>whatsThis</name>
<property name="whatsThis" stdset="0">
<string>Discard all changes and close window.</string>
</property>
</widget>
@ -360,9 +242,9 @@ Regular RFB/VNC port numbers are between 0 and 99. If you enter a higher number
</vbox>
</widget>
<images>
<image>
<name>image0</name>
<image name="image0">
<data format="XPM.GZ" length="1407">789cad93db4ac4301086effb14a1b95b64b76b150a8b8fa0782988173393367b54d0f542c477377fd2405b7b5a7066cbe6231f49864c560bf5f478af16abe4e34ce79d28d9d2bb5a98cfd3e9ebf9e5ee3b49f36be57eeb1bb54eaf9274a9443dbcbd96186fdd58672e8a0c5845148f65c4aa02ee0216356a609e218106785b2081022cb2a25e99809421817b8f8591b0d40128d8c9cfb2c71c093c02ab2aceda80085fce44cc75f444788746e3126778a3863374de3e87eb1c7458c8b061599aa530f739cce21c32e23e12a87f1c16f642486858aaed10a662f83149c761c25cac387886db0e79a30c375d064fa8ed88336cad38c95a0babed38c3c2d9baa825aba5e344456b48deb1badfc149fec369eea53b0e249415ce5cee82d2bdaf66ed5ee9bd777794a0ecd17483fd132f63acc7e6f4e19833a3e78964f2ed1c8e42c70354d7af840f23ff7fc11b9cf1de876a8a91fe6c925fbe975961</data>
</image>
</images>
<layoutdefaults spacing="6" margin="11"/>
</UI>

40
krfb/eventsrc Normal file
View File

@ -0,0 +1,40 @@
[!Global!]
IconName=krfb
Comment=Desktop Sharing
[UserAcceptsConnection]
Name=UserAcceptsConnection
Comment=User accepts connection
default_presentation=4
[UserRefusesConnection]
Name=UserRefusesConnection
Comment=User refuses connection
default_presentation=4
[ConnectionClosed]
Name=ConnectionClosed
Comment=Connection closed
default_presentation=4
[InvalidPassword]
Name=InvalidPassword
Comment=Invalid Password
default_presentation=4
[NewConnectionOnHold]
Name=NewConnectionOnHold
Comment=Connection requested, user must accept
default_presentation=4
[NewConnectionAutoAccepted]
Name=NewConnectionAutoAccepted
Comment=New connection automatically established
default_presentation=4
[TooManyConnections]
Name=TooManyConnections
Comment=Busy, connection refused
default_presentation=4
default_logfile=

View File

@ -19,6 +19,5 @@ k_dcop:
virtual void setAllowDesktopControl(bool) = 0;
virtual void setPassword(QString) = 0;
virtual int port() = 0;
virtual void setPort(int) = 0;
};
#endif

View File

@ -11,7 +11,8 @@
KRfbIfaceImpl::KRfbIfaceImpl(Configuration *c) :
DCOPObject("krfbIface"),
configuration(c)
configuration(c),
portNum(0)
{
}
@ -60,10 +61,16 @@ void KRfbIfaceImpl::setPassword(QString password)
}
int KRfbIfaceImpl::port()
{
return configuration->port();
}
void KRfbIfaceImpl::setPort(int port)
{
configuration->setPort(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;
}

37
krfb/krfbifaceimpl.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef __KRFB_IFACE_IMPL_H
#define __KRFB_IFACE_IMPL_H
#include <qobject.h>
#include "configuration.h"
#include "krfbiface.h"
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();
bool oneConnection();
void setOneConnection(bool);
bool askOnConnect();
void setAskOnConnect(bool);
bool allowDesktopControl();
void setAllowDesktopControl(bool);
void setPassword(QString);
int port();
};
#endif

View File

@ -39,7 +39,6 @@
static const char *description = I18N_NOOP("VNC-compatible server to share "
"KDE desktops");
#define ARG_PORT "port"
#define ARG_ONE_SESSION "one-session"
#define ARG_PASSWORD "password"
#define ARG_DONT_CONFIRM_CONNECT "dont-confirm-connect"
@ -47,8 +46,6 @@ static const char *description = I18N_NOOP("VNC-compatible server to share "
static KCmdLineOptions options[] =
{
{ "p", 0, 0},
{ ARG_PORT " ", I18N_NOOP("Set the port number the server is listening on."), "0"},
{ "o", 0, 0},
{ ARG_ONE_SESSION, I18N_NOOP("Terminate when the first session is finished."), 0},
{ "w", 0, 0},
@ -63,7 +60,6 @@ static KCmdLineOptions options[] =
int main(int argc, char *argv[])
{
int r;
KAboutData aboutData( "krfb", I18N_NOOP("Desktop Sharing"),
VERSION, description, KAboutData::License_GPL,
"(c) 2001-2002, Tim Jansen\n"
@ -99,8 +95,7 @@ int main(int argc, char *argv[])
Configuration *config;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet(ARG_PORT) ||
args->isSet(ARG_ONE_SESSION) ||
if (args->isSet(ARG_ONE_SESSION) ||
args->isSet(ARG_PASSWORD) ||
args->isSet(ARG_REMOTE_CONTROL) ||
args->isSet(ARG_DONT_CONFIRM_CONNECT)) {
@ -109,9 +104,8 @@ int main(int argc, char *argv[])
bool askOnConnect = !args->isSet(ARG_DONT_CONFIRM_CONNECT);
bool allowDesktopControl = args->isSet(ARG_REMOTE_CONTROL);
QString password = args->getOption(ARG_PASSWORD);
int port = args->getOption(ARG_PORT).toInt();
config = new Configuration(oneConnection, askOnConnect,
allowDesktopControl, password, port);
allowDesktopControl, password);
}
else
config = new Configuration();
@ -140,13 +134,15 @@ int main(int argc, char *argv[])
QObject::connect(&dcopiface, SIGNAL(exitApp()),
&app, SLOT(quit()));
QObject::connect(config, SIGNAL(portChanged()),
&controller, SLOT(rebind()));
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()) {
QObject::connect(&controller, SIGNAL(sessionRefused()),
&app, SLOT(quit()));

View File

@ -26,6 +26,7 @@
#include <fcntl.h>
#include <kapplication.h>
#include <knotifyclient.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h>
@ -311,8 +312,7 @@ void RFBController::startServer(bool xtestGrab)
}
server->frameBuffer = fb;
server->rfbPort = configuration->port();
//server->udpPort = configuration->port();
server->autoPort = TRUE;
server->kbdAddEvent = keyboardHook;
server->ptrAddEvent = pointerHook;
@ -330,6 +330,8 @@ void RFBController::startServer(bool xtestGrab)
rfbInitServer(server);
state = RFB_WAITING;
emit portProbed(server->rfbPort);
if (xtestGrab) {
disabler.disable = false;
XTestGrabControl(qt_xdisplay(), true);
@ -374,7 +376,10 @@ void RFBController::connectionAccepted(bool aRC)
void RFBController::acceptConnection(bool aRC)
{
// todo: knotify
KNotifyClient::event("UserAcceptsConnection",
i18n("Connecting system: %1")
.arg(remoteIp));
if (state != RFB_CONNECTING)
return;
@ -384,7 +389,10 @@ void RFBController::acceptConnection(bool aRC)
void RFBController::refuseConnection()
{
// todo: knotify
KNotifyClient::event("UserRefusesConnection",
i18n("Connecting system: %1")
.arg(remoteIp));
if (state != RFB_CONNECTING)
return;
rfbRefuseOnHoldClient(server->rfbClientHead);
@ -411,7 +419,10 @@ bool RFBController::checkAsyncEvents()
void RFBController::connectionClosed()
{
// todo: knotify
KNotifyClient::event("ConnectionClosed",
i18n("Closed connection: %1.")
.arg(remoteIp));
idleTimer.stop();
connectionNum--;
state = RFB_WAITING;
@ -490,7 +501,14 @@ bool RFBController::handleCheckPassword(rfbClientPtr cl,
vncEncryptBytes(cl->authChallenge, passwd);
if (memcmp(cl->authChallenge, response, len) != 0) {
// TODO: knotify
QString host, port;
KExtendedSocket::resolve(KExtendedSocket::peerAddress(cl->sock),
host, port);
KNotifyClient::event("InvalidPassword",
i18n("Connecting system: %1")
.arg(remoteIp));
return FALSE;
}
return TRUE;
@ -500,22 +518,35 @@ enum rfbNewClientAction RFBController::handleNewClient(rfbClientPtr cl)
{
int socket = cl->sock;
if ((connectionNum > 0) ||
(state != RFB_WAITING))
return RFB_CLIENT_REFUSE;
QString host, port;
KExtendedSocket::resolve(KExtendedSocket::peerAddress(socket),
host, port);
if ((connectionNum > 0) ||
(state != RFB_WAITING)) {
KNotifyClient::event("TooManyConnections",
i18n("Connecting system: %1")
.arg(host));
return RFB_CLIENT_REFUSE;
}
remoteIp = host;
state = RFB_CONNECTING;
if (!configuration->askOnConnect()) {
KNotifyClient::event("NewConnectionAutoAccepted",
i18n("Connecting system: %1")
.arg(remoteIp));
connectionAccepted(configuration->allowDesktopControl());
return RFB_CLIENT_ACCEPT;
}
// TODO: knotify
QString host, port;
KExtendedSocket::resolve(KExtendedSocket::peerAddress(socket),
host, port);
dialog.ipLabel->setText(host);
KNotifyClient::event("NewConnectionOnHold",
i18n("Connecting system: %1")
.arg(remoteIp));
dialog.ipLabel->setText(remoteIp);
dialog.allowRemoteControlCB->setChecked(configuration->allowDesktopControl());
dialog.setFixedSize(dialog.sizeHint());
dialog.show();
@ -552,6 +583,11 @@ void RFBController::passwordChanged() {
((configuration->password().length() == 0) ? 0 : 1);
}
int RFBController::getPort()
{
return server->rfbPort;
}
bool RFBController::checkX11Capabilities() {
int bp1, bp2, majorv, minorv;
Bool r = XTestQueryExtension(qt_xdisplay(), &bp1, &bp2,

View File

@ -120,6 +120,7 @@ public:
void handlePointerEvent(int button_mask, int x, int y);
enum rfbNewClientAction handleNewClient(rfbClientPtr cl);
void handleClientGone();
int getPort();
static bool checkX11Capabilities();
@ -132,6 +133,7 @@ signals:
void sessionEstablished();
void sessionFinished();
void sessionRefused();
void portProbed(int);
private:
void startServer(bool xtestGrab = true);
@ -140,6 +142,7 @@ private:
bool allowRemoteControl;
int connectionNum;
QString remoteIp;
QTimer idleTimer;
Configuration *configuration;

2
libvncserver/TODO.krfb Normal file
View File

@ -0,0 +1,2 @@
- fix 24 bit encodings
- replace stderr/stdout logs