mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:41:17 -07:00
sync
svn path=/trunk/kdenetwork/krfb/; revision=127696
This commit is contained in:
3
TODO
3
TODO
@@ -1,6 +1,7 @@
|
||||
Todo:
|
||||
- fix what's-this help in dialogs
|
||||
- remove help button?
|
||||
- remove help buttons?
|
||||
- add command-line args (one-connection, set-password, ask-on-connect)
|
||||
|
||||
Possible features:
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include "XUpdateScanner.h"
|
||||
|
||||
#define SHOW_MOUSE_POINTER 1
|
||||
|
||||
namespace rfb {
|
||||
|
||||
unsigned int scanlines[32] = { 0, 16, 8, 24,
|
||||
@@ -194,7 +192,8 @@ char pointerMap[] =
|
||||
" .. "
|
||||
" ";
|
||||
|
||||
void XUpdateScanner::searchUpdates( list< Hint > &hintList )
|
||||
void XUpdateScanner::searchUpdates( list< Hint > &hintList,
|
||||
bool showMousePointer)
|
||||
{
|
||||
/*
|
||||
count %= (blockWidth * blockHeight);
|
||||
@@ -244,7 +243,7 @@ void XUpdateScanner::searchUpdates( list< Hint > &hintList )
|
||||
}
|
||||
|
||||
|
||||
if ( SHOW_MOUSE_POINTER ) {
|
||||
if ( showMousePointer ) {
|
||||
|
||||
Window root_return, child_return;
|
||||
int root_x, root_y;
|
||||
|
||||
@@ -44,7 +44,7 @@ class XUpdateScanner
|
||||
~XUpdateScanner();
|
||||
|
||||
void checkTile( int x, int y, list< Hint > &hintList );
|
||||
void searchUpdates( list< Hint > &hintList );
|
||||
void searchUpdates( list< Hint > &hintList, bool showMouse );
|
||||
|
||||
|
||||
Display *dpy;
|
||||
|
||||
@@ -102,7 +102,7 @@ QString Configuration::password() const {
|
||||
}
|
||||
|
||||
int Configuration::port() const {
|
||||
return (portNumber < 1023) ? (portNumber + 5900) : portNumber;
|
||||
return (portNumber < 100) ? (portNumber + 5900) : portNumber;
|
||||
}
|
||||
|
||||
void Configuration::showDialog() {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>386</width>
|
||||
<height>278</height>
|
||||
<width>318</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
@@ -80,7 +80,7 @@
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>If this option is enabled you will be asked whenever a remote user wants to connect to your display. This allows to close windows that the remote user should not see or to deny the request completely. It is highly recommended when you work 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>
|
||||
<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>
|
||||
@@ -95,7 +95,7 @@
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>If you allow this option 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 see what you are doing.</string>
|
||||
<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>
|
||||
<widget>
|
||||
@@ -182,7 +182,7 @@
|
||||
</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 here. Regular RFB/VNC port number 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>
|
||||
<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>
|
||||
@@ -289,21 +289,25 @@
|
||||
<hbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>5</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>helpButton</cstring>
|
||||
<cstring>applyButton</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&Help</string>
|
||||
<string>&Apply</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>Click this to apply the changes immediately.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
@@ -327,21 +331,6 @@
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>applyButton</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&Apply</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>Click this to apply the changes immediately.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
|
||||
@@ -208,7 +208,7 @@ This means that he can see everything on your screen and, if the box below is en
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>If you allow this option 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 see what you are doing.</string>
|
||||
<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>
|
||||
@@ -249,17 +249,6 @@ This means that he can see everything on your screen and, if the box below is en
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton8</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
@@ -293,7 +282,7 @@ This means that he can see everything on your screen and, if the box below is en
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>This button grant the request. The remote user can now see everything on your desktop and, if you enabled it, control your computer.</string>
|
||||
<string>This button grants the request. The remote user can now watch your desktop and, if you selected it above, control your computer.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
@@ -306,6 +295,10 @@ This means that he can see everything on your screen and, if the box below is en
|
||||
<name>text</name>
|
||||
<string>Refuse connection</string>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>default</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>This button will refuse the connection. You should chose this unless you trust the requesting user.</string>
|
||||
|
||||
@@ -33,11 +33,13 @@
|
||||
RFBConnection::RFBConnection(Display *_dpy,
|
||||
int _fd,
|
||||
const QString &cpassword,
|
||||
bool _allowInput) :
|
||||
bool _allowInput,
|
||||
bool _showMousePointer) :
|
||||
Server(),
|
||||
dpy(_dpy),
|
||||
fd(_fd),
|
||||
allowInput(_allowInput),
|
||||
showMousePointer(_showMousePointer),
|
||||
buttonMask(0)
|
||||
{
|
||||
memcpy(password, "\0\0\0\0\0\0\0\0", 8);
|
||||
@@ -157,7 +159,7 @@ void RFBConnection::scanUpdates()
|
||||
{
|
||||
list<Hint> hintList;
|
||||
|
||||
scanner->searchUpdates(hintList);
|
||||
scanner->searchUpdates(hintList, showMousePointer);
|
||||
list<Hint>::iterator i;
|
||||
for (i = hintList.begin(); i != hintList.end(); i++)
|
||||
handleHint(*i);
|
||||
|
||||
@@ -51,7 +51,8 @@ class RFBConnection : public QObject, public Server {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RFBConnection(Display *dpy, int fd,
|
||||
const QString &cpassword, bool allowInput);
|
||||
const QString &cpassword,
|
||||
bool allowInput, bool showMouse);
|
||||
~RFBConnection();
|
||||
virtual void handleKeyEvent(KeyEvent &keyEvent);
|
||||
virtual void handlePointerEvent(PointerEvent &pointerEvent);
|
||||
@@ -67,6 +68,7 @@ private:
|
||||
int fd;
|
||||
int buttonMask;
|
||||
bool allowInput;
|
||||
bool showMousePointer;
|
||||
|
||||
XUpdateScanner *scanner;
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <kdebug.h>
|
||||
#include <qwindowdefs.h>
|
||||
#include <qtimer.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qglobal.h>
|
||||
|
||||
RFBController::RFBController(Configuration *c) :
|
||||
@@ -37,6 +39,11 @@ RFBController::RFBController(Configuration *c) :
|
||||
connection(0),
|
||||
idleUpdateScheduled(false)
|
||||
{
|
||||
connect(dialog.acceptConnectionButton, SIGNAL(clicked()),
|
||||
SLOT(dialogAccepted()));
|
||||
connect(dialog.refuseConnectionButton, SIGNAL(clicked()),
|
||||
SLOT(dialogRefused()));
|
||||
|
||||
startServer();
|
||||
}
|
||||
|
||||
@@ -80,17 +87,27 @@ void RFBController::accepted(KSocket *s) {
|
||||
fcntl(sockFd, F_SETFL, O_NONBLOCK);
|
||||
socket = s;
|
||||
|
||||
// TODO: ASK USER FOR PERMISSION HERE BEFORE GOING ON
|
||||
// TODO: also handle case if remote closes while dialog is shown
|
||||
if (configuration->askOnConnect()) {
|
||||
dialog.allowRemoteControlCB->setChecked(
|
||||
configuration->allowDesktopControl());
|
||||
dialog.show();
|
||||
}
|
||||
else {
|
||||
acceptConnection(configuration->allowDesktopControl());
|
||||
}
|
||||
}
|
||||
|
||||
void RFBController::acceptConnection(bool allowDesktopControl) {
|
||||
KSocket *s = socket;
|
||||
connect(s, SIGNAL(readEvent(KSocket*)), SLOT(socketReadable()));
|
||||
connect(s, SIGNAL(writeEvent(KSocket*)), SLOT(socketWritable()));
|
||||
connect(s, SIGNAL(closeEvent(KSocket*)), SLOT(closeSession()));
|
||||
s->enableRead(true);
|
||||
s->enableWrite(true);
|
||||
connection = new RFBConnection(qt_xdisplay(), sockFd,
|
||||
connection = new RFBConnection(qt_xdisplay(), s->socket(),
|
||||
configuration->password(),
|
||||
configuration->allowDesktopControl());
|
||||
allowDesktopControl,
|
||||
configuration->showMousePointer());
|
||||
|
||||
emit sessionEstablished();
|
||||
}
|
||||
@@ -173,6 +190,26 @@ void RFBController::closeSession() {
|
||||
connection = 0;
|
||||
emit sessionFinished();
|
||||
}
|
||||
closeSocket();
|
||||
}
|
||||
|
||||
void RFBController::dialogAccepted() {
|
||||
ASSERT(socket);
|
||||
ASSERT(!connection);
|
||||
|
||||
dialog.hide();
|
||||
acceptConnection(dialog.allowRemoteControlCB->isChecked());
|
||||
}
|
||||
|
||||
void RFBController::dialogRefused() {
|
||||
ASSERT(socket);
|
||||
ASSERT(!connection);
|
||||
|
||||
closeSocket();
|
||||
dialog.hide();
|
||||
}
|
||||
|
||||
void RFBController::closeSocket() {
|
||||
delete socket;
|
||||
socket = 0;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define RFBCONTROLLER_H
|
||||
|
||||
#include "configuration.h"
|
||||
#include "newconnectiondialog.h"
|
||||
#include <ksock.h>
|
||||
#include <qobject.h>
|
||||
// rfbconnection must be last because of X11 headers
|
||||
@@ -58,11 +59,14 @@ private:
|
||||
void startServer();
|
||||
void checkWriteBuffer();
|
||||
void prepareIdleUpdate();
|
||||
void acceptConnection(bool ask);
|
||||
void closeSocket();
|
||||
|
||||
Configuration *configuration;
|
||||
KServerSocket *serversocket;
|
||||
KSocket *socket;
|
||||
RFBConnection *connection;
|
||||
KRFBConnectionDialog dialog;
|
||||
bool idleUpdateScheduled;
|
||||
|
||||
private slots:
|
||||
@@ -70,6 +74,8 @@ private slots:
|
||||
void accepted(KSocket*);
|
||||
void socketReadable();
|
||||
void socketWritable();
|
||||
void dialogAccepted();
|
||||
void dialogRefused();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user