summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/loginwindowimpl.cpp25
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp1
2 files changed, 22 insertions, 4 deletions
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp
index 547a9b3..b9a286d 100644
--- a/core/opie-login/loginwindowimpl.cpp
+++ b/core/opie-login/loginwindowimpl.cpp
@@ -196,64 +196,81 @@ void LoginWindowImpl::backlight ( )
196class WaitLogo : public QLabel { 196class WaitLogo : public QLabel {
197public: 197public:
198 WaitLogo ( ) : QLabel ( 0, "wait hack!", WStyle_Customize | WStyle_NoBorder | WStyle_Tool ) 198 WaitLogo ( ) : QLabel ( 0, "wait hack!", WStyle_Customize | WStyle_NoBorder | WStyle_Tool )
199 { 199 {
200 setPixmap( Opie::Core::OResource::loadPixmap( "launcher/new_wait" ) ); 200 setPixmap( Opie::Core::OResource::loadPixmap( "launcher/new_wait" ) );
201 setAlignment ( AlignCenter ); 201 setAlignment ( AlignCenter );
202 move ( 0, 0 ); 202 move ( 0, 0 );
203 resize ( qApp-> desktop ( )-> width ( ), qApp-> desktop ( )-> height ( )); 203 resize ( qApp-> desktop ( )-> width ( ), qApp-> desktop ( )-> height ( ));
204 204
205 m_visible = false; 205 m_visible = false;
206 show ( ); 206 show ( );
207 } 207 }
208 208
209 virtual void showEvent ( QShowEvent *e ) 209 virtual void showEvent ( QShowEvent *e )
210 { 210 {
211 QLabel::showEvent ( e ); 211 QLabel::showEvent ( e );
212 m_visible = true; 212 m_visible = true;
213 } 213 }
214 214
215 virtual void paintEvent ( QPaintEvent *e ) 215 virtual void paintEvent ( QPaintEvent *e )
216 { 216 {
217 QLabel::paintEvent ( e ); 217 QLabel::paintEvent ( e );
218 if ( m_visible ) 218 if ( m_visible )
219 qApp-> quit ( ); 219 qApp-> quit ( );
220 } 220 }
221 221
222private: 222private:
223 bool m_visible; 223 bool m_visible;
224}; 224};
225 225
226void LoginWindowImpl::login ( ) 226void LoginWindowImpl::login ( )
227{ 227{
228 const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); 228 char *const user = ::strdup ( m_user-> currentText ( ). local8Bit ( ));
229 const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); 229 char *pass = ::strdup ( m_password-> text ( ). local8Bit ( ));
230 230
231 if ( !user || !user [0] ) 231 if ( !user ) {
232 if ( pass )
233 free( pass );
232 return; 234 return;
233 if ( !pass ) 235 }
236 if ( !user [0] ) {
237 free( user );
238 if ( pass )
239 free( pass );
240 return;
241 }
242 bool passwordIsEmpty = false;
243 if ( !pass ) {
244 passwordIsEmpty = true;
234 pass = ""; 245 pass = "";
246 }
235 247
236 if ( lApp-> checkPassword ( user, pass )) { 248 if ( lApp-> checkPassword ( user, pass )) {
249 if ( !passwordIsEmpty )
250 free(pass);
237 Config cfg ( "opie-login" ); 251 Config cfg ( "opie-login" );
238 cfg. setGroup ( "General" ); 252 cfg. setGroup ( "General" );
239 cfg. writeEntry ( "LastLogin", user ); 253 cfg. writeEntry ( "LastLogin", user );
240 cfg. write ( ); 254 cfg. write ( );
241 255
242 lApp-> setLoginAs ( user ); 256 lApp-> setLoginAs ( user );
243 257
244 // Draw a big wait icon, the image can be altered in later revisions 258 // Draw a big wait icon, the image can be altered in later revisions
245 m_input-> hideInputMethod ( ); 259 m_input-> hideInputMethod ( );
246 new WaitLogo ( ); 260 new WaitLogo ( );
247 // WaitLogo::showEvent() calls qApp-> quit() 261 // WaitLogo::showEvent() calls qApp-> quit()
248 } 262 }
249 else { 263 else {
250 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); 264 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." ));
251 m_password-> clear ( ); 265 m_password-> clear ( );
266 free( user );
267 if ( !passwordIsEmpty )
268 free( pass );
252 } 269 }
253} 270}
254 271
255void LoginWindowImpl::showPasswordDialog() { 272void LoginWindowImpl::showPasswordDialog() {
256 PasswordDialogImpl dia( this ); 273 PasswordDialogImpl dia( this );
257 dia.showMaximized(); 274 dia.showMaximized();
258 dia.exec(); 275 dia.exec();
259} 276}
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp
index 28f6318..00141a3 100644
--- a/noncore/apps/opie-reader/Bkmks.cpp
+++ b/noncore/apps/opie-reader/Bkmks.cpp
@@ -290,64 +290,65 @@ CList<Bkmk>* BkmkFile::readall()
290CList<Bkmk>* BkmkFile::readall00(Bkmk* (*readfn)(BkmkFile*, FILE*)) 290CList<Bkmk>* BkmkFile::readall00(Bkmk* (*readfn)(BkmkFile*, FILE*))
291{ 291{
292 CList<Bkmk>* bl = new CList<Bkmk>; 292 CList<Bkmk>* bl = new CList<Bkmk>;
293 while (1) 293 while (1)
294 { 294 {
295 Bkmk* b = (*readfn)(this, f); 295 Bkmk* b = (*readfn)(this, f);
296 if (b == NULL) break; 296 if (b == NULL) break;
297 bl->push_back(*b); 297 bl->push_back(*b);
298 delete b; 298 delete b;
299 } 299 }
300 return bl; 300 return bl;
301} 301}
302 302
303Bkmk* BkmkFile::read03(BkmkFile* /*_this*/, FILE* f) 303Bkmk* BkmkFile::read03(BkmkFile* /*_this*/, FILE* f)
304{ 304{
305 Bkmk* b = NULL; 305 Bkmk* b = NULL;
306 if (f != NULL) 306 if (f != NULL)
307 { 307 {
308 unsigned short ln; 308 unsigned short ln;
309 if (fread(&ln,sizeof(ln),1,f) == 1) 309 if (fread(&ln,sizeof(ln),1,f) == 1)
310 { 310 {
311 tchar* name = new tchar[ln+1]; 311 tchar* name = new tchar[ln+1];
312 fread(name,sizeof(tchar),ln,f); 312 fread(name,sizeof(tchar),ln,f);
313 name[ln] = 0; 313 name[ln] = 0;
314 314
315 ln = 0; 315 ln = 0;
316 tchar* anno = new tchar[ln+1]; 316 tchar* anno = new tchar[ln+1];
317 anno[ln] = 0; 317 anno[ln] = 0;
318 318
319 unsigned int pos; 319 unsigned int pos;
320 fread(&pos,sizeof(pos),1,f); 320 fread(&pos,sizeof(pos),1,f);
321 b = new Bkmk(name,anno,pos); 321 b = new Bkmk(name,anno,pos);
322 delete [] anno;
322 } 323 }
323 } 324 }
324 return b; 325 return b;
325} 326}
326 327
327Bkmk* BkmkFile::read05(BkmkFile* /*_this*/, FILE* f) 328Bkmk* BkmkFile::read05(BkmkFile* /*_this*/, FILE* f)
328{ 329{
329 Bkmk* b = NULL; 330 Bkmk* b = NULL;
330 if (f != NULL) 331 if (f != NULL)
331 { 332 {
332 unsigned short ln; 333 unsigned short ln;
333 if (fread(&ln,sizeof(ln),1,f) == 1) 334 if (fread(&ln,sizeof(ln),1,f) == 1)
334 { 335 {
335 tchar* nm = new tchar[ln+1]; 336 tchar* nm = new tchar[ln+1];
336 fread(nm,sizeof(tchar),ln,f); 337 fread(nm,sizeof(tchar),ln,f);
337 nm[ln] = 0; 338 nm[ln] = 0;
338 fread(&ln,sizeof(ln),1,f); 339 fread(&ln,sizeof(ln),1,f);
339 tchar* anno = new tchar[ln+1]; 340 tchar* anno = new tchar[ln+1];
340 if (ln > 0) fread(anno,sizeof(tchar),ln,f); 341 if (ln > 0) fread(anno,sizeof(tchar),ln,f);
341 anno[ln] = 0; 342 anno[ln] = 0;
342 unsigned int pos; 343 unsigned int pos;
343 fread(&pos,sizeof(pos),1,f); 344 fread(&pos,sizeof(pos),1,f);
344 b = new Bkmk(nm,anno,pos); 345 b = new Bkmk(nm,anno,pos);
345 } 346 }
346 } 347 }
347 return b; 348 return b;
348} 349}
349 350
350Bkmk* BkmkFile::read06(BkmkFile* /*_this*/, FILE* f) 351Bkmk* BkmkFile::read06(BkmkFile* /*_this*/, FILE* f)
351{ 352{
352 Bkmk* b = NULL; 353 Bkmk* b = NULL;
353 if (f != NULL) 354 if (f != NULL)