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 | |
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 | 199 |
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 @@ -1,35 +1,35 @@ /* C implementation of RC2 encryption algorithm, as described in RFC2268 */ /* By Matthew Palmer <mjp16@uow.edu.au> */ /* $Id$ */ #include "categorylist.h" CategoryList::CategoryList() { } 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() { 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 @@ -1,32 +1,34 @@ /* ** $Id$ */ #ifndef _CATEGORY_LIST_H_ #define _CATEGORY_LIST_H_ #include <qstring.h> -#include <qasciidict.h> + +#include <qdict.h> + #include "category.h" // list of Category class CategoryList { public: CategoryList(); ~CategoryList(); void insert (QString key, Category *category); Category *find (QString key); void remove (QString key); void clear(); - QAsciiDict<Category> categoryList; + QDict<Category> categoryList; private: }; #endif // _CATEGORY_LIST_H_ 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 @@ -1,48 +1,50 @@ /**************************************************************************** ** ** Created: Sat Apr 6 17:57:45 2002 ** ** Author: Carsten Schneider <CarstenSchneider@t-online.de> ** ** $Id$ ** ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html ** ** Compile Flags: ** Zaurus arm : -DNO_OPIE ** 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" #include "categorydialog.h" #include "passworddialog.h" #include "infoform.h" #include "zlistview.h" #include "shadedlistitem.h" #ifndef DESKTOP #ifndef NO_OPIE #include <opie/ofiledialog.h> #else #include "scqtfileedit.h" #endif #endif #include <qclipboard.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #ifndef WIN32 #include <unistd.h> #endif #include <string.h> #include <errno.h> @@ -425,71 +427,84 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) conf->setGroup ("zsafe"); #endif QPixmap copy_img((const char**) copy_xpm); QPixmap cut_img((const char**) cut_xpm); QPixmap edit_img((const char**) edit_xpm); QPixmap editdelete_img((const char**) editdelete_xpm); QPixmap find_img((const char**) find_xpm); QPixmap folder_open_img((const char**) folder_open_xpm); QPixmap help_icon_img((const char**) help_icon_xpm); QPixmap new_img((const char**) new_xpm); QPixmap paste_img((const char**) paste_xpm); QPixmap quit_icon_img((const char**) quit_icon_xpm); QPixmap save_img((const char**) save_xpm); QPixmap trash_img((const char**) trash_xpm); QPixmap expand_img((const char**) expand_xpm); QPixmap export_img((const char**) export_xpm); QPixmap import_img((const char**) import_xpm); QPixmap bank_cards( ( const char** ) bank_cards_data ); QPixmap passwords( ( const char** ) passwords_data ); QPixmap software( ( const char** ) software_data ); QPixmap general( ( const char** ) general_data ); if ( !name ) setName( "ZSafe" ); #ifdef DESKTOP #ifdef WIN32 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"); if (filename.isEmpty() || filename.isNull()) { // check if the directory application exists, if not // create it // #ifndef WIN32 // QString d1("Documents/application"); // #else QString d1(QDir::homeDirPath() + "/Documents/application"); // #endif QDir pd1(d1); if (!pd1.exists()) { QDir pd1("Documents"); if (!pd1.mkdir("application", FALSE)) { QMessageBox::critical( 0, tr("ZSafe"), tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1)); exitZs (1); } } // #ifndef WIN32 // QString d2("Documents/application/zsafe"); // #else QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); // #endif QDir pd2(d2); if (!pd2.exists()) @@ -731,155 +746,187 @@ void ZSafe::editPwd() // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); // set the fields dialog->NameField->setText(selectedItem->text (0)); dialog->UsernameField->setText(selectedItem->text (1)); dialog->PasswordField->setText(selectedItem->text (2)); QString comment = selectedItem->text (3); comment.replace (QRegExp("<br>"), "\n"); dialog->Field5->setText(selectedItem->text (4)); dialog->Field6->setText(selectedItem->text (5)); dialog->CommentField->insertLine(comment); dialog->CommentField->setCursorPosition(0,0); #ifdef DESKTOP #ifndef WIN32 dialog->show(); #endif #else dialog->showMaximized(); #endif DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP 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)); QString user = dialog->UsernameField->text(); selectedItem->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); selectedItem->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); selectedItem->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); selectedItem->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); selectedItem->setText (5, tr (f6)); +#endif } delete dialog; } else { editCategory(); } } void ZSafe::newPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) selectedItem = selectedItem->parent(); if (isCategory(selectedItem)) { QString cat = selectedItem->text(0); // open the 'New Entry' dialog NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("New Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); retype: #ifdef DESKTOP #ifndef WIN32 dialog->show(); #endif #else dialog->showMaximized(); #endif DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif if (result == Accepted) { QString name = dialog->NameField->text(); if (cat == name) { QMessageBox::critical( 0, tr("ZSafe"), tr("Entry name must be different\nfrom the category name.") ); goto retype; // it's not a good programming style :-) } modified = true; // 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(); i->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); i->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); i->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); i->setText (5, tr (f6)); +#endif } delete dialog; } } void ZSafe::findPwd() { // open the 'Search' dialog SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("Search")); #endif #ifdef DESKTOP #endif if (lastSearchedName) dialog->NameField->setText(lastSearchedName); else dialog->NameField->setText(""); if (lastSearchedUsername) dialog->UsernameField->setText(lastSearchedUsername); else dialog->UsernameField->setText(""); if (lastSearchedComment) dialog->CommentField->setText(lastSearchedComment); else dialog->CommentField->setText(""); DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; @@ -1175,65 +1222,65 @@ void ZSafe::listViewSelected( QListViewItem *_item) if (selectedItem != NULL) selectedItem->setSelected(FALSE); selectedItem = _item; #ifndef DESKTOP // set the column text dependent on the selected item ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); #endif #ifdef WIN32 // set the column text dependent on the selected item ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); #endif } 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; } void ZSafe::removeAsciiFile() { // QString fn = filename + ".txt"; // open the file dialog #ifndef DESKTOP #ifndef NO_OPIE QMap<QString, QStringList> mimeTypes; mimeTypes.insert(tr("All"), QStringList() ); mimeTypes.insert(tr("Text"), "text/*" ); QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, QDir::homeDirPath() + "/Documents/application/zsafe", QString::null, mimeTypes, this, tr ("Remove text file")); #else QString fn = ScQtFileEdit::getOpenFileName(this, tr ("Remove text file"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.txt"); #endif #else QString fn = QFileDialog::getOpenFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.txt)", this, "ZSafe File Dialog" @@ -1404,145 +1451,167 @@ void ZSafe::readAllEntries() QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; ) // si = si->nextSibling()) { QListViewItem *_si = si; si = si->nextSibling(); i->takeItem(_si); // remove from view list if (_si) delete _si; } } qWarning ("ReadAllEntries(): "); QTextStream t(&f); while ( !t.eof() ) { QString s = t.readLine(); s.replace (QRegExp("\";\""), "\"|\""); // char buffer[1024]; #ifndef WIN32 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; QString comment; QString field5=""; 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++; } Category *cat= categories.find (category); if (cat) { // use the existend item 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); QString icon; QString fullIconPath; QPixmap *pix; // #ifndef WIN32 icon = conf->readEntry(APP_KEY+category); // #endif bool isIconAv = false; if (!icon.isEmpty() && !icon.isNull()) { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (pix) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIconName (icon); c1->setIcon (*pix); isIconAv = true; } } if (!isIconAv) { c1->setIcon (*getPredefinedIcon(category)); } c1->setListItem (catI); c1->initListItem(); @@ -1684,80 +1753,94 @@ void ZSafe::readAllEntries() case 0: name = &i[1]; name.truncate(name.length() -1); // name break; case 1: // user user = &i[1]; user.truncate(user.length() -1); break; case 2: // password password = &i[1]; password.truncate(password.length() -1); break; case 3: // comment comment = &i[1]; comment.truncate(comment.length() -1); break; } idx++; } Category *cat= categories.find (category); if (cat) { // use the existend item 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); QString icon; QString fullIconPath; QPixmap *pix; // #ifndef WIN32 icon = conf->readEntry(APP_KEY+category); // #endif bool isIconAv = false; if (!icon.isEmpty() && !icon.isNull()) { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (pix) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIconName (icon); c1->setIcon (*pix); isIconAv = true; } } if (!isIconAv) { c1->setIcon (*getPredefinedIcon(category)); } c1->setListItem (catI); c1->initListItem(); @@ -1880,103 +1963,121 @@ bool ZSafe::openDocument(const char* _filename, const char* ) if (i < numberOfTries - 1) { switch( QMessageBox::warning( this, tr("ZSafe"), tr("Wrong password.\nEnter again?"), tr("&Yes"), tr("&No."), 0 ) ) { case 1: // No exitZs (1); break; case 0: // Yes continue; } } } if (pwdOk == 0) { // unset the document entry conf->writeEntry(APP_KEY+"document", "INVALIDPWD"); if (conf) delete conf; exitZs (1); } retval = loadEntry(entry); 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) { // use the existend item 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++; } } 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 if (expandTree) catI->setOpen( TRUE ); Category *c1 = new Category(); c1->setCategoryName(category); QString icon; QString fullIconPath; QPixmap *pix; // #ifndef WIN32 icon = conf->readEntry(APP_KEY+category); // #endif bool isIconAv = false; if (!icon.isEmpty() && !icon.isNull()) { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (pix) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIconName (icon); c1->setIcon (*pix); isIconAv = true; } } if (!isIconAv) { c1->setIcon (*getPredefinedIcon(category)); } @@ -2230,79 +2331,78 @@ bool ZSafe::saveDocument(const char* _filename, entry[i] = (char*)malloc(strlen("field5")+1); strcpy(entry[i++], "field5"); entry[i] = (char*)malloc(strlen("field6")+1); strcpy(entry[i++], "field6"); retval = saveEntry(entry); for (int z=0; z<i; z++) free(entry[z]); if (retval == PWERR_DATA) { qWarning("1: Error writing file, contents not saved"); saveFinalize(); return false; } // #ifndef WIN32 conf->writeEntry(APP_KEY+"valzsafe", 1); // #endif saveConf(); } QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); 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++) { free(entry[z]); } if (retval == PWERR_DATA) { qWarning("1: Error writing file, contents not saved"); saveFinalize(); return false; } } } if (saveFinalize() == PWERR_DATA) { qWarning("2: Error writing file, contents not saved"); return false; } else { #ifndef DESKTOP Global::statusMessage (tr("Password file saved.")); #endif modified = false; return true; } } PasswordForm *newPwdDialog; bool newPwdDialogResult = false; void ZSafe::setPasswordDialogDone() { newPwdDialogResult = true; @@ -3174,66 +3274,71 @@ void ZSafe::editCategory() if (icon != "predefined.png") { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (pix) { // save the full pixmap name into the config file // #ifndef WIN32 conf->writeEntry(APP_KEY+category, icon); // #endif saveConf(); QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); cat->setIconName (icon); cat->setIcon (*pix); } } else { // #ifndef WIN32 conf->removeEntry (category); // #endif saveConf(); cat->setIcon (*getPredefinedIcon(category)); } // change the category name of the selected category 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); } } saveCategoryDialogFields(dialog); } else { // delete dialog; dialog->hide(); return; } } } void ZSafe::cutItem() { if (!selectedItem) return; if (!isCategory(selectedItem)) { IsCut = true; copiedItem = selectedItem; } } void ZSafe::copyItem() { if (!selectedItem) return; if (!isCategory(selectedItem)) @@ -3500,77 +3605,99 @@ void ZSafe::saveDocumentAs() filename = newFile; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); #ifdef WIN32 this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif QMessageBox::information( this, tr("ZSafe"), tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); saveDocumentWithPwd(); } } void ZSafe::saveDocumentWithoutPwd() { saveDocument(filename, FALSE); } void ZSafe::saveDocumentWithPwd() { saveDocument(filename, TRUE); } 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>"); 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></div>"; info += "</body></html>"; +#endif // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); QMessageBox mb( this, tr("ZSafe")); mb.setText (info); mb.setButtonText (QMessageBox::Ok, tr ("&OK")); QPixmap zsafe_img((const char**) zsafe_xpm); mb.setIconPixmap (zsafe_img); mb.exec(); } void ZSafe::setExpandFlag() { expandTree = !expandTree; file->setItemChecked('o', expandTree); #ifndef DESKTOP conf->setGroup ("zsafePrefs"); #endif // #ifndef WIN32 conf->writeEntry (APP_KEY+"expandTree", expandTree); // #endif saveConf(); } void ZSafe::paintEvent( QPaintEvent * ) { if (raiseFlag) { raiseFlag = false; raiseTimer.start (1, true); if (infoForm->isVisible()) |