summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfbbuffer.cpp17
-rw-r--r--noncore/comm/keypebble/krfbcanvas.cpp5
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp7
-rw-r--r--noncore/comm/keypebble/krfbdecoder.h5
-rw-r--r--noncore/comm/keypebble/krfbserver.cpp2
-rw-r--r--noncore/comm/keypebble/krfbserver.h1
-rw-r--r--noncore/comm/keypebble/kvnc.cpp8
-rw-r--r--noncore/comm/keypebble/kvnc.h3
-rw-r--r--noncore/comm/keypebble/kvncbookmarkdlg.cpp3
-rw-r--r--noncore/comm/keypebble/kvncconndlg.cpp21
-rw-r--r--noncore/comm/keypebble/kvncconndlg.h1
-rw-r--r--noncore/comm/keypebble/kvncconndlgbase.ui752
12 files changed, 461 insertions, 364 deletions
diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp
index 5a52f31..f1cb929 100644
--- a/noncore/comm/keypebble/krfbbuffer.cpp
+++ b/noncore/comm/keypebble/krfbbuffer.cpp
@@ -1,194 +1,203 @@
1#include <assert.h> 1#include <assert.h>
2#include <qpixmap.h> 2#include <qpixmap.h>
3#include <qbrush.h> 3#include <qbrush.h>
4#include <qimage.h> 4#include <qimage.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qapplication.h> 6#include <qapplication.h>
7#include "krfbdecoder.h" 7#include "krfbdecoder.h"
8#include "krfbbuffer.h" 8#include "krfbbuffer.h"
9#include "krfbconnection.h"
10#include "krfbserver.h"
9#include "krfbserverinfo.h" 11#include "krfbserverinfo.h"
10 12
11// 13//
12// Endian stuff 14// Endian stuff
13// 15//
14#ifndef KDE_USE_FINAL 16#ifndef KDE_USE_FINAL
15const int endianTest = 1; 17const int endianTest = 1;
16#endif 18#endif
17 19
18#define Swap16IfLE(s) \ 20#define Swap16IfLE(s) \
19 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) 21 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
20 22
21#define Swap32IfLE(l) \ 23#define Swap32IfLE(l) \
22 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ 24 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
23 (((l) & 0x00ff0000) >> 8) | \ 25 (((l) & 0x00ff0000) >> 8) | \
24 (((l) & 0x0000ff00) << 8) | \ 26 (((l) & 0x0000ff00) << 8) | \
25 (((l) & 0x000000ff) << 24)) : (l)) 27 (((l) & 0x000000ff) << 24)) : (l))
26 28
27KRFBBuffer::KRFBBuffer( KRFBDecoder *decoder, 29KRFBBuffer::KRFBBuffer( KRFBDecoder *decoder,
28 QObject *parent, const char *name ) 30 QObject *parent, const char *name )
29 : QObject( parent, name ) 31 : QObject( parent, name )
30{ 32{
31 assert( decoder ); 33 assert( decoder );
32 this->decoder = decoder; 34 this->decoder = decoder;
33 pix = new QPixmap(); 35 pix = new QPixmap();
34} 36}
35 37
36KRFBBuffer::~KRFBBuffer() 38KRFBBuffer::~KRFBBuffer()
37{ 39{
38 delete pix; 40 delete pix;
39} 41}
40 42
41void KRFBBuffer::resize( int w, int h ) 43void KRFBBuffer::resize( int w, int h )
42{ 44{
43 qWarning( "Resizing buffer" ); 45 qWarning( "Resizing buffer" );
44 46
45 pix->resize( w, h ); 47 pix->resize( w, h );
46 48
47 QPalette pal = qApp->palette(); 49 QPalette pal = qApp->palette();
48 pix->fill( pal.active().base() ); 50 pix->fill( pal.active().base() );
49 51
50 emit sizeChanged( w, h ); 52 emit sizeChanged( w, h );
51} 53}
52 54
53void KRFBBuffer::soundBell() 55void KRFBBuffer::soundBell()
54{ 56{
55 emit bell(); 57 emit bell();
56} 58}
57 59
58void KRFBBuffer::mouseEvent( QMouseEvent *e ) 60void KRFBBuffer::mouseEvent( QMouseEvent *e )
59{ 61{
60 decoder->sendMouseEvent( e ); 62 decoder->sendMouseEvent( e );
61} 63}
62 64
63void KRFBBuffer::keyPressEvent( QKeyEvent *e ) 65void KRFBBuffer::keyPressEvent( QKeyEvent *e )
64{ 66{
65 qWarning( "Buffer got a key" ); 67 qWarning( "Buffer got a key" );
66 68
67 decoder->sendKeyPressEvent( e ); 69 decoder->sendKeyPressEvent( e );
68} 70}
69 71
70void KRFBBuffer::keyReleaseEvent( QKeyEvent *e ) 72void KRFBBuffer::keyReleaseEvent( QKeyEvent *e )
71{ 73{
72 decoder->sendKeyReleaseEvent( e ); 74 decoder->sendKeyReleaseEvent( e );
73} 75}
74 76
75void KRFBBuffer::copyRect( int srcX, int srcY, 77void KRFBBuffer::copyRect( int srcX, int srcY,
76 int destX, int destY, int w, int h ) 78 int destX, int destY, int w, int h )
77{ 79{
78// qWarning( "Got copy rect" ); 80// qWarning( "Got copy rect" );
79 bitBlt( pix, destX, destY, pix, srcX, srcY, w, h, CopyROP ); 81 bitBlt( pix, destX, destY, pix, srcX, srcY, w, h, CopyROP );
80 82
81 emit updated( destX, destY, w, h ); 83 emit updated( destX, destY, w, h );
82} 84}
83 85
84void KRFBBuffer::drawRawRectChunk( void *data, 86void KRFBBuffer::drawRawRectChunk( void *data,
85 int x, int y, int w, int h ) 87 int x, int y, int w, int h )
86{ 88{
87 QImage img( w, h, 32 ); 89 QImage img( w, h, 32 );
88 90
91 int scaleFactor=decoder->con->options()->scaleFactor;
89 int redMax = Swap16IfLE( decoder->format->redMax ); 92 int redMax = Swap16IfLE( decoder->format->redMax );
90 int greenMax = Swap16IfLE( decoder->format->greenMax ); 93 int greenMax = Swap16IfLE( decoder->format->greenMax );
91 int blueMax = Swap16IfLE( decoder->format->blueMax ); 94 int blueMax = Swap16IfLE( decoder->format->blueMax );
92 95
93 QPainter p( pix ); 96 QPainter p( pix );
94 97
95 if ( decoder->format->bpp == 8 ) { 98 if ( decoder->format->bpp == 8 ) {
96 uchar *d = (unsigned char *) data; 99 uchar *d = (unsigned char *) data;
97 100
98 uint r,g,b; 101 uint r,g,b;
99 102
100 for ( int j = 0; j < h; j++ ) { 103
104 for ( int j = 0; j < h; j++) {
101 for ( int i = 0; i < w ; i++ ) { 105 for ( int i = 0; i < w ; i++ ) {
102 r = d[ j * w + i ]; 106 r = d[ j * w + i ];
103 r = r >> decoder->format->redShift; 107 r = r >> decoder->format->redShift;
104 r = r & redMax; 108 r = r & redMax;
105 109
106 g = d[ j * w + i ]; 110 g = d[ j * w + i ];
107 g = g >> decoder->format->greenShift; 111 g = g >> decoder->format->greenShift;
108 g = g & greenMax; 112 g = g & greenMax;
109 113
110 b = d[ j * w + i ]; 114 b = d[ j * w + i ];
111 b = b >> decoder->format->blueShift; 115 b = b >> decoder->format->blueShift;
112 b = b & blueMax; 116 b = b & blueMax;
113 117
114 r = ( r * 255 ) / redMax; 118 r = ( r * 255 ) / redMax;
115 g = ( g * 255 ) / greenMax; 119 g = ( g * 255 ) / greenMax;
116 b = ( b * 255 ) / blueMax; 120 b = ( b * 255 ) / blueMax;
117 121
118 uint *p = ( uint * ) img.scanLine( j ) + i; 122 uint *p = ( uint * ) img.scanLine( j ) + i;
119 *p = qRgb( r,g,b ); 123 *p = qRgb( r,g,b );
120 } 124 }
121 } 125 }
122 } 126 }
123 else if ( decoder->format->bpp == 32 ) { 127 else if ( decoder->format->bpp == 32 ) {
124 ulong *d = (ulong *) data; 128 ulong *d = (ulong *) data;
125 129
126 ulong r,g,b; 130 ulong r,g,b;
127 131
128 for ( int j = 0; j < h; j++ ) { 132 for ( int j = 0; j < h; j++ ) {
129 for ( int i = 0; i < w ; i++ ) { 133 for ( int i = 0; i < w ; i++ ) {
130 ulong pixel = d[ j * w + i ]; 134 ulong pixel = d[ j * w + i ];
131 pixel = Swap32IfLE( pixel ); 135 pixel = Swap32IfLE( pixel );
132 136
133 r = pixel; 137 r = pixel;
134 r = r >> decoder->format->redShift; 138 r = r >> decoder->format->redShift;
135 r = r & redMax; 139 r = r & redMax;
136 140
137 g = pixel; 141 g = pixel;
138 g = g >> decoder->format->greenShift; 142 g = g >> decoder->format->greenShift;
139 g = g & greenMax; 143 g = g & greenMax;
140 144
141 b = pixel; 145 b = pixel;
142 b = b >> decoder->format->blueShift; 146 b = b >> decoder->format->blueShift;
143 b = b & blueMax; 147 b = b & blueMax;
144 148
145 r = ( r * 255 ) / redMax; 149 r = ( r * 255 ) / redMax;
146 g = ( g * 255 ) / greenMax; 150 g = ( g * 255 ) / greenMax;
147 b = ( b * 255 ) / blueMax; 151 b = ( b * 255 ) / blueMax;
148 152
149 uint *p = ( uint * ) img.scanLine( j ) + i; 153 uint *p = ( uint * ) img.scanLine( j ) + i;
150 *p = qRgb( r,g,b ); 154 *p = qRgb( r,g,b );
151 } 155 }
152 } 156 }
153 } else if (decoder->format->bpp == 16 ) { 157 } else if (decoder->format->bpp == 16 ) {
154 158
155 CARD16 *d = (CARD16 *) data; 159 CARD16 *d = (CARD16 *) data;
156 160
157 uint r,g,b; 161 uint r,g,b;
158 162
159 for ( int j = 0; j < h; j++ ) { 163 for ( int j = 0; j < h; j++ ) {
160 for ( int i = 0; i < w ; i++ ) { 164 for ( int i = 0; i < w ; i++ ) {
161 CARD16 pixel = d[ j * w + i ]; 165 CARD16 pixel = d[ j * w + i ];
162 pixel = Swap16IfLE( pixel ); 166 pixel = Swap16IfLE( pixel );
163 167
164 r = pixel; 168 r = pixel;
165 r = r >> decoder->format->redShift; 169 r = r >> decoder->format->redShift;
166 r = r & redMax; 170 r = r & redMax;
167 171
168 g = pixel; 172 g = pixel;
169 g = g >> decoder->format->greenShift; 173 g = g >> decoder->format->greenShift;
170 g = g & greenMax; 174 g = g & greenMax;
171 175
172 b = pixel; 176 b = pixel;
173 b = b >> decoder->format->blueShift; 177 b = b >> decoder->format->blueShift;
174 b = b & blueMax; 178 b = b & blueMax;
175 179
176 r = ( r * 255 ) / redMax; 180 r = ( r * 255 ) / redMax;
177 g = ( g * 255 ) / greenMax; 181 g = ( g * 255 ) / greenMax;
178 b = ( b * 255 ) / blueMax; 182 b = ( b * 255 ) / blueMax;
179 183
180 ulong *p = ( ulong * ) img.scanLine( j ) + i; 184 ulong *p = ( ulong * ) img.scanLine( j ) + i;
181 *p = qRgb( r,g,b ); 185 *p = qRgb( r,g,b );
182 } 186 }
183 } 187 }
184 } 188 }
185 else { 189 else {
186 p.setBrush( QBrush( Qt::black ) ); 190 p.setBrush( QBrush( Qt::black ) );
187 p.drawRect( x, y, w, h ); 191 p.drawRect( x, y, w, h );
188 } 192 }
189 193
190 p.drawImage( x, y, img ); 194 if (scaleFactor > 1) {
191 195 p.drawImage( x/scaleFactor, y/scaleFactor, img.smoothScale(w/scaleFactor,h/scaleFactor) );
192 emit updated( x, y, w, h ); 196 emit updated( x/scaleFactor, y/scaleFactor, w/scaleFactor, h/scaleFactor );
197 }
198 else {
199 p.drawImage( x, y, img);
200 emit updated( x, y, w, h );
201 }
193} 202}
194 203
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp
index 8b56795..896de7f 100644
--- a/noncore/comm/keypebble/krfbcanvas.cpp
+++ b/noncore/comm/keypebble/krfbcanvas.cpp
@@ -1,172 +1,175 @@
1#include "krfbconnection.h" 1#include "krfbconnection.h"
2#include "krfbcanvas.h" 2#include "krfbcanvas.h"
3#include "krfbserver.h" 3#include "krfbserver.h"
4#include "krfbbuffer.h" 4#include "krfbbuffer.h"
5 5
6#include <qpe/config.h> 6#include <qpe/config.h>
7#include <qpe/qpeapplication.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
17KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) 17KRFBCanvas::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( loggedIn() ), 21 connect( connection_, SIGNAL( loggedIn() ),
22 this, SLOT( loggedIn() ) ); 22 this, SLOT( loggedIn() ) );
23 23
24 loggedIn_ = false; 24 loggedIn_ = false;
25 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); 25
26 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold);
26 27
27 viewport()->setFocusPolicy( QWidget::StrongFocus ); 28 viewport()->setFocusPolicy( QWidget::StrongFocus );
28 viewport()->setFocus(); 29 viewport()->setFocus();
29} 30}
30 31
31KRFBCanvas::~KRFBCanvas() 32KRFBCanvas::~KRFBCanvas()
32{ 33{
33} 34}
34 35
35 36
36void KRFBCanvas::openConnection(KRFBServer server) 37void KRFBCanvas::openConnection(KRFBServer server)
37{ 38{
38 39
39 40
40 QCString host = server.hostname.latin1(); 41 QCString host = server.hostname.latin1();
41 password=server.password; 42 password=server.password;
42 connection_->connectTo( server); 43 connection_->connectTo( server);
43} 44}
44 45
45 46
46void KRFBCanvas::openURL( const QUrl &url ) 47void KRFBCanvas::openURL( const QUrl &url )
47{ 48{
48 if ( loggedIn_ ) { 49 if ( loggedIn_ ) {
49 qWarning( "openURL invoked when logged in\n" ); 50 qWarning( "openURL invoked when logged in\n" );
50 return; 51 return;
51 } 52 }
52 53
53 QCString host = url.host().latin1(); 54 QCString host = url.host().latin1();
54 int display = url.port(); 55 int display = url.port();
55 56
56// connection_->connectTo( host, display ); 57// connection_->connectTo( host, display );
57} 58}
58 59
59void KRFBCanvas::closeConnection() 60void KRFBCanvas::closeConnection()
60{ 61{
61 loggedIn_ = false; 62 loggedIn_ = false;
62 connection_->disconnect(); 63 connection_->disconnect();
63 64
64 viewport()->setMouseTracking( false ); 65 viewport()->setMouseTracking( false );
65 viewport()->setBackgroundMode( PaletteDark ); 66 viewport()->setBackgroundMode( PaletteDark );
66 setBackgroundMode( PaletteDark ); 67 setBackgroundMode( PaletteDark );
67 update(); 68 update();
68} 69}
69 70
70 71
71void KRFBCanvas::bell() 72void KRFBCanvas::bell()
72{ 73{
73 if ( connection_->options()->deIconify ) { 74 if ( connection_->options()->deIconify ) {
74 topLevelWidget()->raise(); 75 topLevelWidget()->raise();
75 topLevelWidget()->show(); 76 topLevelWidget()->show();
76 } 77 }
77} 78}
78 79
79void KRFBCanvas::loggedIn() 80void KRFBCanvas::loggedIn()
80{ 81{
81 qWarning( "Ok, we're logged in" ); 82 qWarning( "Ok, we're logged in" );
82 83
83 // 84 //
84 // Get ready for action 85 // Get ready for action
85 // 86 //
86 loggedIn_ = true; 87 loggedIn_ = true;
87 viewport()->setMouseTracking( true ); 88 viewport()->setMouseTracking( true );
88 viewport()->setBackgroundMode( NoBackground ); 89 viewport()->setBackgroundMode( NoBackground );
89 setBackgroundMode( NoBackground ); 90 setBackgroundMode( NoBackground );
90 91
91 // Start using the buffer 92 // Start using the buffer
92 connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ), 93 connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ),
93 this, SLOT( resizeContents(int,int) ) ); 94 this, SLOT( resizeContents(int,int) ) );
94 connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), 95 connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ),
95 this, SLOT( viewportUpdate(int,int,int,int) ) ); 96 this, SLOT( viewportUpdate(int,int,int,int) ) );
96 connect( connection_->buffer(), SIGNAL( bell() ), 97 connect( connection_->buffer(), SIGNAL( bell() ),
97 this, SLOT( bell() ) ); 98 this, SLOT( bell() ) );
98 connect( qApp->clipboard(), SIGNAL( dataChanged() ), 99 connect( qApp->clipboard(), SIGNAL( dataChanged() ),
99 this, SLOT( clipboardChanged() ) ); 100 this, SLOT( clipboardChanged() ) );
100} 101}
101 102
102void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) 103void KRFBCanvas::viewportPaintEvent( QPaintEvent *e )
103{ 104{
104 QRect r = e->rect(); 105 QRect r = e->rect();
105 106
106 if ( loggedIn_ ) { 107 if ( loggedIn_ ) {
108 QPixmap p;
109
107 bitBlt( viewport(), r.x(), r.y(), 110 bitBlt( viewport(), r.x(), r.y(),
108 connection_->buffer()->pixmap(), 111 connection_->buffer()->pixmap(),
109 r.x() + contentsX(), r.y() + contentsY(), 112 r.x() + contentsX(), r.y() + contentsY(),
110 r.width(), r.height() ); 113 r.width(), r.height() );
111 } 114 }
112 else { 115 else {
113 QScrollView::viewportPaintEvent( e ); 116 QScrollView::viewportPaintEvent( e );
114 } 117 }
115} 118}
116 119
117void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) 120void KRFBCanvas::viewportUpdate( int x, int y, int w, int h )
118{ 121{
119 updateContents( x, y, w, h ); 122 updateContents( x, y, w, h );
120} 123}
121 124
122void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) 125void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e )
123{ 126{
124 if ( loggedIn_ ) 127 if ( loggedIn_ )
125 connection_->buffer()->mouseEvent( e ); 128 connection_->buffer()->mouseEvent( e );
126} 129}
127 130
128void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) 131void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e )
129{ 132{
130 if ( loggedIn_ ) 133 if ( loggedIn_ )
131 connection_->buffer()->mouseEvent( e ); 134 connection_->buffer()->mouseEvent( e );
132} 135}
133 136
134void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) 137void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e )
135{ 138{
136 if ( loggedIn_ ) 139 if ( loggedIn_ )
137 connection_->buffer()->mouseEvent( e ); 140 connection_->buffer()->mouseEvent( e );
138} 141}
139 142
140void KRFBCanvas::keyPressEvent( QKeyEvent *e ) 143void KRFBCanvas::keyPressEvent( QKeyEvent *e )
141{ 144{
142 if ( loggedIn_ ) 145 if ( loggedIn_ )
143 connection_->buffer()->keyPressEvent( e ); 146 connection_->buffer()->keyPressEvent( e );
144} 147}
145 148
146void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) 149void KRFBCanvas::keyReleaseEvent( QKeyEvent *e )
147{ 150{
148 if ( loggedIn_ ) 151 if ( loggedIn_ )
149 connection_->buffer()->keyReleaseEvent( e ); 152 connection_->buffer()->keyReleaseEvent( e );
150} 153}
151 154
152void KRFBCanvas::refresh() 155void KRFBCanvas::refresh()
153{ 156{
154 if ( loggedIn_ ) 157 if ( loggedIn_ )
155 connection_->refresh(); 158 connection_->refresh();
156} 159}
157 160
158void KRFBCanvas::clipboardChanged() 161void KRFBCanvas::clipboardChanged()
159{ 162{
160 if ( loggedIn_ ) { 163 if ( loggedIn_ ) {
161 connection_->sendCutText( qApp->clipboard()->text() ); 164 connection_->sendCutText( qApp->clipboard()->text() );
162 } 165 }
163} 166}
164void KRFBCanvas::sendCtlAltDel( void) 167void KRFBCanvas::sendCtlAltDel( void)
165{ 168{
166 169
167 qDebug("Here"); 170 qDebug("Here");
168 if ( loggedIn_ ) { 171 if ( loggedIn_ ) {
169 connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0x7f,ControlButton|AltButton)); 172 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)); 173 // connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Delete, 0x7f,ControlButton|AltButton));
171 } 174 }
172} 175}
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index a964c09..94e3b79 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -1,840 +1,841 @@
1#include "krfbconnection.h" 1#include "krfbconnection.h"
2#include "krfbserver.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
15#include <assert.h> 15#include <assert.h>
16 16
17// 17//
18// Endian stuff 18// Endian stuff
19// 19//
20#ifndef KDE_USE_FINAL 20#ifndef KDE_USE_FINAL
21const int endianTest = 1; 21const int endianTest = 1;
22#endif 22#endif
23 23
24#define Swap16IfLE(s) \ 24#define Swap16IfLE(s) \
25 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) 25 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
26 26
27#define Swap32IfLE(l) \ 27#define Swap32IfLE(l) \
28 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ 28 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
29 (((l) & 0x00ff0000) >> 8) | \ 29 (((l) & 0x00ff0000) >> 8) | \
30 (((l) & 0x0000ff00) << 8) | \ 30 (((l) & 0x0000ff00) << 8) | \
31 (((l) & 0x000000ff) << 24)) : (l)) 31 (((l) & 0x000000ff) << 24)) : (l))
32 32
33// 33//
34// The lengths of the messages we need to wait for 34// The lengths of the messages we need to wait for
35// 35//
36const int ServerInitLength = 24; 36const int ServerInitLength = 24;
37const int UpdateHeaderLength = 4; 37const int UpdateHeaderLength = 4;
38const int RectHeaderLength = 12; 38const int RectHeaderLength = 12;
39const int RectChunkSize = 4; 39const int RectChunkSize = 4;
40const int CopyRectPosLength = 4; 40const int CopyRectPosLength = 4;
41const int ServerCutLenLength = 7; 41const int ServerCutLenLength = 7;
42 42
43// 43//
44// Client -> Server Message Identifiers 44// Client -> Server Message Identifiers
45// 45//
46static CARD8 SetPixelFormatId = 0; 46static CARD8 SetPixelFormatId = 0;
47//static CARD8 FixColourMapEntriesId = 1; // Not used 47//static CARD8 FixColourMapEntriesId = 1; // Not used
48static CARD8 SetEncodingsId = 2; 48static CARD8 SetEncodingsId = 2;
49static CARD8 UpdateRequestId = 3; 49static CARD8 UpdateRequestId = 3;
50static CARD8 KeyEventId = 4; 50static CARD8 KeyEventId = 4;
51static CARD8 PointerEventId = 5; 51static CARD8 PointerEventId = 5;
52static CARD8 ClientCutTextId = 6; 52static CARD8 ClientCutTextId = 6;
53 53
54// 54//
55// Server -> Client Message Identifiers 55// Server -> Client Message Identifiers
56// 56//
57static CARD8 UpdateId = 0; 57static CARD8 UpdateId = 0;
58static CARD8 BellId = 2; 58static CARD8 BellId = 2;
59static CARD8 ServerCutId = 3; 59static CARD8 ServerCutId = 3;
60 60
61// 61//
62// Encoding identifiers 62// Encoding identifiers
63// 63//
64static CARD32 RawEncoding = Swap32IfLE( 0 ); 64static CARD32 RawEncoding = Swap32IfLE( 0 );
65static CARD32 CopyRectEncoding = Swap32IfLE(1 ); 65static CARD32 CopyRectEncoding = Swap32IfLE(1 );
66static CARD32 RreEncoding = Swap32IfLE( 2 ); 66static CARD32 RreEncoding = Swap32IfLE( 2 );
67static CARD32 CorreEncoding = Swap32IfLE( 4 ); 67static CARD32 CorreEncoding = Swap32IfLE( 4 );
68static CARD32 HexTileEncoding = Swap32IfLE( 5 ); 68static CARD32 HexTileEncoding = Swap32IfLE( 5 );
69 69
70static struct { 70static struct {
71 int keysym; 71 int keysym;
72 int keycode; 72 int keycode;
73} keyMap[] = { 73} keyMap[] = {
74 { 0xff08, Qt::Key_Backspace }, 74 { 0xff08, Qt::Key_Backspace },
75 { 0xff09, Qt::Key_Tab }, 75 { 0xff09, Qt::Key_Tab },
76 { 0xff0d, Qt::Key_Return }, 76 { 0xff0d, Qt::Key_Return },
77 { 0xff1b, Qt::Key_Escape }, 77 { 0xff1b, Qt::Key_Escape },
78 { 0xff63, Qt::Key_Insert }, 78 { 0xff63, Qt::Key_Insert },
79 { 0xffff, Qt::Key_Delete }, 79 { 0xffff, Qt::Key_Delete },
80 { 0xff50, Qt::Key_Home }, 80 { 0xff50, Qt::Key_Home },
81 { 0xff57, Qt::Key_End }, 81 { 0xff57, Qt::Key_End },
82 { 0xff55, Qt::Key_Prior }, 82 { 0xff55, Qt::Key_Prior },
83 { 0xff56, Qt::Key_Next }, 83 { 0xff56, Qt::Key_Next },
84 { 0xff51, Qt::Key_Left }, 84 { 0xff51, Qt::Key_Left },
85 { 0xff52, Qt::Key_Up }, 85 { 0xff52, Qt::Key_Up },
86 { 0xff53, Qt::Key_Right }, 86 { 0xff53, Qt::Key_Right },
87 { 0xff54, Qt::Key_Down }, 87 { 0xff54, Qt::Key_Down },
88 { 0xffbe, Qt::Key_F1 }, 88 { 0xffbe, Qt::Key_F1 },
89 { 0xffbf, Qt::Key_F2 }, 89 { 0xffbf, Qt::Key_F2 },
90 { 0xffc0, Qt::Key_F3 }, 90 { 0xffc0, Qt::Key_F3 },
91 { 0xffc1, Qt::Key_F4 }, 91 { 0xffc1, Qt::Key_F4 },
92 { 0xffc2, Qt::Key_F5 }, 92 { 0xffc2, Qt::Key_F5 },
93 { 0xffc3, Qt::Key_F6 }, 93 { 0xffc3, Qt::Key_F6 },
94 { 0xffc4, Qt::Key_F7 }, 94 { 0xffc4, Qt::Key_F7 },
95 { 0xffc5, Qt::Key_F8 }, 95 { 0xffc5, Qt::Key_F8 },
96 { 0xffc6, Qt::Key_F9 }, 96 { 0xffc6, Qt::Key_F9 },
97 { 0xffc7, Qt::Key_F10 }, 97 { 0xffc7, Qt::Key_F10 },
98 { 0xffc8, Qt::Key_F11 }, 98 { 0xffc8, Qt::Key_F11 },
99 { 0xffc9, Qt::Key_F12 }, 99 { 0xffc9, Qt::Key_F12 },
100 { 0xffe1, Qt::Key_Shift }, 100 { 0xffe1, Qt::Key_Shift },
101 { 0xffe2, Qt::Key_Shift }, 101 { 0xffe2, Qt::Key_Shift },
102 { 0xffe3, Qt::Key_Control }, 102 { 0xffe3, Qt::Key_Control },
103 { 0xffe4, Qt::Key_Control }, 103 { 0xffe4, Qt::Key_Control },
104 { 0xffe7, Qt::Key_Meta }, 104 { 0xffe7, Qt::Key_Meta },
105 { 0xffe8, Qt::Key_Meta }, 105 { 0xffe8, Qt::Key_Meta },
106 { 0xffe9, Qt::Key_Alt }, 106 { 0xffe9, Qt::Key_Alt },
107 { 0xffea, Qt::Key_Alt }, 107 { 0xffea, Qt::Key_Alt },
108 { 0, 0 } 108 { 0, 0 }
109}; 109};
110 110
111 111
112KRFBDecoder::KRFBDecoder( KRFBConnection *con ) 112KRFBDecoder::KRFBDecoder( KRFBConnection *con )
113 : QObject( con, "RFB Decoder" ) 113 : QObject( con, "RFB Decoder" )
114{ 114{
115 assert( con ); 115 assert( con );
116 assert( con->state() == KRFBConnection::Connected ); 116 assert( con->state() == KRFBConnection::Connected );
117 117
118 this->con = con; 118 this->con = con;
119 this->buf = 0; 119 this->buf = 0;
120 this->info = 0; 120 this->info = 0;
121 this->format = 0; 121 this->format = 0;
122 this->buttonMask = 0; 122 this->buttonMask = 0;
123 currentState = Idle; 123 currentState = Idle;
124} 124}
125 125
126KRFBDecoder::~KRFBDecoder() 126KRFBDecoder::~KRFBDecoder()
127{ 127{
128 if ( info ) 128 if ( info )
129 delete info; 129 delete info;
130 if ( format ) 130 if ( format )
131 delete format; 131 delete format;
132} 132}
133 133
134void KRFBDecoder::start() 134void KRFBDecoder::start()
135{ 135{
136 sendClientInit(); 136 sendClientInit();
137} 137}
138 138
139void KRFBDecoder::sendClientInit() 139void KRFBDecoder::sendClientInit()
140{ 140{
141 con->write( &( con->options()->shared ), 1 ); 141 con->write( &( con->options()->shared ), 1 );
142 142
143 // Wait for server init 143 // Wait for server init
144 qWarning( "Waiting for server init" ); 144 qWarning( "Waiting for server init" );
145 145
146 static QString statusMsg = tr( "Waiting for server initialisation..." ); 146 static QString statusMsg = tr( "Waiting for server initialisation..." );
147 emit status( statusMsg ); 147 emit status( statusMsg );
148 148
149 currentState = AwaitingServerInit; 149 currentState = AwaitingServerInit;
150 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerInit() ) ); 150 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerInit() ) );
151 con->waitForData( ServerInitLength ); 151 con->waitForData( ServerInitLength );
152} 152}
153 153
154void KRFBDecoder::gotServerInit() 154void KRFBDecoder::gotServerInit()
155{ 155{
156 qWarning( "Got server init" ); 156 qWarning( "Got server init" );
157 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) ); 157 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) );
158 158
159 if ( info ) 159 if ( info )
160 delete info; 160 delete info;
161 info = new KRFBServerInfo; 161 info = new KRFBServerInfo;
162 CHECK_PTR( info ); 162 CHECK_PTR( info );
163 163
164 con->read( &(info->width), 2 ); 164 con->read( &(info->width), 2 );
165 info->width = Swap16IfLE( info->width ); 165 info->width = Swap16IfLE( info->width );
166 con->read( &info->height, 2 ); 166 con->read( &info->height, 2 );
167 info->height = Swap16IfLE( info->height ); 167 info->height = Swap16IfLE( info->height );
168 168
169 con->read( &(info->bpp), 1 ); 169 con->read( &(info->bpp), 1 );
170 con->read( &(info->depth), 1 ); 170 con->read( &(info->depth), 1 );
171 con->read( &(info->bigEndian), 1 ); 171 con->read( &(info->bigEndian), 1 );
172 con->read( &(info->trueColor), 1 ); 172 con->read( &(info->trueColor), 1 );
173 173
174 con->read( &(info->redMax), 2 ); 174 con->read( &(info->redMax), 2 );
175 info->redMax = Swap16IfLE( info->redMax ); 175 info->redMax = Swap16IfLE( info->redMax );
176 con->read( &(info->greenMax), 2 ); 176 con->read( &(info->greenMax), 2 );
177 info->greenMax = Swap16IfLE( info->greenMax ); 177 info->greenMax = Swap16IfLE( info->greenMax );
178 con->read( &(info->blueMax), 2 ); 178 con->read( &(info->blueMax), 2 );
179 info->blueMax = Swap16IfLE( info->blueMax ); 179 info->blueMax = Swap16IfLE( info->blueMax );
180 180
181 con->read( &(info->redShift), 1 ); 181 con->read( &(info->redShift), 1 );
182 con->read( &(info->greenShift), 1 ); 182 con->read( &(info->greenShift), 1 );
183 con->read( &(info->blueShift), 1 ); 183 con->read( &(info->blueShift), 1 );
184 184
185 con->read( info->padding, 3 ); 185 con->read( info->padding, 3 );
186 186
187 con->read( &(info->nameLength), 4 ); 187 con->read( &(info->nameLength), 4 );
188 info->nameLength = Swap32IfLE( info->nameLength ); 188 info->nameLength = Swap32IfLE( info->nameLength );
189 189
190 qWarning( "Width = %d, Height = %d", info->width, info->height ); 190 qWarning( "Width = %d, Height = %d", info->width, info->height );
191 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d", 191 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d",
192 info->bpp, info->depth, info->bigEndian, info->trueColor ); 192 info->bpp, info->depth, info->bigEndian, info->trueColor );
193 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d", 193 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d",
194 info->redMax, info->greenMax, info->blueMax ); 194 info->redMax, info->greenMax, info->blueMax );
195 qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d", 195 qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d",
196 info->redShift, info->greenShift,info-> blueShift ); 196 info->redShift, info->greenShift,info-> blueShift );
197 197
198 buf->resize( info->width, info->height ); 198 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
199 199
200 // Wait for desktop name 200 // Wait for desktop name
201 qWarning( "Waiting for desktop name" ); 201 qWarning( "Waiting for desktop name" );
202 202
203 static QString statusMsg = tr( "Waiting for desktop name..." ); 203 static QString statusMsg = tr( "Waiting for desktop name..." );
204 emit status( statusMsg ); 204 emit status( statusMsg );
205 205
206 currentState = AwaitingDesktopName; 206 currentState = AwaitingDesktopName;
207 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) ); 207 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) );
208 con->waitForData( info->nameLength ); 208 con->waitForData( info->nameLength );
209} 209}
210 210
211void KRFBDecoder::gotDesktopName() 211void KRFBDecoder::gotDesktopName()
212{ 212{
213 assert( info ); 213 assert( info );
214 assert( currentState == AwaitingDesktopName ); 214 assert( currentState == AwaitingDesktopName );
215 215
216 qWarning( "Got desktop name" ); 216 qWarning( "Got desktop name" );
217 217
218 disconnect( con, SIGNAL( gotEnoughData() ), 218 disconnect( con, SIGNAL( gotEnoughData() ),
219 this, SLOT( gotDesktopName() ) ); 219 this, SLOT( gotDesktopName() ) );
220 220
221 char *buf = new char[ info->nameLength + 1 ]; 221 char *buf = new char[ info->nameLength + 1 ];
222 CHECK_PTR( buf ); 222 CHECK_PTR( buf );
223 223
224 con->read( buf, info->nameLength ); 224 con->read( buf, info->nameLength );
225 buf[ info->nameLength ] = '\0'; 225 buf[ info->nameLength ] = '\0';
226 info->name = buf; 226 info->name = buf;
227 227
228 qWarning( "Desktop: %s", info->name.latin1() ); 228 qWarning( "Desktop: %s", info->name.latin1() );
229 229
230 delete buf; 230 delete buf;
231 231
232 // Get the format we'll really use and tell the server 232 // Get the format we'll really use and tell the server
233 decidePixelFormat(); 233 decidePixelFormat();
234 sendPixelFormat(); 234 sendPixelFormat();
235 sendAllowedEncodings(); 235 sendAllowedEncodings();
236 currentState = Idle; 236 currentState = Idle;
237 237
238 QString msg; 238 QString msg;
239 msg = tr( "Connected to %1" ); 239 msg = tr( "Connected to %1" );
240 msg = msg.arg( info->name ); 240 msg = msg.arg( info->name );
241 emit status( msg ); 241 emit status( msg );
242 242
243 sendUpdateRequest( false ); 243 sendUpdateRequest( false );
244} 244}
245 245
246void KRFBDecoder::decidePixelFormat() 246void KRFBDecoder::decidePixelFormat()
247{ 247{
248 assert( info ); 248 assert( info );
249 249
250 if ( format ) 250 if ( format )
251 delete format; 251 delete format;
252 format = new KRFBPixelFormat; 252 format = new KRFBPixelFormat;
253 CHECK_PTR( format ); 253 CHECK_PTR( format );
254 254
255 // What depth do we want? 255 // What depth do we want?
256 // 256 //
257 // We'll use the minimum of the remote and local depths, UNLESS an 257 // We'll use the minimum of the remote and local depths, UNLESS an
258 // eight bit session has been specifically requested by the user. 258 // eight bit session has been specifically requested by the user.
259 int screenDepth = QPixmap::defaultDepth(); 259 int screenDepth = QPixmap::defaultDepth();
260 int bestDepth = ( screenDepth > info->depth ) ? info->depth : screenDepth; 260 int bestDepth = ( screenDepth > info->depth ) ? info->depth : screenDepth;
261 int chosenDepth; 261 int chosenDepth;
262 262
263 if ( con->options()->colors256 ) 263 if ( con->options()->colors256 )
264 chosenDepth = 8; 264 chosenDepth = 8;
265 else 265 else
266 chosenDepth = bestDepth; 266 chosenDepth = bestDepth;
267 267
268 qWarning( "Screen depth=%d, server depth=%d, best depth=%d, " \ 268 qWarning( "Screen depth=%d, server depth=%d, best depth=%d, " \
269 "eight bit %d, chosenDepth=%d", 269 "eight bit %d, chosenDepth=%d",
270 screenDepth, 270 screenDepth,
271 info->depth, 271 info->depth,
272 bestDepth, 272 bestDepth,
273 con->options()->colors256, chosenDepth ); 273 con->options()->colors256, chosenDepth );
274 274
275 format->depth = chosenDepth; 275 format->depth = chosenDepth;
276 276
277 // If we're using the servers native depth 277 // If we're using the servers native depth
278 if ( chosenDepth == info->depth ) { 278 if ( chosenDepth == info->depth ) {
279 // Use the servers native format 279 // Use the servers native format
280 format->bpp = info->bpp; 280 format->bpp = info->bpp;
281 // format->bigEndian = info->bigEndian; 281 // format->bigEndian = info->bigEndian;
282 format->bigEndian = true; 282 format->bigEndian = true;
283 format->trueColor = info->trueColor; 283 format->trueColor = info->trueColor;
284 format->redMax = info->redMax; 284 format->redMax = info->redMax;
285 format->greenMax = info->greenMax; 285 format->greenMax = info->greenMax;
286 format->blueMax = info->blueMax; 286 format->blueMax = info->blueMax;
287 format->redShift = info->redShift; 287 format->redShift = info->redShift;
288 format->greenShift = info->greenShift; 288 format->greenShift = info->greenShift;
289 format->blueShift = info->blueShift; 289 format->blueShift = info->blueShift;
290 } 290 }
291 else { 291 else {
292 if ( chosenDepth == 8 ) { 292 if ( chosenDepth == 8 ) {
293 format->bpp = 8; 293 format->bpp = 8;
294 format->bigEndian = true; 294 format->bigEndian = true;
295 format->trueColor = true; 295 format->trueColor = true;
296 format->redMax = 7; 296 format->redMax = 7;
297 format->greenMax = 7; 297 format->greenMax = 7;
298 format->blueMax = 3; 298 format->blueMax = 3;
299 format->redShift = 0; 299 format->redShift = 0;
300 format->greenShift = 3; 300 format->greenShift = 3;
301 format->blueShift = 6; 301 format->blueShift = 6;
302 } 302 }
303 } 303 }
304 304
305 format->redMax = Swap16IfLE( format->redMax ); 305 format->redMax = Swap16IfLE( format->redMax );
306 format->greenMax = Swap16IfLE( format->greenMax ); 306 format->greenMax = Swap16IfLE( format->greenMax );
307 format->blueMax = Swap16IfLE( format->blueMax ); 307 format->blueMax = Swap16IfLE( format->blueMax );
308} 308}
309 309
310void KRFBDecoder::sendPixelFormat() 310void KRFBDecoder::sendPixelFormat()
311{ 311{
312 static char padding[3]; 312 static char padding[3];
313 con->write( &SetPixelFormatId, 1 ); 313 con->write( &SetPixelFormatId, 1 );
314 con->write( padding, 3 ); 314 con->write( padding, 3 );
315 315
316 con->write( &(format->bpp), 1 ); 316 con->write( &(format->bpp), 1 );
317 con->write( &(format->depth), 1 ); 317 con->write( &(format->depth), 1 );
318 con->write( &(format->bigEndian), 1 ); 318 con->write( &(format->bigEndian), 1 );
319 con->write( &(format->trueColor), 1 ); 319 con->write( &(format->trueColor), 1 );
320 320
321 con->write( &(format->redMax), 2 ); 321 con->write( &(format->redMax), 2 );
322 con->write( &(format->greenMax), 2 ); 322 con->write( &(format->greenMax), 2 );
323 con->write( &(format->blueMax), 2 ); 323 con->write( &(format->blueMax), 2 );
324 324
325 con->write( &(format->redShift), 1 ); 325 con->write( &(format->redShift), 1 );
326 con->write( &(format->greenShift), 1 ); 326 con->write( &(format->greenShift), 1 );
327 con->write( &(format->blueShift), 1 ); 327 con->write( &(format->blueShift), 1 );
328 con->write( format->padding, 3 ); // Padding 328 con->write( format->padding, 3 ); // Padding
329} 329}
330 330
331void KRFBDecoder::sendAllowedEncodings() 331void KRFBDecoder::sendAllowedEncodings()
332{ 332{
333 static CARD8 padding[1]; 333 static CARD8 padding[1];
334 con->write( &SetEncodingsId, 1 ); 334 con->write( &SetEncodingsId, 1 );
335 con->write( padding, 1 ); 335 con->write( padding, 1 );
336 336
337 static CARD16 noEncodings = con->options()->encodings(); 337 static CARD16 noEncodings = con->options()->encodings();
338 noEncodings = Swap16IfLE( noEncodings ); 338 noEncodings = Swap16IfLE( noEncodings );
339 con->write( &noEncodings, 2 ); 339 con->write( &noEncodings, 2 );
340 340
341 if ( con->options()->corre ) 341 if ( con->options()->corre )
342 con->write( &CorreEncoding, 4 ); 342 con->write( &CorreEncoding, 4 );
343 if ( con->options()->hexTile ) 343 if ( con->options()->hexTile )
344 con->write( &HexTileEncoding, 4 ); 344 con->write( &HexTileEncoding, 4 );
345 if ( con->options()->rre ) 345 if ( con->options()->rre )
346 con->write( &RreEncoding, 4 ); 346 con->write( &RreEncoding, 4 );
347 if ( con->options()->copyrect ) 347 if ( con->options()->copyrect )
348 con->write( &CopyRectEncoding, 4 ); 348 con->write( &CopyRectEncoding, 4 );
349 // We always support this 349 // We always support this
350 con->write( &RawEncoding, 4 ); 350 con->write( &RawEncoding, 4 );
351} 351}
352 352
353void KRFBDecoder::sendUpdateRequest( bool incremental ) 353void KRFBDecoder::sendUpdateRequest( bool incremental )
354{ 354{
355 if ( currentState != Idle ) 355 if ( currentState != Idle )
356 return; 356 return;
357 357
358 con->write( &UpdateRequestId, 1 ); 358 con->write( &UpdateRequestId, 1 );
359 con->write( &incremental, 1 ); 359 con->write( &incremental, 1 );
360 360
361 static CARD16 x = 0, y = 0; 361 static CARD16 x = 0, y = 0;
362 static CARD16 w = Swap16IfLE( info->width ); 362 static CARD16 w = Swap16IfLE( info->width );
363 static CARD16 h = Swap16IfLE( info->height ); 363 static CARD16 h = Swap16IfLE( info->height );
364 364
365 con->write( &x, 2 ); 365 con->write( &x, 2 );
366 con->write( &y, 2 ); 366 con->write( &y, 2 );
367 con->write( &w, 2 ); 367 con->write( &w, 2 );
368 con->write( &h, 2 ); 368 con->write( &h, 2 );
369 369
370 // Now wait for the update 370 // Now wait for the update
371 currentState = AwaitingUpdate; 371 currentState = AwaitingUpdate;
372 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 372 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
373 con->waitForData( UpdateHeaderLength ); 373 con->waitForData( UpdateHeaderLength );
374} 374}
375 375
376void KRFBDecoder::gotUpdateHeader() 376void KRFBDecoder::gotUpdateHeader()
377{ 377{
378 assert( currentState == AwaitingUpdate ); 378 assert( currentState == AwaitingUpdate );
379 379
380 // qWarning( "Got update header" ); 380 // qWarning( "Got update header" );
381 381
382 disconnect( con, SIGNAL( gotEnoughData() ), 382 disconnect( con, SIGNAL( gotEnoughData() ),
383 this, SLOT( gotUpdateHeader() ) ); 383 this, SLOT( gotUpdateHeader() ) );
384 384
385 CARD8 msgType; 385 CARD8 msgType;
386 con->read( &msgType, 1 ); 386 con->read( &msgType, 1 );
387 387
388 if ( msgType != UpdateId ) { 388 if ( msgType != UpdateId ) {
389 // We might have a bell or server cut 389 // We might have a bell or server cut
390 if ( msgType == ServerCutId ) { 390 if ( msgType == ServerCutId ) {
391 oldState = currentState; 391 oldState = currentState;
392 gotServerCut(); 392 gotServerCut();
393 } 393 }
394 else if ( msgType == BellId ) { 394 else if ( msgType == BellId ) {
395 oldState = currentState; 395 oldState = currentState;
396 gotBell(); 396 gotBell();
397 } 397 }
398 else { 398 else {
399 int msg = msgType; 399 int msg = msgType;
400 QString protocolError = tr( "Protocol Error: Message Id %1 was " 400 QString protocolError = tr( "Protocol Error: Message Id %1 was "
401 "found when expecting an update " 401 "found when expecting an update "
402 "message." ).arg( msg ); 402 "message." ).arg( msg );
403 currentState = Error; 403 currentState = Error;
404 emit error( protocolError ); 404 emit error( protocolError );
405 } 405 }
406 return; 406 return;
407 } 407 }
408 408
409 CARD8 padding; 409 CARD8 padding;
410 con->read( &padding, 1 ); 410 con->read( &padding, 1 );
411 411
412 con->read( &noRects, 2 ); 412 con->read( &noRects, 2 );
413 noRects = Swap16IfLE( noRects ); 413 noRects = Swap16IfLE( noRects );
414 414
415 // qWarning( "Expecting %d rects", noRects ); 415 // qWarning( "Expecting %d rects", noRects );
416 416
417 // Now wait for the data 417 // Now wait for the data
418 currentState = AwaitingRectHeader; 418 currentState = AwaitingRectHeader;
419 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 419 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
420 con->waitForData( RectHeaderLength ); 420 con->waitForData( RectHeaderLength );
421} 421}
422 422
423void KRFBDecoder::gotRectHeader() 423void KRFBDecoder::gotRectHeader()
424{ 424{
425 assert( currentState == AwaitingRectHeader ); 425 assert( currentState == AwaitingRectHeader );
426 426
427 // qWarning( "Got rect header" ); 427 // qWarning( "Got rect header" );
428 428
429 disconnect( con, SIGNAL( gotEnoughData() ), 429 disconnect( con, SIGNAL( gotEnoughData() ),
430 this, SLOT( gotRectHeader() ) ); 430 this, SLOT( gotRectHeader() ) );
431 431
432 con->read( &x, 2 ); 432 con->read( &x, 2 );
433 x = Swap16IfLE( x ); 433 x = Swap16IfLE( x );
434 con->read( &y, 2 ); 434 con->read( &y, 2 );
435 y = Swap16IfLE( y ); 435 y = Swap16IfLE( y );
436 436
437 con->read( &w, 2 ); 437 con->read( &w, 2 );
438 w = Swap16IfLE( w ); 438 w = Swap16IfLE( w );
439 con->read( &h, 2 ); 439 con->read( &h, 2 );
440 h = Swap16IfLE( h ); 440 h = Swap16IfLE( h );
441 441
442 con->read( &encoding, 4 ); 442 con->read( &encoding, 4 );
443 443
444 // CARD32 encodingLocal = Swap32IfLE( encoding ); 444 // CARD32 encodingLocal = Swap32IfLE( encoding );
445 // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", 445 // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld",
446 // x, y, w, h, encodingLocal ); 446 // x, y, w, h, encodingLocal );
447 447
448 // 448 //
449 // Each encoding needs to be handled differently. Some require 449 // Each encoding needs to be handled differently. Some require
450 // waiting for more data, but others like a copyrect do not. 450 // waiting for more data, but others like a copyrect do not.
451 // Our constants have already been byte swapped, so we use 451 // Our constants have already been byte swapped, so we use
452 // the remote value as is. 452 // the remote value as is.
453 // 453 //
454 if ( encoding == RawEncoding ) { 454 if ( encoding == RawEncoding ) {
455 // qWarning( "Raw encoding" ); 455 // qWarning( "Raw encoding" );
456 handleRawRect(); 456 handleRawRect();
457 } 457 }
458 else if ( encoding == CopyRectEncoding ) { 458 else if ( encoding == CopyRectEncoding ) {
459// qWarning( "CopyRect encoding" ); 459// qWarning( "CopyRect encoding" );
460 handleCopyRect(); 460 handleCopyRect();
461 } 461 }
462 else if ( encoding == RreEncoding ) { 462 else if ( encoding == RreEncoding ) {
463 qWarning( "RRE encoding" ); 463 qWarning( "RRE encoding" );
464 handleRRERect(); 464 handleRRERect();
465 } 465 }
466 else if ( encoding == CorreEncoding ) { 466 else if ( encoding == CorreEncoding ) {
467 qWarning( "CoRRE encoding" ); 467 qWarning( "CoRRE encoding" );
468 handleCoRRERect(); 468 handleCoRRERect();
469 } 469 }
470 else if ( encoding == HexTileEncoding ) { 470 else if ( encoding == HexTileEncoding ) {
471 qWarning( "HexTile encoding" ); 471 qWarning( "HexTile encoding" );
472 handleHexTileRect(); 472 handleHexTileRect();
473 } 473 }
474 else { 474 else {
475 int msg = Swap32IfLE( encoding ); 475 int msg = Swap32IfLE( encoding );
476 QString protocolError = tr( "Protocol Error: An unknown encoding was " 476 QString protocolError = tr( "Protocol Error: An unknown encoding was "
477 "used by the server %1" ).arg( msg ); 477 "used by the server %1" ).arg( msg );
478 currentState = Error; 478 currentState = Error;
479 qWarning( "Unknown encoding, %d", msg ); 479 qWarning( "Unknown encoding, %d", msg );
480 emit error( protocolError ); 480 emit error( protocolError );
481 return; 481 return;
482 } 482 }
483} 483}
484 484
485// 485//
486// Raw Encoding 486// Raw Encoding
487// 487//
488 488
489void KRFBDecoder::handleRawRect() 489void KRFBDecoder::handleRawRect()
490{ 490{
491 // We need something a bit cleverer here to handle large 491 // We need something a bit cleverer here to handle large
492 // rectanges nicely. The chunking should be based on the 492 // rectanges nicely. The chunking should be based on the
493 // overall size (but has to be in complete lines). 493 // overall size (but has to be in complete lines).
494 494
495 // qWarning( "Handling a raw rect chunk" ); 495 // qWarning( "Handling a raw rect chunk" );
496 496
497 // CARD32 lineCount = w * format->bpp / 8; 497 // CARD32 lineCount = w * format->bpp / 8;
498 498
499 if ( h > RectChunkSize ) { 499 if ( h > RectChunkSize ) {
500 // if ( con->sock->size() / lineCount ) { 500 // if ( con->sock->size() / lineCount ) {
501 // getRawRectChunk( con->sock->size() / lineCount ); 501 // getRawRectChunk( con->sock->size() / lineCount );
502 // } 502 // }
503 // else { 503 // else {
504 getRawRectChunk( RectChunkSize ); 504 getRawRectChunk( RectChunkSize );
505 // } 505 // }
506 } 506 }
507 else { 507 else {
508 getRawRectChunk( h ); 508 getRawRectChunk( h );
509 } 509 }
510} 510}
511 511
512void KRFBDecoder::getRawRectChunk( int lines ) 512void KRFBDecoder::getRawRectChunk( int lines )
513{ 513{
514 this->lines = lines; 514 this->lines = lines;
515 CARD32 count = lines * w * format->bpp / 8; 515 CARD32 count = lines * w * format->bpp / 8;
516 516
517 // Wait for server init 517 // Wait for server init
518 // qWarning( "Waiting for raw rect chunk, %ld", count ); 518 // qWarning( "Waiting for raw rect chunk, %ld", count );
519 519
520 currentState = AwaitingRawRectChunk; 520 currentState = AwaitingRawRectChunk;
521 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); 521 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) );
522 con->waitForData( count ); 522 con->waitForData( count );
523} 523}
524 524
525void KRFBDecoder::gotRawRectChunk() 525void KRFBDecoder::gotRawRectChunk()
526{ 526{
527 assert( currentState == AwaitingRawRectChunk ); 527 assert( currentState == AwaitingRawRectChunk );
528 528
529 disconnect( con, SIGNAL( gotEnoughData() ), 529 disconnect( con, SIGNAL( gotEnoughData() ),
530 this, SLOT( gotRawRectChunk() ) ); 530 this, SLOT( gotRawRectChunk() ) );
531 531
532 // qWarning( "Got raw rect chunk" ); 532 // qWarning( "Got raw rect chunk" );
533 533
534 // 534 //
535 // Read the rect data and copy it to the buffer. 535 // Read the rect data and copy it to the buffer.
536 // 536 //
537 537
538 // TODO: Replace this! 538 // TODO: Replace this!
539 int count = lines * w * format->bpp / 8; 539 int count = lines * w * format->bpp / 8;
540 char *hack = new char[ count ]; 540 char *hack = new char[ count ];
541 con->read( hack, count ); 541 con->read( hack, count );
542 buf->drawRawRectChunk( hack, x, y, w, lines ); 542 buf->drawRawRectChunk( hack, x, y, w, lines );
543 delete hack; 543 delete hack;
544 // /TODO: 544 // /TODO:
545 545
546 h = h - lines; 546 h = h - lines;
547 y = y + lines; 547 y = y + lines;
548 548
549 if ( h > 0 ) { 549 if ( h > 0 ) {
550 handleRawRect(); 550 handleRawRect();
551 } 551 }
552 else { 552 else {
553 noRects--; 553 noRects--;
554 554
555 // qWarning( "There are %d rects left", noRects ); 555 // qWarning( "There are %d rects left", noRects );
556 556
557 if ( noRects ) { 557 if ( noRects ) {
558 currentState = AwaitingRectHeader; 558 currentState = AwaitingRectHeader;
559 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 559 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
560 con->waitForData( RectHeaderLength ); 560 con->waitForData( RectHeaderLength );
561 } 561 }
562 else 562 else
563 currentState = Idle; 563 currentState = Idle;
564 } 564 }
565} 565}
566 566
567// 567//
568// Copy Rectangle Encoding 568// Copy Rectangle Encoding
569// 569//
570 570
571void KRFBDecoder::handleCopyRect() 571void KRFBDecoder::handleCopyRect()
572{ 572{
573 currentState = AwaitingCopyRectPos; 573 currentState = AwaitingCopyRectPos;
574 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotCopyRectPos() ) ); 574 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotCopyRectPos() ) );
575 con->waitForData( CopyRectPosLength ); 575 con->waitForData( CopyRectPosLength );
576} 576}
577 577
578void KRFBDecoder::gotCopyRectPos() 578void KRFBDecoder::gotCopyRectPos()
579{ 579{
580 disconnect( con, SIGNAL( gotEnoughData() ), 580 disconnect( con, SIGNAL( gotEnoughData() ),
581 this, SLOT( gotCopyRectPos() ) ); 581 this, SLOT( gotCopyRectPos() ) );
582 582
583 CARD16 srcX; 583 CARD16 srcX;
584 CARD16 srcY; 584 CARD16 srcY;
585 585
586 con->read( &srcX, 2 ); 586 con->read( &srcX, 2 );
587 con->read( &srcY, 2 ); 587 con->read( &srcY, 2 );
588 588
589 srcX = Swap16IfLE( srcX ); 589 srcX = Swap16IfLE( srcX );
590 srcY = Swap16IfLE( srcY ); 590 srcY = Swap16IfLE( srcY );
591 591
592 buf->copyRect( srcX, srcY, x, y, w, h ); 592 buf->copyRect( srcX, srcY, x, y, w, h );
593 593
594 noRects--; 594 noRects--;
595 595
596 // qWarning( "There are %d rects left", noRects ); 596 // qWarning( "There are %d rects left", noRects );
597 597
598 if ( noRects ) { 598 if ( noRects ) {
599 currentState = AwaitingRectHeader; 599 currentState = AwaitingRectHeader;
600 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 600 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
601 con->waitForData( RectHeaderLength ); 601 con->waitForData( RectHeaderLength );
602 } 602 }
603 else 603 else
604 currentState = Idle; 604 currentState = Idle;
605} 605}
606 606
607void KRFBDecoder::handleRRERect() 607void KRFBDecoder::handleRRERect()
608{ 608{
609 qWarning( "RRE not implemented" ); 609 qWarning( "RRE not implemented" );
610} 610}
611 611
612void KRFBDecoder::handleCoRRERect() 612void KRFBDecoder::handleCoRRERect()
613{ 613{
614 qWarning( "CoRRE not implemented" ); 614 qWarning( "CoRRE not implemented" );
615} 615}
616 616
617void KRFBDecoder::handleHexTileRect() 617void KRFBDecoder::handleHexTileRect()
618{ 618{
619 qWarning( "HexTile not implemented" ); 619 qWarning( "HexTile not implemented" );
620} 620}
621 621
622void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) 622void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
623{ 623{
624 // Deal with the buttons 624 // Deal with the buttons
625 if ( e->type() != QEvent::MouseMove ) { 625 if ( e->type() != QEvent::MouseMove ) {
626 buttonMask = 0; 626 buttonMask = 0;
627 if ( e->type() == QEvent::MouseButtonPress ) { 627 if ( e->type() == QEvent::MouseButtonPress ) {
628 if ( e->button() & LeftButton ) 628 if ( e->button() & LeftButton )
629 buttonMask |= 0x01; 629 buttonMask |= 0x01;
630 if ( e->button() & MidButton ) 630 if ( e->button() & MidButton )
631 buttonMask |= 0x04; 631 buttonMask |= 0x04;
632 if ( e->button() & RightButton ) 632 if ( e->button() & RightButton )
633 buttonMask |= 0x02; 633 buttonMask |= 0x02;
634 } 634 }
635 else if ( e->type() == QEvent::MouseButtonRelease ) { 635 else if ( e->type() == QEvent::MouseButtonRelease ) {
636 if ( e->button() & LeftButton ) 636 if ( e->button() & LeftButton )
637 buttonMask &= 0x06; 637 buttonMask &= 0x06;
638 if ( e->button() & MidButton ) 638 if ( e->button() & MidButton )
639 buttonMask |= 0x03; 639 buttonMask |= 0x03;
640 if ( e->button() & RightButton ) 640 if ( e->button() & RightButton )
641 buttonMask |= 0x05; 641 buttonMask |= 0x05;
642 } 642 }
643 } 643 }
644 644
645 CARD16 x = Swap16IfLE( e->x() ); 645 // HACK: Scaling
646 CARD16 y = Swap16IfLE( e->y() ); 646 CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor );
647 CARD16 y = Swap16IfLE( e->y() *con->options()->scaleFactor );
647 648
648 con->write( &PointerEventId, 1 ); 649 con->write( &PointerEventId, 1 );
649 con->write( &buttonMask, 1 ); 650 con->write( &buttonMask, 1 );
650 con->write( &x, 2 ); 651 con->write( &x, 2 );
651 con->write( &y, 2 ); 652 con->write( &y, 2 );
652} 653}
653 654
654 655
655void KRFBDecoder::sendCutEvent( const QString &unicode ) 656void KRFBDecoder::sendCutEvent( const QString &unicode )
656{ 657{
657 // 658 //
658 // Warning: There is a bug in the RFB protocol because there is no way to find 659 // Warning: There is a bug in the RFB protocol because there is no way to find
659 // out the codepage in use on the remote machine. This could be fixed by requiring 660 // out the codepage in use on the remote machine. This could be fixed by requiring
660 // the remote server to use utf8 etc. but for now we have to assume they're the 661 // the remote server to use utf8 etc. but for now we have to assume they're the
661 // same. I've reported this problem to the ORL guys, but they apparantly have no 662 // same. I've reported this problem to the ORL guys, but they apparantly have no
662 // immediate plans to fix the issue. :-( (rich) 663 // immediate plans to fix the issue. :-( (rich)
663 // 664 //
664 665
665 CARD8 padding[3]; 666 CARD8 padding[3];
666 QCString text = unicode.local8Bit(); 667 QCString text = unicode.local8Bit();
667 CARD32 length = text.length(); 668 CARD32 length = text.length();
668 length = Swap32IfLE( length ); 669 length = Swap32IfLE( length );
669 670
670 con->write( &ClientCutTextId, 1 ); 671 con->write( &ClientCutTextId, 1 );
671 con->write( &padding, 3 ); 672 con->write( &padding, 3 );
672 con->write( &length, 4 ); 673 con->write( &length, 4 );
673 con->write( text.data(), length ); 674 con->write( text.data(), length );
674} 675}
675 676
676void KRFBDecoder::gotServerCut() 677void KRFBDecoder::gotServerCut()
677{ 678{
678 qWarning( "Got server cut" ); 679 qWarning( "Got server cut" );
679 680
680 currentState = AwaitingServerCutLength; 681 currentState = AwaitingServerCutLength;
681 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); 682 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) );
682 con->waitForData( ServerCutLenLength ); 683 con->waitForData( ServerCutLenLength );
683} 684}
684 685
685void KRFBDecoder::gotServerCutLength() 686void KRFBDecoder::gotServerCutLength()
686{ 687{
687 assert( currentState = AwaitingServerCutLength ); 688 assert( currentState = AwaitingServerCutLength );
688 disconnect( con, SIGNAL( gotEnoughData() ), 689 disconnect( con, SIGNAL( gotEnoughData() ),
689 this, SLOT( gotServerCutLength() ) ); 690 this, SLOT( gotServerCutLength() ) );
690 691
691 CARD8 padding[3]; 692 CARD8 padding[3];
692 con->read( padding, 3 ); 693 con->read( padding, 3 );
693 694
694 con->read( &serverCutTextLen, 4 ); 695 con->read( &serverCutTextLen, 4 );
695 serverCutTextLen = Swap32IfLE( serverCutTextLen ); 696 serverCutTextLen = Swap32IfLE( serverCutTextLen );
696 697
697 currentState = AwaitingServerCutText; 698 currentState = AwaitingServerCutText;
698 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) ); 699 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) );
699 con->waitForData( serverCutTextLen ); 700 con->waitForData( serverCutTextLen );
700} 701}
701 702
702void KRFBDecoder::gotServerCutText() 703void KRFBDecoder::gotServerCutText()
703{ 704{
704 assert( currentState = AwaitingServerCutText ); 705 assert( currentState = AwaitingServerCutText );
705 706
706 disconnect( con, SIGNAL( gotEnoughData() ), 707 disconnect( con, SIGNAL( gotEnoughData() ),
707 this, SLOT( gotServerCutText() ) ); 708 this, SLOT( gotServerCutText() ) );
708 709
709 // 710 //
710 // Warning: There is a bug in the RFB protocol because there is no way to find 711 // Warning: There is a bug in the RFB protocol because there is no way to find
711 // out the codepage in use on the remote machine. This could be fixed by requiring 712 // out the codepage in use on the remote machine. This could be fixed by requiring
712 // the remote server to use utf8 etc. but for now we have to assume they're the 713 // the remote server to use utf8 etc. but for now we have to assume they're the
713 // same. I've reported this problem to the ORL guys, but they apparantly have no 714 // same. I've reported this problem to the ORL guys, but they apparantly have no
714 // immediate plans to fix the issue. :-( (rich) 715 // immediate plans to fix the issue. :-( (rich)
715 // 716 //
716 717
717 char *cutbuf = new char[ serverCutTextLen + 1 ]; 718 char *cutbuf = new char[ serverCutTextLen + 1 ];
718 CHECK_PTR( cutbuf ); 719 CHECK_PTR( cutbuf );
719 720
720 con->read( cutbuf, serverCutTextLen ); 721 con->read( cutbuf, serverCutTextLen );
721 cutbuf[ serverCutTextLen ] = '\0'; 722 cutbuf[ serverCutTextLen ] = '\0';
722 723
723 qWarning( "Server cut: %s", cutbuf ); 724 qWarning( "Server cut: %s", cutbuf );
724 725
725 QString cutText( cutbuf ); // DANGER!! 726 QString cutText( cutbuf ); // DANGER!!
726 qApp->clipboard()->setText( cutText ); 727 qApp->clipboard()->setText( cutText );
727 728
728 delete cutbuf; 729 delete cutbuf;
729 730
730 // Now wait for the update (again) 731 // Now wait for the update (again)
731 if ( oldState == AwaitingUpdate ) { 732 if ( oldState == AwaitingUpdate ) {
732 currentState = AwaitingUpdate; 733 currentState = AwaitingUpdate;
733 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 734 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
734 con->waitForData( UpdateHeaderLength ); 735 con->waitForData( UpdateHeaderLength );
735 } 736 }
736 else if ( oldState == Idle ) { 737 else if ( oldState == Idle ) {
737 currentState = Idle; 738 currentState = Idle;
738 } 739 }
739 else { 740 else {
740 qWarning( "Async handled in weird state" ); 741 qWarning( "Async handled in weird state" );
741 currentState = oldState; 742 currentState = oldState;
742 }; 743 };
743} 744}
744 745
745void KRFBDecoder::gotBell() 746void KRFBDecoder::gotBell()
746{ 747{
747 qWarning( "Got server bell" ); 748 qWarning( "Got server bell" );
748 buf->soundBell(); 749 buf->soundBell();
749 750
750 // Now wait for the update (again) 751 // Now wait for the update (again)
751 if ( oldState == AwaitingUpdate ) { 752 if ( oldState == AwaitingUpdate ) {
752 currentState = AwaitingUpdate; 753 currentState = AwaitingUpdate;
753 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 754 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
754 con->waitForData( UpdateHeaderLength ); 755 con->waitForData( UpdateHeaderLength );
755 } 756 }
756 else if ( oldState == Idle ) { 757 else if ( oldState == Idle ) {
757 currentState = Idle; 758 currentState = Idle;
758 } 759 }
759 else { 760 else {
760 qWarning( "Async handled in weird state" ); 761 qWarning( "Async handled in weird state" );
761 currentState = oldState; 762 currentState = oldState;
762 }; 763 };
763} 764}
764 765
765void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) 766void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event )
766{ 767{
767 int key; 768 int key;
768 key = toKeySym( event ); 769 key = toKeySym( event );
769 if ( key ) { 770 if ( key ) {
770 key = Swap32IfLE( key ); 771 key = Swap32IfLE( key );
771 772
772 CARD8 mask = true; 773 CARD8 mask = true;
773 774
774 CARD16 padding = 0; 775 CARD16 padding = 0;
775 con->write( &KeyEventId, 1 ); 776 con->write( &KeyEventId, 1 );
776 con->write( &mask, 1 ); 777 con->write( &mask, 1 );
777 con->write( &padding, 2 ); 778 con->write( &padding, 2 );
778 con->write( &key, 4 ); 779 con->write( &key, 4 );
779 } 780 }
780} 781}
781 782
782void KRFBDecoder::sendKeyReleaseEvent( QKeyEvent *event ) 783void KRFBDecoder::sendKeyReleaseEvent( QKeyEvent *event )
783{ 784{
784 int key; 785 int key;
785 key = toKeySym( event ); 786 key = toKeySym( event );
786 if ( key ) { 787 if ( key ) {
787 key = Swap32IfLE( key ); 788 key = Swap32IfLE( key );
788 789
789 CARD8 mask = false; 790 CARD8 mask = false;
790 791
791 CARD16 padding = 0; 792 CARD16 padding = 0;
792 con->write( &KeyEventId, 1 ); 793 con->write( &KeyEventId, 1 );
793 con->write( &mask, 1 ); 794 con->write( &mask, 1 );
794 con->write( &padding, 2 ); 795 con->write( &padding, 2 );
795 con->write( &key, 4 ); 796 con->write( &key, 4 );
796 } 797 }
797} 798}
798 799
799 800
800int KRFBDecoder::toKeySym( QKeyEvent *k ) 801int KRFBDecoder::toKeySym( QKeyEvent *k )
801{ 802{
802 int ke = 0; 803 int ke = 0;
803 804
804 ke = k->ascii(); 805 ke = k->ascii();
805 // Markus: Crappy hack. I dont know why lower case letters are 806 // Markus: Crappy hack. I dont know why lower case letters are
806 // not defined in qkeydefs.h. The key() for e.g. 'l' == 'L'. 807 // not defined in qkeydefs.h. The key() for e.g. 'l' == 'L'.
807 // This sucks. :-( 808 // This sucks. :-(
808 809
809 if ( (ke == 'a') || (ke == 'b') || (ke == 'c') || (ke == 'd') 810 if ( (ke == 'a') || (ke == 'b') || (ke == 'c') || (ke == 'd')
810 || (ke == 'e') || (ke == 'f') || (ke == 'g') || (ke == 'h') 811 || (ke == 'e') || (ke == 'f') || (ke == 'g') || (ke == 'h')
811 || (ke == 'i') || (ke == 'j') || (ke == 'k') || (ke == 'l') 812 || (ke == 'i') || (ke == 'j') || (ke == 'k') || (ke == 'l')
812 || (ke == 'm') || (ke == 'n') || (ke == 'o') || (ke == 'p') 813 || (ke == 'm') || (ke == 'n') || (ke == 'o') || (ke == 'p')
813 || (ke == 'q') || (ke == 'r') || (ke == 's') || (ke == 't') 814 || (ke == 'q') || (ke == 'r') || (ke == 's') || (ke == 't')
814 || (ke == 'u') || (ke == 'v') ||( ke == 'w') || (ke == 'x') 815 || (ke == 'u') || (ke == 'v') ||( ke == 'w') || (ke == 'x')
815 || (ke == 'y') || (ke == 'z') ) { 816 || (ke == 'y') || (ke == 'z') ) {
816 ke = k->key(); 817 ke = k->key();
817 ke = ke + 0x20; 818 ke = ke + 0x20;
818 return ke; 819 return ke;
819 } 820 }
820 821
821 // qkeydefs = xkeydefs! :-) 822 // qkeydefs = xkeydefs! :-)
822 if ( ( k->key() >= 0x0a0 ) && k->key() <= 0x0ff ) 823 if ( ( k->key() >= 0x0a0 ) && k->key() <= 0x0ff )
823 return k->key(); 824 return k->key();
824 825
825 if ( ( k->key() >= 0x20 ) && ( k->key() <= 0x7e ) ) 826 if ( ( k->key() >= 0x20 ) && ( k->key() <= 0x7e ) )
826 return k->key(); 827 return k->key();
827 828
828 // qkeydefs != xkeydefs! :-( 829 // qkeydefs != xkeydefs! :-(
829 // This is gonna suck :-( 830 // This is gonna suck :-(
830 831
831 int i = 0; 832 int i = 0;
832 while ( keyMap[i].keycode ) { 833 while ( keyMap[i].keycode ) {
833 if ( k->key() == keyMap[i].keycode ) 834 if ( k->key() == keyMap[i].keycode )
834 return keyMap[i].keysym; 835 return keyMap[i].keysym;
835 i++; 836 i++;
836 } 837 }
837 838
838 return 0; 839 return 0;
839} 840}
840 841
diff --git a/noncore/comm/keypebble/krfbdecoder.h b/noncore/comm/keypebble/krfbdecoder.h
index 4ba0185..db6271d 100644
--- a/noncore/comm/keypebble/krfbdecoder.h
+++ b/noncore/comm/keypebble/krfbdecoder.h
@@ -1,134 +1,135 @@
1// -*- c++ -*- 1// -*- c++ -*-
2 2
3#ifndef KRFBDECODER_H 3#ifndef KRFBDECODER_H
4#define KRFBDECODER_H 4#define KRFBDECODER_H
5 5
6#include <qobject.h> 6#include <qobject.h>
7 7
8class KRFBConnection; 8class KRFBConnection;
9class KRFBServerInfo; 9class KRFBServerInfo;
10class KRFBPixelFormat; 10class KRFBPixelFormat;
11class KRFBBuffer; 11class KRFBBuffer;
12 12
13 13
14typedef unsigned char CARD8; 14typedef unsigned char CARD8;
15typedef unsigned short CARD16; 15typedef unsigned short CARD16;
16typedef unsigned long CARD32; 16typedef unsigned long CARD32;
17 17
18/** 18/**
19 * Negotiates the pixel format to be used then decodes the resulting 19 * Negotiates the pixel format to be used then decodes the resulting
20 * data stream. 20 * data stream.
21 * 21 *
22 * @author Richard Moore, rich@kde.org 22 * @author Richard Moore, rich@kde.org
23 */ 23 */
24class KRFBDecoder : public QObject 24class KRFBDecoder : public QObject
25{ 25{
26 Q_OBJECT 26 Q_OBJECT
27 27
28public: 28public:
29 friend class KRFBBuffer; 29 friend class KRFBBuffer;
30 30
31 enum State { 31 enum State {
32 AwaitingServerInit, 32 AwaitingServerInit,
33 AwaitingDesktopName, 33 AwaitingDesktopName,
34 AwaitingUpdate, 34 AwaitingUpdate,
35 AwaitingRectHeader, 35 AwaitingRectHeader,
36 AwaitingRawRectChunk, 36 AwaitingRawRectChunk,
37 AwaitingCopyRectPos, 37 AwaitingCopyRectPos,
38 AwaitingServerCutLength, 38 AwaitingServerCutLength,
39 AwaitingServerCutText, 39 AwaitingServerCutText,
40 Idle, 40 Idle,
41 Error 41 Error
42 }; 42 };
43 43
44 /** 44 /**
45 * Create a KRFBDecoder that reads data from a logged in KRFBConnection 45 * Create a KRFBDecoder that reads data from a logged in KRFBConnection
46 * and sends its output to a KRFBBuffer. 46 * and sends its output to a KRFBBuffer.
47 */ 47 */
48 KRFBDecoder( KRFBConnection *con ); 48 KRFBDecoder( KRFBConnection *con );
49 ~KRFBDecoder(); 49 ~KRFBDecoder();
50 50
51 void setBuffer( KRFBBuffer *buf ) { this->buf = buf; }; 51 void setBuffer( KRFBBuffer *buf ) { this->buf = buf; };
52 void start(); 52 void start();
53 53
54 int toKeySym( QKeyEvent *k ); 54 int toKeySym( QKeyEvent *k );
55 55
56 // 56 //
57 // Client -> Server messages 57 // Client -> Server messages
58 // 58 //
59 void sendUpdateRequest( bool incremental ); 59 void sendUpdateRequest( bool incremental );
60 void sendMouseEvent( QMouseEvent *e ); 60 void sendMouseEvent( QMouseEvent *e );
61 void sendKeyPressEvent( QKeyEvent *e ); 61 void sendKeyPressEvent( QKeyEvent *e );
62 void sendKeyReleaseEvent( QKeyEvent *e ); 62 void sendKeyReleaseEvent( QKeyEvent *e );
63 void sendCutEvent( const QString &text ); 63 void sendCutEvent( const QString &text );
64 64
65protected: 65protected:
66 // 66 //
67 // Initial format negotiation 67 // Initial format negotiation
68 // 68 //
69 void decidePixelFormat(); 69 void decidePixelFormat();
70 void sendPixelFormat(); 70 void sendPixelFormat();
71 void sendClientInit(); 71 void sendClientInit();
72 void sendAllowedEncodings(); 72 void sendAllowedEncodings();
73 73
74 // 74 //
75 // Rectange processing 75 // Rectange processing
76 // 76 //
77 void handleRawRect(); 77 void handleRawRect();
78 void handleCopyRect(); 78 void handleCopyRect();
79 void handleRRERect(); 79 void handleRRERect();
80 void handleCoRRERect(); 80 void handleCoRRERect();
81 void handleHexTileRect(); 81 void handleHexTileRect();
82 82
83 void getRawRectChunk( int lines ); 83 void getRawRectChunk( int lines );
84 84
85protected slots: 85protected slots:
86 void gotServerInit(); 86 void gotServerInit();
87 void gotDesktopName(); 87 void gotDesktopName();
88 void gotUpdateHeader(); 88 void gotUpdateHeader();
89 void gotRectHeader(); 89 void gotRectHeader();
90 void gotRawRectChunk(); 90 void gotRawRectChunk();
91 void gotCopyRectPos(); 91 void gotCopyRectPos();
92 void gotServerCut(); 92 void gotServerCut();
93 void gotServerCutLength(); 93 void gotServerCutLength();
94 void gotServerCutText(); 94 void gotServerCutText();
95 void gotBell(); 95 void gotBell();
96 96
97signals: 97signals:
98 void error( const QString & ); 98 void error( const QString & );
99 void status( const QString & ); 99 void status( const QString & );
100 100
101protected:
102 /** The connection to the server. */
103 KRFBConnection *con;
101private: 104private:
102 State currentState; 105 State currentState;
103 106
104 // Used to store the state we were in before a cut or bell msg 107 // Used to store the state we were in before a cut or bell msg
105 State oldState; 108 State oldState;
106 109
107 // The number of rects we're expecting 110 // The number of rects we're expecting
108 CARD16 noRects; 111 CARD16 noRects;
109 112
110 // 113 //
111 // Info about the current rect. 114 // Info about the current rect.
112 // 115 //
113 CARD16 x, y, w, h; 116 CARD16 x, y, w, h;
114 int lines; 117 int lines;
115 CARD32 encoding; 118 CARD32 encoding;
116 119
117 CARD32 serverCutTextLen; 120 CARD32 serverCutTextLen;
118 121
119 /** Where we draw the data (and the source of our events). */ 122 /** Where we draw the data (and the source of our events). */
120 KRFBBuffer *buf; 123 KRFBBuffer *buf;
121 /** The connection to the server. */
122 KRFBConnection *con;
123 124
124 /** Info about the RFB server. */ 125 /** Info about the RFB server. */
125 KRFBServerInfo *info; 126 KRFBServerInfo *info;
126 /** The pixel format we want. */ 127 /** The pixel format we want. */
127 KRFBPixelFormat *format; 128 KRFBPixelFormat *format;
128 129
129 CARD8 buttonMask; 130 CARD8 buttonMask;
130}; 131};
131 132
132#endif // KRFBDECODER_H 133#endif // KRFBDECODER_H
133 134
134 135
diff --git a/noncore/comm/keypebble/krfbserver.cpp b/noncore/comm/keypebble/krfbserver.cpp
index 5775f09..b47534e 100644
--- a/noncore/comm/keypebble/krfbserver.cpp
+++ b/noncore/comm/keypebble/krfbserver.cpp
@@ -1,39 +1,41 @@
1#include <qpe/config.h> 1#include <qpe/config.h>
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include "krfbserver.h" 3#include "krfbserver.h"
4 4
5KRFBServer::KRFBServer() 5KRFBServer::KRFBServer()
6{ 6{
7 QString name; 7 QString name;
8 QString hostname; 8 QString hostname;
9 QString password; 9 QString password;
10 display=0; 10 display=0;
11 11
12 scaleFactor=1;
13
12 hexTile=0; 14 hexTile=0;
13 corre=0; 15 corre=0;
14 rre=0; 16 rre=0;
15 copyrect=1; 17 copyrect=1;
16 18
17 colors256=1; 19 colors256=1;
18 shared=0; 20 shared=0;
19 readOnly=0; 21 readOnly=0;
20 deIconify=0; 22 deIconify=0;
21 23
22 updateRate=0; 24 updateRate=0;
23} 25}
24KRFBServer::~KRFBServer() 26KRFBServer::~KRFBServer()
25{ 27{
26} 28}
27 29
28int KRFBServer::encodings() 30int KRFBServer::encodings()
29{ 31{
30 // Initially one because we always support raw encoding 32 // Initially one because we always support raw encoding
31 int count = 1; 33 int count = 1;
32 34
33 count += hexTile ? 1 : 0; 35 count += hexTile ? 1 : 0;
34 count += corre ? 1 : 0; 36 count += corre ? 1 : 0;
35 count += rre ? 1 : 0; 37 count += rre ? 1 : 0;
36 count += copyrect ? 1 : 0; 38 count += copyrect ? 1 : 0;
37 39
38 return count; 40 return count;
39} 41}
diff --git a/noncore/comm/keypebble/krfbserver.h b/noncore/comm/keypebble/krfbserver.h
index f87eecc..e38e2d2 100644
--- a/noncore/comm/keypebble/krfbserver.h
+++ b/noncore/comm/keypebble/krfbserver.h
@@ -1,34 +1,35 @@
1// -*- c++ -*- 1// -*- c++ -*-
2 2
3#ifndef KRFBOPTIONS_H 3#ifndef KRFBOPTIONS_H
4#define KRFBOPTIONS_H 4#define KRFBOPTIONS_H
5 5
6class Config; 6class Config;
7 7
8class KRFBServer 8class KRFBServer
9{ 9{
10public: 10public:
11 KRFBServer(); 11 KRFBServer();
12 ~KRFBServer(); 12 ~KRFBServer();
13 13
14 int encodings(); 14 int encodings();
15 15
16 QString name; 16 QString name;
17 QString hostname; 17 QString hostname;
18 QString password; 18 QString password;
19 int display; 19 int display;
20 20
21 bool hexTile; 21 bool hexTile;
22 bool corre; 22 bool corre;
23 bool rre; 23 bool rre;
24 bool copyrect; 24 bool copyrect;
25 25
26 bool colors256; 26 bool colors256;
27 bool shared; 27 bool shared;
28 bool readOnly; 28 bool readOnly;
29 bool deIconify; 29 bool deIconify;
30 30
31 int updateRate; 31 int updateRate;
32 int scaleFactor;
32}; 33};
33 34
34#endif // KRFBOPTIONS_H 35#endif // KRFBOPTIONS_H
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index aa46e2f..b173004 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -1,272 +1,278 @@
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> 13#include <qspinbox.h>
14#include <qlistbox.h> 14#include <qlistbox.h>
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17#include <qpe/global.h> 17#include <qpe/global.h>
18#include <qpe/qpetoolbar.h> 18#include <qpe/qpetoolbar.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20 20
21#include <assert.h> 21#include <assert.h>
22 22
23#include "kvnc.h" 23#include "kvnc.h"
24#include "krfbcanvas.h" 24#include "krfbcanvas.h"
25#include "krfbconnection.h" 25#include "krfbconnection.h"
26#include "kvncconndlg.h" 26#include "kvncconndlg.h"
27#include "krfbserver.h" 27#include "krfbserver.h"
28 28
29static int u_id = 1; 29static int u_id = 1;
30static int get_unique_id() 30static int get_unique_id()
31{ 31{
32 return u_id++; 32 return u_id++;
33} 33}
34 34
35 35
36/* XPM */ 36/* XPM */
37static char * menu_xpm[] = { 37static char * menu_xpm[] = {
38"12 12 5 1", 38"12 12 5 1",
39 " c None", 39 " c None",
40 ".c #000000", 40 ".c #000000",
41 "+c #FFFDAD", 41 "+c #FFFDAD",
42 "@c #FFFF00", 42 "@c #FFFF00",
43 "#c #E5E100", 43 "#c #E5E100",
44" ", 44" ",
45" ", 45" ",
46" ......... ", 46" ......... ",
47" .+++++++. ", 47" .+++++++. ",
48" .+@@@@#. ", 48" .+@@@@#. ",
49" .+@@@#. ", 49" .+@@@#. ",
50" .+@@#. ", 50" .+@@#. ",
51" .+@#. ", 51" .+@#. ",
52" .+#. ", 52" .+#. ",
53" .+. ", 53" .+. ",
54" .. ", 54" .. ",
55" "}; 55" "};
56 56
57const int StatusTextId = 0; 57const int StatusTextId = 0;
58 58
59KVNC::KVNC( const char *name ) : QMainWindow( 0, name ) 59KVNC::KVNC( const char *name ) : QMainWindow( 0, name )
60{ 60{
61 setCaption( tr("VNC Viewer") ); 61 setCaption( tr("VNC Viewer") );
62 fullscreen = false; 62 fullscreen = false;
63 63
64 stack = new QWidgetStack( this ); 64 stack = new QWidgetStack( this );
65 setCentralWidget( stack ); 65 setCentralWidget( stack );
66 66
67 bookmarkSelector=new KVNCBookmarkDlg(); 67 bookmarkSelector=new KVNCBookmarkDlg();
68 stack->addWidget(bookmarkSelector,get_unique_id()); 68 stack->addWidget(bookmarkSelector,get_unique_id());
69 stack->raiseWidget( bookmarkSelector ); 69 stack->raiseWidget( bookmarkSelector );
70 70
71 canvas = new KRFBCanvas( stack, "canvas" ); 71 canvas = new KRFBCanvas( stack, "canvas" );
72 stack->addWidget(canvas,get_unique_id()); 72 stack->addWidget(canvas,get_unique_id());
73 setCentralWidget( stack ); 73 setCentralWidget( stack );
74 74
75
75 connect( bookmarkSelector->bookmarkList, SIGNAL(doubleClicked(QListBoxItem *)), 76 connect( bookmarkSelector->bookmarkList, SIGNAL(doubleClicked(QListBoxItem *)),
76 this, SLOT(openConnection(QListBoxItem *)) ); 77 this, SLOT(openConnection(QListBoxItem *)) );
77 connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), 78 connect( canvas->connection(), SIGNAL(statusChanged(const QString &)),
78 this, SLOT(statusMessage(const QString &)) ); 79 this, SLOT(statusMessage(const QString &)) );
79 connect( canvas->connection(), SIGNAL(error(const QString &)), 80 connect( canvas->connection(), SIGNAL(error(const QString &)),
80 this, SLOT(error(const QString &)) ); 81 this, SLOT(error(const QString &)) );
81 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); 82 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) );
82 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); 83 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) );
83 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); 84 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) );
84 85
85 setupActions(); 86 setupActions();
86 87
87 cornerButton = new QPushButton( this ); 88 cornerButton = new QPushButton( this );
88 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 89 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
89 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); 90 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) );
90 canvas->setCornerWidget( cornerButton ); 91 canvas->setCornerWidget( cornerButton );
91 92
92 stack->raiseWidget( bookmarkSelector ); 93 stack->raiseWidget( bookmarkSelector );
93 94
94 95
95 QPEToolBar *bar = new QPEToolBar( this ); 96 bar= new QToolBar( this );
97 setToolBarsMovable( false );
98 setRightJustification(false);
99
96 100
97 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), 101 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ),
98 QString::null, 0, this, 0 ); 102 QString::null, 0, this, 0 );
99 connect( n, SIGNAL( activated() ), 103 connect( n, SIGNAL( activated() ),
100 this, SLOT( newConnection() ) ); 104 this, SLOT( newConnection() ) );
101 n->addTo( bar ); 105 n->addTo( bar );
102 106
103 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "edit" ), 107 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "edit" ),
104 QString::null, 0, this, 0 ); 108 QString::null, 0, this, 0 );
105 connect( o, SIGNAL( activated() ), 109 connect( o, SIGNAL( activated() ),
106 this, SLOT( openConnection() ) ); 110 this, SLOT( openConnection() ) );
107 o->addTo( bar ); 111 o->addTo( bar );
108 112
109 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), 113 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ),
110 QString::null, 0, this, 0 ); 114 QString::null, 0, this, 0 );
111 connect( d, SIGNAL( activated() ), 115 connect( d, SIGNAL( activated() ),
112 this, SLOT( deleteBookmark() ) ); 116 this, SLOT( deleteBookmark() ) );
113 d->addTo( bar ); 117 d->addTo( bar );
114} 118}
115 119
116KVNC::~KVNC() 120KVNC::~KVNC()
117{ 121{
118 122
119} 123}
120 124
121void KVNC::newConnection() 125void KVNC::newConnection()
122{ 126{
123 curServer=new KRFBServer; 127 curServer=new KRFBServer;
124 128
125 KVNCConnDlg dlg( curServer,this); 129 KVNCConnDlg dlg( curServer,this);
126 dlg.showMaximized(); 130 dlg.showMaximized();
127 if (dlg.exec()) { 131 if (dlg.exec()) {
128 if (!curServer->name.isEmpty()) 132 if (!curServer->name.isEmpty())
129 bookmarkSelector->addBookmark(curServer); 133 bookmarkSelector->addBookmark(curServer);
130 canvas->openConnection(*curServer); 134 canvas->openConnection(*curServer);
131 } else 135 } else
132 curServer=0; 136 curServer=0;
133} 137}
134 138
135void KVNC::openConnection( QString name) 139void KVNC::openConnection( QString name)
136{ 140{
137 curServer=bookmarkSelector->getServer(name); 141 curServer=bookmarkSelector->getServer(name);
138 142
139 if (curServer) { 143 if (curServer) {
140 KVNCConnDlg dlg( curServer,this); 144 KVNCConnDlg dlg( curServer,this);
141 dlg.showMaximized(); 145 dlg.showMaximized();
142 146
143 if ( dlg.exec() ) { 147 if ( dlg.exec() ) {
144 canvas->openConnection(*curServer); 148 canvas->openConnection(*curServer);
145 bookmarkSelector->writeBookmarks(); 149 bookmarkSelector->writeBookmarks();
146 } else 150 } else
147 curServer=0; 151 curServer=0;
148 } 152 }
149} 153}
150 154
151void KVNC::openConnection( void ) 155void KVNC::openConnection( void )
152{ 156{
153 openConnection( bookmarkSelector->selectedBookmark()); 157 openConnection( bookmarkSelector->selectedBookmark());
154} 158}
155 159
156void KVNC::openConnection( QListBoxItem * item) 160void KVNC::openConnection( QListBoxItem * item)
157{ 161{
158 openConnection(item->text()); 162 openConnection(item->text());
159} 163}
160 164
161void KVNC::setupActions() 165void KVNC::setupActions()
162{ 166{
163 cornerMenu = new QPopupMenu( this ); 167 cornerMenu = new QPopupMenu( this );
164 168
165 fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); 169 fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 );
166 connect( fullScreenAction, SIGNAL(activated()), 170 connect( fullScreenAction, SIGNAL(activated()),
167 this, SLOT( toggleFullScreen() ) ); 171 this, SLOT( toggleFullScreen() ) );
168 fullScreenAction->addTo( cornerMenu ); 172 fullScreenAction->addTo( cornerMenu );
169 fullScreenAction->setEnabled( false ); 173 fullScreenAction->setEnabled( false );
170 174
171 ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); 175 ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 );
172 connect( ctlAltDelAction, SIGNAL(activated()), 176 connect( ctlAltDelAction, SIGNAL(activated()),
173 canvas, SLOT( sendCtlAltDel() ) ); 177 canvas, SLOT( sendCtlAltDel() ) );
174 ctlAltDelAction->addTo( cornerMenu ); 178 ctlAltDelAction->addTo( cornerMenu );
175 ctlAltDelAction->setEnabled( false ); 179 ctlAltDelAction->setEnabled( false );
176 180
177 disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); 181 disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 );
178 connect( disconnectAction, SIGNAL(activated()), 182 connect( disconnectAction, SIGNAL(activated()),
179 this, SLOT( closeConnection() ) ); 183 this, SLOT( closeConnection() ) );
180 disconnectAction->addTo( cornerMenu ); 184 disconnectAction->addTo( cornerMenu );
181 disconnectAction->setEnabled( false ); 185 disconnectAction->setEnabled( false );
182} 186}
183 187
184void KVNC::toggleFullScreen() 188void KVNC::toggleFullScreen()
185{ 189{
186 if ( fullscreen ) { 190 if ( fullscreen ) {
187 canvas->releaseKeyboard(); 191 canvas->releaseKeyboard();
188 canvas->reparent( stack, 0, QPoint(0,0), false ); 192 canvas->reparent( stack, 0, QPoint(0,0), false );
189 canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 193 canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken );
190 setCentralWidget( stack ); 194 setCentralWidget( stack );
191 stack->addWidget(canvas,get_unique_id()); 195 stack->addWidget(canvas,get_unique_id());
192 stack->raiseWidget(canvas); 196 stack->raiseWidget(canvas);
193 canvas->show(); 197 canvas->show();
194 stack->show(); 198 stack->show();
195 fullScreenAction->setText( tr("Full Screen") ); 199 fullScreenAction->setText( tr("Full Screen") );
196 } else { 200 } else {
197 canvas->setFrameStyle( QFrame::NoFrame ); 201 canvas->setFrameStyle( QFrame::NoFrame );
198 stack->removeWidget(canvas); 202 stack->removeWidget(canvas);
199 canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, 203 canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop,
200 QPoint(0,0),false); 204 QPoint(0,0),false);
201 canvas->resize(qApp->desktop()->width(), qApp->desktop()->height()); 205 canvas->resize(qApp->desktop()->width(), qApp->desktop()->height());
202 canvas->raise(); 206 canvas->raise();
203 canvas->setFocus(); 207 canvas->setFocus();
204 canvas->grabKeyboard(); 208 canvas->grabKeyboard();
205 canvas->show(); 209 canvas->show();
206 210
207 fullScreenAction->setText( tr("Stop Full Screen") ); 211 fullScreenAction->setText( tr("Stop Full Screen") );
208 } 212 }
209 213
210 214
211 fullscreen = !fullscreen; 215 fullscreen = !fullscreen;
212} 216}
213 217
214void KVNC::closeConnection() 218void KVNC::closeConnection()
215{ 219{
216 if ( fullscreen ) 220 if ( fullscreen )
217 toggleFullScreen(); 221 toggleFullScreen();
218 canvas->closeConnection(); 222 canvas->closeConnection();
219} 223}
220 224
221void KVNC::showMenu() 225void KVNC::showMenu()
222{ 226{
223 QPoint pt = mapToGlobal(cornerButton->pos()); 227 QPoint pt = mapToGlobal(cornerButton->pos());
224 QSize s = cornerMenu->sizeHint(); 228 QSize s = cornerMenu->sizeHint();
225 pt.ry() -= s.height(); 229 pt.ry() -= s.height();
226 pt.rx() -= s.width(); 230 pt.rx() -= s.width();
227 cornerMenu->popup( pt ); 231 cornerMenu->popup( pt );
228} 232}
229 233
230void KVNC::connected() 234void KVNC::connected()
231{ 235{
232 static QString msg = tr( "Connected to remote host" ); 236 static QString msg = tr( "Connected to remote host" );
233 statusMessage( msg ); 237 statusMessage( msg );
234 ctlAltDelAction->setEnabled(true); 238 ctlAltDelAction->setEnabled(true);
235 disconnectAction->setEnabled( true ); 239 disconnectAction->setEnabled( true );
236 fullScreenAction->setEnabled( true ); 240 fullScreenAction->setEnabled( true );
237 stack->raiseWidget(canvas); 241 stack->raiseWidget(canvas);
242 bar->hide();
238} 243}
239 244
240void KVNC::loggedIn() 245void KVNC::loggedIn()
241{ 246{
242 static QString msg = tr( "Logged in to remote host" ); 247 static QString msg = tr( "Logged in to remote host" );
243 statusMessage( msg ); 248 statusMessage( msg );
244} 249}
245 250
246void KVNC::disconnected() 251void KVNC::disconnected()
247{ 252{
248 253
249 if ( fullscreen ) 254 if ( fullscreen )
250 toggleFullScreen(); 255 toggleFullScreen();
251 static QString msg = tr( "Connection closed" ); 256 static QString msg = tr( "Connection closed" );
252 statusMessage( msg ); 257 statusMessage( msg );
253 ctlAltDelAction->setEnabled(false); 258 ctlAltDelAction->setEnabled(false);
254 disconnectAction->setEnabled( false ); 259 disconnectAction->setEnabled( false );
255 fullScreenAction->setEnabled( false ); 260 fullScreenAction->setEnabled( false );
256 stack->raiseWidget(bookmarkSelector); 261 stack->raiseWidget(bookmarkSelector);
262 bar->show();
257} 263}
258 264
259void KVNC::statusMessage( const QString &m ) 265void KVNC::statusMessage( const QString &m )
260{ 266{
261 Global::statusMessage( m ); 267 Global::statusMessage( m );
262} 268}
263 269
264void KVNC::error( const QString &msg ) 270void KVNC::error( const QString &msg )
265{ 271{
266 statusMessage( msg ); 272 statusMessage( msg );
267 QMessageBox::warning( this, tr("VNC Viewer"), msg ); 273 QMessageBox::warning( this, tr("VNC Viewer"), msg );
268} 274}
269void KVNC::deleteBookmark(void) 275void KVNC::deleteBookmark(void)
270{ 276{
271 bookmarkSelector->deleteBookmark(bookmarkSelector->selectedBookmark()); 277 bookmarkSelector->deleteBookmark(bookmarkSelector->selectedBookmark());
272} 278}
diff --git a/noncore/comm/keypebble/kvnc.h b/noncore/comm/keypebble/kvnc.h
index 6e0a385..82a24fc 100644
--- a/noncore/comm/keypebble/kvnc.h
+++ b/noncore/comm/keypebble/kvnc.h
@@ -1,66 +1,67 @@
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 <qtoolbar.h>
8#include <qwidgetstack.h> 8#include <qwidgetstack.h>
9#include "kvncbookmarkdlg.h" 9#include "kvncbookmarkdlg.h"
10 10
11class QAction; 11class QAction;
12class KRFBCanvas; 12class KRFBCanvas;
13class QPushButton; 13class QPushButton;
14class QToolBar; 14class QToolBar;
15 15
16/** 16/**
17 * Top level window for Keystone. 17 * Top level window for Keystone.
18 * 18 *
19 * @author Richard Moore, rich@kde.org 19 * @author Richard Moore, rich@kde.org
20 * @version $Id$ 20 * @version $Id$
21 */ 21 */
22class KVNC : public QMainWindow 22class KVNC : public QMainWindow
23{ 23{
24 Q_OBJECT 24 Q_OBJECT
25public: 25public:
26 KVNC( const char *name = 0 ); 26 KVNC( const char *name = 0 );
27 ~KVNC(); 27 ~KVNC();
28 28
29public slots: 29public slots:
30 void newConnection(); 30 void newConnection();
31 void deleteBookmark(); 31 void deleteBookmark();
32 void openConnection(QListBoxItem *); 32 void openConnection(QListBoxItem *);
33 void openConnection(QString); 33 void openConnection(QString);
34 void openConnection(void); 34 void openConnection(void);
35 void toggleFullScreen(); 35 void toggleFullScreen();
36 void closeConnection(); 36 void closeConnection();
37 37
38protected: 38protected:
39 void setupActions(); 39 void setupActions();
40 40
41protected slots: 41protected slots:
42 void showMenu(); 42 void showMenu();
43 43
44 void connected(); 44 void connected();
45 void loggedIn(); 45 void loggedIn();
46 void disconnected(); 46 void disconnected();
47 void statusMessage( const QString & ); 47 void statusMessage( const QString & );
48 void error( const QString & ); 48 void error( const QString & );
49 49
50private: 50private:
51 bool fullscreen; 51 bool fullscreen;
52 KRFBCanvas *canvas; 52 KRFBCanvas *canvas;
53 QPopupMenu *cornerMenu; 53 QPopupMenu *cornerMenu;
54 QPushButton *cornerButton; 54 QPushButton *cornerButton;
55 QAction *fullScreenAction; 55 QAction *fullScreenAction;
56 QAction *optionsAction; 56 QAction *optionsAction;
57 QAction *disconnectAction; 57 QAction *disconnectAction;
58 QAction *ctlAltDelAction;; 58 QAction *ctlAltDelAction;;
59 QAction *connectAction; 59 QAction *connectAction;
60 QToolBar * bar;
60 61
61 KVNCBookmarkDlg * bookmarkSelector; 62 KVNCBookmarkDlg * bookmarkSelector;
62 QWidgetStack * stack; 63 QWidgetStack * stack;
63 KRFBServer * curServer; 64 KRFBServer * curServer;
64}; 65};
65 66
66#endif // KVNC_H 67#endif // KVNC_H
diff --git a/noncore/comm/keypebble/kvncbookmarkdlg.cpp b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
index 1f97d13..1e2f3c3 100644
--- a/noncore/comm/keypebble/kvncbookmarkdlg.cpp
+++ b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
@@ -1,220 +1,223 @@
1#include <qframe.h> 1#include <qframe.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qspinbox.h> 4#include <qspinbox.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qwhatsthis.h> 7#include <qwhatsthis.h>
8#include <qfile.h> 8#include <qfile.h>
9#include <qdir.h> 9#include <qdir.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qapplication.h> 11#include <qapplication.h>
12#include <qlineedit.h> 12#include <qlineedit.h>
13#include <qtextstream.h> 13#include <qtextstream.h>
14#include <qpushbutton.h> 14#include <qpushbutton.h>
15#include <qlistbox.h> 15#include <qlistbox.h>
16#include <qpe/config.h> 16#include <qpe/config.h>
17#include <qpe/global.h> 17#include <qpe/global.h>
18#include "krfbserver.h" 18#include "krfbserver.h"
19#include "kvncbookmarkdlg.h" 19#include "kvncbookmarkdlg.h"
20 20
21KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent=0, const char * name=0, WFlags f=0 ) 21KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent=0, const char * name=0, WFlags f=0 )
22 22
23: KVNCBookmarkDlgBase( parent, name,f) 23: KVNCBookmarkDlgBase( parent, name,f)
24{ 24{
25 readBookmarks(); 25 readBookmarks();
26 refresh(); 26 refresh();
27 27
28} 28}
29 29
30KVNCBookmarkDlg::~KVNCBookmarkDlg() 30KVNCBookmarkDlg::~KVNCBookmarkDlg()
31{ 31{
32} 32}
33 33
34void KVNCBookmarkDlg::addBookmark(KRFBServer * server) 34void KVNCBookmarkDlg::addBookmark(KRFBServer * server)
35{ 35{
36 if (server) { 36 if (server) {
37 servers.append(server); 37 servers.append(server);
38 bookmarkList->insertItem(server->name); 38 bookmarkList->insertItem(server->name);
39 writeBookmarks(); 39 writeBookmarks();
40 refresh(); 40 refresh();
41 } 41 }
42} 42}
43 43
44void KVNCBookmarkDlg::deleteBookmark(QString name) 44void KVNCBookmarkDlg::deleteBookmark(QString name)
45{ 45{
46 KRFBServer * server=0; 46 KRFBServer * server=0;
47 for ( server=servers.first(); server != 0; server=servers.next() ) { 47 for ( server=servers.first(); server != 0; server=servers.next() ) {
48 if (server->name==name) { 48 if (server->name==name) {
49 servers.remove(servers.at()); 49 servers.remove(servers.at());
50 writeBookmarks(); 50 writeBookmarks();
51 refresh(); 51 refresh();
52 return; 52 return;
53 } 53 }
54 } 54 }
55} 55}
56KRFBServer *KVNCBookmarkDlg::getServer(QString name) 56KRFBServer *KVNCBookmarkDlg::getServer(QString name)
57{ 57{
58 KRFBServer * server=0; 58 KRFBServer * server=0;
59 for ( server=servers.first(); server != 0; server=servers.next() ) { 59 for ( server=servers.first(); server != 0; server=servers.next() ) {
60 if (server->name==name) 60 if (server->name==name)
61 61
62 return server; 62 return server;
63 } 63 }
64 return 0; 64 return 0;
65} 65}
66 66
67 67
68/* 68/*
69 Note that the degree of protection offered by the encryption here is 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 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 71 files. People with access to the files can write down the contents and
72 decrypt it using this source code. 72 decrypt it using this source code.
73 73
74 Conceivably, and at some burden to the user, this encryption could 74 Conceivably, and at some burden to the user, this encryption could
75 be improved. 75 be improved.
76*/ 76*/
77QString KVNCBookmarkDlg::encipher(const QString& plain) 77QString KVNCBookmarkDlg::encipher(const QString& plain)
78{ 78{
79 // mainly, we make it long 79 // mainly, we make it long
80 QString cipher; 80 QString cipher;
81 int mix=28730492; 81 int mix=28730492;
82 for (int i=0; i<(int)plain.length(); i++) { 82 for (int i=0; i<(int)plain.length(); i++) {
83 int u = plain[i].unicode(); 83 int u = plain[i].unicode();
84 int c = u ^ mix; 84 int c = u ^ mix;
85 QString x = QString::number(c,36); 85 QString x = QString::number(c,36);
86 cipher.append(QChar('a'+x.length())); 86 cipher.append(QChar('a'+x.length()));
87 cipher.append(x); 87 cipher.append(x);
88 mix *= u; 88 mix *= u;
89 } 89 }
90 return cipher; 90 return cipher;
91} 91}
92 92
93QString KVNCBookmarkDlg::decipher(const QString& cipher) 93QString KVNCBookmarkDlg::decipher(const QString& cipher)
94{ 94{
95 QString plain; 95 QString plain;
96 int mix=28730492; 96 int mix=28730492;
97 for (int i=0; i<(int)cipher.length();) { 97 for (int i=0; i<(int)cipher.length();) {
98 int l = cipher[i].unicode()-'a'; 98 int l = cipher[i].unicode()-'a';
99 QString x = cipher.mid(i+1,l); i+=l+1; 99 QString x = cipher.mid(i+1,l); i+=l+1;
100 int u = x.toInt(0,36) ^ mix; 100 int u = x.toInt(0,36) ^ mix;
101 plain.append(QChar(u)); 101 plain.append(QChar(u));
102 mix *= u; 102 mix *= u;
103 } 103 }
104 return plain; 104 return plain;
105} 105}
106 106
107void KVNCBookmarkDlg::readBookmarks(void) 107void KVNCBookmarkDlg::readBookmarks(void)
108{ 108{
109 QFile f(QDir::homeDirPath() + QString("/Applications/keypebble/bookmarks")); 109 QFile f(QDir::homeDirPath() + QString("/Applications/keypebble/bookmarks"));
110 110
111 QStringList entry; 111 QStringList entry;
112 QString key, val; 112 QString key, val;
113 KRFBServer * server=0; 113 KRFBServer * server=0;
114 114
115 if ( f.open(IO_ReadOnly) ) { 115 if ( f.open(IO_ReadOnly) ) {
116 QTextStream t( &f ); 116 QTextStream t( &f );
117 QString s; 117 QString s;
118 int n = 1; 118 int n = 1;
119 while ( !t.eof() ) { 119 while ( !t.eof() ) {
120 s = t.readLine(); 120 s = t.readLine();
121 121
122 122
123 entry=QStringList::split('=',s); 123 entry=QStringList::split('=',s);
124 key=entry[0].stripWhiteSpace().lower(); 124 key=entry[0].stripWhiteSpace().lower();
125 val=entry[1].stripWhiteSpace(); 125 val=entry[1].stripWhiteSpace();
126 126
127 if (key=="server") { 127 if (key=="server") {
128 128
129 if (server){ 129 if (server){
130 servers.append(server); 130 servers.append(server);
131 server=0; 131 server=0;
132 } 132 }
133 server = new KRFBServer(); 133 server = new KRFBServer();
134 134
135 if (!server) 135 if (!server)
136 return; 136 return;
137 server->name=val; 137 server->name=val;
138 138
139 } 139 }
140 else if (key=="hostname") 140 else if (key=="hostname")
141 server->hostname=val; 141 server->hostname=val;
142 else if (key=="password") 142 else if (key=="password")
143 server->password=decipher(val); 143 server->password=decipher(val);
144 else if (key=="display") 144 else if (key=="display")
145 server->display=val.toInt(); 145 server->display=val.toInt();
146 else if (key=="hextile") 146 else if (key=="hextile")
147 server->hexTile=val.toInt(); 147 server->hexTile=val.toInt();
148 else if (key=="corre") 148 else if (key=="corre")
149 server->corre=val.toInt(); 149 server->corre=val.toInt();
150 else if (key=="rre") 150 else if (key=="rre")
151 server->rre=val.toInt(); 151 server->rre=val.toInt();
152 else if (key=="copyrect") 152 else if (key=="copyrect")
153 server->copyrect=val.toInt(); 153 server->copyrect=val.toInt();
154 else if (key=="colors256") 154 else if (key=="colors256")
155 server->colors256=val.toInt(); 155 server->colors256=val.toInt();
156 else if (key=="shared") 156 else if (key=="shared")
157 server->shared=val.toInt(); 157 server->shared=val.toInt();
158 else if (key=="readonly") 158 else if (key=="readonly")
159 server->readOnly=val.toInt(); 159 server->readOnly=val.toInt();
160 else if (key=="deiconify") 160 else if (key=="deiconify")
161 server->deIconify=val.toInt(); 161 server->deIconify=val.toInt();
162 else if (key=="updaterate") 162 else if (key=="updaterate")
163 server->updateRate=val.toInt(); 163 server->updateRate=val.toInt();
164 else if (key=="scalefactor")
165 server->scaleFactor=val.toInt();
164 166
165 } 167 }
166 if (server){ 168 if (server){
167 servers.append(server); 169 servers.append(server);
168 server=0; 170 server=0;
169 } 171 }
170 f.close(); 172 f.close();
171 } 173 }
172} 174}
173 175
174void KVNCBookmarkDlg::writeBookmarks(void) 176void KVNCBookmarkDlg::writeBookmarks(void)
175{ 177{
176 QString filename=Global::applicationFileName("keypebble","bookmarks"); 178 QString filename=Global::applicationFileName("keypebble","bookmarks");
177 179
178 QFile f(filename); 180 QFile f(filename);
179 181
180 QString key, val; 182 QString key, val;
181 KRFBServer * server=0; 183 KRFBServer * server=0;
182 184
183 if ( f.open(IO_ReadWrite) ) { 185 if ( f.open(IO_ReadWrite) ) {
184 QTextStream t( &f ); 186 QTextStream t( &f );
185 QString s; 187 QString s;
186 int n = 1; 188 int n = 1;
187 KRFBServer *server; 189 KRFBServer *server;
188 190
189 for ( server=servers.first(); server != 0; server=servers.next() ) { 191 for ( server=servers.first(); server != 0; server=servers.next() ) {
190 qDebug(server->name); 192 qDebug(server->name);
191 t << "server=" << server->name << '\n'; 193 t << "server=" << server->name << '\n';
192 t << "\thostname=" << server->hostname << '\n'; 194 t << "\thostname=" << server->hostname << '\n';
193 t << "\tpassword=" << encipher(server->password )<< '\n'; 195 t << "\tpassword=" << encipher(server->password )<< '\n';
194 t << "\tdisplay=" << server->display << '\n'; 196 t << "\tdisplay=" << server->display << '\n';
195 t << "\thextile=" << server->hexTile << '\n'; 197 t << "\thextile=" << server->hexTile << '\n';
196 t << "\tcorre=" << server->corre << '\n'; 198 t << "\tcorre=" << server->corre << '\n';
197 t << "\trre=" << server->rre << '\n'; 199 t << "\trre=" << server->rre << '\n';
198 t << "\tcopyrect=" << server->copyrect << '\n'; 200 t << "\tcopyrect=" << server->copyrect << '\n';
199 t << "\tshared=" << server->shared << '\n'; 201 t << "\tshared=" << server->shared << '\n';
200 t << "\treadonly=" << server->readOnly << '\n'; 202 t << "\treadonly=" << server->readOnly << '\n';
201 t << "\tdeiconify=" << server->deIconify << '\n'; 203 t << "\tdeiconify=" << server->deIconify << '\n';
202 t << "\tupdaterate=" << server->updateRate << '\n'; 204 t << "\tupdaterate=" << server->updateRate << '\n';
205 t << "\tscalefactor=" << server->scaleFactor << '\n';
203 206
204 } 207 }
205 f.close(); 208 f.close();
206 } 209 }
207} 210}
208void KVNCBookmarkDlg::refresh(void) 211void KVNCBookmarkDlg::refresh(void)
209{ 212{
210 bookmarkList->clear(); 213 bookmarkList->clear();
211 KRFBServer * server=0; 214 KRFBServer * server=0;
212 for ( server=servers.first(); server != 0; server=servers.next() ) { 215 for ( server=servers.first(); server != 0; server=servers.next() ) {
213 bookmarkList->insertItem(server->name); 216 bookmarkList->insertItem(server->name);
214 } 217 }
215} 218}
216 219
217QString KVNCBookmarkDlg::selectedBookmark() 220QString KVNCBookmarkDlg::selectedBookmark()
218{ 221{
219 return bookmarkList->currentText(); 222 return bookmarkList->currentText();
220} 223}
diff --git a/noncore/comm/keypebble/kvncconndlg.cpp b/noncore/comm/keypebble/kvncconndlg.cpp
index 6873feb..2f073f8 100644
--- a/noncore/comm/keypebble/kvncconndlg.cpp
+++ b/noncore/comm/keypebble/kvncconndlg.cpp
@@ -1,75 +1,94 @@
1#include <qframe.h> 1#include <qframe.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qcombobox.h>
4#include <qspinbox.h> 5#include <qspinbox.h>
5#include <qlabel.h> 6#include <qlabel.h>
6#include <qlayout.h> 7#include <qlayout.h>
7#include <qwhatsthis.h> 8#include <qwhatsthis.h>
8#include <qapplication.h> 9#include <qapplication.h>
9#include <qlineedit.h> 10#include <qlineedit.h>
10#include <qpushbutton.h> 11#include <qpushbutton.h>
11#include "krfbserver.h" 12#include "krfbserver.h"
12 13
13#include "kvncconndlg.h" 14#include "kvncconndlg.h"
14 15
15KVNCConnDlg::KVNCConnDlg( KRFBServer *options, 16KVNCConnDlg::KVNCConnDlg( KRFBServer *options,
16 QWidget *parent, char *name, bool modal ) 17 QWidget *parent, char *name, bool modal )
17: KVNCConnDlgBase( parent, name, modal ) 18: KVNCConnDlgBase( parent, name, modal )
18{ 19{
19 this->options=options; 20 this->options=options;
20 tmpOptions=*options; 21 tmpOptions=*options;
21 22
22 serverHostname->setText(options->hostname); 23 serverHostname->setText(options->hostname);
23 serverDisplay->setValue(options->display); 24 serverDisplay->setValue(options->display);
24 serverPassword->setText(options->password); 25 serverPassword->setText(options->password);
25 serverBookmark->setText(options->name); 26 serverBookmark->setText(options->name);
26 27
27 hex->setChecked( options->hexTile ); 28 hex->setChecked( options->hexTile );
28 corre->setChecked( options->corre ); 29 corre->setChecked( options->corre );
29 rre->setChecked( options->rre ); 30 rre->setChecked( options->rre );
30 copyRect->setChecked( options->copyrect ); 31 copyRect->setChecked( options->copyrect );
31 32
33 for (int i=0; i < scaleFactor->count(); ++i) {
34 if (scaleFactor->text(i).toInt()==tmpOptions.scaleFactor) {
35 scaleFactor->setCurrentItem(i);
36 }
37 }
38
32 // TODO 39 // TODO
33 hex->setEnabled( false ); 40 hex->setEnabled( false );
34 corre->setEnabled( false ); 41 corre->setEnabled( false );
35 rre->setEnabled( false ); 42 rre->setEnabled( false );
36 // /TODO 43 // /TODO
37 44
38 deIconify->setChecked( options->deIconify ); 45 deIconify->setChecked( options->deIconify );
39 bit->setChecked( options->colors256 ); 46 bit->setChecked( options->colors256 );
40 shared->setChecked( options->shared ); 47 shared->setChecked( options->shared );
41 timeBox->setValue( options->updateRate ); 48 timeBox->setValue( options->updateRate );
42 49
50 serverPassword->setEchoMode(QLineEdit::Password);
43 51
44} 52 connect(togglePassword, SIGNAL( stateChanged(int) ), this, SLOT( showPassword(int) ) );
45 53
54
55}
46KVNCConnDlg::~KVNCConnDlg() 56KVNCConnDlg::~KVNCConnDlg()
47{ 57{
48} 58}
49 59
50void KVNCConnDlg::accept() 60void KVNCConnDlg::accept()
51{ 61{
52 save(); 62 save();
53 QDialog::accept(); 63 QDialog::accept();
54} 64}
55 65
56void KVNCConnDlg::save() 66void KVNCConnDlg::save()
57{ 67{
58 tmpOptions.hexTile = hex->isChecked(); 68 tmpOptions.hexTile = hex->isChecked();
59 tmpOptions.corre = corre->isChecked(); 69 tmpOptions.corre = corre->isChecked();
60 tmpOptions.rre = rre->isChecked(); 70 tmpOptions.rre = rre->isChecked();
61 tmpOptions.copyrect = copyRect->isChecked(); 71 tmpOptions.copyrect = copyRect->isChecked();
62 tmpOptions.deIconify = deIconify->isChecked(); 72 tmpOptions.deIconify = deIconify->isChecked();
63 tmpOptions.colors256 = bit->isChecked(); 73 tmpOptions.colors256 = bit->isChecked();
64 tmpOptions.shared = shared->isChecked(); 74 tmpOptions.shared = shared->isChecked();
65 tmpOptions.hostname = serverHostname->text(); 75 tmpOptions.hostname = serverHostname->text();
66 tmpOptions.password = serverPassword->text(); 76 tmpOptions.password = serverPassword->text();
67 tmpOptions.display = serverDisplay->value(); 77 tmpOptions.display = serverDisplay->value();
68 tmpOptions.name = serverBookmark->text(); 78 tmpOptions.name = serverBookmark->text();
79 tmpOptions.scaleFactor = scaleFactor->currentText().toInt();
69 80
70 if (!serverBookmark->text().isEmpty()) { 81 if (!serverBookmark->text().isEmpty()) {
71 if ( options) { 82 if ( options) {
72 *options=tmpOptions; 83 *options=tmpOptions;
73 } 84 }
74 } 85 }
75} 86}
87
88void KVNCConnDlg::showPassword(int show)
89{
90 if (show)
91 serverPassword->setEchoMode(QLineEdit::Normal);
92 else
93 serverPassword->setEchoMode(QLineEdit::Password);
94}
diff --git a/noncore/comm/keypebble/kvncconndlg.h b/noncore/comm/keypebble/kvncconndlg.h
index fae7d62..5e84750 100644
--- a/noncore/comm/keypebble/kvncconndlg.h
+++ b/noncore/comm/keypebble/kvncconndlg.h
@@ -1,33 +1,34 @@
1// -*- c++ -*- 1// -*- c++ -*-
2 2
3#ifndef KVNCCONNECTION_H 3#ifndef KVNCCONNECTION_H
4#define KVNCCONNECTION_H 4#define KVNCCONNECTION_H
5 5
6#include "kvncconndlgbase.h" 6#include "kvncconndlgbase.h"
7#include "krfbserver.h" 7#include "krfbserver.h"
8 8
9 9
10class KVNCConnDlg : public KVNCConnDlgBase 10class KVNCConnDlg : public KVNCConnDlgBase
11{ 11{
12 Q_OBJECT 12 Q_OBJECT
13 13
14 public: 14 public:
15 KVNCConnDlg( KRFBServer *options, 15 KVNCConnDlg( KRFBServer *options,
16 QWidget *parent = 0, char *name = 0, bool modal = true ); 16 QWidget *parent = 0, char *name = 0, bool modal = true );
17 ~KVNCConnDlg(); 17 ~KVNCConnDlg();
18 18
19 protected: 19 protected:
20 void accept(); 20 void accept();
21 private slots: 21 private slots:
22 void save(); 22 void save();
23 void showPassword(int);
23 24
24 private: 25 private:
25 KRFBServer tmpOptions; 26 KRFBServer tmpOptions;
26 KRFBServer * options; 27 KRFBServer * options;
27}; 28};
28 29
29#endif // KVNCCONNECTION_H 30#endif // KVNCCONNECTION_H
30 31
31 32
32 33
33 34
diff --git a/noncore/comm/keypebble/kvncconndlgbase.ui b/noncore/comm/keypebble/kvncconndlgbase.ui
index df0d375..42765c1 100644
--- a/noncore/comm/keypebble/kvncconndlgbase.ui
+++ b/noncore/comm/keypebble/kvncconndlgbase.ui
@@ -1,432 +1,482 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>KVNCConnDlgBase</class> 2<class>KVNCConnDlgBase</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>KVNCConnDlgBase</cstring> 7 <cstring>KVNCConnDlgBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>984</width> 14 <width>260</width>
15 <height>676</height> 15 <height>242</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>VNC Viewer Connection</string> 20 <string>VNC Viewer Connection</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <vbox> 25 <widget>
26 <class>QTabWidget</class>
26 <property stdset="1"> 27 <property stdset="1">
27 <name>margin</name> 28 <name>name</name>
28 <number>0</number> 29 <cstring>TabWidget3</cstring>
29 </property> 30 </property>
30 <property stdset="1"> 31 <property stdset="1">
31 <name>spacing</name> 32 <name>geometry</name>
32 <number>6</number> 33 <rect>
34 <x>0</x>
35 <y>0</y>
36 <width>266</width>
37 <height>233</height>
38 </rect>
33 </property> 39 </property>
34 <widget> 40 <widget>
35 <class>QTabWidget</class> 41 <class>QWidget</class>
36 <property stdset="1"> 42 <property stdset="1">
37 <name>name</name> 43 <name>name</name>
38 <cstring>TabWidget3</cstring> 44 <cstring>tab</cstring>
39 </property> 45 </property>
40 <widget> 46 <attribute>
41 <class>QWidget</class> 47 <name>title</name>
48 <string>Server</string>
49 </attribute>
50 <grid>
42 <property stdset="1"> 51 <property stdset="1">
43 <name>name</name> 52 <name>margin</name>
44 <cstring>tab</cstring> 53 <number>11</number>
45 </property> 54 </property>
46 <attribute> 55 <property stdset="1">
47 <name>title</name> 56 <name>spacing</name>
48 <string>Server</string> 57 <number>6</number>
49 </attribute> 58 </property>
50 <grid> 59 <widget row="2" column="1" rowspan="1" colspan="2" >
60 <class>QLineEdit</class>
51 <property stdset="1"> 61 <property stdset="1">
52 <name>margin</name> 62 <name>name</name>
53 <number>11</number> 63 <cstring>serverPassword</cstring>
54 </property> 64 </property>
55 <property stdset="1"> 65 <property stdset="1">
56 <name>spacing</name> 66 <name>autoMask</name>
57 <number>6</number> 67 <bool>true</bool>
58 </property> 68 </property>
59 <widget row="0" column="0" > 69 <property stdset="1">
60 <class>QLabel</class> 70 <name>echoMode</name>
61 <property stdset="1"> 71 <enum>Password</enum>
62 <name>name</name> 72 </property>
63 <cstring>hostname</cstring> 73 </widget>
64 </property> 74 <widget row="3" column="1" >
65 <property stdset="1"> 75 <class>QCheckBox</class>
66 <name>text</name> 76 <property stdset="1">
67 <string>Host Name:</string> 77 <name>name</name>
68 </property> 78 <cstring>togglePassword</cstring>
69 </widget> 79 </property>
70 <widget row="1" column="0" > 80 <property stdset="1">
71 <class>QLabel</class> 81 <name>text</name>
72 <property stdset="1"> 82 <string>Show Password</string>
73 <name>name</name> 83 </property>
74 <cstring>TextLabel2_2</cstring> 84 </widget>
75 </property> 85 <widget row="2" column="0" >
76 <property stdset="1"> 86 <class>QLabel</class>
77 <name>text</name> 87 <property stdset="1">
78 <string>Display Number:</string> 88 <name>name</name>
79 </property> 89 <cstring>TextLabel3</cstring>
80 </widget> 90 </property>
81 <widget row="2" column="1" rowspan="1" colspan="2" > 91 <property stdset="1">
82 <class>QLineEdit</class> 92 <name>text</name>
83 <property stdset="1"> 93 <string>Password:</string>
84 <name>name</name> 94 </property>
85 <cstring>serverPassword</cstring> 95 </widget>
86 </property> 96 <widget row="4" column="1" rowspan="1" colspan="2" >
87 <property stdset="1"> 97 <class>QLineEdit</class>
88 <name>autoMask</name> 98 <property stdset="1">
89 <bool>true</bool> 99 <name>name</name>
90 </property> 100 <cstring>serverBookmark</cstring>
91 </widget> 101 </property>
92 <widget row="1" column="1" rowspan="1" colspan="2" > 102 </widget>
93 <class>QSpinBox</class> 103 <widget row="4" column="0" >
94 <property stdset="1"> 104 <class>QLabel</class>
95 <name>name</name> 105 <property stdset="1">
96 <cstring>serverDisplay</cstring> 106 <name>name</name>
97 </property> 107 <cstring>TextLabel1_2</cstring>
98 <property stdset="1"> 108 </property>
99 <name>maxValue</name> 109 <property stdset="1">
100 <number>500</number> 110 <name>text</name>
101 </property> 111 <string>Bookmark Name:</string>
102 <property stdset="1"> 112 </property>
103 <name>minValue</name> 113 </widget>
104 <number>0</number> 114 <widget row="0" column="1" rowspan="1" colspan="2" >
105 </property> 115 <class>QLineEdit</class>
116 <property stdset="1">
117 <name>name</name>
118 <cstring>serverHostname</cstring>
119 </property>
120 </widget>
121 <widget row="0" column="0" >
122 <class>QLabel</class>
123 <property stdset="1">
124 <name>name</name>
125 <cstring>hostname</cstring>
126 </property>
127 <property stdset="1">
128 <name>text</name>
129 <string>Host Name:</string>
130 </property>
131 </widget>
132 <widget row="1" column="0" >
133 <class>QLabel</class>
134 <property stdset="1">
135 <name>name</name>
136 <cstring>TextLabel2_2</cstring>
137 </property>
138 <property stdset="1">
139 <name>text</name>
140 <string>Display Number:</string>
141 </property>
142 </widget>
143 <widget row="1" column="1" rowspan="1" colspan="2" >
144 <class>QSpinBox</class>
145 <property stdset="1">
146 <name>name</name>
147 <cstring>serverDisplay</cstring>
148 </property>
149 <property stdset="1">
150 <name>maxValue</name>
151 <number>500</number>
152 </property>
153 <property stdset="1">
154 <name>minValue</name>
155 <number>0</number>
156 </property>
157 <property stdset="1">
158 <name>value</name>
159 <number>0</number>
160 </property>
161 </widget>
162 <spacer row="5" column="2" >
163 <property>
164 <name>name</name>
165 <cstring>Spacer2</cstring>
166 </property>
167 <property stdset="1">
168 <name>orientation</name>
169 <enum>Vertical</enum>
170 </property>
171 <property stdset="1">
172 <name>sizeType</name>
173 <enum>Expanding</enum>
174 </property>
175 <property>
176 <name>sizeHint</name>
177 <size>
178 <width>20</width>
179 <height>20</height>
180 </size>
181 </property>
182 </spacer>
183 </grid>
184 </widget>
185 <widget>
186 <class>QWidget</class>
187 <property stdset="1">
188 <name>name</name>
189 <cstring>tab</cstring>
190 </property>
191 <attribute>
192 <name>title</name>
193 <string>Options</string>
194 </attribute>
195 <vbox>
196 <property stdset="1">
197 <name>margin</name>
198 <number>11</number>
199 </property>
200 <property stdset="1">
201 <name>spacing</name>
202 <number>6</number>
203 </property>
204 <widget>
205 <class>QLabel</class>
206 <property stdset="1">
207 <name>name</name>
208 <cstring>TextLabel1</cstring>
209 </property>
210 <property stdset="1">
211 <name>text</name>
212 <string>Check for screen updates every:</string>
213 </property>
214 </widget>
215 <widget>
216 <class>QLayoutWidget</class>
217 <property stdset="1">
218 <name>name</name>
219 <cstring>Layout2</cstring>
220 </property>
221 <hbox>
106 <property stdset="1"> 222 <property stdset="1">
107 <name>value</name> 223 <name>margin</name>
108 <number>0</number> 224 <number>0</number>
109 </property> 225 </property>
110 </widget>
111 <widget row="0" column="1" rowspan="1" colspan="2" >
112 <class>QLineEdit</class>
113 <property stdset="1">
114 <name>name</name>
115 <cstring>serverHostname</cstring>
116 </property>
117 </widget>
118 <widget row="2" column="0" >
119 <class>QLabel</class>
120 <property stdset="1">
121 <name>name</name>
122 <cstring>TextLabel3</cstring>
123 </property>
124 <property stdset="1"> 226 <property stdset="1">
125 <name>text</name> 227 <name>spacing</name>
126 <string>Password:</string> 228 <number>6</number>
127 </property> 229 </property>
128 </widget> 230 <widget>
129 <widget row="3" column="1" rowspan="1" colspan="2" > 231 <class>QSpinBox</class>
130 <class>QLineEdit</class>
131 <property stdset="1">
132 <name>name</name>
133 <cstring>serverBookmark</cstring>
134 </property>
135 </widget>
136 <widget row="3" column="0" >
137 <class>QLabel</class>
138 <property stdset="1">
139 <name>name</name>
140 <cstring>TextLabel1_2</cstring>
141 </property>
142 <property stdset="1">
143 <name>text</name>
144 <string>Bookmark Name:</string>
145 </property>
146 </widget>
147 <spacer row="5" column="2" >
148 <property>
149 <name>name</name>
150 <cstring>Spacer2</cstring>
151 </property>
152 <property stdset="1">
153 <name>orientation</name>
154 <enum>Vertical</enum>
155 </property>
156 <property stdset="1">
157 <name>sizeType</name>
158 <enum>Expanding</enum>
159 </property>
160 <property>
161 <name>sizeHint</name>
162 <size>
163 <width>20</width>
164 <height>20</height>
165 </size>
166 </property>
167 </spacer>
168 <widget row="4" column="1" >
169 <class>QLayoutWidget</class>
170 <property stdset="1">
171 <name>name</name>
172 <cstring>Layout3</cstring>
173 </property>
174 <hbox>
175 <property stdset="1"> 232 <property stdset="1">
176 <name>margin</name> 233 <name>name</name>
177 <number>0</number> 234 <cstring>timeBox</cstring>
178 </property> 235 </property>
179 <property stdset="1"> 236 <property stdset="1">
180 <name>spacing</name> 237 <name>maxValue</name>
181 <number>6</number> 238 <number>500</number>
182 </property> 239 </property>
183 </hbox> 240 <property stdset="1">
184 </widget> 241 <name>minValue</name>
185 </grid> 242 <number>1</number>
186 </widget> 243 </property>
187 <widget> 244 </widget>
188 <class>QWidget</class> 245 <widget>
189 <property stdset="1"> 246 <class>QLabel</class>
190 <name>name</name> 247 <property stdset="1">
191 <cstring>tab</cstring> 248 <name>name</name>
192 </property> 249 <cstring>TextLabel2</cstring>
193 <attribute> 250 </property>
194 <name>title</name> 251 <property stdset="1">
195 <string>Options</string> 252 <name>text</name>
196 </attribute> 253 <string>Milliseconds</string>
197 <vbox> 254 </property>
255 </widget>
256 </hbox>
257 </widget>
258 <widget>
259 <class>QCheckBox</class>
198 <property stdset="1"> 260 <property stdset="1">
199 <name>margin</name> 261 <name>name</name>
200 <number>11</number> 262 <cstring>bit</cstring>
201 </property> 263 </property>
202 <property stdset="1"> 264 <property stdset="1">
203 <name>spacing</name> 265 <name>text</name>
204 <number>6</number> 266 <string>Request 8-bit session</string>
205 </property> 267 </property>
206 <widget> 268 </widget>
207 <class>QLabel</class> 269 <widget>
208 <property stdset="1"> 270 <class>QCheckBox</class>
209 <name>name</name> 271 <property stdset="1">
210 <cstring>TextLabel1</cstring> 272 <name>name</name>
211 </property> 273 <cstring>deIconify</cstring>
274 </property>
275 <property stdset="1">
276 <name>text</name>
277 <string>Raise on bell</string>
278 </property>
279 </widget>
280 <widget>
281 <class>QCheckBox</class>
282 <property stdset="1">
283 <name>name</name>
284 <cstring>shared</cstring>
285 </property>
286 <property stdset="1">
287 <name>text</name>
288 <string>Request shared session</string>
289 </property>
290 </widget>
291 <widget>
292 <class>QLayoutWidget</class>
293 <property stdset="1">
294 <name>name</name>
295 <cstring>Layout3</cstring>
296 </property>
297 <hbox>
212 <property stdset="1"> 298 <property stdset="1">
213 <name>text</name> 299 <name>margin</name>
214 <string>Check for screen updates every:</string> 300 <number>0</number>
215 </property> 301 </property>
216 </widget>
217 <widget>
218 <class>QLayoutWidget</class>
219 <property stdset="1"> 302 <property stdset="1">
220 <name>name</name> 303 <name>spacing</name>
221 <cstring>Layout2</cstring> 304 <number>6</number>
222 </property> 305 </property>
223 <hbox> 306 <widget>
224 <property stdset="1"> 307 <class>QComboBox</class>
225 <name>margin</name> 308 <item>
226 <number>0</number> 309 <property>
227 </property> 310 <name>text</name>
228 <property stdset="1"> 311 <string>1</string>
229 <name>spacing</name>
230 <number>6</number>
231 </property>
232 <widget>
233 <class>QSpinBox</class>
234 <property stdset="1">
235 <name>name</name>
236 <cstring>timeBox</cstring>
237 </property>
238 <property stdset="1">
239 <name>maxValue</name>
240 <number>500</number>
241 </property>
242 <property stdset="1">
243 <name>minValue</name>
244 <number>1</number>
245 </property> 312 </property>
246 </widget> 313 </item>
247 <widget> 314 <item>
248 <class>QLabel</class> 315 <property>
249 <property stdset="1"> 316 <name>text</name>
250 <name>name</name> 317 <string>2</string>
251 <cstring>TextLabel2</cstring>
252 </property> 318 </property>
253 <property stdset="1"> 319 </item>
320 <item>
321 <property>
254 <name>text</name> 322 <name>text</name>
255 <string>Milliseconds</string> 323 <string>4</string>
256 </property> 324 </property>
257 </widget> 325 </item>
258 </hbox> 326 <property stdset="1">
259 </widget> 327 <name>name</name>
260 <widget> 328 <cstring>scaleFactor</cstring>
261 <class>QCheckBox</class> 329 </property>
262 <property stdset="1"> 330 </widget>
263 <name>name</name> 331 <widget>
264 <cstring>bit</cstring> 332 <class>QLabel</class>
265 </property> 333 <property stdset="1">
266 <property stdset="1"> 334 <name>name</name>
267 <name>text</name> 335 <cstring>TextLabel2_3</cstring>
268 <string>Request 8-bit session</string> 336 </property>
269 </property> 337 <property stdset="1">
270 </widget> 338 <name>text</name>
271 <widget> 339 <string>Scale Factor</string>
272 <class>QCheckBox</class> 340 </property>
273 <property stdset="1"> 341 </widget>
274 <name>name</name> 342 </hbox>
275 <cstring>deIconify</cstring> 343 </widget>
276 </property> 344 <spacer>
277 <property stdset="1"> 345 <property>
278 <name>text</name> 346 <name>name</name>
279 <string>Raise on bell</string> 347 <cstring>Spacer2</cstring>
280 </property> 348 </property>
281 </widget> 349 <property stdset="1">
282 <widget> 350 <name>orientation</name>
283 <class>QCheckBox</class> 351 <enum>Vertical</enum>
284 <property stdset="1"> 352 </property>
285 <name>name</name> 353 <property stdset="1">
286 <cstring>shared</cstring> 354 <name>sizeType</name>
287 </property> 355 <enum>Expanding</enum>
288 <property stdset="1"> 356 </property>
289 <name>text</name> 357 <property>
290 <string>Request shared session</string> 358 <name>sizeHint</name>
291 </property> 359 <size>
292 </widget> 360 <width>20</width>
293 <spacer> 361 <height>20</height>
294 <property> 362 </size>
295 <name>name</name> 363 </property>
296 <cstring>Spacer2</cstring> 364 </spacer>
297 </property> 365 </vbox>
298 <property stdset="1"> 366 </widget>
299 <name>orientation</name> 367 <widget>
300 <enum>Vertical</enum> 368 <class>QWidget</class>
301 </property> 369 <property stdset="1">
302 <property stdset="1"> 370 <name>name</name>
303 <name>sizeType</name> 371 <cstring>tab</cstring>
304 <enum>Expanding</enum> 372 </property>
305 </property> 373 <attribute>
306 <property> 374 <name>title</name>
307 <name>sizeHint</name> 375 <string>Encodings</string>
308 <size> 376 </attribute>
309 <width>20</width> 377 <vbox>
310 <height>20</height> 378 <property stdset="1">
311 </size> 379 <name>margin</name>
312 </property> 380 <number>11</number>
313 </spacer> 381 </property>
314 </vbox>
315 </widget>
316 <widget>
317 <class>QWidget</class>
318 <property stdset="1"> 382 <property stdset="1">
319 <name>name</name> 383 <name>spacing</name>
320 <cstring>tab</cstring> 384 <number>6</number>
321 </property> 385 </property>
322 <attribute> 386 <widget>
323 <name>title</name> 387 <class>QCheckBox</class>
324 <string>Encodings</string>
325 </attribute>
326 <vbox>
327 <property stdset="1"> 388 <property stdset="1">
328 <name>margin</name> 389 <name>name</name>
329 <number>11</number> 390 <cstring>hex</cstring>
330 </property> 391 </property>
331 <property stdset="1"> 392 <property stdset="1">
332 <name>spacing</name> 393 <name>enabled</name>
333 <number>6</number> 394 <bool>false</bool>
334 </property> 395 </property>
335 <widget> 396 <property stdset="1">
336 <class>QCheckBox</class> 397 <name>text</name>
337 <property stdset="1"> 398 <string>Hextile encoding</string>
338 <name>name</name> 399 </property>
339 <cstring>hex</cstring> 400 </widget>
340 </property> 401 <widget>
341 <property stdset="1"> 402 <class>QCheckBox</class>
342 <name>enabled</name> 403 <property stdset="1">
343 <bool>false</bool> 404 <name>name</name>
344 </property> 405 <cstring>corre</cstring>
345 <property stdset="1"> 406 </property>
346 <name>text</name> 407 <property stdset="1">
347 <string>Hextile encoding</string> 408 <name>enabled</name>
348 </property> 409 <bool>false</bool>
349 </widget> 410 </property>
350 <widget> 411 <property stdset="1">
351 <class>QCheckBox</class> 412 <name>text</name>
352 <property stdset="1"> 413 <string>CoRRE encoding</string>
353 <name>name</name> 414 </property>
354 <cstring>corre</cstring> 415 </widget>
355 </property> 416 <widget>
356 <property stdset="1"> 417 <class>QCheckBox</class>
357 <name>enabled</name> 418 <property stdset="1">
358 <bool>false</bool> 419 <name>name</name>
359 </property> 420 <cstring>rre</cstring>
360 <property stdset="1"> 421 </property>
361 <name>text</name> 422 <property stdset="1">
362 <string>CoRRE encoding</string> 423 <name>enabled</name>
363 </property> 424 <bool>false</bool>
364 </widget> 425 </property>
365 <widget> 426 <property stdset="1">
366 <class>QCheckBox</class> 427 <name>text</name>
367 <property stdset="1"> 428 <string>RRE encoding</string>
368 <name>name</name> 429 </property>
369 <cstring>rre</cstring> 430 </widget>
370 </property> 431 <widget>
371 <property stdset="1"> 432 <class>QCheckBox</class>
372 <name>enabled</name> 433 <property stdset="1">
373 <bool>false</bool> 434 <name>name</name>
374 </property> 435 <cstring>copyRect</cstring>
375 <property stdset="1"> 436 </property>
376 <name>text</name> 437 <property stdset="1">
377 <string>RRE encoding</string> 438 <name>text</name>
378 </property> 439 <string>Copy rectangle encoding</string>
379 </widget> 440 </property>
380 <widget> 441 </widget>
381 <class>QCheckBox</class> 442 <spacer>
382 <property stdset="1"> 443 <property>
383 <name>name</name> 444 <name>name</name>
384 <cstring>copyRect</cstring> 445 <cstring>Spacer3</cstring>
385 </property> 446 </property>
386 <property stdset="1"> 447 <property stdset="1">
387 <name>text</name> 448 <name>orientation</name>
388 <string>Copy rectangle encoding</string> 449 <enum>Vertical</enum>
389 </property> 450 </property>
390 </widget> 451 <property stdset="1">
391 <spacer> 452 <name>sizeType</name>
392 <property> 453 <enum>Expanding</enum>
393 <name>name</name> 454 </property>
394 <cstring>Spacer3</cstring> 455 <property>
395 </property> 456 <name>sizeHint</name>
396 <property stdset="1"> 457 <size>
397 <name>orientation</name> 458 <width>20</width>
398 <enum>Vertical</enum> 459 <height>20</height>
399 </property> 460 </size>
400 <property stdset="1"> 461 </property>
401 <name>sizeType</name> 462 </spacer>
402 <enum>Expanding</enum> 463 </vbox>
403 </property>
404 <property>
405 <name>sizeHint</name>
406 <size>
407 <width>20</width>
408 <height>20</height>
409 </size>
410 </property>
411 </spacer>
412 </vbox>
413 </widget>
414 </widget> 464 </widget>
415 </vbox> 465 </widget>
416</widget> 466</widget>
417<tabstops> 467<tabstops>
418 <tabstop>TabWidget3</tabstop> 468 <tabstop>TabWidget3</tabstop>
419 <tabstop>serverHostname</tabstop> 469 <tabstop>serverHostname</tabstop>
420 <tabstop>serverDisplay</tabstop> 470 <tabstop>serverDisplay</tabstop>
421 <tabstop>serverPassword</tabstop> 471 <tabstop>serverPassword</tabstop>
422 <tabstop>serverBookmark</tabstop> 472 <tabstop>serverBookmark</tabstop>
423 <tabstop>timeBox</tabstop> 473 <tabstop>timeBox</tabstop>
424 <tabstop>bit</tabstop> 474 <tabstop>bit</tabstop>
425 <tabstop>deIconify</tabstop> 475 <tabstop>deIconify</tabstop>
426 <tabstop>shared</tabstop> 476 <tabstop>shared</tabstop>
427 <tabstop>hex</tabstop> 477 <tabstop>hex</tabstop>
428 <tabstop>corre</tabstop> 478 <tabstop>corre</tabstop>
429 <tabstop>rre</tabstop> 479 <tabstop>rre</tabstop>
430 <tabstop>copyRect</tabstop> 480 <tabstop>copyRect</tabstop>
431</tabstops> 481</tabstops>
432</UI> 482</UI>