summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/categorylist.cpp6
-rw-r--r--noncore/apps/zsafe/categorylist.h6
-rw-r--r--noncore/apps/zsafe/zsafe.cpp199
3 files changed, 170 insertions, 41 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
@@ -13,19 +13,19 @@ CategoryList::~CategoryList()
}
void CategoryList::insert (QString key, Category *category)
{
- categoryList.insert ((const char *) key, category);
+ categoryList.insert (key, category);
}
Category *CategoryList::find (QString key)
{
- return categoryList.find ((const char *) key);
+ return categoryList.find (key);
}
void CategoryList::remove (QString key)
{
- categoryList.remove ((const char *) key);
+ categoryList.remove (key);
}
void CategoryList::clear()
{
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
@@ -4,9 +4,11 @@
#ifndef _CATEGORY_LIST_H_
#define _CATEGORY_LIST_H_
#include <qstring.h>
-#include <qasciidict.h>
+
+#include <qdict.h>
+
#include "category.h"
// list of Category
@@ -20,9 +22,9 @@ public:
Category *find (QString key);
void remove (QString key);
void clear();
- QAsciiDict<Category> categoryList;
+ QDict<Category> categoryList;
private:
};
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
@@ -13,8 +13,10 @@
** Zaurus Opie arm: none
** Linux Desktop : -DDESKTOP
** Windows Desktop: -DDESKTOP -DWIN32
**
+** for japanese version additional use: -DJPATCH_HDE
+**
****************************************************************************/
#include "zsafe.h"
#include "newdialog.h"
#include "searchdialog.h"
@@ -453,15 +455,28 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
setGeometry(100, 150, DeskW, DeskH-30 );
#else
resize( DeskW, DeskH-30 );
#endif
- // setMinimumSize( QSize( DeskW, DeskH-30 ) );
- // setMaximumSize( QSize( DeskW, DeskH-30 ) );
+
+#else
+
+#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 );
- // setMinimumSize( QSize( DeskW, DeskH-30 ) );
- // setMaximumSize( QSize( 440, 290 ) );
- // setMaximumSize( QSize( DeskW+400, DeskH+200 ) );
+#endif
+
#endif
// setCaption( tr( "ZSafe" ) );
filename = conf->readEntry(APP_KEY+"document");
@@ -759,8 +774,24 @@ void ZSafe::editPwd()
result = Accepted;
#endif
if (result == Accepted)
{
+#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;
// edit the selected item
QString name = dialog->NameField->text();
selectedItem->setText (0, tr (name));
@@ -774,8 +805,9 @@ void ZSafe::editPwd()
QString f5 = dialog->Field5->text();
selectedItem->setText (4, tr (f5));
QString f6 = dialog->Field6->text();
selectedItem->setText (5, tr (f6));
+#endif
}
delete dialog;
}
@@ -838,8 +870,22 @@ retype:
// add the new item
QListViewItem *i = new ShadedListItem (0, selectedItem);
i->setOpen (TRUE);
+#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));
QString user = dialog->UsernameField->text();
i->setText (1, tr (user));
QString pwd = dialog->PasswordField->text();
@@ -850,8 +896,9 @@ retype:
QString f5 = dialog->Field5->text();
i->setText (4, tr (f5));
QString f6 = dialog->Field6->text();
i->setText (5, tr (f6));
+#endif
}
delete dialog;
}
@@ -1203,9 +1250,9 @@ bool ZSafe::isCategory(QListViewItem *_item)
if (_item == NULL)
return FALSE;
QString categoryName = _item->text (0);
- if (categories.find ((const char *)categoryName))
+ if (categories.find (categoryName))
return TRUE;
else
return FALSE;
}
@@ -1432,9 +1479,13 @@ void ZSafe::readAllEntries()
char buffer[s.length()+1];
#else
char buffer[4048];
#endif
- strcpy (buffer, s);
+
+
+ /* modify QString -> QCString::utf8 */
+
+ strcpy (buffer, s.utf8());
QString name;
QString user;
QString password;
@@ -1443,44 +1494,44 @@ void ZSafe::readAllEntries()
QString field6="";
// separete the entries
char *i = strtok (buffer, "|");
- QString category(&i[1]);
+ QString category(QString::fromUtf8(&i[1]));
category.truncate(category.length() -1);
int idx=0;
while ((i = strtok (NULL, "|")) != NULL)
{
switch (idx)
{
case 0:
- name = &i[1];
+ name = QString::fromUtf8(&i[1]);
name.truncate(name.length() -1);
// name
break;
case 1:
// user
- user = &i[1];
+ user = QString::fromUtf8(&i[1]);
user.truncate(user.length() -1);
break;
case 2:
// password
- password = &i[1];
+ password = QString::fromUtf8(&i[1]);
password.truncate(password.length() -1);
break;
case 3:
// comment
- comment = &i[1];
+ comment = QString::fromUtf8(&i[1]);
comment.truncate(comment.length() -1);
break;
case 4:
// field5
- field5 = &i[1];
+ field5 = QString::fromUtf8(&i[1]);
field5.truncate(field5.length() -1);
break;
case 5:
// field6
- field6 = &i[1];
+ field6 = QString::fromUtf8(&i[1]);
field6.truncate(field6.length() -1);
break;
}
idx++;
@@ -1493,28 +1544,46 @@ void ZSafe::readAllEntries()
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
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 ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
catItem->setOpen( TRUE );
+#endif
}
}
else
{
QListViewItem *catI = new ShadedListItem( 1, ListView );
// create and insert a new item
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 ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
+#endif
catI->setOpen( TRUE );
Category *c1 = new Category();
c1->setCategoryName(category);
@@ -1712,24 +1781,38 @@ void ZSafe::readAllEntries()
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
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 ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
+#endif
catItem->setOpen( TRUE );
}
}
else
{
QListViewItem *catI = new ShadedListItem( 1, ListView );
// create and insert a new item
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 ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
+#endif
catI->setOpen( TRUE );
Category *c1 = new Category();
c1->setCategoryName(category);
@@ -1908,15 +1991,15 @@ bool ZSafe::openDocument(const char* _filename, const char* )
int numberOfEntries=0;
while (retval == 1) {
- 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
Category *cat= categories.find (category);
if (cat)
@@ -1925,14 +2008,23 @@ bool ZSafe::openDocument(const char* _filename, const char* )
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
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 ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
+#endif
if (expandTree)
catItem->setOpen( TRUE );
numberOfEntries++;
}
@@ -1941,14 +2033,23 @@ bool ZSafe::openDocument(const char* _filename, const char* )
{
QListViewItem *catI = new ShadedListItem( 1, ListView );
// create and insert a new item
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 ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
+#endif
if (expandTree)
catI->setOpen( TRUE );
Category *c1 = new Category();
@@ -2258,23 +2359,22 @@ bool ZSafe::saveDocument(const char* _filename,
si != NULL;
si = si->nextSibling())
{
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());
retval = saveEntry(entry);
for (int z=0; z<j; z++)
{
@@ -3202,10 +3302,15 @@ void ZSafe::editCategory()
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
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();
categories.insert (category, cat);
}
}
@@ -3528,8 +3633,29 @@ void ZSafe::saveDocumentWithPwd()
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"">";
info += "<b>";
info += tr("Zaurus Password Manager<br>");
info += tr("ZSafe version 2.1.2<br>");
@@ -3541,8 +3667,9 @@ void ZSafe::about()
info += tr("Translations by Robert Ernst<br>");
info += "robert.ernst@linux-solutions.at<br>";
info += "<br></div>";
info += "</body></html>";
+#endif
// QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
QMessageBox mb( this, tr("ZSafe"));