summaryrefslogtreecommitdiff
authorzcarsten <zcarsten>2003-08-14 07:10:23 (UTC)
committer zcarsten <zcarsten>2003-08-14 07:10:23 (UTC)
commit1ff9232b95b7f8ea0d841a3b9219eaa7e82f1d62 (patch) (side-by-side diff)
tree953026506eca01ba05fbee7a97e6c321750587f0
parent7812d22080064f97d964dcbc3b085fde586a97d7 (diff)
downloadopie-1ff9232b95b7f8ea0d841a3b9219eaa7e82f1d62.zip
opie-1ff9232b95b7f8ea0d841a3b9219eaa7e82f1d62.tar.gz
opie-1ff9232b95b7f8ea0d841a3b9219eaa7e82f1d62.tar.bz2
code clean up against previous version
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp106
1 files changed, 19 insertions, 87 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index d55624b..43565ee 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -98,12 +98,16 @@ extern int DeskW, DeskH;
#ifdef DESKTOP
extern QApplication *appl;
#else
extern QPEApplication *appl;
#endif
+#ifdef JPATCH_HDE
+#define tr(arg) arg
+#endif
+
#ifdef DESKTOP
#ifndef WIN32
const QString APP_KEY="/.zsafe/";
#else
const QString APP_KEY="";
@@ -494,13 +498,17 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
if (!pd1.exists())
{
QDir pd1("Documents");
if (!pd1.mkdir("application", FALSE))
{
QMessageBox::critical( 0, tr("ZSafe"),
+#ifdef JPATCH_HDE
+ tr("Can't create directory\n.../Documents/application\n\nZSafe will now exit."));
+#else
tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1));
+#endif
exitZs (1);
}
}
// #ifndef WIN32
// QString d2("Documents/application/zsafe");
// #else
@@ -510,13 +518,17 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
if (!pd2.exists())
{
QDir pd2("Documents/application");
if (!pd2.mkdir("zsafe", FALSE))
{
QMessageBox::critical( 0, tr("ZSafe"),
+#ifdef JPATCH_HDE
+ tr("Can't create directory\n...//Documents/application/zsafe\n\nZSafe will now exit."));
+#else
tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2));
+#endif
exitZs (1);
}
}
// set the default filename
@@ -772,28 +784,12 @@ void ZSafe::editPwd()
#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));
@@ -803,13 +799,12 @@ void ZSafe::editPwd()
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
{
@@ -868,39 +863,24 @@ retype:
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;
}
}
@@ -1542,50 +1522,33 @@ void ZSafe::readAllEntries()
{
// 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;
@@ -1779,42 +1742,30 @@ void ZSafe::readAllEntries()
{
// 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;
@@ -2006,52 +1957,37 @@ bool ZSafe::openDocument(const char* _filename, const char* )
{
// 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);
@@ -3300,19 +3236,15 @@ void ZSafe::editCategory()
// 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);
}