summaryrefslogtreecommitdiff
Unidiff
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
@@ -2598,4 +2598,5 @@ void ZSafe::addCategory()
2598 QStringList::Iterator it = list.begin(); 2598 QStringList::Iterator it = list.begin();
2599 QString categ; 2599 QString categ;
2600 QString firstCategory;
2600 dialog->CategoryField->clear(); // remove all items 2601 dialog->CategoryField->clear(); // remove all items
2601 while( it != list.end() ) 2602 while( it != list.end() )
@@ -2619,4 +2620,6 @@ void ZSafe::addCategory()
2619 { 2620 {
2620 dialog->CategoryField->insertItem (categ, -1); 2621 dialog->CategoryField->insertItem (categ, -1);
2622 if (firstCategory.isEmpty())
2623 firstCategory = categ;
2621 } 2624 }
2622 } 2625 }
@@ -2625,5 +2628,8 @@ void ZSafe::addCategory()
2625 2628
2626 2629
2627 setCategoryDialogFields(dialog); 2630 if (firstCategory.isEmpty())
2631 setCategoryDialogFields(dialog);
2632 else
2633 setCategoryDialogFields(dialog, firstCategory);
2628 2634
2629 // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); 2635 // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE);
@@ -2787,16 +2793,31 @@ void ZSafe::delCategory()
2787void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) 2793void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2788{ 2794{
2789 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 2795 if (!dialog)
2790 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 2796 return;
2791 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
2792 dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
2793 dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
2794 dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
2795 2797
2796 QString icon; 2798 QString icon;
2797 Category *cat= categories.find (selectedItem->text(0)); 2799 if (selectedItem)
2798 if (cat)
2799 { 2800 {
2800 icon = cat->getIconName(); 2801 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
2802 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
2803 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
2804 dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
2805 dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
2806 dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
2807
2808 Category *cat= categories.find (selectedItem->text(0));
2809 if (cat)
2810 {
2811 icon = cat->getIconName();
2812 }
2813 }
2814 else
2815 {
2816 dialog->Field1->setText(tr("Name"));
2817 dialog->Field2->setText(tr("Username"));
2818 dialog->Field3->setText(tr("Password"));
2819 dialog->Field4->setText(tr("Comment"));
2820 dialog->Field5->setText(tr("Field 4"));
2821 dialog->Field6->setText(tr("Field 5"));
2801 } 2822 }
2802 2823
@@ -2839,4 +2860,7 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2839void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) 2860void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
2840{ 2861{
2862 if (!dialog)
2863 return;
2864
2841 dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); 2865 dialog->Field1->setText(getFieldLabel (category, "1", tr("Name")));
2842 dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); 2866 dialog->Field2->setText(getFieldLabel (category, "2", tr("Username")));