-rw-r--r-- | noncore/apps/zsafe/categorylist.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/zsafe/categorylist.h | 6 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 201 |
3 files changed, 171 insertions, 42 deletions
diff --git a/noncore/apps/zsafe/categorylist.cpp b/noncore/apps/zsafe/categorylist.cpp index 2fa59d2..c5e8d66 100644 --- a/noncore/apps/zsafe/categorylist.cpp +++ b/noncore/apps/zsafe/categorylist.cpp | |||
@@ -9,27 +9,27 @@ CategoryList::CategoryList() | |||
9 | } | 9 | } |
10 | 10 | ||
11 | CategoryList::~CategoryList() | 11 | CategoryList::~CategoryList() |
12 | { | 12 | { |
13 | } | 13 | } |
14 | 14 | ||
15 | void CategoryList::insert (QString key, Category *category) | 15 | void CategoryList::insert (QString key, Category *category) |
16 | { | 16 | { |
17 | categoryList.insert ((const char *) key, category); | 17 | categoryList.insert (key, category); |
18 | } | 18 | } |
19 | 19 | ||
20 | Category *CategoryList::find (QString key) | 20 | Category *CategoryList::find (QString key) |
21 | { | 21 | { |
22 | return categoryList.find ((const char *) key); | 22 | return categoryList.find (key); |
23 | } | 23 | } |
24 | 24 | ||
25 | void CategoryList::remove (QString key) | 25 | void CategoryList::remove (QString key) |
26 | { | 26 | { |
27 | categoryList.remove ((const char *) key); | 27 | categoryList.remove (key); |
28 | } | 28 | } |
29 | 29 | ||
30 | void CategoryList::clear() | 30 | void CategoryList::clear() |
31 | { | 31 | { |
32 | categoryList.clear(); | 32 | categoryList.clear(); |
33 | } | 33 | } |
34 | 34 | ||
35 | 35 | ||
diff --git a/noncore/apps/zsafe/categorylist.h b/noncore/apps/zsafe/categorylist.h index 96cf389..fc1c0a2 100644 --- a/noncore/apps/zsafe/categorylist.h +++ b/noncore/apps/zsafe/categorylist.h | |||
@@ -1,32 +1,34 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id$ | 2 | ** $Id$ |
3 | */ | 3 | */ |
4 | #ifndef _CATEGORY_LIST_H_ | 4 | #ifndef _CATEGORY_LIST_H_ |
5 | #define _CATEGORY_LIST_H_ | 5 | #define _CATEGORY_LIST_H_ |
6 | 6 | ||
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qasciidict.h> | 8 | |
9 | #include <qdict.h> | ||
10 | |||
9 | #include "category.h" | 11 | #include "category.h" |
10 | 12 | ||
11 | // list of Category | 13 | // list of Category |
12 | 14 | ||
13 | class CategoryList | 15 | class CategoryList |
14 | { | 16 | { |
15 | public: | 17 | public: |
16 | CategoryList(); | 18 | CategoryList(); |
17 | ~CategoryList(); | 19 | ~CategoryList(); |
18 | 20 | ||
19 | void insert (QString key, Category *category); | 21 | void insert (QString key, Category *category); |
20 | Category *find (QString key); | 22 | Category *find (QString key); |
21 | void remove (QString key); | 23 | void remove (QString key); |
22 | void clear(); | 24 | void clear(); |
23 | 25 | ||
24 | QAsciiDict<Category> categoryList; | 26 | QDict<Category> categoryList; |
25 | 27 | ||
26 | private: | 28 | private: |
27 | 29 | ||
28 | }; | 30 | }; |
29 | #endif // _CATEGORY_LIST_H_ | 31 | #endif // _CATEGORY_LIST_H_ |
30 | 32 | ||
31 | 33 | ||
32 | 34 | ||
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 9341425..d55624b 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -9,16 +9,18 @@ | |||
9 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html | 9 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html |
10 | ** | 10 | ** |
11 | ** Compile Flags: | 11 | ** Compile Flags: |
12 | ** Zaurus arm : -DNO_OPIE | 12 | ** Zaurus arm : -DNO_OPIE |
13 | ** Zaurus Opie arm: none | 13 | ** Zaurus Opie arm: none |
14 | ** Linux Desktop : -DDESKTOP | 14 | ** Linux Desktop : -DDESKTOP |
15 | ** Windows Desktop: -DDESKTOP -DWIN32 | 15 | ** Windows Desktop: -DDESKTOP -DWIN32 |
16 | ** | 16 | ** |
17 | ** for japanese version additional use: -DJPATCH_HDE | ||
18 | ** | ||
17 | ****************************************************************************/ | 19 | ****************************************************************************/ |
18 | #include "zsafe.h" | 20 | #include "zsafe.h" |
19 | #include "newdialog.h" | 21 | #include "newdialog.h" |
20 | #include "searchdialog.h" | 22 | #include "searchdialog.h" |
21 | #include "categorydialog.h" | 23 | #include "categorydialog.h" |
22 | #include "passworddialog.h" | 24 | #include "passworddialog.h" |
23 | #include "infoform.h" | 25 | #include "infoform.h" |
24 | #include "zlistview.h" | 26 | #include "zlistview.h" |
@@ -449,23 +451,36 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
449 | setName( "ZSafe" ); | 451 | setName( "ZSafe" ); |
450 | 452 | ||
451 | #ifdef DESKTOP | 453 | #ifdef DESKTOP |
452 | #ifdef WIN32 | 454 | #ifdef WIN32 |
453 | setGeometry(100, 150, DeskW, DeskH-30 ); | 455 | setGeometry(100, 150, DeskW, DeskH-30 ); |
454 | #else | 456 | #else |
455 | resize( DeskW, DeskH-30 ); | 457 | resize( DeskW, DeskH-30 ); |
456 | #endif | 458 | #endif |
457 | // setMinimumSize( QSize( DeskW, DeskH-30 ) ); | 459 | |
458 | // setMaximumSize( QSize( DeskW, DeskH-30 ) ); | ||
459 | #else | 460 | #else |
460 | resize( DeskW, DeskH-30 ); | 461 | |
461 | // setMinimumSize( QSize( DeskW, DeskH-30 ) ); | 462 | #ifdef JPATCH_HDE |
462 | // setMaximumSize( QSize( 440, 290 ) ); | 463 | int DeskS; |
463 | // setMaximumSize( QSize( DeskW+400, DeskH+200 ) ); | 464 | if(DeskW > DeskH) |
465 | { | ||
466 | DeskS = DeskW; | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | DeskS = DeskH; | ||
471 | } | ||
472 | resize( DeskW, DeskH ); | ||
473 | setMinimumSize( QSize( DeskS, DeskS ) ); | ||
474 | setMaximumSize( QSize( DeskS, DeskS ) ); | ||
475 | #else | ||
476 | resize( DeskW, DeskH-30 ); | ||
477 | #endif | ||
478 | |||
464 | #endif | 479 | #endif |
465 | // setCaption( tr( "ZSafe" ) ); | 480 | // setCaption( tr( "ZSafe" ) ); |
466 | 481 | ||
467 | filename = conf->readEntry(APP_KEY+"document"); | 482 | filename = conf->readEntry(APP_KEY+"document"); |
468 | if (filename.isEmpty() || filename.isNull()) | 483 | if (filename.isEmpty() || filename.isNull()) |
469 | { | 484 | { |
470 | 485 | ||
471 | // check if the directory application exists, if not | 486 | // check if the directory application exists, if not |
@@ -755,31 +770,48 @@ void ZSafe::editPwd() | |||
755 | #endif | 770 | #endif |
756 | DialogCode result = (DialogCode) dialog->exec(); | 771 | DialogCode result = (DialogCode) dialog->exec(); |
757 | 772 | ||
758 | #ifdef DESKTOP | 773 | #ifdef DESKTOP |
759 | result = Accepted; | 774 | result = Accepted; |
760 | #endif | 775 | #endif |
761 | if (result == Accepted) | 776 | if (result == Accepted) |
762 | { | 777 | { |
778 | #ifdef JPATCH_HDE | ||
779 | // edit the selected item | ||
780 | QString name = dialog->NameField->text(); | ||
781 | selectedItem->setText (0, name); | ||
782 | QString user = dialog->UsernameField->text(); | ||
783 | selectedItem->setText (1, user); | ||
784 | QString pwd = dialog->PasswordField->text(); | ||
785 | selectedItem->setText (2, pwd); | ||
786 | QString comment = dialog->CommentField->text(); | ||
787 | comment.replace (QRegExp("\n"), "<br>"); | ||
788 | selectedItem->setText (3, comment); | ||
789 | QString f5 = dialog->Field5->text(); | ||
790 | selectedItem->setText (4, f5); | ||
791 | QString f6 = dialog->Field6->text(); | ||
792 | selectedItem->setText (5, f6); | ||
793 | #else | ||
763 | modified = true; | 794 | modified = true; |
764 | // edit the selected item | 795 | // edit the selected item |
765 | QString name = dialog->NameField->text(); | 796 | QString name = dialog->NameField->text(); |
766 | selectedItem->setText (0, tr (name)); | 797 | selectedItem->setText (0, tr (name)); |
767 | QString user = dialog->UsernameField->text(); | 798 | QString user = dialog->UsernameField->text(); |
768 | selectedItem->setText (1, tr (user)); | 799 | selectedItem->setText (1, tr (user)); |
769 | QString pwd = dialog->PasswordField->text(); | 800 | QString pwd = dialog->PasswordField->text(); |
770 | selectedItem->setText (2, tr (pwd)); | 801 | selectedItem->setText (2, tr (pwd)); |
771 | QString comment = dialog->CommentField->text(); | 802 | QString comment = dialog->CommentField->text(); |
772 | comment.replace (QRegExp("\n"), "<br>"); | 803 | comment.replace (QRegExp("\n"), "<br>"); |
773 | selectedItem->setText (3, tr (comment)); | 804 | selectedItem->setText (3, tr (comment)); |
774 | QString f5 = dialog->Field5->text(); | 805 | QString f5 = dialog->Field5->text(); |
775 | selectedItem->setText (4, tr (f5)); | 806 | selectedItem->setText (4, tr (f5)); |
776 | QString f6 = dialog->Field6->text(); | 807 | QString f6 = dialog->Field6->text(); |
777 | selectedItem->setText (5, tr (f6)); | 808 | selectedItem->setText (5, tr (f6)); |
809 | #endif | ||
778 | } | 810 | } |
779 | 811 | ||
780 | delete dialog; | 812 | delete dialog; |
781 | } | 813 | } |
782 | else | 814 | else |
783 | { | 815 | { |
784 | editCategory(); | 816 | editCategory(); |
785 | } | 817 | } |
@@ -834,28 +866,43 @@ retype: | |||
834 | goto retype; // it's not a good programming style :-) | 866 | goto retype; // it's not a good programming style :-) |
835 | } | 867 | } |
836 | 868 | ||
837 | modified = true; | 869 | modified = true; |
838 | // add the new item | 870 | // add the new item |
839 | QListViewItem *i = new ShadedListItem (0, selectedItem); | 871 | QListViewItem *i = new ShadedListItem (0, selectedItem); |
840 | i->setOpen (TRUE); | 872 | i->setOpen (TRUE); |
841 | 873 | ||
874 | #ifdef JPATCH_HDE | ||
875 | i->setText (0, name); | ||
876 | QString user = dialog->UsernameField->text(); | ||
877 | i->setText (1, user); | ||
878 | QString pwd = dialog->PasswordField->text(); | ||
879 | i->setText (2, pwd); | ||
880 | QString comment = dialog->CommentField->text(); | ||
881 | comment.replace (QRegExp("\n"), "<br>"); | ||
882 | i->setText (3, comment); | ||
883 | QString f5 = dialog->Field5->text(); | ||
884 | i->setText (4, f5); | ||
885 | QString f6 = dialog->Field6->text(); | ||
886 | i->setText (5, f6); | ||
887 | #else | ||
842 | i->setText (0, tr (name)); | 888 | i->setText (0, tr (name)); |
843 | QString user = dialog->UsernameField->text(); | 889 | QString user = dialog->UsernameField->text(); |
844 | i->setText (1, tr (user)); | 890 | i->setText (1, tr (user)); |
845 | QString pwd = dialog->PasswordField->text(); | 891 | QString pwd = dialog->PasswordField->text(); |
846 | i->setText (2, tr (pwd)); | 892 | i->setText (2, tr (pwd)); |
847 | QString comment = dialog->CommentField->text(); | 893 | QString comment = dialog->CommentField->text(); |
848 | comment.replace (QRegExp("\n"), "<br>"); | 894 | comment.replace (QRegExp("\n"), "<br>"); |
849 | i->setText (3, tr (comment)); | 895 | i->setText (3, tr (comment)); |
850 | QString f5 = dialog->Field5->text(); | 896 | QString f5 = dialog->Field5->text(); |
851 | i->setText (4, tr (f5)); | 897 | i->setText (4, tr (f5)); |
852 | QString f6 = dialog->Field6->text(); | 898 | QString f6 = dialog->Field6->text(); |
853 | i->setText (5, tr (f6)); | 899 | i->setText (5, tr (f6)); |
900 | #endif | ||
854 | } | 901 | } |
855 | 902 | ||
856 | delete dialog; | 903 | delete dialog; |
857 | } | 904 | } |
858 | } | 905 | } |
859 | 906 | ||
860 | void ZSafe::findPwd() | 907 | void ZSafe::findPwd() |
861 | { | 908 | { |
@@ -1199,17 +1246,17 @@ void ZSafe::listViewSelected( QListViewItem *_item) | |||
1199 | } | 1246 | } |
1200 | 1247 | ||
1201 | bool ZSafe::isCategory(QListViewItem *_item) | 1248 | bool ZSafe::isCategory(QListViewItem *_item) |
1202 | { | 1249 | { |
1203 | if (_item == NULL) | 1250 | if (_item == NULL) |
1204 | return FALSE; | 1251 | return FALSE; |
1205 | 1252 | ||
1206 | QString categoryName = _item->text (0); | 1253 | QString categoryName = _item->text (0); |
1207 | if (categories.find ((const char *)categoryName)) | 1254 | if (categories.find (categoryName)) |
1208 | return TRUE; | 1255 | return TRUE; |
1209 | else | 1256 | else |
1210 | return FALSE; | 1257 | return FALSE; |
1211 | } | 1258 | } |
1212 | 1259 | ||
1213 | void ZSafe::removeAsciiFile() | 1260 | void ZSafe::removeAsciiFile() |
1214 | { | 1261 | { |
1215 | // QString fn = filename + ".txt"; | 1262 | // QString fn = filename + ".txt"; |
@@ -1428,97 +1475,119 @@ void ZSafe::readAllEntries() | |||
1428 | QString s = t.readLine(); | 1475 | QString s = t.readLine(); |
1429 | s.replace (QRegExp("\";\""), "\"|\""); | 1476 | s.replace (QRegExp("\";\""), "\"|\""); |
1430 | // char buffer[1024]; | 1477 | // char buffer[1024]; |
1431 | #ifndef WIN32 | 1478 | #ifndef WIN32 |
1432 | char buffer[s.length()+1]; | 1479 | char buffer[s.length()+1]; |
1433 | #else | 1480 | #else |
1434 | char buffer[4048]; | 1481 | char buffer[4048]; |
1435 | #endif | 1482 | #endif |
1436 | strcpy (buffer, s); | 1483 | |
1484 | |||
1485 | /* modify QString -> QCString::utf8 */ | ||
1486 | |||
1487 | strcpy (buffer, s.utf8()); | ||
1437 | 1488 | ||
1438 | QString name; | 1489 | QString name; |
1439 | QString user; | 1490 | QString user; |
1440 | QString password; | 1491 | QString password; |
1441 | QString comment; | 1492 | QString comment; |
1442 | QString field5=""; | 1493 | QString field5=""; |
1443 | QString field6=""; | 1494 | QString field6=""; |
1444 | 1495 | ||
1445 | // separete the entries | 1496 | // separete the entries |
1446 | char *i = strtok (buffer, "|"); | 1497 | char *i = strtok (buffer, "|"); |
1447 | QString category(&i[1]); | 1498 | QString category(QString::fromUtf8(&i[1])); |
1448 | category.truncate(category.length() -1); | 1499 | category.truncate(category.length() -1); |
1449 | 1500 | ||
1450 | int idx=0; | 1501 | int idx=0; |
1451 | while ((i = strtok (NULL, "|")) != NULL) | 1502 | while ((i = strtok (NULL, "|")) != NULL) |
1452 | { | 1503 | { |
1453 | switch (idx) | 1504 | switch (idx) |
1454 | { | 1505 | { |
1455 | case 0: | 1506 | case 0: |
1456 | name = &i[1]; | 1507 | name = QString::fromUtf8(&i[1]); |
1457 | name.truncate(name.length() -1); | 1508 | name.truncate(name.length() -1); |
1458 | // name | 1509 | // name |
1459 | break; | 1510 | break; |
1460 | case 1: | 1511 | case 1: |
1461 | // user | 1512 | // user |
1462 | user = &i[1]; | 1513 | user = QString::fromUtf8(&i[1]); |
1463 | user.truncate(user.length() -1); | 1514 | user.truncate(user.length() -1); |
1464 | break; | 1515 | break; |
1465 | case 2: | 1516 | case 2: |
1466 | // password | 1517 | // password |
1467 | password = &i[1]; | 1518 | password = QString::fromUtf8(&i[1]); |
1468 | password.truncate(password.length() -1); | 1519 | password.truncate(password.length() -1); |
1469 | break; | 1520 | break; |
1470 | case 3: | 1521 | case 3: |
1471 | // comment | 1522 | // comment |
1472 | comment = &i[1]; | 1523 | comment = QString::fromUtf8(&i[1]); |
1473 | comment.truncate(comment.length() -1); | 1524 | comment.truncate(comment.length() -1); |
1474 | break; | 1525 | break; |
1475 | case 4: | 1526 | case 4: |
1476 | // field5 | 1527 | // field5 |
1477 | field5 = &i[1]; | 1528 | field5 = QString::fromUtf8(&i[1]); |
1478 | field5.truncate(field5.length() -1); | 1529 | field5.truncate(field5.length() -1); |
1479 | break; | 1530 | break; |
1480 | case 5: | 1531 | case 5: |
1481 | // field6 | 1532 | // field6 |
1482 | field6 = &i[1]; | 1533 | field6 = QString::fromUtf8(&i[1]); |
1483 | field6.truncate(field6.length() -1); | 1534 | field6.truncate(field6.length() -1); |
1484 | break; | 1535 | break; |
1485 | } | 1536 | } |
1486 | idx++; | 1537 | idx++; |
1487 | } | 1538 | } |
1488 | 1539 | ||
1489 | Category *cat= categories.find (category); | 1540 | Category *cat= categories.find (category); |
1490 | if (cat) | 1541 | if (cat) |
1491 | { | 1542 | { |
1492 | // use the existend item | 1543 | // use the existend item |
1493 | QListViewItem *catItem = cat->getListItem(); | 1544 | QListViewItem *catItem = cat->getListItem(); |
1494 | if (catItem) | 1545 | if (catItem) |
1495 | { | 1546 | { |
1496 | QListViewItem * item = new ShadedListItem( 0, catItem ); | 1547 | QListViewItem * item = new ShadedListItem( 0, catItem ); |
1548 | #ifdef JPATCH_HDE | ||
1549 | item->setText( 0, name ); | ||
1550 | item->setText( 1, user ); | ||
1551 | item->setText( 2, password ); | ||
1552 | item->setText( 3, comment ); | ||
1553 | item->setText( 4, field5 ); | ||
1554 | item->setText( 5, field6 ); | ||
1555 | #else | ||
1497 | item->setText( 0, tr( name ) ); | 1556 | item->setText( 0, tr( name ) ); |
1498 | item->setText( 1, tr( user ) ); | 1557 | item->setText( 1, tr( user ) ); |
1499 | item->setText( 2, tr( password ) ); | 1558 | item->setText( 2, tr( password ) ); |
1500 | item->setText( 3, tr( comment ) ); | 1559 | item->setText( 3, tr( comment ) ); |
1501 | item->setText( 4, tr( field5 ) ); | 1560 | item->setText( 4, tr( field5 ) ); |
1502 | item->setText( 5, tr( field6 ) ); | 1561 | item->setText( 5, tr( field6 ) ); |
1503 | catItem->setOpen( TRUE ); | 1562 | catItem->setOpen( TRUE ); |
1563 | #endif | ||
1504 | } | 1564 | } |
1505 | } | 1565 | } |
1506 | else | 1566 | else |
1507 | { | 1567 | { |
1508 | QListViewItem *catI = new ShadedListItem( 1, ListView ); | 1568 | QListViewItem *catI = new ShadedListItem( 1, ListView ); |
1509 | // create and insert a new item | 1569 | // create and insert a new item |
1510 | QListViewItem * item = new ShadedListItem( 0, catI ); | 1570 | QListViewItem * item = new ShadedListItem( 0, catI ); |
1571 | #ifdef JPATCH_HDE | ||
1572 | item->setText( 0, name ); | ||
1573 | item->setText( 1, user ); | ||
1574 | item->setText( 2, password ); | ||
1575 | item->setText( 3, comment ); | ||
1576 | item->setText( 4, field5 ); | ||
1577 | item->setText( 5, field6 ); | ||
1578 | #else | ||
1511 | item->setText( 0, tr( name ) ); | 1579 | item->setText( 0, tr( name ) ); |
1512 | item->setText( 1, tr( user ) ); | 1580 | item->setText( 1, tr( user ) ); |
1513 | item->setText( 2, tr( password ) ); | 1581 | item->setText( 2, tr( password ) ); |
1514 | item->setText( 3, tr( comment ) ); | 1582 | item->setText( 3, tr( comment ) ); |
1515 | item->setText( 4, tr( field5 ) ); | 1583 | item->setText( 4, tr( field5 ) ); |
1516 | item->setText( 5, tr( field6 ) ); | 1584 | item->setText( 5, tr( field6 ) ); |
1585 | #endif | ||
1517 | catI->setOpen( TRUE ); | 1586 | catI->setOpen( TRUE ); |
1518 | 1587 | ||
1519 | Category *c1 = new Category(); | 1588 | Category *c1 = new Category(); |
1520 | c1->setCategoryName(category); | 1589 | c1->setCategoryName(category); |
1521 | 1590 | ||
1522 | QString icon; | 1591 | QString icon; |
1523 | QString fullIconPath; | 1592 | QString fullIconPath; |
1524 | QPixmap *pix; | 1593 | QPixmap *pix; |
@@ -1708,32 +1777,46 @@ void ZSafe::readAllEntries() | |||
1708 | Category *cat= categories.find (category); | 1777 | Category *cat= categories.find (category); |
1709 | if (cat) | 1778 | if (cat) |
1710 | { | 1779 | { |
1711 | // use the existend item | 1780 | // use the existend item |
1712 | QListViewItem *catItem = cat->getListItem(); | 1781 | QListViewItem *catItem = cat->getListItem(); |
1713 | if (catItem) | 1782 | if (catItem) |
1714 | { | 1783 | { |
1715 | QListViewItem * item = new ShadedListItem( 0, catItem ); | 1784 | QListViewItem * item = new ShadedListItem( 0, catItem ); |
1785 | #ifdef JPATCH_HDE | ||
1786 | item->setText( 0, name ); | ||
1787 | item->setText( 1, user ); | ||
1788 | item->setText( 2, password ); | ||
1789 | item->setText( 3, comment ); | ||
1790 | #else | ||
1716 | item->setText( 0, tr( name ) ); | 1791 | item->setText( 0, tr( name ) ); |
1717 | item->setText( 1, tr( user ) ); | 1792 | item->setText( 1, tr( user ) ); |
1718 | item->setText( 2, tr( password ) ); | 1793 | item->setText( 2, tr( password ) ); |
1719 | item->setText( 3, tr( comment ) ); | 1794 | item->setText( 3, tr( comment ) ); |
1795 | #endif | ||
1720 | catItem->setOpen( TRUE ); | 1796 | catItem->setOpen( TRUE ); |
1721 | } | 1797 | } |
1722 | } | 1798 | } |
1723 | else | 1799 | else |
1724 | { | 1800 | { |
1725 | QListViewItem *catI = new ShadedListItem( 1, ListView ); | 1801 | QListViewItem *catI = new ShadedListItem( 1, ListView ); |
1726 | // create and insert a new item | 1802 | // create and insert a new item |
1727 | QListViewItem * item = new ShadedListItem( 0, catI ); | 1803 | QListViewItem * item = new ShadedListItem( 0, catI ); |
1804 | #ifdef JPATCH_HDE | ||
1805 | item->setText( 0, name ); | ||
1806 | item->setText( 1, user ); | ||
1807 | item->setText( 2, password ); | ||
1808 | item->setText( 3, comment ); | ||
1809 | #else | ||
1728 | item->setText( 0, tr( name ) ); | 1810 | item->setText( 0, tr( name ) ); |
1729 | item->setText( 1, tr( user ) ); | 1811 | item->setText( 1, tr( user ) ); |
1730 | item->setText( 2, tr( password ) ); | 1812 | item->setText( 2, tr( password ) ); |
1731 | item->setText( 3, tr( comment ) ); | 1813 | item->setText( 3, tr( comment ) ); |
1814 | #endif | ||
1732 | catI->setOpen( TRUE ); | 1815 | catI->setOpen( TRUE ); |
1733 | 1816 | ||
1734 | Category *c1 = new Category(); | 1817 | Category *c1 = new Category(); |
1735 | c1->setCategoryName(category); | 1818 | c1->setCategoryName(category); |
1736 | 1819 | ||
1737 | QString icon; | 1820 | QString icon; |
1738 | QString fullIconPath; | 1821 | QString fullIconPath; |
1739 | QPixmap *pix; | 1822 | QPixmap *pix; |
@@ -1904,55 +1987,73 @@ bool ZSafe::openDocument(const char* _filename, const char* ) | |||
1904 | } | 1987 | } |
1905 | 1988 | ||
1906 | 1989 | ||
1907 | retval = loadEntry(entry); | 1990 | retval = loadEntry(entry); |
1908 | 1991 | ||
1909 | int numberOfEntries=0; | 1992 | int numberOfEntries=0; |
1910 | while (retval == 1) { | 1993 | while (retval == 1) { |
1911 | 1994 | ||
1912 | QString category(entry[0]); | 1995 | QString category( QString::fromUtf8(entry[0]) ); |
1913 | QString name(entry[1]); | 1996 | QString name( QString::fromUtf8(entry[1]) ); |
1914 | QString user(entry[2]); | 1997 | QString user( QString::fromUtf8(entry[2]) ); |
1915 | QString password(entry[3]); | 1998 | QString password( QString::fromUtf8(entry[3]) ); |
1916 | QString comment(entry[4]); | 1999 | QString comment( QString::fromUtf8(entry[4]) ); |
1917 | QString field5(entry[5]); | 2000 | QString field5( QString::fromUtf8(entry[5]) ); |
1918 | QString field6(entry[6]); | 2001 | QString field6( QString::fromUtf8(entry[6]) ); |
1919 | // add the subitems to the categories | 2002 | // add the subitems to the categories |
1920 | 2003 | ||
1921 | Category *cat= categories.find (category); | 2004 | Category *cat= categories.find (category); |
1922 | if (cat) | 2005 | if (cat) |
1923 | { | 2006 | { |
1924 | // use the existend item | 2007 | // use the existend item |
1925 | QListViewItem *catItem = cat->getListItem(); | 2008 | QListViewItem *catItem = cat->getListItem(); |
1926 | if (catItem) | 2009 | if (catItem) |
1927 | { | 2010 | { |
1928 | QListViewItem * item = new ShadedListItem( 0, catItem ); | 2011 | QListViewItem * item = new ShadedListItem( 0, catItem ); |
2012 | #ifdef JPATCH_HDE | ||
2013 | item->setText( 0, name ); | ||
2014 | item->setText( 1, user ); | ||
2015 | item->setText( 2, password ); | ||
2016 | item->setText( 3, comment ); | ||
2017 | item->setText( 4, field5 ); | ||
2018 | item->setText( 5, field6 ); | ||
2019 | #else | ||
1929 | item->setText( 0, tr( name ) ); | 2020 | item->setText( 0, tr( name ) ); |
1930 | item->setText( 1, tr( user ) ); | 2021 | item->setText( 1, tr( user ) ); |
1931 | item->setText( 2, tr( password ) ); | 2022 | item->setText( 2, tr( password ) ); |
1932 | item->setText( 3, tr( comment ) ); | 2023 | item->setText( 3, tr( comment ) ); |
1933 | item->setText( 4, tr( field5 ) ); | 2024 | item->setText( 4, tr( field5 ) ); |
1934 | item->setText( 5, tr( field6 ) ); | 2025 | item->setText( 5, tr( field6 ) ); |
2026 | #endif | ||
1935 | if (expandTree) | 2027 | if (expandTree) |
1936 | catItem->setOpen( TRUE ); | 2028 | catItem->setOpen( TRUE ); |
1937 | numberOfEntries++; | 2029 | numberOfEntries++; |
1938 | } | 2030 | } |
1939 | } | 2031 | } |
1940 | else | 2032 | else |
1941 | { | 2033 | { |
1942 | QListViewItem *catI = new ShadedListItem( 1, ListView ); | 2034 | QListViewItem *catI = new ShadedListItem( 1, ListView ); |
1943 | // create and insert a new item | 2035 | // create and insert a new item |
1944 | QListViewItem * item = new ShadedListItem( 0, catI ); | 2036 | QListViewItem * item = new ShadedListItem( 0, catI ); |
2037 | #ifdef JPATCH_HDE | ||
2038 | item->setText( 0, name ); | ||
2039 | item->setText( 1, user ); | ||
2040 | item->setText( 2, password ); | ||
2041 | item->setText( 3, comment ); | ||
2042 | item->setText( 4, field5 ); | ||
2043 | item->setText( 5, field6 ); | ||
2044 | #else | ||
1945 | item->setText( 0, tr( name ) ); | 2045 | item->setText( 0, tr( name ) ); |
1946 | item->setText( 1, tr( user ) ); | 2046 | item->setText( 1, tr( user ) ); |
1947 | item->setText( 2, tr( password ) ); | 2047 | item->setText( 2, tr( password ) ); |
1948 | item->setText( 3, tr( comment ) ); | 2048 | item->setText( 3, tr( comment ) ); |
1949 | item->setText( 4, tr( field5 ) ); | 2049 | item->setText( 4, tr( field5 ) ); |
1950 | item->setText( 5, tr( field6 ) ); | 2050 | item->setText( 5, tr( field6 ) ); |
2051 | #endif | ||
1951 | if (expandTree) | 2052 | if (expandTree) |
1952 | catI->setOpen( TRUE ); | 2053 | catI->setOpen( TRUE ); |
1953 | 2054 | ||
1954 | Category *c1 = new Category(); | 2055 | Category *c1 = new Category(); |
1955 | c1->setCategoryName(category); | 2056 | c1->setCategoryName(category); |
1956 | 2057 | ||
1957 | QString icon; | 2058 | QString icon; |
1958 | QString fullIconPath; | 2059 | QString fullIconPath; |
@@ -2254,31 +2355,30 @@ bool ZSafe::saveDocument(const char* _filename, | |||
2254 | { | 2355 | { |
2255 | // step through all subitems | 2356 | // step through all subitems |
2256 | QListViewItem *si; | 2357 | QListViewItem *si; |
2257 | for (si = i->firstChild(); | 2358 | for (si = i->firstChild(); |
2258 | si != NULL; | 2359 | si != NULL; |
2259 | si = si->nextSibling()) | 2360 | si = si->nextSibling()) |
2260 | { | 2361 | { |
2261 | int j=0; | 2362 | int j=0; |
2262 | entry[j] = (char*)malloc(strlen(i->text(0))+1); | 2363 | entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); |
2263 | strcpy(entry[j++], i->text(0)); | 2364 | strcpy(entry[j++], i->text(0).utf8()); |
2264 | entry[j] = (char*)malloc(strlen(si->text(0))+1); | 2365 | entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); |
2265 | strcpy(entry[j++], si->text(0)); | 2366 | strcpy(entry[j++], si->text(0).utf8()); |
2266 | entry[j] = (char*)malloc(strlen(si->text(1))+1); | 2367 | entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); |
2267 | strcpy(entry[j++], si->text(1)); | 2368 | strcpy(entry[j++], si->text(1).utf8()); |
2268 | entry[j] = (char*)malloc(strlen(si->text(2))+1); | 2369 | entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); |
2269 | strcpy(entry[j++], si->text(2)); | 2370 | strcpy(entry[j++], si->text(2).utf8()); |
2270 | entry[j] = (char*)malloc(strlen(si->text(3))+1); | 2371 | entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); |
2271 | strcpy(entry[j++], si->text(3)); | 2372 | strcpy(entry[j++], si->text(3).utf8()); |
2272 | 2373 | entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); | |
2273 | entry[j] = (char*)malloc(strlen(si->text(4))+1); | 2374 | strcpy(entry[j++], si->text(4).utf8()); |
2274 | strcpy(entry[j++], si->text(4)); | 2375 | entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); |
2275 | entry[j] = (char*)malloc(strlen(si->text(5))+1); | 2376 | strcpy(entry[j++], si->text(5).utf8()); |
2276 | strcpy(entry[j++], si->text(5)); | ||
2277 | 2377 | ||
2278 | retval = saveEntry(entry); | 2378 | retval = saveEntry(entry); |
2279 | for (int z=0; z<j; z++) | 2379 | for (int z=0; z<j; z++) |
2280 | { | 2380 | { |
2281 | free(entry[z]); | 2381 | free(entry[z]); |
2282 | } | 2382 | } |
2283 | if (retval == PWERR_DATA) { | 2383 | if (retval == PWERR_DATA) { |
2284 | qWarning("1: Error writing file, contents not saved"); | 2384 | qWarning("1: Error writing file, contents not saved"); |
@@ -3198,18 +3298,23 @@ void ZSafe::editCategory() | |||
3198 | cat->setIcon (*getPredefinedIcon(category)); | 3298 | cat->setIcon (*getPredefinedIcon(category)); |
3199 | } | 3299 | } |
3200 | 3300 | ||
3201 | // change the category name of the selected category | 3301 | // change the category name of the selected category |
3202 | QListViewItem *catItem = cat->getListItem(); | 3302 | QListViewItem *catItem = cat->getListItem(); |
3203 | if (catItem) | 3303 | if (catItem) |
3204 | { | 3304 | { |
3205 | qWarning (category); | 3305 | qWarning (category); |
3306 | #ifdef JPATCH_HDE | ||
3307 | catItem->setText( 0, category ); | ||
3308 | cat->setCategoryName (category); | ||
3309 | #else | ||
3206 | catItem->setText( 0, tr( category ) ); | 3310 | catItem->setText( 0, tr( category ) ); |
3207 | cat->setCategoryName (tr(category)); | 3311 | cat->setCategoryName (tr(category)); |
3312 | #endif | ||
3208 | cat->initListItem(); | 3313 | cat->initListItem(); |
3209 | categories.insert (category, cat); | 3314 | categories.insert (category, cat); |
3210 | } | 3315 | } |
3211 | } | 3316 | } |
3212 | saveCategoryDialogFields(dialog); | 3317 | saveCategoryDialogFields(dialog); |
3213 | } | 3318 | } |
3214 | else | 3319 | else |
3215 | { | 3320 | { |
@@ -3524,29 +3629,51 @@ void ZSafe::saveDocumentWithoutPwd() | |||
3524 | void ZSafe::saveDocumentWithPwd() | 3629 | void ZSafe::saveDocumentWithPwd() |
3525 | { | 3630 | { |
3526 | saveDocument(filename, TRUE); | 3631 | saveDocument(filename, TRUE); |
3527 | } | 3632 | } |
3528 | 3633 | ||
3529 | void ZSafe::about() | 3634 | void ZSafe::about() |
3530 | { | 3635 | { |
3531 | QString info; | 3636 | QString info; |
3637 | #ifdef JPATCH_HDE | ||
3638 | info = "<html><body><div align=""center"">"; | ||
3639 | info += "<b>"; | ||
3640 | info += tr("Zaurus Password Manager<br>"); | ||
3641 | info += tr("ZSafe version 2.1.2-jv01b<br>"); | ||
3642 | info += "</b>"; | ||
3643 | info += tr("by Carsten Schneider<br>"); | ||
3644 | info += "zcarsten@gmx.net<br>"; | ||
3645 | info += "http://z-soft.z-portal.info/zsafe"; | ||
3646 | info += "<br>"; | ||
3647 | info += tr("Translations by Robert Ernst<br>"); | ||
3648 | info += "robert.ernst@linux-solutions.at<br>"; | ||
3649 | |||
3650 | info += "<br><br>"; | ||
3651 | info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>"); | ||
3652 | info += "HADECO R&D<br>"; | ||
3653 | info += "r&d@hadeco.co.jp<br>"; | ||
3654 | info += "http://www.hadeco.co.jp/r&d/<br>"; | ||
3655 | info += "<br></div>"; | ||
3656 | info += "</body></html>"; | ||
3657 | #else | ||
3532 | info = "<html><body><div align=""center"">"; | 3658 | info = "<html><body><div align=""center"">"; |
3533 | info += "<b>"; | 3659 | info += "<b>"; |
3534 | info += tr("Zaurus Password Manager<br>"); | 3660 | info += tr("Zaurus Password Manager<br>"); |
3535 | info += tr("ZSafe version 2.1.2<br>"); | 3661 | info += tr("ZSafe version 2.1.2<br>"); |
3536 | info += "</b>"; | 3662 | info += "</b>"; |
3537 | info += tr("by Carsten Schneider<br>"); | 3663 | info += tr("by Carsten Schneider<br>"); |
3538 | info += "zcarsten@gmx.net<br>"; | 3664 | info += "zcarsten@gmx.net<br>"; |
3539 | info += "http://z-soft.z-portal.info/zsafe"; | 3665 | info += "http://z-soft.z-portal.info/zsafe"; |
3540 | info += "<br>"; | 3666 | info += "<br>"; |
3541 | info += tr("Translations by Robert Ernst<br>"); | 3667 | info += tr("Translations by Robert Ernst<br>"); |
3542 | info += "robert.ernst@linux-solutions.at<br>"; | 3668 | info += "robert.ernst@linux-solutions.at<br>"; |
3543 | info += "<br></div>"; | 3669 | info += "<br></div>"; |
3544 | info += "</body></html>"; | 3670 | info += "</body></html>"; |
3671 | #endif | ||
3545 | 3672 | ||
3546 | // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); | 3673 | // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); |
3547 | 3674 | ||
3548 | QMessageBox mb( this, tr("ZSafe")); | 3675 | QMessageBox mb( this, tr("ZSafe")); |
3549 | mb.setText (info); | 3676 | mb.setText (info); |
3550 | mb.setButtonText (QMessageBox::Ok, tr ("&OK")); | 3677 | mb.setButtonText (QMessageBox::Ok, tr ("&OK")); |
3551 | QPixmap zsafe_img((const char**) zsafe_xpm); | 3678 | QPixmap zsafe_img((const char**) zsafe_xpm); |
3552 | mb.setIconPixmap (zsafe_img); | 3679 | mb.setIconPixmap (zsafe_img); |