author | treke <treke> | 2002-09-04 17:53:12 (UTC) |
---|---|---|
committer | treke <treke> | 2002-09-04 17:53:12 (UTC) |
commit | 605d854057eb470a1d75210193b82eb0b1ad6b53 (patch) (unidiff) | |
tree | c411b661d5211fefbd83a7c8f63eef8c9cca72ee | |
parent | c35a5eabd8f5ed18e4216f6c88ee6794bacfb491 (diff) | |
download | opie-605d854057eb470a1d75210193b82eb0b1ad6b53.zip opie-605d854057eb470a1d75210193b82eb0b1ad6b53.tar.gz opie-605d854057eb470a1d75210193b82eb0b1ad6b53.tar.bz2 |
Major modifications to the User Interface
1) Bookmark support added, all options are stored on a per bookmark basis
2) 16 Bit color is now a supported bit depth for the server
-rw-r--r-- | noncore/comm/keypebble/keypebble.pro | 16 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbbuffer.cpp | 33 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbcanvas.cpp | 39 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbcanvas.h | 6 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbconnection.cpp | 272 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbconnection.h | 19 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbdecoder.cpp | 3 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfblogin.cpp | 8 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfboptions.cpp | 56 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfboptions.h | 31 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbserver.cpp | 39 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvnc.cpp | 168 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvnc.h | 14 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvncbookmarkdlg.cpp | 220 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvncconndlg.cpp | 75 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvncconnectdlg.cpp | 79 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvncconnectdlg.h | 39 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvncoptionsdlg.cpp | 54 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvncoptionsdlg.h | 30 | ||||
-rw-r--r-- | noncore/comm/keypebble/main.cpp | 4 |
20 files changed, 682 insertions, 523 deletions
diff --git a/noncore/comm/keypebble/keypebble.pro b/noncore/comm/keypebble/keypebble.pro index a102381..1017133 100644 --- a/noncore/comm/keypebble/keypebble.pro +++ b/noncore/comm/keypebble/keypebble.pro | |||
@@ -1,40 +1,42 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = d3des.h \ | 4 | HEADERS = d3des.h \ |
5 | krfbbuffer.h \ | 5 | krfbbuffer.h \ |
6 | krfbcanvas.h \ | 6 | krfbcanvas.h \ |
7 | krfbconnection.h \ | 7 | krfbconnection.h \ |
8 | krfbdecoder.h \ | 8 | krfbdecoder.h \ |
9 | krfblogin.h \ | 9 | krfblogin.h \ |
10 | krfboptions.h \ | 10 | krfbserver.h \ |
11 | krfbserverinfo.h \ | 11 | krfbserverinfo.h \ |
12 | kvnc.h \ | 12 | kvnc.h \ |
13 | kvncconnectdlg.h \ | 13 | kvncconndlg.h \ |
14 | kvncoptionsdlg.h \ | 14 | kvncbookmarkdlg.h \ |
15 | version.h \ | ||
15 | vncauth.h | 16 | vncauth.h |
16 | SOURCES = d3des.c \ | 17 | SOURCES = d3des.c \ |
17 | vncauth.c \ | 18 | vncauth.c \ |
18 | krfbbuffer.cpp \ | 19 | krfbbuffer.cpp \ |
19 | krfbcanvas.cpp \ | 20 | krfbcanvas.cpp \ |
20 | krfbconnection.cpp \ | 21 | krfbconnection.cpp \ |
21 | krfbdecoder.cpp \ | 22 | krfbdecoder.cpp \ |
22 | krfblogin.cpp \ | 23 | krfblogin.cpp \ |
23 | krfboptions.cpp \ | 24 | krfbserver.cpp \ |
24 | kvnc.cpp \ | 25 | kvnc.cpp \ |
25 | kvncconnectdlg.cpp \ | 26 | kvncconndlg.cpp \ |
26 | kvncoptionsdlg.cpp \ | 27 | kvncbookmarkdlg.cpp \ |
27 | main.cpp | 28 | main.cpp |
28 | INTERFACES= vncoptionsbase.ui | 29 | INTERFACES= kvncconndlgbase.ui \ |
30 | kvncbookmarkdlgbase.ui | ||
29 | TARGET = keypebble | 31 | TARGET = keypebble |
30 | INCLUDEPATH += $(OPIEDIR)/include | 32 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH += $(OPIEDIR)/include | 33 | DEPENDPATH += $(OPIEDIR)/include |
32 | LIBS += -lqpe | 34 | LIBS += -lqpe |
33 | 35 | ||
34 | TRANSLATIONS = ../../../i18n/de/keypebble.ts \ | 36 | TRANSLATIONS = ../../../i18n/de/keypebble.ts \ |
35 | ../../../i18n/en/keypebble.ts \ | 37 | ../../../i18n/en/keypebble.ts \ |
36 | ../../../i18n/es/keypebble.ts \ | 38 | ../../../i18n/es/keypebble.ts \ |
37 | ../../../i18n/fr/keypebble.ts \ | 39 | ../../../i18n/fr/keypebble.ts \ |
38 | ../../../i18n/hu/keypebble.ts \ | 40 | ../../../i18n/hu/keypebble.ts \ |
39 | ../../../i18n/ja/keypebble.ts \ | 41 | ../../../i18n/ja/keypebble.ts \ |
40 | ../../../i18n/ko/keypebble.ts \ | 42 | ../../../i18n/ko/keypebble.ts \ |
diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp index 4885261..5a52f31 100644 --- a/noncore/comm/keypebble/krfbbuffer.cpp +++ b/noncore/comm/keypebble/krfbbuffer.cpp | |||
@@ -141,23 +141,54 @@ void KRFBBuffer::drawRawRectChunk( void *data, | |||
141 | b = pixel; | 141 | b = pixel; |
142 | b = b >> decoder->format->blueShift; | 142 | b = b >> decoder->format->blueShift; |
143 | b = b & blueMax; | 143 | b = b & blueMax; |
144 | 144 | ||
145 | r = ( r * 255 ) / redMax; | 145 | r = ( r * 255 ) / redMax; |
146 | g = ( g * 255 ) / greenMax; | 146 | g = ( g * 255 ) / greenMax; |
147 | b = ( b * 255 ) / blueMax; | 147 | b = ( b * 255 ) / blueMax; |
148 | 148 | ||
149 | uint *p = ( uint * ) img.scanLine( j ) + i; | 149 | uint *p = ( uint * ) img.scanLine( j ) + i; |
150 | *p = qRgb( r,g,b ); | 150 | *p = qRgb( r,g,b ); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | } | 153 | } else if (decoder->format->bpp == 16 ) { |
154 | |||
155 | CARD16 *d = (CARD16 *) data; | ||
156 | |||
157 | uint r,g,b; | ||
158 | |||
159 | for ( int j = 0; j < h; j++ ) { | ||
160 | for ( int i = 0; i < w ; i++ ) { | ||
161 | CARD16 pixel = d[ j * w + i ]; | ||
162 | pixel = Swap16IfLE( pixel ); | ||
163 | |||
164 | r = pixel; | ||
165 | r = r >> decoder->format->redShift; | ||
166 | r = r & redMax; | ||
167 | |||
168 | g = pixel; | ||
169 | g = g >> decoder->format->greenShift; | ||
170 | g = g & greenMax; | ||
171 | |||
172 | b = pixel; | ||
173 | b = b >> decoder->format->blueShift; | ||
174 | b = b & blueMax; | ||
175 | |||
176 | r = ( r * 255 ) / redMax; | ||
177 | g = ( g * 255 ) / greenMax; | ||
178 | b = ( b * 255 ) / blueMax; | ||
179 | |||
180 | ulong *p = ( ulong * ) img.scanLine( j ) + i; | ||
181 | *p = qRgb( r,g,b ); | ||
182 | } | ||
183 | } | ||
184 | } | ||
154 | else { | 185 | else { |
155 | p.setBrush( QBrush( Qt::black ) ); | 186 | p.setBrush( QBrush( Qt::black ) ); |
156 | p.drawRect( x, y, w, h ); | 187 | p.drawRect( x, y, w, h ); |
157 | } | 188 | } |
158 | 189 | ||
159 | p.drawImage( x, y, img ); | 190 | p.drawImage( x, y, img ); |
160 | 191 | ||
161 | emit updated( x, y, w, h ); | 192 | emit updated( x, y, w, h ); |
162 | } | 193 | } |
163 | 194 | ||
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index f74ab7b..8b56795 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp | |||
@@ -1,87 +1,81 @@ | |||
1 | #include "kvncconnectdlg.h" | ||
2 | #include "krfbconnection.h" | 1 | #include "krfbconnection.h" |
3 | #include "krfbcanvas.h" | 2 | #include "krfbcanvas.h" |
4 | #include "krfboptions.h" | 3 | #include "krfbserver.h" |
5 | #include "krfbbuffer.h" | 4 | #include "krfbbuffer.h" |
6 | 5 | ||
7 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
7 | #include <qpe/qpeapplication.h> | ||
8 | 8 | ||
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qclipboard.h> | 10 | #include <qclipboard.h> |
11 | #include <qaction.h> | 11 | #include <qaction.h> |
12 | #include <qpixmap.h> | 12 | #include <qpixmap.h> |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | #include <qmainwindow.h> | 14 | #include <qmainwindow.h> |
15 | #include <qiconset.h> | 15 | #include <qiconset.h> |
16 | 16 | ||
17 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) | 17 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) |
18 | : QScrollView( parent, name ) | 18 | : QScrollView( parent, name ) |
19 | { | 19 | { |
20 | connection_ = new KRFBConnection(); | 20 | connection_ = new KRFBConnection(); |
21 | connect( connection_, SIGNAL( passwordRequired( KRFBConnection * ) ), | ||
22 | this, SLOT( passwordRequired( KRFBConnection * ) ) ); | ||
23 | connect( connection_, SIGNAL( loggedIn() ), | 21 | connect( connection_, SIGNAL( loggedIn() ), |
24 | this, SLOT( loggedIn() ) ); | 22 | this, SLOT( loggedIn() ) ); |
25 | 23 | ||
26 | loggedIn_ = false; | 24 | loggedIn_ = false; |
25 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); | ||
27 | 26 | ||
28 | viewport()->setFocusPolicy( QWidget::StrongFocus ); | 27 | viewport()->setFocusPolicy( QWidget::StrongFocus ); |
29 | viewport()->setFocus(); | 28 | viewport()->setFocus(); |
30 | } | 29 | } |
31 | 30 | ||
32 | KRFBCanvas::~KRFBCanvas() | 31 | KRFBCanvas::~KRFBCanvas() |
33 | { | 32 | { |
34 | } | 33 | } |
35 | 34 | ||
36 | void KRFBCanvas::openConnection() | 35 | |
36 | void KRFBCanvas::openConnection(KRFBServer server) | ||
37 | { | 37 | { |
38 | KVNCConnectDlg dlg( connection_, this, "connect dialog" ); | 38 | |
39 | if ( dlg.exec() ) { | 39 | |
40 | QCString host = dlg.hostname().latin1(); | 40 | QCString host = server.hostname.latin1(); |
41 | password = dlg.password(); | 41 | password=server.password; |
42 | connection_->connectTo( host, dlg.display() ); | 42 | connection_->connectTo( server); |
43 | } | ||
44 | } | 43 | } |
45 | 44 | ||
45 | |||
46 | void KRFBCanvas::openURL( const QUrl &url ) | 46 | void KRFBCanvas::openURL( const QUrl &url ) |
47 | { | 47 | { |
48 | if ( loggedIn_ ) { | 48 | if ( loggedIn_ ) { |
49 | qWarning( "openURL invoked when logged in\n" ); | 49 | qWarning( "openURL invoked when logged in\n" ); |
50 | return; | 50 | return; |
51 | } | 51 | } |
52 | 52 | ||
53 | QCString host = url.host().latin1(); | 53 | QCString host = url.host().latin1(); |
54 | int display = url.port(); | 54 | int display = url.port(); |
55 | if ( url.hasPassword() ) | ||
56 | connection_->setPassword( url.password().latin1() ); | ||
57 | 55 | ||
58 | connection_->connectTo( host, display ); | 56 | // connection_->connectTo( host, display ); |
59 | } | 57 | } |
60 | 58 | ||
61 | void KRFBCanvas::closeConnection() | 59 | void KRFBCanvas::closeConnection() |
62 | { | 60 | { |
63 | loggedIn_ = false; | 61 | loggedIn_ = false; |
64 | connection_->disconnect(); | 62 | connection_->disconnect(); |
65 | 63 | ||
66 | viewport()->setMouseTracking( false ); | 64 | viewport()->setMouseTracking( false ); |
67 | viewport()->setBackgroundMode( PaletteDark ); | 65 | viewport()->setBackgroundMode( PaletteDark ); |
68 | setBackgroundMode( PaletteDark ); | 66 | setBackgroundMode( PaletteDark ); |
69 | update(); | 67 | update(); |
70 | } | 68 | } |
71 | 69 | ||
72 | void KRFBCanvas::passwordRequired( KRFBConnection *con ) | ||
73 | { | ||
74 | con->setPassword( password.latin1() ); | ||
75 | } | ||
76 | 70 | ||
77 | void KRFBCanvas::bell() | 71 | void KRFBCanvas::bell() |
78 | { | 72 | { |
79 | if ( connection_->options()->deIconify ) { | 73 | if ( connection_->options()->deIconify ) { |
80 | topLevelWidget()->raise(); | 74 | topLevelWidget()->raise(); |
81 | topLevelWidget()->show(); | 75 | topLevelWidget()->show(); |
82 | } | 76 | } |
83 | } | 77 | } |
84 | 78 | ||
85 | void KRFBCanvas::loggedIn() | 79 | void KRFBCanvas::loggedIn() |
86 | { | 80 | { |
87 | qWarning( "Ok, we're logged in" ); | 81 | qWarning( "Ok, we're logged in" ); |
@@ -158,12 +152,21 @@ void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) | |||
158 | void KRFBCanvas::refresh() | 152 | void KRFBCanvas::refresh() |
159 | { | 153 | { |
160 | if ( loggedIn_ ) | 154 | if ( loggedIn_ ) |
161 | connection_->refresh(); | 155 | connection_->refresh(); |
162 | } | 156 | } |
163 | 157 | ||
164 | void KRFBCanvas::clipboardChanged() | 158 | void KRFBCanvas::clipboardChanged() |
165 | { | 159 | { |
166 | if ( loggedIn_ ) { | 160 | if ( loggedIn_ ) { |
167 | connection_->sendCutText( qApp->clipboard()->text() ); | 161 | connection_->sendCutText( qApp->clipboard()->text() ); |
168 | } | 162 | } |
169 | } | 163 | } |
164 | void KRFBCanvas::sendCtlAltDel( void) | ||
165 | { | ||
166 | |||
167 | qDebug("Here"); | ||
168 | if ( loggedIn_ ) { | ||
169 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0x7f,ControlButton|AltButton)); | ||
170 | // connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Delete, 0x7f,ControlButton|AltButton)); | ||
171 | } | ||
172 | } | ||
diff --git a/noncore/comm/keypebble/krfbcanvas.h b/noncore/comm/keypebble/krfbcanvas.h index 7864f1c..cd3047c 100644 --- a/noncore/comm/keypebble/krfbcanvas.h +++ b/noncore/comm/keypebble/krfbcanvas.h | |||
@@ -1,44 +1,46 @@ | |||
1 | // -*- c++ -*- | 1 | // -*- c++ -*- |
2 | 2 | ||
3 | #ifndef KRFBCANVAS_H | 3 | #ifndef KRFBCANVAS_H |
4 | #define KRFBCANVAS_H | 4 | #define KRFBCANVAS_H |
5 | 5 | ||
6 | #include <qscrollview.h> | 6 | #include <qscrollview.h> |
7 | #include <qurl.h> | 7 | #include <qurl.h> |
8 | 8 | ||
9 | class KRFBConnection; | 9 | class KRFBConnection; |
10 | class KRFBServer; | ||
10 | 11 | ||
11 | /** | 12 | /** |
12 | * Displays data from an KRFBDecoder, and sends events to the | 13 | * Displays data from an KRFBDecoder, and sends events to the |
13 | * KRFBConnection. | 14 | * KRFBConnection. |
14 | */ | 15 | */ |
15 | class KRFBCanvas : public QScrollView | 16 | class KRFBCanvas : public QScrollView |
16 | { | 17 | { |
17 | Q_OBJECT | 18 | Q_OBJECT |
18 | public: | 19 | public: |
19 | KRFBCanvas( QWidget *parent, const char *name=0 ); | 20 | KRFBCanvas( QWidget *parent, const char *name=0 ); |
20 | ~KRFBCanvas(); | 21 | ~KRFBCanvas(); |
21 | 22 | ||
22 | void setConnection( KRFBConnection * ); | 23 | void setConnection( KRFBConnection * ); |
23 | KRFBConnection *connection() { return connection_; }; | 24 | KRFBConnection *connection() { return connection_; }; |
24 | 25 | ||
25 | public slots: | 26 | public slots: |
26 | void openConnection(); | 27 | |
28 | void openConnection (KRFBServer); | ||
27 | void openURL( const QUrl & ); | 29 | void openURL( const QUrl & ); |
28 | void closeConnection(); | 30 | void closeConnection(); |
29 | void passwordRequired( KRFBConnection * ); | ||
30 | 31 | ||
31 | void refresh(); | 32 | void refresh(); |
32 | void bell(); | 33 | void bell(); |
34 | void sendCtlAltDel(void); | ||
33 | 35 | ||
34 | protected: | 36 | protected: |
35 | virtual void keyPressEvent( QKeyEvent * ); | 37 | virtual void keyPressEvent( QKeyEvent * ); |
36 | virtual void keyReleaseEvent( QKeyEvent * ); | 38 | virtual void keyReleaseEvent( QKeyEvent * ); |
37 | virtual void contentsMousePressEvent( QMouseEvent * ); | 39 | virtual void contentsMousePressEvent( QMouseEvent * ); |
38 | virtual void contentsMouseReleaseEvent( QMouseEvent * ); | 40 | virtual void contentsMouseReleaseEvent( QMouseEvent * ); |
39 | virtual void contentsMouseMoveEvent( QMouseEvent * ); | 41 | virtual void contentsMouseMoveEvent( QMouseEvent * ); |
40 | 42 | ||
41 | virtual void viewportPaintEvent( QPaintEvent *e ); | 43 | virtual void viewportPaintEvent( QPaintEvent *e ); |
42 | 44 | ||
43 | protected slots: | 45 | protected slots: |
44 | void loggedIn(); | 46 | void loggedIn(); |
diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp index c51f18a..389c836 100644 --- a/noncore/comm/keypebble/krfbconnection.cpp +++ b/noncore/comm/keypebble/krfbconnection.cpp | |||
@@ -1,242 +1,234 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | #include <qsocket.h> | 2 | #include <qsocket.h> |
3 | #include <qtimer.h> | 3 | #include <qtimer.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | 5 | ||
6 | #include "krfbconnection.h" | 6 | #include "krfbconnection.h" |
7 | #include "krfblogin.h" | 7 | #include "krfblogin.h" |
8 | #include "krfboptions.h" | 8 | #include "krfbserver.h" |
9 | #include "krfbdecoder.h" | 9 | #include "krfbdecoder.h" |
10 | #include "krfbbuffer.h" | 10 | #include "krfbbuffer.h" |
11 | 11 | ||
12 | KRFBConnection::KRFBConnection( QObject *parent ) | 12 | KRFBConnection::KRFBConnection( QObject *parent ) |
13 | : QObject( parent, "KRFBConnection" ) | 13 | : QObject( parent, "KRFBConnection" ) |
14 | { | 14 | { |
15 | portBase_ = 5900; | 15 | portBase_ = 5900; |
16 | currentState_ = Disconnected; | 16 | currentState_ = Disconnected; |
17 | sock = 0; | 17 | sock = 0; |
18 | minData_ = 0; | 18 | minData_ = 0; |
19 | options_ = new KRFBOptions(); | 19 | options_ = new KRFBServer(); |
20 | updater = 0; | 20 | updater = 0; |
21 | decoder_ = 0; | 21 | decoder_ = 0; |
22 | buffer_ = 0; | 22 | buffer_ = 0; |
23 | } | 23 | } |
24 | 24 | ||
25 | KRFBConnection::~KRFBConnection() | 25 | KRFBConnection::~KRFBConnection() |
26 | { | 26 | { |
27 | if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { | 27 | if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { |
28 | disconnectDone(); | 28 | disconnectDone(); |
29 | } | 29 | } |
30 | delete options_; | 30 | delete options_; |
31 | } | 31 | } |
32 | 32 | ||
33 | void KRFBConnection::connectTo( const QCString &host, int display ) | 33 | void KRFBConnection::connectTo( KRFBServer server) |
34 | { | 34 | { |
35 | if ( currentState_ != Disconnected ); | 35 | if ( currentState_ != Disconnected ) |
36 | disconnect(); | 36 | disconnect(); |
37 | |||
38 | (*options_)=server; | ||
37 | 39 | ||
38 | this->host_= host; | 40 | sock = new QSocket( this, "rfbSocket" ); |
39 | this->display_ = display; | 41 | CHECK_PTR( sock ); |
40 | 42 | ||
41 | sock = new QSocket( this, "rfbSocket" ); | 43 | // Connect to something to notice connection or error |
42 | CHECK_PTR( sock ); | 44 | connect( sock, SIGNAL( error( int ) ), SLOT( gotSocketError( int ) ) ); |
45 | connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); | ||
43 | 46 | ||
44 | // Connect to something to notice connection or error | 47 | qWarning( "Connecting..." ); |
45 | connect( sock, SIGNAL( error( int ) ), SLOT( gotSocketError( int ) ) ); | ||
46 | connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); | ||
47 | 48 | ||
48 | qWarning( "Connecting..." ); | 49 | currentState_ = Connecting; |
49 | 50 | sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); | |
50 | currentState_ = Connecting; | ||
51 | sock->connectToHost( host_, portBase_ + display_ ); | ||
52 | } | 51 | } |
53 | 52 | ||
54 | void KRFBConnection::disconnect() | 53 | void KRFBConnection::disconnect() |
55 | { | 54 | { |
56 | qWarning( "Disconnecting from server" ); | 55 | qWarning( "Disconnecting from server" ); |
57 | 56 | ||
58 | if ( ( currentState_ != Disconnected ) | 57 | if ( ( currentState_ != Disconnected ) |
59 | && ( currentState_ != Disconnecting ) | 58 | && ( currentState_ != Disconnecting ) |
60 | && sock ) { | 59 | && sock ) { |
61 | currentState_ = Disconnecting; | 60 | currentState_ = Disconnecting; |
62 | 61 | ||
63 | connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); | 62 | connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); |
64 | sock->close(); | 63 | sock->close(); |
65 | 64 | ||
66 | if ( sock->state() != QSocket::Closing ) | 65 | if ( sock->state() != QSocket::Closing ) |
67 | disconnectDone(); | 66 | disconnectDone(); |
68 | } | 67 | } |
69 | } | 68 | } |
70 | 69 | ||
71 | void KRFBConnection::disconnectDone() | 70 | void KRFBConnection::disconnectDone() |
72 | { | 71 | { |
73 | qWarning( "KRFBConnection disconnected" ); | 72 | currentState_ = Disconnected; |
74 | currentState_ = Disconnected; | 73 | delete sock; |
75 | delete sock; | 74 | sock = 0; |
76 | sock = 0; | 75 | minData_ = 0; |
77 | minData_ = 0; | 76 | delete updater; |
78 | delete updater; | 77 | delete decoder_; |
79 | delete decoder_; | 78 | delete buffer_; |
80 | delete buffer_; | 79 | emit disconnected(); |
81 | emit disconnected(); | ||
82 | } | 80 | } |
83 | 81 | ||
84 | void KRFBConnection::gotSocketConnection() | 82 | void KRFBConnection::gotSocketConnection() |
85 | { | 83 | { |
86 | currentState_ = LoggingIn; | 84 | currentState_ = LoggingIn; |
87 | 85 | ||
88 | qWarning( "Connected, logging in..." ); | 86 | qWarning( "Connected, logging in..." ); |
89 | 87 | ||
90 | static QString statusMsg = tr( "Connected" ); | 88 | static QString statusMsg = tr( "Connected" ); |
91 | emit statusChanged( statusMsg ); | 89 | emit statusChanged( statusMsg ); |
92 | 90 | ||
93 | // Do some login stuff | 91 | // Do some login stuff |
94 | login = new KRFBLogin( this ); | 92 | login = new KRFBLogin( this ); |
95 | } | 93 | } |
96 | 94 | ||
97 | void KRFBConnection::gotRFBConnection() | 95 | void KRFBConnection::gotRFBConnection() |
98 | { | 96 | { |
99 | qWarning( "Logged into server" ); | 97 | qWarning( "Logged into server" ); |
100 | 98 | ||
101 | currentState_ = Connected; | 99 | currentState_ = Connected; |
102 | emit connected(); | 100 | emit connected(); |
103 | 101 | ||
104 | // Create the decoder and start doing stuff | 102 | // Create the decoder and start doing stuff |
105 | decoder_ = new KRFBDecoder( this ); | 103 | decoder_ = new KRFBDecoder( this ); |
106 | CHECK_PTR( decoder_ ); | 104 | CHECK_PTR( decoder_ ); |
107 | 105 | ||
108 | buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" ); | 106 | buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" ); |
109 | CHECK_PTR( buffer_ ); | 107 | CHECK_PTR( buffer_ ); |
110 | decoder_->setBuffer( buffer_ ); | 108 | decoder_->setBuffer( buffer_ ); |
111 | 109 | ||
112 | connect( decoder_, SIGNAL( status( const QString & ) ), | 110 | connect( decoder_, SIGNAL( status( const QString & ) ), |
113 | this, SIGNAL( statusChanged( const QString & ) ) ); | 111 | this, SIGNAL( statusChanged( const QString & ) ) ); |
114 | emit loggedIn(); | 112 | emit loggedIn(); |
115 | 113 | ||
116 | decoder_->start(); | 114 | decoder_->start(); |
117 | 115 | ||
118 | updater = new QTimer; | 116 | updater = new QTimer; |
119 | connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) ); | 117 | connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) ); |
120 | updater->start( options_->updateRate ); | 118 | updater->start( options_->updateRate ); |
121 | } | 119 | } |
122 | 120 | ||
123 | void KRFBConnection::gotSocketError( int err ) | 121 | void KRFBConnection::gotSocketError( int err ) |
124 | { | 122 | { |
125 | currentState_ = Error; | 123 | currentState_ = Error; |
126 | 124 | ||
127 | // Do some error handling stuff | 125 | // Do some error handling stuff |
128 | qWarning( "KRFBConnection: Socket error %d", err ); | 126 | qWarning( "KRFBConnection: Socket error %d", err ); |
129 | 127 | ||
130 | static QString refused = tr( "Connection Refused" ); | 128 | static QString refused = tr( "Connection Refused" ); |
131 | static QString host = tr( "Host not found" ); | 129 | static QString host = tr( "Host not found" ); |
132 | static QString read = tr( "Read Error: QSocket reported an error reading\n" | 130 | static QString read = tr( "Read Error: QSocket reported an error reading\n" |
133 | "data, the remote host has probably dropped the\n" | 131 | "data, the remote host has probably dropped the\n" |
134 | "connection." ); | 132 | "connection." ); |
135 | static QString confused = tr( "QSocket reported an invalid error code" ); | 133 | static QString confused = tr( "QSocket reported an invalid error code" ); |
136 | 134 | ||
137 | QString msg; | 135 | QString msg; |
138 | switch ( err ) { | 136 | switch ( err ) { |
139 | case QSocket::ErrConnectionRefused: | 137 | case QSocket::ErrConnectionRefused: |
140 | msg = refused; | 138 | msg = refused; |
141 | break; | 139 | break; |
142 | case QSocket::ErrHostNotFound: | 140 | case QSocket::ErrHostNotFound: |
143 | msg = host; | 141 | msg = host; |
144 | break; | 142 | break; |
145 | case QSocket::ErrSocketRead: | 143 | case QSocket::ErrSocketRead: |
146 | msg = read; | 144 | msg = read; |
147 | break; | 145 | break; |
148 | default: | 146 | default: |
149 | msg = confused; | 147 | msg = confused; |
150 | }; | 148 | }; |
151 | 149 | ||
152 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); | 150 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); |
153 | delete sock; | 151 | delete sock; |
154 | sock = 0; | 152 | sock = 0; |
155 | currentState_ = Disconnected; | 153 | currentState_ = Disconnected; |
156 | 154 | ||
157 | emit error( msg ); | 155 | emit error( msg ); |
158 | } | 156 | } |
159 | 157 | ||
160 | void KRFBConnection::gotMoreData() | 158 | void KRFBConnection::gotMoreData() |
161 | { | 159 | { |
162 | assert( minData_ > 0 ); | 160 | assert( minData_ > 0 ); |
163 | 161 | ||
164 | if ( sock->size() >= minData_ ) { | 162 | if ( sock->size() >= minData_ ) { |
165 | minData_ = 0; | 163 | minData_ = 0; |
166 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); | 164 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); |
167 | emit gotEnoughData(); | 165 | emit gotEnoughData(); |
168 | } | 166 | } |
169 | } | 167 | } |
170 | 168 | ||
171 | void KRFBConnection::waitForData( unsigned int sz ) | 169 | void KRFBConnection::waitForData( unsigned int sz ) |
172 | { | 170 | { |
173 | assert( minData_ == 0 ); | 171 | assert( minData_ == 0 ); |
174 | assert( sz > 0 ); | 172 | assert( sz > 0 ); |
175 | assert( currentState_ != Error ); | 173 | assert( currentState_ != Error ); |
176 | 174 | ||
177 | if ( sock->size() >= sz ) { | 175 | if ( sock->size() >= sz ) { |
178 | // qWarning( "No need to wait for data" ); | 176 | // qWarning( "No need to wait for data" ); |
179 | emit gotEnoughData(); | 177 | emit gotEnoughData(); |
180 | } | 178 | } |
181 | else { | 179 | else { |
182 | // qWarning( "Waiting for %u bytes", sz ); | 180 | // qWarning( "Waiting for %u bytes", sz ); |
183 | 181 | minData_ = sz; | |
184 | minData_ = sz; | 182 | connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); |
185 | connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); | 183 | } |
186 | } | ||
187 | } | 184 | } |
188 | 185 | ||
189 | int KRFBConnection::read( void *buf, int sz ) | 186 | int KRFBConnection::read( void *buf, int sz ) |
190 | { | 187 | { |
191 | return sock->readBlock( (char *) buf, sz ); | 188 | return sock->readBlock( (char *) buf, sz ); |
192 | } | 189 | } |
193 | 190 | ||
194 | int KRFBConnection::write( void *buf, int sz ) | 191 | int KRFBConnection::write( void *buf, int sz ) |
195 | { | 192 | { |
196 | return sock->writeBlock( (const char *) buf, sz ); | 193 | return sock->writeBlock( (const char *) buf, sz ); |
197 | } | 194 | } |
198 | 195 | ||
199 | KRFBConnection::State KRFBConnection::state() const | 196 | KRFBConnection::State KRFBConnection::state() const |
200 | { | 197 | { |
201 | return currentState_; | 198 | return currentState_; |
202 | } | 199 | } |
203 | 200 | ||
204 | void KRFBConnection::setPortBase( int base ) | 201 | void KRFBConnection::setPortBase( int base ) |
205 | { | 202 | { |
206 | portBase_ = base; | 203 | portBase_ = base; |
207 | } | 204 | } |
208 | 205 | ||
209 | int KRFBConnection::portBase() const | 206 | int KRFBConnection::portBase() const |
210 | { | 207 | { |
211 | return portBase_; | 208 | return portBase_; |
212 | } | ||
213 | |||
214 | void KRFBConnection::setPassword( const QCString &pass ) | ||
215 | { | ||
216 | this->pass_ = pass; | ||
217 | } | 209 | } |
218 | 210 | ||
219 | void KRFBConnection::updateTimer() | 211 | void KRFBConnection::updateTimer() |
220 | { | 212 | { |
221 | decoder_->sendUpdateRequest( true ); | 213 | decoder_->sendUpdateRequest( true ); |
222 | } | 214 | } |
223 | 215 | ||
224 | void KRFBConnection::refresh() | 216 | void KRFBConnection::refresh() |
225 | { | 217 | { |
226 | decoder_->sendUpdateRequest( false ); | 218 | decoder_->sendUpdateRequest( false ); |
227 | } | 219 | } |
228 | 220 | ||
229 | void KRFBConnection::sendCutText( const QString &text ) | 221 | void KRFBConnection::sendCutText( const QString &text ) |
230 | { | 222 | { |
231 | decoder_->sendCutEvent( text ); | 223 | decoder_->sendCutEvent( text ); |
232 | } | 224 | } |
233 | 225 | ||
234 | const QUrl &KRFBConnection::url() | 226 | const QUrl &KRFBConnection::url() |
235 | { | 227 | { |
236 | url_.setProtocol( "vnc" ); | 228 | url_.setProtocol( "vnc" ); |
237 | url_.setPort( display() ); | 229 | url_.setPort( display() ); |
238 | url_.setHost( host() ); | 230 | url_.setHost( host() ); |
239 | url_.setPath( "/" ); | 231 | url_.setPath( "/" ); |
240 | 232 | ||
241 | return url_; | 233 | return url_; |
242 | } | 234 | } |
diff --git a/noncore/comm/keypebble/krfbconnection.h b/noncore/comm/keypebble/krfbconnection.h index fe477c1..a8d3457 100644 --- a/noncore/comm/keypebble/krfbconnection.h +++ b/noncore/comm/keypebble/krfbconnection.h | |||
@@ -1,25 +1,26 @@ | |||
1 | // -*- c++ -*- | 1 | // -*- c++ -*- |
2 | 2 | ||
3 | #ifndef KRFBCONNECTION_H | 3 | #ifndef KRFBCONNECTION_H |
4 | #define KRFBCONNECTION_H | 4 | #define KRFBCONNECTION_H |
5 | 5 | ||
6 | #include <qobject.h> | 6 | #include <qobject.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qcstring.h> | 8 | #include <qcstring.h> |
9 | #include "krfbserver.h" | ||
9 | #include <qurl.h> | 10 | #include <qurl.h> |
10 | 11 | ||
11 | class KRFBLogin; | 12 | class KRFBLogin; |
12 | class KRBUpdateHandler; | 13 | class KRBUpdateHandler; |
13 | class KRFBOptions; | 14 | class KRFBServer; |
14 | class QSocket; | 15 | class QSocket; |
15 | class KRFBDecoder; | 16 | class KRFBDecoder; |
16 | class KRFBBuffer; | 17 | class KRFBBuffer; |
17 | class QTimer; | 18 | class QTimer; |
18 | 19 | ||
19 | /** | 20 | /** |
20 | * Encapsulates the RFB socket. | 21 | * Encapsulates the RFB socket. |
21 | * | 22 | * |
22 | */ | 23 | */ |
23 | class KRFBConnection : public QObject | 24 | class KRFBConnection : public QObject |
24 | { | 25 | { |
25 | Q_OBJECT | 26 | Q_OBJECT |
@@ -36,50 +37,47 @@ public: | |||
36 | Disconnecting, | 37 | Disconnecting, |
37 | Disconnected, | 38 | Disconnected, |
38 | Error | 39 | Error |
39 | }; | 40 | }; |
40 | 41 | ||
41 | KRFBConnection( QObject *parent = 0 ); | 42 | KRFBConnection( QObject *parent = 0 ); |
42 | ~KRFBConnection(); | 43 | ~KRFBConnection(); |
43 | 44 | ||
44 | //* Get the state of a connection. | 45 | //* Get the state of a connection. |
45 | State state() const; | 46 | State state() const; |
46 | 47 | ||
47 | //* Get the options for this connection | 48 | //* Get the options for this connection |
48 | KRFBOptions *options() const { return options_; }; | 49 | KRFBServer *options() const { return options_; }; |
49 | 50 | ||
50 | KRFBBuffer *buffer() const { return buffer_; }; | 51 | KRFBBuffer *buffer() const { return buffer_; }; |
51 | 52 | ||
52 | KRFBDecoder *decoder() const { return decoder_; }; | 53 | KRFBDecoder *decoder() const { return decoder_; }; |
53 | 54 | ||
54 | //* Set the base from which the port for a given display will be calculated. | 55 | //* Set the base from which the port for a given display will be calculated. |
55 | void setPortBase( int base ); | 56 | void setPortBase( int base ); |
56 | 57 | ||
57 | //* Get the base from which the port for a given display is calculated. | 58 | //* Get the base from which the port for a given display is calculated. |
58 | int portBase() const; | 59 | int portBase() const; |
59 | 60 | ||
60 | //* Set the password which will be used to login | ||
61 | void setPassword( const QCString &pass ); | ||
62 | |||
63 | //* Open a connection | 61 | //* Open a connection |
64 | void connectTo( const QCString &host, int display ); | 62 | void connectTo( KRFBServer); |
65 | 63 | ||
66 | //* Close the connection | 64 | //* Close the connection |
67 | void disconnect(); | 65 | void disconnect(); |
68 | 66 | ||
69 | //* Get the host | 67 | //* Get the host |
70 | const QCString host() const { return host_; }; | 68 | const QCString host() const { return options_->hostname.latin1(); }; |
71 | 69 | ||
72 | //* Get the display | 70 | //* Get the display |
73 | int display() const { return display_; }; | 71 | int display() const { return options_->display; }; |
74 | 72 | ||
75 | //* Get the current host/display as a URL | 73 | //* Get the current host/display as a URL |
76 | const QUrl &url(); | 74 | const QUrl &url(); |
77 | 75 | ||
78 | //* Reload the display | 76 | //* Reload the display |
79 | void refresh(); | 77 | void refresh(); |
80 | 78 | ||
81 | //* Send text to the remote clipboard | 79 | //* Send text to the remote clipboard |
82 | void sendCutText( const QString & ); | 80 | void sendCutText( const QString & ); |
83 | 81 | ||
84 | protected slots: | 82 | protected slots: |
85 | //* When the shit hits the fan | 83 | //* When the shit hits the fan |
@@ -124,29 +122,26 @@ signals: | |||
124 | 122 | ||
125 | private: | 123 | private: |
126 | // | 124 | // |
127 | // The following are called by our friends. | 125 | // The following are called by our friends. |
128 | // | 126 | // |
129 | 127 | ||
130 | void waitForData( unsigned int ); | 128 | void waitForData( unsigned int ); |
131 | 129 | ||
132 | int read( void *buf, int sz ); | 130 | int read( void *buf, int sz ); |
133 | int write( void *buf, int sz ); | 131 | int write( void *buf, int sz ); |
134 | 132 | ||
135 | private: | 133 | private: |
136 | QCString host_; | ||
137 | int portBase_; | 134 | int portBase_; |
138 | int display_; | ||
139 | QCString pass_; | ||
140 | QSocket *sock; | 135 | QSocket *sock; |
141 | State currentState_; | 136 | State currentState_; |
142 | unsigned int minData_; | 137 | unsigned int minData_; |
143 | QTimer *updater; | 138 | QTimer *updater; |
144 | KRFBLogin *login; | 139 | KRFBLogin *login; |
145 | KRFBDecoder *decoder_; | 140 | KRFBDecoder *decoder_; |
146 | KRFBOptions *options_; | 141 | KRFBServer *options_; |
147 | KRFBBuffer *buffer_; | 142 | KRFBBuffer *buffer_; |
148 | QUrl url_; | 143 | QUrl url_; |
149 | }; | 144 | }; |
150 | 145 | ||
151 | #endif // KRFBCONNECTION_H | 146 | #endif // KRFBCONNECTION_H |
152 | 147 | ||
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index 174dd7b..a964c09 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp | |||
@@ -1,14 +1,14 @@ | |||
1 | #include "krfbconnection.h" | 1 | #include "krfbconnection.h" |
2 | #include "krfboptions.h" | 2 | #include "krfbserver.h" |
3 | #include "krfbserverinfo.h" | 3 | #include "krfbserverinfo.h" |
4 | #include "krfbdecoder.h" | 4 | #include "krfbdecoder.h" |
5 | #include "krfbbuffer.h" | 5 | #include "krfbbuffer.h" |
6 | 6 | ||
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | #include <qpixmap.h> | 9 | #include <qpixmap.h> |
10 | #include <qsocket.h> | 10 | #include <qsocket.h> |
11 | #include <qevent.h> | 11 | #include <qevent.h> |
12 | #include <qstring.h> | 12 | #include <qstring.h> |
13 | #include <qclipboard.h> | 13 | #include <qclipboard.h> |
14 | 14 | ||
@@ -787,24 +787,25 @@ void KRFBDecoder::sendKeyReleaseEvent( QKeyEvent *event ) | |||
787 | key = Swap32IfLE( key ); | 787 | key = Swap32IfLE( key ); |
788 | 788 | ||
789 | CARD8 mask = false; | 789 | CARD8 mask = false; |
790 | 790 | ||
791 | CARD16 padding = 0; | 791 | CARD16 padding = 0; |
792 | con->write( &KeyEventId, 1 ); | 792 | con->write( &KeyEventId, 1 ); |
793 | con->write( &mask, 1 ); | 793 | con->write( &mask, 1 ); |
794 | con->write( &padding, 2 ); | 794 | con->write( &padding, 2 ); |
795 | con->write( &key, 4 ); | 795 | con->write( &key, 4 ); |
796 | } | 796 | } |
797 | } | 797 | } |
798 | 798 | ||
799 | |||
799 | int KRFBDecoder::toKeySym( QKeyEvent *k ) | 800 | int KRFBDecoder::toKeySym( QKeyEvent *k ) |
800 | { | 801 | { |
801 | int ke = 0; | 802 | int ke = 0; |
802 | 803 | ||
803 | ke = k->ascii(); | 804 | ke = k->ascii(); |
804 | // Markus: Crappy hack. I dont know why lower case letters are | 805 | // Markus: Crappy hack. I dont know why lower case letters are |
805 | // not defined in qkeydefs.h. The key() for e.g. 'l' == 'L'. | 806 | // not defined in qkeydefs.h. The key() for e.g. 'l' == 'L'. |
806 | // This sucks. :-( | 807 | // This sucks. :-( |
807 | 808 | ||
808 | if ( (ke == 'a') || (ke == 'b') || (ke == 'c') || (ke == 'd') | 809 | if ( (ke == 'a') || (ke == 'b') || (ke == 'c') || (ke == 'd') |
809 | || (ke == 'e') || (ke == 'f') || (ke == 'g') || (ke == 'h') | 810 | || (ke == 'e') || (ke == 'f') || (ke == 'g') || (ke == 'h') |
810 | || (ke == 'i') || (ke == 'j') || (ke == 'k') || (ke == 'l') | 811 | || (ke == 'i') || (ke == 'j') || (ke == 'k') || (ke == 'l') |
diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp index cc3a8fa..0d2a205 100644 --- a/noncore/comm/keypebble/krfblogin.cpp +++ b/noncore/comm/keypebble/krfblogin.cpp | |||
@@ -43,26 +43,24 @@ const int endianTest = 1; | |||
43 | (((l) & 0x000000ff) << 24)) : (l)) | 43 | (((l) & 0x000000ff) << 24)) : (l)) |
44 | 44 | ||
45 | KRFBLogin::KRFBLogin( KRFBConnection *con ) | 45 | KRFBLogin::KRFBLogin( KRFBConnection *con ) |
46 | : QObject( con, "RFB login manager" ) | 46 | : QObject( con, "RFB login manager" ) |
47 | { | 47 | { |
48 | assert( con ); | 48 | assert( con ); |
49 | this->con = con; | 49 | this->con = con; |
50 | currentState = AwaitingServerVersion; | 50 | currentState = AwaitingServerVersion; |
51 | 51 | ||
52 | connect( this, SIGNAL( error( const QString & ) ), | 52 | connect( this, SIGNAL( error( const QString & ) ), |
53 | con, SIGNAL( error( const QString & ) ) ); | 53 | con, SIGNAL( error( const QString & ) ) ); |
54 | 54 | ||
55 | connect( this, SIGNAL( passwordRequired( KRFBConnection * ) ), | ||
56 | con, SIGNAL( passwordRequired( KRFBConnection * ) ) ); | ||
57 | 55 | ||
58 | qWarning( "Waiting for server version..." ); | 56 | qWarning( "Waiting for server version..." ); |
59 | 57 | ||
60 | static QString statusMsg = tr( "Waiting for server version..." ); | 58 | static QString statusMsg = tr( "Waiting for server version..." ); |
61 | emit status( statusMsg ); | 59 | emit status( statusMsg ); |
62 | 60 | ||
63 | // Kick off the state machine | 61 | // Kick off the state machine |
64 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); | 62 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); |
65 | con->waitForData( ServerVersionLength ); | 63 | con->waitForData( ServerVersionLength ); |
66 | } | 64 | } |
67 | 65 | ||
68 | KRFBLogin::~KRFBLogin() | 66 | KRFBLogin::~KRFBLogin() |
@@ -174,38 +172,38 @@ void KRFBLogin::gotChallenge() | |||
174 | this, SLOT( gotChallenge() ) ); | 172 | this, SLOT( gotChallenge() ) ); |
175 | 173 | ||
176 | QTimer::singleShot( 0, this, SLOT(getPassword()) ); | 174 | QTimer::singleShot( 0, this, SLOT(getPassword()) ); |
177 | } | 175 | } |
178 | 176 | ||
179 | void KRFBLogin::getPassword() | 177 | void KRFBLogin::getPassword() |
180 | { | 178 | { |
181 | // Got data | 179 | // Got data |
182 | CARD8 challenge[ ChallengeLength ]; | 180 | CARD8 challenge[ ChallengeLength ]; |
183 | con->read( challenge, ChallengeLength ); | 181 | con->read( challenge, ChallengeLength ); |
184 | 182 | ||
185 | // Last chance to enter a password | 183 | // Last chance to enter a password |
186 | if ( con->pass_.isNull() ) { | 184 | if ( con->options_->password.isNull() ) { |
187 | qWarning( "krfblogin needs a password" ); | 185 | qWarning( "krfblogin needs a password" ); |
188 | emit passwordRequired( con ); | 186 | emit passwordRequired( con ); |
189 | } | 187 | } |
190 | 188 | ||
191 | if ( con->pass_.isNull() ) { | 189 | if ( con->options_->password.isNull() ) { |
192 | QString msg = tr( "Error: This server requires a password, but none " | 190 | QString msg = tr( "Error: This server requires a password, but none " |
193 | "has been specified.\n" ); | 191 | "has been specified.\n" ); |
194 | 192 | ||
195 | emit error( msg ); | 193 | emit error( msg ); |
196 | return; | 194 | return; |
197 | } | 195 | } |
198 | 196 | ||
199 | vncEncryptBytes( (unsigned char *) challenge, con->pass_.data() ); | 197 | vncEncryptBytes( (unsigned char *) challenge, QCString(con->options_->password.latin1()).data() ); |
200 | con->write( challenge, ChallengeLength ); | 198 | con->write( challenge, ChallengeLength ); |
201 | 199 | ||
202 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthResult() ) ); | 200 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthResult() ) ); |
203 | con->waitForData( AuthResultLength ); | 201 | con->waitForData( AuthResultLength ); |
204 | } | 202 | } |
205 | 203 | ||
206 | void KRFBLogin::gotFailureReasonSize() | 204 | void KRFBLogin::gotFailureReasonSize() |
207 | { | 205 | { |
208 | disconnect( con, SIGNAL( gotEnoughData() ), this, | 206 | disconnect( con, SIGNAL( gotEnoughData() ), this, |
209 | SLOT( gotFailureReasonSize() ) ); | 207 | SLOT( gotFailureReasonSize() ) ); |
210 | } | 208 | } |
211 | 209 | ||
diff --git a/noncore/comm/keypebble/krfboptions.cpp b/noncore/comm/keypebble/krfboptions.cpp deleted file mode 100644 index 8c4320b..0000000 --- a/noncore/comm/keypebble/krfboptions.cpp +++ b/dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | #include <qpe/config.h> | ||
2 | #include <qpe/qpeapplication.h> | ||
3 | #include "krfboptions.h" | ||
4 | |||
5 | KRFBOptions::KRFBOptions() | ||
6 | { | ||
7 | readSettings(); | ||
8 | } | ||
9 | |||
10 | KRFBOptions::~KRFBOptions() | ||
11 | { | ||
12 | writeSettings(); | ||
13 | } | ||
14 | |||
15 | void KRFBOptions::readSettings() | ||
16 | { | ||
17 | Config config( "keypebble" ); | ||
18 | config.setGroup("Settings"); | ||
19 | hexTile = config.readBoolEntry( "HexTile", 0 ); | ||
20 | corre = config.readBoolEntry( "CORRE", 0 ); | ||
21 | rre = config.readBoolEntry( "RRE", 0 ); | ||
22 | copyrect = config.readBoolEntry( "CopyRect", 1 ); | ||
23 | colors256 = config.readBoolEntry( "Colors256", 0 ); | ||
24 | shared = config.readBoolEntry( "Shared", 0 ); | ||
25 | readOnly = config.readBoolEntry( "ReadOnly", 0 ); | ||
26 | updateRate = config.readNumEntry( "UpdateRate", 50 ); | ||
27 | deIconify = config.readBoolEntry( "DeIconify", 0 ); | ||
28 | } | ||
29 | |||
30 | void KRFBOptions::writeSettings() | ||
31 | { | ||
32 | Config config( "keypebble" ); | ||
33 | config.setGroup("Settings"); | ||
34 | config.writeEntry( "HexTile", hexTile ); | ||
35 | config.writeEntry( "CORRE", corre ); | ||
36 | config.writeEntry( "RRE", rre ); | ||
37 | config.writeEntry( "CopyRect", copyrect ); | ||
38 | config.writeEntry( "Colors256", colors256 ); | ||
39 | config.writeEntry( "Shared", shared ); | ||
40 | config.writeEntry( "ReadOnly", readOnly ); | ||
41 | config.writeEntry( "UpdateRate", updateRate ); | ||
42 | config.writeEntry( "DeIconify", deIconify ); | ||
43 | } | ||
44 | |||
45 | int KRFBOptions::encodings() | ||
46 | { | ||
47 | // Initially one because we always support raw encoding | ||
48 | int count = 1; | ||
49 | |||
50 | count += hexTile ? 1 : 0; | ||
51 | count += corre ? 1 : 0; | ||
52 | count += rre ? 1 : 0; | ||
53 | count += copyrect ? 1 : 0; | ||
54 | |||
55 | return count; | ||
56 | } | ||
diff --git a/noncore/comm/keypebble/krfboptions.h b/noncore/comm/keypebble/krfboptions.h deleted file mode 100644 index fd2b65c..0000000 --- a/noncore/comm/keypebble/krfboptions.h +++ b/dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | // -*- c++ -*- | ||
2 | |||
3 | #ifndef KRFBOPTIONS_H | ||
4 | #define KRFBOPTIONS_H | ||
5 | |||
6 | class Config; | ||
7 | |||
8 | class KRFBOptions | ||
9 | { | ||
10 | public: | ||
11 | KRFBOptions(); | ||
12 | ~KRFBOptions(); | ||
13 | |||
14 | int encodings(); | ||
15 | void readSettings(); | ||
16 | void writeSettings(); | ||
17 | |||
18 | bool hexTile; | ||
19 | bool corre; | ||
20 | bool rre; | ||
21 | bool copyrect; | ||
22 | |||
23 | bool colors256; | ||
24 | bool shared; | ||
25 | bool readOnly; | ||
26 | bool deIconify; | ||
27 | |||
28 | int updateRate; | ||
29 | }; | ||
30 | |||
31 | #endif // KRFBOPTIONS_H | ||
diff --git a/noncore/comm/keypebble/krfbserver.cpp b/noncore/comm/keypebble/krfbserver.cpp new file mode 100644 index 0000000..5775f09 --- a/dev/null +++ b/noncore/comm/keypebble/krfbserver.cpp | |||
@@ -0,0 +1,39 @@ | |||
1 | #include <qpe/config.h> | ||
2 | #include <qpe/qpeapplication.h> | ||
3 | #include "krfbserver.h" | ||
4 | |||
5 | KRFBServer::KRFBServer() | ||
6 | { | ||
7 | QString name; | ||
8 | QString hostname; | ||
9 | QString password; | ||
10 | display=0; | ||
11 | |||
12 | hexTile=0; | ||
13 | corre=0; | ||
14 | rre=0; | ||
15 | copyrect=1; | ||
16 | |||
17 | colors256=1; | ||
18 | shared=0; | ||
19 | readOnly=0; | ||
20 | deIconify=0; | ||
21 | |||
22 | updateRate=0; | ||
23 | } | ||
24 | KRFBServer::~KRFBServer() | ||
25 | { | ||
26 | } | ||
27 | |||
28 | int KRFBServer::encodings() | ||
29 | { | ||
30 | // Initially one because we always support raw encoding | ||
31 | int count = 1; | ||
32 | |||
33 | count += hexTile ? 1 : 0; | ||
34 | count += corre ? 1 : 0; | ||
35 | count += rre ? 1 : 0; | ||
36 | count += copyrect ? 1 : 0; | ||
37 | |||
38 | return count; | ||
39 | } | ||
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp index 43cffc5..aa46e2f 100644 --- a/noncore/comm/keypebble/kvnc.cpp +++ b/noncore/comm/keypebble/kvnc.cpp | |||
@@ -1,32 +1,45 @@ | |||
1 | #include <qiconset.h> | 1 | #include <qiconset.h> |
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qpixmap.h> | 3 | #include <qpixmap.h> |
4 | #include <qdom.h> | 4 | #include <qdom.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qstatusbar.h> | 7 | #include <qstatusbar.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qtimer.h> | 11 | #include <qtimer.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qspinbox.h> | ||
14 | #include <qlistbox.h> | ||
15 | #include <qlineedit.h> | ||
13 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
14 | #include <qpe/global.h> | 17 | #include <qpe/global.h> |
18 | #include <qpe/qpetoolbar.h> | ||
19 | #include <qpe/resource.h> | ||
20 | |||
15 | #include <assert.h> | 21 | #include <assert.h> |
16 | 22 | ||
17 | #include "kvnc.h" | 23 | #include "kvnc.h" |
18 | #include "krfbcanvas.h" | 24 | #include "krfbcanvas.h" |
19 | #include "kvncoptionsdlg.h" | ||
20 | #include "krfbconnection.h" | 25 | #include "krfbconnection.h" |
26 | #include "kvncconndlg.h" | ||
27 | #include "krfbserver.h" | ||
28 | |||
29 | static int u_id = 1; | ||
30 | static int get_unique_id() | ||
31 | { | ||
32 | return u_id++; | ||
33 | } | ||
21 | 34 | ||
22 | 35 | ||
23 | /* XPM */ | 36 | /* XPM */ |
24 | static char * menu_xpm[] = { | 37 | static char * menu_xpm[] = { |
25 | "12 12 5 1", | 38 | "12 12 5 1", |
26 | " c None", | 39 | " c None", |
27 | ".c #000000", | 40 | ".c #000000", |
28 | "+c #FFFDAD", | 41 | "+c #FFFDAD", |
29 | "@c #FFFF00", | 42 | "@c #FFFF00", |
30 | "#c #E5E100", | 43 | "#c #E5E100", |
31 | " ", | 44 | " ", |
32 | " ", | 45 | " ", |
@@ -39,152 +52,221 @@ static char * menu_xpm[] = { | |||
39 | " .+#. ", | 52 | " .+#. ", |
40 | " .+. ", | 53 | " .+. ", |
41 | " .. ", | 54 | " .. ", |
42 | " "}; | 55 | " "}; |
43 | 56 | ||
44 | const int StatusTextId = 0; | 57 | const int StatusTextId = 0; |
45 | 58 | ||
46 | KVNC::KVNC( const char *name ) : QMainWindow( 0, name ) | 59 | KVNC::KVNC( const char *name ) : QMainWindow( 0, name ) |
47 | { | 60 | { |
48 | setCaption( tr("VNC Viewer") ); | 61 | setCaption( tr("VNC Viewer") ); |
49 | fullscreen = false; | 62 | fullscreen = false; |
50 | 63 | ||
51 | canvas = new KRFBCanvas( this, "canvas" ); | 64 | stack = new QWidgetStack( this ); |
52 | setCentralWidget( canvas ); | 65 | setCentralWidget( stack ); |
53 | 66 | ||
67 | bookmarkSelector=new KVNCBookmarkDlg(); | ||
68 | stack->addWidget(bookmarkSelector,get_unique_id()); | ||
69 | stack->raiseWidget( bookmarkSelector ); | ||
70 | |||
71 | canvas = new KRFBCanvas( stack, "canvas" ); | ||
72 | stack->addWidget(canvas,get_unique_id()); | ||
73 | setCentralWidget( stack ); | ||
74 | |||
75 | connect( bookmarkSelector->bookmarkList, SIGNAL(doubleClicked(QListBoxItem *)), | ||
76 | this, SLOT(openConnection(QListBoxItem *)) ); | ||
54 | connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), | 77 | connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), |
55 | this, SLOT(statusMessage(const QString &)) ); | 78 | this, SLOT(statusMessage(const QString &)) ); |
56 | connect( canvas->connection(), SIGNAL(error(const QString &)), | 79 | connect( canvas->connection(), SIGNAL(error(const QString &)), |
57 | this, SLOT(error(const QString &)) ); | 80 | this, SLOT(error(const QString &)) ); |
58 | connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); | 81 | connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); |
59 | connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); | 82 | connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); |
60 | connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); | 83 | connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); |
61 | 84 | ||
62 | setupActions(); | 85 | setupActions(); |
63 | 86 | ||
64 | cornerButton = new QPushButton( this ); | 87 | cornerButton = new QPushButton( this ); |
65 | cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); | 88 | cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); |
66 | connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); | 89 | connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); |
67 | canvas->setCornerWidget( cornerButton ); | 90 | canvas->setCornerWidget( cornerButton ); |
68 | 91 | ||
69 | QTimer::singleShot( 0, canvas, SLOT(openConnection()) ); | 92 | stack->raiseWidget( bookmarkSelector ); |
93 | |||
94 | |||
95 | QPEToolBar *bar = new QPEToolBar( this ); | ||
96 | |||
97 | QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), | ||
98 | QString::null, 0, this, 0 ); | ||
99 | connect( n, SIGNAL( activated() ), | ||
100 | this, SLOT( newConnection() ) ); | ||
101 | n->addTo( bar ); | ||
102 | |||
103 | QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "edit" ), | ||
104 | QString::null, 0, this, 0 ); | ||
105 | connect( o, SIGNAL( activated() ), | ||
106 | this, SLOT( openConnection() ) ); | ||
107 | o->addTo( bar ); | ||
108 | |||
109 | QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), | ||
110 | QString::null, 0, this, 0 ); | ||
111 | connect( d, SIGNAL( activated() ), | ||
112 | this, SLOT( deleteBookmark() ) ); | ||
113 | d->addTo( bar ); | ||
70 | } | 114 | } |
71 | 115 | ||
72 | KVNC::~KVNC() | 116 | KVNC::~KVNC() |
73 | { | 117 | { |
118 | |||
119 | } | ||
120 | |||
121 | void KVNC::newConnection() | ||
122 | { | ||
123 | curServer=new KRFBServer; | ||
124 | |||
125 | KVNCConnDlg dlg( curServer,this); | ||
126 | dlg.showMaximized(); | ||
127 | if (dlg.exec()) { | ||
128 | if (!curServer->name.isEmpty()) | ||
129 | bookmarkSelector->addBookmark(curServer); | ||
130 | canvas->openConnection(*curServer); | ||
131 | } else | ||
132 | curServer=0; | ||
133 | } | ||
134 | |||
135 | void KVNC::openConnection( QString name) | ||
136 | { | ||
137 | curServer=bookmarkSelector->getServer(name); | ||
138 | |||
139 | if (curServer) { | ||
140 | KVNCConnDlg dlg( curServer,this); | ||
141 | dlg.showMaximized(); | ||
142 | |||
143 | if ( dlg.exec() ) { | ||
144 | canvas->openConnection(*curServer); | ||
145 | bookmarkSelector->writeBookmarks(); | ||
146 | } else | ||
147 | curServer=0; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | void KVNC::openConnection( void ) | ||
152 | { | ||
153 | openConnection( bookmarkSelector->selectedBookmark()); | ||
74 | } | 154 | } |
75 | 155 | ||
76 | void KVNC::openURL( const QUrl &url ) | 156 | void KVNC::openConnection( QListBoxItem * item) |
77 | { | 157 | { |
78 | canvas->openURL( url ); | 158 | openConnection(item->text()); |
79 | } | 159 | } |
80 | 160 | ||
81 | void KVNC::setupActions() | 161 | void KVNC::setupActions() |
82 | { | 162 | { |
83 | cornerMenu = new QPopupMenu( this ); | 163 | cornerMenu = new QPopupMenu( this ); |
84 | 164 | ||
85 | fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); | 165 | fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); |
86 | connect( fullScreenAction, SIGNAL(activated()), | 166 | connect( fullScreenAction, SIGNAL(activated()), |
87 | this, SLOT( toggleFullScreen() ) ); | 167 | this, SLOT( toggleFullScreen() ) ); |
88 | fullScreenAction->addTo( cornerMenu ); | 168 | fullScreenAction->addTo( cornerMenu ); |
89 | fullScreenAction->setEnabled( false ); | 169 | fullScreenAction->setEnabled( false ); |
90 | 170 | ||
91 | optionsAction = new QAction( tr("Settings"), QString::null, 0, 0 ); | 171 | ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); |
92 | connect( optionsAction, SIGNAL(activated()), this, SLOT( showOptions() ) ); | 172 | connect( ctlAltDelAction, SIGNAL(activated()), |
93 | optionsAction->addTo( cornerMenu ); | 173 | canvas, SLOT( sendCtlAltDel() ) ); |
94 | 174 | ctlAltDelAction->addTo( cornerMenu ); | |
95 | connectAction = new QAction( tr("Connect..."), QString::null, 0, 0 ); | 175 | ctlAltDelAction->setEnabled( false ); |
96 | connect( connectAction, SIGNAL(activated()), | ||
97 | canvas, SLOT( openConnection() ) ); | ||
98 | connectAction->addTo( cornerMenu ); | ||
99 | 176 | ||
100 | disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); | 177 | disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); |
101 | connect( disconnectAction, SIGNAL(activated()), | 178 | connect( disconnectAction, SIGNAL(activated()), |
102 | this, SLOT( closeConnection() ) ); | 179 | this, SLOT( closeConnection() ) ); |
103 | disconnectAction->addTo( cornerMenu ); | 180 | disconnectAction->addTo( cornerMenu ); |
104 | disconnectAction->setEnabled( false ); | 181 | disconnectAction->setEnabled( false ); |
105 | } | 182 | } |
106 | 183 | ||
107 | void KVNC::toggleFullScreen() | 184 | void KVNC::toggleFullScreen() |
108 | { | 185 | { |
109 | if ( fullscreen ) { | 186 | if ( fullscreen ) { |
110 | canvas->releaseKeyboard(); | 187 | canvas->releaseKeyboard(); |
111 | canvas->reparent( this, 0, QPoint(0,0), false ); | 188 | canvas->reparent( stack, 0, QPoint(0,0), false ); |
112 | canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 189 | canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
113 | setCentralWidget( canvas ); | 190 | setCentralWidget( stack ); |
114 | canvas->show(); | 191 | stack->addWidget(canvas,get_unique_id()); |
115 | fullScreenAction->setText( tr("Full Screen") ); | 192 | stack->raiseWidget(canvas); |
116 | } else { | 193 | canvas->show(); |
117 | canvas->setFrameStyle( QFrame::NoFrame ); | 194 | stack->show(); |
118 | canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, | 195 | fullScreenAction->setText( tr("Full Screen") ); |
119 | QPoint(0,0),false); | 196 | } else { |
120 | canvas->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 197 | canvas->setFrameStyle( QFrame::NoFrame ); |
121 | canvas->raise(); | 198 | stack->removeWidget(canvas); |
122 | canvas->setFocus(); | 199 | canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, |
123 | canvas->grabKeyboard(); | 200 | QPoint(0,0),false); |
124 | canvas->show(); | 201 | canvas->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
125 | 202 | canvas->raise(); | |
126 | fullScreenAction->setText( tr("Stop Full Screen") ); | 203 | canvas->setFocus(); |
127 | } | 204 | canvas->grabKeyboard(); |
128 | 205 | canvas->show(); | |
206 | |||
207 | fullScreenAction->setText( tr("Stop Full Screen") ); | ||
208 | } | ||
209 | |||
210 | |||
129 | fullscreen = !fullscreen; | 211 | fullscreen = !fullscreen; |
130 | } | 212 | } |
131 | 213 | ||
132 | void KVNC::closeConnection() | 214 | void KVNC::closeConnection() |
133 | { | 215 | { |
134 | if ( fullscreen ) | 216 | if ( fullscreen ) |
135 | toggleFullScreen(); | 217 | toggleFullScreen(); |
136 | canvas->closeConnection(); | 218 | canvas->closeConnection(); |
137 | } | 219 | } |
138 | 220 | ||
139 | void KVNC::showMenu() | 221 | void KVNC::showMenu() |
140 | { | 222 | { |
141 | QPoint pt = mapToGlobal(cornerButton->pos()); | 223 | QPoint pt = mapToGlobal(cornerButton->pos()); |
142 | QSize s = cornerMenu->sizeHint(); | 224 | QSize s = cornerMenu->sizeHint(); |
143 | pt.ry() -= s.height(); | 225 | pt.ry() -= s.height(); |
144 | pt.rx() -= s.width(); | 226 | pt.rx() -= s.width(); |
145 | cornerMenu->popup( pt ); | 227 | cornerMenu->popup( pt ); |
146 | } | 228 | } |
147 | 229 | ||
148 | void KVNC::connected() | 230 | void KVNC::connected() |
149 | { | 231 | { |
150 | static QString msg = tr( "Connected to remote host" ); | 232 | static QString msg = tr( "Connected to remote host" ); |
151 | statusMessage( msg ); | 233 | statusMessage( msg ); |
152 | connectAction->setEnabled( false ); | 234 | ctlAltDelAction->setEnabled(true); |
153 | disconnectAction->setEnabled( true ); | 235 | disconnectAction->setEnabled( true ); |
154 | fullScreenAction->setEnabled( true ); | 236 | fullScreenAction->setEnabled( true ); |
237 | stack->raiseWidget(canvas); | ||
155 | } | 238 | } |
156 | 239 | ||
157 | void KVNC::loggedIn() | 240 | void KVNC::loggedIn() |
158 | { | 241 | { |
159 | static QString msg = tr( "Logged in to remote host" ); | 242 | static QString msg = tr( "Logged in to remote host" ); |
160 | statusMessage( msg ); | 243 | statusMessage( msg ); |
161 | } | 244 | } |
162 | 245 | ||
163 | void KVNC::disconnected() | 246 | void KVNC::disconnected() |
164 | { | 247 | { |
248 | |||
249 | if ( fullscreen ) | ||
250 | toggleFullScreen(); | ||
165 | static QString msg = tr( "Connection closed" ); | 251 | static QString msg = tr( "Connection closed" ); |
166 | statusMessage( msg ); | 252 | statusMessage( msg ); |
167 | connectAction->setEnabled( true ); | 253 | ctlAltDelAction->setEnabled(false); |
168 | disconnectAction->setEnabled( false ); | 254 | disconnectAction->setEnabled( false ); |
169 | fullScreenAction->setEnabled( false ); | 255 | fullScreenAction->setEnabled( false ); |
256 | stack->raiseWidget(bookmarkSelector); | ||
170 | } | 257 | } |
171 | 258 | ||
172 | void KVNC::statusMessage( const QString &m ) | 259 | void KVNC::statusMessage( const QString &m ) |
173 | { | 260 | { |
174 | Global::statusMessage( m ); | 261 | Global::statusMessage( m ); |
175 | } | 262 | } |
176 | 263 | ||
177 | void KVNC::error( const QString &msg ) | 264 | void KVNC::error( const QString &msg ) |
178 | { | 265 | { |
179 | statusMessage( msg ); | 266 | statusMessage( msg ); |
180 | QMessageBox::warning( this, tr("VNC Viewer"), msg ); | 267 | QMessageBox::warning( this, tr("VNC Viewer"), msg ); |
181 | } | 268 | } |
182 | 269 | void KVNC::deleteBookmark(void) | |
183 | void KVNC::showOptions() | ||
184 | { | 270 | { |
185 | KVNCOptionsDlg *wdg = new KVNCOptionsDlg( canvas->connection()->options(), this ); | 271 | bookmarkSelector->deleteBookmark(bookmarkSelector->selectedBookmark()); |
186 | wdg->showMaximized(); | ||
187 | wdg->exec(); | ||
188 | delete wdg; | ||
189 | } | 272 | } |
190 | |||
diff --git a/noncore/comm/keypebble/kvnc.h b/noncore/comm/keypebble/kvnc.h index 92666c5..6e0a385 100644 --- a/noncore/comm/keypebble/kvnc.h +++ b/noncore/comm/keypebble/kvnc.h | |||
@@ -1,56 +1,66 @@ | |||
1 | // -*- c++ -*- | 1 | // -*- c++ -*- |
2 | 2 | ||
3 | #ifndef KVNC_H | 3 | #ifndef KVNC_H |
4 | #define KVNC_H | 4 | #define KVNC_H |
5 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | #include <qurl.h> | 7 | #include <qurl.h> |
8 | #include <qwidgetstack.h> | ||
9 | #include "kvncbookmarkdlg.h" | ||
8 | 10 | ||
9 | class QAction; | 11 | class QAction; |
10 | class KRFBCanvas; | 12 | class KRFBCanvas; |
11 | class QPushButton; | 13 | class QPushButton; |
12 | class QToolBar; | 14 | class QToolBar; |
13 | 15 | ||
14 | /** | 16 | /** |
15 | * Top level window for Keystone. | 17 | * Top level window for Keystone. |
16 | * | 18 | * |
17 | * @author Richard Moore, rich@kde.org | 19 | * @author Richard Moore, rich@kde.org |
18 | * @version $Id$ | 20 | * @version $Id$ |
19 | */ | 21 | */ |
20 | class KVNC : public QMainWindow | 22 | class KVNC : public QMainWindow |
21 | { | 23 | { |
22 | Q_OBJECT | 24 | Q_OBJECT |
23 | public: | 25 | public: |
24 | KVNC( const char *name = 0 ); | 26 | KVNC( const char *name = 0 ); |
25 | ~KVNC(); | 27 | ~KVNC(); |
26 | 28 | ||
27 | public slots: | 29 | public slots: |
30 | void newConnection(); | ||
31 | void deleteBookmark(); | ||
32 | void openConnection(QListBoxItem *); | ||
33 | void openConnection(QString); | ||
34 | void openConnection(void); | ||
28 | void toggleFullScreen(); | 35 | void toggleFullScreen(); |
29 | void openURL( const QUrl & ); | ||
30 | void closeConnection(); | 36 | void closeConnection(); |
31 | void showOptions(); | ||
32 | 37 | ||
33 | protected: | 38 | protected: |
34 | void setupActions(); | 39 | void setupActions(); |
35 | 40 | ||
36 | protected slots: | 41 | protected slots: |
37 | void showMenu(); | 42 | void showMenu(); |
38 | 43 | ||
39 | void connected(); | 44 | void connected(); |
40 | void loggedIn(); | 45 | void loggedIn(); |
41 | void disconnected(); | 46 | void disconnected(); |
42 | void statusMessage( const QString & ); | 47 | void statusMessage( const QString & ); |
43 | void error( const QString & ); | 48 | void error( const QString & ); |
44 | 49 | ||
45 | private: | 50 | private: |
46 | bool fullscreen; | 51 | bool fullscreen; |
47 | KRFBCanvas *canvas; | 52 | KRFBCanvas *canvas; |
48 | QPopupMenu *cornerMenu; | 53 | QPopupMenu *cornerMenu; |
49 | QPushButton *cornerButton; | 54 | QPushButton *cornerButton; |
50 | QAction *fullScreenAction; | 55 | QAction *fullScreenAction; |
51 | QAction *optionsAction; | 56 | QAction *optionsAction; |
52 | QAction *disconnectAction; | 57 | QAction *disconnectAction; |
58 | QAction *ctlAltDelAction;; | ||
53 | QAction *connectAction; | 59 | QAction *connectAction; |
60 | |||
61 | KVNCBookmarkDlg * bookmarkSelector; | ||
62 | QWidgetStack * stack; | ||
63 | KRFBServer * curServer; | ||
54 | }; | 64 | }; |
55 | 65 | ||
56 | #endif // KVNC_H | 66 | #endif // KVNC_H |
diff --git a/noncore/comm/keypebble/kvncbookmarkdlg.cpp b/noncore/comm/keypebble/kvncbookmarkdlg.cpp new file mode 100644 index 0000000..1f97d13 --- a/dev/null +++ b/noncore/comm/keypebble/kvncbookmarkdlg.cpp | |||
@@ -0,0 +1,220 @@ | |||
1 | #include <qframe.h> | ||
2 | #include <qvbox.h> | ||
3 | #include <qcheckbox.h> | ||
4 | #include <qspinbox.h> | ||
5 | #include <qlabel.h> | ||
6 | #include <qlayout.h> | ||
7 | #include <qwhatsthis.h> | ||
8 | #include <qfile.h> | ||
9 | #include <qdir.h> | ||
10 | #include <qstring.h> | ||
11 | #include <qapplication.h> | ||
12 | #include <qlineedit.h> | ||
13 | #include <qtextstream.h> | ||
14 | #include <qpushbutton.h> | ||
15 | #include <qlistbox.h> | ||
16 | #include <qpe/config.h> | ||
17 | #include <qpe/global.h> | ||
18 | #include "krfbserver.h" | ||
19 | #include "kvncbookmarkdlg.h" | ||
20 | |||
21 | KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent=0, const char * name=0, WFlags f=0 ) | ||
22 | |||
23 | : KVNCBookmarkDlgBase( parent, name,f) | ||
24 | { | ||
25 | readBookmarks(); | ||
26 | refresh(); | ||
27 | |||
28 | } | ||
29 | |||
30 | KVNCBookmarkDlg::~KVNCBookmarkDlg() | ||
31 | { | ||
32 | } | ||
33 | |||
34 | void KVNCBookmarkDlg::addBookmark(KRFBServer * server) | ||
35 | { | ||
36 | if (server) { | ||
37 | servers.append(server); | ||
38 | bookmarkList->insertItem(server->name); | ||
39 | writeBookmarks(); | ||
40 | refresh(); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | void KVNCBookmarkDlg::deleteBookmark(QString name) | ||
45 | { | ||
46 | KRFBServer * server=0; | ||
47 | for ( server=servers.first(); server != 0; server=servers.next() ) { | ||
48 | if (server->name==name) { | ||
49 | servers.remove(servers.at()); | ||
50 | writeBookmarks(); | ||
51 | refresh(); | ||
52 | return; | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | KRFBServer *KVNCBookmarkDlg::getServer(QString name) | ||
57 | { | ||
58 | KRFBServer * server=0; | ||
59 | for ( server=servers.first(); server != 0; server=servers.next() ) { | ||
60 | if (server->name==name) | ||
61 | |||
62 | return server; | ||
63 | } | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | |||
68 | /* | ||
69 | Note that the degree of protection offered by the encryption here is | ||
70 | only sufficient to avoid the most casual observation of the configuration | ||
71 | files. People with access to the files can write down the contents and | ||
72 | decrypt it using this source code. | ||
73 | |||
74 | Conceivably, and at some burden to the user, this encryption could | ||
75 | be improved. | ||
76 | */ | ||
77 | QString KVNCBookmarkDlg::encipher(const QString& plain) | ||
78 | { | ||
79 | // mainly, we make it long | ||
80 | QString cipher; | ||
81 | int mix=28730492; | ||
82 | for (int i=0; i<(int)plain.length(); i++) { | ||
83 | int u = plain[i].unicode(); | ||
84 | int c = u ^ mix; | ||
85 | QString x = QString::number(c,36); | ||
86 | cipher.append(QChar('a'+x.length())); | ||
87 | cipher.append(x); | ||
88 | mix *= u; | ||
89 | } | ||
90 | return cipher; | ||
91 | } | ||
92 | |||
93 | QString KVNCBookmarkDlg::decipher(const QString& cipher) | ||
94 | { | ||
95 | QString plain; | ||
96 | int mix=28730492; | ||
97 | for (int i=0; i<(int)cipher.length();) { | ||
98 | int l = cipher[i].unicode()-'a'; | ||
99 | QString x = cipher.mid(i+1,l); i+=l+1; | ||
100 | int u = x.toInt(0,36) ^ mix; | ||
101 | plain.append(QChar(u)); | ||
102 | mix *= u; | ||
103 | } | ||
104 | return plain; | ||
105 | } | ||
106 | |||
107 | void KVNCBookmarkDlg::readBookmarks(void) | ||
108 | { | ||
109 | QFile f(QDir::homeDirPath() + QString("/Applications/keypebble/bookmarks")); | ||
110 | |||
111 | QStringList entry; | ||
112 | QString key, val; | ||
113 | KRFBServer * server=0; | ||
114 | |||
115 | if ( f.open(IO_ReadOnly) ) { | ||
116 | QTextStream t( &f ); | ||
117 | QString s; | ||
118 | int n = 1; | ||
119 | while ( !t.eof() ) { | ||
120 | s = t.readLine(); | ||
121 | |||
122 | |||
123 | entry=QStringList::split('=',s); | ||
124 | key=entry[0].stripWhiteSpace().lower(); | ||
125 | val=entry[1].stripWhiteSpace(); | ||
126 | |||
127 | if (key=="server") { | ||
128 | |||
129 | if (server){ | ||
130 | servers.append(server); | ||
131 | server=0; | ||
132 | } | ||
133 | server = new KRFBServer(); | ||
134 | |||
135 | if (!server) | ||
136 | return; | ||
137 | server->name=val; | ||
138 | |||
139 | } | ||
140 | else if (key=="hostname") | ||
141 | server->hostname=val; | ||
142 | else if (key=="password") | ||
143 | server->password=decipher(val); | ||
144 | else if (key=="display") | ||
145 | server->display=val.toInt(); | ||
146 | else if (key=="hextile") | ||
147 | server->hexTile=val.toInt(); | ||
148 | else if (key=="corre") | ||
149 | server->corre=val.toInt(); | ||
150 | else if (key=="rre") | ||
151 | server->rre=val.toInt(); | ||
152 | else if (key=="copyrect") | ||
153 | server->copyrect=val.toInt(); | ||
154 | else if (key=="colors256") | ||
155 | server->colors256=val.toInt(); | ||
156 | else if (key=="shared") | ||
157 | server->shared=val.toInt(); | ||
158 | else if (key=="readonly") | ||
159 | server->readOnly=val.toInt(); | ||
160 | else if (key=="deiconify") | ||
161 | server->deIconify=val.toInt(); | ||
162 | else if (key=="updaterate") | ||
163 | server->updateRate=val.toInt(); | ||
164 | |||
165 | } | ||
166 | if (server){ | ||
167 | servers.append(server); | ||
168 | server=0; | ||
169 | } | ||
170 | f.close(); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | void KVNCBookmarkDlg::writeBookmarks(void) | ||
175 | { | ||
176 | QString filename=Global::applicationFileName("keypebble","bookmarks"); | ||
177 | |||
178 | QFile f(filename); | ||
179 | |||
180 | QString key, val; | ||
181 | KRFBServer * server=0; | ||
182 | |||
183 | if ( f.open(IO_ReadWrite) ) { | ||
184 | QTextStream t( &f ); | ||
185 | QString s; | ||
186 | int n = 1; | ||
187 | KRFBServer *server; | ||
188 | |||
189 | for ( server=servers.first(); server != 0; server=servers.next() ) { | ||
190 | qDebug(server->name); | ||
191 | t << "server=" << server->name << '\n'; | ||
192 | t << "\thostname=" << server->hostname << '\n'; | ||
193 | t << "\tpassword=" << encipher(server->password )<< '\n'; | ||
194 | t << "\tdisplay=" << server->display << '\n'; | ||
195 | t << "\thextile=" << server->hexTile << '\n'; | ||
196 | t << "\tcorre=" << server->corre << '\n'; | ||
197 | t << "\trre=" << server->rre << '\n'; | ||
198 | t << "\tcopyrect=" << server->copyrect << '\n'; | ||
199 | t << "\tshared=" << server->shared << '\n'; | ||
200 | t << "\treadonly=" << server->readOnly << '\n'; | ||
201 | t << "\tdeiconify=" << server->deIconify << '\n'; | ||
202 | t << "\tupdaterate=" << server->updateRate << '\n'; | ||
203 | |||
204 | } | ||
205 | f.close(); | ||
206 | } | ||
207 | } | ||
208 | void KVNCBookmarkDlg::refresh(void) | ||
209 | { | ||
210 | bookmarkList->clear(); | ||
211 | KRFBServer * server=0; | ||
212 | for ( server=servers.first(); server != 0; server=servers.next() ) { | ||
213 | bookmarkList->insertItem(server->name); | ||
214 | } | ||
215 | } | ||
216 | |||
217 | QString KVNCBookmarkDlg::selectedBookmark() | ||
218 | { | ||
219 | return bookmarkList->currentText(); | ||
220 | } | ||
diff --git a/noncore/comm/keypebble/kvncconndlg.cpp b/noncore/comm/keypebble/kvncconndlg.cpp new file mode 100644 index 0000000..6873feb --- a/dev/null +++ b/noncore/comm/keypebble/kvncconndlg.cpp | |||
@@ -0,0 +1,75 @@ | |||
1 | #include <qframe.h> | ||
2 | #include <qvbox.h> | ||
3 | #include <qcheckbox.h> | ||
4 | #include <qspinbox.h> | ||
5 | #include <qlabel.h> | ||
6 | #include <qlayout.h> | ||
7 | #include <qwhatsthis.h> | ||
8 | #include <qapplication.h> | ||
9 | #include <qlineedit.h> | ||
10 | #include <qpushbutton.h> | ||
11 | #include "krfbserver.h" | ||
12 | |||
13 | #include "kvncconndlg.h" | ||
14 | |||
15 | KVNCConnDlg::KVNCConnDlg( KRFBServer *options, | ||
16 | QWidget *parent, char *name, bool modal ) | ||
17 | : KVNCConnDlgBase( parent, name, modal ) | ||
18 | { | ||
19 | this->options=options; | ||
20 | tmpOptions=*options; | ||
21 | |||
22 | serverHostname->setText(options->hostname); | ||
23 | serverDisplay->setValue(options->display); | ||
24 | serverPassword->setText(options->password); | ||
25 | serverBookmark->setText(options->name); | ||
26 | |||
27 | hex->setChecked( options->hexTile ); | ||
28 | corre->setChecked( options->corre ); | ||
29 | rre->setChecked( options->rre ); | ||
30 | copyRect->setChecked( options->copyrect ); | ||
31 | |||
32 | // TODO | ||
33 | hex->setEnabled( false ); | ||
34 | corre->setEnabled( false ); | ||
35 | rre->setEnabled( false ); | ||
36 | // /TODO | ||
37 | |||
38 | deIconify->setChecked( options->deIconify ); | ||
39 | bit->setChecked( options->colors256 ); | ||
40 | shared->setChecked( options->shared ); | ||
41 | timeBox->setValue( options->updateRate ); | ||
42 | |||
43 | |||
44 | } | ||
45 | |||
46 | KVNCConnDlg::~KVNCConnDlg() | ||
47 | { | ||
48 | } | ||
49 | |||
50 | void KVNCConnDlg::accept() | ||
51 | { | ||
52 | save(); | ||
53 | QDialog::accept(); | ||
54 | } | ||
55 | |||
56 | void KVNCConnDlg::save() | ||
57 | { | ||
58 | tmpOptions.hexTile = hex->isChecked(); | ||
59 | tmpOptions.corre = corre->isChecked(); | ||
60 | tmpOptions.rre = rre->isChecked(); | ||
61 | tmpOptions.copyrect = copyRect->isChecked(); | ||
62 | tmpOptions.deIconify = deIconify->isChecked(); | ||
63 | tmpOptions.colors256 = bit->isChecked(); | ||
64 | tmpOptions.shared = shared->isChecked(); | ||
65 | tmpOptions.hostname = serverHostname->text(); | ||
66 | tmpOptions.password = serverPassword->text(); | ||
67 | tmpOptions.display = serverDisplay->value(); | ||
68 | tmpOptions.name = serverBookmark->text(); | ||
69 | |||
70 | if (!serverBookmark->text().isEmpty()) { | ||
71 | if ( options) { | ||
72 | *options=tmpOptions; | ||
73 | } | ||
74 | } | ||
75 | } | ||
diff --git a/noncore/comm/keypebble/kvncconnectdlg.cpp b/noncore/comm/keypebble/kvncconnectdlg.cpp deleted file mode 100644 index 467cebf..0000000 --- a/noncore/comm/keypebble/kvncconnectdlg.cpp +++ b/dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | #include <qstring.h> | ||
2 | #include <qlayout.h> | ||
3 | #include <qframe.h> | ||
4 | #include <qspinbox.h> | ||
5 | #include <qcombobox.h> | ||
6 | #include <qlabel.h> | ||
7 | #include <qfont.h> | ||
8 | |||
9 | #include <assert.h> | ||
10 | |||
11 | #include "krfbconnection.h" | ||
12 | #include "kvncoptionsdlg.h" | ||
13 | #include "kvncconnectdlg.h" | ||
14 | |||
15 | |||
16 | KVNCConnectDlg::KVNCConnectDlg( KRFBConnection *con, | ||
17 | QWidget *parent, const char *name ) | ||
18 | : QDialog( parent, name, true ) | ||
19 | { | ||
20 | setCaption( tr("Connect to VNC server") ); | ||
21 | assert( con ); | ||
22 | this->con = con; | ||
23 | |||
24 | QGridLayout *inner = new QGridLayout( this, 3, 2, 6 ); | ||
25 | |||
26 | QLabel *label = new QLabel( tr("Host Name:"), | ||
27 | this , "hostLabel"); | ||
28 | hostNameCombo = new QComboBox( true, this ); | ||
29 | hostNameCombo->setInsertionPolicy( QComboBox::AtTop ); | ||
30 | hostNameCombo->setMaxCount( 10 ); | ||
31 | hostNameCombo->insertItem( "localhost" ); | ||
32 | hostNameCombo->setFocus(); | ||
33 | |||
34 | inner->addWidget( label, 0, 0 ); | ||
35 | inner->addWidget( hostNameCombo, 0, 1 ); | ||
36 | |||
37 | label = new QLabel( tr("Display Number:"), this, "displayNumber" ); | ||
38 | displayNumberEdit = new QSpinBox( this ); | ||
39 | |||
40 | inner->addWidget( label, 1, 0 ); | ||
41 | inner->addWidget( displayNumberEdit, 1, 1 ); | ||
42 | |||
43 | // if ( viewer->display() != -1 ) { | ||
44 | // displayNumberEdit->setValue( viewer->display() ); | ||
45 | displayNumberEdit->setValue( 1 ); | ||
46 | // } | ||
47 | |||
48 | label = new QLabel( tr("Password:"), this ); | ||
49 | inner->addWidget( label, 2, 0 ); | ||
50 | |||
51 | passwordEdit = new QLineEdit( this ); | ||
52 | passwordEdit->setEchoMode( QLineEdit::Password ); | ||
53 | inner->addWidget( passwordEdit, 2, 1 ); | ||
54 | |||
55 | inner->setColStretch( 0, 0 ); | ||
56 | inner->setColStretch( 1, 15 ); | ||
57 | } | ||
58 | |||
59 | |||
60 | void KVNCConnectDlg::accept() | ||
61 | { | ||
62 | int dis; | ||
63 | // viewer->setHost(hostNameCombo->currentText()); | ||
64 | QString temp = displayNumberEdit->text(); | ||
65 | if(temp.isEmpty()) | ||
66 | dis = -1; | ||
67 | else | ||
68 | dis = temp.toUInt(); | ||
69 | // viewer->setDisplay(dis); | ||
70 | QDialog::accept(); | ||
71 | } | ||
72 | |||
73 | void KVNCConnectDlg::options() | ||
74 | { | ||
75 | KVNCOptionsDlg *wdg = new KVNCOptionsDlg( con->options(), this ); | ||
76 | wdg->exec(); | ||
77 | delete wdg; | ||
78 | } | ||
79 | |||
diff --git a/noncore/comm/keypebble/kvncconnectdlg.h b/noncore/comm/keypebble/kvncconnectdlg.h deleted file mode 100644 index cf34aab..0000000 --- a/noncore/comm/keypebble/kvncconnectdlg.h +++ b/dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | // -*- c++ -*- | ||
2 | |||
3 | #ifndef KVNCCONNECTDLG_H | ||
4 | #define KVNCCONNECTDLG_H | ||
5 | |||
6 | #include <qdialog.h> | ||
7 | #include <qspinbox.h> | ||
8 | #include <qcombobox.h> | ||
9 | #include <qlineedit.h> | ||
10 | #include <qurl.h> | ||
11 | |||
12 | class KRFBConnection; | ||
13 | |||
14 | class KVNCConnectDlg : public QDialog | ||
15 | { | ||
16 | Q_OBJECT | ||
17 | |||
18 | public: | ||
19 | KVNCConnectDlg( KRFBConnection *con, | ||
20 | QWidget *parent = 0, const char *name = 0 ); | ||
21 | |||
22 | QString hostname() { return hostNameCombo->currentText(); }; | ||
23 | int display() { return displayNumberEdit->value(); }; | ||
24 | QString password() const { return passwordEdit->text(); } | ||
25 | |||
26 | protected: | ||
27 | void accept(); | ||
28 | |||
29 | protected slots: | ||
30 | void options(); | ||
31 | |||
32 | private: | ||
33 | QComboBox *hostNameCombo; | ||
34 | QSpinBox *displayNumberEdit; | ||
35 | QLineEdit *passwordEdit; | ||
36 | KRFBConnection *con; | ||
37 | }; | ||
38 | |||
39 | #endif // KVNCCONNECTDLG_H | ||
diff --git a/noncore/comm/keypebble/kvncoptionsdlg.cpp b/noncore/comm/keypebble/kvncoptionsdlg.cpp deleted file mode 100644 index 9d61c7b..0000000 --- a/noncore/comm/keypebble/kvncoptionsdlg.cpp +++ b/dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | #include <qframe.h> | ||
2 | #include <qvbox.h> | ||
3 | #include <qcheckbox.h> | ||
4 | #include <qspinbox.h> | ||
5 | #include <qlabel.h> | ||
6 | #include <qlayout.h> | ||
7 | #include <qwhatsthis.h> | ||
8 | #include <qapplication.h> | ||
9 | #include "krfboptions.h" | ||
10 | |||
11 | #include "kvncoptionsdlg.h" | ||
12 | |||
13 | KVNCOptionsDlg::KVNCOptionsDlg( KRFBOptions *options, | ||
14 | QWidget *parent, char *name, bool modal ) | ||
15 | : VncOptionsBase( parent, name, modal ) | ||
16 | { | ||
17 | this->options = options; | ||
18 | |||
19 | hex->setChecked( options->hexTile ); | ||
20 | corre->setChecked( options->corre ); | ||
21 | rre->setChecked( options->rre ); | ||
22 | copyRect->setChecked( options->copyrect ); | ||
23 | |||
24 | // TODO | ||
25 | hex->setEnabled( false ); | ||
26 | corre->setEnabled( false ); | ||
27 | rre->setEnabled( false ); | ||
28 | // /TODO | ||
29 | |||
30 | deIconify->setChecked( options->deIconify ); | ||
31 | bit->setChecked( options->colors256 ); | ||
32 | shared->setChecked( options->shared ); | ||
33 | timeBox->setValue( options->updateRate ); | ||
34 | } | ||
35 | |||
36 | KVNCOptionsDlg::~KVNCOptionsDlg() | ||
37 | { | ||
38 | } | ||
39 | |||
40 | void KVNCOptionsDlg::accept() | ||
41 | { | ||
42 | options->hexTile = hex->isChecked(); | ||
43 | options->corre = corre->isChecked(); | ||
44 | options->rre = rre->isChecked(); | ||
45 | options->copyrect = copyRect->isChecked(); | ||
46 | options->deIconify = deIconify->isChecked(); | ||
47 | options->colors256 = bit->isChecked(); | ||
48 | options->shared = shared->isChecked(); | ||
49 | options->updateRate = timeBox->value(); | ||
50 | options->writeSettings(); | ||
51 | |||
52 | QDialog::accept(); | ||
53 | } | ||
54 | |||
diff --git a/noncore/comm/keypebble/kvncoptionsdlg.h b/noncore/comm/keypebble/kvncoptionsdlg.h deleted file mode 100644 index a166490..0000000 --- a/noncore/comm/keypebble/kvncoptionsdlg.h +++ b/dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | // -*- c++ -*- | ||
2 | |||
3 | #ifndef KVNCOPTIONSDIALOG_H | ||
4 | #define KVNCOPTIONSDIALOG_H | ||
5 | |||
6 | #include "vncoptionsbase.h" | ||
7 | |||
8 | class KRFBOptions; | ||
9 | |||
10 | class KVNCOptionsDlg : public VncOptionsBase | ||
11 | { | ||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | KVNCOptionsDlg( KRFBOptions *options, | ||
16 | QWidget *parent = 0, char *name = 0, bool modal = true ); | ||
17 | ~KVNCOptionsDlg(); | ||
18 | |||
19 | protected: | ||
20 | void accept(); | ||
21 | |||
22 | private: | ||
23 | KRFBOptions *options; | ||
24 | }; | ||
25 | |||
26 | #endif // KVNCOPTIONSDIALOG_H | ||
27 | |||
28 | |||
29 | |||
30 | |||
diff --git a/noncore/comm/keypebble/main.cpp b/noncore/comm/keypebble/main.cpp index ee3cd79..bc7782c 100644 --- a/noncore/comm/keypebble/main.cpp +++ b/noncore/comm/keypebble/main.cpp | |||
@@ -1,17 +1,15 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qurl.h> | 3 | #include <qurl.h> |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include "kvnc.h" | 5 | #include "kvnc.h" |
6 | 6 | ||
7 | int main( int argc, char **argv ) | 7 | int main( int argc, char **argv ) |
8 | { | 8 | { |
9 | QPEApplication app( argc, argv ); | 9 | QPEApplication app( argc, argv ); |
10 | KVNC *view = new KVNC( "Keypebble" ); | 10 | KVNC *view = new KVNC( "Keypebble" ); |
11 | app.showMainWidget( view ); | 11 | app.showMainWidget( view ); |
12 | 12 | ||
13 | if ( argc > 1 ) | ||
14 | view->openURL( QUrl(argv[1]) ); | ||
15 | |||
16 | return app.exec(); | 13 | return app.exec(); |
17 | } | 14 | } |
15 | |||