summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/categorylist.cpp6
-rw-r--r--noncore/apps/zsafe/categorylist.h6
-rw-r--r--noncore/apps/zsafe/zsafe.cpp201
3 files changed, 171 insertions, 42 deletions
diff --git a/noncore/apps/zsafe/categorylist.cpp b/noncore/apps/zsafe/categorylist.cpp
index 2fa59d2..c5e8d66 100644
--- a/noncore/apps/zsafe/categorylist.cpp
+++ b/noncore/apps/zsafe/categorylist.cpp
@@ -1,35 +1,35 @@
1/* C implementation of RC2 encryption algorithm, as described in RFC2268 */ 1/* C implementation of RC2 encryption algorithm, as described in RFC2268 */
2/* By Matthew Palmer <mjp16@uow.edu.au> */ 2/* By Matthew Palmer <mjp16@uow.edu.au> */
3/* $Id$ */ 3/* $Id$ */
4 4
5#include "categorylist.h" 5#include "categorylist.h"
6 6
7CategoryList::CategoryList() 7CategoryList::CategoryList()
8{ 8{
9} 9}
10 10
11CategoryList::~CategoryList() 11CategoryList::~CategoryList()
12{ 12{
13} 13}
14 14
15void CategoryList::insert (QString key, Category *category) 15void CategoryList::insert (QString key, Category *category)
16{ 16{
17 categoryList.insert ((const char *) key, category); 17 categoryList.insert (key, category);
18} 18}
19 19
20Category *CategoryList::find (QString key) 20Category *CategoryList::find (QString key)
21{ 21{
22 return categoryList.find ((const char *) key); 22 return categoryList.find (key);
23} 23}
24 24
25void CategoryList::remove (QString key) 25void CategoryList::remove (QString key)
26{ 26{
27 categoryList.remove ((const char *) key); 27 categoryList.remove (key);
28} 28}
29 29
30void CategoryList::clear() 30void CategoryList::clear()
31{ 31{
32 categoryList.clear(); 32 categoryList.clear();
33} 33}
34 34
35 35
diff --git a/noncore/apps/zsafe/categorylist.h b/noncore/apps/zsafe/categorylist.h
index 96cf389..fc1c0a2 100644
--- a/noncore/apps/zsafe/categorylist.h
+++ b/noncore/apps/zsafe/categorylist.h
@@ -1,32 +1,34 @@
1/* 1/*
2** $Id$ 2** $Id$
3*/ 3*/
4#ifndef _CATEGORY_LIST_H_ 4#ifndef _CATEGORY_LIST_H_
5#define _CATEGORY_LIST_H_ 5#define _CATEGORY_LIST_H_
6 6
7#include <qstring.h> 7#include <qstring.h>
8#include <qasciidict.h> 8
9#include <qdict.h>
10
9#include "category.h" 11#include "category.h"
10 12
11// list of Category 13// list of Category
12 14
13class CategoryList 15class CategoryList
14{ 16{
15public: 17public:
16 CategoryList(); 18 CategoryList();
17 ~CategoryList(); 19 ~CategoryList();
18 20
19 void insert (QString key, Category *category); 21 void insert (QString key, Category *category);
20 Category *find (QString key); 22 Category *find (QString key);
21 void remove (QString key); 23 void remove (QString key);
22 void clear(); 24 void clear();
23 25
24 QAsciiDict<Category> categoryList; 26 QDict<Category> categoryList;
25 27
26private: 28private:
27 29
28}; 30};
29#endif // _CATEGORY_LIST_H_ 31#endif // _CATEGORY_LIST_H_
30 32
31 33
32 34
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 9341425..d55624b 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -1,80 +1,82 @@
1/**************************************************************************** 1/****************************************************************************
2** 2**
3** Created: Sat Apr 6 17:57:45 2002 3** Created: Sat Apr 6 17:57:45 2002
4** 4**
5** Author: Carsten Schneider <CarstenSchneider@t-online.de> 5** Author: Carsten Schneider <CarstenSchneider@t-online.de>
6** 6**
7** $Id$ 7** $Id$
8** 8**
9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html 9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
10** 10**
11** Compile Flags: 11** Compile Flags:
12** Zaurus arm : -DNO_OPIE 12** Zaurus arm : -DNO_OPIE
13** Zaurus Opie arm: none 13** Zaurus Opie arm: none
14** Linux Desktop : -DDESKTOP 14** Linux Desktop : -DDESKTOP
15** Windows Desktop: -DDESKTOP -DWIN32 15** Windows Desktop: -DDESKTOP -DWIN32
16** 16**
17** for japanese version additional use: -DJPATCH_HDE
18**
17****************************************************************************/ 19****************************************************************************/
18#include "zsafe.h" 20#include "zsafe.h"
19#include "newdialog.h" 21#include "newdialog.h"
20#include "searchdialog.h" 22#include "searchdialog.h"
21#include "categorydialog.h" 23#include "categorydialog.h"
22#include "passworddialog.h" 24#include "passworddialog.h"
23#include "infoform.h" 25#include "infoform.h"
24#include "zlistview.h" 26#include "zlistview.h"
25#include "shadedlistitem.h" 27#include "shadedlistitem.h"
26 28
27#ifndef DESKTOP 29#ifndef DESKTOP
28#ifndef NO_OPIE 30#ifndef NO_OPIE
29#include <opie/ofiledialog.h> 31#include <opie/ofiledialog.h>
30#else 32#else
31#include "scqtfileedit.h" 33#include "scqtfileedit.h"
32#endif 34#endif
33#endif 35#endif
34 36
35#include <qclipboard.h> 37#include <qclipboard.h>
36 38
37#include <stdio.h> 39#include <stdio.h>
38 40
39#include <sys/types.h> 41#include <sys/types.h>
40#include <sys/stat.h> 42#include <sys/stat.h>
41#include <fcntl.h> 43#include <fcntl.h>
42#include <stdlib.h> 44#include <stdlib.h>
43#ifndef WIN32 45#ifndef WIN32
44#include <unistd.h> 46#include <unistd.h>
45#endif 47#endif
46#include <string.h> 48#include <string.h>
47#include <errno.h> 49#include <errno.h>
48 50
49#include <qmenubar.h> 51#include <qmenubar.h>
50#include <qpopupmenu.h> 52#include <qpopupmenu.h>
51 53
52#ifdef DESKTOP 54#ifdef DESKTOP
53#include <qfiledialog.h> 55#include <qfiledialog.h>
54#ifndef WIN32 56#ifndef WIN32
55#include <qsettings.h> 57#include <qsettings.h>
56#else 58#else
57#include "qsettings.h" 59#include "qsettings.h"
58#endif 60#endif
59#include <qapplication.h> 61#include <qapplication.h>
60#else 62#else
61#include <qfile.h> 63#include <qfile.h>
62#include <qpe/fileselector.h> 64#include <qpe/fileselector.h>
63#include <qpe/global.h> 65#include <qpe/global.h>
64#include <qpe/qpeapplication.h> 66#include <qpe/qpeapplication.h>
65#include <qpe/resource.h> 67#include <qpe/resource.h>
66#include <qpe/config.h> 68#include <qpe/config.h>
67#endif 69#endif
68 70
69#include <qtimer.h> 71#include <qtimer.h>
70#include <qlayout.h> 72#include <qlayout.h>
71#include <qmessagebox.h> 73#include <qmessagebox.h>
72#include <qfile.h> 74#include <qfile.h>
73#include <qtextstream.h> 75#include <qtextstream.h>
74#include <qheader.h> 76#include <qheader.h>
75#include <qlistview.h> 77#include <qlistview.h>
76#include <qtoolbutton.h> 78#include <qtoolbutton.h>
77#include <qlayout.h> 79#include <qlayout.h>
78#include <qvariant.h> 80#include <qvariant.h>
79#include <qtooltip.h> 81#include <qtooltip.h>
80#include <qwhatsthis.h> 82#include <qwhatsthis.h>
@@ -393,135 +395,148 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
393 // set the icon path 395 // set the icon path
394 QString qpedir ((const char *)getenv("QPEDIR")); 396 QString qpedir ((const char *)getenv("QPEDIR"));
395#ifdef DESKTOP 397#ifdef DESKTOP
396 iconPath = QDir::homeDirPath() + "/pics/"; 398 iconPath = QDir::homeDirPath() + "/pics/";
397#else 399#else
398 if (qpedir.isEmpty()) 400 if (qpedir.isEmpty())
399 iconPath = "/home/QtPalmtop/pics/"; 401 iconPath = "/home/QtPalmtop/pics/";
400 else 402 else
401 iconPath = qpedir + "/pics/"; 403 iconPath = qpedir + "/pics/";
402#endif 404#endif
403 405
404 // create a zsafe configuration object 406 // create a zsafe configuration object
405#ifdef DESKTOP 407#ifdef DESKTOP
406#ifndef WIN32 408#ifndef WIN32
407 conf = new QSettings (); 409 conf = new QSettings ();
408 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); 410 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
409#else 411#else
410 conf = new QSettings (cfgFile); 412 conf = new QSettings (cfgFile);
411 conf->insertSearchPath (QSettings::Unix, cfgFile); 413 conf->insertSearchPath (QSettings::Unix, cfgFile);
412#endif 414#endif
413#else 415#else
414 conf = new Config (cfgFile, Config::File); 416 conf = new Config (cfgFile, Config::File);
415 conf->setGroup ("zsafePrefs"); 417 conf->setGroup ("zsafePrefs");
416#endif 418#endif
417#ifdef DESKTOP 419#ifdef DESKTOP
418// #ifndef WIN32 420// #ifndef WIN32
419 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); 421 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false);
420// #endif 422// #endif
421#else 423#else
422 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); 424 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0);
423#endif 425#endif
424#ifndef DESKTOP 426#ifndef DESKTOP
425 conf->setGroup ("zsafe"); 427 conf->setGroup ("zsafe");
426#endif 428#endif
427 429
428 QPixmap copy_img((const char**) copy_xpm); 430 QPixmap copy_img((const char**) copy_xpm);
429 QPixmap cut_img((const char**) cut_xpm); 431 QPixmap cut_img((const char**) cut_xpm);
430 QPixmap edit_img((const char**) edit_xpm); 432 QPixmap edit_img((const char**) edit_xpm);
431 QPixmap editdelete_img((const char**) editdelete_xpm); 433 QPixmap editdelete_img((const char**) editdelete_xpm);
432 QPixmap find_img((const char**) find_xpm); 434 QPixmap find_img((const char**) find_xpm);
433 QPixmap folder_open_img((const char**) folder_open_xpm); 435 QPixmap folder_open_img((const char**) folder_open_xpm);
434 QPixmap help_icon_img((const char**) help_icon_xpm); 436 QPixmap help_icon_img((const char**) help_icon_xpm);
435 QPixmap new_img((const char**) new_xpm); 437 QPixmap new_img((const char**) new_xpm);
436 QPixmap paste_img((const char**) paste_xpm); 438 QPixmap paste_img((const char**) paste_xpm);
437 QPixmap quit_icon_img((const char**) quit_icon_xpm); 439 QPixmap quit_icon_img((const char**) quit_icon_xpm);
438 QPixmap save_img((const char**) save_xpm); 440 QPixmap save_img((const char**) save_xpm);
439 QPixmap trash_img((const char**) trash_xpm); 441 QPixmap trash_img((const char**) trash_xpm);
440 QPixmap expand_img((const char**) expand_xpm); 442 QPixmap expand_img((const char**) expand_xpm);
441 QPixmap export_img((const char**) export_xpm); 443 QPixmap export_img((const char**) export_xpm);
442 QPixmap import_img((const char**) import_xpm); 444 QPixmap import_img((const char**) import_xpm);
443 445
444 QPixmap bank_cards( ( const char** ) bank_cards_data ); 446 QPixmap bank_cards( ( const char** ) bank_cards_data );
445 QPixmap passwords( ( const char** ) passwords_data ); 447 QPixmap passwords( ( const char** ) passwords_data );
446 QPixmap software( ( const char** ) software_data ); 448 QPixmap software( ( const char** ) software_data );
447 QPixmap general( ( const char** ) general_data ); 449 QPixmap general( ( const char** ) general_data );
448 if ( !name ) 450 if ( !name )
449 setName( "ZSafe" ); 451 setName( "ZSafe" );
450 452
451#ifdef DESKTOP 453#ifdef DESKTOP
452#ifdef WIN32 454#ifdef WIN32
453 setGeometry(100, 150, DeskW, DeskH-30 ); 455 setGeometry(100, 150, DeskW, DeskH-30 );
454#else 456#else
455 resize( DeskW, DeskH-30 ); 457 resize( DeskW, DeskH-30 );
456#endif 458#endif
457 // setMinimumSize( QSize( DeskW, DeskH-30 ) ); 459
458 // setMaximumSize( QSize( DeskW, DeskH-30 ) );
459#else 460#else
460 resize( DeskW, DeskH-30 ); 461
461 // setMinimumSize( QSize( DeskW, DeskH-30 ) ); 462#ifdef JPATCH_HDE
462 // setMaximumSize( QSize( 440, 290 ) ); 463 int DeskS;
463 // setMaximumSize( QSize( DeskW+400, DeskH+200 ) ); 464 if(DeskW > DeskH)
465 {
466 DeskS = DeskW;
467 }
468 else
469 {
470 DeskS = DeskH;
471 }
472 resize( DeskW, DeskH );
473 setMinimumSize( QSize( DeskS, DeskS ) );
474 setMaximumSize( QSize( DeskS, DeskS ) );
475#else
476 resize( DeskW, DeskH-30 );
477#endif
478
464#endif 479#endif
465 // setCaption( tr( "ZSafe" ) ); 480 // setCaption( tr( "ZSafe" ) );
466 481
467 filename = conf->readEntry(APP_KEY+"document"); 482 filename = conf->readEntry(APP_KEY+"document");
468 if (filename.isEmpty() || filename.isNull()) 483 if (filename.isEmpty() || filename.isNull())
469 { 484 {
470 485
471 // check if the directory application exists, if not 486 // check if the directory application exists, if not
472 // create it 487 // create it
473// #ifndef WIN32 488// #ifndef WIN32
474 // QString d1("Documents/application"); 489 // QString d1("Documents/application");
475// #else 490// #else
476 QString d1(QDir::homeDirPath() + "/Documents/application"); 491 QString d1(QDir::homeDirPath() + "/Documents/application");
477// #endif 492// #endif
478 QDir pd1(d1); 493 QDir pd1(d1);
479 if (!pd1.exists()) 494 if (!pd1.exists())
480 { 495 {
481 QDir pd1("Documents"); 496 QDir pd1("Documents");
482 if (!pd1.mkdir("application", FALSE)) 497 if (!pd1.mkdir("application", FALSE))
483 { 498 {
484 QMessageBox::critical( 0, tr("ZSafe"), 499 QMessageBox::critical( 0, tr("ZSafe"),
485 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1)); 500 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1));
486 exitZs (1); 501 exitZs (1);
487 } 502 }
488 } 503 }
489// #ifndef WIN32 504// #ifndef WIN32
490 // QString d2("Documents/application/zsafe"); 505 // QString d2("Documents/application/zsafe");
491// #else 506// #else
492 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); 507 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
493// #endif 508// #endif
494 QDir pd2(d2); 509 QDir pd2(d2);
495 if (!pd2.exists()) 510 if (!pd2.exists())
496 { 511 {
497 QDir pd2("Documents/application"); 512 QDir pd2("Documents/application");
498 if (!pd2.mkdir("zsafe", FALSE)) 513 if (!pd2.mkdir("zsafe", FALSE))
499 { 514 {
500 QMessageBox::critical( 0, tr("ZSafe"), 515 QMessageBox::critical( 0, tr("ZSafe"),
501 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2)); 516 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2));
502 exitZs (1); 517 exitZs (1);
503 } 518 }
504 } 519 }
505 520
506 521
507 // set the default filename 522 // set the default filename
508 filename=d2 + "/passwords.zsf"; 523 filename=d2 + "/passwords.zsf";
509 524
510 // save the current filename to the config file 525 // save the current filename to the config file
511 conf->writeEntry(APP_KEY+"document", filename); 526 conf->writeEntry(APP_KEY+"document", filename);
512 saveConf(); 527 saveConf();
513 } 528 }
514 529
515 //if (filename == "INVALIDPWD") 530 //if (filename == "INVALIDPWD")
516 //filename = ""; 531 //filename = "";
517 532
518 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 533 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
519#ifdef WIN32 534#ifdef WIN32
520 this->setCaption("Qt ZSafe: " + ti); 535 this->setCaption("Qt ZSafe: " + ti);
521#else 536#else
522 this->setCaption("ZSafe: " + ti); 537 this->setCaption("ZSafe: " + ti);
523#endif 538#endif
524 539
525 selectedItem = NULL; 540 selectedItem = NULL;
526 lastSearchedCategory = NULL; 541 lastSearchedCategory = NULL;
527 lastSearchedItem = NULL; 542 lastSearchedItem = NULL;
@@ -699,219 +714,251 @@ void ZSafe::deletePwd()
699 tr("&Delete"), tr("D&on't Delete"), 714 tr("&Delete"), tr("D&on't Delete"),
700 0 // Enter == button 0 715 0 // Enter == button 0
701 ) ) { // Escape == button 2 716 ) ) { // Escape == button 2
702 case 0: // Delete clicked, Alt-S or Enter pressed. 717 case 0: // Delete clicked, Alt-S or Enter pressed.
703 // Delete 718 // Delete
704 modified = true; 719 modified = true;
705 selectedItem->parent()->takeItem(selectedItem); 720 selectedItem->parent()->takeItem(selectedItem);
706 selectedItem = NULL; 721 selectedItem = NULL;
707 break; 722 break;
708 case 1: // Don't delete 723 case 1: // Don't delete
709 break; 724 break;
710 } 725 }
711 } 726 }
712 else 727 else
713 { 728 {
714 delCategory(); 729 delCategory();
715 } 730 }
716} 731}
717 732
718void ZSafe::editPwd() 733void ZSafe::editPwd()
719{ 734{
720 if (!selectedItem) 735 if (!selectedItem)
721 return; 736 return;
722 if (!isCategory(selectedItem)) 737 if (!isCategory(selectedItem))
723 { 738 {
724 // open the 'New Entry' dialog 739 // open the 'New Entry' dialog
725 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); 740 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE);
726#ifdef WIN32 741#ifdef WIN32
727 dialog->setCaption ("Qt " + tr("Edit Entry")); 742 dialog->setCaption ("Qt " + tr("Edit Entry"));
728 dialog->setGeometry(200, 250, 220, 310 ); 743 dialog->setGeometry(200, 250, 220, 310 );
729#endif 744#endif
730 745
731 // set the labels 746 // set the labels
732 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 747 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
733 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 748 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
734 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 749 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
735 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 750 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
736 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); 751 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
737 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); 752 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
738 753
739 // set the fields 754 // set the fields
740 dialog->NameField->setText(selectedItem->text (0)); 755 dialog->NameField->setText(selectedItem->text (0));
741 dialog->UsernameField->setText(selectedItem->text (1)); 756 dialog->UsernameField->setText(selectedItem->text (1));
742 dialog->PasswordField->setText(selectedItem->text (2)); 757 dialog->PasswordField->setText(selectedItem->text (2));
743 QString comment = selectedItem->text (3); 758 QString comment = selectedItem->text (3);
744 comment.replace (QRegExp("<br>"), "\n"); 759 comment.replace (QRegExp("<br>"), "\n");
745 dialog->Field5->setText(selectedItem->text (4)); 760 dialog->Field5->setText(selectedItem->text (4));
746 dialog->Field6->setText(selectedItem->text (5)); 761 dialog->Field6->setText(selectedItem->text (5));
747 dialog->CommentField->insertLine(comment); 762 dialog->CommentField->insertLine(comment);
748 dialog->CommentField->setCursorPosition(0,0); 763 dialog->CommentField->setCursorPosition(0,0);
749#ifdef DESKTOP 764#ifdef DESKTOP
750#ifndef WIN32 765#ifndef WIN32
751 dialog->show(); 766 dialog->show();
752#endif 767#endif
753#else 768#else
754 dialog->showMaximized(); 769 dialog->showMaximized();
755#endif 770#endif
756 DialogCode result = (DialogCode) dialog->exec(); 771 DialogCode result = (DialogCode) dialog->exec();
757 772
758#ifdef DESKTOP 773#ifdef DESKTOP
759 result = Accepted; 774 result = Accepted;
760#endif 775#endif
761 if (result == Accepted) 776 if (result == Accepted)
762 { 777 {
778#ifdef JPATCH_HDE
779 // edit the selected item
780 QString name = dialog->NameField->text();
781 selectedItem->setText (0, name);
782 QString user = dialog->UsernameField->text();
783 selectedItem->setText (1, user);
784 QString pwd = dialog->PasswordField->text();
785 selectedItem->setText (2, pwd);
786 QString comment = dialog->CommentField->text();
787 comment.replace (QRegExp("\n"), "<br>");
788 selectedItem->setText (3, comment);
789 QString f5 = dialog->Field5->text();
790 selectedItem->setText (4, f5);
791 QString f6 = dialog->Field6->text();
792 selectedItem->setText (5, f6);
793#else
763 modified = true; 794 modified = true;
764 // edit the selected item 795 // edit the selected item
765 QString name = dialog->NameField->text(); 796 QString name = dialog->NameField->text();
766 selectedItem->setText (0, tr (name)); 797 selectedItem->setText (0, tr (name));
767 QString user = dialog->UsernameField->text(); 798 QString user = dialog->UsernameField->text();
768 selectedItem->setText (1, tr (user)); 799 selectedItem->setText (1, tr (user));
769 QString pwd = dialog->PasswordField->text(); 800 QString pwd = dialog->PasswordField->text();
770 selectedItem->setText (2, tr (pwd)); 801 selectedItem->setText (2, tr (pwd));
771 QString comment = dialog->CommentField->text(); 802 QString comment = dialog->CommentField->text();
772 comment.replace (QRegExp("\n"), "<br>"); 803 comment.replace (QRegExp("\n"), "<br>");
773 selectedItem->setText (3, tr (comment)); 804 selectedItem->setText (3, tr (comment));
774 QString f5 = dialog->Field5->text(); 805 QString f5 = dialog->Field5->text();
775 selectedItem->setText (4, tr (f5)); 806 selectedItem->setText (4, tr (f5));
776 QString f6 = dialog->Field6->text(); 807 QString f6 = dialog->Field6->text();
777 selectedItem->setText (5, tr (f6)); 808 selectedItem->setText (5, tr (f6));
809#endif
778 } 810 }
779 811
780 delete dialog; 812 delete dialog;
781 } 813 }
782 else 814 else
783 { 815 {
784 editCategory(); 816 editCategory();
785 } 817 }
786} 818}
787 819
788void ZSafe::newPwd() 820void ZSafe::newPwd()
789{ 821{
790 if (!selectedItem) 822 if (!selectedItem)
791 return; 823 return;
792 824
793 if (!isCategory(selectedItem)) 825 if (!isCategory(selectedItem))
794 selectedItem = selectedItem->parent(); 826 selectedItem = selectedItem->parent();
795 827
796 if (isCategory(selectedItem)) 828 if (isCategory(selectedItem))
797 { 829 {
798 QString cat = selectedItem->text(0); 830 QString cat = selectedItem->text(0);
799 831
800 // open the 'New Entry' dialog 832 // open the 'New Entry' dialog
801 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); 833 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE);
802#ifdef WIN32 834#ifdef WIN32
803 dialog->setCaption ("Qt " + tr("New Entry")); 835 dialog->setCaption ("Qt " + tr("New Entry"));
804 dialog->setGeometry(200, 250, 220, 310 ); 836 dialog->setGeometry(200, 250, 220, 310 );
805#endif 837#endif
806 // set the labels 838 // set the labels
807 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 839 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
808 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 840 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
809 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 841 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
810 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 842 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
811 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); 843 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
812 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); 844 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
813retype: 845retype:
814#ifdef DESKTOP 846#ifdef DESKTOP
815#ifndef WIN32 847#ifndef WIN32
816 dialog->show(); 848 dialog->show();
817#endif 849#endif
818#else 850#else
819 dialog->showMaximized(); 851 dialog->showMaximized();
820#endif 852#endif
821 DialogCode result = (DialogCode) dialog->exec(); 853 DialogCode result = (DialogCode) dialog->exec();
822#ifdef DESKTOP 854#ifdef DESKTOP
823 result = Accepted; 855 result = Accepted;
824#endif 856#endif
825 857
826 if (result == Accepted) 858 if (result == Accepted)
827 { 859 {
828 860
829 QString name = dialog->NameField->text(); 861 QString name = dialog->NameField->text();
830 if (cat == name) 862 if (cat == name)
831 { 863 {
832 QMessageBox::critical( 0, tr("ZSafe"), 864 QMessageBox::critical( 0, tr("ZSafe"),
833 tr("Entry name must be different\nfrom the category name.") ); 865 tr("Entry name must be different\nfrom the category name.") );
834 goto retype; // it's not a good programming style :-) 866 goto retype; // it's not a good programming style :-)
835 } 867 }
836 868
837 modified = true; 869 modified = true;
838 // add the new item 870 // add the new item
839 QListViewItem *i = new ShadedListItem (0, selectedItem); 871 QListViewItem *i = new ShadedListItem (0, selectedItem);
840 i->setOpen (TRUE); 872 i->setOpen (TRUE);
841 873
874#ifdef JPATCH_HDE
875 i->setText (0, name);
876 QString user = dialog->UsernameField->text();
877 i->setText (1, user);
878 QString pwd = dialog->PasswordField->text();
879 i->setText (2, pwd);
880 QString comment = dialog->CommentField->text();
881 comment.replace (QRegExp("\n"), "<br>");
882 i->setText (3, comment);
883 QString f5 = dialog->Field5->text();
884 i->setText (4, f5);
885 QString f6 = dialog->Field6->text();
886 i->setText (5, f6);
887#else
842 i->setText (0, tr (name)); 888 i->setText (0, tr (name));
843 QString user = dialog->UsernameField->text(); 889 QString user = dialog->UsernameField->text();
844 i->setText (1, tr (user)); 890 i->setText (1, tr (user));
845 QString pwd = dialog->PasswordField->text(); 891 QString pwd = dialog->PasswordField->text();
846 i->setText (2, tr (pwd)); 892 i->setText (2, tr (pwd));
847 QString comment = dialog->CommentField->text(); 893 QString comment = dialog->CommentField->text();
848 comment.replace (QRegExp("\n"), "<br>"); 894 comment.replace (QRegExp("\n"), "<br>");
849 i->setText (3, tr (comment)); 895 i->setText (3, tr (comment));
850 QString f5 = dialog->Field5->text(); 896 QString f5 = dialog->Field5->text();
851 i->setText (4, tr (f5)); 897 i->setText (4, tr (f5));
852 QString f6 = dialog->Field6->text(); 898 QString f6 = dialog->Field6->text();
853 i->setText (5, tr (f6)); 899 i->setText (5, tr (f6));
900#endif
854 } 901 }
855 902
856 delete dialog; 903 delete dialog;
857 } 904 }
858} 905}
859 906
860void ZSafe::findPwd() 907void ZSafe::findPwd()
861{ 908{
862 909
863 // open the 'Search' dialog 910 // open the 'Search' dialog
864 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); 911 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
865#ifdef WIN32 912#ifdef WIN32
866 dialog->setCaption ("Qt " + tr("Search")); 913 dialog->setCaption ("Qt " + tr("Search"));
867#endif 914#endif
868 915
869#ifdef DESKTOP 916#ifdef DESKTOP
870#endif 917#endif
871 if (lastSearchedName) 918 if (lastSearchedName)
872 dialog->NameField->setText(lastSearchedName); 919 dialog->NameField->setText(lastSearchedName);
873 else 920 else
874 dialog->NameField->setText(""); 921 dialog->NameField->setText("");
875 if (lastSearchedUsername) 922 if (lastSearchedUsername)
876 dialog->UsernameField->setText(lastSearchedUsername); 923 dialog->UsernameField->setText(lastSearchedUsername);
877 else 924 else
878 dialog->UsernameField->setText(""); 925 dialog->UsernameField->setText("");
879 if (lastSearchedComment) 926 if (lastSearchedComment)
880 dialog->CommentField->setText(lastSearchedComment); 927 dialog->CommentField->setText(lastSearchedComment);
881 else 928 else
882 dialog->CommentField->setText(""); 929 dialog->CommentField->setText("");
883 DialogCode result = (DialogCode) dialog->exec(); 930 DialogCode result = (DialogCode) dialog->exec();
884#ifdef DESKTOP 931#ifdef DESKTOP
885 result = Accepted; 932 result = Accepted;
886#endif 933#endif
887 934
888 QString name; 935 QString name;
889 QString username; 936 QString username;
890 QString comment; 937 QString comment;
891 if (result == Accepted) 938 if (result == Accepted)
892 { 939 {
893 name = dialog->NameField->text(); 940 name = dialog->NameField->text();
894 username = dialog->UsernameField->text(); 941 username = dialog->UsernameField->text();
895 comment = dialog->CommentField->text(); 942 comment = dialog->CommentField->text();
896 qWarning (name); 943 qWarning (name);
897 } 944 }
898 else 945 else
899 { 946 {
900 delete dialog; 947 delete dialog;
901 return; 948 return;
902 } 949 }
903 950
904 if (!name.isEmpty() && name != lastSearchedName || 951 if (!name.isEmpty() && name != lastSearchedName ||
905 lastSearchedName.isEmpty() && !name.isEmpty()) 952 lastSearchedName.isEmpty() && !name.isEmpty())
906 { 953 {
907 // set search at the beginning if a new name is given 954 // set search at the beginning if a new name is given
908 lastSearchedCategory = NULL; 955 lastSearchedCategory = NULL;
909 lastSearchedItem = NULL; 956 lastSearchedItem = NULL;
910 } 957 }
911 lastSearchedName = name; 958 lastSearchedName = name;
912 if (!username.isEmpty() && username != lastSearchedUsername || 959 if (!username.isEmpty() && username != lastSearchedUsername ||
913 lastSearchedUsername.isEmpty() && !username.isEmpty()) 960 lastSearchedUsername.isEmpty() && !username.isEmpty())
914 { 961 {
915 // set search at the beginning if a new name is given 962 // set search at the beginning if a new name is given
916 lastSearchedCategory = NULL; 963 lastSearchedCategory = NULL;
917 lastSearchedItem = NULL; 964 lastSearchedItem = NULL;
@@ -1143,129 +1190,129 @@ void ZSafe::showInfo( QListViewItem *_item)
1143 // text += "<br>"; 1190 // text += "<br>";
1144 } 1191 }
1145 1192
1146 entry = selectedItem->text(3); 1193 entry = selectedItem->text(3);
1147 if (!entry.isEmpty() && entry.compare(" ")) 1194 if (!entry.isEmpty() && entry.compare(" "))
1148 { 1195 {
1149 text += "<u><b>"; 1196 text += "<u><b>";
1150 text += getFieldLabel (selectedItem, "4", tr("Comment")); 1197 text += getFieldLabel (selectedItem, "4", tr("Comment"));
1151 text += ":<br> </b></u>"; 1198 text += ":<br> </b></u>";
1152 QString comment = selectedItem->text(3); 1199 QString comment = selectedItem->text(3);
1153 comment.replace (QRegExp("\n"), "<br>"); 1200 comment.replace (QRegExp("\n"), "<br>");
1154 text += comment; 1201 text += comment;
1155 // text += "<br>"; 1202 // text += "<br>";
1156 } 1203 }
1157 1204
1158 text += "</body></html>"; 1205 text += "</body></html>";
1159 1206
1160 infoForm->InfoText->setText(text); 1207 infoForm->InfoText->setText(text);
1161 infoForm->hide(); 1208 infoForm->hide();
1162#ifdef DESKTOP 1209#ifdef DESKTOP
1163 infoForm->show(); 1210 infoForm->show();
1164#else 1211#else
1165 infoForm->showMaximized(); 1212 infoForm->showMaximized();
1166#endif 1213#endif
1167 1214
1168 } 1215 }
1169} 1216}
1170 1217
1171void ZSafe::listViewSelected( QListViewItem *_item) 1218void ZSafe::listViewSelected( QListViewItem *_item)
1172{ 1219{
1173 if (!_item) 1220 if (!_item)
1174 return; 1221 return;
1175 if (selectedItem != NULL) 1222 if (selectedItem != NULL)
1176 selectedItem->setSelected(FALSE); 1223 selectedItem->setSelected(FALSE);
1177 1224
1178 selectedItem = _item; 1225 selectedItem = _item;
1179 1226
1180#ifndef DESKTOP 1227#ifndef DESKTOP
1181 // set the column text dependent on the selected item 1228 // set the column text dependent on the selected item
1182 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); 1229 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
1183 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); 1230 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
1184 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); 1231 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
1185 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); 1232 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
1186 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); 1233 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1187 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); 1234 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1188#endif 1235#endif
1189#ifdef WIN32 1236#ifdef WIN32
1190 // set the column text dependent on the selected item 1237 // set the column text dependent on the selected item
1191 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); 1238 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
1192 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); 1239 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
1193 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); 1240 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
1194 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); 1241 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
1195 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); 1242 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1196 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); 1243 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1197#endif 1244#endif
1198 1245
1199} 1246}
1200 1247
1201bool ZSafe::isCategory(QListViewItem *_item) 1248bool ZSafe::isCategory(QListViewItem *_item)
1202{ 1249{
1203 if (_item == NULL) 1250 if (_item == NULL)
1204 return FALSE; 1251 return FALSE;
1205 1252
1206 QString categoryName = _item->text (0); 1253 QString categoryName = _item->text (0);
1207 if (categories.find ((const char *)categoryName)) 1254 if (categories.find (categoryName))
1208 return TRUE; 1255 return TRUE;
1209 else 1256 else
1210 return FALSE; 1257 return FALSE;
1211} 1258}
1212 1259
1213void ZSafe::removeAsciiFile() 1260void ZSafe::removeAsciiFile()
1214{ 1261{
1215 // QString fn = filename + ".txt"; 1262 // QString fn = filename + ".txt";
1216 // open the file dialog 1263 // open the file dialog
1217#ifndef DESKTOP 1264#ifndef DESKTOP
1218#ifndef NO_OPIE 1265#ifndef NO_OPIE
1219 QMap<QString, QStringList> mimeTypes; 1266 QMap<QString, QStringList> mimeTypes;
1220 mimeTypes.insert(tr("All"), QStringList() ); 1267 mimeTypes.insert(tr("All"), QStringList() );
1221 mimeTypes.insert(tr("Text"), "text/*" ); 1268 mimeTypes.insert(tr("Text"), "text/*" );
1222 QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 1269 QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
1223 QDir::homeDirPath() + "/Documents/application/zsafe", 1270 QDir::homeDirPath() + "/Documents/application/zsafe",
1224 QString::null, 1271 QString::null,
1225 mimeTypes, 1272 mimeTypes,
1226 this, 1273 this,
1227 tr ("Remove text file")); 1274 tr ("Remove text file"));
1228#else 1275#else
1229 QString fn = ScQtFileEdit::getOpenFileName(this, 1276 QString fn = ScQtFileEdit::getOpenFileName(this,
1230 tr ("Remove text file"), 1277 tr ("Remove text file"),
1231 QDir::homeDirPath() + "/Documents/application/zsafe", 1278 QDir::homeDirPath() + "/Documents/application/zsafe",
1232 "*.txt"); 1279 "*.txt");
1233#endif 1280#endif
1234#else 1281#else
1235 QString fn = QFileDialog::getOpenFileName( 1282 QString fn = QFileDialog::getOpenFileName(
1236 QDir::homeDirPath() + "/Documents/application/zsafe", 1283 QDir::homeDirPath() + "/Documents/application/zsafe",
1237 "ZSafe (*.txt)", 1284 "ZSafe (*.txt)",
1238 this, 1285 this,
1239 "ZSafe File Dialog" 1286 "ZSafe File Dialog"
1240 "Choose a text file" ); 1287 "Choose a text file" );
1241#endif 1288#endif
1242 1289
1243 if (fn && fn.length() > 0 ) 1290 if (fn && fn.length() > 0 )
1244 { 1291 {
1245 QFile f( fn ); 1292 QFile f( fn );
1246 if ( !f.remove() ) 1293 if ( !f.remove() )
1247 { 1294 {
1248 qWarning( QString("Could not remove file %1").arg(fn), 1295 qWarning( QString("Could not remove file %1").arg(fn),
1249 2000 ); 1296 2000 );
1250 QMessageBox::critical( 0, tr("ZSafe"), 1297 QMessageBox::critical( 0, tr("ZSafe"),
1251 tr("Could not remove text file.") ); 1298 tr("Could not remove text file.") );
1252 return; 1299 return;
1253 } 1300 }
1254 } 1301 }
1255} 1302}
1256 1303
1257void ZSafe::writeAllEntries() 1304void ZSafe::writeAllEntries()
1258{ 1305{
1259 if (filename.isEmpty()) 1306 if (filename.isEmpty())
1260 { 1307 {
1261 QMessageBox::critical( 0, tr("ZSafe"), 1308 QMessageBox::critical( 0, tr("ZSafe"),
1262 tr("No document defined.\nYou have to create a new document")); 1309 tr("No document defined.\nYou have to create a new document"));
1263 return; 1310 return;
1264 } 1311 }
1265 1312
1266 // open the file dialog 1313 // open the file dialog
1267#ifndef DESKTOP 1314#ifndef DESKTOP
1268#ifndef NO_OPIE 1315#ifndef NO_OPIE
1269 QMap<QString, QStringList> mimeTypes; 1316 QMap<QString, QStringList> mimeTypes;
1270 mimeTypes.insert(tr("All"), QStringList() ); 1317 mimeTypes.insert(tr("All"), QStringList() );
1271 mimeTypes.insert(tr("Text"), "text/*" ); 1318 mimeTypes.insert(tr("Text"), "text/*" );
@@ -1372,209 +1419,231 @@ void ZSafe::readAllEntries()
1372 tr ("Import text file")); 1419 tr ("Import text file"));
1373#else 1420#else
1374 QString fn = ScQtFileEdit::getOpenFileName(this, 1421 QString fn = ScQtFileEdit::getOpenFileName(this,
1375 tr ("Import text file"), 1422 tr ("Import text file"),
1376 QDir::homeDirPath() + "/Documents/application/zsafe", 1423 QDir::homeDirPath() + "/Documents/application/zsafe",
1377 "*.txt"); 1424 "*.txt");
1378#endif 1425#endif
1379#else 1426#else
1380 QString fn = QFileDialog::getOpenFileName( 1427 QString fn = QFileDialog::getOpenFileName(
1381 QDir::homeDirPath() + "/Documents/application/zsafe", 1428 QDir::homeDirPath() + "/Documents/application/zsafe",
1382 "ZSafe (*.txt)", 1429 "ZSafe (*.txt)",
1383 this, 1430 this,
1384 "ZSafe File Dialog" 1431 "ZSafe File Dialog"
1385 "Choose a text file" ); 1432 "Choose a text file" );
1386#endif 1433#endif
1387 1434
1388 if (fn && fn.length() > 0 ) 1435 if (fn && fn.length() > 0 )
1389 { 1436 {
1390 QFile f( fn ); 1437 QFile f( fn );
1391 if ( !f.open( IO_ReadOnly ) ) 1438 if ( !f.open( IO_ReadOnly ) )
1392 { 1439 {
1393 qWarning( QString("Could not read file %1").arg(fn), 1440 qWarning( QString("Could not read file %1").arg(fn),
1394 2000 ); 1441 2000 );
1395 QMessageBox::critical( 0, "ZSafe", 1442 QMessageBox::critical( 0, "ZSafe",
1396 QString("Could not import text file.") ); 1443 QString("Could not import text file.") );
1397 return; 1444 return;
1398 } 1445 }
1399 1446
1400 modified = true; 1447 modified = true;
1401 1448
1402 // clear the password list 1449 // clear the password list
1403 selectedItem = NULL; 1450 selectedItem = NULL;
1404 QListViewItem *i; 1451 QListViewItem *i;
1405 // step through all categories 1452 // step through all categories
1406 for (i = ListView->firstChild(); 1453 for (i = ListView->firstChild();
1407 i != NULL; 1454 i != NULL;
1408 i = i->nextSibling()) 1455 i = i->nextSibling())
1409 { 1456 {
1410 // step through all subitems 1457 // step through all subitems
1411 QListViewItem *si; 1458 QListViewItem *si;
1412 for (si = i->firstChild(); 1459 for (si = i->firstChild();
1413 si != NULL; ) 1460 si != NULL; )
1414 // si = si->nextSibling()) 1461 // si = si->nextSibling())
1415 { 1462 {
1416 QListViewItem *_si = si; 1463 QListViewItem *_si = si;
1417 si = si->nextSibling(); 1464 si = si->nextSibling();
1418 i->takeItem(_si); // remove from view list 1465 i->takeItem(_si); // remove from view list
1419 if (_si) delete _si; 1466 if (_si) delete _si;
1420 } 1467 }
1421 } 1468 }
1422 1469
1423 qWarning ("ReadAllEntries(): "); 1470 qWarning ("ReadAllEntries(): ");
1424 1471
1425 QTextStream t(&f); 1472 QTextStream t(&f);
1426 while ( !t.eof() ) 1473 while ( !t.eof() )
1427 { 1474 {
1428 QString s = t.readLine(); 1475 QString s = t.readLine();
1429 s.replace (QRegExp("\";\""), "\"|\""); 1476 s.replace (QRegExp("\";\""), "\"|\"");
1430 // char buffer[1024]; 1477 // char buffer[1024];
1431#ifndef WIN32 1478#ifndef WIN32
1432 char buffer[s.length()+1]; 1479 char buffer[s.length()+1];
1433#else 1480#else
1434 char buffer[4048]; 1481 char buffer[4048];
1435#endif 1482#endif
1436 strcpy (buffer, s); 1483
1484
1485 /* modify QString -> QCString::utf8 */
1486
1487 strcpy (buffer, s.utf8());
1437 1488
1438 QString name; 1489 QString name;
1439 QString user; 1490 QString user;
1440 QString password; 1491 QString password;
1441 QString comment; 1492 QString comment;
1442 QString field5=""; 1493 QString field5="";
1443 QString field6=""; 1494 QString field6="";
1444 1495
1445 // separete the entries 1496 // separete the entries
1446 char *i = strtok (buffer, "|"); 1497 char *i = strtok (buffer, "|");
1447 QString category(&i[1]); 1498 QString category(QString::fromUtf8(&i[1]));
1448 category.truncate(category.length() -1); 1499 category.truncate(category.length() -1);
1449 1500
1450 int idx=0; 1501 int idx=0;
1451 while ((i = strtok (NULL, "|")) != NULL) 1502 while ((i = strtok (NULL, "|")) != NULL)
1452 { 1503 {
1453 switch (idx) 1504 switch (idx)
1454 { 1505 {
1455 case 0: 1506 case 0:
1456 name = &i[1]; 1507 name = QString::fromUtf8(&i[1]);
1457 name.truncate(name.length() -1); 1508 name.truncate(name.length() -1);
1458 // name 1509 // name
1459 break; 1510 break;
1460 case 1: 1511 case 1:
1461 // user 1512 // user
1462 user = &i[1]; 1513 user = QString::fromUtf8(&i[1]);
1463 user.truncate(user.length() -1); 1514 user.truncate(user.length() -1);
1464 break; 1515 break;
1465 case 2: 1516 case 2:
1466 // password 1517 // password
1467 password = &i[1]; 1518 password = QString::fromUtf8(&i[1]);
1468 password.truncate(password.length() -1); 1519 password.truncate(password.length() -1);
1469 break; 1520 break;
1470 case 3: 1521 case 3:
1471 // comment 1522 // comment
1472 comment = &i[1]; 1523 comment = QString::fromUtf8(&i[1]);
1473 comment.truncate(comment.length() -1); 1524 comment.truncate(comment.length() -1);
1474 break; 1525 break;
1475 case 4: 1526 case 4:
1476 // field5 1527 // field5
1477 field5 = &i[1]; 1528 field5 = QString::fromUtf8(&i[1]);
1478 field5.truncate(field5.length() -1); 1529 field5.truncate(field5.length() -1);
1479 break; 1530 break;
1480 case 5: 1531 case 5:
1481 // field6 1532 // field6
1482 field6 = &i[1]; 1533 field6 = QString::fromUtf8(&i[1]);
1483 field6.truncate(field6.length() -1); 1534 field6.truncate(field6.length() -1);
1484 break; 1535 break;
1485 } 1536 }
1486 idx++; 1537 idx++;
1487 } 1538 }
1488 1539
1489 Category *cat= categories.find (category); 1540 Category *cat= categories.find (category);
1490 if (cat) 1541 if (cat)
1491 { 1542 {
1492 // use the existend item 1543 // use the existend item
1493 QListViewItem *catItem = cat->getListItem(); 1544 QListViewItem *catItem = cat->getListItem();
1494 if (catItem) 1545 if (catItem)
1495 { 1546 {
1496 QListViewItem * item = new ShadedListItem( 0, catItem ); 1547 QListViewItem * item = new ShadedListItem( 0, catItem );
1548#ifdef JPATCH_HDE
1549 item->setText( 0, name );
1550 item->setText( 1, user );
1551 item->setText( 2, password );
1552 item->setText( 3, comment );
1553 item->setText( 4, field5 );
1554 item->setText( 5, field6 );
1555#else
1497 item->setText( 0, tr( name ) ); 1556 item->setText( 0, tr( name ) );
1498 item->setText( 1, tr( user ) ); 1557 item->setText( 1, tr( user ) );
1499 item->setText( 2, tr( password ) ); 1558 item->setText( 2, tr( password ) );
1500 item->setText( 3, tr( comment ) ); 1559 item->setText( 3, tr( comment ) );
1501 item->setText( 4, tr( field5 ) ); 1560 item->setText( 4, tr( field5 ) );
1502 item->setText( 5, tr( field6 ) ); 1561 item->setText( 5, tr( field6 ) );
1503 catItem->setOpen( TRUE ); 1562 catItem->setOpen( TRUE );
1563#endif
1504 } 1564 }
1505 } 1565 }
1506 else 1566 else
1507 { 1567 {
1508 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1568 QListViewItem *catI = new ShadedListItem( 1, ListView );
1509 // create and insert a new item 1569 // create and insert a new item
1510 QListViewItem * item = new ShadedListItem( 0, catI ); 1570 QListViewItem * item = new ShadedListItem( 0, catI );
1571#ifdef JPATCH_HDE
1572 item->setText( 0, name );
1573 item->setText( 1, user );
1574 item->setText( 2, password );
1575 item->setText( 3, comment );
1576 item->setText( 4, field5 );
1577 item->setText( 5, field6 );
1578#else
1511 item->setText( 0, tr( name ) ); 1579 item->setText( 0, tr( name ) );
1512 item->setText( 1, tr( user ) ); 1580 item->setText( 1, tr( user ) );
1513 item->setText( 2, tr( password ) ); 1581 item->setText( 2, tr( password ) );
1514 item->setText( 3, tr( comment ) ); 1582 item->setText( 3, tr( comment ) );
1515 item->setText( 4, tr( field5 ) ); 1583 item->setText( 4, tr( field5 ) );
1516 item->setText( 5, tr( field6 ) ); 1584 item->setText( 5, tr( field6 ) );
1585#endif
1517 catI->setOpen( TRUE ); 1586 catI->setOpen( TRUE );
1518 1587
1519 Category *c1 = new Category(); 1588 Category *c1 = new Category();
1520 c1->setCategoryName(category); 1589 c1->setCategoryName(category);
1521 1590
1522 QString icon; 1591 QString icon;
1523 QString fullIconPath; 1592 QString fullIconPath;
1524 QPixmap *pix; 1593 QPixmap *pix;
1525// #ifndef WIN32 1594// #ifndef WIN32
1526 icon = conf->readEntry(APP_KEY+category); 1595 icon = conf->readEntry(APP_KEY+category);
1527// #endif 1596// #endif
1528 bool isIconAv = false; 1597 bool isIconAv = false;
1529 if (!icon.isEmpty() && !icon.isNull()) 1598 if (!icon.isEmpty() && !icon.isNull())
1530 { 1599 {
1531 // build the full path 1600 // build the full path
1532 fullIconPath = iconPath + icon; 1601 fullIconPath = iconPath + icon;
1533 pix = new QPixmap (fullIconPath); 1602 pix = new QPixmap (fullIconPath);
1534 if (pix) 1603 if (pix)
1535 { 1604 {
1536 QImage img = pix->convertToImage(); 1605 QImage img = pix->convertToImage();
1537 pix->convertFromImage(img.smoothScale(14,14)); 1606 pix->convertFromImage(img.smoothScale(14,14));
1538 c1->setIconName (icon); 1607 c1->setIconName (icon);
1539 c1->setIcon (*pix); 1608 c1->setIcon (*pix);
1540 isIconAv = true; 1609 isIconAv = true;
1541 } 1610 }
1542 } 1611 }
1543 if (!isIconAv) 1612 if (!isIconAv)
1544 { 1613 {
1545 c1->setIcon (*getPredefinedIcon(category)); 1614 c1->setIcon (*getPredefinedIcon(category));
1546 } 1615 }
1547 c1->setListItem (catI); 1616 c1->setListItem (catI);
1548 c1->initListItem(); 1617 c1->initListItem();
1549 categories.insert (c1->getCategoryName(), c1); 1618 categories.insert (c1->getCategoryName(), c1);
1550 } 1619 }
1551 1620
1552 } 1621 }
1553 f.close(); 1622 f.close();
1554 1623
1555 } 1624 }
1556 else 1625 else
1557 { 1626 {
1558 } 1627 }
1559 1628
1560} 1629}
1561 1630
1562#ifdef UNUSED 1631#ifdef UNUSED
1563void ZSafe::writeAllEntries() 1632void ZSafe::writeAllEntries()
1564{ 1633{
1565 // open the file for writing 1634 // open the file for writing
1566 QString fn = filename + ".txt"; 1635 QString fn = filename + ".txt";
1567 QFile f( fn ); 1636 QFile f( fn );
1568 if ( !f.open( IO_WriteOnly ) ) { 1637 if ( !f.open( IO_WriteOnly ) ) {
1569 qWarning( QString("Could not write to file %1").arg(fn), 1638 qWarning( QString("Could not write to file %1").arg(fn),
1570 2000 ); 1639 2000 );
1571 QMessageBox::critical( 0, tr("ZSafe"), 1640 QMessageBox::critical( 0, tr("ZSafe"),
1572 tr("Could not export to text file.") ); 1641 tr("Could not export to text file.") );
1573 return; 1642 return;
1574 } 1643 }
1575 QTextStream t( &f ); 1644 QTextStream t( &f );
1576 1645
1577 QListViewItem *i; 1646 QListViewItem *i;
1578 // step through all categories 1647 // step through all categories
1579 for (i = ListView->firstChild(); 1648 for (i = ListView->firstChild();
1580 i != NULL; 1649 i != NULL;
@@ -1652,144 +1721,158 @@ void ZSafe::readAllEntries()
1652 1721
1653 qWarning ("ReadAllEntries(): "); 1722 qWarning ("ReadAllEntries(): ");
1654 1723
1655 QTextStream t(&f); 1724 QTextStream t(&f);
1656 while ( !t.eof() ) 1725 while ( !t.eof() )
1657 { 1726 {
1658 QString s = t.readLine(); 1727 QString s = t.readLine();
1659 s.replace (QRegExp("\";\""), "\"|\""); 1728 s.replace (QRegExp("\";\""), "\"|\"");
1660 // char buffer[1024]; 1729 // char buffer[1024];
1661 int len=s.length()+1; 1730 int len=s.length()+1;
1662#ifdef WIN32 1731#ifdef WIN32
1663 char buffer[512]; 1732 char buffer[512];
1664#else 1733#else
1665 char buffer[len]; 1734 char buffer[len];
1666#endif 1735#endif
1667 strcpy (buffer, s); 1736 strcpy (buffer, s);
1668 1737
1669 QString name; 1738 QString name;
1670 QString user; 1739 QString user;
1671 QString password; 1740 QString password;
1672 QString comment; 1741 QString comment;
1673 1742
1674 // separete the entries 1743 // separete the entries
1675 char *i = strtok (buffer, "|"); 1744 char *i = strtok (buffer, "|");
1676 QString category(&i[1]); 1745 QString category(&i[1]);
1677 category.truncate(category.length() -1); 1746 category.truncate(category.length() -1);
1678 1747
1679 int idx=0; 1748 int idx=0;
1680 while (i = strtok (NULL, "|")) 1749 while (i = strtok (NULL, "|"))
1681 { 1750 {
1682 switch (idx) 1751 switch (idx)
1683 { 1752 {
1684 case 0: 1753 case 0:
1685 name = &i[1]; 1754 name = &i[1];
1686 name.truncate(name.length() -1); 1755 name.truncate(name.length() -1);
1687 // name 1756 // name
1688 break; 1757 break;
1689 case 1: 1758 case 1:
1690 // user 1759 // user
1691 user = &i[1]; 1760 user = &i[1];
1692 user.truncate(user.length() -1); 1761 user.truncate(user.length() -1);
1693 break; 1762 break;
1694 case 2: 1763 case 2:
1695 // password 1764 // password
1696 password = &i[1]; 1765 password = &i[1];
1697 password.truncate(password.length() -1); 1766 password.truncate(password.length() -1);
1698 break; 1767 break;
1699 case 3: 1768 case 3:
1700 // comment 1769 // comment
1701 comment = &i[1]; 1770 comment = &i[1];
1702 comment.truncate(comment.length() -1); 1771 comment.truncate(comment.length() -1);
1703 break; 1772 break;
1704 } 1773 }
1705 idx++; 1774 idx++;
1706 } 1775 }
1707 1776
1708 Category *cat= categories.find (category); 1777 Category *cat= categories.find (category);
1709 if (cat) 1778 if (cat)
1710 { 1779 {
1711 // use the existend item 1780 // use the existend item
1712 QListViewItem *catItem = cat->getListItem(); 1781 QListViewItem *catItem = cat->getListItem();
1713 if (catItem) 1782 if (catItem)
1714 { 1783 {
1715 QListViewItem * item = new ShadedListItem( 0, catItem ); 1784 QListViewItem * item = new ShadedListItem( 0, catItem );
1785#ifdef JPATCH_HDE
1786 item->setText( 0, name );
1787 item->setText( 1, user );
1788 item->setText( 2, password );
1789 item->setText( 3, comment );
1790#else
1716 item->setText( 0, tr( name ) ); 1791 item->setText( 0, tr( name ) );
1717 item->setText( 1, tr( user ) ); 1792 item->setText( 1, tr( user ) );
1718 item->setText( 2, tr( password ) ); 1793 item->setText( 2, tr( password ) );
1719 item->setText( 3, tr( comment ) ); 1794 item->setText( 3, tr( comment ) );
1795#endif
1720 catItem->setOpen( TRUE ); 1796 catItem->setOpen( TRUE );
1721 } 1797 }
1722 } 1798 }
1723 else 1799 else
1724 { 1800 {
1725 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1801 QListViewItem *catI = new ShadedListItem( 1, ListView );
1726 // create and insert a new item 1802 // create and insert a new item
1727 QListViewItem * item = new ShadedListItem( 0, catI ); 1803 QListViewItem * item = new ShadedListItem( 0, catI );
1804#ifdef JPATCH_HDE
1805 item->setText( 0, name );
1806 item->setText( 1, user );
1807 item->setText( 2, password );
1808 item->setText( 3, comment );
1809#else
1728 item->setText( 0, tr( name ) ); 1810 item->setText( 0, tr( name ) );
1729 item->setText( 1, tr( user ) ); 1811 item->setText( 1, tr( user ) );
1730 item->setText( 2, tr( password ) ); 1812 item->setText( 2, tr( password ) );
1731 item->setText( 3, tr( comment ) ); 1813 item->setText( 3, tr( comment ) );
1814#endif
1732 catI->setOpen( TRUE ); 1815 catI->setOpen( TRUE );
1733 1816
1734 Category *c1 = new Category(); 1817 Category *c1 = new Category();
1735 c1->setCategoryName(category); 1818 c1->setCategoryName(category);
1736 1819
1737 QString icon; 1820 QString icon;
1738 QString fullIconPath; 1821 QString fullIconPath;
1739 QPixmap *pix; 1822 QPixmap *pix;
1740// #ifndef WIN32 1823// #ifndef WIN32
1741 icon = conf->readEntry(APP_KEY+category); 1824 icon = conf->readEntry(APP_KEY+category);
1742// #endif 1825// #endif
1743 bool isIconAv = false; 1826 bool isIconAv = false;
1744 if (!icon.isEmpty() && !icon.isNull()) 1827 if (!icon.isEmpty() && !icon.isNull())
1745 { 1828 {
1746 // build the full path 1829 // build the full path
1747 fullIconPath = iconPath + icon; 1830 fullIconPath = iconPath + icon;
1748 pix = new QPixmap (fullIconPath); 1831 pix = new QPixmap (fullIconPath);
1749 if (pix) 1832 if (pix)
1750 { 1833 {
1751 QImage img = pix->convertToImage(); 1834 QImage img = pix->convertToImage();
1752 pix->convertFromImage(img.smoothScale(14,14)); 1835 pix->convertFromImage(img.smoothScale(14,14));
1753 c1->setIconName (icon); 1836 c1->setIconName (icon);
1754 c1->setIcon (*pix); 1837 c1->setIcon (*pix);
1755 isIconAv = true; 1838 isIconAv = true;
1756 } 1839 }
1757 } 1840 }
1758 if (!isIconAv) 1841 if (!isIconAv)
1759 { 1842 {
1760 c1->setIcon (*getPredefinedIcon(category)); 1843 c1->setIcon (*getPredefinedIcon(category));
1761 } 1844 }
1762 c1->setListItem (catI); 1845 c1->setListItem (catI);
1763 c1->initListItem(); 1846 c1->initListItem();
1764 categories.insert (c1->getCategoryName(), c1); 1847 categories.insert (c1->getCategoryName(), c1);
1765 } 1848 }
1766 1849
1767 } 1850 }
1768 f.close(); 1851 f.close();
1769 1852
1770} 1853}
1771#endif // UNUSED 1854#endif // UNUSED
1772 1855
1773void ZSafe::resume(int) 1856void ZSafe::resume(int)
1774{ 1857{
1775 qWarning ("Resume"); 1858 qWarning ("Resume");
1776 // hide the main window 1859 // hide the main window
1777 1860
1778 infoForm->hide(); 1861 infoForm->hide();
1779 // open zsafe again 1862 // open zsafe again
1780 m_password = ""; 1863 m_password = "";
1781 selectedItem = NULL; 1864 selectedItem = NULL;
1782 1865
1783 // clear the password list 1866 // clear the password list
1784 QListViewItem *i; 1867 QListViewItem *i;
1785 // step through all categories 1868 // step through all categories
1786 for (i = ListView->firstChild(); 1869 for (i = ListView->firstChild();
1787 i != NULL; 1870 i != NULL;
1788 i = i->nextSibling()) 1871 i = i->nextSibling())
1789 { 1872 {
1790 // step through all subitems 1873 // step through all subitems
1791 QListViewItem *si; 1874 QListViewItem *si;
1792 for (si = i->firstChild(); 1875 for (si = i->firstChild();
1793 si != NULL; ) 1876 si != NULL; )
1794 { 1877 {
1795 QListViewItem *_si = si; 1878 QListViewItem *_si = si;
@@ -1848,167 +1931,185 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1848#else 1931#else
1849 this->setCaption("ZSafe"); 1932 this->setCaption("ZSafe");
1850#endif 1933#endif
1851 filename = ""; 1934 filename = "";
1852 return false; 1935 return false;
1853 } 1936 }
1854 1937
1855 1938
1856 // load the validation entry 1939 // load the validation entry
1857 if (validationFlag == 0) 1940 if (validationFlag == 0)
1858 { 1941 {
1859 pwdOk = 1; 1942 pwdOk = 1;
1860 break; 1943 break;
1861 } 1944 }
1862 1945
1863 retval = loadEntry(entry); 1946 retval = loadEntry(entry);
1864 if (retval == 1 && 1947 if (retval == 1 &&
1865 !strcmp (entry[0], "ZSAFECATEGORY") && 1948 !strcmp (entry[0], "ZSAFECATEGORY") &&
1866 !strcmp (entry[1], "name") && 1949 !strcmp (entry[1], "name") &&
1867 !strcmp (entry[2], "username") && 1950 !strcmp (entry[2], "username") &&
1868 !strcmp (entry[3], "password") && 1951 !strcmp (entry[3], "password") &&
1869 !strcmp (entry[4], "comment") ) 1952 !strcmp (entry[4], "comment") )
1870 { 1953 {
1871 for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); 1954 for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1872 pwdOk = 1; 1955 pwdOk = 1;
1873 break; 1956 break;
1874 } 1957 }
1875 else 1958 else
1876 // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); 1959 // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1877 fclose (fd); 1960 fclose (fd);
1878 m_password = ""; 1961 m_password = "";
1879 1962
1880 if (i < numberOfTries - 1) 1963 if (i < numberOfTries - 1)
1881 { 1964 {
1882 switch( QMessageBox::warning( this, tr("ZSafe"), 1965 switch( QMessageBox::warning( this, tr("ZSafe"),
1883 tr("Wrong password.\nEnter again?"), 1966 tr("Wrong password.\nEnter again?"),
1884 tr("&Yes"), tr("&No."), 1967 tr("&Yes"), tr("&No."),
1885 0 1968 0
1886 ) ) 1969 ) )
1887 { 1970 {
1888 case 1: // No 1971 case 1: // No
1889 exitZs (1); 1972 exitZs (1);
1890 break; 1973 break;
1891 case 0: // Yes 1974 case 0: // Yes
1892 continue; 1975 continue;
1893 } 1976 }
1894 } 1977 }
1895 } 1978 }
1896 if (pwdOk == 0) 1979 if (pwdOk == 0)
1897 { 1980 {
1898 // unset the document entry 1981 // unset the document entry
1899 conf->writeEntry(APP_KEY+"document", "INVALIDPWD"); 1982 conf->writeEntry(APP_KEY+"document", "INVALIDPWD");
1900 if (conf) 1983 if (conf)
1901 delete conf; 1984 delete conf;
1902 1985
1903 exitZs (1); 1986 exitZs (1);
1904 } 1987 }
1905 1988
1906 1989
1907 retval = loadEntry(entry); 1990 retval = loadEntry(entry);
1908 1991
1909 int numberOfEntries=0; 1992 int numberOfEntries=0;
1910 while (retval == 1) { 1993 while (retval == 1) {
1911 1994
1912 QString category(entry[0]); 1995 QString category( QString::fromUtf8(entry[0]) );
1913 QString name(entry[1]); 1996 QString name( QString::fromUtf8(entry[1]) );
1914 QString user(entry[2]); 1997 QString user( QString::fromUtf8(entry[2]) );
1915 QString password(entry[3]); 1998 QString password( QString::fromUtf8(entry[3]) );
1916 QString comment(entry[4]); 1999 QString comment( QString::fromUtf8(entry[4]) );
1917 QString field5(entry[5]); 2000 QString field5( QString::fromUtf8(entry[5]) );
1918 QString field6(entry[6]); 2001 QString field6( QString::fromUtf8(entry[6]) );
1919 // add the subitems to the categories 2002 // add the subitems to the categories
1920 2003
1921 Category *cat= categories.find (category); 2004 Category *cat= categories.find (category);
1922 if (cat) 2005 if (cat)
1923 { 2006 {
1924 // use the existend item 2007 // use the existend item
1925 QListViewItem *catItem = cat->getListItem(); 2008 QListViewItem *catItem = cat->getListItem();
1926 if (catItem) 2009 if (catItem)
1927 { 2010 {
1928 QListViewItem * item = new ShadedListItem( 0, catItem ); 2011 QListViewItem * item = new ShadedListItem( 0, catItem );
2012#ifdef JPATCH_HDE
2013 item->setText( 0, name );
2014 item->setText( 1, user );
2015 item->setText( 2, password );
2016 item->setText( 3, comment );
2017 item->setText( 4, field5 );
2018 item->setText( 5, field6 );
2019#else
1929 item->setText( 0, tr( name ) ); 2020 item->setText( 0, tr( name ) );
1930 item->setText( 1, tr( user ) ); 2021 item->setText( 1, tr( user ) );
1931 item->setText( 2, tr( password ) ); 2022 item->setText( 2, tr( password ) );
1932 item->setText( 3, tr( comment ) ); 2023 item->setText( 3, tr( comment ) );
1933 item->setText( 4, tr( field5 ) ); 2024 item->setText( 4, tr( field5 ) );
1934 item->setText( 5, tr( field6 ) ); 2025 item->setText( 5, tr( field6 ) );
2026#endif
1935 if (expandTree) 2027 if (expandTree)
1936 catItem->setOpen( TRUE ); 2028 catItem->setOpen( TRUE );
1937 numberOfEntries++; 2029 numberOfEntries++;
1938 } 2030 }
1939 } 2031 }
1940 else 2032 else
1941 { 2033 {
1942 QListViewItem *catI = new ShadedListItem( 1, ListView ); 2034 QListViewItem *catI = new ShadedListItem( 1, ListView );
1943 // create and insert a new item 2035 // create and insert a new item
1944 QListViewItem * item = new ShadedListItem( 0, catI ); 2036 QListViewItem * item = new ShadedListItem( 0, catI );
2037#ifdef JPATCH_HDE
2038 item->setText( 0, name );
2039 item->setText( 1, user );
2040 item->setText( 2, password );
2041 item->setText( 3, comment );
2042 item->setText( 4, field5 );
2043 item->setText( 5, field6 );
2044#else
1945 item->setText( 0, tr( name ) ); 2045 item->setText( 0, tr( name ) );
1946 item->setText( 1, tr( user ) ); 2046 item->setText( 1, tr( user ) );
1947 item->setText( 2, tr( password ) ); 2047 item->setText( 2, tr( password ) );
1948 item->setText( 3, tr( comment ) ); 2048 item->setText( 3, tr( comment ) );
1949 item->setText( 4, tr( field5 ) ); 2049 item->setText( 4, tr( field5 ) );
1950 item->setText( 5, tr( field6 ) ); 2050 item->setText( 5, tr( field6 ) );
2051#endif
1951 if (expandTree) 2052 if (expandTree)
1952 catI->setOpen( TRUE ); 2053 catI->setOpen( TRUE );
1953 2054
1954 Category *c1 = new Category(); 2055 Category *c1 = new Category();
1955 c1->setCategoryName(category); 2056 c1->setCategoryName(category);
1956 2057
1957 QString icon; 2058 QString icon;
1958 QString fullIconPath; 2059 QString fullIconPath;
1959 QPixmap *pix; 2060 QPixmap *pix;
1960// #ifndef WIN32 2061// #ifndef WIN32
1961 icon = conf->readEntry(APP_KEY+category); 2062 icon = conf->readEntry(APP_KEY+category);
1962// #endif 2063// #endif
1963 bool isIconAv = false; 2064 bool isIconAv = false;
1964 if (!icon.isEmpty() && !icon.isNull()) 2065 if (!icon.isEmpty() && !icon.isNull())
1965 { 2066 {
1966 // build the full path 2067 // build the full path
1967 fullIconPath = iconPath + icon; 2068 fullIconPath = iconPath + icon;
1968 pix = new QPixmap (fullIconPath); 2069 pix = new QPixmap (fullIconPath);
1969 if (pix) 2070 if (pix)
1970 { 2071 {
1971 QImage img = pix->convertToImage(); 2072 QImage img = pix->convertToImage();
1972 pix->convertFromImage(img.smoothScale(14,14)); 2073 pix->convertFromImage(img.smoothScale(14,14));
1973 c1->setIconName (icon); 2074 c1->setIconName (icon);
1974 c1->setIcon (*pix); 2075 c1->setIcon (*pix);
1975 isIconAv = true; 2076 isIconAv = true;
1976 } 2077 }
1977 } 2078 }
1978 if (!isIconAv) 2079 if (!isIconAv)
1979 { 2080 {
1980 c1->setIcon (*getPredefinedIcon(category)); 2081 c1->setIcon (*getPredefinedIcon(category));
1981 } 2082 }
1982 2083
1983 c1->setListItem (catI); 2084 c1->setListItem (catI);
1984 c1->initListItem(); 2085 c1->initListItem();
1985 categories.insert (c1->getCategoryName(), c1); 2086 categories.insert (c1->getCategoryName(), c1);
1986 numberOfEntries++; 2087 numberOfEntries++;
1987 } 2088 }
1988 2089
1989 for (int count = 0; count < FIELD_SIZE; count++) { 2090 for (int count = 0; count < FIELD_SIZE; count++) {
1990 free(entry[count]); 2091 free(entry[count]);
1991 } 2092 }
1992 retval = loadEntry(entry); 2093 retval = loadEntry(entry);
1993 if (retval == 2) { 2094 if (retval == 2) {
1994 // m_parent->slotStatusHelpMsg("Last entry loaded"); 2095 // m_parent->slotStatusHelpMsg("Last entry loaded");
1995 } 2096 }
1996 } // end while 2097 } // end while
1997 2098
1998 if (numberOfEntries == 0) 2099 if (numberOfEntries == 0)
1999 { 2100 {
2000 2101
2001 switch( QMessageBox::warning( this, tr("ZSafe"), 2102 switch( QMessageBox::warning( this, tr("ZSafe"),
2002 tr("Empty document or\nwrong password.\nContinue?"), 2103 tr("Empty document or\nwrong password.\nContinue?"),
2003 tr("&No"), tr("&Yes."), 2104 tr("&No"), tr("&Yes."),
2004 0 2105 0
2005 ) ) { 2106 ) ) {
2006 case 0: // No 2107 case 0: // No
2007 retval = loadFinalize(); 2108 retval = loadFinalize();
2008 exitZs (1); 2109 exitZs (1);
2009 break; 2110 break;
2010 case 1: // Yes 2111 case 1: // Yes
2011 break; 2112 break;
2012 } 2113 }
2013 } 2114 }
2014 2115
@@ -2198,143 +2299,142 @@ bool ZSafe::saveDocument(const char* _filename,
2198 break; 2299 break;
2199 case 1: // Don't Save clicked or Alt-D pressed 2300 case 1: // Don't Save clicked or Alt-D pressed
2200 modified = false; 2301 modified = false;
2201 return true; 2302 return true;
2202 } 2303 }
2203 } 2304 }
2204 modified = false; 2305 modified = false;
2205 2306
2206 if (m_password.isEmpty()) 2307 if (m_password.isEmpty())
2207 return false; 2308 return false;
2208 2309
2209 int retval = saveInit(_filename, m_password); 2310 int retval = saveInit(_filename, m_password);
2210 // int retval = saveInit(_filename, "test"); 2311 // int retval = saveInit(_filename, "test");
2211 if (retval != PWERR_GOOD) { 2312 if (retval != PWERR_GOOD) {
2212 return false; 2313 return false;
2213 } 2314 }
2214 2315
2215 char* entry[FIELD_SIZE]; 2316 char* entry[FIELD_SIZE];
2216 2317
2217 // save the validation entry 2318 // save the validation entry
2218 { 2319 {
2219 int i=0; 2320 int i=0;
2220 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); 2321 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
2221 strcpy(entry[i++], "ZSAFECATEGORY"); 2322 strcpy(entry[i++], "ZSAFECATEGORY");
2222 entry[i] = (char*)malloc(strlen("name")+1); 2323 entry[i] = (char*)malloc(strlen("name")+1);
2223 strcpy(entry[i++], "name"); 2324 strcpy(entry[i++], "name");
2224 entry[i] = (char*)malloc(strlen("username")+1); 2325 entry[i] = (char*)malloc(strlen("username")+1);
2225 strcpy(entry[i++], "username"); 2326 strcpy(entry[i++], "username");
2226 entry[i] = (char*)malloc(strlen("password")+1); 2327 entry[i] = (char*)malloc(strlen("password")+1);
2227 strcpy(entry[i++], "password"); 2328 strcpy(entry[i++], "password");
2228 entry[i] = (char*)malloc(strlen("comment")+1); 2329 entry[i] = (char*)malloc(strlen("comment")+1);
2229 strcpy(entry[i++], "comment"); 2330 strcpy(entry[i++], "comment");
2230 2331
2231 entry[i] = (char*)malloc(strlen("field5")+1); 2332 entry[i] = (char*)malloc(strlen("field5")+1);
2232 strcpy(entry[i++], "field5"); 2333 strcpy(entry[i++], "field5");
2233 entry[i] = (char*)malloc(strlen("field6")+1); 2334 entry[i] = (char*)malloc(strlen("field6")+1);
2234 strcpy(entry[i++], "field6"); 2335 strcpy(entry[i++], "field6");
2235 2336
2236 retval = saveEntry(entry); 2337 retval = saveEntry(entry);
2237 for (int z=0; z<i; z++) free(entry[z]); 2338 for (int z=0; z<i; z++) free(entry[z]);
2238 if (retval == PWERR_DATA) { 2339 if (retval == PWERR_DATA) {
2239 qWarning("1: Error writing file, contents not saved"); 2340 qWarning("1: Error writing file, contents not saved");
2240 saveFinalize(); 2341 saveFinalize();
2241 return false; 2342 return false;
2242 } 2343 }
2243// #ifndef WIN32 2344// #ifndef WIN32
2244 conf->writeEntry(APP_KEY+"valzsafe", 1); 2345 conf->writeEntry(APP_KEY+"valzsafe", 1);
2245// #endif 2346// #endif
2246 saveConf(); 2347 saveConf();
2247 } 2348 }
2248 2349
2249 QListViewItem *i; 2350 QListViewItem *i;
2250 // step through all categories 2351 // step through all categories
2251 for (i = ListView->firstChild(); 2352 for (i = ListView->firstChild();
2252 i != NULL; 2353 i != NULL;
2253 i = i->nextSibling()) 2354 i = i->nextSibling())
2254 { 2355 {
2255 // step through all subitems 2356 // step through all subitems
2256 QListViewItem *si; 2357 QListViewItem *si;
2257 for (si = i->firstChild(); 2358 for (si = i->firstChild();
2258 si != NULL; 2359 si != NULL;
2259 si = si->nextSibling()) 2360 si = si->nextSibling())
2260 { 2361 {
2261 int j=0; 2362 int j=0;
2262 entry[j] = (char*)malloc(strlen(i->text(0))+1); 2363 entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1);
2263 strcpy(entry[j++], i->text(0)); 2364 strcpy(entry[j++], i->text(0).utf8());
2264 entry[j] = (char*)malloc(strlen(si->text(0))+1); 2365 entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1);
2265 strcpy(entry[j++], si->text(0)); 2366 strcpy(entry[j++], si->text(0).utf8());
2266 entry[j] = (char*)malloc(strlen(si->text(1))+1); 2367 entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1);
2267 strcpy(entry[j++], si->text(1)); 2368 strcpy(entry[j++], si->text(1).utf8());
2268 entry[j] = (char*)malloc(strlen(si->text(2))+1); 2369 entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1);
2269 strcpy(entry[j++], si->text(2)); 2370 strcpy(entry[j++], si->text(2).utf8());
2270 entry[j] = (char*)malloc(strlen(si->text(3))+1); 2371 entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1);
2271 strcpy(entry[j++], si->text(3)); 2372 strcpy(entry[j++], si->text(3).utf8());
2272 2373 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1);
2273 entry[j] = (char*)malloc(strlen(si->text(4))+1); 2374 strcpy(entry[j++], si->text(4).utf8());
2274 strcpy(entry[j++], si->text(4)); 2375 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1);
2275 entry[j] = (char*)malloc(strlen(si->text(5))+1); 2376 strcpy(entry[j++], si->text(5).utf8());
2276 strcpy(entry[j++], si->text(5));
2277 2377
2278 retval = saveEntry(entry); 2378 retval = saveEntry(entry);
2279 for (int z=0; z<j; z++) 2379 for (int z=0; z<j; z++)
2280 { 2380 {
2281 free(entry[z]); 2381 free(entry[z]);
2282 } 2382 }
2283 if (retval == PWERR_DATA) { 2383 if (retval == PWERR_DATA) {
2284 qWarning("1: Error writing file, contents not saved"); 2384 qWarning("1: Error writing file, contents not saved");
2285 saveFinalize(); 2385 saveFinalize();
2286 return false; 2386 return false;
2287 } 2387 }
2288 2388
2289 } 2389 }
2290 } 2390 }
2291 2391
2292 if (saveFinalize() == PWERR_DATA) { 2392 if (saveFinalize() == PWERR_DATA) {
2293 qWarning("2: Error writing file, contents not saved"); 2393 qWarning("2: Error writing file, contents not saved");
2294 return false; 2394 return false;
2295 } else { 2395 } else {
2296#ifndef DESKTOP 2396#ifndef DESKTOP
2297 Global::statusMessage (tr("Password file saved.")); 2397 Global::statusMessage (tr("Password file saved."));
2298#endif 2398#endif
2299 modified = false; 2399 modified = false;
2300 return true; 2400 return true;
2301 } 2401 }
2302} 2402}
2303 2403
2304PasswordForm *newPwdDialog; 2404PasswordForm *newPwdDialog;
2305bool newPwdDialogResult = false; 2405bool newPwdDialogResult = false;
2306void ZSafe::setPasswordDialogDone() 2406void ZSafe::setPasswordDialogDone()
2307{ 2407{
2308 newPwdDialogResult = true; 2408 newPwdDialogResult = true;
2309 newPwdDialog->close(); 2409 newPwdDialog->close();
2310} 2410}
2311 2411
2312void ZSafe::getDocPassword(QString title) 2412void ZSafe::getDocPassword(QString title)
2313{ 2413{
2314qWarning ("getDocPassword"); 2414qWarning ("getDocPassword");
2315 // open the 'Password' dialog 2415 // open the 'Password' dialog
2316 PasswordForm *dialog = new PasswordForm(this, title, TRUE); 2416 PasswordForm *dialog = new PasswordForm(this, title, TRUE);
2317 newPwdDialog = dialog; 2417 newPwdDialog = dialog;
2318 newPwdDialogResult = false; 2418 newPwdDialogResult = false;
2319 2419
2320 connect( dialog->PasswordField, SIGNAL( returnPressed() ), 2420 connect( dialog->PasswordField, SIGNAL( returnPressed() ),
2321 this, SLOT( setPasswordDialogDone() ) ); 2421 this, SLOT( setPasswordDialogDone() ) );
2322 2422
2323 // CS: !!! 2423 // CS: !!!
2324 // int pos = filename.findRev ('/'); 2424 // int pos = filename.findRev ('/');
2325 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 2425 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
2326#ifdef WIN32 2426#ifdef WIN32
2327 dialog->setCaption("Qt " + ti); 2427 dialog->setCaption("Qt " + ti);
2328#else 2428#else
2329 dialog->setCaption(ti); 2429 dialog->setCaption(ti);
2330#endif 2430#endif
2331 // dialog->setCaption(title); 2431 // dialog->setCaption(title);
2332 2432
2333 dialog->PasswordField->setFocus(); 2433 dialog->PasswordField->setFocus();
2334 DialogCode result = (DialogCode) dialog->exec(); 2434 DialogCode result = (DialogCode) dialog->exec();
2335#ifdef DESKTOP 2435#ifdef DESKTOP
2336 result = Accepted; 2436 result = Accepted;
2337#endif 2437#endif
2338 2438
2339 QString password; 2439 QString password;
2340 if (result == Accepted || newPwdDialogResult) 2440 if (result == Accepted || newPwdDialogResult)
@@ -3142,130 +3242,135 @@ void ZSafe::editCategory()
3142 3242
3143 // dialog->show(); 3243 // dialog->show();
3144#ifndef DESKTOP 3244#ifndef DESKTOP
3145 // dialog->move (20, 100); 3245 // dialog->move (20, 100);
3146#endif 3246#endif
3147 DialogCode result = (DialogCode) dialog->exec(); 3247 DialogCode result = (DialogCode) dialog->exec();
3148#ifdef DESKTOP 3248#ifdef DESKTOP
3149 result = Accepted; 3249 result = Accepted;
3150#endif 3250#endif
3151 3251
3152 QString fullIconPath; 3252 QString fullIconPath;
3153 QPixmap *pix; 3253 QPixmap *pix;
3154 if (result == Accepted) 3254 if (result == Accepted)
3155 { 3255 {
3156 modified = true; 3256 modified = true;
3157 if (category != dialog->CategoryField->currentText()) 3257 if (category != dialog->CategoryField->currentText())
3158 { 3258 {
3159 categories.remove (category); 3259 categories.remove (category);
3160// #ifndef WIN32 3260// #ifndef WIN32
3161 conf->removeEntry(category); 3261 conf->removeEntry(category);
3162// #endif 3262// #endif
3163 saveConf(); 3263 saveConf();
3164 } 3264 }
3165 3265
3166 category = dialog->CategoryField->currentText(); 3266 category = dialog->CategoryField->currentText();
3167 icon = dialog->IconField->currentText()+".png"; 3267 icon = dialog->IconField->currentText()+".png";
3168 3268
3169 if (cat) 3269 if (cat)
3170 { 3270 {
3171 qWarning("Category found"); 3271 qWarning("Category found");
3172 3272
3173 // if (!icon.isEmpty() && !icon.isNull()) 3273 // if (!icon.isEmpty() && !icon.isNull())
3174 if (icon != "predefined.png") 3274 if (icon != "predefined.png")
3175 { 3275 {
3176 // build the full path 3276 // build the full path
3177 fullIconPath = iconPath + icon; 3277 fullIconPath = iconPath + icon;
3178 pix = new QPixmap (fullIconPath); 3278 pix = new QPixmap (fullIconPath);
3179 if (pix) 3279 if (pix)
3180 { 3280 {
3181 // save the full pixmap name into the config file 3281 // save the full pixmap name into the config file
3182// #ifndef WIN32 3282// #ifndef WIN32
3183 conf->writeEntry(APP_KEY+category, icon); 3283 conf->writeEntry(APP_KEY+category, icon);
3184// #endif 3284// #endif
3185 saveConf(); 3285 saveConf();
3186 QImage img = pix->convertToImage(); 3286 QImage img = pix->convertToImage();
3187 pix->convertFromImage(img.smoothScale(14,14)); 3287 pix->convertFromImage(img.smoothScale(14,14));
3188 cat->setIconName (icon); 3288 cat->setIconName (icon);
3189 cat->setIcon (*pix); 3289 cat->setIcon (*pix);
3190 } 3290 }
3191 } 3291 }
3192 else 3292 else
3193 { 3293 {
3194// #ifndef WIN32 3294// #ifndef WIN32
3195 conf->removeEntry (category); 3295 conf->removeEntry (category);
3196// #endif 3296// #endif
3197 saveConf(); 3297 saveConf();
3198 cat->setIcon (*getPredefinedIcon(category)); 3298 cat->setIcon (*getPredefinedIcon(category));
3199 } 3299 }
3200 3300
3201 // change the category name of the selected category 3301 // change the category name of the selected category
3202 QListViewItem *catItem = cat->getListItem(); 3302 QListViewItem *catItem = cat->getListItem();
3203 if (catItem) 3303 if (catItem)
3204 { 3304 {
3205 qWarning (category); 3305 qWarning (category);
3306#ifdef JPATCH_HDE
3307 catItem->setText( 0, category );
3308 cat->setCategoryName (category);
3309#else
3206 catItem->setText( 0, tr( category ) ); 3310 catItem->setText( 0, tr( category ) );
3207 cat->setCategoryName (tr(category)); 3311 cat->setCategoryName (tr(category));
3312#endif
3208 cat->initListItem(); 3313 cat->initListItem();
3209 categories.insert (category, cat); 3314 categories.insert (category, cat);
3210 } 3315 }
3211 } 3316 }
3212 saveCategoryDialogFields(dialog); 3317 saveCategoryDialogFields(dialog);
3213 } 3318 }
3214 else 3319 else
3215 { 3320 {
3216 // delete dialog; 3321 // delete dialog;
3217 dialog->hide(); 3322 dialog->hide();
3218 return; 3323 return;
3219 } 3324 }
3220 3325
3221 } 3326 }
3222} 3327}
3223 3328
3224void ZSafe::cutItem() 3329void ZSafe::cutItem()
3225{ 3330{
3226 if (!selectedItem) 3331 if (!selectedItem)
3227 return; 3332 return;
3228 if (!isCategory(selectedItem)) 3333 if (!isCategory(selectedItem))
3229 { 3334 {
3230 IsCut = true; 3335 IsCut = true;
3231 copiedItem = selectedItem; 3336 copiedItem = selectedItem;
3232 } 3337 }
3233} 3338}
3234 3339
3235void ZSafe::copyItem() 3340void ZSafe::copyItem()
3236{ 3341{
3237 if (!selectedItem) 3342 if (!selectedItem)
3238 return; 3343 return;
3239 if (!isCategory(selectedItem)) 3344 if (!isCategory(selectedItem))
3240 { 3345 {
3241 IsCopy = true; 3346 IsCopy = true;
3242 copiedItem = selectedItem; 3347 copiedItem = selectedItem;
3243 } 3348 }
3244} 3349}
3245 3350
3246// paste item into category 3351// paste item into category
3247void ZSafe::pasteItem() 3352void ZSafe::pasteItem()
3248{ 3353{
3249 if (!selectedItem) 3354 if (!selectedItem)
3250 return; 3355 return;
3251 if (isCategory(selectedItem)) 3356 if (isCategory(selectedItem))
3252 { 3357 {
3253 modified = true; 3358 modified = true;
3254 if (IsCut) 3359 if (IsCut)
3255 { 3360 {
3256 if (copiedItem) 3361 if (copiedItem)
3257 { 3362 {
3258 // add the new item 3363 // add the new item
3259 QListViewItem *i = new ShadedListItem (0, selectedItem); 3364 QListViewItem *i = new ShadedListItem (0, selectedItem);
3260 // i->setOpen (TRUE); 3365 // i->setOpen (TRUE);
3261 i->setText (0, copiedItem->text(0)); 3366 i->setText (0, copiedItem->text(0));
3262 i->setText (1, copiedItem->text(1)); 3367 i->setText (1, copiedItem->text(1));
3263 i->setText (2, copiedItem->text(2)); 3368 i->setText (2, copiedItem->text(2));
3264 i->setText (3, copiedItem->text(3)); 3369 i->setText (3, copiedItem->text(3));
3265 i->setText (4, copiedItem->text(4)); 3370 i->setText (4, copiedItem->text(4));
3266 i->setText (5, copiedItem->text(5)); 3371 i->setText (5, copiedItem->text(5));
3267 selectedItem->setOpen( TRUE ); 3372 selectedItem->setOpen( TRUE );
3268 3373
3269 // remove the cutted item 3374 // remove the cutted item
3270 copiedItem->parent()->takeItem(copiedItem); 3375 copiedItem->parent()->takeItem(copiedItem);
3271 selectedItem = NULL; 3376 selectedItem = NULL;
@@ -3468,141 +3573,163 @@ void ZSafe::saveDocumentAs()
3468 mimeTypes.insert(tr("All"), QStringList() ); 3573 mimeTypes.insert(tr("All"), QStringList() );
3469 mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); 3574 mimeTypes.insert(tr("ZSafe"), "zsafe/*" );
3470 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, 3575 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
3471 QDir::homeDirPath() + "/Documents/application/zsafe", 3576 QDir::homeDirPath() + "/Documents/application/zsafe",
3472 QString::null, 3577 QString::null,
3473 mimeTypes, 3578 mimeTypes,
3474 this, 3579 this,
3475 tr ("Save ZSafe document as..")); 3580 tr ("Save ZSafe document as.."));
3476#else 3581#else
3477 QString newFile = ScQtFileEdit::getSaveAsFileName(this, 3582 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3478 tr ("Save ZSafe document as.."), 3583 tr ("Save ZSafe document as.."),
3479 QDir::homeDirPath() + "/Documents/application/zsafe", 3584 QDir::homeDirPath() + "/Documents/application/zsafe",
3480 "*.zsf"); 3585 "*.zsf");
3481#endif 3586#endif
3482#else 3587#else
3483 // open the file dialog 3588 // open the file dialog
3484 QString newFile = QFileDialog::getSaveFileName( 3589 QString newFile = QFileDialog::getSaveFileName(
3485 QDir::homeDirPath() + "/Documents/application/zsafe", 3590 QDir::homeDirPath() + "/Documents/application/zsafe",
3486 "ZSafe (*.zsf)", 3591 "ZSafe (*.zsf)",
3487 this, 3592 this,
3488 "ZSafe File Dialog" 3593 "ZSafe File Dialog"
3489 "Choose a ZSafe file" ); 3594 "Choose a ZSafe file" );
3490#endif 3595#endif
3491 3596
3492 // open the new document 3597 // open the new document
3493 if (newFile && newFile.length() > 0 ) 3598 if (newFile && newFile.length() > 0 )
3494 { 3599 {
3495 // save the previous opened document 3600 // save the previous opened document
3496 if (!filename.isEmpty()) 3601 if (!filename.isEmpty())
3497 saveDocument(filename, FALSE); 3602 saveDocument(filename, FALSE);
3498 3603
3499 selectedItem = NULL; 3604 selectedItem = NULL;
3500 filename = newFile; 3605 filename = newFile;
3501 3606
3502 // save the current filename to the config file 3607 // save the current filename to the config file
3503 conf->writeEntry(APP_KEY+"document", filename); 3608 conf->writeEntry(APP_KEY+"document", filename);
3504 saveConf(); 3609 saveConf();
3505 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3610 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3506#ifdef WIN32 3611#ifdef WIN32
3507 this->setCaption("Qt ZSafe: " + ti); 3612 this->setCaption("Qt ZSafe: " + ti);
3508#else 3613#else
3509 this->setCaption("ZSafe: " + ti); 3614 this->setCaption("ZSafe: " + ti);
3510#endif 3615#endif
3511 3616
3512 QMessageBox::information( this, tr("ZSafe"), 3617 QMessageBox::information( this, tr("ZSafe"),
3513 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); 3618 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3514 3619
3515 saveDocumentWithPwd(); 3620 saveDocumentWithPwd();
3516 } 3621 }
3517} 3622}
3518 3623
3519void ZSafe::saveDocumentWithoutPwd() 3624void ZSafe::saveDocumentWithoutPwd()
3520{ 3625{
3521 saveDocument(filename, FALSE); 3626 saveDocument(filename, FALSE);
3522} 3627}
3523 3628
3524void ZSafe::saveDocumentWithPwd() 3629void ZSafe::saveDocumentWithPwd()
3525{ 3630{
3526 saveDocument(filename, TRUE); 3631 saveDocument(filename, TRUE);
3527} 3632}
3528 3633
3529void ZSafe::about() 3634void ZSafe::about()
3530{ 3635{
3531 QString info; 3636 QString info;
3637#ifdef JPATCH_HDE
3638 info = "<html><body><div align=""center"">";
3639 info += "<b>";
3640 info += tr("Zaurus Password Manager<br>");
3641 info += tr("ZSafe version 2.1.2-jv01b<br>");
3642 info += "</b>";
3643 info += tr("by Carsten Schneider<br>");
3644 info += "zcarsten@gmx.net<br>";
3645 info += "http://z-soft.z-portal.info/zsafe";
3646 info += "<br>";
3647 info += tr("Translations by Robert Ernst<br>");
3648 info += "robert.ernst@linux-solutions.at<br>";
3649
3650 info += "<br><br>";
3651 info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>");
3652 info += "HADECO R&D<br>";
3653 info += "r&d@hadeco.co.jp<br>";
3654 info += "http://www.hadeco.co.jp/r&d/<br>";
3655 info += "<br></div>";
3656 info += "</body></html>";
3657#else
3532 info = "<html><body><div align=""center"">"; 3658 info = "<html><body><div align=""center"">";
3533 info += "<b>"; 3659 info += "<b>";
3534 info += tr("Zaurus Password Manager<br>"); 3660 info += tr("Zaurus Password Manager<br>");
3535 info += tr("ZSafe version 2.1.2<br>"); 3661 info += tr("ZSafe version 2.1.2<br>");
3536 info += "</b>"; 3662 info += "</b>";
3537 info += tr("by Carsten Schneider<br>"); 3663 info += tr("by Carsten Schneider<br>");
3538 info += "zcarsten@gmx.net<br>"; 3664 info += "zcarsten@gmx.net<br>";
3539 info += "http://z-soft.z-portal.info/zsafe"; 3665 info += "http://z-soft.z-portal.info/zsafe";
3540 info += "<br>"; 3666 info += "<br>";
3541 info += tr("Translations by Robert Ernst<br>"); 3667 info += tr("Translations by Robert Ernst<br>");
3542 info += "robert.ernst@linux-solutions.at<br>"; 3668 info += "robert.ernst@linux-solutions.at<br>";
3543 info += "<br></div>"; 3669 info += "<br></div>";
3544 info += "</body></html>"; 3670 info += "</body></html>";
3671#endif
3545 3672
3546 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); 3673 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
3547 3674
3548 QMessageBox mb( this, tr("ZSafe")); 3675 QMessageBox mb( this, tr("ZSafe"));
3549 mb.setText (info); 3676 mb.setText (info);
3550 mb.setButtonText (QMessageBox::Ok, tr ("&OK")); 3677 mb.setButtonText (QMessageBox::Ok, tr ("&OK"));
3551 QPixmap zsafe_img((const char**) zsafe_xpm); 3678 QPixmap zsafe_img((const char**) zsafe_xpm);
3552 mb.setIconPixmap (zsafe_img); 3679 mb.setIconPixmap (zsafe_img);
3553 mb.exec(); 3680 mb.exec();
3554} 3681}
3555 3682
3556void ZSafe::setExpandFlag() 3683void ZSafe::setExpandFlag()
3557{ 3684{
3558 expandTree = !expandTree; 3685 expandTree = !expandTree;
3559 file->setItemChecked('o', expandTree); 3686 file->setItemChecked('o', expandTree);
3560#ifndef DESKTOP 3687#ifndef DESKTOP
3561 conf->setGroup ("zsafePrefs"); 3688 conf->setGroup ("zsafePrefs");
3562#endif 3689#endif
3563// #ifndef WIN32 3690// #ifndef WIN32
3564 conf->writeEntry (APP_KEY+"expandTree", expandTree); 3691 conf->writeEntry (APP_KEY+"expandTree", expandTree);
3565// #endif 3692// #endif
3566 saveConf(); 3693 saveConf();
3567 3694
3568} 3695}
3569 3696
3570void ZSafe::paintEvent( QPaintEvent * ) 3697void ZSafe::paintEvent( QPaintEvent * )
3571{ 3698{
3572 if (raiseFlag) 3699 if (raiseFlag)
3573 { 3700 {
3574 raiseFlag = false; 3701 raiseFlag = false;
3575 raiseTimer.start (1, true); 3702 raiseTimer.start (1, true);
3576 if (infoForm->isVisible()) 3703 if (infoForm->isVisible())
3577 infoForm->raise(); 3704 infoForm->raise();
3578 } 3705 }
3579} 3706}
3580 3707
3581void ZSafe::resizeEvent ( QResizeEvent * ) 3708void ZSafe::resizeEvent ( QResizeEvent * )
3582{ 3709{
3583 // qWarning ("resizeEvent"); 3710 // qWarning ("resizeEvent");
3584#ifndef DESKTOP 3711#ifndef DESKTOP
3585 DeskW = appl->desktop()->width(); 3712 DeskW = appl->desktop()->width();
3586 DeskH = appl->desktop()->height(); 3713 DeskH = appl->desktop()->height();
3587#else 3714#else
3588 DeskW = this->width(); 3715 DeskW = this->width();
3589 DeskH = this->height(); 3716 DeskH = this->height();
3590#endif 3717#endif
3591 qWarning( QString("Width : %1").arg(DeskW), 2000 ); 3718 qWarning( QString("Width : %1").arg(DeskW), 2000 );
3592 qWarning( QString("Height: %1").arg(DeskH), 2000 ); 3719 qWarning( QString("Height: %1").arg(DeskH), 2000 );
3593 3720
3594 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); 3721 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
3595 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); 3722 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
3596 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 3723 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
3597 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); 3724 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
3598} 3725}
3599 3726
3600void ZSafe::slotRaiseTimer() 3727void ZSafe::slotRaiseTimer()
3601{ 3728{
3602 if (infoForm->isVisible()) 3729 if (infoForm->isVisible())
3603 infoForm->raise(); 3730 infoForm->raise();
3604 raiseFlag = true; 3731 raiseFlag = true;
3605} 3732}
3606 3733
3607QPixmap * ZSafe::getPredefinedIcon(QString category) 3734QPixmap * ZSafe::getPredefinedIcon(QString category)
3608{ 3735{