summaryrefslogtreecommitdiff
authordrw <drw>2004-02-23 17:12:28 (UTC)
committer drw <drw>2004-02-23 17:12:28 (UTC)
commit2f11aa15eeb70dd8826523597adb8947fdffbaa7 (patch) (unidiff)
treeacc6ceb27c67437734e94b39b06835edac5d5bad
parent20b0e62e6c23cdaed9a30d6fad73431edc60be53 (diff)
downloadopie-2f11aa15eeb70dd8826523597adb8947fdffbaa7.zip
opie-2f11aa15eeb70dd8826523597adb8947fdffbaa7.tar.gz
opie-2f11aa15eeb70dd8826523597adb8947fdffbaa7.tar.bz2
ZSafe: libopie->libopie2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/config.in2
-rw-r--r--noncore/apps/zsafe/opie-zsafe.control2
-rw-r--r--noncore/apps/zsafe/zsafe.cpp989
-rw-r--r--noncore/apps/zsafe/zsafe.pro16
4 files changed, 506 insertions, 503 deletions
diff --git a/noncore/apps/zsafe/config.in b/noncore/apps/zsafe/config.in
index 4b1e968..6e321f3 100644
--- a/noncore/apps/zsafe/config.in
+++ b/noncore/apps/zsafe/config.in
@@ -1,5 +1,5 @@
1config ZSAFE 1config ZSAFE
2 boolean "zsafe (Zaurus Password Manager)" 2 boolean "zsafe (Zaurus Password Manager)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI
5 5
diff --git a/noncore/apps/zsafe/opie-zsafe.control b/noncore/apps/zsafe/opie-zsafe.control
index b58a987..6288fac 100644
--- a/noncore/apps/zsafe/opie-zsafe.control
+++ b/noncore/apps/zsafe/opie-zsafe.control
@@ -3,7 +3,7 @@ Files: bin/zsafe apps/Applications/zsafe.desktop pics/zsafe/*.png
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Version: $QPE_VERSION$EXTRAVERSION 5Version: $QPE_VERSION$EXTRAVERSION
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal, libopieui2
8Maintainer: Carsten Schneider <zcarsten@gmx.net> 8Maintainer: Carsten Schneider <zcarsten@gmx.net>
9Description: This is a password manager program for Opie. 9Description: This is a password manager program for Opie.
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index bdd2aed..f43a206 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -27,9 +27,12 @@
27#include "shadedlistitem.h" 27#include "shadedlistitem.h"
28 28
29#ifndef DESKTOP 29#ifndef DESKTOP
30#ifndef NO_OPIE 30#ifndef NO_OPIE
31#include <opie/ofiledialog.h> 31#include <opie2/ofiledialog.h>
32
33using Opie::OFileDialog;
34using Opie::OFileSelector;
32#else 35#else
33#include "scqtfileedit.h" 36#include "scqtfileedit.h"
34#endif 37#endif
35#endif 38#endif
@@ -133,9 +136,9 @@ const QString APP_KEY="";
133#include "pics/zsafe/export.xpm" 136#include "pics/zsafe/export.xpm"
134#include "pics/zsafe/import.xpm" 137#include "pics/zsafe/import.xpm"
135#include "pics/zsafe/zsafe.xpm" 138#include "pics/zsafe/zsafe.xpm"
136 139
137static const char* const bank_cards_data[] = { 140static const char* const bank_cards_data[] = {
138"14 14 16 1", 141"14 14 16 1",
139". c None", 142". c None",
140"# c #000000", 143"# c #000000",
141"b c #0000de", 144"b c #0000de",
@@ -167,9 +170,9 @@ static const char* const bank_cards_data[] = {
167"..............", 170"..............",
168".............."}; 171".............."};
169 172
170 173
171static const char* const passwords_data[] = { 174static const char* const passwords_data[] = {
172"16 16 20 1", 175"16 16 20 1",
173". c None", 176". c None",
174"# c #000000", 177"# c #000000",
175"r c #000083", 178"r c #000083",
@@ -206,9 +209,9 @@ static const char* const passwords_data[] = {
206"#oopqpprprr#....", 209"#oopqpprprr#....",
207"#oopqpprprr#....", 210"#oopqpprprr#....",
208"############...."}; 211"############...."};
209 212
210static const char* const software_data[] = { 213static const char* const software_data[] = {
211"16 16 5 1", 214"16 16 5 1",
212". c None", 215". c None",
213"# c #000000", 216"# c #000000",
214"b c #838183", 217"b c #838183",
@@ -230,9 +233,9 @@ static const char* const software_data[] = {
230"#bbbbbbbbbbbbbb#", 233"#bbbbbbbbbbbbbb#",
231".##############.", 234".##############.",
232"................"}; 235"................"};
233 236
234static const char* const general_data[] = { 237static const char* const general_data[] = {
235"14 14 98 2", 238"14 14 98 2",
236"Qt c None", 239"Qt c None",
237".k c #000000", 240".k c #000000",
238"#x c #080808", 241"#x c #080808",
@@ -378,17 +381,17 @@ static const char* const general_data[] = {
378 } 381 }
379 } 382 }
380 383
381 384
382/* 385/*
383 * Constructs a ZSafe which is a child of 'parent', with the 386 * Constructs a ZSafe which is a child of 'parent', with the
384 * name 'name' and widget flags set to 'f' 387 * name 'name' and widget flags set to 'f'
385 * 388 *
386 * The dialog will by default be modeless, unless you set 'modal' to 389 * The dialog will by default be modeless, unless you set 'modal' to
387 * TRUE to construct a modal dialog. 390 * TRUE to construct a modal dialog.
388 */ 391 */
389ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) 392ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
390 : QDialog( parent, name, modal, fl ), 393 : QDialog( parent, name, modal, fl ),
391 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) 394 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
392{ 395{
393 IsCut = false; 396 IsCut = false;
394 IsCopy = false; 397 IsCopy = false;
@@ -408,9 +411,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
408 iconPath = QDir::homeDirPath() + "/pics/"; 411 iconPath = QDir::homeDirPath() + "/pics/";
409#else 412#else
410 if (qpedir.isEmpty()) 413 if (qpedir.isEmpty())
411 iconPath = "/home/QtPalmtop/pics/"; 414 iconPath = "/home/QtPalmtop/pics/";
412 else 415 else
413 iconPath = qpedir + "/pics/"; 416 iconPath = qpedir + "/pics/";
414#endif 417#endif
415 418
416 // create a zsafe configuration object 419 // create a zsafe configuration object
@@ -457,15 +460,15 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
457 QPixmap passwords( ( const char** ) passwords_data ); 460 QPixmap passwords( ( const char** ) passwords_data );
458 QPixmap software( ( const char** ) software_data ); 461 QPixmap software( ( const char** ) software_data );
459 QPixmap general( ( const char** ) general_data ); 462 QPixmap general( ( const char** ) general_data );
460 if ( !name ) 463 if ( !name )
461 setName( "ZSafe" ); 464 setName( "ZSafe" );
462 465
463#ifdef DESKTOP 466#ifdef DESKTOP
464#ifdef WIN32 467#ifdef WIN32
465 setGeometry(100, 150, DeskW, DeskH-30 ); 468 setGeometry(100, 150, DeskW, DeskH-30 );
466#else 469#else
467 resize( DeskW, DeskH-30 ); 470 resize( DeskW, DeskH-30 );
468#endif 471#endif
469 472
470#else 473#else
471 474
@@ -497,9 +500,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
497 // create it 500 // create it
498// #ifndef WIN32 501// #ifndef WIN32
499 // QString d1("Documents/application"); 502 // QString d1("Documents/application");
500// #else 503// #else
501 QString d1(QDir::homeDirPath() + "/Documents/application"); 504 QString d1(QDir::homeDirPath() + "/Documents/application");
502// #endif 505// #endif
503 QDir pd1(d1); 506 QDir pd1(d1);
504 if (!pd1.exists()) 507 if (!pd1.exists())
505 { 508 {
@@ -514,9 +517,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
514#endif 517#endif
515 exitZs (1); 518 exitZs (1);
516 } 519 }
517 } 520 }
518 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); 521 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
519 QDir pd2(d2); 522 QDir pd2(d2);
520 if (!pd2.exists()) 523 if (!pd2.exists())
521 { 524 {
522 QDir pd2(QDir::homeDirPath() + "Documents/application"); 525 QDir pd2(QDir::homeDirPath() + "Documents/application");
@@ -530,9 +533,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
530#endif 533#endif
531 exitZs (1); 534 exitZs (1);
532 } 535 }
533 } 536 }
534 537
535 538
536 // set the default filename 539 // set the default filename
537 filename=d2 + "/passwords.zsf"; 540 filename=d2 + "/passwords.zsf";
538 541
@@ -575,16 +578,16 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
575 file->insertSeparator(); 578 file->insertSeparator();
576// #endif 579// #endif
577 580
578 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); 581 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
579 file->insertItem( save_img, tr("S&ave document with new Password"), this, 582 file->insertItem( save_img, tr("S&ave document with new Password"), this,
580 SLOT(saveDocumentWithPwd()) ); 583 SLOT(saveDocumentWithPwd()) );
581 file->insertSeparator(); 584 file->insertSeparator();
582 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); 585 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) );
583 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); 586 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) );
584 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); 587 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) );
585 file->insertSeparator(); 588 file->insertSeparator();
586 file->insertItem( expand_img, tr("&Open entries expanded"), this, 589 file->insertItem( expand_img, tr("&Open entries expanded"), this,
587 SLOT(setExpandFlag()), 0, 'o'); 590 SLOT(setExpandFlag()), 0, 'o');
588 file->setItemChecked('o', expandTree); 591 file->setItemChecked('o', expandTree);
589 file->insertSeparator(); 592 file->insertSeparator();
590 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); 593 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) );
@@ -613,28 +616,28 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
613 616
614 // toolbar icons 617 // toolbar icons
615 618
616 New = new QToolButton( menu, "New" ); 619 New = new QToolButton( menu, "New" );
617 New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); 620 New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) );
618 New->setMouseTracking( TRUE ); 621 New->setMouseTracking( TRUE );
619 New->setText( tr( "" ) ); 622 New->setText( tr( "" ) );
620 New->setPixmap( new_img ); 623 New->setPixmap( new_img );
621 QToolTip::add( New, tr( "New entry" ) ); 624 QToolTip::add( New, tr( "New entry" ) );
622 625
623 Edit = new QToolButton( menu, "Edit" ); 626 Edit = new QToolButton( menu, "Edit" );
624 Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); 627 Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) );
625 Edit->setText( tr( "" ) ); 628 Edit->setText( tr( "" ) );
626 Edit->setPixmap( edit_img ); 629 Edit->setPixmap( edit_img );
627 QToolTip::add( Edit, tr( "Edit category or entry" ) ); 630 QToolTip::add( Edit, tr( "Edit category or entry" ) );
628 631
629 Delete = new QToolButton( menu, "Delete" ); 632 Delete = new QToolButton( menu, "Delete" );
630 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 633 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
631 Delete->setText( tr( "" ) ); 634 Delete->setText( tr( "" ) );
632 Delete->setPixmap( trash_img ); 635 Delete->setPixmap( trash_img );
633 QToolTip::add( Delete, tr( "Delete category or entry" ) ); 636 QToolTip::add( Delete, tr( "Delete category or entry" ) );
634 637
635 Find = new QToolButton( menu, "Find" ); 638 Find = new QToolButton( menu, "Find" );
636 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); 639 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
637 Find->setText( tr( "" ) ); 640 Find->setText( tr( "" ) );
638 Find->setPixmap( find_img ); 641 Find->setPixmap( find_img );
639 QToolTip::add( Find, tr( "Find entry" ) ); 642 QToolTip::add( Find, tr( "Find entry" ) );
640 643
@@ -657,13 +660,13 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
657 ListView->setAllColumnsShowFocus(TRUE); 660 ListView->setAllColumnsShowFocus(TRUE);
658 661
659#ifdef DESKTOP 662#ifdef DESKTOP
660 ListView->setResizePolicy(QScrollView::AutoOneFit); 663 ListView->setResizePolicy(QScrollView::AutoOneFit);
661 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) ); 664 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
662#else 665#else
663 ListView->setResizePolicy(QScrollView::AutoOneFit); 666 ListView->setResizePolicy(QScrollView::AutoOneFit);
664 // ListView->setGeometry( QRect( 0, 22, 667 // ListView->setGeometry( QRect( 0, 22,
665 // this->width(), this->height() - 30 ) ); 668 // this->width(), this->height() - 30 ) );
666 // ListView->setMaximumSize( QSize( 440, 290 ) ); 669 // ListView->setMaximumSize( QSize( 440, 290 ) );
667#endif 670#endif
668 ListView->setVScrollBarMode( QListView::Auto ); 671 ListView->setVScrollBarMode( QListView::Auto );
669 672
@@ -700,9 +703,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
700const QColor *ZSafe::evenRowColor = &Qt::white; 703const QColor *ZSafe::evenRowColor = &Qt::white;
701// const QColor *ZSafe::oddRowColor = &Qt::lightGray; 704// const QColor *ZSafe::oddRowColor = &Qt::lightGray;
702const QColor *ZSafe::oddRowColor = new QColor(216,240,255); 705const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
703 706
704/* 707/*
705 * Destroys the object and frees any allocated resources 708 * Destroys the object and frees any allocated resources
706 */ 709 */
707ZSafe::~ZSafe() 710ZSafe::~ZSafe()
708{ 711{
@@ -724,9 +727,9 @@ void ZSafe::deletePwd()
724 if (!isCategory(selectedItem)) 727 if (!isCategory(selectedItem))
725 { 728 {
726 switch( QMessageBox::information( this, tr("ZSafe"), 729 switch( QMessageBox::information( this, tr("ZSafe"),
727 tr("Do you want to delete?"), 730 tr("Do you want to delete?"),
728 tr("&Delete"), tr("D&on't Delete"), 731 tr("&Delete"), tr("D&on't Delete"),
729 0 // Enter == button 0 732 0 // Enter == button 0
730 ) ) { // Escape == button 2 733 ) ) { // Escape == button 2
731 case 0: // Delete clicked, Alt-S or Enter pressed. 734 case 0: // Delete clicked, Alt-S or Enter pressed.
732 // Delete 735 // Delete
@@ -753,11 +756,11 @@ void ZSafe::editPwd()
753 // open the 'New Entry' dialog 756 // open the 'New Entry' dialog
754 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); 757 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE);
755#ifdef WIN32 758#ifdef WIN32
756 dialog->setCaption ("Qt " + tr("Edit Entry")); 759 dialog->setCaption ("Qt " + tr("Edit Entry"));
757 dialog->setGeometry(200, 250, 220, 310 ); 760 dialog->setGeometry(200, 250, 220, 310 );
758#endif 761#endif
759 762
760 // set the labels 763 // set the labels
761 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 764 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
762 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 765 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
763 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 766 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
@@ -784,26 +787,26 @@ void ZSafe::editPwd()
784 if (result == Accepted) 787 if (result == Accepted)
785 { 788 {
786 modified = true; 789 modified = true;
787 // edit the selected item 790 // edit the selected item
788 QString name = dialog->NameField->text(); 791 QString name = dialog->NameField->text();
789 selectedItem->setText (0, tr (name)); 792 selectedItem->setText (0, tr (name));
790 QString user = dialog->UsernameField->text(); 793 QString user = dialog->UsernameField->text();
791 selectedItem->setText (1, tr (user)); 794 selectedItem->setText (1, tr (user));
792 QString pwd = dialog->PasswordField->text(); 795 QString pwd = dialog->PasswordField->text();
793 selectedItem->setText (2, tr (pwd)); 796 selectedItem->setText (2, tr (pwd));
794 QString comment = dialog->CommentField->text(); 797 QString comment = dialog->CommentField->text();
795 comment.replace (QRegExp("\n"), "<br>"); 798 comment.replace (QRegExp("\n"), "<br>");
796 selectedItem->setText (3, tr (comment)); 799 selectedItem->setText (3, tr (comment));
797 QString f5 = dialog->Field5->text(); 800 QString f5 = dialog->Field5->text();
798 selectedItem->setText (4, tr (f5)); 801 selectedItem->setText (4, tr (f5));
799 QString f6 = dialog->Field6->text(); 802 QString f6 = dialog->Field6->text();
800 selectedItem->setText (5, tr (f6)); 803 selectedItem->setText (5, tr (f6));
801 } 804 }
802 805
803 delete dialog; 806 delete dialog;
804 } 807 }
805 else 808 else
806 { 809 {
807 editCategory(); 810 editCategory();
808 } 811 }
809} 812}
@@ -823,9 +826,9 @@ void ZSafe::newPwd()
823 // open the 'New Entry' dialog 826 // open the 'New Entry' dialog
824 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); 827 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE);
825#ifdef WIN32 828#ifdef WIN32
826 dialog->setCaption ("Qt " + tr("New Entry")); 829 dialog->setCaption ("Qt " + tr("New Entry"));
827 dialog->setGeometry(200, 250, 220, 310 ); 830 dialog->setGeometry(200, 250, 220, 310 );
828#endif 831#endif
829 // set the labels 832 // set the labels
830 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 833 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
831 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 834 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
@@ -842,9 +845,9 @@ retype:
842 845
843 if (result == Accepted) 846 if (result == Accepted)
844 { 847 {
845 848
846 QString name = dialog->NameField->text(); 849 QString name = dialog->NameField->text();
847 if (cat == name) 850 if (cat == name)
848 { 851 {
849 QMessageBox::critical( 0, tr("ZSafe"), 852 QMessageBox::critical( 0, tr("ZSafe"),
850 tr("Entry name must be different\nfrom the category name.") ); 853 tr("Entry name must be different\nfrom the category name.") );
@@ -856,18 +859,18 @@ retype:
856 QListViewItem *i = new ShadedListItem (0, selectedItem); 859 QListViewItem *i = new ShadedListItem (0, selectedItem);
857 i->setOpen (TRUE); 860 i->setOpen (TRUE);
858 861
859 i->setText (0, tr (name)); 862 i->setText (0, tr (name));
860 QString user = dialog->UsernameField->text(); 863 QString user = dialog->UsernameField->text();
861 i->setText (1, tr (user)); 864 i->setText (1, tr (user));
862 QString pwd = dialog->PasswordField->text(); 865 QString pwd = dialog->PasswordField->text();
863 i->setText (2, tr (pwd)); 866 i->setText (2, tr (pwd));
864 QString comment = dialog->CommentField->text(); 867 QString comment = dialog->CommentField->text();
865 comment.replace (QRegExp("\n"), "<br>"); 868 comment.replace (QRegExp("\n"), "<br>");
866 i->setText (3, tr (comment)); 869 i->setText (3, tr (comment));
867 QString f5 = dialog->Field5->text(); 870 QString f5 = dialog->Field5->text();
868 i->setText (4, tr (f5)); 871 i->setText (4, tr (f5));
869 QString f6 = dialog->Field6->text(); 872 QString f6 = dialog->Field6->text();
870 i->setText (5, tr (f6)); 873 i->setText (5, tr (f6));
871 } 874 }
872 875
873 delete dialog; 876 delete dialog;
@@ -951,9 +954,9 @@ void ZSafe::findPwd()
951 if (lastSearchedCategory) 954 if (lastSearchedCategory)
952 i = lastSearchedCategory; 955 i = lastSearchedCategory;
953 else 956 else
954 i = ListView->firstChild(); 957 i = ListView->firstChild();
955 for (; 958 for (;
956 i != NULL; 959 i != NULL;
957 i = i->nextSibling()) 960 i = i->nextSibling())
958 { 961 {
959 qWarning (i->text(0)); 962 qWarning (i->text(0));
@@ -964,9 +967,9 @@ void ZSafe::findPwd()
964 if (lastSearchedItem) 967 if (lastSearchedItem)
965 si = lastSearchedItem; 968 si = lastSearchedItem;
966 else 969 else
967 si = i->firstChild(); 970 si = i->firstChild();
968 // for (si = i->firstChild(); 971 // for (si = i->firstChild();
969 for (; 972 for (;
970 si != NULL; 973 si != NULL;
971 si = si->nextSibling()) 974 si = si->nextSibling())
972 { 975 {
@@ -1017,11 +1020,11 @@ void ZSafe::findPwd()
1017 lastSearchedCategory = NULL; 1020 lastSearchedCategory = NULL;
1018 lastSearchedItem = NULL; 1021 lastSearchedItem = NULL;
1019 delete dialog; 1022 delete dialog;
1020 update(); 1023 update();
1021 QMessageBox::information( this, tr("ZSafe"), 1024 QMessageBox::information( this, tr("ZSafe"),
1022 tr("Entry not found"), tr("&OK"), 0); 1025 tr("Entry not found"), tr("&OK"), 0);
1023 1026
1024} 1027}
1025 1028
1026QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) 1029QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
1027{ 1030{
@@ -1075,9 +1078,9 @@ QString ZSafe::getFieldLabel (QString category, QString field, QString def)
1075 app_key += "/fieldDefs/"; 1078 app_key += "/fieldDefs/";
1076#endif 1079#endif
1077#endif 1080#endif
1078// #ifndef WIN32 1081// #ifndef WIN32
1079 QString label = conf->readEntry(app_key+category+"-field"+field, 1082 QString label = conf->readEntry(app_key+category+"-field"+field,
1080 def); 1083 def);
1081// #else 1084// #else
1082 // QString label(def); 1085 // QString label(def);
1083// #endif 1086// #endif
@@ -1092,9 +1095,9 @@ void ZSafe::showInfo( QListViewItem *_item)
1092 if (!_item) 1095 if (!_item)
1093 return; 1096 return;
1094 if (selectedItem != NULL) 1097 if (selectedItem != NULL)
1095 selectedItem->setSelected(FALSE); 1098 selectedItem->setSelected(FALSE);
1096 1099
1097 selectedItem = _item; 1100 selectedItem = _item;
1098 selectedItem->setSelected(TRUE); 1101 selectedItem->setSelected(TRUE);
1099 1102
1100 if (!isCategory(_item)) 1103 if (!isCategory(_item))
@@ -1237,16 +1240,16 @@ void ZSafe::removeAsciiFile()
1237 mimeTypes, 1240 mimeTypes,
1238 this, 1241 this,
1239 tr ("Remove text file")); 1242 tr ("Remove text file"));
1240#else 1243#else
1241 QString fn = ScQtFileEdit::getOpenFileName(this, 1244 QString fn = ScQtFileEdit::getOpenFileName(this,
1242 tr ("Remove text file"), 1245 tr ("Remove text file"),
1243 QDir::homeDirPath() + "/Documents/application/zsafe", 1246 QDir::homeDirPath() + "/Documents/application/zsafe",
1244 "*.txt"); 1247 "*.txt");
1245#endif 1248#endif
1246#else 1249#else
1247 QString fn = QFileDialog::getOpenFileName( 1250 QString fn = QFileDialog::getOpenFileName(
1248 QDir::homeDirPath() + "/Documents/application/zsafe", 1251 QDir::homeDirPath() + "/Documents/application/zsafe",
1249 "ZSafe (*.txt)", 1252 "ZSafe (*.txt)",
1250 this, 1253 this,
1251 "ZSafe File Dialog" 1254 "ZSafe File Dialog"
1252 "Choose a text file" ); 1255 "Choose a text file" );
@@ -1254,9 +1257,9 @@ void ZSafe::removeAsciiFile()
1254 1257
1255 if (fn && fn.length() > 0 ) 1258 if (fn && fn.length() > 0 )
1256 { 1259 {
1257 QFile f( fn ); 1260 QFile f( fn );
1258 if ( !f.remove() ) 1261 if ( !f.remove() )
1259 { 1262 {
1260 qWarning( QString("Could not remove file %1").arg(fn), 1263 qWarning( QString("Could not remove file %1").arg(fn),
1261 2000 ); 1264 2000 );
1262 QMessageBox::critical( 0, tr("ZSafe"), 1265 QMessageBox::critical( 0, tr("ZSafe"),
@@ -1287,16 +1290,16 @@ void ZSafe::writeAllEntries()
1287 mimeTypes, 1290 mimeTypes,
1288 this, 1291 this,
1289 tr ("Export text file")); 1292 tr ("Export text file"));
1290#else 1293#else
1291 QString fn = ScQtFileEdit::getSaveAsFileName(this, 1294 QString fn = ScQtFileEdit::getSaveAsFileName(this,
1292 tr ("Export text file"), 1295 tr ("Export text file"),
1293 QDir::homeDirPath() + "/Documents/application/zsafe", 1296 QDir::homeDirPath() + "/Documents/application/zsafe",
1294 "*.txt"); 1297 "*.txt");
1295#endif 1298#endif
1296#else 1299#else
1297 QString fn = QFileDialog::getSaveFileName( 1300 QString fn = QFileDialog::getSaveFileName(
1298 QDir::homeDirPath() + "/Documents/application/zsafe", 1301 QDir::homeDirPath() + "/Documents/application/zsafe",
1299 "ZSafe (*.txt)", 1302 "ZSafe (*.txt)",
1300 this, 1303 this,
1301 "ZSafe File Dialog" 1304 "ZSafe File Dialog"
1302 "Choose a text file" ); 1305 "Choose a text file" );
@@ -1316,15 +1319,15 @@ void ZSafe::writeAllEntries()
1316 QTextStream t( &f ); 1319 QTextStream t( &f );
1317 1320
1318 QListViewItem *i; 1321 QListViewItem *i;
1319 // step through all categories 1322 // step through all categories
1320 for (i = ListView->firstChild(); 1323 for (i = ListView->firstChild();
1321 i != NULL; 1324 i != NULL;
1322 i = i->nextSibling()) 1325 i = i->nextSibling())
1323 { 1326 {
1324 // step through all subitems 1327 // step through all subitems
1325 QListViewItem *si; 1328 QListViewItem *si;
1326 for (si = i->firstChild(); 1329 for (si = i->firstChild();
1327 si != NULL; 1330 si != NULL;
1328 si = si->nextSibling()) 1331 si = si->nextSibling())
1329 { 1332 {
1330 QString oneEntry; 1333 QString oneEntry;
@@ -1382,16 +1385,16 @@ void ZSafe::readAllEntries()
1382 mimeTypes, 1385 mimeTypes,
1383 this, 1386 this,
1384 tr ("Import text file")); 1387 tr ("Import text file"));
1385#else 1388#else
1386 QString fn = ScQtFileEdit::getOpenFileName(this, 1389 QString fn = ScQtFileEdit::getOpenFileName(this,
1387 tr ("Import text file"), 1390 tr ("Import text file"),
1388 QDir::homeDirPath() + "/Documents/application/zsafe", 1391 QDir::homeDirPath() + "/Documents/application/zsafe",
1389 "*.txt"); 1392 "*.txt");
1390#endif 1393#endif
1391#else 1394#else
1392 QString fn = QFileDialog::getOpenFileName( 1395 QString fn = QFileDialog::getOpenFileName(
1393 QDir::homeDirPath() + "/Documents/application/zsafe", 1396 QDir::homeDirPath() + "/Documents/application/zsafe",
1394 "ZSafe (*.txt)", 1397 "ZSafe (*.txt)",
1395 this, 1398 this,
1396 "ZSafe File Dialog" 1399 "ZSafe File Dialog"
1397 "Choose a text file" ); 1400 "Choose a text file" );
@@ -1434,22 +1437,22 @@ void ZSafe::readAllEntries()
1434 1437
1435 qWarning ("ReadAllEntries(): "); 1438 qWarning ("ReadAllEntries(): ");
1436 1439
1437 QTextStream t(&f); 1440 QTextStream t(&f);
1438 while ( !t.eof() ) 1441 while ( !t.eof() )
1439 { 1442 {
1440 QString s = t.readLine(); 1443 QString s = t.readLine();
1441 s.replace (QRegExp("\";\""), "\"|\""); 1444 s.replace (QRegExp("\";\""), "\"|\"");
1442 // char buffer[1024]; 1445 // char buffer[1024];
1443#ifndef WIN32 1446#ifndef WIN32
1444 char buffer[s.length()+1]; 1447 char buffer[s.length()+1];
1445#else 1448#else
1446 char buffer[4048]; 1449 char buffer[4048];
1447#endif 1450#endif
1448 1451
1449 1452
1450 /* modify QString -> QCString::utf8 */ 1453 /* modify QString -> QCString::utf8 */
1451 1454
1452 strcpy (buffer, s.utf8()); 1455 strcpy (buffer, s.utf8());
1453 1456
1454 QString name; 1457 QString name;
1455 QString user; 1458 QString user;
@@ -1498,9 +1501,9 @@ void ZSafe::readAllEntries()
1498 field6 = QString::fromUtf8(&i[1]); 1501 field6 = QString::fromUtf8(&i[1]);
1499 field6.truncate(field6.length() -1); 1502 field6.truncate(field6.length() -1);
1500 break; 1503 break;
1501 } 1504 }
1502 idx++; 1505 idx++;
1503 } 1506 }
1504 1507
1505 Category *cat= categories.find (category); 1508 Category *cat= categories.find (category);
1506 if (cat) 1509 if (cat)
@@ -1592,15 +1595,15 @@ void ZSafe::writeAllEntries()
1592 QTextStream t( &f ); 1595 QTextStream t( &f );
1593 1596
1594 QListViewItem *i; 1597 QListViewItem *i;
1595 // step through all categories 1598 // step through all categories
1596 for (i = ListView->firstChild(); 1599 for (i = ListView->firstChild();
1597 i != NULL; 1600 i != NULL;
1598 i = i->nextSibling()) 1601 i = i->nextSibling())
1599 { 1602 {
1600 // step through all subitems 1603 // step through all subitems
1601 QListViewItem *si; 1604 QListViewItem *si;
1602 for (si = i->firstChild(); 1605 for (si = i->firstChild();
1603 si != NULL; 1606 si != NULL;
1604 si = si->nextSibling()) 1607 si = si->nextSibling())
1605 { 1608 {
1606 QString oneEntry; 1609 QString oneEntry;
@@ -1669,16 +1672,16 @@ void ZSafe::readAllEntries()
1669 1672
1670 qWarning ("ReadAllEntries(): "); 1673 qWarning ("ReadAllEntries(): ");
1671 1674
1672 QTextStream t(&f); 1675 QTextStream t(&f);
1673 while ( !t.eof() ) 1676 while ( !t.eof() )
1674 { 1677 {
1675 QString s = t.readLine(); 1678 QString s = t.readLine();
1676 s.replace (QRegExp("\";\""), "\"|\""); 1679 s.replace (QRegExp("\";\""), "\"|\"");
1677 // char buffer[1024]; 1680 // char buffer[1024];
1678 int len=s.length()+1; 1681 int len=s.length()+1;
1679#ifdef WIN32 1682#ifdef WIN32
1680 char buffer[512]; 1683 char buffer[512];
1681#else 1684#else
1682 char buffer[len]; 1685 char buffer[len];
1683#endif 1686#endif
1684 strcpy (buffer, s); 1687 strcpy (buffer, s);
@@ -1718,9 +1721,9 @@ void ZSafe::readAllEntries()
1718 comment = &i[1]; 1721 comment = &i[1];
1719 comment.truncate(comment.length() -1); 1722 comment.truncate(comment.length() -1);
1720 break; 1723 break;
1721 } 1724 }
1722 idx++; 1725 idx++;
1723 } 1726 }
1724 1727
1725 Category *cat= categories.find (category); 1728 Category *cat= categories.find (category);
1726 if (cat) 1729 if (cat)
@@ -1831,9 +1834,9 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1831 char* entry[FIELD_SIZE]; 1834 char* entry[FIELD_SIZE];
1832// #ifndef WIN32 1835// #ifndef WIN32
1833 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); 1836 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1);
1834// #else 1837// #else
1835 // int validationFlag = 1; 1838 // int validationFlag = 1;
1836// #endif 1839// #endif
1837 1840
1838 int pwdOk = 0; 1841 int pwdOk = 0;
1839 int numberOfTries = 3; 1842 int numberOfTries = 3;
@@ -1842,24 +1845,24 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1842 QFile f(_filename); 1845 QFile f(_filename);
1843 if (f.exists()) 1846 if (f.exists())
1844 { 1847 {
1845 // ask with a dialog for the password 1848 // ask with a dialog for the password
1846 if (m_password.isEmpty()) 1849 if (m_password.isEmpty())
1847 getDocPassword(tr("Enter Password")); 1850 getDocPassword(tr("Enter Password"));
1848 if (m_password.isEmpty() && validationFlag == 0) 1851 if (m_password.isEmpty() && validationFlag == 0)
1849 { 1852 {
1850 qWarning ("Wrong password"); 1853 qWarning ("Wrong password");
1851 QMessageBox::critical( 0, tr("ZSafe"), 1854 QMessageBox::critical( 0, tr("ZSafe"),
1852 tr("Wrong password.\n\nZSafe will now exit.") ); 1855 tr("Wrong password.\n\nZSafe will now exit.") );
1853 exitZs (1); 1856 exitZs (1);
1854 } 1857 }
1855 1858
1856 retval = loadInit(_filename, m_password); 1859 retval = loadInit(_filename, m_password);
1857 if (retval != PWERR_GOOD) 1860 if (retval != PWERR_GOOD)
1858 { 1861 {
1859 qWarning ("Error loading Document"); 1862 qWarning ("Error loading Document");
1860 return false; 1863 return false;
1861 } 1864 }
1862 } 1865 }
1863 else 1866 else
1864 { 1867 {
1865#ifdef WIN32 1868#ifdef WIN32
@@ -1878,33 +1881,33 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1878 pwdOk = 1; 1881 pwdOk = 1;
1879 break; 1882 break;
1880 } 1883 }
1881 1884
1882 retval = loadEntry(entry); 1885 retval = loadEntry(entry);
1883 if (retval == 1 && 1886 if (retval == 1 &&
1884 !strcmp (entry[0], "ZSAFECATEGORY") && 1887 !strcmp (entry[0], "ZSAFECATEGORY") &&
1885 !strcmp (entry[1], "name") && 1888 !strcmp (entry[1], "name") &&
1886 !strcmp (entry[2], "username") && 1889 !strcmp (entry[2], "username") &&
1887 !strcmp (entry[3], "password") && 1890 !strcmp (entry[3], "password") &&
1888 !strcmp (entry[4], "comment") ) 1891 !strcmp (entry[4], "comment") )
1889 { 1892 {
1890 for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); 1893 for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1891 pwdOk = 1; 1894 pwdOk = 1;
1892 break; 1895 break;
1893 } 1896 }
1894 else 1897 else
1895 // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); 1898 // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1896 fclose (fd); 1899 fclose (fd);
1897 m_password = ""; 1900 m_password = "";
1898 1901
1899 if (i < numberOfTries - 1) 1902 if (i < numberOfTries - 1)
1900 { 1903 {
1901 switch( QMessageBox::warning( this, tr("ZSafe"), 1904 switch( QMessageBox::warning( this, tr("ZSafe"),
1902 tr("Wrong password.\nEnter again?"), 1905 tr("Wrong password.\nEnter again?"),
1903 tr("&Yes"), tr("&No."), 1906 tr("&Yes"), tr("&No."),
1904 0 1907 0
1905 ) ) 1908 ) )
1906 { 1909 {
1907 case 1: // No 1910 case 1: // No
1908 exitZs (1); 1911 exitZs (1);
1909 break; 1912 break;
1910 case 0: // Yes 1913 case 0: // Yes
@@ -1922,12 +1925,12 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1922 exitZs (1); 1925 exitZs (1);
1923 } 1926 }
1924 1927
1925 1928
1926 retval = loadEntry(entry); 1929 retval = loadEntry(entry);
1927 1930
1928 int numberOfEntries=0; 1931 int numberOfEntries=0;
1929 while (retval == 1) { 1932 while (retval == 1) {
1930 1933
1931 QString category( QString::fromUtf8(entry[0]) ); 1934 QString category( QString::fromUtf8(entry[0]) );
1932 QString name( QString::fromUtf8(entry[1]) ); 1935 QString name( QString::fromUtf8(entry[1]) );
1933 QString user( QString::fromUtf8(entry[2]) ); 1936 QString user( QString::fromUtf8(entry[2]) );
@@ -2007,159 +2010,159 @@ bool ZSafe::openDocument(const char* _filename, const char* )
2007 categories.insert (c1->getCategoryName(), c1); 2010 categories.insert (c1->getCategoryName(), c1);
2008 numberOfEntries++; 2011 numberOfEntries++;
2009 } 2012 }
2010 2013
2011 for (int count = 0; count < FIELD_SIZE; count++) { 2014 for (int count = 0; count < FIELD_SIZE; count++) {
2012 free(entry[count]); 2015 free(entry[count]);
2013 } 2016 }
2014 retval = loadEntry(entry); 2017 retval = loadEntry(entry);
2015 if (retval == 2) { 2018 if (retval == 2) {
2016 // m_parent->slotStatusHelpMsg("Last entry loaded"); 2019 // m_parent->slotStatusHelpMsg("Last entry loaded");
2017 } 2020 }
2018 } // end while 2021 } // end while
2019 2022
2020 if (numberOfEntries == 0) 2023 if (numberOfEntries == 0)
2021 { 2024 {
2022 2025
2023 switch( QMessageBox::warning( this, tr("ZSafe"), 2026 switch( QMessageBox::warning( this, tr("ZSafe"),
2024 tr("Empty document or\nwrong password.\nContinue?"), 2027 tr("Empty document or\nwrong password.\nContinue?"),
2025 tr("&No"), tr("&Yes."), 2028 tr("&No"), tr("&Yes."),
2026 0 2029 0
2027 ) ) { 2030 ) ) {
2028 case 0: // No 2031 case 0: // No
2029 retval = loadFinalize(); 2032 retval = loadFinalize();
2030 exitZs (1); 2033 exitZs (1);
2031 break; 2034 break;
2032 case 1: // Yes 2035 case 1: // Yes
2033 break; 2036 break;
2034 } 2037 }
2035 } 2038 }
2036 2039
2037 retval = loadFinalize(); 2040 retval = loadFinalize();
2038 2041
2039 return true; 2042 return true;
2040} 2043}
2041 2044
2042int ZSafe::loadInit(const char* _filename, const char *password) 2045int ZSafe::loadInit(const char* _filename, const char *password)
2043{ 2046{
2044 unsigned int j = 0; 2047 unsigned int j = 0;
2045 unsigned int keylength=0; 2048 unsigned int keylength=0;
2046 int count=0, count2=0, count3=0; 2049 int count=0, count2=0, count3=0;
2047 unsigned char charbuf[8]; 2050 unsigned char charbuf[8];
2048 unsigned short ciphertext[4]; 2051 unsigned short ciphertext[4];
2049 char key[128]; 2052 char key[128];
2050 Krc2* krc2 = new Krc2(); 2053 Krc2* krc2 = new Krc2();
2051 2054
2052 fd = fopen (_filename, "rb"); 2055 fd = fopen (_filename, "rb");
2053 2056
2054 QFileInfo f (_filename); 2057 QFileInfo f (_filename);
2055 load_buffer_length = f.size(); 2058 load_buffer_length = f.size();
2056 load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; 2059 load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2;
2057 2060
2058 if (fd == NULL) 2061 if (fd == NULL)
2059 return PWERR_OPEN; 2062 return PWERR_OPEN;
2060 2063
2061 buffer = (char *)malloc(load_buffer_length); 2064 buffer = (char *)malloc(load_buffer_length);
2062 for (j = 0; password[j] != '\0'; j++) { 2065 for (j = 0; password[j] != '\0'; j++) {
2063 key[j] = password[j]; 2066 key[j] = password[j];
2064 } 2067 }
2065 keylength = j; 2068 keylength = j;
2066 krc2->rc2_expandkey (key, keylength, 128); 2069 krc2->rc2_expandkey (key, keylength, 128);
2067 2070
2068#ifndef WIN32 2071#ifndef WIN32
2069 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); 2072 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8);
2070#else 2073#else
2071 printf ("LoadInit() read1"); 2074 printf ("LoadInit() read1");
2072 size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); 2075 size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2073#endif 2076#endif
2074 2077
2075 if (size < 8) 2078 if (size < 8)
2076 return PWERR_DATA; 2079 return PWERR_DATA;
2077 2080
2078 for (count = 0; count < 4; count++) { 2081 for (count = 0; count < 4; count++) {
2079 count2 = count << 1; 2082 count2 = count << 1;
2080 iv[count] = charbuf[count2] << 8; 2083 iv[count] = charbuf[count2] << 8;
2081 iv[count] += charbuf[count2 + 1]; 2084 iv[count] += charbuf[count2 + 1];
2082 } 2085 }
2083 2086
2084 size = 0; 2087 size = 0;
2085 bufferIndex = 0; 2088 bufferIndex = 0;
2086#ifndef WIN32 2089#ifndef WIN32
2087 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { 2090 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) {
2088 while (count < 8) { 2091 while (count < 8) {
2089 count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); 2092 count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8);
2090#else 2093#else
2091 printf ("LoadInit() read2"); 2094 printf ("LoadInit() read2");
2092 while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { 2095 while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) {
2093 while (count < 8) { 2096 while (count < 8) {
2094 count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); 2097 count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2095#endif 2098#endif
2096 if (count2 == 0) { 2099 if (count2 == 0) {
2097 return PWERR_DATA; 2100 return PWERR_DATA;
2098 } 2101 }
2099 count += count2; 2102 count += count2;
2100 } /* while (count < 8) */ 2103 } /* while (count < 8) */
2101 2104
2102 size += 8; 2105 size += 8;
2103 for (count2 = 0; count2 < 8; count2 += 2) { 2106 for (count2 = 0; count2 < 8; count2 += 2) {
2104 count3 = count2 >> 1; 2107 count3 = count2 >> 1;
2105 ciphertext[count3] = charbuf[count2] << 8; 2108 ciphertext[count3] = charbuf[count2] << 8;
2106 ciphertext[count3] += charbuf[count2 + 1]; 2109 ciphertext[count3] += charbuf[count2 + 1];
2107 2110
2108 plaintext[count3] = ciphertext[count3] ^ iv[count3]; 2111 plaintext[count3] = ciphertext[count3] ^ iv[count3];
2109 iv[count3] = plaintext[count3]; 2112 iv[count3] = plaintext[count3];
2110 } /* for (count2) */ 2113 } /* for (count2) */
2111 2114
2112 krc2->rc2_decrypt (plaintext); 2115 krc2->rc2_decrypt (plaintext);
2113 memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8); 2116 memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8);
2114 bufferIndex += 8; 2117 bufferIndex += 8;
2115 buffer[bufferIndex + 1] = '\0'; 2118 buffer[bufferIndex + 1] = '\0';
2116 } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */ 2119 } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */
2117 size -= buffer[size - 1]; 2120 size -= buffer[size - 1];
2118 lastcount = 0; 2121 lastcount = 0;
2119 2122
2120 /* This will point to the starting index */ 2123 /* This will point to the starting index */
2121 bufferIndex = 0; 2124 bufferIndex = 0;
2122 return PWERR_GOOD; 2125 return PWERR_GOOD;
2123} 2126}
2124 2127
2125int ZSafe::loadEntry(char *entry[FIELD_SIZE]) 2128int ZSafe::loadEntry(char *entry[FIELD_SIZE])
2126{ 2129{
2127 /* Strip off PKCS 5 padding 2130 /* Strip off PKCS 5 padding
2128 * Should check to make sure it's good here 2131 * Should check to make sure it's good here
2129 */ 2132 */
2130 int count, count1=0; 2133 int count, count1=0;
2131 2134
2132 for (count = lastcount; count < size; count++) { 2135 for (count = lastcount; count < size; count++) {
2133 if ((unsigned char) (buffer[count]) == 255) { 2136 if ((unsigned char) (buffer[count]) == 255) {
2134 if (buffer[bufferIndex] == '\0') { 2137 if (buffer[bufferIndex] == '\0') {
2135 bufferIndex++; 2138 bufferIndex++;
2136 } 2139 }
2137 entry[count1] = (char *) malloc (count - bufferIndex + 1); 2140 entry[count1] = (char *) malloc (count - bufferIndex + 1);
2138 memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex); 2141 memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex);
2139 entry[count1][count - bufferIndex] = '\0'; 2142 entry[count1][count - bufferIndex] = '\0';
2140 count++; 2143 count++;
2141 bufferIndex = count; 2144 bufferIndex = count;
2142 count1++; 2145 count1++;
2143 if (count1 == FIELD_SIZE) { 2146 if (count1 == FIELD_SIZE) {
2144 lastcount = count; 2147 lastcount = count;
2145 return 1; 2148 return 1;
2146 } 2149 }
2147 } /* if ((unsigned char) (buffer[count]) == 255) */ 2150 } /* if ((unsigned char) (buffer[count]) == 255) */
2148 } /* for (count = 0; count < size; count++) */ 2151 } /* for (count = 0; count < size; count++) */
2149 2152
2150 return 2; 2153 return 2;
2151} 2154}
2152 2155
2153int ZSafe::loadFinalize(void) 2156int ZSafe::loadFinalize(void)
2154{ 2157{
2155 fclose (fd); 2158 fclose (fd);
2156 if (buffer) free(buffer); 2159 if (buffer) free(buffer);
2157 return PWERR_GOOD; 2160 return PWERR_GOOD;
2158} 2161}
2159 2162
2160bool ZSafe::saveDocument(const char* _filename, 2163bool ZSafe::saveDocument(const char* _filename,
2161 bool withPwd, 2164 bool withPwd,
2162 const char* ) 2165 const char* )
2163{ 2166{
2164 if (filename.isEmpty()) 2167 if (filename.isEmpty())
2165 { 2168 {
@@ -2174,47 +2177,47 @@ bool ZSafe::saveDocument(const char* _filename,
2174 { 2177 {
2175 bool pwdOk = FALSE; 2178 bool pwdOk = FALSE;
2176 while (!pwdOk) 2179 while (!pwdOk)
2177 { 2180 {
2178 getDocPassword(tr("Enter Password")); 2181 getDocPassword(tr("Enter Password"));
2179 if (m_password.isEmpty()) 2182 if (m_password.isEmpty())
2180 { 2183 {
2181 2184
2182 QMessageBox::critical( 0, tr("ZSafe"), 2185 QMessageBox::critical( 0, tr("ZSafe"),
2183 tr("Password is empty.\nPlease enter again.")); 2186 tr("Password is empty.\nPlease enter again."));
2184 continue; 2187 continue;
2185 } 2188 }
2186 2189
2187 QString firstPasswd = m_password; 2190 QString firstPasswd = m_password;
2188 2191
2189 getDocPassword(tr("Reenter Password")); 2192 getDocPassword(tr("Reenter Password"));
2190 if (m_password.isEmpty()) 2193 if (m_password.isEmpty())
2191 { 2194 {
2192 QMessageBox::critical( 0, tr("ZSafe"), 2195 QMessageBox::critical( 0, tr("ZSafe"),
2193 tr("Password is empty.\nPlease enter again.")); 2196 tr("Password is empty.\nPlease enter again."));
2194 continue; 2197 continue;
2195 } 2198 }
2196 if (firstPasswd != m_password) 2199 if (firstPasswd != m_password)
2197 { 2200 {
2198 2201
2199 QMessageBox::critical( 0, tr("ZSafe"), 2202 QMessageBox::critical( 0, tr("ZSafe"),
2200 tr("Passwords must be identical.\nPlease enter again.")); 2203 tr("Passwords must be identical.\nPlease enter again."));
2201 continue; 2204 continue;
2202 } 2205 }
2203 pwdOk = TRUE; 2206 pwdOk = TRUE;
2204 modified = false; 2207 modified = false;
2205 } 2208 }
2206 } 2209 }
2207 else if (modified) 2210 else if (modified)
2208 { 2211 {
2209 QString fns(_filename); 2212 QString fns(_filename);
2210 fns = fns.right (fns.length() - fns.findRev ('/') - 1); 2213 fns = fns.right (fns.length() - fns.findRev ('/') - 1);
2211 switch( QMessageBox::information( this, tr("ZSafe"), 2214 switch( QMessageBox::information( this, tr("ZSafe"),
2212 tr("Do you want to save ") + fns + tr("\nbefore continuing?"), 2215 tr("Do you want to save ") + fns + tr("\nbefore continuing?"),
2213 tr("&Save"), 2216 tr("&Save"),
2214 tr("&Don't Save"), 2217 tr("&Don't Save"),
2215 0 // Enter == button 0 2218 0 // Enter == button 0
2216 ) ) 2219 ) )
2217 { // Escape == button 2 2220 { // Escape == button 2
2218 case 0: // Save clicked, Alt-S or Enter pressed. 2221 case 0: // Save clicked, Alt-S or Enter pressed.
2219 modified = false; 2222 modified = false;
2220 break; 2223 break;
@@ -2223,40 +2226,40 @@ bool ZSafe::saveDocument(const char* _filename,
2223 return true; 2226 return true;
2224 } 2227 }
2225 } 2228 }
2226 modified = false; 2229 modified = false;
2227 2230
2228 if (m_password.isEmpty()) 2231 if (m_password.isEmpty())
2229 return false; 2232 return false;
2230 2233
2231 int retval = saveInit(_filename, m_password); 2234 int retval = saveInit(_filename, m_password);
2232 // int retval = saveInit(_filename, "test"); 2235 // int retval = saveInit(_filename, "test");
2233 if (retval != PWERR_GOOD) { 2236 if (retval != PWERR_GOOD) {
2234 return false; 2237 return false;
2235 } 2238 }
2236 2239
2237 char* entry[FIELD_SIZE]; 2240 char* entry[FIELD_SIZE];
2238 2241
2239 // save the validation entry 2242 // save the validation entry
2240 { 2243 {
2241 int i=0; 2244 int i=0;
2242 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); 2245 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
2243 strcpy(entry[i++], "ZSAFECATEGORY"); 2246 strcpy(entry[i++], "ZSAFECATEGORY");
2244 entry[i] = (char*)malloc(strlen("name")+1); 2247 entry[i] = (char*)malloc(strlen("name")+1);
2245 strcpy(entry[i++], "name"); 2248 strcpy(entry[i++], "name");
2246 entry[i] = (char*)malloc(strlen("username")+1); 2249 entry[i] = (char*)malloc(strlen("username")+1);
2247 strcpy(entry[i++], "username"); 2250 strcpy(entry[i++], "username");
2248 entry[i] = (char*)malloc(strlen("password")+1); 2251 entry[i] = (char*)malloc(strlen("password")+1);
2249 strcpy(entry[i++], "password"); 2252 strcpy(entry[i++], "password");
2250 entry[i] = (char*)malloc(strlen("comment")+1); 2253 entry[i] = (char*)malloc(strlen("comment")+1);
2251 strcpy(entry[i++], "comment"); 2254 strcpy(entry[i++], "comment");
2252 2255
2253 entry[i] = (char*)malloc(strlen("field5")+1); 2256 entry[i] = (char*)malloc(strlen("field5")+1);
2254 strcpy(entry[i++], "field5"); 2257 strcpy(entry[i++], "field5");
2255 entry[i] = (char*)malloc(strlen("field6")+1); 2258 entry[i] = (char*)malloc(strlen("field6")+1);
2256 strcpy(entry[i++], "field6"); 2259 strcpy(entry[i++], "field6");
2257 2260
2258 retval = saveEntry(entry); 2261 retval = saveEntry(entry);
2259 for (int z=0; z<i; z++) free(entry[z]); 2262 for (int z=0; z<i; z++) free(entry[z]);
2260 if (retval == PWERR_DATA) { 2263 if (retval == PWERR_DATA) {
2261 qWarning("1: Error writing file, contents not saved"); 2264 qWarning("1: Error writing file, contents not saved");
2262 saveFinalize(); 2265 saveFinalize();
@@ -2295,9 +2298,9 @@ bool ZSafe::saveDocument(const char* _filename,
2295 strcpy(entry[j++], si->text(4).utf8()); 2298 strcpy(entry[j++], si->text(4).utf8());
2296 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); 2299 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1);
2297 strcpy(entry[j++], si->text(5).utf8()); 2300 strcpy(entry[j++], si->text(5).utf8());
2298 2301
2299 retval = saveEntry(entry); 2302 retval = saveEntry(entry);
2300 for (int z=0; z<j; z++) 2303 for (int z=0; z<j; z++)
2301 { 2304 {
2302 free(entry[z]); 2305 free(entry[z]);
2303 } 2306 }
@@ -2309,18 +2312,18 @@ bool ZSafe::saveDocument(const char* _filename,
2309 2312
2310 } 2313 }
2311 } 2314 }
2312 2315
2313 if (saveFinalize() == PWERR_DATA) { 2316 if (saveFinalize() == PWERR_DATA) {
2314 qWarning("2: Error writing file, contents not saved"); 2317 qWarning("2: Error writing file, contents not saved");
2315 return false; 2318 return false;
2316 } else { 2319 } else {
2317#ifndef DESKTOP 2320#ifndef DESKTOP
2318 Global::statusMessage (tr("Password file saved.")); 2321 Global::statusMessage (tr("Password file saved."));
2319#endif 2322#endif
2320 modified = false; 2323 modified = false;
2321 return true; 2324 return true;
2322 } 2325 }
2323} 2326}
2324 2327
2325PasswordForm *newPwdDialog; 2328PasswordForm *newPwdDialog;
2326bool newPwdDialogResult = false; 2329bool newPwdDialogResult = false;
@@ -2369,145 +2372,145 @@ qWarning ("getDocPassword");
2369} 2372}
2370 2373
2371int ZSafe::saveInit(const char *_filename, const char *password) 2374int ZSafe::saveInit(const char *_filename, const char *password)
2372{ 2375{
2373 char key[128]; 2376 char key[128];
2374 unsigned int j = 0; 2377 unsigned int j = 0;
2375 unsigned int keylength; 2378 unsigned int keylength;
2376 // int val; 2379 // int val;
2377 int count2; 2380 int count2;
2378 Krc2* krc2 = new Krc2(); 2381 Krc2* krc2 = new Krc2();
2379 2382
2380 /* first we should check the permissions of the filename */ 2383 /* first we should check the permissions of the filename */
2381/* 2384/*
2382 if (QFile::exists(_filename)) { 2385 if (QFile::exists(_filename)) {
2383 val = checkFile(_filename); 2386 val = checkFile(_filename);
2384 if (val != PWERR_GOOD) 2387 if (val != PWERR_GOOD)
2385 return val; 2388 return val;
2386 } else 2389 } else
2387 { 2390 {
2388 val = creat (_filename, (S_IRUSR | S_IWUSR)); 2391 val = creat (_filename, (S_IRUSR | S_IWUSR));
2389 if (val == -1) 2392 if (val == -1)
2390 return PWERR_OPEN; 2393 return PWERR_OPEN;
2391 else 2394 else
2392 close(val); 2395 close(val);
2393 } 2396 }
2394*/ 2397*/
2395 QFileInfo f (_filename); 2398 QFileInfo f (_filename);
2396 save_buffer_length = f.size(); 2399 save_buffer_length = f.size();
2397 save_buffer_length = ((save_buffer_length / 1024)+1) * 1024; 2400 save_buffer_length = ((save_buffer_length / 1024)+1) * 1024;
2398 2401
2399 fd = fopen (_filename, "wb"); 2402 fd = fopen (_filename, "wb");
2400 if (fd == NULL) 2403 if (fd == NULL)
2401 return PWERR_OPEN; 2404 return PWERR_OPEN;
2402 2405
2403 buffer = (char*)malloc(save_buffer_length); 2406 buffer = (char*)malloc(save_buffer_length);
2404 2407
2405 /* make the key ready */ 2408 /* make the key ready */
2406 for (j = 0; password[j] != '\0'; j++) { 2409 for (j = 0; password[j] != '\0'; j++) {
2407 key[j] = password[j]; 2410 key[j] = password[j];
2408 } 2411 }
2409 keylength = j; 2412 keylength = j;
2410 krc2->rc2_expandkey (key, keylength, 128); 2413 krc2->rc2_expandkey (key, keylength, 128);
2411 2414
2412 /* First, we make the IV */ 2415 /* First, we make the IV */
2413 for (count2 = 0; count2 < 4; count2++) { 2416 for (count2 = 0; count2 < 4; count2++) {
2414 iv[count2] = rand (); 2417 iv[count2] = rand ();
2415 putc ((unsigned char) (iv[count2] >> 8), fd); 2418 putc ((unsigned char) (iv[count2] >> 8), fd);
2416 putc ((unsigned char) (iv[count2] & 0xff), fd); 2419 putc ((unsigned char) (iv[count2] & 0xff), fd);
2417 } 2420 }
2418 2421
2419 bufferIndex = 0; 2422 bufferIndex = 0;
2420 return PWERR_GOOD; 2423 return PWERR_GOOD;
2421} 2424}
2422 2425
2423 2426
2424int ZSafe::saveEntry(char *entry[FIELD_SIZE]) 2427int ZSafe::saveEntry(char *entry[FIELD_SIZE])
2425{ 2428{
2426 char *text1; 2429 char *text1;
2427 int count2, count3; 2430 int count2, count3;
2428 unsigned short ciphertext[4]; 2431 unsigned short ciphertext[4];
2429 Krc2* krc2 = new Krc2(); 2432 Krc2* krc2 = new Krc2();
2430 2433
2431 buffer = (char*)memset(buffer, '\0', save_buffer_length); 2434 buffer = (char*)memset(buffer, '\0', save_buffer_length);
2432 2435
2433 for (count2 = 0; count2 < FIELD_SIZE; count2++) { 2436 for (count2 = 0; count2 < FIELD_SIZE; count2++) {
2434 text1 = entry[count2]; 2437 text1 = entry[count2];
2435 if (strlen (text1) == 0) { 2438 if (strlen (text1) == 0) {
2436 strncat(buffer, " ", strlen(" ")); 2439 strncat(buffer, " ", strlen(" "));
2437 } else { 2440 } else {
2438 strncat(buffer, text1, strlen(text1)); 2441 strncat(buffer, text1, strlen(text1));
2439 } 2442 }
2440 /* Use 255 as the marker. \n is too tough to test for */ 2443 /* Use 255 as the marker. \n is too tough to test for */
2441 buffer[strlen (buffer)] = 255; 2444 buffer[strlen (buffer)] = 255;
2442 } /*for (count2 = 0; count2 < 5; count2++)*/ 2445 } /*for (count2 = 0; count2 < 5; count2++)*/
2443 count2 = 0; 2446 count2 = 0;
2444 /* I'm using CBC mode and encrypting the data straight from top down. 2447 /* I'm using CBC mode and encrypting the data straight from top down.
2445 * At the bottom, encrypted, I will append an MD5 hash of the file, eventually. 2448 * At the bottom, encrypted, I will append an MD5 hash of the file, eventually.
2446 * PKCS 5 padding (explained at the code section 2449 * PKCS 5 padding (explained at the code section
2447 */ 2450 */
2448 while (count2 < (int)strlen (buffer)) { 2451 while (count2 < (int)strlen (buffer)) {
2449#ifndef WORDS_BIGENDIAN 2452#ifndef WORDS_BIGENDIAN
2450 plaintext[bufferIndex] = buffer[count2 + 1] << 8; 2453 plaintext[bufferIndex] = buffer[count2 + 1] << 8;
2451 plaintext[bufferIndex] += buffer[count2] & 0xff; 2454 plaintext[bufferIndex] += buffer[count2] & 0xff;
2452#endif 2455#endif
2453#ifdef WORDS_BIGENDIAN 2456#ifdef WORDS_BIGENDIAN
2454 plaintext[bufferIndex] = buffer[count2] << 8; 2457 plaintext[bufferIndex] = buffer[count2] << 8;
2455 plaintext[bufferIndex] += buffer[count2 + 1] & 0xff; 2458 plaintext[bufferIndex] += buffer[count2 + 1] & 0xff;
2456#endif 2459#endif
2457 bufferIndex++; 2460 bufferIndex++;
2458 if (bufferIndex == 4) { 2461 if (bufferIndex == 4) {
2459 krc2->rc2_encrypt (plaintext); 2462 krc2->rc2_encrypt (plaintext);
2460 2463
2461 for (count3 = 0; count3 < 4; count3++) { 2464 for (count3 = 0; count3 < 4; count3++) {
2462 ciphertext[count3] = iv[count3] ^ plaintext[count3]; 2465 ciphertext[count3] = iv[count3] ^ plaintext[count3];
2463 2466
2464 /* Now store the ciphertext as the iv */ 2467 /* Now store the ciphertext as the iv */
2465 iv[count3] = plaintext[count3]; 2468 iv[count3] = plaintext[count3];
2466 2469
2467 /* reset the buffer index */ 2470 /* reset the buffer index */
2468 bufferIndex = 0; 2471 bufferIndex = 0;
2469 if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA; 2472 if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA;
2470 if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA; 2473 if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA;
2471 } /*for (count3 = 0; count3 < 5; count3++)*/ 2474 } /*for (count3 = 0; count3 < 5; count3++)*/
2472 } /*if (bufferIndex == 5)*/ 2475 } /*if (bufferIndex == 5)*/
2473 /* increment a short, not a byte */ 2476 /* increment a short, not a byte */
2474 count2 += 2; 2477 count2 += 2;
2475 } /*while (count2 < strlen (buffer))*/ 2478 } /*while (count2 < strlen (buffer))*/
2476 int ret = PWERR_GOOD; 2479 int ret = PWERR_GOOD;
2477 return ret; 2480 return ret;
2478} 2481}
2479 2482
2480int ZSafe::saveFinalize(void) 2483int ZSafe::saveFinalize(void)
2481{ 2484{
2482 int count1, retval = PWERR_GOOD; 2485 int count1, retval = PWERR_GOOD;
2483 unsigned short ciphertext[4]; 2486 unsigned short ciphertext[4];
2484 Krc2* krc2 = new Krc2(); 2487 Krc2* krc2 = new Krc2();
2485 2488
2486 /* Tack on the PKCS 5 padding 2489 /* Tack on the PKCS 5 padding
2487 * How it works is we fill up the last n bytes with the value n 2490 * How it works is we fill up the last n bytes with the value n
2488 * 2491 *
2489 * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left 2492 * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left
2490 * over, leaving us 3 short, so we fill it in with 3's. 2493 * over, leaving us 3 short, so we fill it in with 3's.
2491 * 2494 *
2492 * If we come out even, we fill it with 8 8s 2495 * If we come out even, we fill it with 8 8s
2493 * 2496 *
2494 * um, except that in this instance we are using 4 shorts instead of 8 bytes. 2497 * um, except that in this instance we are using 4 shorts instead of 8 bytes.
2495 * so, half everything 2498 * so, half everything
2496 */ 2499 */
2497 for (count1 = bufferIndex; count1 < 4; count1++) { 2500 for (count1 = bufferIndex; count1 < 4; count1++) {
2498 plaintext[count1] = (4 - bufferIndex); 2501 plaintext[count1] = (4 - bufferIndex);
2499 } 2502 }
2500 krc2->rc2_encrypt (plaintext); 2503 krc2->rc2_encrypt (plaintext);
2501 for (count1 = 0; count1 < 4; count1++) { 2504 for (count1 = 0; count1 < 4; count1++) {
2502 ciphertext[count1] = iv[count1] ^ plaintext[count1]; 2505 ciphertext[count1] = iv[count1] ^ plaintext[count1];
2503 if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA; 2506 if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA;
2504 if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA; 2507 if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA;
2505 } 2508 }
2506 2509
2507 fclose (fd); 2510 fclose (fd);
2508 free(buffer); 2511 free(buffer);
2509 return retval; 2512 return retval;
2510} 2513}
2511 2514
2512void ZSafe::quitMe () 2515void ZSafe::quitMe ()
2513{ 2516{
@@ -2516,21 +2519,21 @@ void ZSafe::quitMe ()
2516 if (modified) 2519 if (modified)
2517 { 2520 {
2518 switch( QMessageBox::information( this, tr("ZSafe"), 2521 switch( QMessageBox::information( this, tr("ZSafe"),
2519 tr("Do you want to save\nbefore exiting?"), 2522 tr("Do you want to save\nbefore exiting?"),
2520 tr("&Save"), 2523 tr("&Save"),
2521 tr("S&ave with\nnew\npassword"), 2524 tr("S&ave with\nnew\npassword"),
2522 tr("&Don't Save"), 2525 tr("&Don't Save"),
2523 0 // Enter == button 0 2526 0 // Enter == button 0
2524 ) ) 2527 ) )
2525 { // Escape == button 2 2528 { // Escape == button 2
2526 case 0: // Save clicked, Alt-S or Enter pressed. 2529 case 0: // Save clicked, Alt-S or Enter pressed.
2527 // save 2530 // save
2528 modified = false; 2531 modified = false;
2529 saveDocument(filename, FALSE); 2532 saveDocument(filename, FALSE);
2530 exitZs (1); 2533 exitZs (1);
2531 break; 2534 break;
2532 case 1: // 2535 case 1: //
2533 // Save with new password 2536 // Save with new password
2534 modified = false; 2537 modified = false;
2535 saveDocument(filename, TRUE); 2538 saveDocument(filename, TRUE);
2536 exitZs (1); 2539 exitZs (1);
@@ -2575,9 +2578,9 @@ void ZSafe::addCategory()
2575#ifdef WIN32 2578#ifdef WIN32
2576 categoryDialog->setCaption ("Qt " + tr("Category")); 2579 categoryDialog->setCaption ("Qt " + tr("Category"));
2577#endif 2580#endif
2578 dialog = categoryDialog; 2581 dialog = categoryDialog;
2579 connect( dialog->CategoryField, 2582 connect( dialog->CategoryField,
2580 SIGNAL( activated ( const QString &)), 2583 SIGNAL( activated ( const QString &)),
2581 this, SLOT( categoryFieldActivated( const QString & ) ) ); 2584 this, SLOT( categoryFieldActivated( const QString & ) ) );
2582 initIcons = true; 2585 initIcons = true;
2583 } 2586 }
@@ -2600,9 +2603,9 @@ void ZSafe::addCategory()
2600 } 2603 }
2601 f.close(); 2604 f.close();
2602 } 2605 }
2603#endif 2606#endif
2604#else 2607#else
2605 // read all categories from the config file and store 2608 // read all categories from the config file and store
2606 // into a list 2609 // into a list
2607 QFile f (cfgFile); 2610 QFile f (cfgFile);
2608 QStringList list; 2611 QStringList list;
@@ -2619,19 +2622,19 @@ void ZSafe::addCategory()
2619 QStringList::Iterator it = list.begin(); 2622 QStringList::Iterator it = list.begin();
2620 QString categ; 2623 QString categ;
2621 QString firstCategory; 2624 QString firstCategory;
2622 dialog->CategoryField->clear(); // remove all items 2625 dialog->CategoryField->clear(); // remove all items
2623 while( it != list.end() ) 2626 while( it != list.end() )
2624 { 2627 {
2625 QString *cat = new QString (*it); 2628 QString *cat = new QString (*it);
2626 if (cat->contains("-field1", FALSE)) 2629 if (cat->contains("-field1", FALSE))
2627 { 2630 {
2628#ifdef DESKTOP 2631#ifdef DESKTOP
2629#ifndef WIN32 2632#ifndef WIN32
2630 categ = cat->section ("-field1", 0, 0); 2633 categ = cat->section ("-field1", 0, 0);
2631#else 2634#else
2632 int pos = cat->find ("-field1"); 2635 int pos = cat->find ("-field1");
2633 categ = cat->left (pos); 2636 categ = cat->left (pos);
2634#endif 2637#endif
2635#else 2638#else
2636 int pos = cat->find ("-field1"); 2639 int pos = cat->find ("-field1");
2637 cat->truncate(pos); 2640 cat->truncate(pos);
@@ -2656,45 +2659,45 @@ void ZSafe::addCategory()
2656 // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); 2659 // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE);
2657 2660
2658 if (initIcons) 2661 if (initIcons)
2659 { 2662 {
2660 Wait waitDialog(this, tr("Wait dialog")); 2663 Wait waitDialog(this, tr("Wait dialog"));
2661 waitDialog.waitLabel->setText(tr("Gathering icons...")); 2664 waitDialog.waitLabel->setText(tr("Gathering icons..."));
2662 waitDialog.show(); 2665 waitDialog.show();
2663 qApp->processEvents(); 2666 qApp->processEvents();
2664 2667
2665#ifdef DESKTOP 2668#ifdef DESKTOP
2666 QDir d(iconPath); 2669 QDir d(iconPath);
2667#else 2670#else
2668 QDir d(QPEApplication::qpeDir() + "/pics/"); 2671 QDir d(QPEApplication::qpeDir() + "/pics/");
2669#endif 2672#endif
2670 d.setFilter( QDir::Files); 2673 d.setFilter( QDir::Files);
2671 2674
2672 const QFileInfoList *list = d.entryInfoList(); 2675 const QFileInfoList *list = d.entryInfoList();
2673 QFileInfoListIterator it( *list ); // create list iterator 2676 QFileInfoListIterator it( *list ); // create list iterator
2674 QFileInfo *fi; // pointer for traversing 2677 QFileInfo *fi; // pointer for traversing
2675 2678
2676 dialog->IconField->insertItem("predefined"); 2679 dialog->IconField->insertItem("predefined");
2677 while ( (fi=it.current()) ) { // for each file... 2680 while ( (fi=it.current()) ) { // for each file...
2678 QString fileName = fi->fileName(); 2681 QString fileName = fi->fileName();
2679 if(fileName.right(4) == ".png"){ 2682 if(fileName.right(4) == ".png"){
2680 fileName = fileName.mid(0,fileName.length()-4); 2683 fileName = fileName.mid(0,fileName.length()-4);
2681#ifdef DESKTOP 2684#ifdef DESKTOP
2682 QPixmap imageOfFile; 2685 QPixmap imageOfFile;
2683 imageOfFile.load(iconPath + fi->fileName()); 2686 imageOfFile.load(iconPath + fi->fileName());
2684#else 2687#else
2685 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 2688 QPixmap imageOfFile(Resource::loadPixmap(fileName));
2686#endif 2689#endif
2687 QImage foo = imageOfFile.convertToImage(); 2690 QImage foo = imageOfFile.convertToImage();
2688 foo = foo.smoothScale(16,16); 2691 foo = foo.smoothScale(16,16);
2689 imageOfFile.convertFromImage(foo); 2692 imageOfFile.convertFromImage(foo);
2690 dialog->IconField->insertItem(imageOfFile,fileName); 2693 dialog->IconField->insertItem(imageOfFile,fileName);
2691 } 2694 }
2692 ++it; 2695 ++it;
2693 } 2696 }
2694 waitDialog.hide(); 2697 waitDialog.hide();
2695 } 2698 }
2696 2699
2697#ifndef WIN32 2700#ifndef WIN32
2698 dialog->show(); 2701 dialog->show();
2699#endif 2702#endif
2700#ifndef DESKTOP 2703#ifndef DESKTOP
@@ -2726,9 +2729,9 @@ void ZSafe::addCategory()
2726 { 2729 {
2727 // build the full path 2730 // build the full path
2728 fullIconPath = iconPath + icon; 2731 fullIconPath = iconPath + icon;
2729 pix = new QPixmap (fullIconPath); 2732 pix = new QPixmap (fullIconPath);
2730 // pix->resize(14, 14); 2733 // pix->resize(14, 14);
2731 if (pix) 2734 if (pix)
2732 { 2735 {
2733 // save the full pixmap name into the config file 2736 // save the full pixmap name into the config file
2734// #ifndef WIN32 2737// #ifndef WIN32
@@ -2775,9 +2778,9 @@ void ZSafe::delCategory()
2775 if (isCategory(selectedItem)) 2778 if (isCategory(selectedItem))
2776 { 2779 {
2777 switch( QMessageBox::information( this, tr("ZSafe"), 2780 switch( QMessageBox::information( this, tr("ZSafe"),
2778 tr("Do you want to delete?"), 2781 tr("Do you want to delete?"),
2779 tr("&Delete"), tr("D&on't Delete"), 2782 tr("&Delete"), tr("D&on't Delete"),
2780 0 // Enter == button 0 2783 0 // Enter == button 0
2781 ) ) { // Escape == button 2 2784 ) ) { // Escape == button 2
2782 case 0: // Delete clicked, Alt-S or Enter pressed. 2785 case 0: // Delete clicked, Alt-S or Enter pressed.
2783 // Delete from the category list 2786 // Delete from the category list
@@ -2816,9 +2819,9 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2816 if (!dialog) 2819 if (!dialog)
2817 return; 2820 return;
2818 2821
2819 QString icon; 2822 QString icon;
2820 if (selectedItem) 2823 if (selectedItem)
2821 { 2824 {
2822 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 2825 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
2823 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 2826 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
2824 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 2827 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
@@ -2844,41 +2847,41 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2844 dialog->Field6->setText(tr("Field 5")); 2847 dialog->Field6->setText(tr("Field 5"));
2845 } 2848 }
2846 2849
2847#ifdef DESKTOP 2850#ifdef DESKTOP
2848 QDir d(iconPath); 2851 QDir d(iconPath);
2849#else 2852#else
2850 QDir d(QPEApplication::qpeDir() + "/pics/"); 2853 QDir d(QPEApplication::qpeDir() + "/pics/");
2851#endif 2854#endif
2852 d.setFilter( QDir::Files); 2855 d.setFilter( QDir::Files);
2853 2856
2854 const QFileInfoList *list = d.entryInfoList(); 2857 const QFileInfoList *list = d.entryInfoList();
2855 int i=0; 2858 int i=0;
2856 QFileInfoListIterator it( *list ); // create list iterator 2859 QFileInfoListIterator it( *list ); // create list iterator
2857 QFileInfo *fi; // pointer for traversing 2860 QFileInfo *fi; // pointer for traversing
2858 if (icon.isEmpty() || icon.isNull()) 2861 if (icon.isEmpty() || icon.isNull())
2859 { 2862 {
2860 dialog->IconField->setCurrentItem(0); 2863 dialog->IconField->setCurrentItem(0);
2861 } 2864 }
2862 else 2865 else
2863 { 2866 {
2864 while ( (fi=it.current()) ) 2867 while ( (fi=it.current()) )
2865 { // for each file... 2868 { // for each file...
2866 QString fileName = fi->fileName(); 2869 QString fileName = fi->fileName();
2867 if(fileName.right(4) == ".png") 2870 if(fileName.right(4) == ".png")
2868 { 2871 {
2869 fileName = fileName.mid(0,fileName.length()-4); 2872 fileName = fileName.mid(0,fileName.length()-4);
2870 2873
2871 if(fileName+".png"==icon) 2874 if(fileName+".png"==icon)
2872 { 2875 {
2873 dialog->IconField->setCurrentItem(i+1); 2876 dialog->IconField->setCurrentItem(i+1);
2874 break; 2877 break;
2875 } 2878 }
2876 ++i; 2879 ++i;
2877 } 2880 }
2878 ++it; 2881 ++it;
2879 } 2882 }
2880 } 2883 }
2881} 2884}
2882 2885
2883void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) 2886void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
2884{ 2887{
@@ -2901,41 +2904,41 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
2901 else 2904 else
2902 icon = conf->readEntry(APP_KEY+category); 2905 icon = conf->readEntry(APP_KEY+category);
2903 2906
2904#ifdef DESKTOP 2907#ifdef DESKTOP
2905 QDir d(iconPath); 2908 QDir d(iconPath);
2906#else 2909#else
2907 QDir d(QPEApplication::qpeDir() + "/pics/"); 2910 QDir d(QPEApplication::qpeDir() + "/pics/");
2908#endif 2911#endif
2909 d.setFilter( QDir::Files); 2912 d.setFilter( QDir::Files);
2910 2913
2911 const QFileInfoList *list = d.entryInfoList(); 2914 const QFileInfoList *list = d.entryInfoList();
2912 int i=0; 2915 int i=0;
2913 QFileInfoListIterator it( *list ); // create list iterator 2916 QFileInfoListIterator it( *list ); // create list iterator
2914 QFileInfo *fi; // pointer for traversing 2917 QFileInfo *fi; // pointer for traversing
2915 if (icon.isEmpty() || icon.isNull()) 2918 if (icon.isEmpty() || icon.isNull())
2916 { 2919 {
2917 dialog->IconField->setCurrentItem(0); 2920 dialog->IconField->setCurrentItem(0);
2918 } 2921 }
2919 else 2922 else
2920 { 2923 {
2921 while ( (fi=it.current()) ) 2924 while ( (fi=it.current()) )
2922 { // for each file... 2925 { // for each file...
2923 QString fileName = fi->fileName(); 2926 QString fileName = fi->fileName();
2924 if(fileName.right(4) == ".png") 2927 if(fileName.right(4) == ".png")
2925 { 2928 {
2926 fileName = fileName.mid(0,fileName.length()-4); 2929 fileName = fileName.mid(0,fileName.length()-4);
2927 2930
2928 if(fileName+".png"==icon) 2931 if(fileName+".png"==icon)
2929 { 2932 {
2930 dialog->IconField->setCurrentItem(i+1); 2933 dialog->IconField->setCurrentItem(i+1);
2931 break; 2934 break;
2932 } 2935 }
2933 ++i; 2936 ++i;
2934 } 2937 }
2935 ++it; 2938 ++it;
2936 } 2939 }
2937 } 2940 }
2938} 2941}
2939 2942
2940void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) 2943void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
2941{ 2944{
@@ -2982,9 +2985,9 @@ void ZSafe::editCategory()
2982#ifdef WIN32 2985#ifdef WIN32
2983 categoryDialog->setCaption ("Qt " + tr("Category")); 2986 categoryDialog->setCaption ("Qt " + tr("Category"));
2984#endif 2987#endif
2985 dialog = categoryDialog; 2988 dialog = categoryDialog;
2986 connect( dialog->CategoryField, 2989 connect( dialog->CategoryField,
2987 SIGNAL( activated ( const QString &)), 2990 SIGNAL( activated ( const QString &)),
2988 this, SLOT( categoryFieldActivated( const QString & ) ) ); 2991 this, SLOT( categoryFieldActivated( const QString & ) ) );
2989 initIcons = true; 2992 initIcons = true;
2990 } 2993 }
@@ -3028,19 +3031,19 @@ void ZSafe::editCategory()
3028 QString categ; 3031 QString categ;
3029 dialog->CategoryField->clear(); // remove all items 3032 dialog->CategoryField->clear(); // remove all items
3030 int i=0; 3033 int i=0;
3031 bool foundCategory = false; 3034 bool foundCategory = false;
3032 while( it != list.end() ) 3035 while( it != list.end() )
3033 { 3036 {
3034 QString *cat = new QString (*it); 3037 QString *cat = new QString (*it);
3035 if (cat->contains("-field1", FALSE)) 3038 if (cat->contains("-field1", FALSE))
3036 { 3039 {
3037#ifdef DESKTOP 3040#ifdef DESKTOP
3038#ifndef WIN32 3041#ifndef WIN32
3039 categ = cat->section ("-field1", 0, 0); 3042 categ = cat->section ("-field1", 0, 0);
3040#else 3043#else
3041 int pos = cat->find ("-field1"); 3044 int pos = cat->find ("-field1");
3042 categ = cat->left (pos); 3045 categ = cat->left (pos);
3043#endif 3046#endif
3044#else 3047#else
3045 int pos = cat->find ("-field1"); 3048 int pos = cat->find ("-field1");
3046 cat->truncate(pos); 3049 cat->truncate(pos);
@@ -3074,92 +3077,92 @@ void ZSafe::editCategory()
3074 3077
3075 if (initIcons) 3078 if (initIcons)
3076 { 3079 {
3077 3080
3078 Wait waitDialog(this, tr("Wait dialog")); 3081 Wait waitDialog(this, tr("Wait dialog"));
3079 waitDialog.waitLabel->setText(tr("Gathering icons...")); 3082 waitDialog.waitLabel->setText(tr("Gathering icons..."));
3080 waitDialog.show(); 3083 waitDialog.show();
3081 qApp->processEvents(); 3084 qApp->processEvents();
3082 3085
3083#ifdef DESKTOP 3086#ifdef DESKTOP
3084 QDir d(iconPath); 3087 QDir d(iconPath);
3085#else 3088#else
3086 QDir d(QPEApplication::qpeDir() + "/pics/"); 3089 QDir d(QPEApplication::qpeDir() + "/pics/");
3087#endif 3090#endif
3088 d.setFilter( QDir::Files); 3091 d.setFilter( QDir::Files);
3089 3092
3090 const QFileInfoList *list = d.entryInfoList(); 3093 const QFileInfoList *list = d.entryInfoList();
3091 int i=0; 3094 int i=0;
3092 QFileInfoListIterator it( *list ); // create list iterator 3095 QFileInfoListIterator it( *list ); // create list iterator
3093 QFileInfo *fi; // pointer for traversing 3096 QFileInfo *fi; // pointer for traversing
3094 if (icon.isEmpty() || icon.isNull()) 3097 if (icon.isEmpty() || icon.isNull())
3095 { 3098 {
3096 dialog->IconField->setCurrentItem(0); 3099 dialog->IconField->setCurrentItem(0);
3097 } 3100 }
3098 3101
3099 dialog->IconField->insertItem("predefined"); 3102 dialog->IconField->insertItem("predefined");
3100 while ( (fi=it.current()) ) { // for each file... 3103 while ( (fi=it.current()) ) { // for each file...
3101 QString fileName = fi->fileName(); 3104 QString fileName = fi->fileName();
3102 if(fileName.right(4) == ".png") 3105 if(fileName.right(4) == ".png")
3103 { 3106 {
3104 fileName = fileName.mid(0,fileName.length()-4); 3107 fileName = fileName.mid(0,fileName.length()-4);
3105#ifdef DESKTOP 3108#ifdef DESKTOP
3106 QPixmap imageOfFile; 3109 QPixmap imageOfFile;
3107 imageOfFile.load(iconPath + fi->fileName()); 3110 imageOfFile.load(iconPath + fi->fileName());
3108#else 3111#else
3109 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 3112 QPixmap imageOfFile(Resource::loadPixmap(fileName));
3110#endif 3113#endif
3111 QImage foo = imageOfFile.convertToImage(); 3114 QImage foo = imageOfFile.convertToImage();
3112 foo = foo.smoothScale(16,16); 3115 foo = foo.smoothScale(16,16);
3113 imageOfFile.convertFromImage(foo); 3116 imageOfFile.convertFromImage(foo);
3114 dialog->IconField->insertItem(imageOfFile,fileName); 3117 dialog->IconField->insertItem(imageOfFile,fileName);
3115 if(fileName+".png"==icon) 3118 if(fileName+".png"==icon)
3116 dialog->IconField->setCurrentItem(i+1); 3119 dialog->IconField->setCurrentItem(i+1);
3117 ++i; 3120 ++i;
3118 } 3121 }
3119 ++it; 3122 ++it;
3120 } 3123 }
3121 waitDialog.hide(); 3124 waitDialog.hide();
3122 } 3125 }
3123 else 3126 else
3124 { 3127 {
3125#ifdef DESKTOP 3128#ifdef DESKTOP
3126 // QDir d(QDir::homeDirPath() + "/pics/"); 3129 // QDir d(QDir::homeDirPath() + "/pics/");
3127 QDir d(iconPath); 3130 QDir d(iconPath);
3128#else 3131#else
3129 QDir d(QPEApplication::qpeDir() + "/pics/"); 3132 QDir d(QPEApplication::qpeDir() + "/pics/");
3130#endif 3133#endif
3131 d.setFilter( QDir::Files); 3134 d.setFilter( QDir::Files);
3132 3135
3133 const QFileInfoList *list = d.entryInfoList(); 3136 const QFileInfoList *list = d.entryInfoList();
3134 int i=0; 3137 int i=0;
3135 QFileInfoListIterator it( *list ); // create list iterator 3138 QFileInfoListIterator it( *list ); // create list iterator
3136 QFileInfo *fi; // pointer for traversing 3139 QFileInfo *fi; // pointer for traversing
3137 if (icon.isEmpty() || icon.isNull()) 3140 if (icon.isEmpty() || icon.isNull())
3138 { 3141 {
3139 dialog->IconField->setCurrentItem(0); 3142 dialog->IconField->setCurrentItem(0);
3140 } 3143 }
3141 else 3144 else
3142 { 3145 {
3143 3146
3144 while ( (fi=it.current()) ) 3147 while ( (fi=it.current()) )
3145 { // for each file... 3148 { // for each file...
3146 QString fileName = fi->fileName(); 3149 QString fileName = fi->fileName();
3147 if(fileName.right(4) == ".png") 3150 if(fileName.right(4) == ".png")
3148 { 3151 {
3149 fileName = fileName.mid(0,fileName.length()-4); 3152 fileName = fileName.mid(0,fileName.length()-4);
3150 3153
3151 3154
3152 if(fileName+".png"==icon) 3155 if(fileName+".png"==icon)
3153 { 3156 {
3154 dialog->IconField->setCurrentItem(i+1); 3157 dialog->IconField->setCurrentItem(i+1);
3155 break; 3158 break;
3156 } 3159 }
3157 ++i; 3160 ++i;
3158 } 3161 }
3159 ++it; 3162 ++it;
3160 } 3163 }
3161 } 3164 }
3162 } 3165 }
3163 3166
3164 // dialog->show(); 3167 // dialog->show();
3165#ifndef DESKTOP 3168#ifndef DESKTOP
@@ -3329,16 +3332,16 @@ void ZSafe::newDocument()
3329 mimeTypes, 3332 mimeTypes,
3330 this, 3333 this,
3331 tr ("Create new ZSafe document")); 3334 tr ("Create new ZSafe document"));
3332#else 3335#else
3333 QString newFile = ScQtFileEdit::getSaveAsFileName(this, 3336 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3334 tr ("Create new ZSafe document"), 3337 tr ("Create new ZSafe document"),
3335 QDir::homeDirPath() + "/Documents/application/zsafe", 3338 QDir::homeDirPath() + "/Documents/application/zsafe",
3336 "*.zsf"); 3339 "*.zsf");
3337#endif 3340#endif
3338#else 3341#else
3339 QString newFile = QFileDialog::getSaveFileName( 3342 QString newFile = QFileDialog::getSaveFileName(
3340 QDir::homeDirPath() + "/Documents/application/zsafe", 3343 QDir::homeDirPath() + "/Documents/application/zsafe",
3341 "ZSafe (*.zsf)", 3344 "ZSafe (*.zsf)",
3342 this, 3345 this,
3343 "ZSafe File Dialog" 3346 "ZSafe File Dialog"
3344 "Choose a ZSafe file" ); 3347 "Choose a ZSafe file" );
@@ -3394,9 +3397,9 @@ void ZSafe::newDocument()
3394#endif 3397#endif
3395 3398
3396 // openDocument(filename); 3399 // openDocument(filename);
3397 3400
3398 QMessageBox::information( this, tr("ZSafe"), 3401 QMessageBox::information( this, tr("ZSafe"),
3399 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); 3402 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3400 3403
3401 saveDocumentWithPwd(); 3404 saveDocumentWithPwd();
3402 } 3405 }
@@ -3417,16 +3420,16 @@ void ZSafe::loadDocument()
3417 mimeTypes, 3420 mimeTypes,
3418 this, 3421 this,
3419 tr ("Open ZSafe document")); 3422 tr ("Open ZSafe document"));
3420#else 3423#else
3421 QString newFile = ScQtFileEdit::getOpenFileName(this, 3424 QString newFile = ScQtFileEdit::getOpenFileName(this,
3422 tr ("Open ZSafe document"), 3425 tr ("Open ZSafe document"),
3423 QDir::homeDirPath() + "/Documents/application/zsafe", 3426 QDir::homeDirPath() + "/Documents/application/zsafe",
3424 "*.zsf"); 3427 "*.zsf");
3425#endif 3428#endif
3426#else 3429#else
3427 QString newFile = QFileDialog::getOpenFileName( 3430 QString newFile = QFileDialog::getOpenFileName(
3428 QDir::homeDirPath() + "/Documents/application/zsafe", 3431 QDir::homeDirPath() + "/Documents/application/zsafe",
3429 "ZSafe (*.zsf)", 3432 "ZSafe (*.zsf)",
3430 this, 3433 this,
3431 "ZSafe File Dialog" 3434 "ZSafe File Dialog"
3432 "Choose a ZSafe file" ); 3435 "Choose a ZSafe file" );
@@ -3495,17 +3498,17 @@ void ZSafe::saveDocumentAs()
3495 mimeTypes, 3498 mimeTypes,
3496 this, 3499 this,
3497 tr ("Save ZSafe document as..")); 3500 tr ("Save ZSafe document as.."));
3498#else 3501#else
3499 QString newFile = ScQtFileEdit::getSaveAsFileName(this, 3502 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3500 tr ("Save ZSafe document as.."), 3503 tr ("Save ZSafe document as.."),
3501 QDir::homeDirPath() + "/Documents/application/zsafe", 3504 QDir::homeDirPath() + "/Documents/application/zsafe",
3502 "*.zsf"); 3505 "*.zsf");
3503#endif 3506#endif
3504#else 3507#else
3505 // open the file dialog 3508 // open the file dialog
3506 QString newFile = QFileDialog::getSaveFileName( 3509 QString newFile = QFileDialog::getSaveFileName(
3507 QDir::homeDirPath() + "/Documents/application/zsafe", 3510 QDir::homeDirPath() + "/Documents/application/zsafe",
3508 "ZSafe (*.zsf)", 3511 "ZSafe (*.zsf)",
3509 this, 3512 this,
3510 "ZSafe File Dialog" 3513 "ZSafe File Dialog"
3511 "Choose a ZSafe file" ); 3514 "Choose a ZSafe file" );
@@ -3530,9 +3533,9 @@ void ZSafe::saveDocumentAs()
3530#else 3533#else
3531 this->setCaption("ZSafe: " + ti); 3534 this->setCaption("ZSafe: " + ti);
3532#endif 3535#endif
3533 3536
3534 QMessageBox::information( this, tr("ZSafe"), 3537 QMessageBox::information( this, tr("ZSafe"),
3535 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); 3538 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3536 3539
3537 saveDocumentWithPwd(); 3540 saveDocumentWithPwd();
3538 } 3541 }
@@ -3621,9 +3624,9 @@ void ZSafe::paintEvent( QPaintEvent * )
3621 infoForm->raise(); 3624 infoForm->raise();
3622 } 3625 }
3623} 3626}
3624 3627
3625void ZSafe::resizeEvent ( QResizeEvent * ) 3628void ZSafe::resizeEvent ( QResizeEvent * )
3626{ 3629{
3627 // qWarning ("resizeEvent"); 3630 // qWarning ("resizeEvent");
3628#ifndef DESKTOP 3631#ifndef DESKTOP
3629 DeskW = appl->desktop()->width(); 3632 DeskW = appl->desktop()->width();
@@ -3633,15 +3636,15 @@ void ZSafe::resizeEvent ( QResizeEvent * )
3633 DeskH = this->height(); 3636 DeskH = this->height();
3634#endif 3637#endif
3635 3638
3636 if (New) 3639 if (New)
3637 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); 3640 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
3638 if (Edit) 3641 if (Edit)
3639 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); 3642 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
3640 if (Delete) 3643 if (Delete)
3641 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 3644 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
3642 if (Find) 3645 if (Find)
3643 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); 3646 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
3644} 3647}
3645 3648
3646void ZSafe::slotRaiseTimer() 3649void ZSafe::slotRaiseTimer()
3647{ 3650{
@@ -3721,9 +3724,9 @@ void ZSafe::setDocument(const QString& fileref)
3721 categories.clear(); 3724 categories.clear();
3722 3725
3723 m_password = ""; 3726 m_password = "";
3724 selectedItem = NULL; 3727 selectedItem = NULL;
3725 3728
3726 openDocument(filename); 3729 openDocument(filename);
3727#endif 3730#endif
3728} 3731}
3729 3732
diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro
index 65bcb79..1e8e4ac 100644
--- a/noncore/apps/zsafe/zsafe.pro
+++ b/noncore/apps/zsafe/zsafe.pro
@@ -1,17 +1,17 @@
1 TEMPLATE = app 1TEMPLATE = app
2 CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \ 4HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \
5 scqtfiledlg.h 5 scqtfiledlg.h
6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ 6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
7 categorylist.cpp zlistview.cpp shadedlistitem.cpp\ 7 categorylist.cpp zlistview.cpp shadedlistitem.cpp\
8 scqtfileedit.cpp scqtfileedit.moc.cpp \ 8 scqtfileedit.cpp scqtfileedit.moc.cpp \
9 scqtfiledlg.cpp 9 scqtfiledlg.cpp
10 INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui 10INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui
11 INCLUDEPATH+= $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12 DEPENDPATH+= $(OPIEDIR)/include 12DEPENDPATH += $(OPIEDIR)/include
13LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopie 13LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopieui2
14 TARGET = zsafe 14TARGET = zsafe
15 15
16include ( $(OPIEDIR)/include.pro ) 16include ( $(OPIEDIR)/include.pro )
17 17