author | zcarsten <zcarsten> | 2003-08-13 16:54:10 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-08-13 16:54:10 (UTC) |
commit | 7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194 (patch) (unidiff) | |
tree | 06c6127d5a89ba75f127c709c3aaa46dcb38853e /noncore/apps | |
parent | 1b22b22d6e50b46f3ea04b5a1cfc3dc9bfd8a78a (diff) | |
download | opie-7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194.zip opie-7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194.tar.gz opie-7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194.tar.bz2 |
japanese support added (see defines JPATCH_HDE)
-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 | |||
@@ -11,23 +11,23 @@ CategoryList::CategoryList() | |||
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 | } |
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 | |||
@@ -2,13 +2,15 @@ | |||
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 | { |
@@ -18,13 +20,13 @@ public: | |||
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 | ||
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 | |||
@@ -11,12 +11,14 @@ | |||
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" |
@@ -451,19 +453,32 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
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 | { |
@@ -757,12 +772,28 @@ void ZSafe::editPwd() | |||
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)); |
@@ -772,12 +803,13 @@ void ZSafe::editPwd() | |||
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 | { |
@@ -836,24 +868,39 @@ retype: | |||
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 | ||
@@ -1201,13 +1248,13 @@ void ZSafe::listViewSelected( QListViewItem *_item) | |||
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() |
@@ -1430,59 +1477,63 @@ void ZSafe::readAllEntries() | |||
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 | ||
@@ -1491,32 +1542,50 @@ void ZSafe::readAllEntries() | |||
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; |
@@ -1710,28 +1779,42 @@ void ZSafe::readAllEntries() | |||
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; |
@@ -1906,51 +1989,69 @@ bool ZSafe::openDocument(const char* _filename, const char* ) | |||
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 | ||
@@ -2256,27 +2357,26 @@ bool ZSafe::saveDocument(const char* _filename, | |||
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 | } |
@@ -3200,14 +3300,19 @@ void ZSafe::editCategory() | |||
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 | } |
@@ -3526,12 +3631,33 @@ void ZSafe::saveDocumentWithPwd() | |||
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>"); |
@@ -3539,12 +3665,13 @@ void ZSafe::about() | |||
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")); |