author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/comm | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
-rw-r--r-- | noncore/comm/keypebble/krfbcanvas.cpp | 4 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbconnection.cpp | 6 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfblogin.cpp | 4 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvnc.cpp | 12 |
4 files changed, 13 insertions, 13 deletions
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index 75cba68..cd1fda0 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp | |||
@@ -1,200 +1,200 @@ | |||
1 | #include "krfbconnection.h" | 1 | #include "krfbconnection.h" |
2 | #include "krfbcanvas.h" | 2 | #include "krfbcanvas.h" |
3 | #include "krfbbuffer.h" | 3 | #include "krfbbuffer.h" |
4 | 4 | ||
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | 6 | ||
7 | #include <qclipboard.h> | 7 | #include <qclipboard.h> |
8 | 8 | ||
9 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) | 9 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) |
10 | : QScrollView( parent, name ) | 10 | : QScrollView( parent, name ) |
11 | { | 11 | { |
12 | connection_ = new KRFBConnection(); | 12 | connection_ = new KRFBConnection(); |
13 | connect( connection_, SIGNAL( loggedIn() ), | 13 | connect( connection_, SIGNAL( loggedIn() ), |
14 | this, SLOT( loggedIn() ) ); | 14 | this, SLOT( loggedIn() ) ); |
15 | 15 | ||
16 | loggedIn_ = false; | 16 | loggedIn_ = false; |
17 | 17 | ||
18 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); | 18 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); |
19 | 19 | ||
20 | viewport()->setFocusPolicy( QWidget::StrongFocus ); | 20 | viewport()->setFocusPolicy( QWidget::StrongFocus ); |
21 | viewport()->setFocus(); | 21 | viewport()->setFocus(); |
22 | 22 | ||
23 | nextRightClick=0; | 23 | nextRightClick=0; |
24 | nextDoubleClick=0; | 24 | nextDoubleClick=0; |
25 | } | 25 | } |
26 | 26 | ||
27 | KRFBCanvas::~KRFBCanvas() | 27 | KRFBCanvas::~KRFBCanvas() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | void KRFBCanvas::openConnection(KRFBServer server) | 32 | void KRFBCanvas::openConnection(KRFBServer server) |
33 | { | 33 | { |
34 | 34 | ||
35 | 35 | ||
36 | QCString host = server.hostname.latin1(); | 36 | QCString host = server.hostname.latin1(); |
37 | password=server.password; | 37 | password=server.password; |
38 | connection_->connectTo( server); | 38 | connection_->connectTo( server); |
39 | } | 39 | } |
40 | 40 | ||
41 | 41 | ||
42 | void KRFBCanvas::openURL( const QUrl &url ) | 42 | void KRFBCanvas::openURL( const QUrl &url ) |
43 | { | 43 | { |
44 | if ( loggedIn_ ) { | 44 | if ( loggedIn_ ) { |
45 | qWarning( "openURL invoked when logged in\n" ); | 45 | qWarning( "openURL invoked when logged in\n" ); |
46 | return; | 46 | return; |
47 | } | 47 | } |
48 | 48 | ||
49 | QCString host = url.host().latin1(); | 49 | QCString host = url.host().latin1(); |
50 | int display = url.port(); | 50 | int display = url.port(); |
51 | 51 | ||
52 | // connection_->connectTo( host, display ); | 52 | // connection_->connectTo( host, display ); |
53 | } | 53 | } |
54 | 54 | ||
55 | void KRFBCanvas::closeConnection() | 55 | void KRFBCanvas::closeConnection() |
56 | { | 56 | { |
57 | loggedIn_ = false; | 57 | loggedIn_ = false; |
58 | connection_->disconnect(); | 58 | connection_->disconnect(); |
59 | 59 | ||
60 | viewport()->setMouseTracking( false ); | 60 | viewport()->setMouseTracking( false ); |
61 | viewport()->setBackgroundMode( PaletteDark ); | 61 | viewport()->setBackgroundMode( PaletteDark ); |
62 | setBackgroundMode( PaletteDark ); | 62 | setBackgroundMode( PaletteDark ); |
63 | update(); | 63 | update(); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | void KRFBCanvas::bell() | 67 | void KRFBCanvas::bell() |
68 | { | 68 | { |
69 | if ( connection_->options()->deIconify ) { | 69 | if ( connection_->options()->deIconify ) { |
70 | topLevelWidget()->raise(); | 70 | topLevelWidget()->raise(); |
71 | topLevelWidget()->show(); | 71 | topLevelWidget()->show(); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | void KRFBCanvas::loggedIn() | 75 | void KRFBCanvas::loggedIn() |
76 | { | 76 | { |
77 | qWarning( "Ok, we're logged in" ); | 77 | qWarning( "Ok, we're logged in" ); |
78 | 78 | ||
79 | // | 79 | // |
80 | // Get ready for action | 80 | // Get ready for action |
81 | // | 81 | // |
82 | loggedIn_ = true; | 82 | loggedIn_ = true; |
83 | viewport()->setMouseTracking( true ); | 83 | viewport()->setMouseTracking( true ); |
84 | viewport()->setBackgroundMode( NoBackground ); | 84 | viewport()->setBackgroundMode( NoBackground ); |
85 | setBackgroundMode( NoBackground ); | 85 | setBackgroundMode( NoBackground ); |
86 | 86 | ||
87 | // Start using the buffer | 87 | // Start using the buffer |
88 | connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ), | 88 | connect( connection_->buffer(), SIGNAL( sizeChanged(int,int) ), |
89 | this, SLOT( resizeContents(int,int) ) ); | 89 | this, SLOT( resizeContents(int,int) ) ); |
90 | connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), | 90 | connect( connection_->buffer(), SIGNAL( updated(int,int,int,int) ), |
91 | this, SLOT( viewportUpdate(int,int,int,int) ) ); | 91 | this, SLOT( viewportUpdate(int,int,int,int) ) ); |
92 | connect( connection_->buffer(), SIGNAL( bell() ), | 92 | connect( connection_->buffer(), SIGNAL( bell() ), |
93 | this, SLOT( bell() ) ); | 93 | this, SLOT( bell() ) ); |
94 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), | 94 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), |
95 | this, SLOT( clipboardChanged() ) ); | 95 | this, SLOT( clipboardChanged() ) ); |
96 | } | 96 | } |
97 | 97 | ||
98 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) | 98 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) |
99 | { | 99 | { |
100 | QRect r = e->rect(); | 100 | QRect r = e->rect(); |
101 | 101 | ||
102 | if ( loggedIn_ ) { | 102 | if ( loggedIn_ ) { |
103 | QPixmap p; | 103 | QPixmap p; |
104 | 104 | ||
105 | bitBlt( viewport(), r.x(), r.y(), | 105 | bitBlt( viewport(), r.x(), r.y(), |
106 | connection_->buffer()->pixmap(), | 106 | connection_->buffer()->pixmap(), |
107 | r.x() + contentsX(), r.y() + contentsY(), | 107 | r.x() + contentsX(), r.y() + contentsY(), |
108 | r.width(), r.height() ); | 108 | r.width(), r.height() ); |
109 | } | 109 | } |
110 | else { | 110 | else { |
111 | QScrollView::viewportPaintEvent( e ); | 111 | QScrollView::viewportPaintEvent( e ); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) | 115 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) |
116 | { | 116 | { |
117 | updateContents( x, y, w, h ); | 117 | updateContents( x, y, w, h ); |
118 | } | 118 | } |
119 | 119 | ||
120 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) | 120 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) |
121 | { | 121 | { |
122 | 122 | ||
123 | if (nextDoubleClick) { | 123 | if (nextDoubleClick) { |
124 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); | 124 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); |
125 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); | 125 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); |
126 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); | 126 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); |
127 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); | 127 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); |
128 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); | 128 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); |
129 | } if (nextRightClick) { | 129 | } if (nextRightClick) { |
130 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); | 130 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); |
131 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); | 131 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); |
132 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); | 132 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); |
133 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); | 133 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); |
134 | } else if ( loggedIn_ ) | 134 | } else if ( loggedIn_ ) |
135 | connection_->buffer()->mouseEvent( e ); | 135 | connection_->buffer()->mouseEvent( e ); |
136 | 136 | ||
137 | } | 137 | } |
138 | 138 | ||
139 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) | 139 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) |
140 | { | 140 | { |
141 | if ( loggedIn_ && !nextRightClick && !nextDoubleClick) { | 141 | if ( loggedIn_ && !nextRightClick && !nextDoubleClick) { |
142 | connection_->buffer()->mouseEvent( e ); | 142 | connection_->buffer()->mouseEvent( e ); |
143 | } | 143 | } |
144 | 144 | ||
145 | nextRightClick=0; | 145 | nextRightClick=0; |
146 | nextDoubleClick=0; | 146 | nextDoubleClick=0; |
147 | } | 147 | } |
148 | 148 | ||
149 | void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) | 149 | void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) |
150 | { | 150 | { |
151 | if ( loggedIn_ ) | 151 | if ( loggedIn_ ) |
152 | connection_->buffer()->mouseEvent( e ); | 152 | connection_->buffer()->mouseEvent( e ); |
153 | } | 153 | } |
154 | 154 | ||
155 | void KRFBCanvas::keyPressEvent( QKeyEvent *e ) | 155 | void KRFBCanvas::keyPressEvent( QKeyEvent *e ) |
156 | { | 156 | { |
157 | if ( loggedIn_ ) | 157 | if ( loggedIn_ ) |
158 | connection_->buffer()->keyPressEvent( e ); | 158 | connection_->buffer()->keyPressEvent( e ); |
159 | } | 159 | } |
160 | 160 | ||
161 | void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) | 161 | void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) |
162 | { | 162 | { |
163 | if ( loggedIn_ ) | 163 | if ( loggedIn_ ) |
164 | connection_->buffer()->keyReleaseEvent( e ); | 164 | connection_->buffer()->keyReleaseEvent( e ); |
165 | } | 165 | } |
166 | 166 | ||
167 | void KRFBCanvas::refresh() | 167 | void KRFBCanvas::refresh() |
168 | { | 168 | { |
169 | if ( loggedIn_ ) | 169 | if ( loggedIn_ ) |
170 | connection_->refresh(); | 170 | connection_->refresh(); |
171 | } | 171 | } |
172 | 172 | ||
173 | void KRFBCanvas::clipboardChanged() | 173 | void KRFBCanvas::clipboardChanged() |
174 | { | 174 | { |
175 | if ( loggedIn_ ) { | 175 | if ( loggedIn_ ) { |
176 | connection_->sendCutText( qApp->clipboard()->text() ); | 176 | connection_->sendCutText( qApp->clipboard()->text() ); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | void KRFBCanvas::sendCtlAltDel( void) | 179 | void KRFBCanvas::sendCtlAltDel( void) |
180 | { | 180 | { |
181 | 181 | ||
182 | if ( loggedIn_ ) { | 182 | if ( loggedIn_ ) { |
183 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Control, 0,0)); | 183 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Control, 0,0)); |
184 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Alt, 0,0)); | 184 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Alt, 0,0)); |
185 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0,0)); | 185 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0,0)); |
186 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Control, 0,0)); | 186 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Control, 0,0)); |
187 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Alt, 0,0)); | 187 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Alt, 0,0)); |
188 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Delete, 0,0)); | 188 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Delete, 0,0)); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | void KRFBCanvas::markDoubleClick( void) | 192 | void KRFBCanvas::markDoubleClick( void) |
193 | { | 193 | { |
194 | nextRightClick=1; | 194 | nextRightClick=1; |
195 | } | 195 | } |
196 | 196 | ||
197 | void KRFBCanvas::markRightClick( void) | 197 | void KRFBCanvas::markRightClick( void) |
198 | { | 198 | { |
199 | nextRightClick=1; | 199 | nextRightClick=1; |
200 | } | 200 | } |
diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp index e6c33c6..b447046 100644 --- a/noncore/comm/keypebble/krfbconnection.cpp +++ b/noncore/comm/keypebble/krfbconnection.cpp | |||
@@ -1,233 +1,233 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | #include <qsocket.h> | 2 | #include <qsocket.h> |
3 | #include <qtimer.h> | 3 | #include <qtimer.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | 5 | ||
6 | #include "krfbconnection.h" | 6 | #include "krfbconnection.h" |
7 | #include "krfblogin.h" | 7 | #include "krfblogin.h" |
8 | #include "krfbdecoder.h" | 8 | #include "krfbdecoder.h" |
9 | #include "krfbbuffer.h" | 9 | #include "krfbbuffer.h" |
10 | 10 | ||
11 | KRFBConnection::KRFBConnection( QObject *parent ) | 11 | KRFBConnection::KRFBConnection( QObject *parent ) |
12 | : QObject( parent, "KRFBConnection" ) | 12 | : QObject( parent, "KRFBConnection" ) |
13 | { | 13 | { |
14 | portBase_ = 5900; | 14 | portBase_ = 5900; |
15 | currentState_ = Disconnected; | 15 | currentState_ = Disconnected; |
16 | sock = 0; | 16 | sock = 0; |
17 | minData_ = 0; | 17 | minData_ = 0; |
18 | options_ = new KRFBServer(); | 18 | options_ = new KRFBServer(); |
19 | updater = 0; | 19 | updater = 0; |
20 | decoder_ = 0; | 20 | decoder_ = 0; |
21 | buffer_ = 0; | 21 | buffer_ = 0; |
22 | } | 22 | } |
23 | 23 | ||
24 | KRFBConnection::~KRFBConnection() | 24 | KRFBConnection::~KRFBConnection() |
25 | { | 25 | { |
26 | if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { | 26 | if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { |
27 | disconnectDone(); | 27 | disconnectDone(); |
28 | } | 28 | } |
29 | delete options_; | 29 | delete options_; |
30 | } | 30 | } |
31 | 31 | ||
32 | void KRFBConnection::connectTo( KRFBServer server) | 32 | void KRFBConnection::connectTo( KRFBServer server) |
33 | { | 33 | { |
34 | if ( currentState_ != Disconnected ) | 34 | if ( currentState_ != Disconnected ) |
35 | disconnect(); | 35 | disconnect(); |
36 | 36 | ||
37 | (*options_)=server; | 37 | (*options_)=server; |
38 | 38 | ||
39 | sock = new QSocket( this, "rfbSocket" ); | 39 | sock = new QSocket( this, "rfbSocket" ); |
40 | CHECK_PTR( sock ); | 40 | CHECK_PTR( sock ); |
41 | 41 | ||
42 | // Connect to something to notice connection or error | 42 | // Connect to something to notice connection or error |
43 | connect( sock, SIGNAL( error( int ) ), SLOT( gotSocketError( int ) ) ); | 43 | connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) ); |
44 | connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); | 44 | connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); |
45 | 45 | ||
46 | qWarning( "Connecting..." ); | 46 | qWarning( "Connecting..." ); |
47 | 47 | ||
48 | currentState_ = Connecting; | 48 | currentState_ = Connecting; |
49 | sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); | 49 | sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); |
50 | } | 50 | } |
51 | 51 | ||
52 | void KRFBConnection::disconnect() | 52 | void KRFBConnection::disconnect() |
53 | { | 53 | { |
54 | qWarning( "Disconnecting from server" ); | 54 | qWarning( "Disconnecting from server" ); |
55 | 55 | ||
56 | if ( ( currentState_ != Disconnected ) | 56 | if ( ( currentState_ != Disconnected ) |
57 | && ( currentState_ != Disconnecting ) | 57 | && ( currentState_ != Disconnecting ) |
58 | && sock ) { | 58 | && sock ) { |
59 | currentState_ = Disconnecting; | 59 | currentState_ = Disconnecting; |
60 | 60 | ||
61 | connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); | 61 | connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); |
62 | sock->close(); | 62 | sock->close(); |
63 | 63 | ||
64 | if ( sock->state() != QSocket::Closing ) | 64 | if ( sock->state() != QSocket::Closing ) |
65 | disconnectDone(); | 65 | disconnectDone(); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | void KRFBConnection::disconnectDone() | 69 | void KRFBConnection::disconnectDone() |
70 | { | 70 | { |
71 | currentState_ = Disconnected; | 71 | currentState_ = Disconnected; |
72 | delete sock; | 72 | delete sock; |
73 | sock = 0; | 73 | sock = 0; |
74 | minData_ = 0; | 74 | minData_ = 0; |
75 | delete updater; | 75 | delete updater; |
76 | delete decoder_; | 76 | delete decoder_; |
77 | delete buffer_; | 77 | delete buffer_; |
78 | emit disconnected(); | 78 | emit disconnected(); |
79 | } | 79 | } |
80 | 80 | ||
81 | void KRFBConnection::gotSocketConnection() | 81 | void KRFBConnection::gotSocketConnection() |
82 | { | 82 | { |
83 | currentState_ = LoggingIn; | 83 | currentState_ = LoggingIn; |
84 | 84 | ||
85 | qWarning( "Connected, logging in..." ); | 85 | qWarning( "Connected, logging in..." ); |
86 | 86 | ||
87 | static QString statusMsg = tr( "Connected" ); | 87 | static QString statusMsg = tr( "Connected" ); |
88 | emit statusChanged( statusMsg ); | 88 | emit statusChanged( statusMsg ); |
89 | 89 | ||
90 | // Do some login stuff | 90 | // Do some login stuff |
91 | login = new KRFBLogin( this ); | 91 | login = new KRFBLogin( this ); |
92 | } | 92 | } |
93 | 93 | ||
94 | void KRFBConnection::gotRFBConnection() | 94 | void KRFBConnection::gotRFBConnection() |
95 | { | 95 | { |
96 | qWarning( "Logged into server" ); | 96 | qWarning( "Logged into server" ); |
97 | 97 | ||
98 | currentState_ = Connected; | 98 | currentState_ = Connected; |
99 | emit connected(); | 99 | emit connected(); |
100 | 100 | ||
101 | // Create the decoder and start doing stuff | 101 | // Create the decoder and start doing stuff |
102 | decoder_ = new KRFBDecoder( this ); | 102 | decoder_ = new KRFBDecoder( this ); |
103 | CHECK_PTR( decoder_ ); | 103 | CHECK_PTR( decoder_ ); |
104 | 104 | ||
105 | buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" ); | 105 | buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" ); |
106 | CHECK_PTR( buffer_ ); | 106 | CHECK_PTR( buffer_ ); |
107 | decoder_->setBuffer( buffer_ ); | 107 | decoder_->setBuffer( buffer_ ); |
108 | 108 | ||
109 | connect( decoder_, SIGNAL( status( const QString & ) ), | 109 | connect( decoder_, SIGNAL( status(const QString&) ), |
110 | this, SIGNAL( statusChanged( const QString & ) ) ); | 110 | this, SIGNAL( statusChanged(const QString&) ) ); |
111 | emit loggedIn(); | 111 | emit loggedIn(); |
112 | 112 | ||
113 | decoder_->start(); | 113 | decoder_->start(); |
114 | 114 | ||
115 | updater = new QTimer; | 115 | updater = new QTimer; |
116 | connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) ); | 116 | connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) ); |
117 | updater->start( options_->updateRate ); | 117 | updater->start( options_->updateRate ); |
118 | } | 118 | } |
119 | 119 | ||
120 | void KRFBConnection::gotSocketError( int err ) | 120 | void KRFBConnection::gotSocketError( int err ) |
121 | { | 121 | { |
122 | currentState_ = Error; | 122 | currentState_ = Error; |
123 | 123 | ||
124 | // Do some error handling stuff | 124 | // Do some error handling stuff |
125 | qWarning( "KRFBConnection: Socket error %d", err ); | 125 | qWarning( "KRFBConnection: Socket error %d", err ); |
126 | 126 | ||
127 | static QString refused = tr( "Connection Refused" ); | 127 | static QString refused = tr( "Connection Refused" ); |
128 | static QString host = tr( "Host not found" ); | 128 | static QString host = tr( "Host not found" ); |
129 | static QString read = tr( "Read Error: QSocket reported an error reading\n" | 129 | static QString read = tr( "Read Error: QSocket reported an error reading\n" |
130 | "data, the remote host has probably dropped the\n" | 130 | "data, the remote host has probably dropped the\n" |
131 | "connection." ); | 131 | "connection." ); |
132 | static QString confused = tr( "QSocket reported an invalid error code" ); | 132 | static QString confused = tr( "QSocket reported an invalid error code" ); |
133 | 133 | ||
134 | QString msg; | 134 | QString msg; |
135 | switch ( err ) { | 135 | switch ( err ) { |
136 | case QSocket::ErrConnectionRefused: | 136 | case QSocket::ErrConnectionRefused: |
137 | msg = refused; | 137 | msg = refused; |
138 | break; | 138 | break; |
139 | case QSocket::ErrHostNotFound: | 139 | case QSocket::ErrHostNotFound: |
140 | msg = host; | 140 | msg = host; |
141 | break; | 141 | break; |
142 | case QSocket::ErrSocketRead: | 142 | case QSocket::ErrSocketRead: |
143 | msg = read; | 143 | msg = read; |
144 | break; | 144 | break; |
145 | default: | 145 | default: |
146 | msg = confused; | 146 | msg = confused; |
147 | }; | 147 | }; |
148 | 148 | ||
149 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); | 149 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); |
150 | delete sock; | 150 | delete sock; |
151 | sock = 0; | 151 | sock = 0; |
152 | currentState_ = Disconnected; | 152 | currentState_ = Disconnected; |
153 | 153 | ||
154 | emit error( msg ); | 154 | emit error( msg ); |
155 | } | 155 | } |
156 | 156 | ||
157 | void KRFBConnection::gotMoreData() | 157 | void KRFBConnection::gotMoreData() |
158 | { | 158 | { |
159 | assert( minData_ > 0 ); | 159 | assert( minData_ > 0 ); |
160 | 160 | ||
161 | if ( sock->size() >= minData_ ) { | 161 | if ( sock->size() >= minData_ ) { |
162 | minData_ = 0; | 162 | minData_ = 0; |
163 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); | 163 | QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); |
164 | emit gotEnoughData(); | 164 | emit gotEnoughData(); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | void KRFBConnection::waitForData( unsigned int sz ) | 168 | void KRFBConnection::waitForData( unsigned int sz ) |
169 | { | 169 | { |
170 | assert( minData_ == 0 ); | 170 | assert( minData_ == 0 ); |
171 | assert( sz > 0 ); | 171 | assert( sz > 0 ); |
172 | assert( currentState_ != Error ); | 172 | assert( currentState_ != Error ); |
173 | 173 | ||
174 | if ( sock->size() >= sz ) { | 174 | if ( sock->size() >= sz ) { |
175 | // qWarning( "No need to wait for data" ); | 175 | // qWarning( "No need to wait for data" ); |
176 | emit gotEnoughData(); | 176 | emit gotEnoughData(); |
177 | } | 177 | } |
178 | else { | 178 | else { |
179 | // qWarning( "Waiting for %u bytes", sz ); | 179 | // qWarning( "Waiting for %u bytes", sz ); |
180 | minData_ = sz; | 180 | minData_ = sz; |
181 | connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); | 181 | connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | int KRFBConnection::read( void *buf, int sz ) | 185 | int KRFBConnection::read( void *buf, int sz ) |
186 | { | 186 | { |
187 | return sock->readBlock( (char *) buf, sz ); | 187 | return sock->readBlock( (char *) buf, sz ); |
188 | } | 188 | } |
189 | 189 | ||
190 | int KRFBConnection::write( void *buf, int sz ) | 190 | int KRFBConnection::write( void *buf, int sz ) |
191 | { | 191 | { |
192 | return sock->writeBlock( (const char *) buf, sz ); | 192 | return sock->writeBlock( (const char *) buf, sz ); |
193 | } | 193 | } |
194 | 194 | ||
195 | KRFBConnection::State KRFBConnection::state() const | 195 | KRFBConnection::State KRFBConnection::state() const |
196 | { | 196 | { |
197 | return currentState_; | 197 | return currentState_; |
198 | } | 198 | } |
199 | 199 | ||
200 | void KRFBConnection::setPortBase( int base ) | 200 | void KRFBConnection::setPortBase( int base ) |
201 | { | 201 | { |
202 | portBase_ = base; | 202 | portBase_ = base; |
203 | } | 203 | } |
204 | 204 | ||
205 | int KRFBConnection::portBase() const | 205 | int KRFBConnection::portBase() const |
206 | { | 206 | { |
207 | return portBase_; | 207 | return portBase_; |
208 | } | 208 | } |
209 | 209 | ||
210 | void KRFBConnection::updateTimer() | 210 | void KRFBConnection::updateTimer() |
211 | { | 211 | { |
212 | decoder_->sendUpdateRequest( true ); | 212 | decoder_->sendUpdateRequest( true ); |
213 | } | 213 | } |
214 | 214 | ||
215 | void KRFBConnection::refresh() | 215 | void KRFBConnection::refresh() |
216 | { | 216 | { |
217 | decoder_->sendUpdateRequest( false ); | 217 | decoder_->sendUpdateRequest( false ); |
218 | } | 218 | } |
219 | 219 | ||
220 | void KRFBConnection::sendCutText( const QString &text ) | 220 | void KRFBConnection::sendCutText( const QString &text ) |
221 | { | 221 | { |
222 | decoder_->sendCutEvent( text ); | 222 | decoder_->sendCutEvent( text ); |
223 | } | 223 | } |
224 | 224 | ||
225 | const QUrl &KRFBConnection::url() | 225 | const QUrl &KRFBConnection::url() |
226 | { | 226 | { |
227 | url_.setProtocol( "vnc" ); | 227 | url_.setProtocol( "vnc" ); |
228 | url_.setPort( display() ); | 228 | url_.setPort( display() ); |
229 | url_.setHost( host() ); | 229 | url_.setHost( host() ); |
230 | url_.setPath( "/" ); | 230 | url_.setPath( "/" ); |
231 | 231 | ||
232 | return url_; | 232 | return url_; |
233 | } | 233 | } |
diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp index 0b4a757..2bbd110 100644 --- a/noncore/comm/keypebble/krfblogin.cpp +++ b/noncore/comm/keypebble/krfblogin.cpp | |||
@@ -1,244 +1,244 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | 3 | ||
4 | extern "C" { | 4 | extern "C" { |
5 | #include "vncauth.h" | 5 | #include "vncauth.h" |
6 | } | 6 | } |
7 | 7 | ||
8 | #include "krfblogin.h" | 8 | #include "krfblogin.h" |
9 | #include "krfbconnection.h" | 9 | #include "krfbconnection.h" |
10 | #include <qtimer.h> | 10 | #include <qtimer.h> |
11 | 11 | ||
12 | // The length of the various messages (used to decide how many bytes to | 12 | // The length of the various messages (used to decide how many bytes to |
13 | // wait for). | 13 | // wait for). |
14 | const int ServerVersionLength = 12; | 14 | const int ServerVersionLength = 12; |
15 | const int ClientVersionLength = 12; | 15 | const int ClientVersionLength = 12; |
16 | const int AuthSchemeLength = 4; | 16 | const int AuthSchemeLength = 4; |
17 | const int FailureReasonSizeLength = 4; | 17 | const int FailureReasonSizeLength = 4; |
18 | const int ChallengeLength = 16; | 18 | const int ChallengeLength = 16; |
19 | const int AuthResultLength = 4; | 19 | const int AuthResultLength = 4; |
20 | 20 | ||
21 | // Authentication results | 21 | // Authentication results |
22 | enum AuthResult { | 22 | enum AuthResult { |
23 | AuthOk, | 23 | AuthOk, |
24 | AuthFailed, | 24 | AuthFailed, |
25 | AuthTooMany | 25 | AuthTooMany |
26 | }; | 26 | }; |
27 | 27 | ||
28 | typedef unsigned char CARD8; | 28 | typedef unsigned char CARD8; |
29 | typedef unsigned short CARD16; | 29 | typedef unsigned short CARD16; |
30 | typedef unsigned long CARD32; | 30 | typedef unsigned long CARD32; |
31 | 31 | ||
32 | const int endianTest = 1; | 32 | const int endianTest = 1; |
33 | 33 | ||
34 | // Endian stuff | 34 | // Endian stuff |
35 | #define Swap16IfLE(s) \ | 35 | #define Swap16IfLE(s) \ |
36 | (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) | 36 | (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) |
37 | 37 | ||
38 | #define Swap32IfLE(l) \ | 38 | #define Swap32IfLE(l) \ |
39 | (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ | 39 | (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ |
40 | (((l) & 0x00ff0000) >> 8) | \ | 40 | (((l) & 0x00ff0000) >> 8) | \ |
41 | (((l) & 0x0000ff00) << 8) | \ | 41 | (((l) & 0x0000ff00) << 8) | \ |
42 | (((l) & 0x000000ff) << 24)) : (l)) | 42 | (((l) & 0x000000ff) << 24)) : (l)) |
43 | 43 | ||
44 | KRFBLogin::KRFBLogin( KRFBConnection *con ) | 44 | KRFBLogin::KRFBLogin( KRFBConnection *con ) |
45 | : QObject( con, "RFB login manager" ) | 45 | : QObject( con, "RFB login manager" ) |
46 | { | 46 | { |
47 | assert( con ); | 47 | assert( con ); |
48 | this->con = con; | 48 | this->con = con; |
49 | currentState = AwaitingServerVersion; | 49 | currentState = AwaitingServerVersion; |
50 | 50 | ||
51 | connect( this, SIGNAL( error( const QString & ) ), | 51 | connect( this, SIGNAL( error(const QString&) ), |
52 | con, SIGNAL( error( const QString & ) ) ); | 52 | con, SIGNAL( error(const QString&) ) ); |
53 | 53 | ||
54 | 54 | ||
55 | qWarning( "Waiting for server version..." ); | 55 | qWarning( "Waiting for server version..." ); |
56 | 56 | ||
57 | static QString statusMsg = tr( "Waiting for server version..." ); | 57 | static QString statusMsg = tr( "Waiting for server version..." ); |
58 | emit status( statusMsg ); | 58 | emit status( statusMsg ); |
59 | 59 | ||
60 | // Kick off the state machine | 60 | // Kick off the state machine |
61 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); | 61 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); |
62 | con->waitForData( ServerVersionLength ); | 62 | con->waitForData( ServerVersionLength ); |
63 | } | 63 | } |
64 | 64 | ||
65 | KRFBLogin::~KRFBLogin() | 65 | KRFBLogin::~KRFBLogin() |
66 | { | 66 | { |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | KRFBLogin::State KRFBLogin::state() const | 70 | KRFBLogin::State KRFBLogin::state() const |
71 | { | 71 | { |
72 | return currentState; | 72 | return currentState; |
73 | } | 73 | } |
74 | 74 | ||
75 | void KRFBLogin::gotServerVersion() | 75 | void KRFBLogin::gotServerVersion() |
76 | { | 76 | { |
77 | qWarning( "Got server version" ); | 77 | qWarning( "Got server version" ); |
78 | 78 | ||
79 | disconnect( con, SIGNAL( gotEnoughData() ), | 79 | disconnect( con, SIGNAL( gotEnoughData() ), |
80 | this, SLOT( gotServerVersion() ) ); | 80 | this, SLOT( gotServerVersion() ) ); |
81 | 81 | ||
82 | // Read the server's version message | 82 | // Read the server's version message |
83 | char serverVersion[ ServerVersionLength + 1 ]; | 83 | char serverVersion[ ServerVersionLength + 1 ]; |
84 | con->read( serverVersion, ServerVersionLength ); | 84 | con->read( serverVersion, ServerVersionLength ); |
85 | serverVersion[ ServerVersionLength ] = '\0'; | 85 | serverVersion[ ServerVersionLength ] = '\0'; |
86 | 86 | ||
87 | QCString rfbString( serverVersion, ServerVersionLength + 1 ); | 87 | QCString rfbString( serverVersion, ServerVersionLength + 1 ); |
88 | versionString = rfbString; | 88 | versionString = rfbString; |
89 | 89 | ||
90 | QRegExp regexp( "RFB [0-9][0-9][0-9]\\.[0-9][0-9][0-9]\n" ); | 90 | QRegExp regexp( "RFB [0-9][0-9][0-9]\\.[0-9][0-9][0-9]\n" ); |
91 | 91 | ||
92 | if ( rfbString.find( regexp ) == -1 ) { | 92 | if ( rfbString.find( regexp ) == -1 ) { |
93 | static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString ); | 93 | static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString ); |
94 | 94 | ||
95 | qWarning( msg ); | 95 | qWarning( msg ); |
96 | emit error( msg ); | 96 | emit error( msg ); |
97 | currentState = Error; | 97 | currentState = Error; |
98 | return; | 98 | return; |
99 | } | 99 | } |
100 | 100 | ||
101 | // Calculate the actual version number | 101 | // Calculate the actual version number |
102 | serverMajor = (serverVersion[4] - '0') * 100 | 102 | serverMajor = (serverVersion[4] - '0') * 100 |
103 | + (serverVersion[5] - '0') * 10 | 103 | + (serverVersion[5] - '0') * 10 |
104 | + (serverVersion[6] - '0'); | 104 | + (serverVersion[6] - '0'); |
105 | serverMinor = (serverVersion[8] - '0') * 100 | 105 | serverMinor = (serverVersion[8] - '0') * 100 |
106 | + (serverVersion[9] - '0') * 10 | 106 | + (serverVersion[9] - '0') * 10 |
107 | + (serverVersion[10] - '0'); | 107 | + (serverVersion[10] - '0'); |
108 | 108 | ||
109 | qWarning("Server Version: %03d.%03d", serverMajor, serverMinor ); | 109 | qWarning("Server Version: %03d.%03d", serverMajor, serverMinor ); |
110 | 110 | ||
111 | if ( serverMajor != 3 ) { | 111 | if ( serverMajor != 3 ) { |
112 | QString msg = tr( "Error: Unsupported server version, %1" ) | 112 | QString msg = tr( "Error: Unsupported server version, %1" ) |
113 | .arg( rfbString ); | 113 | .arg( rfbString ); |
114 | 114 | ||
115 | qWarning( msg ); | 115 | qWarning( msg ); |
116 | emit error( msg ); | 116 | emit error( msg ); |
117 | currentState = Error; | 117 | currentState = Error; |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | 120 | ||
121 | if ( serverMinor != 3 ) { | 121 | if ( serverMinor != 3 ) { |
122 | qWarning( "Minor version mismatch: %d", serverMinor ); | 122 | qWarning( "Minor version mismatch: %d", serverMinor ); |
123 | } | 123 | } |
124 | 124 | ||
125 | // Setup for the next state | 125 | // Setup for the next state |
126 | sendClientVersion(); | 126 | sendClientVersion(); |
127 | 127 | ||
128 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthScheme() ) ); | 128 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthScheme() ) ); |
129 | con->waitForData( AuthSchemeLength ); | 129 | con->waitForData( AuthSchemeLength ); |
130 | } | 130 | } |
131 | 131 | ||
132 | void KRFBLogin::gotAuthScheme() | 132 | void KRFBLogin::gotAuthScheme() |
133 | { | 133 | { |
134 | disconnect( con, SIGNAL( gotEnoughData() ), | 134 | disconnect( con, SIGNAL( gotEnoughData() ), |
135 | this, SLOT( gotAuthScheme() ) ); | 135 | this, SLOT( gotAuthScheme() ) ); |
136 | 136 | ||
137 | // Got data | 137 | // Got data |
138 | CARD32 scheme; | 138 | CARD32 scheme; |
139 | con->read( &scheme, AuthSchemeLength ); | 139 | con->read( &scheme, AuthSchemeLength ); |
140 | scheme = Swap32IfLE( scheme ); | 140 | scheme = Swap32IfLE( scheme ); |
141 | 141 | ||
142 | static QString statusMsgOk = tr( "Logged in" ); | 142 | static QString statusMsgOk = tr( "Logged in" ); |
143 | 143 | ||
144 | switch ( scheme ) { | 144 | switch ( scheme ) { |
145 | case 0: | 145 | case 0: |
146 | qWarning( "Failed" ); | 146 | qWarning( "Failed" ); |
147 | // Handle failure | 147 | // Handle failure |
148 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) ); | 148 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) ); |
149 | con->waitForData( FailureReasonSizeLength ); | 149 | con->waitForData( FailureReasonSizeLength ); |
150 | break; | 150 | break; |
151 | case 1: | 151 | case 1: |
152 | // Handle no auth | 152 | // Handle no auth |
153 | emit status( statusMsgOk ); | 153 | emit status( statusMsgOk ); |
154 | con->gotRFBConnection(); | 154 | con->gotRFBConnection(); |
155 | break; | 155 | break; |
156 | case 2: | 156 | case 2: |
157 | // Handle VNC auth | 157 | // Handle VNC auth |
158 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotChallenge() ) ); | 158 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotChallenge() ) ); |
159 | con->waitForData( ChallengeLength ); | 159 | con->waitForData( ChallengeLength ); |
160 | break; | 160 | break; |
161 | default: | 161 | default: |
162 | qWarning( "Unknown authentication scheme, 0x%08lx", scheme ); | 162 | qWarning( "Unknown authentication scheme, 0x%08lx", scheme ); |
163 | currentState = Error; | 163 | currentState = Error; |
164 | break; | 164 | break; |
165 | }; | 165 | }; |
166 | } | 166 | } |
167 | 167 | ||
168 | void KRFBLogin::gotChallenge() | 168 | void KRFBLogin::gotChallenge() |
169 | { | 169 | { |
170 | disconnect( con, SIGNAL( gotEnoughData() ), | 170 | disconnect( con, SIGNAL( gotEnoughData() ), |
171 | this, SLOT( gotChallenge() ) ); | 171 | this, SLOT( gotChallenge() ) ); |
172 | 172 | ||
173 | QTimer::singleShot( 0, this, SLOT(getPassword()) ); | 173 | QTimer::singleShot( 0, this, SLOT(getPassword()) ); |
174 | } | 174 | } |
175 | 175 | ||
176 | void KRFBLogin::getPassword() | 176 | void KRFBLogin::getPassword() |
177 | { | 177 | { |
178 | // Got data | 178 | // Got data |
179 | CARD8 challenge[ ChallengeLength ]; | 179 | CARD8 challenge[ ChallengeLength ]; |
180 | con->read( challenge, ChallengeLength ); | 180 | con->read( challenge, ChallengeLength ); |
181 | 181 | ||
182 | // Last chance to enter a password | 182 | // Last chance to enter a password |
183 | if ( con->options_->password.isNull() ) { | 183 | if ( con->options_->password.isNull() ) { |
184 | qWarning( "krfblogin needs a password" ); | 184 | qWarning( "krfblogin needs a password" ); |
185 | emit passwordRequired( con ); | 185 | emit passwordRequired( con ); |
186 | } | 186 | } |
187 | 187 | ||
188 | if ( con->options_->password.isNull() ) { | 188 | if ( con->options_->password.isNull() ) { |
189 | QString msg = tr( "Error: This server requires a password, but none " | 189 | QString msg = tr( "Error: This server requires a password, but none " |
190 | "has been specified.\n" ); | 190 | "has been specified.\n" ); |
191 | 191 | ||
192 | emit error( msg ); | 192 | emit error( msg ); |
193 | return; | 193 | return; |
194 | } | 194 | } |
195 | 195 | ||
196 | vncEncryptBytes( (unsigned char *) challenge, QCString(con->options_->password.latin1()).data() ); | 196 | vncEncryptBytes( (unsigned char *) challenge, QCString(con->options_->password.latin1()).data() ); |
197 | con->write( challenge, ChallengeLength ); | 197 | con->write( challenge, ChallengeLength ); |
198 | 198 | ||
199 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthResult() ) ); | 199 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthResult() ) ); |
200 | con->waitForData( AuthResultLength ); | 200 | con->waitForData( AuthResultLength ); |
201 | } | 201 | } |
202 | 202 | ||
203 | void KRFBLogin::gotFailureReasonSize() | 203 | void KRFBLogin::gotFailureReasonSize() |
204 | { | 204 | { |
205 | disconnect( con, SIGNAL( gotEnoughData() ), this, | 205 | disconnect( con, SIGNAL( gotEnoughData() ), this, |
206 | SLOT( gotFailureReasonSize() ) ); | 206 | SLOT( gotFailureReasonSize() ) ); |
207 | } | 207 | } |
208 | 208 | ||
209 | void KRFBLogin::gotAuthResult() | 209 | void KRFBLogin::gotAuthResult() |
210 | { | 210 | { |
211 | // Got data | 211 | // Got data |
212 | disconnect( con, SIGNAL( gotEnoughData() ), this, | 212 | disconnect( con, SIGNAL( gotEnoughData() ), this, |
213 | SLOT( gotAuthResult() ) ); | 213 | SLOT( gotAuthResult() ) ); |
214 | 214 | ||
215 | long result; | 215 | long result; |
216 | con->read( &result, AuthResultLength ); | 216 | con->read( &result, AuthResultLength ); |
217 | result = Swap32IfLE( result ); | 217 | result = Swap32IfLE( result ); |
218 | 218 | ||
219 | qWarning( "Authentication Result is 0x%08lx", result ); | 219 | qWarning( "Authentication Result is 0x%08lx", result ); |
220 | 220 | ||
221 | static QString failed = tr( "Error: The password you specified was incorrect." ); | 221 | static QString failed = tr( "Error: The password you specified was incorrect." ); |
222 | static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n" | 222 | static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n" |
223 | "to this account, please try later." ); | 223 | "to this account, please try later." ); |
224 | 224 | ||
225 | static QString statusMsgOk = tr( "Logged in" ); | 225 | static QString statusMsgOk = tr( "Logged in" ); |
226 | static QString statusMsgFailed = tr( "Login Failed" ); | 226 | static QString statusMsgFailed = tr( "Login Failed" ); |
227 | static QString statusMsgTooMany = tr( "Too many failures" ); | 227 | static QString statusMsgTooMany = tr( "Too many failures" ); |
228 | 228 | ||
229 | switch( result ) { | 229 | switch( result ) { |
230 | case AuthOk: | 230 | case AuthOk: |
231 | emit status( statusMsgOk ); | 231 | emit status( statusMsgOk ); |
232 | con->gotRFBConnection(); | 232 | con->gotRFBConnection(); |
233 | break; | 233 | break; |
234 | case AuthFailed: | 234 | case AuthFailed: |
235 | qWarning( "Dammit" ); | 235 | qWarning( "Dammit" ); |
236 | emit status( statusMsgFailed ); | 236 | emit status( statusMsgFailed ); |
237 | emit error( failed ); | 237 | emit error( failed ); |
238 | break; | 238 | break; |
239 | case AuthTooMany: | 239 | case AuthTooMany: |
240 | emit status( statusMsgTooMany ); | 240 | emit status( statusMsgTooMany ); |
241 | emit error( tooMany ); | 241 | emit error( tooMany ); |
242 | break; | 242 | break; |
243 | default: | 243 | default: |
244 | qWarning( "Invalid authentication result, %lx", result ); | 244 | qWarning( "Invalid authentication result, %lx", result ); |
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp index c678edf..88cb50b 100644 --- a/noncore/comm/keypebble/kvnc.cpp +++ b/noncore/comm/keypebble/kvnc.cpp | |||
@@ -1,260 +1,260 @@ | |||
1 | #include <qaction.h> | 1 | #include <qaction.h> |
2 | #include <qpopupmenu.h> | 2 | #include <qpopupmenu.h> |
3 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qlistbox.h> | 5 | #include <qlistbox.h> |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | 8 | ||
9 | #include <assert.h> | 9 | #include <assert.h> |
10 | 10 | ||
11 | #include "kvnc.h" | 11 | #include "kvnc.h" |
12 | #include "krfbcanvas.h" | 12 | #include "krfbcanvas.h" |
13 | #include "krfbconnection.h" | 13 | #include "krfbconnection.h" |
14 | #include "kvncconndlg.h" | 14 | #include "kvncconndlg.h" |
15 | 15 | ||
16 | static int u_id = 1; | 16 | static int u_id = 1; |
17 | static int get_unique_id() | 17 | static int get_unique_id() |
18 | { | 18 | { |
19 | return u_id++; | 19 | return u_id++; |
20 | } | 20 | } |
21 | 21 | ||
22 | 22 | ||
23 | /* XPM */ | 23 | /* XPM */ |
24 | static char * menu_xpm[] = { | 24 | static char * menu_xpm[] = { |
25 | "12 12 5 1", | 25 | "12 12 5 1", |
26 | " c None", | 26 | " c None", |
27 | ".c #000000", | 27 | ".c #000000", |
28 | "+c #FFFDAD", | 28 | "+c #FFFDAD", |
29 | "@c #FFFF00", | 29 | "@c #FFFF00", |
30 | "#c #E5E100", | 30 | "#c #E5E100", |
31 | " ", | 31 | " ", |
32 | " ", | 32 | " ", |
33 | " ......... ", | 33 | " ......... ", |
34 | " .+++++++. ", | 34 | " .+++++++. ", |
35 | " .+@@@@#. ", | 35 | " .+@@@@#. ", |
36 | " .+@@@#. ", | 36 | " .+@@@#. ", |
37 | " .+@@#. ", | 37 | " .+@@#. ", |
38 | " .+@#. ", | 38 | " .+@#. ", |
39 | " .+#. ", | 39 | " .+#. ", |
40 | " .+. ", | 40 | " .+. ", |
41 | " .. ", | 41 | " .. ", |
42 | " "}; | 42 | " "}; |
43 | 43 | ||
44 | const int StatusTextId = 0; | 44 | const int StatusTextId = 0; |
45 | 45 | ||
46 | KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name ,WStyle_ContextHelp) | 46 | KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name ,WStyle_ContextHelp) |
47 | { | 47 | { |
48 | setCaption( tr("VNC Viewer") ); | 48 | setCaption( tr("VNC Viewer") ); |
49 | fullscreen = false; | 49 | fullscreen = false; |
50 | 50 | ||
51 | stack = new QWidgetStack( this ); | 51 | stack = new QWidgetStack( this ); |
52 | setCentralWidget( stack ); | 52 | setCentralWidget( stack ); |
53 | 53 | ||
54 | bookmarkSelector=new KVNCBookmarkDlg(); | 54 | bookmarkSelector=new KVNCBookmarkDlg(); |
55 | stack->addWidget(bookmarkSelector,get_unique_id()); | 55 | stack->addWidget(bookmarkSelector,get_unique_id()); |
56 | stack->raiseWidget( bookmarkSelector ); | 56 | stack->raiseWidget( bookmarkSelector ); |
57 | 57 | ||
58 | canvas = new KRFBCanvas( stack, "canvas" ); | 58 | canvas = new KRFBCanvas( stack, "canvas" ); |
59 | stack->addWidget(canvas,get_unique_id()); | 59 | stack->addWidget(canvas,get_unique_id()); |
60 | setCentralWidget( stack ); | 60 | setCentralWidget( stack ); |
61 | 61 | ||
62 | 62 | ||
63 | connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem *)), | 63 | connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem*)), |
64 | this, SLOT(openConnection(QListBoxItem *)) ); | 64 | this, SLOT(openConnection(QListBoxItem*)) ); |
65 | connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), | 65 | connect( canvas->connection(), SIGNAL(statusChanged(const QString&)), |
66 | this, SLOT(statusMessage(const QString &)) ); | 66 | this, SLOT(statusMessage(const QString&)) ); |
67 | connect( canvas->connection(), SIGNAL(error(const QString &)), | 67 | connect( canvas->connection(), SIGNAL(error(const QString&)), |
68 | this, SLOT(error(const QString &)) ); | 68 | this, SLOT(error(const QString&)) ); |
69 | connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); | 69 | connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); |
70 | connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); | 70 | connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); |
71 | connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); | 71 | connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); |
72 | 72 | ||
73 | setupActions(); | 73 | setupActions(); |
74 | 74 | ||
75 | cornerButton = new QPushButton( this ); | 75 | cornerButton = new QPushButton( this ); |
76 | cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); | 76 | cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); |
77 | connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); | 77 | connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); |
78 | canvas->setCornerWidget( cornerButton ); | 78 | canvas->setCornerWidget( cornerButton ); |
79 | 79 | ||
80 | stack->raiseWidget( bookmarkSelector ); | 80 | stack->raiseWidget( bookmarkSelector ); |
81 | 81 | ||
82 | 82 | ||
83 | bar= new QToolBar( this ); | 83 | bar= new QToolBar( this ); |
84 | setToolBarsMovable( false ); | 84 | setToolBarsMovable( false ); |
85 | setRightJustification(false); | 85 | setRightJustification(false); |
86 | 86 | ||
87 | 87 | ||
88 | QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), | 88 | QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), |
89 | QString::null, 0, this, 0 ); | 89 | QString::null, 0, this, 0 ); |
90 | connect( n, SIGNAL( activated() ), | 90 | connect( n, SIGNAL( activated() ), |
91 | this, SLOT( newConnection() ) ); | 91 | this, SLOT( newConnection() ) ); |
92 | n->addTo( bar ); | 92 | n->addTo( bar ); |
93 | 93 | ||
94 | QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), | 94 | QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), |
95 | QString::null, 0, this, 0 ); | 95 | QString::null, 0, this, 0 ); |
96 | connect( o, SIGNAL( activated() ), | 96 | connect( o, SIGNAL( activated() ), |
97 | this, SLOT( openConnection() ) ); | 97 | this, SLOT( openConnection() ) ); |
98 | o->addTo( bar ); | 98 | o->addTo( bar ); |
99 | 99 | ||
100 | QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), | 100 | QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), |
101 | QString::null, 0, this, 0 ); | 101 | QString::null, 0, this, 0 ); |
102 | connect( d, SIGNAL( activated() ), | 102 | connect( d, SIGNAL( activated() ), |
103 | this, SLOT( deleteBookmark() ) ); | 103 | this, SLOT( deleteBookmark() ) ); |
104 | d->addTo( bar ); | 104 | d->addTo( bar ); |
105 | } | 105 | } |
106 | 106 | ||
107 | KVNC::~KVNC() | 107 | KVNC::~KVNC() |
108 | { | 108 | { |
109 | 109 | ||
110 | } | 110 | } |
111 | 111 | ||
112 | void KVNC::newConnection() | 112 | void KVNC::newConnection() |
113 | { | 113 | { |
114 | curServer=new KRFBServer; | 114 | curServer=new KRFBServer; |
115 | 115 | ||
116 | KVNCConnDlg dlg( curServer,this); | 116 | KVNCConnDlg dlg( curServer,this); |
117 | if ( QPEApplication::execDialog( &dlg )) { | 117 | if ( QPEApplication::execDialog( &dlg )) { |
118 | if (!curServer->name.isEmpty()) | 118 | if (!curServer->name.isEmpty()) |
119 | bookmarkSelector->addBookmark(curServer); | 119 | bookmarkSelector->addBookmark(curServer); |
120 | canvas->openConnection(*curServer); | 120 | canvas->openConnection(*curServer); |
121 | } else | 121 | } else |
122 | curServer=0; | 122 | curServer=0; |
123 | } | 123 | } |
124 | 124 | ||
125 | void KVNC::openConnection( QString name) | 125 | void KVNC::openConnection( QString name) |
126 | { | 126 | { |
127 | curServer=bookmarkSelector->getServer(name); | 127 | curServer=bookmarkSelector->getServer(name); |
128 | 128 | ||
129 | if (curServer) { | 129 | if (curServer) { |
130 | KVNCConnDlg dlg( curServer,this); | 130 | KVNCConnDlg dlg( curServer,this); |
131 | if ( QPEApplication::execDialog( &dlg ) ) { | 131 | if ( QPEApplication::execDialog( &dlg ) ) { |
132 | canvas->openConnection(*curServer); | 132 | canvas->openConnection(*curServer); |
133 | bookmarkSelector->writeBookmarks(); | 133 | bookmarkSelector->writeBookmarks(); |
134 | } else | 134 | } else |
135 | curServer=0; | 135 | curServer=0; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | void KVNC::openConnection( void ) | 139 | void KVNC::openConnection( void ) |
140 | { | 140 | { |
141 | openConnection( bookmarkSelector->selectedBookmark()); | 141 | openConnection( bookmarkSelector->selectedBookmark()); |
142 | } | 142 | } |
143 | 143 | ||
144 | void KVNC::openConnection( QListBoxItem * item) | 144 | void KVNC::openConnection( QListBoxItem * item) |
145 | { | 145 | { |
146 | if (item) | 146 | if (item) |
147 | openConnection(item->text()); | 147 | openConnection(item->text()); |
148 | } | 148 | } |
149 | 149 | ||
150 | void KVNC::setupActions() | 150 | void KVNC::setupActions() |
151 | { | 151 | { |
152 | cornerMenu = new QPopupMenu( this ); | 152 | cornerMenu = new QPopupMenu( this ); |
153 | 153 | ||
154 | fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); | 154 | fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); |
155 | connect( fullScreenAction, SIGNAL(activated()), | 155 | connect( fullScreenAction, SIGNAL(activated()), |
156 | this, SLOT( toggleFullScreen() ) ); | 156 | this, SLOT( toggleFullScreen() ) ); |
157 | fullScreenAction->addTo( cornerMenu ); | 157 | fullScreenAction->addTo( cornerMenu ); |
158 | fullScreenAction->setEnabled( false ); | 158 | fullScreenAction->setEnabled( false ); |
159 | 159 | ||
160 | ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); | 160 | ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); |
161 | connect( ctlAltDelAction, SIGNAL(activated()), | 161 | connect( ctlAltDelAction, SIGNAL(activated()), |
162 | canvas, SLOT( sendCtlAltDel() ) ); | 162 | canvas, SLOT( sendCtlAltDel() ) ); |
163 | ctlAltDelAction->addTo( cornerMenu ); | 163 | ctlAltDelAction->addTo( cornerMenu ); |
164 | ctlAltDelAction->setEnabled( false ); | 164 | ctlAltDelAction->setEnabled( false ); |
165 | 165 | ||
166 | disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); | 166 | disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); |
167 | connect( disconnectAction, SIGNAL(activated()), | 167 | connect( disconnectAction, SIGNAL(activated()), |
168 | this, SLOT( closeConnection() ) ); | 168 | this, SLOT( closeConnection() ) ); |
169 | disconnectAction->addTo( cornerMenu ); | 169 | disconnectAction->addTo( cornerMenu ); |
170 | disconnectAction->setEnabled( false ); | 170 | disconnectAction->setEnabled( false ); |
171 | 171 | ||
172 | doubleClickAction = new QAction( tr("Next Click is Double Click"), QString::null, 0, 0 ); | 172 | doubleClickAction = new QAction( tr("Next Click is Double Click"), QString::null, 0, 0 ); |
173 | connect( doubleClickAction, SIGNAL(activated()), | 173 | connect( doubleClickAction, SIGNAL(activated()), |
174 | canvas, SLOT( markDoubleClick() ) ); | 174 | canvas, SLOT( markDoubleClick() ) ); |
175 | doubleClickAction->addTo( cornerMenu ); | 175 | doubleClickAction->addTo( cornerMenu ); |
176 | doubleClickAction->setEnabled( false ); | 176 | doubleClickAction->setEnabled( false ); |
177 | 177 | ||
178 | rightClickAction = new QAction( tr("Next Click is Right Click"), QString::null, 0, 0 ); | 178 | rightClickAction = new QAction( tr("Next Click is Right Click"), QString::null, 0, 0 ); |
179 | connect( rightClickAction, SIGNAL(activated()), | 179 | connect( rightClickAction, SIGNAL(activated()), |
180 | canvas, SLOT( markRightClick() ) ); | 180 | canvas, SLOT( markRightClick() ) ); |
181 | rightClickAction->addTo( cornerMenu ); | 181 | rightClickAction->addTo( cornerMenu ); |
182 | rightClickAction->setEnabled( false ); | 182 | rightClickAction->setEnabled( false ); |
183 | } | 183 | } |
184 | 184 | ||
185 | void KVNC::toggleFullScreen() | 185 | void KVNC::toggleFullScreen() |
186 | { | 186 | { |
187 | if ( fullscreen ) { | 187 | if ( fullscreen ) { |
188 | canvas->releaseKeyboard(); | 188 | canvas->releaseKeyboard(); |
189 | canvas->reparent( stack, 0, QPoint(0,0), false ); | 189 | canvas->reparent( stack, 0, QPoint(0,0), false ); |
190 | canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 190 | canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
191 | setCentralWidget( stack ); | 191 | setCentralWidget( stack ); |
192 | stack->addWidget(canvas,get_unique_id()); | 192 | stack->addWidget(canvas,get_unique_id()); |
193 | stack->raiseWidget(canvas); | 193 | stack->raiseWidget(canvas); |
194 | canvas->show(); | 194 | canvas->show(); |
195 | stack->show(); | 195 | stack->show(); |
196 | fullScreenAction->setText( tr("Full Screen") ); | 196 | fullScreenAction->setText( tr("Full Screen") ); |
197 | } else { | 197 | } else { |
198 | canvas->setFrameStyle( QFrame::NoFrame ); | 198 | canvas->setFrameStyle( QFrame::NoFrame ); |
199 | stack->removeWidget(canvas); | 199 | stack->removeWidget(canvas); |
200 | canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, | 200 | canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, |
201 | QPoint(0,0),false); | 201 | QPoint(0,0),false); |
202 | canvas->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 202 | canvas->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
203 | canvas->raise(); | 203 | canvas->raise(); |
204 | canvas->setFocus(); | 204 | canvas->setFocus(); |
205 | canvas->grabKeyboard(); | 205 | canvas->grabKeyboard(); |
206 | canvas->show(); | 206 | canvas->show(); |
207 | 207 | ||
208 | fullScreenAction->setText( tr("Stop Full Screen") ); | 208 | fullScreenAction->setText( tr("Stop Full Screen") ); |
209 | } | 209 | } |
210 | 210 | ||
211 | 211 | ||
212 | fullscreen = !fullscreen; | 212 | fullscreen = !fullscreen; |
213 | } | 213 | } |
214 | 214 | ||
215 | void KVNC::closeConnection() | 215 | void KVNC::closeConnection() |
216 | { | 216 | { |
217 | if ( fullscreen ) | 217 | if ( fullscreen ) |
218 | toggleFullScreen(); | 218 | toggleFullScreen(); |
219 | canvas->closeConnection(); | 219 | canvas->closeConnection(); |
220 | } | 220 | } |
221 | 221 | ||
222 | void KVNC::showMenu() | 222 | void KVNC::showMenu() |
223 | { | 223 | { |
224 | QPoint pt = mapToGlobal(cornerButton->pos()); | 224 | QPoint pt = mapToGlobal(cornerButton->pos()); |
225 | QSize s = cornerMenu->sizeHint(); | 225 | QSize s = cornerMenu->sizeHint(); |
226 | pt.ry() -= s.height(); | 226 | pt.ry() -= s.height(); |
227 | pt.rx() -= s.width(); | 227 | pt.rx() -= s.width(); |
228 | cornerMenu->popup( pt ); | 228 | cornerMenu->popup( pt ); |
229 | } | 229 | } |
230 | 230 | ||
231 | void KVNC::connected() | 231 | void KVNC::connected() |
232 | { | 232 | { |
233 | static QString msg = tr( "Connected to remote host" ); | 233 | static QString msg = tr( "Connected to remote host" ); |
234 | statusMessage( msg ); | 234 | statusMessage( msg ); |
235 | ctlAltDelAction->setEnabled(true); | 235 | ctlAltDelAction->setEnabled(true); |
236 | disconnectAction->setEnabled( true ); | 236 | disconnectAction->setEnabled( true ); |
237 | fullScreenAction->setEnabled( true ); | 237 | fullScreenAction->setEnabled( true ); |
238 | doubleClickAction->setEnabled( false ); | 238 | doubleClickAction->setEnabled( false ); |
239 | rightClickAction->setEnabled( true ); | 239 | rightClickAction->setEnabled( true ); |
240 | stack->raiseWidget(canvas); | 240 | stack->raiseWidget(canvas); |
241 | bar->hide(); | 241 | bar->hide(); |
242 | } | 242 | } |
243 | 243 | ||
244 | void KVNC::loggedIn() | 244 | void KVNC::loggedIn() |
245 | { | 245 | { |
246 | static QString msg = tr( "Logged in to remote host" ); | 246 | static QString msg = tr( "Logged in to remote host" ); |
247 | statusMessage( msg ); | 247 | statusMessage( msg ); |
248 | } | 248 | } |
249 | 249 | ||
250 | void KVNC::disconnected() | 250 | void KVNC::disconnected() |
251 | { | 251 | { |
252 | 252 | ||
253 | if ( fullscreen ) | 253 | if ( fullscreen ) |
254 | toggleFullScreen(); | 254 | toggleFullScreen(); |
255 | static QString msg = tr( "Connection closed" ); | 255 | static QString msg = tr( "Connection closed" ); |
256 | statusMessage( msg ); | 256 | statusMessage( msg ); |
257 | ctlAltDelAction->setEnabled(false); | 257 | ctlAltDelAction->setEnabled(false); |
258 | disconnectAction->setEnabled( false ); | 258 | disconnectAction->setEnabled( false ); |
259 | fullScreenAction->setEnabled( false ); | 259 | fullScreenAction->setEnabled( false ); |
260 | doubleClickAction->setEnabled( false ); | 260 | doubleClickAction->setEnabled( false ); |