summaryrefslogtreecommitdiff
authorzcarsten <zcarsten>2003-08-06 20:15:19 (UTC)
committer zcarsten <zcarsten>2003-08-06 20:15:19 (UTC)
commite14f10f07d8477ee49cd487587732e27a3307878 (patch) (side-by-side diff)
treee46ff1986ce5c0cbba2283d80a878df432f874d8
parentba25812361114b7cf059a3a1fb3aed42f8a7ebde (diff)
downloadopie-e14f10f07d8477ee49cd487587732e27a3307878.zip
opie-e14f10f07d8477ee49cd487587732e27a3307878.tar.gz
opie-e14f10f07d8477ee49cd487587732e27a3307878.tar.bz2
addCategory corrected
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp44
1 files changed, 34 insertions, 10 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index ef16b46..e86b3d2 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -2597,6 +2597,7 @@ void ZSafe::addCategory()
#endif
QStringList::Iterator it = list.begin();
QString categ;
+ QString firstCategory;
dialog->CategoryField->clear(); // remove all items
while( it != list.end() )
{
@@ -2618,13 +2619,18 @@ void ZSafe::addCategory()
if (!categ.isEmpty())
{
dialog->CategoryField->insertItem (categ, -1);
+ if (firstCategory.isEmpty())
+ firstCategory = categ;
}
}
++it;
}
- setCategoryDialogFields(dialog);
+ if (firstCategory.isEmpty())
+ setCategoryDialogFields(dialog);
+ else
+ setCategoryDialogFields(dialog, firstCategory);
// CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE);
@@ -2786,18 +2792,33 @@ void ZSafe::delCategory()
void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
{
- dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
- dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
- dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
- dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
- dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
- dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
+ if (!dialog)
+ return;
QString icon;
- Category *cat= categories.find (selectedItem->text(0));
- if (cat)
+ if (selectedItem)
{
- icon = cat->getIconName();
+ dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
+ dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
+ dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
+ dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
+ dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
+ dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
+
+ Category *cat= categories.find (selectedItem->text(0));
+ if (cat)
+ {
+ icon = cat->getIconName();
+ }
+ }
+ else
+ {
+ dialog->Field1->setText(tr("Name"));
+ dialog->Field2->setText(tr("Username"));
+ dialog->Field3->setText(tr("Password"));
+ dialog->Field4->setText(tr("Comment"));
+ dialog->Field5->setText(tr("Field 4"));
+ dialog->Field6->setText(tr("Field 5"));
}
#ifdef DESKTOP
@@ -2838,6 +2859,9 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
{
+ if (!dialog)
+ return;
+
dialog->Field1->setText(getFieldLabel (category, "1", tr("Name")));
dialog->Field2->setText(getFieldLabel (category, "2", tr("Username")));
dialog->Field3->setText(getFieldLabel (category, "3", tr("Password")));