summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/krfblogin.cpp
Unidiff
Diffstat (limited to 'noncore/comm/keypebble/krfblogin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfblogin.cpp8
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
@@ -43,26 +43,24 @@ const int endianTest = 1;
43 (((l) & 0x000000ff) << 24)) : (l)) 43 (((l) & 0x000000ff) << 24)) : (l))
44 44
45KRFBLogin::KRFBLogin( KRFBConnection *con ) 45KRFBLogin::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
68KRFBLogin::~KRFBLogin() 66KRFBLogin::~KRFBLogin()
@@ -174,38 +172,38 @@ void KRFBLogin::gotChallenge()
174 this, SLOT( gotChallenge() ) ); 172 this, SLOT( gotChallenge() ) );
175 173
176 QTimer::singleShot( 0, this, SLOT(getPassword()) ); 174 QTimer::singleShot( 0, this, SLOT(getPassword()) );
177} 175}
178 176
179void KRFBLogin::getPassword() 177void 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
206void KRFBLogin::gotFailureReasonSize() 204void 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