author | zcarsten <zcarsten> | 2003-08-13 16:54:10 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-08-13 16:54:10 (UTC) |
commit | 7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194 (patch) (side-by-side diff) | |
tree | 06c6127d5a89ba75f127c709c3aaa46dcb38853e /noncore/apps/zsafe/zsafe.cpp | |
parent | 1b22b22d6e50b46f3ea04b5a1cfc3dc9bfd8a78a (diff) | |
download | opie-7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194.zip opie-7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194.tar.gz opie-7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194.tar.bz2 |
japanese support added (see defines JPATCH_HDE)
Diffstat (limited to 'noncore/apps/zsafe/zsafe.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 201 |
1 files changed, 164 insertions, 37 deletions
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 @@ -16,2 +16,4 @@ ** +** for japanese version additional use: -DJPATCH_HDE +** ****************************************************************************/ @@ -456,9 +458,22 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) #endif - // setMinimumSize( QSize( DeskW, DeskH-30 ) ); - // setMaximumSize( QSize( DeskW, DeskH-30 ) ); + #else - resize( DeskW, DeskH-30 ); - // setMinimumSize( QSize( DeskW, DeskH-30 ) ); - // setMaximumSize( QSize( 440, 290 ) ); - // setMaximumSize( QSize( DeskW+400, DeskH+200 ) ); + +#ifdef JPATCH_HDE + int DeskS; + if(DeskW > DeskH) + { + DeskS = DeskW; + } + else + { + DeskS = DeskH; + } + resize( DeskW, DeskH ); + setMinimumSize( QSize( DeskS, DeskS ) ); + setMaximumSize( QSize( DeskS, DeskS ) ); +#else + resize( DeskW, DeskH-30 ); +#endif + #endif @@ -762,2 +777,18 @@ void ZSafe::editPwd() { +#ifdef JPATCH_HDE + // edit the selected item + QString name = dialog->NameField->text(); + selectedItem->setText (0, name); + QString user = dialog->UsernameField->text(); + selectedItem->setText (1, user); + QString pwd = dialog->PasswordField->text(); + selectedItem->setText (2, pwd); + QString comment = dialog->CommentField->text(); + comment.replace (QRegExp("\n"), "<br>"); + selectedItem->setText (3, comment); + QString f5 = dialog->Field5->text(); + selectedItem->setText (4, f5); + QString f6 = dialog->Field6->text(); + selectedItem->setText (5, f6); +#else modified = true; @@ -777,2 +808,3 @@ void ZSafe::editPwd() selectedItem->setText (5, tr (f6)); +#endif } @@ -841,2 +873,16 @@ retype: +#ifdef JPATCH_HDE + i->setText (0, name); + QString user = dialog->UsernameField->text(); + i->setText (1, user); + QString pwd = dialog->PasswordField->text(); + i->setText (2, pwd); + QString comment = dialog->CommentField->text(); + comment.replace (QRegExp("\n"), "<br>"); + i->setText (3, comment); + QString f5 = dialog->Field5->text(); + i->setText (4, f5); + QString f6 = dialog->Field6->text(); + i->setText (5, f6); +#else i->setText (0, tr (name)); @@ -853,2 +899,3 @@ retype: i->setText (5, tr (f6)); +#endif } @@ -1206,3 +1253,3 @@ bool ZSafe::isCategory(QListViewItem *_item) QString categoryName = _item->text (0); - if (categories.find ((const char *)categoryName)) + if (categories.find (categoryName)) return TRUE; @@ -1435,3 +1482,7 @@ void ZSafe::readAllEntries() #endif - strcpy (buffer, s); + + + /* modify QString -> QCString::utf8 */ + + strcpy (buffer, s.utf8()); @@ -1446,3 +1497,3 @@ void ZSafe::readAllEntries() char *i = strtok (buffer, "|"); - QString category(&i[1]); + QString category(QString::fromUtf8(&i[1])); category.truncate(category.length() -1); @@ -1455,3 +1506,3 @@ void ZSafe::readAllEntries() case 0: - name = &i[1]; + name = QString::fromUtf8(&i[1]); name.truncate(name.length() -1); @@ -1461,3 +1512,3 @@ void ZSafe::readAllEntries() // user - user = &i[1]; + user = QString::fromUtf8(&i[1]); user.truncate(user.length() -1); @@ -1466,3 +1517,3 @@ void ZSafe::readAllEntries() // password - password = &i[1]; + password = QString::fromUtf8(&i[1]); password.truncate(password.length() -1); @@ -1471,3 +1522,3 @@ void ZSafe::readAllEntries() // comment - comment = &i[1]; + comment = QString::fromUtf8(&i[1]); comment.truncate(comment.length() -1); @@ -1476,3 +1527,3 @@ void ZSafe::readAllEntries() // field5 - field5 = &i[1]; + field5 = QString::fromUtf8(&i[1]); field5.truncate(field5.length() -1); @@ -1481,3 +1532,3 @@ void ZSafe::readAllEntries() // field6 - field6 = &i[1]; + field6 = QString::fromUtf8(&i[1]); field6.truncate(field6.length() -1); @@ -1496,2 +1547,10 @@ void ZSafe::readAllEntries() QListViewItem * item = new ShadedListItem( 0, catItem ); +#ifdef JPATCH_HDE + item->setText( 0, name ); + item->setText( 1, user ); + item->setText( 2, password ); + item->setText( 3, comment ); + item->setText( 4, field5 ); + item->setText( 5, field6 ); +#else item->setText( 0, tr( name ) ); @@ -1503,2 +1562,3 @@ void ZSafe::readAllEntries() catItem->setOpen( TRUE ); +#endif } @@ -1510,2 +1570,10 @@ void ZSafe::readAllEntries() QListViewItem * item = new ShadedListItem( 0, catI ); +#ifdef JPATCH_HDE + item->setText( 0, name ); + item->setText( 1, user ); + item->setText( 2, password ); + item->setText( 3, comment ); + item->setText( 4, field5 ); + item->setText( 5, field6 ); +#else item->setText( 0, tr( name ) ); @@ -1516,2 +1584,3 @@ void ZSafe::readAllEntries() item->setText( 5, tr( field6 ) ); +#endif catI->setOpen( TRUE ); @@ -1715,2 +1784,8 @@ void ZSafe::readAllEntries() QListViewItem * item = new ShadedListItem( 0, catItem ); +#ifdef JPATCH_HDE + item->setText( 0, name ); + item->setText( 1, user ); + item->setText( 2, password ); + item->setText( 3, comment ); +#else item->setText( 0, tr( name ) ); @@ -1719,2 +1794,3 @@ void ZSafe::readAllEntries() item->setText( 3, tr( comment ) ); +#endif catItem->setOpen( TRUE ); @@ -1727,2 +1803,8 @@ void ZSafe::readAllEntries() QListViewItem * item = new ShadedListItem( 0, catI ); +#ifdef JPATCH_HDE + item->setText( 0, name ); + item->setText( 1, user ); + item->setText( 2, password ); + item->setText( 3, comment ); +#else item->setText( 0, tr( name ) ); @@ -1731,2 +1813,3 @@ void ZSafe::readAllEntries() item->setText( 3, tr( comment ) ); +#endif catI->setOpen( TRUE ); @@ -1911,9 +1994,9 @@ bool ZSafe::openDocument(const char* _filename, const char* ) - QString category(entry[0]); - QString name(entry[1]); - QString user(entry[2]); - QString password(entry[3]); - QString comment(entry[4]); - QString field5(entry[5]); - QString field6(entry[6]); + QString category( QString::fromUtf8(entry[0]) ); + QString name( QString::fromUtf8(entry[1]) ); + QString user( QString::fromUtf8(entry[2]) ); + QString password( QString::fromUtf8(entry[3]) ); + QString comment( QString::fromUtf8(entry[4]) ); + QString field5( QString::fromUtf8(entry[5]) ); + QString field6( QString::fromUtf8(entry[6]) ); // add the subitems to the categories @@ -1928,2 +2011,10 @@ bool ZSafe::openDocument(const char* _filename, const char* ) QListViewItem * item = new ShadedListItem( 0, catItem ); +#ifdef JPATCH_HDE + item->setText( 0, name ); + item->setText( 1, user ); + item->setText( 2, password ); + item->setText( 3, comment ); + item->setText( 4, field5 ); + item->setText( 5, field6 ); +#else item->setText( 0, tr( name ) ); @@ -1934,2 +2025,3 @@ bool ZSafe::openDocument(const char* _filename, const char* ) item->setText( 5, tr( field6 ) ); +#endif if (expandTree) @@ -1944,2 +2036,10 @@ bool ZSafe::openDocument(const char* _filename, const char* ) QListViewItem * item = new ShadedListItem( 0, catI ); +#ifdef JPATCH_HDE + item->setText( 0, name ); + item->setText( 1, user ); + item->setText( 2, password ); + item->setText( 3, comment ); + item->setText( 4, field5 ); + item->setText( 5, field6 ); +#else item->setText( 0, tr( name ) ); @@ -1950,2 +2050,3 @@ bool ZSafe::openDocument(const char* _filename, const char* ) item->setText( 5, tr( field6 ) ); +#endif if (expandTree) @@ -2261,17 +2362,16 @@ bool ZSafe::saveDocument(const char* _filename, int j=0; - entry[j] = (char*)malloc(strlen(i->text(0))+1); - strcpy(entry[j++], i->text(0)); - entry[j] = (char*)malloc(strlen(si->text(0))+1); - strcpy(entry[j++], si->text(0)); - entry[j] = (char*)malloc(strlen(si->text(1))+1); - strcpy(entry[j++], si->text(1)); - entry[j] = (char*)malloc(strlen(si->text(2))+1); - strcpy(entry[j++], si->text(2)); - entry[j] = (char*)malloc(strlen(si->text(3))+1); - strcpy(entry[j++], si->text(3)); - - entry[j] = (char*)malloc(strlen(si->text(4))+1); - strcpy(entry[j++], si->text(4)); - entry[j] = (char*)malloc(strlen(si->text(5))+1); - strcpy(entry[j++], si->text(5)); + entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); + strcpy(entry[j++], i->text(0).utf8()); + entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); + strcpy(entry[j++], si->text(0).utf8()); + entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); + strcpy(entry[j++], si->text(1).utf8()); + entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); + strcpy(entry[j++], si->text(2).utf8()); + entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); + strcpy(entry[j++], si->text(3).utf8()); + entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); + strcpy(entry[j++], si->text(4).utf8()); + entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); + strcpy(entry[j++], si->text(5).utf8()); @@ -3205,4 +3305,9 @@ void ZSafe::editCategory() qWarning (category); +#ifdef JPATCH_HDE + catItem->setText( 0, category ); + cat->setCategoryName (category); +#else catItem->setText( 0, tr( category ) ); cat->setCategoryName (tr(category)); +#endif cat->initListItem(); @@ -3531,2 +3636,23 @@ void ZSafe::about() QString info; +#ifdef JPATCH_HDE + info = "<html><body><div align=""center"">"; + info += "<b>"; + info += tr("Zaurus Password Manager<br>"); + info += tr("ZSafe version 2.1.2-jv01b<br>"); + info += "</b>"; + info += tr("by Carsten Schneider<br>"); + info += "zcarsten@gmx.net<br>"; + info += "http://z-soft.z-portal.info/zsafe"; + info += "<br>"; + info += tr("Translations by Robert Ernst<br>"); + info += "robert.ernst@linux-solutions.at<br>"; + + info += "<br><br>"; + info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>"); + info += "HADECO R&D<br>"; + info += "r&d@hadeco.co.jp<br>"; + info += "http://www.hadeco.co.jp/r&d/<br>"; + info += "<br></div>"; + info += "</body></html>"; +#else info = "<html><body><div align=""center"">"; @@ -3544,2 +3670,3 @@ void ZSafe::about() info += "</body></html>"; +#endif |