summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp106
1 files changed, 19 insertions, 87 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index d55624b..43565ee 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -80,48 +80,52 @@
80#include <qvariant.h> 80#include <qvariant.h>
81#include <qtooltip.h> 81#include <qtooltip.h>
82#include <qwhatsthis.h> 82#include <qwhatsthis.h>
83#include <qimage.h> 83#include <qimage.h>
84#include <qpixmap.h> 84#include <qpixmap.h>
85#include <qlineedit.h> 85#include <qlineedit.h>
86#include <qmultilineedit.h> 86#include <qmultilineedit.h>
87#include <qregexp.h> 87#include <qregexp.h>
88#include <qdir.h> 88#include <qdir.h>
89#include <qtextbrowser.h> 89#include <qtextbrowser.h>
90#include <qlabel.h> 90#include <qlabel.h>
91#include <qcombobox.h> 91#include <qcombobox.h>
92 92
93#include "krc2.h" 93#include "krc2.h"
94 94
95#include "wait.h" 95#include "wait.h"
96 96
97extern int DeskW, DeskH; 97extern int DeskW, DeskH;
98#ifdef DESKTOP 98#ifdef DESKTOP
99extern QApplication *appl; 99extern QApplication *appl;
100#else 100#else
101extern QPEApplication *appl; 101extern QPEApplication *appl;
102#endif 102#endif
103 103
104#ifdef JPATCH_HDE
105#define tr(arg) arg
106#endif
107
104 108
105#ifdef DESKTOP 109#ifdef DESKTOP
106#ifndef WIN32 110#ifndef WIN32
107const QString APP_KEY="/.zsafe/"; 111const QString APP_KEY="/.zsafe/";
108#else 112#else
109const QString APP_KEY=""; 113const QString APP_KEY="";
110#endif 114#endif
111#else 115#else
112const QString APP_KEY=""; 116const QString APP_KEY="";
113#endif 117#endif
114 118
115// include xmp images 119// include xmp images
116#include "pics/zsafe/copy.xpm" 120#include "pics/zsafe/copy.xpm"
117#include "pics/zsafe/cut.xpm" 121#include "pics/zsafe/cut.xpm"
118#include "pics/zsafe/edit.xpm" 122#include "pics/zsafe/edit.xpm"
119#include "pics/zsafe/editdelete.xpm" 123#include "pics/zsafe/editdelete.xpm"
120#include "pics/zsafe/find.xpm" 124#include "pics/zsafe/find.xpm"
121#include "pics/zsafe/folder_open.xpm" 125#include "pics/zsafe/folder_open.xpm"
122#include "pics/zsafe/help_icon.xpm" 126#include "pics/zsafe/help_icon.xpm"
123#include "pics/zsafe/new.xpm" 127#include "pics/zsafe/new.xpm"
124#include "pics/zsafe/paste.xpm" 128#include "pics/zsafe/paste.xpm"
125#include "pics/zsafe/quit_icon.xpm" 129#include "pics/zsafe/quit_icon.xpm"
126#include "pics/zsafe/save.xpm" 130#include "pics/zsafe/save.xpm"
127#include "pics/zsafe/trash.xpm" 131#include "pics/zsafe/trash.xpm"
@@ -476,65 +480,73 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
476 resize( DeskW, DeskH-30 ); 480 resize( DeskW, DeskH-30 );
477#endif 481#endif
478 482
479#endif 483#endif
480 // setCaption( tr( "ZSafe" ) ); 484 // setCaption( tr( "ZSafe" ) );
481 485
482 filename = conf->readEntry(APP_KEY+"document"); 486 filename = conf->readEntry(APP_KEY+"document");
483 if (filename.isEmpty() || filename.isNull()) 487 if (filename.isEmpty() || filename.isNull())
484 { 488 {
485 489
486 // check if the directory application exists, if not 490 // check if the directory application exists, if not
487 // create it 491 // create it
488// #ifndef WIN32 492// #ifndef WIN32
489 // QString d1("Documents/application"); 493 // QString d1("Documents/application");
490// #else 494// #else
491 QString d1(QDir::homeDirPath() + "/Documents/application"); 495 QString d1(QDir::homeDirPath() + "/Documents/application");
492// #endif 496// #endif
493 QDir pd1(d1); 497 QDir pd1(d1);
494 if (!pd1.exists()) 498 if (!pd1.exists())
495 { 499 {
496 QDir pd1("Documents"); 500 QDir pd1("Documents");
497 if (!pd1.mkdir("application", FALSE)) 501 if (!pd1.mkdir("application", FALSE))
498 { 502 {
499 QMessageBox::critical( 0, tr("ZSafe"), 503 QMessageBox::critical( 0, tr("ZSafe"),
504#ifdef JPATCH_HDE
505 tr("Can't create directory\n.../Documents/application\n\nZSafe will now exit."));
506#else
500 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1)); 507 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1));
508#endif
501 exitZs (1); 509 exitZs (1);
502 } 510 }
503 } 511 }
504// #ifndef WIN32 512// #ifndef WIN32
505 // QString d2("Documents/application/zsafe"); 513 // QString d2("Documents/application/zsafe");
506// #else 514// #else
507 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); 515 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
508// #endif 516// #endif
509 QDir pd2(d2); 517 QDir pd2(d2);
510 if (!pd2.exists()) 518 if (!pd2.exists())
511 { 519 {
512 QDir pd2("Documents/application"); 520 QDir pd2("Documents/application");
513 if (!pd2.mkdir("zsafe", FALSE)) 521 if (!pd2.mkdir("zsafe", FALSE))
514 { 522 {
515 QMessageBox::critical( 0, tr("ZSafe"), 523 QMessageBox::critical( 0, tr("ZSafe"),
524#ifdef JPATCH_HDE
525 tr("Can't create directory\n...//Documents/application/zsafe\n\nZSafe will now exit."));
526#else
516 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2)); 527 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2));
528#endif
517 exitZs (1); 529 exitZs (1);
518 } 530 }
519 } 531 }
520 532
521 533
522 // set the default filename 534 // set the default filename
523 filename=d2 + "/passwords.zsf"; 535 filename=d2 + "/passwords.zsf";
524 536
525 // save the current filename to the config file 537 // save the current filename to the config file
526 conf->writeEntry(APP_KEY+"document", filename); 538 conf->writeEntry(APP_KEY+"document", filename);
527 saveConf(); 539 saveConf();
528 } 540 }
529 541
530 //if (filename == "INVALIDPWD") 542 //if (filename == "INVALIDPWD")
531 //filename = ""; 543 //filename = "";
532 544
533 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 545 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
534#ifdef WIN32 546#ifdef WIN32
535 this->setCaption("Qt ZSafe: " + ti); 547 this->setCaption("Qt ZSafe: " + ti);
536#else 548#else
537 this->setCaption("ZSafe: " + ti); 549 this->setCaption("ZSafe: " + ti);
538#endif 550#endif
539 551
540 selectedItem = NULL; 552 selectedItem = NULL;
@@ -754,80 +766,63 @@ void ZSafe::editPwd()
754 // set the fields 766 // set the fields
755 dialog->NameField->setText(selectedItem->text (0)); 767 dialog->NameField->setText(selectedItem->text (0));
756 dialog->UsernameField->setText(selectedItem->text (1)); 768 dialog->UsernameField->setText(selectedItem->text (1));
757 dialog->PasswordField->setText(selectedItem->text (2)); 769 dialog->PasswordField->setText(selectedItem->text (2));
758 QString comment = selectedItem->text (3); 770 QString comment = selectedItem->text (3);
759 comment.replace (QRegExp("<br>"), "\n"); 771 comment.replace (QRegExp("<br>"), "\n");
760 dialog->Field5->setText(selectedItem->text (4)); 772 dialog->Field5->setText(selectedItem->text (4));
761 dialog->Field6->setText(selectedItem->text (5)); 773 dialog->Field6->setText(selectedItem->text (5));
762 dialog->CommentField->insertLine(comment); 774 dialog->CommentField->insertLine(comment);
763 dialog->CommentField->setCursorPosition(0,0); 775 dialog->CommentField->setCursorPosition(0,0);
764#ifdef DESKTOP 776#ifdef DESKTOP
765#ifndef WIN32 777#ifndef WIN32
766 dialog->show(); 778 dialog->show();
767#endif 779#endif
768#else 780#else
769 dialog->showMaximized(); 781 dialog->showMaximized();
770#endif 782#endif
771 DialogCode result = (DialogCode) dialog->exec(); 783 DialogCode result = (DialogCode) dialog->exec();
772 784
773#ifdef DESKTOP 785#ifdef DESKTOP
774 result = Accepted; 786 result = Accepted;
775#endif 787#endif
776 if (result == Accepted) 788 if (result == Accepted)
777 { 789 {
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
794 modified = true; 790 modified = true;
795 // edit the selected item 791 // edit the selected item
796 QString name = dialog->NameField->text(); 792 QString name = dialog->NameField->text();
797 selectedItem->setText (0, tr (name)); 793 selectedItem->setText (0, tr (name));
798 QString user = dialog->UsernameField->text(); 794 QString user = dialog->UsernameField->text();
799 selectedItem->setText (1, tr (user)); 795 selectedItem->setText (1, tr (user));
800 QString pwd = dialog->PasswordField->text(); 796 QString pwd = dialog->PasswordField->text();
801 selectedItem->setText (2, tr (pwd)); 797 selectedItem->setText (2, tr (pwd));
802 QString comment = dialog->CommentField->text(); 798 QString comment = dialog->CommentField->text();
803 comment.replace (QRegExp("\n"), "<br>"); 799 comment.replace (QRegExp("\n"), "<br>");
804 selectedItem->setText (3, tr (comment)); 800 selectedItem->setText (3, tr (comment));
805 QString f5 = dialog->Field5->text(); 801 QString f5 = dialog->Field5->text();
806 selectedItem->setText (4, tr (f5)); 802 selectedItem->setText (4, tr (f5));
807 QString f6 = dialog->Field6->text(); 803 QString f6 = dialog->Field6->text();
808 selectedItem->setText (5, tr (f6)); 804 selectedItem->setText (5, tr (f6));
809#endif
810 } 805 }
811 806
812 delete dialog; 807 delete dialog;
813 } 808 }
814 else 809 else
815 { 810 {
816 editCategory(); 811 editCategory();
817 } 812 }
818} 813}
819 814
820void ZSafe::newPwd() 815void ZSafe::newPwd()
821{ 816{
822 if (!selectedItem) 817 if (!selectedItem)
823 return; 818 return;
824 819
825 if (!isCategory(selectedItem)) 820 if (!isCategory(selectedItem))
826 selectedItem = selectedItem->parent(); 821 selectedItem = selectedItem->parent();
827 822
828 if (isCategory(selectedItem)) 823 if (isCategory(selectedItem))
829 { 824 {
830 QString cat = selectedItem->text(0); 825 QString cat = selectedItem->text(0);
831 826
832 // open the 'New Entry' dialog 827 // open the 'New Entry' dialog
833 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); 828 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE);
@@ -850,75 +845,60 @@ retype:
850#else 845#else
851 dialog->showMaximized(); 846 dialog->showMaximized();
852#endif 847#endif
853 DialogCode result = (DialogCode) dialog->exec(); 848 DialogCode result = (DialogCode) dialog->exec();
854#ifdef DESKTOP 849#ifdef DESKTOP
855 result = Accepted; 850 result = Accepted;
856#endif 851#endif
857 852
858 if (result == Accepted) 853 if (result == Accepted)
859 { 854 {
860 855
861 QString name = dialog->NameField->text(); 856 QString name = dialog->NameField->text();
862 if (cat == name) 857 if (cat == name)
863 { 858 {
864 QMessageBox::critical( 0, tr("ZSafe"), 859 QMessageBox::critical( 0, tr("ZSafe"),
865 tr("Entry name must be different\nfrom the category name.") ); 860 tr("Entry name must be different\nfrom the category name.") );
866 goto retype; // it's not a good programming style :-) 861 goto retype; // it's not a good programming style :-)
867 } 862 }
868 863
869 modified = true; 864 modified = true;
870 // add the new item 865 // add the new item
871 QListViewItem *i = new ShadedListItem (0, selectedItem); 866 QListViewItem *i = new ShadedListItem (0, selectedItem);
872 i->setOpen (TRUE); 867 i->setOpen (TRUE);
873 868
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
888 i->setText (0, tr (name)); 869 i->setText (0, tr (name));
889 QString user = dialog->UsernameField->text(); 870 QString user = dialog->UsernameField->text();
890 i->setText (1, tr (user)); 871 i->setText (1, tr (user));
891 QString pwd = dialog->PasswordField->text(); 872 QString pwd = dialog->PasswordField->text();
892 i->setText (2, tr (pwd)); 873 i->setText (2, tr (pwd));
893 QString comment = dialog->CommentField->text(); 874 QString comment = dialog->CommentField->text();
894 comment.replace (QRegExp("\n"), "<br>"); 875 comment.replace (QRegExp("\n"), "<br>");
895 i->setText (3, tr (comment)); 876 i->setText (3, tr (comment));
896 QString f5 = dialog->Field5->text(); 877 QString f5 = dialog->Field5->text();
897 i->setText (4, tr (f5)); 878 i->setText (4, tr (f5));
898 QString f6 = dialog->Field6->text(); 879 QString f6 = dialog->Field6->text();
899 i->setText (5, tr (f6)); 880 i->setText (5, tr (f6));
900#endif
901 } 881 }
902 882
903 delete dialog; 883 delete dialog;
904 } 884 }
905} 885}
906 886
907void ZSafe::findPwd() 887void ZSafe::findPwd()
908{ 888{
909 889
910 // open the 'Search' dialog 890 // open the 'Search' dialog
911 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); 891 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
912#ifdef WIN32 892#ifdef WIN32
913 dialog->setCaption ("Qt " + tr("Search")); 893 dialog->setCaption ("Qt " + tr("Search"));
914#endif 894#endif
915 895
916#ifdef DESKTOP 896#ifdef DESKTOP
917#endif 897#endif
918 if (lastSearchedName) 898 if (lastSearchedName)
919 dialog->NameField->setText(lastSearchedName); 899 dialog->NameField->setText(lastSearchedName);
920 else 900 else
921 dialog->NameField->setText(""); 901 dialog->NameField->setText("");
922 if (lastSearchedUsername) 902 if (lastSearchedUsername)
923 dialog->UsernameField->setText(lastSearchedUsername); 903 dialog->UsernameField->setText(lastSearchedUsername);
924 else 904 else
@@ -1524,86 +1504,69 @@ void ZSafe::readAllEntries()
1524 comment.truncate(comment.length() -1); 1504 comment.truncate(comment.length() -1);
1525 break; 1505 break;
1526 case 4: 1506 case 4:
1527 // field5 1507 // field5
1528 field5 = QString::fromUtf8(&i[1]); 1508 field5 = QString::fromUtf8(&i[1]);
1529 field5.truncate(field5.length() -1); 1509 field5.truncate(field5.length() -1);
1530 break; 1510 break;
1531 case 5: 1511 case 5:
1532 // field6 1512 // field6
1533 field6 = QString::fromUtf8(&i[1]); 1513 field6 = QString::fromUtf8(&i[1]);
1534 field6.truncate(field6.length() -1); 1514 field6.truncate(field6.length() -1);
1535 break; 1515 break;
1536 } 1516 }
1537 idx++; 1517 idx++;
1538 } 1518 }
1539 1519
1540 Category *cat= categories.find (category); 1520 Category *cat= categories.find (category);
1541 if (cat) 1521 if (cat)
1542 { 1522 {
1543 // use the existend item 1523 // use the existend item
1544 QListViewItem *catItem = cat->getListItem(); 1524 QListViewItem *catItem = cat->getListItem();
1545 if (catItem) 1525 if (catItem)
1546 { 1526 {
1547 QListViewItem * item = new ShadedListItem( 0, catItem ); 1527 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
1556 item->setText( 0, tr( name ) ); 1528 item->setText( 0, tr( name ) );
1557 item->setText( 1, tr( user ) ); 1529 item->setText( 1, tr( user ) );
1558 item->setText( 2, tr( password ) ); 1530 item->setText( 2, tr( password ) );
1559 item->setText( 3, tr( comment ) ); 1531 item->setText( 3, tr( comment ) );
1560 item->setText( 4, tr( field5 ) ); 1532 item->setText( 4, tr( field5 ) );
1561 item->setText( 5, tr( field6 ) ); 1533 item->setText( 5, tr( field6 ) );
1562 catItem->setOpen( TRUE ); 1534 catItem->setOpen( TRUE );
1563#endif
1564 } 1535 }
1565 } 1536 }
1566 else 1537 else
1567 { 1538 {
1568 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1539 QListViewItem *catI = new ShadedListItem( 1, ListView );
1569 // create and insert a new item 1540 // create and insert a new item
1570 QListViewItem * item = new ShadedListItem( 0, catI ); 1541 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
1579 item->setText( 0, tr( name ) ); 1542 item->setText( 0, tr( name ) );
1580 item->setText( 1, tr( user ) ); 1543 item->setText( 1, tr( user ) );
1581 item->setText( 2, tr( password ) ); 1544 item->setText( 2, tr( password ) );
1582 item->setText( 3, tr( comment ) ); 1545 item->setText( 3, tr( comment ) );
1583 item->setText( 4, tr( field5 ) ); 1546 item->setText( 4, tr( field5 ) );
1584 item->setText( 5, tr( field6 ) ); 1547 item->setText( 5, tr( field6 ) );
1585#endif 1548
1586 catI->setOpen( TRUE ); 1549 catI->setOpen( TRUE );
1587 1550
1588 Category *c1 = new Category(); 1551 Category *c1 = new Category();
1589 c1->setCategoryName(category); 1552 c1->setCategoryName(category);
1590 1553
1591 QString icon; 1554 QString icon;
1592 QString fullIconPath; 1555 QString fullIconPath;
1593 QPixmap *pix; 1556 QPixmap *pix;
1594// #ifndef WIN32 1557// #ifndef WIN32
1595 icon = conf->readEntry(APP_KEY+category); 1558 icon = conf->readEntry(APP_KEY+category);
1596// #endif 1559// #endif
1597 bool isIconAv = false; 1560 bool isIconAv = false;
1598 if (!icon.isEmpty() && !icon.isNull()) 1561 if (!icon.isEmpty() && !icon.isNull())
1599 { 1562 {
1600 // build the full path 1563 // build the full path
1601 fullIconPath = iconPath + icon; 1564 fullIconPath = iconPath + icon;
1602 pix = new QPixmap (fullIconPath); 1565 pix = new QPixmap (fullIconPath);
1603 if (pix) 1566 if (pix)
1604 { 1567 {
1605 QImage img = pix->convertToImage(); 1568 QImage img = pix->convertToImage();
1606 pix->convertFromImage(img.smoothScale(14,14)); 1569 pix->convertFromImage(img.smoothScale(14,14));
1607 c1->setIconName (icon); 1570 c1->setIconName (icon);
1608 c1->setIcon (*pix); 1571 c1->setIcon (*pix);
1609 isIconAv = true; 1572 isIconAv = true;
@@ -1761,78 +1724,66 @@ void ZSafe::readAllEntries()
1761 user.truncate(user.length() -1); 1724 user.truncate(user.length() -1);
1762 break; 1725 break;
1763 case 2: 1726 case 2:
1764 // password 1727 // password
1765 password = &i[1]; 1728 password = &i[1];
1766 password.truncate(password.length() -1); 1729 password.truncate(password.length() -1);
1767 break; 1730 break;
1768 case 3: 1731 case 3:
1769 // comment 1732 // comment
1770 comment = &i[1]; 1733 comment = &i[1];
1771 comment.truncate(comment.length() -1); 1734 comment.truncate(comment.length() -1);
1772 break; 1735 break;
1773 } 1736 }
1774 idx++; 1737 idx++;
1775 } 1738 }
1776 1739
1777 Category *cat= categories.find (category); 1740 Category *cat= categories.find (category);
1778 if (cat) 1741 if (cat)
1779 { 1742 {
1780 // use the existend item 1743 // use the existend item
1781 QListViewItem *catItem = cat->getListItem(); 1744 QListViewItem *catItem = cat->getListItem();
1782 if (catItem) 1745 if (catItem)
1783 { 1746 {
1784 QListViewItem * item = new ShadedListItem( 0, catItem ); 1747 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
1791 item->setText( 0, tr( name ) ); 1748 item->setText( 0, tr( name ) );
1792 item->setText( 1, tr( user ) ); 1749 item->setText( 1, tr( user ) );
1793 item->setText( 2, tr( password ) ); 1750 item->setText( 2, tr( password ) );
1794 item->setText( 3, tr( comment ) ); 1751 item->setText( 3, tr( comment ) );
1795#endif 1752
1796 catItem->setOpen( TRUE ); 1753 catItem->setOpen( TRUE );
1797 } 1754 }
1798 } 1755 }
1799 else 1756 else
1800 { 1757 {
1801 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1758 QListViewItem *catI = new ShadedListItem( 1, ListView );
1802 // create and insert a new item 1759 // create and insert a new item
1803 QListViewItem * item = new ShadedListItem( 0, catI ); 1760 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
1810 item->setText( 0, tr( name ) ); 1761 item->setText( 0, tr( name ) );
1811 item->setText( 1, tr( user ) ); 1762 item->setText( 1, tr( user ) );
1812 item->setText( 2, tr( password ) ); 1763 item->setText( 2, tr( password ) );
1813 item->setText( 3, tr( comment ) ); 1764 item->setText( 3, tr( comment ) );
1814#endif 1765
1815 catI->setOpen( TRUE ); 1766 catI->setOpen( TRUE );
1816 1767
1817 Category *c1 = new Category(); 1768 Category *c1 = new Category();
1818 c1->setCategoryName(category); 1769 c1->setCategoryName(category);
1819 1770
1820 QString icon; 1771 QString icon;
1821 QString fullIconPath; 1772 QString fullIconPath;
1822 QPixmap *pix; 1773 QPixmap *pix;
1823// #ifndef WIN32 1774// #ifndef WIN32
1824 icon = conf->readEntry(APP_KEY+category); 1775 icon = conf->readEntry(APP_KEY+category);
1825// #endif 1776// #endif
1826 bool isIconAv = false; 1777 bool isIconAv = false;
1827 if (!icon.isEmpty() && !icon.isNull()) 1778 if (!icon.isEmpty() && !icon.isNull())
1828 { 1779 {
1829 // build the full path 1780 // build the full path
1830 fullIconPath = iconPath + icon; 1781 fullIconPath = iconPath + icon;
1831 pix = new QPixmap (fullIconPath); 1782 pix = new QPixmap (fullIconPath);
1832 if (pix) 1783 if (pix)
1833 { 1784 {
1834 QImage img = pix->convertToImage(); 1785 QImage img = pix->convertToImage();
1835 pix->convertFromImage(img.smoothScale(14,14)); 1786 pix->convertFromImage(img.smoothScale(14,14));
1836 c1->setIconName (icon); 1787 c1->setIconName (icon);
1837 c1->setIcon (*pix); 1788 c1->setIcon (*pix);
1838 isIconAv = true; 1789 isIconAv = true;
@@ -1988,88 +1939,73 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1988 1939
1989 1940
1990 retval = loadEntry(entry); 1941 retval = loadEntry(entry);
1991 1942
1992 int numberOfEntries=0; 1943 int numberOfEntries=0;
1993 while (retval == 1) { 1944 while (retval == 1) {
1994 1945
1995 QString category( QString::fromUtf8(entry[0]) ); 1946 QString category( QString::fromUtf8(entry[0]) );
1996 QString name( QString::fromUtf8(entry[1]) ); 1947 QString name( QString::fromUtf8(entry[1]) );
1997 QString user( QString::fromUtf8(entry[2]) ); 1948 QString user( QString::fromUtf8(entry[2]) );
1998 QString password( QString::fromUtf8(entry[3]) ); 1949 QString password( QString::fromUtf8(entry[3]) );
1999 QString comment( QString::fromUtf8(entry[4]) ); 1950 QString comment( QString::fromUtf8(entry[4]) );
2000 QString field5( QString::fromUtf8(entry[5]) ); 1951 QString field5( QString::fromUtf8(entry[5]) );
2001 QString field6( QString::fromUtf8(entry[6]) ); 1952 QString field6( QString::fromUtf8(entry[6]) );
2002 // add the subitems to the categories 1953 // add the subitems to the categories
2003 1954
2004 Category *cat= categories.find (category); 1955 Category *cat= categories.find (category);
2005 if (cat) 1956 if (cat)
2006 { 1957 {
2007 // use the existend item 1958 // use the existend item
2008 QListViewItem *catItem = cat->getListItem(); 1959 QListViewItem *catItem = cat->getListItem();
2009 if (catItem) 1960 if (catItem)
2010 { 1961 {
2011 QListViewItem * item = new ShadedListItem( 0, catItem ); 1962 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
2020 item->setText( 0, tr( name ) ); 1963 item->setText( 0, tr( name ) );
2021 item->setText( 1, tr( user ) ); 1964 item->setText( 1, tr( user ) );
2022 item->setText( 2, tr( password ) ); 1965 item->setText( 2, tr( password ) );
2023 item->setText( 3, tr( comment ) ); 1966 item->setText( 3, tr( comment ) );
2024 item->setText( 4, tr( field5 ) ); 1967 item->setText( 4, tr( field5 ) );
2025 item->setText( 5, tr( field6 ) ); 1968 item->setText( 5, tr( field6 ) );
2026#endif 1969
2027 if (expandTree) 1970 if (expandTree)
2028 catItem->setOpen( TRUE ); 1971 catItem->setOpen( TRUE );
2029 numberOfEntries++; 1972 numberOfEntries++;
2030 } 1973 }
2031 } 1974 }
2032 else 1975 else
2033 { 1976 {
2034 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1977 QListViewItem *catI = new ShadedListItem( 1, ListView );
2035 // create and insert a new item 1978 // create and insert a new item
2036 QListViewItem * item = new ShadedListItem( 0, catI ); 1979 QListViewItem * item = new ShadedListItem( 0, catI );
2037#ifdef JPATCH_HDE 1980
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
2045 item->setText( 0, tr( name ) ); 1981 item->setText( 0, tr( name ) );
2046 item->setText( 1, tr( user ) ); 1982 item->setText( 1, tr( user ) );
2047 item->setText( 2, tr( password ) ); 1983 item->setText( 2, tr( password ) );
2048 item->setText( 3, tr( comment ) ); 1984 item->setText( 3, tr( comment ) );
2049 item->setText( 4, tr( field5 ) ); 1985 item->setText( 4, tr( field5 ) );
2050 item->setText( 5, tr( field6 ) ); 1986 item->setText( 5, tr( field6 ) );
2051#endif 1987
2052 if (expandTree) 1988 if (expandTree)
2053 catI->setOpen( TRUE ); 1989 catI->setOpen( TRUE );
2054 1990
2055 Category *c1 = new Category(); 1991 Category *c1 = new Category();
2056 c1->setCategoryName(category); 1992 c1->setCategoryName(category);
2057 1993
2058 QString icon; 1994 QString icon;
2059 QString fullIconPath; 1995 QString fullIconPath;
2060 QPixmap *pix; 1996 QPixmap *pix;
2061// #ifndef WIN32 1997// #ifndef WIN32
2062 icon = conf->readEntry(APP_KEY+category); 1998 icon = conf->readEntry(APP_KEY+category);
2063// #endif 1999// #endif
2064 bool isIconAv = false; 2000 bool isIconAv = false;
2065 if (!icon.isEmpty() && !icon.isNull()) 2001 if (!icon.isEmpty() && !icon.isNull())
2066 { 2002 {
2067 // build the full path 2003 // build the full path
2068 fullIconPath = iconPath + icon; 2004 fullIconPath = iconPath + icon;
2069 pix = new QPixmap (fullIconPath); 2005 pix = new QPixmap (fullIconPath);
2070 if (pix) 2006 if (pix)
2071 { 2007 {
2072 QImage img = pix->convertToImage(); 2008 QImage img = pix->convertToImage();
2073 pix->convertFromImage(img.smoothScale(14,14)); 2009 pix->convertFromImage(img.smoothScale(14,14));
2074 c1->setIconName (icon); 2010 c1->setIconName (icon);
2075 c1->setIcon (*pix); 2011 c1->setIcon (*pix);
@@ -3282,55 +3218,51 @@ void ZSafe::editCategory()
3282// #ifndef WIN32 3218// #ifndef WIN32
3283 conf->writeEntry(APP_KEY+category, icon); 3219 conf->writeEntry(APP_KEY+category, icon);
3284// #endif 3220// #endif
3285 saveConf(); 3221 saveConf();
3286 QImage img = pix->convertToImage(); 3222 QImage img = pix->convertToImage();
3287 pix->convertFromImage(img.smoothScale(14,14)); 3223 pix->convertFromImage(img.smoothScale(14,14));
3288 cat->setIconName (icon); 3224 cat->setIconName (icon);
3289 cat->setIcon (*pix); 3225 cat->setIcon (*pix);
3290 } 3226 }
3291 } 3227 }
3292 else 3228 else
3293 { 3229 {
3294// #ifndef WIN32 3230// #ifndef WIN32
3295 conf->removeEntry (category); 3231 conf->removeEntry (category);
3296// #endif 3232// #endif
3297 saveConf(); 3233 saveConf();
3298 cat->setIcon (*getPredefinedIcon(category)); 3234 cat->setIcon (*getPredefinedIcon(category));
3299 } 3235 }
3300 3236
3301 // change the category name of the selected category 3237 // change the category name of the selected category
3302 QListViewItem *catItem = cat->getListItem(); 3238 QListViewItem *catItem = cat->getListItem();
3303 if (catItem) 3239 if (catItem)
3304 { 3240 {
3305 qWarning (category); 3241 qWarning (category);
3306#ifdef JPATCH_HDE
3307 catItem->setText( 0, category );
3308 cat->setCategoryName (category);
3309#else
3310 catItem->setText( 0, tr( category ) ); 3242 catItem->setText( 0, tr( category ) );
3311 cat->setCategoryName (tr(category)); 3243 cat->setCategoryName (tr(category));
3312#endif 3244
3313 cat->initListItem(); 3245 cat->initListItem();
3314 categories.insert (category, cat); 3246 categories.insert (category, cat);
3315 } 3247 }
3316 } 3248 }
3317 saveCategoryDialogFields(dialog); 3249 saveCategoryDialogFields(dialog);
3318 } 3250 }
3319 else 3251 else
3320 { 3252 {
3321 // delete dialog; 3253 // delete dialog;
3322 dialog->hide(); 3254 dialog->hide();
3323 return; 3255 return;
3324 } 3256 }
3325 3257
3326 } 3258 }
3327} 3259}
3328 3260
3329void ZSafe::cutItem() 3261void ZSafe::cutItem()
3330{ 3262{
3331 if (!selectedItem) 3263 if (!selectedItem)
3332 return; 3264 return;
3333 if (!isCategory(selectedItem)) 3265 if (!isCategory(selectedItem))
3334 { 3266 {
3335 IsCut = true; 3267 IsCut = true;
3336 copiedItem = selectedItem; 3268 copiedItem = selectedItem;