summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-05-26 16:17:16 (UTC)
committer mickeyl <mickeyl>2004-05-26 16:17:16 (UTC)
commit9a79c3bb271234396696dc54ee52f2a0c2a461d6 (patch) (unidiff)
treefeedc8e51e45f24fbfe376dd18523c14a1c30433
parent2b7ebd326a7e6456471bb973b14b4ad7affb9a9d (diff)
downloadopie-9a79c3bb271234396696dc54ee52f2a0c2a461d6.zip
opie-9a79c3bb271234396696dc54ee52f2a0c2a461d6.tar.gz
opie-9a79c3bb271234396696dc54ee52f2a0c2a461d6.tar.bz2
BUGFIX: Fixed ZSafe not starting up (Bug #1324)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/apps/zsafe/zsafe.cpp59
2 files changed, 16 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index de27eb5..c8da96a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,47 +1,48 @@
1 2004-??-??The Opie Team <opie@handhelds.org> 1 2004-??-??The Opie Team <opie@handhelds.org>
2 2
3 * Fixed ZSafe not starting up (Bug #1324) (mickeyl)
3 * Fixed Drawpad initialization (Bug #1314) (mickeyl) 4 * Fixed Drawpad initialization (Bug #1314) (mickeyl)
4 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 5 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
5 * Added Conversion tool for pim-data (eilers) 6 * Added Conversion tool for pim-data (eilers)
6 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers) 7 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers)
7 8
8 2004-25-04The Opie Team <opie@handhelds.org> 9 2004-25-04The Opie Team <opie@handhelds.org>
9 10
10 * Released as Version 1.1.3 (devel) 11 * Released as Version 1.1.3 (devel)
11 * Introduced first implementation of SQL-Support using SQLite (eilers) 12 * Introduced first implementation of SQL-Support using SQLite (eilers)
12 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 13 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
13 * Added a real system graffiti character set (brad) 14 * Added a real system graffiti character set (brad)
14 * Added Generic Keyconfig Widget (zecke) 15 * Added Generic Keyconfig Widget (zecke)
15 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 16 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
16 * Added new Bible reader app - opie-dagger (drw) 17 * Added new Bible reader app - opie-dagger (drw)
17 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 18 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
18 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 19 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
19 * Enabled the possibility to pass command line arguments to applications (mickeyl) 20 * Enabled the possibility to pass command line arguments to applications (mickeyl)
20 * Added an about applet showing some credits and information about Opie (mickeyl) 21 * Added an about applet showing some credits and information about Opie (mickeyl)
21 * Added benchmarking functionality to sysinfo (mickeyl) 22 * Added benchmarking functionality to sysinfo (mickeyl)
22 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 23 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
23 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 24 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
24 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 25 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
25 * Clean-up of package information in control files (drw) 26 * Clean-up of package information in control files (drw)
26 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 27 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
27 * Improved big-screen support (zecke,ar) 28 * Improved big-screen support (zecke,ar)
28 * Improved multikeyboard support, added keyboard layout switching applet (mouse) 29 * Improved multikeyboard support, added keyboard layout switching applet (mouse)
29 * Added a new mail client based on libetpan (harlekin,alwin,jgf) 30 * Added a new mail client based on libetpan (harlekin,alwin,jgf)
30 * Added new package manager - opie-packagemanager (drw) 31 * Added new package manager - opie-packagemanager (drw)
31 * Improved light-n-power for C7x0 (mickeyl) 32 * Improved light-n-power for C7x0 (mickeyl)
32 * Added automatic rotation support for C7x0 (treke) 33 * Added automatic rotation support for C7x0 (treke)
33 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) 34 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl)
34 * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 35 * Added scanning the wireless network neighbourhood to networksettings (mickeyl)
35 36
36 2003-11-29The Opie Team <opie@handhelds.org> 37 2003-11-29The Opie Team <opie@handhelds.org>
37 38
38 * Released as Version 1.0.3 39 * Released as Version 1.0.3
39 * Improved i18n (various contributors) 40 * Improved i18n (various contributors)
40 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) 41 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin)
41 * Made the Documents Tab optional (mickeyl) 42 * Made the Documents Tab optional (mickeyl)
42 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 43 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken)
43 44
44 2003-08-04The Opie Team <opie@handhelds.org> 45 2003-08-04The Opie Team <opie@handhelds.org>
45 46
46 * Released as Version 1.0.0 47 * Released as Version 1.0.0
47 * Including a PPP module for easy dial up (tille,harlekin,zecke) 48 * Including a PPP module for easy dial up (tille,harlekin,zecke)
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index bf8f7f4..6ff05ac 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -426,181 +426,152 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
426 conf = new Config (cfgFile, Config::File); 426 conf = new Config (cfgFile, Config::File);
427 conf->setGroup ("zsafePrefs"); 427 conf->setGroup ("zsafePrefs");
428#endif 428#endif
429#ifdef DESKTOP 429#ifdef DESKTOP
430// #ifndef WIN32 430// #ifndef WIN32
431 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); 431 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false);
432// #endif 432// #endif
433#else 433#else
434 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); 434 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0);
435#endif 435#endif
436#ifndef DESKTOP 436#ifndef DESKTOP
437 conf->setGroup ("zsafe"); 437 conf->setGroup ("zsafe");
438#endif 438#endif
439 439
440 QPixmap copy_img((const char**) copy_xpm); 440 QPixmap copy_img((const char**) copy_xpm);
441 QPixmap cut_img((const char**) cut_xpm); 441 QPixmap cut_img((const char**) cut_xpm);
442 QPixmap edit_img((const char**) edit_xpm); 442 QPixmap edit_img((const char**) edit_xpm);
443 QPixmap editdelete_img((const char**) editdelete_xpm); 443 QPixmap editdelete_img((const char**) editdelete_xpm);
444 QPixmap find_img((const char**) find_xpm); 444 QPixmap find_img((const char**) find_xpm);
445 QPixmap folder_open_img((const char**) folder_open_xpm); 445 QPixmap folder_open_img((const char**) folder_open_xpm);
446 QPixmap help_icon_img((const char**) help_icon_xpm); 446 QPixmap help_icon_img((const char**) help_icon_xpm);
447 QPixmap new_img((const char**) new_xpm); 447 QPixmap new_img((const char**) new_xpm);
448 QPixmap paste_img((const char**) paste_xpm); 448 QPixmap paste_img((const char**) paste_xpm);
449 QPixmap quit_icon_img((const char**) quit_icon_xpm); 449 QPixmap quit_icon_img((const char**) quit_icon_xpm);
450 QPixmap save_img((const char**) save_xpm); 450 QPixmap save_img((const char**) save_xpm);
451 QPixmap trash_img((const char**) trash_xpm); 451 QPixmap trash_img((const char**) trash_xpm);
452 QPixmap expand_img((const char**) expand_xpm); 452 QPixmap expand_img((const char**) expand_xpm);
453 QPixmap export_img((const char**) export_xpm); 453 QPixmap export_img((const char**) export_xpm);
454 QPixmap import_img((const char**) import_xpm); 454 QPixmap import_img((const char**) import_xpm);
455 455
456 QPixmap bank_cards( ( const char** ) bank_cards_data ); 456 QPixmap bank_cards( ( const char** ) bank_cards_data );
457 QPixmap passwords( ( const char** ) passwords_data ); 457 QPixmap passwords( ( const char** ) passwords_data );
458 QPixmap software( ( const char** ) software_data ); 458 QPixmap software( ( const char** ) software_data );
459 QPixmap general( ( const char** ) general_data ); 459 QPixmap general( ( const char** ) general_data );
460 if ( !name ) 460 if ( !name )
461 setName( "ZSafe" ); 461 setName( "ZSafe" );
462 462
463#ifdef DESKTOP 463#ifdef DESKTOP
464#ifdef WIN32 464#ifdef WIN32
465 setGeometry(100, 150, DeskW, DeskH-30 ); 465 setGeometry(100, 150, DeskW, DeskH-30 );
466#else 466#else
467 resize( DeskW, DeskH-30 ); 467 resize( DeskW, DeskH-30 );
468#endif 468#endif
469 469
470#else 470#else
471 471
472#ifdef JPATCH_HDE 472#ifdef JPATCH_HDE
473 int DeskS; 473 int DeskS;
474 if(DeskW > DeskH) 474 if(DeskW > DeskH)
475 { 475 {
476 DeskS = DeskW; 476 DeskS = DeskW;
477 } 477 }
478 else 478 else
479 { 479 {
480 DeskS = DeskH; 480 DeskS = DeskH;
481 } 481 }
482 resize( DeskW, DeskH ); 482 resize( DeskW, DeskH );
483 setMinimumSize( QSize( DeskS, DeskS ) ); 483 setMinimumSize( QSize( DeskS, DeskS ) );
484 setMaximumSize( QSize( DeskS, DeskS ) ); 484 setMaximumSize( QSize( DeskS, DeskS ) );
485#else 485#else
486 resize( DeskW, DeskH-30 ); 486 resize( DeskW, DeskH-30 );
487#endif 487#endif
488 488
489#endif 489#endif
490 // setCaption( tr( "ZSafe" ) ); 490 setCaption( tr( "ZSafe" ) );
491 491 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe";
492 filename = conf->readEntry(APP_KEY+"document"); 492 QString filename = conf->readEntry(APP_KEY+"document");
493 if (filename.isEmpty() || filename.isNull()) 493 if (filename.isEmpty() || filename.isNull())
494 { 494 {
495 495 if ( !QDir( zsafeAppDirPath ).exists() )
496 // check if the directory application exists, if not
497 // create it
498// #ifndef WIN32
499 // QString d1("Documents/application");
500// #else
501 QString d1(QDir::homeDirPath() + "/Documents/application");
502// #endif
503 QDir pd1(d1);
504 if (!pd1.exists())
505 {
506 QDir pd1("Documents");
507 if (!pd1.mkdir("application", FALSE))
508 { 496 {
509 QMessageBox::critical( 0, tr("ZSafe"), 497 //FIXME: Pending someone to look into why QDir.mkdir does not work as expected
510#ifdef JPATCH_HDE 498 QString cmdline = QString().sprintf( "mkdir -p %s", (const char*) zsafeAppDirPath );
511 tr("Can't create directory\n.../Documents/application\n\nZSafe will now exit.")); 499 ::system( cmdline );
512#else
513 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1));
514#endif
515 exitZs (1);
516 } 500 }
517 } 501 if ( !QDir( zsafeAppDirPath ).exists() )
518 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
519 QDir pd2(d2);
520 if (!pd2.exists())
521 {
522 QDir pd2(QDir::homeDirPath() + "Documents/application");
523 if (!pd2.mkdir("zsafe", FALSE))
524 { 502 {
525 QMessageBox::critical( 0, tr("ZSafe"), 503 QMessageBox::critical( 0, "ZSafe", tr("Can't create application data directory.\nZSafe will now exit."));
526#ifdef JPATCH_HDE 504 exitZs (1);
527 tr("Can't create directory\n...//Documents/application/zsafe\n\nZSafe will now exit."));
528#else
529 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2));
530#endif
531 exitZs (1);
532 } 505 }
533 } 506 }
534 507
535
536 // set the default filename 508 // set the default filename
537 filename=d2 + "/passwords.zsf"; 509 filename = zsafeAppDirPath + "/passwords.zsf";
538 510
539 // save the current filename to the config file 511 // save the current filename to the config file
540 conf->writeEntry(APP_KEY+"document", filename); 512 conf->writeEntry(APP_KEY+"document", filename);
541 saveConf(); 513 saveConf();
542 }
543 514
544 //if (filename == "INVALIDPWD") 515 //if (filename == "INVALIDPWD")
545 //filename = ""; 516 //filename = "";
546 517
547 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 518 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
548#ifdef WIN32 519#ifdef WIN32
549 this->setCaption("Qt ZSafe: " + ti); 520 this->setCaption("Qt ZSafe: " + ti);
550#else 521#else
551 this->setCaption("ZSafe: " + ti); 522 this->setCaption("ZSafe: " + ti);
552#endif 523#endif
553 524
554 selectedItem = NULL; 525 selectedItem = NULL;
555 lastSearchedCategory = NULL; 526 lastSearchedCategory = NULL;
556 lastSearchedItem = NULL; 527 lastSearchedItem = NULL;
557 lastSearchedName = ""; 528 lastSearchedName = "";
558 lastSearchedUsername = ""; 529 lastSearchedUsername = "";
559 lastSearchedComment = ""; 530 lastSearchedComment = "";
560 531
561 infoForm = new InfoForm(); 532 infoForm = new InfoForm();
562 categoryDialog = NULL; 533 categoryDialog = NULL;
563 534
564 // add a menu bar 535 // add a menu bar
565 QMenuBar *menu = new QMenuBar( this ); 536 QMenuBar *menu = new QMenuBar( this );
566 537
567 // add file menu 538 // add file menu
568 // QPopupMenu *file = new QPopupMenu( this ); 539 // QPopupMenu *file = new QPopupMenu( this );
569 file = new QPopupMenu( this ); 540 file = new QPopupMenu( this );
570 541
571// #ifdef DESKTOP 542// #ifdef DESKTOP
572 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); 543 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) );
573 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); 544 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) );
574 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); 545 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) );
575 file->insertSeparator(); 546 file->insertSeparator();
576// #endif 547// #endif
577 548
578 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); 549 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
579 file->insertItem( save_img, tr("S&ave document with new Password"), this, 550 file->insertItem( save_img, tr("S&ave document with new Password"), this,
580 SLOT(saveDocumentWithPwd()) ); 551 SLOT(saveDocumentWithPwd()) );
581 file->insertSeparator(); 552 file->insertSeparator();
582 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); 553 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) );
583 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); 554 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) );
584 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); 555 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) );
585 file->insertSeparator(); 556 file->insertSeparator();
586 file->insertItem( expand_img, tr("&Open entries expanded"), this, 557 file->insertItem( expand_img, tr("&Open entries expanded"), this,
587 SLOT(setExpandFlag()), 0, 'o'); 558 SLOT(setExpandFlag()), 0, 'o');
588 file->setItemChecked('o', expandTree); 559 file->setItemChecked('o', expandTree);
589 file->insertSeparator(); 560 file->insertSeparator();
590 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); 561 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) );
591 menu->insertItem( tr("&File"), file ); 562 menu->insertItem( tr("&File"), file );
592 563
593 QPopupMenu *cat = new QPopupMenu( this ); 564 QPopupMenu *cat = new QPopupMenu( this );
594 cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) ); 565 cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) );
595 cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) ); 566 cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) );
596 cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) ); 567 cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) );
597 menu->insertItem( tr("&Category"), cat ); 568 menu->insertItem( tr("&Category"), cat );
598 569
599 QPopupMenu *it = new QPopupMenu( this ); 570 QPopupMenu *it = new QPopupMenu( this );
600 it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) ); 571 it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) );
601 it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) ); 572 it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) );
602 it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) ); 573 it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) );
603 it->insertSeparator(); 574 it->insertSeparator();
604 it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) ); 575 it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) );
605 it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); 576 it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) );
606 it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); 577 it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) );
@@ -2195,182 +2166,182 @@ bool ZSafe::saveDocument(const char* _filename,
2195 { 2166 {
2196 2167
2197 QMessageBox::critical( 0, tr("ZSafe"), 2168 QMessageBox::critical( 0, tr("ZSafe"),
2198 tr("Passwords must be identical.\nPlease enter again.")); 2169 tr("Passwords must be identical.\nPlease enter again."));
2199 continue; 2170 continue;
2200 } 2171 }
2201 pwdOk = TRUE; 2172 pwdOk = TRUE;
2202 modified = false; 2173 modified = false;
2203 } 2174 }
2204 } 2175 }
2205 else if (modified) 2176 else if (modified)
2206 { 2177 {
2207 QString fns(_filename); 2178 QString fns(_filename);
2208 fns = fns.right (fns.length() - fns.findRev ('/') - 1); 2179 fns = fns.right (fns.length() - fns.findRev ('/') - 1);
2209 switch( QMessageBox::information( this, tr("ZSafe"), 2180 switch( QMessageBox::information( this, tr("ZSafe"),
2210 tr("Do you want to save ") + fns + tr("\nbefore continuing?"), 2181 tr("Do you want to save ") + fns + tr("\nbefore continuing?"),
2211 tr("&Save"), 2182 tr("&Save"),
2212 tr("&Don't Save"), 2183 tr("&Don't Save"),
2213 0 // Enter == button 0 2184 0 // Enter == button 0
2214 ) ) 2185 ) )
2215 { // Escape == button 2 2186 { // Escape == button 2
2216 case 0: // Save clicked, Alt-S or Enter pressed. 2187 case 0: // Save clicked, Alt-S or Enter pressed.
2217 modified = false; 2188 modified = false;
2218 break; 2189 break;
2219 case 1: // Don't Save clicked or Alt-D pressed 2190 case 1: // Don't Save clicked or Alt-D pressed
2220 modified = false; 2191 modified = false;
2221 return true; 2192 return true;
2222 } 2193 }
2223 } 2194 }
2224 modified = false; 2195 modified = false;
2225 2196
2226 if (m_password.isEmpty()) 2197 if (m_password.isEmpty())
2227 return false; 2198 return false;
2228 2199
2229 int retval = saveInit(_filename, m_password); 2200 int retval = saveInit(_filename, m_password);
2230 // int retval = saveInit(_filename, "test"); 2201 // int retval = saveInit(_filename, "test");
2231 if (retval != PWERR_GOOD) { 2202 if (retval != PWERR_GOOD) {
2232 return false; 2203 return false;
2233 } 2204 }
2234 2205
2235 char* entry[FIELD_SIZE]; 2206 char* entry[FIELD_SIZE];
2236 2207
2237 // save the validation entry 2208 // save the validation entry
2238 { 2209 {
2239 int i=0; 2210 int i=0;
2240 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); 2211 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
2241 strcpy(entry[i++], "ZSAFECATEGORY"); 2212 strcpy(entry[i++], "ZSAFECATEGORY");
2242 entry[i] = (char*)malloc(strlen("name")+1); 2213 entry[i] = (char*)malloc(strlen("name")+1);
2243 strcpy(entry[i++], "name"); 2214 strcpy(entry[i++], "name");
2244 entry[i] = (char*)malloc(strlen("username")+1); 2215 entry[i] = (char*)malloc(strlen("username")+1);
2245 strcpy(entry[i++], "username"); 2216 strcpy(entry[i++], "username");
2246 entry[i] = (char*)malloc(strlen("password")+1); 2217 entry[i] = (char*)malloc(strlen("password")+1);
2247 strcpy(entry[i++], "password"); 2218 strcpy(entry[i++], "password");
2248 entry[i] = (char*)malloc(strlen("comment")+1); 2219 entry[i] = (char*)malloc(strlen("comment")+1);
2249 strcpy(entry[i++], "comment"); 2220 strcpy(entry[i++], "comment");
2250 2221
2251 entry[i] = (char*)malloc(strlen("field5")+1); 2222 entry[i] = (char*)malloc(strlen("field5")+1);
2252 strcpy(entry[i++], "field5"); 2223 strcpy(entry[i++], "field5");
2253 entry[i] = (char*)malloc(strlen("field6")+1); 2224 entry[i] = (char*)malloc(strlen("field6")+1);
2254 strcpy(entry[i++], "field6"); 2225 strcpy(entry[i++], "field6");
2255 2226
2256 retval = saveEntry(entry); 2227 retval = saveEntry(entry);
2257 for (int z=0; z<i; z++) free(entry[z]); 2228 for (int z=0; z<i; z++) free(entry[z]);
2258 if (retval == PWERR_DATA) { 2229 if (retval == PWERR_DATA) {
2259 owarn << "1: Error writing file, contents not saved" << oendl; 2230 owarn << "1: Error writing file, contents not saved" << oendl;
2260 saveFinalize(); 2231 saveFinalize();
2261 return false; 2232 return false;
2262 } 2233 }
2263// #ifndef WIN32 2234// #ifndef WIN32
2264 conf->writeEntry(APP_KEY+"valzsafe", 1); 2235 conf->writeEntry(APP_KEY+"valzsafe", 1);
2265// #endif 2236// #endif
2266 saveConf(); 2237 saveConf();
2267 } 2238 }
2268 2239
2269 QListViewItem *i; 2240 QListViewItem *i;
2270 // step through all categories 2241 // step through all categories
2271 for (i = ListView->firstChild(); 2242 for (i = ListView->firstChild();
2272 i != NULL; 2243 i != NULL;
2273 i = i->nextSibling()) 2244 i = i->nextSibling())
2274 { 2245 {
2275 // step through all subitems 2246 // step through all subitems
2276 QListViewItem *si; 2247 QListViewItem *si;
2277 for (si = i->firstChild(); 2248 for (si = i->firstChild();
2278 si != NULL; 2249 si != NULL;
2279 si = si->nextSibling()) 2250 si = si->nextSibling())
2280 { 2251 {
2281 int j=0; 2252 int j=0;
2282 entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); 2253 entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1);
2283 strcpy(entry[j++], i->text(0).utf8()); 2254 strcpy(entry[j++], i->text(0).utf8());
2284 entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); 2255 entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1);
2285 strcpy(entry[j++], si->text(0).utf8()); 2256 strcpy(entry[j++], si->text(0).utf8());
2286 entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); 2257 entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1);
2287 strcpy(entry[j++], si->text(1).utf8()); 2258 strcpy(entry[j++], si->text(1).utf8());
2288 entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); 2259 entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1);
2289 strcpy(entry[j++], si->text(2).utf8()); 2260 strcpy(entry[j++], si->text(2).utf8());
2290 entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); 2261 entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1);
2291 strcpy(entry[j++], si->text(3).utf8()); 2262 strcpy(entry[j++], si->text(3).utf8());
2292 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); 2263 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1);
2293 strcpy(entry[j++], si->text(4).utf8()); 2264 strcpy(entry[j++], si->text(4).utf8());
2294 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); 2265 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1);
2295 strcpy(entry[j++], si->text(5).utf8()); 2266 strcpy(entry[j++], si->text(5).utf8());
2296 2267
2297 retval = saveEntry(entry); 2268 retval = saveEntry(entry);
2298 for (int z=0; z<j; z++) 2269 for (int z=0; z<j; z++)
2299 { 2270 {
2300 free(entry[z]); 2271 free(entry[z]);
2301 } 2272 }
2302 if (retval == PWERR_DATA) { 2273 if (retval == PWERR_DATA) {
2303 owarn << "1: Error writing file, contents not saved" << oendl; 2274 owarn << "1: Error writing file, contents not saved" << oendl;
2304 saveFinalize(); 2275 saveFinalize();
2305 return false; 2276 return false;
2306 } 2277 }
2307 2278
2308 } 2279 }
2309 } 2280 }
2310 2281
2311 if (saveFinalize() == PWERR_DATA) { 2282 if (saveFinalize() == PWERR_DATA) {
2312 owarn << "2: Error writing file, contents not saved" << oendl; 2283 owarn << "2: Error writing file, contents not saved" << oendl;
2313 return false; 2284 return false;
2314 } else { 2285 } else {
2315#ifndef DESKTOP 2286#ifndef DESKTOP
2316 Global::statusMessage (tr("Password file saved.")); 2287 Global::statusMessage (tr("Password file saved."));
2317#endif 2288#endif
2318 modified = false; 2289 modified = false;
2319 return true; 2290 return true;
2320 } 2291 }
2321} 2292}
2322 2293
2323PasswordForm *newPwdDialog; 2294PasswordForm *newPwdDialog;
2324bool newPwdDialogResult = false; 2295bool newPwdDialogResult = false;
2325void ZSafe::setPasswordDialogDone() 2296void ZSafe::setPasswordDialogDone()
2326{ 2297{
2327 newPwdDialogResult = true; 2298 newPwdDialogResult = true;
2328 newPwdDialog->close(); 2299 newPwdDialog->close();
2329} 2300}
2330 2301
2331void ZSafe::getDocPassword(QString title) 2302void ZSafe::getDocPassword(QString title)
2332{ 2303{
2333qWarning ("getDocPassword"); 2304qWarning ("getDocPassword");
2334 // open the 'Password' dialog 2305 // open the 'Password' dialog
2335 PasswordForm *dialog = new PasswordForm(this, title, TRUE); 2306 PasswordForm *dialog = new PasswordForm(this, title, TRUE);
2336 newPwdDialog = dialog; 2307 newPwdDialog = dialog;
2337 newPwdDialogResult = false; 2308 newPwdDialogResult = false;
2338 2309
2339 connect( dialog->PasswordField, SIGNAL( returnPressed() ), 2310 connect( dialog->PasswordField, SIGNAL( returnPressed() ),
2340 this, SLOT( setPasswordDialogDone() ) ); 2311 this, SLOT( setPasswordDialogDone() ) );
2341 2312
2342 // CS: !!! 2313 // CS: !!!
2343 // int pos = filename.findRev ('/'); 2314 // int pos = filename.findRev ('/');
2344 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 2315 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
2345#ifdef WIN32 2316#ifdef WIN32
2346 dialog->setCaption("Qt " + ti); 2317 dialog->setCaption("Qt " + ti);
2347#else 2318#else
2348 dialog->setCaption(ti); 2319 dialog->setCaption(ti);
2349#endif 2320#endif
2350 // dialog->setCaption(title); 2321 // dialog->setCaption(title);
2351 2322
2352 dialog->PasswordField->setFocus(); 2323 dialog->PasswordField->setFocus();
2353 DialogCode result = (DialogCode) dialog->exec(); 2324 DialogCode result = (DialogCode) dialog->exec();
2354#ifdef DESKTOP 2325#ifdef DESKTOP
2355 result = Accepted; 2326 result = Accepted;
2356#endif 2327#endif
2357 2328
2358 QString password; 2329 QString password;
2359 if (result == Accepted || newPwdDialogResult) 2330 if (result == Accepted || newPwdDialogResult)
2360 { 2331 {
2361 m_password = dialog->PasswordField->text(); 2332 m_password = dialog->PasswordField->text();
2362 } 2333 }
2363 else 2334 else
2364 { 2335 {
2365 exitZs (1); 2336 exitZs (1);
2366 } 2337 }
2367} 2338}
2368 2339
2369int ZSafe::saveInit(const char *_filename, const char *password) 2340int ZSafe::saveInit(const char *_filename, const char *password)
2370{ 2341{
2371 char key[128]; 2342 char key[128];
2372 unsigned int j = 0; 2343 unsigned int j = 0;
2373 unsigned int keylength; 2344 unsigned int keylength;
2374 // int val; 2345 // int val;
2375 int count2; 2346 int count2;
2376 Krc2* krc2 = new Krc2(); 2347 Krc2* krc2 = new Krc2();
@@ -3126,129 +3097,129 @@ void ZSafe::editCategory()
3126#else 3097#else
3127 QDir d(QPEApplication::qpeDir() + "/pics/"); 3098 QDir d(QPEApplication::qpeDir() + "/pics/");
3128#endif 3099#endif
3129 d.setFilter( QDir::Files); 3100 d.setFilter( QDir::Files);
3130 3101
3131 const QFileInfoList *list = d.entryInfoList(); 3102 const QFileInfoList *list = d.entryInfoList();
3132 int i=0; 3103 int i=0;
3133 QFileInfoListIterator it( *list ); // create list iterator 3104 QFileInfoListIterator it( *list ); // create list iterator
3134 QFileInfo *fi; // pointer for traversing 3105 QFileInfo *fi; // pointer for traversing
3135 if (icon.isEmpty() || icon.isNull()) 3106 if (icon.isEmpty() || icon.isNull())
3136 { 3107 {
3137 dialog->IconField->setCurrentItem(0); 3108 dialog->IconField->setCurrentItem(0);
3138 } 3109 }
3139 else 3110 else
3140 { 3111 {
3141 3112
3142 while ( (fi=it.current()) ) 3113 while ( (fi=it.current()) )
3143 { // for each file... 3114 { // for each file...
3144 QString fileName = fi->fileName(); 3115 QString fileName = fi->fileName();
3145 if(fileName.right(4) == ".png") 3116 if(fileName.right(4) == ".png")
3146 { 3117 {
3147 fileName = fileName.mid(0,fileName.length()-4); 3118 fileName = fileName.mid(0,fileName.length()-4);
3148 3119
3149 3120
3150 if(fileName+".png"==icon) 3121 if(fileName+".png"==icon)
3151 { 3122 {
3152 dialog->IconField->setCurrentItem(i+1); 3123 dialog->IconField->setCurrentItem(i+1);
3153 break; 3124 break;
3154 } 3125 }
3155 ++i; 3126 ++i;
3156 } 3127 }
3157 ++it; 3128 ++it;
3158 } 3129 }
3159 } 3130 }
3160 } 3131 }
3161 3132
3162 // dialog->show(); 3133 // dialog->show();
3163#ifndef DESKTOP 3134#ifndef DESKTOP
3164 // dialog->move (20, 100); 3135 // dialog->move (20, 100);
3165#endif 3136#endif
3166 DialogCode result = (DialogCode) dialog->exec(); 3137 DialogCode result = (DialogCode) dialog->exec();
3167#ifdef DESKTOP 3138#ifdef DESKTOP
3168 result = Accepted; 3139 result = Accepted;
3169#endif 3140#endif
3170 3141
3171 QString fullIconPath; 3142 QString fullIconPath;
3172 QPixmap *pix; 3143 QPixmap *pix;
3173 if (result == Accepted) 3144 if (result == Accepted)
3174 { 3145 {
3175 modified = true; 3146 modified = true;
3176 if (category != dialog->CategoryField->currentText()) 3147 if (category != dialog->CategoryField->currentText())
3177 { 3148 {
3178 categories.remove (category); 3149 categories.remove (category);
3179// #ifndef WIN32 3150// #ifndef WIN32
3180 conf->removeEntry(category); 3151 conf->removeEntry(category);
3181// #endif 3152// #endif
3182 saveConf(); 3153 saveConf();
3183 } 3154 }
3184 3155
3185 category = dialog->CategoryField->currentText(); 3156 category = dialog->CategoryField->currentText();
3186 icon = dialog->IconField->currentText()+".png"; 3157 icon = dialog->IconField->currentText()+".png";
3187 3158
3188 if (cat) 3159 if (cat)
3189 { 3160 {
3190 owarn << "Category found" << oendl; 3161 owarn << "Category found" << oendl;
3191 3162
3192 // if (!icon.isEmpty() && !icon.isNull()) 3163 // if (!icon.isEmpty() && !icon.isNull())
3193 if (icon != "predefined.png") 3164 if (icon != "predefined.png")
3194 { 3165 {
3195 // build the full path 3166 // build the full path
3196 fullIconPath = iconPath + icon; 3167 fullIconPath = iconPath + icon;
3197 pix = new QPixmap (fullIconPath); 3168 pix = new QPixmap (fullIconPath);
3198 if (pix) 3169 if (pix)
3199 { 3170 {
3200 // save the full pixmap name into the config file 3171 // save the full pixmap name into the config file
3201// #ifndef WIN32 3172// #ifndef WIN32
3202 conf->writeEntry(APP_KEY+category, icon); 3173 conf->writeEntry(APP_KEY+category, icon);
3203// #endif 3174// #endif
3204 saveConf(); 3175 saveConf();
3205 QImage img = pix->convertToImage(); 3176 QImage img = pix->convertToImage();
3206 pix->convertFromImage(img.smoothScale(14,14)); 3177 pix->convertFromImage(img.smoothScale(14,14));
3207 cat->setIconName (icon); 3178 cat->setIconName (icon);
3208 cat->setIcon (*pix); 3179 cat->setIcon (*pix);
3209 } 3180 }
3210 } 3181 }
3211 else 3182 else
3212 { 3183 {
3213// #ifndef WIN32 3184// #ifndef WIN32
3214 conf->removeEntry (category); 3185 conf->removeEntry (category);
3215// #endif 3186// #endif
3216 saveConf(); 3187 saveConf();
3217 cat->setIcon (*getPredefinedIcon(category)); 3188 cat->setIcon (*getPredefinedIcon(category));
3218 } 3189 }
3219 3190
3220 // change the category name of the selected category 3191 // change the category name of the selected category
3221 QListViewItem *catItem = cat->getListItem(); 3192 QListViewItem *catItem = cat->getListItem();
3222 if (catItem) 3193 if (catItem)
3223 { 3194 {
3224 qWarning (category); 3195 qWarning (category);
3225 catItem->setText( 0, tr( category ) ); 3196 catItem->setText( 0, tr( category ) );
3226 cat->setCategoryName (tr(category)); 3197 cat->setCategoryName (tr(category));
3227 3198
3228 cat->initListItem(); 3199 cat->initListItem();
3229 categories.insert (category, cat); 3200 categories.insert (category, cat);
3230 } 3201 }
3231 } 3202 }
3232 saveCategoryDialogFields(dialog); 3203 saveCategoryDialogFields(dialog);
3233 } 3204 }
3234 else 3205 else
3235 { 3206 {
3236 // delete dialog; 3207 // delete dialog;
3237 dialog->hide(); 3208 dialog->hide();
3238 return; 3209 return;
3239 } 3210 }
3240 3211
3241 } 3212 }
3242} 3213}
3243 3214
3244void ZSafe::cutItem() 3215void ZSafe::cutItem()
3245{ 3216{
3246 if (!selectedItem) 3217 if (!selectedItem)
3247 return; 3218 return;
3248 if (!isCategory(selectedItem)) 3219 if (!isCategory(selectedItem))
3249 { 3220 {
3250 IsCut = true; 3221 IsCut = true;
3251 copiedItem = selectedItem; 3222 copiedItem = selectedItem;
3252 } 3223 }
3253} 3224}
3254 3225