author | treke <treke> | 2002-09-04 17:53:12 (UTC) |
---|---|---|
committer | treke <treke> | 2002-09-04 17:53:12 (UTC) |
commit | 605d854057eb470a1d75210193b82eb0b1ad6b53 (patch) (unidiff) | |
tree | c411b661d5211fefbd83a7c8f63eef8c9cca72ee /noncore/comm/keypebble/krfblogin.cpp | |
parent | c35a5eabd8f5ed18e4216f6c88ee6794bacfb491 (diff) | |
download | opie-605d854057eb470a1d75210193b82eb0b1ad6b53.zip opie-605d854057eb470a1d75210193b82eb0b1ad6b53.tar.gz opie-605d854057eb470a1d75210193b82eb0b1ad6b53.tar.bz2 |
Major modifications to the User Interface
1) Bookmark support added, all options are stored on a per bookmark basis
2) 16 Bit color is now a supported bit depth for the server
Diffstat (limited to 'noncore/comm/keypebble/krfblogin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfblogin.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp index cc3a8fa..0d2a205 100644 --- a/noncore/comm/keypebble/krfblogin.cpp +++ b/noncore/comm/keypebble/krfblogin.cpp | |||
@@ -31,50 +31,48 @@ typedef unsigned short CARD16; | |||
31 | typedef unsigned long CARD32; | 31 | typedef unsigned long CARD32; |
32 | 32 | ||
33 | const int endianTest = 1; | 33 | const int endianTest = 1; |
34 | 34 | ||
35 | // Endian stuff | 35 | // Endian stuff |
36 | #define Swap16IfLE(s) \ | 36 | #define Swap16IfLE(s) \ |
37 | (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) | 37 | (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) |
38 | 38 | ||
39 | #define Swap32IfLE(l) \ | 39 | #define Swap32IfLE(l) \ |
40 | (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ | 40 | (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ |
41 | (((l) & 0x00ff0000) >> 8) | \ | 41 | (((l) & 0x00ff0000) >> 8) | \ |
42 | (((l) & 0x0000ff00) << 8) | \ | 42 | (((l) & 0x0000ff00) << 8) | \ |
43 | (((l) & 0x000000ff) << 24)) : (l)) | 43 | (((l) & 0x000000ff) << 24)) : (l)) |
44 | 44 | ||
45 | KRFBLogin::KRFBLogin( KRFBConnection *con ) | 45 | KRFBLogin::KRFBLogin( KRFBConnection *con ) |
46 | : QObject( con, "RFB login manager" ) | 46 | : QObject( con, "RFB login manager" ) |
47 | { | 47 | { |
48 | assert( con ); | 48 | assert( con ); |
49 | this->con = con; | 49 | this->con = con; |
50 | currentState = AwaitingServerVersion; | 50 | currentState = AwaitingServerVersion; |
51 | 51 | ||
52 | connect( this, SIGNAL( error( const QString & ) ), | 52 | connect( this, SIGNAL( error( const QString & ) ), |
53 | con, SIGNAL( error( const QString & ) ) ); | 53 | con, SIGNAL( error( const QString & ) ) ); |
54 | 54 | ||
55 | connect( this, SIGNAL( passwordRequired( KRFBConnection * ) ), | ||
56 | con, SIGNAL( passwordRequired( KRFBConnection * ) ) ); | ||
57 | 55 | ||
58 | qWarning( "Waiting for server version..." ); | 56 | qWarning( "Waiting for server version..." ); |
59 | 57 | ||
60 | static QString statusMsg = tr( "Waiting for server version..." ); | 58 | static QString statusMsg = tr( "Waiting for server version..." ); |
61 | emit status( statusMsg ); | 59 | emit status( statusMsg ); |
62 | 60 | ||
63 | // Kick off the state machine | 61 | // Kick off the state machine |
64 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); | 62 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); |
65 | con->waitForData( ServerVersionLength ); | 63 | con->waitForData( ServerVersionLength ); |
66 | } | 64 | } |
67 | 65 | ||
68 | KRFBLogin::~KRFBLogin() | 66 | KRFBLogin::~KRFBLogin() |
69 | { | 67 | { |
70 | 68 | ||
71 | } | 69 | } |
72 | 70 | ||
73 | KRFBLogin::State KRFBLogin::state() const | 71 | KRFBLogin::State KRFBLogin::state() const |
74 | { | 72 | { |
75 | return currentState; | 73 | return currentState; |
76 | } | 74 | } |
77 | 75 | ||
78 | void KRFBLogin::gotServerVersion() | 76 | void KRFBLogin::gotServerVersion() |
79 | { | 77 | { |
80 | qWarning( "Got server version" ); | 78 | qWarning( "Got server version" ); |
@@ -162,62 +160,62 @@ void KRFBLogin::gotAuthScheme() | |||
162 | con->waitForData( ChallengeLength ); | 160 | con->waitForData( ChallengeLength ); |
163 | break; | 161 | break; |
164 | default: | 162 | default: |
165 | qWarning( "Unknown authentication scheme, 0x%08lx", scheme ); | 163 | qWarning( "Unknown authentication scheme, 0x%08lx", scheme ); |
166 | currentState = Error; | 164 | currentState = Error; |
167 | break; | 165 | break; |
168 | }; | 166 | }; |
169 | } | 167 | } |
170 | 168 | ||
171 | void KRFBLogin::gotChallenge() | 169 | void KRFBLogin::gotChallenge() |
172 | { | 170 | { |
173 | disconnect( con, SIGNAL( gotEnoughData() ), | 171 | disconnect( con, SIGNAL( gotEnoughData() ), |
174 | this, SLOT( gotChallenge() ) ); | 172 | this, SLOT( gotChallenge() ) ); |
175 | 173 | ||
176 | QTimer::singleShot( 0, this, SLOT(getPassword()) ); | 174 | QTimer::singleShot( 0, this, SLOT(getPassword()) ); |
177 | } | 175 | } |
178 | 176 | ||
179 | void KRFBLogin::getPassword() | 177 | void KRFBLogin::getPassword() |
180 | { | 178 | { |
181 | // Got data | 179 | // Got data |
182 | CARD8 challenge[ ChallengeLength ]; | 180 | CARD8 challenge[ ChallengeLength ]; |
183 | con->read( challenge, ChallengeLength ); | 181 | con->read( challenge, ChallengeLength ); |
184 | 182 | ||
185 | // Last chance to enter a password | 183 | // Last chance to enter a password |
186 | if ( con->pass_.isNull() ) { | 184 | if ( con->options_->password.isNull() ) { |
187 | qWarning( "krfblogin needs a password" ); | 185 | qWarning( "krfblogin needs a password" ); |
188 | emit passwordRequired( con ); | 186 | emit passwordRequired( con ); |
189 | } | 187 | } |
190 | 188 | ||
191 | if ( con->pass_.isNull() ) { | 189 | if ( con->options_->password.isNull() ) { |
192 | QString msg = tr( "Error: This server requires a password, but none " | 190 | QString msg = tr( "Error: This server requires a password, but none " |
193 | "has been specified.\n" ); | 191 | "has been specified.\n" ); |
194 | 192 | ||
195 | emit error( msg ); | 193 | emit error( msg ); |
196 | return; | 194 | return; |
197 | } | 195 | } |
198 | 196 | ||
199 | vncEncryptBytes( (unsigned char *) challenge, con->pass_.data() ); | 197 | vncEncryptBytes( (unsigned char *) challenge, QCString(con->options_->password.latin1()).data() ); |
200 | con->write( challenge, ChallengeLength ); | 198 | con->write( challenge, ChallengeLength ); |
201 | 199 | ||
202 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthResult() ) ); | 200 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthResult() ) ); |
203 | con->waitForData( AuthResultLength ); | 201 | con->waitForData( AuthResultLength ); |
204 | } | 202 | } |
205 | 203 | ||
206 | void KRFBLogin::gotFailureReasonSize() | 204 | void KRFBLogin::gotFailureReasonSize() |
207 | { | 205 | { |
208 | disconnect( con, SIGNAL( gotEnoughData() ), this, | 206 | disconnect( con, SIGNAL( gotEnoughData() ), this, |
209 | SLOT( gotFailureReasonSize() ) ); | 207 | SLOT( gotFailureReasonSize() ) ); |
210 | } | 208 | } |
211 | 209 | ||
212 | void KRFBLogin::gotAuthResult() | 210 | void KRFBLogin::gotAuthResult() |
213 | { | 211 | { |
214 | // Got data | 212 | // Got data |
215 | disconnect( con, SIGNAL( gotEnoughData() ), this, | 213 | disconnect( con, SIGNAL( gotEnoughData() ), this, |
216 | SLOT( gotAuthResult() ) ); | 214 | SLOT( gotAuthResult() ) ); |
217 | 215 | ||
218 | long result; | 216 | long result; |
219 | con->read( &result, AuthResultLength ); | 217 | con->read( &result, AuthResultLength ); |
220 | result = Swap32IfLE( result ); | 218 | result = Swap32IfLE( result ); |
221 | 219 | ||
222 | qWarning( "Authentication Result is 0x%08lx", result ); | 220 | qWarning( "Authentication Result is 0x%08lx", result ); |
223 | 221 | ||