summaryrefslogtreecommitdiff
path: root/noncore/apps/zsafe/zsafe.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/zsafe/zsafe.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index ee1da77..bdd2aed 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -754,56 +754,50 @@ void ZSafe::editPwd()
NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE);
#ifdef WIN32
dialog->setCaption ("Qt " + tr("Edit 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")));
// 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();
+
+ DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
#ifdef DESKTOP
result = Accepted;
#endif
if (result == Accepted)
{
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));
}
delete dialog;
@@ -819,63 +813,57 @@ 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();
+
+ DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
#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);
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();
@@ -1167,64 +1155,59 @@ void ZSafe::showInfo( QListViewItem *_item)
text += "<u><b>";
text += getFieldLabel (selectedItem, "6", tr("Field 5"));
text += ":<br> </b></u><blockquote>";
text += entry;
text += "</blockquote>";
// text += "<br>";
}
entry = selectedItem->text(3);
if (!entry.isEmpty() && entry.compare(" "))
{
text += "<u><b>";
text += getFieldLabel (selectedItem, "4", tr("Comment"));
text += ":<br> </b></u>";
QString comment = selectedItem->text(3);
comment.replace (QRegExp("\n"), "<br>");
text += comment;
// text += "<br>";
}
text += "</body></html>";
infoForm->InfoText->setText(text);
infoForm->hide();
-#ifdef DESKTOP
- infoForm->show();
-#else
- infoForm->showMaximized();
-#endif
-
+ QPEApplication::showDialog( infoForm );
}
}
void ZSafe::listViewSelected( QListViewItem *_item)
{
if (!_item)
return;
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)