summaryrefslogtreecommitdiff
authorzcarsten <zcarsten>2003-08-06 20:15:19 (UTC)
committer zcarsten <zcarsten>2003-08-06 20:15:19 (UTC)
commite14f10f07d8477ee49cd487587732e27a3307878 (patch) (unidiff)
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
@@ -2594,12 +2594,13 @@ void ZSafe::addCategory()
2594 } 2594 }
2595 f.close(); 2595 f.close();
2596 } 2596 }
2597#endif 2597#endif
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() )
2602 { 2603 {
2603 QString *cat = new QString (*it); 2604 QString *cat = new QString (*it);
2604 if (cat->contains("-field1", FALSE)) 2605 if (cat->contains("-field1", FALSE))
2605 { 2606 {
@@ -2615,19 +2616,24 @@ void ZSafe::addCategory()
2615 cat->truncate(pos); 2616 cat->truncate(pos);
2616 categ = *cat; 2617 categ = *cat;
2617#endif 2618#endif
2618 if (!categ.isEmpty()) 2619 if (!categ.isEmpty())
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 }
2623 ++it; 2626 ++it;
2624 } 2627 }
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);
2630 2636
2631 if (initIcons) 2637 if (initIcons)
2632 { 2638 {
2633 Wait waitDialog(this, tr("Wait dialog")); 2639 Wait waitDialog(this, tr("Wait dialog"));
@@ -2783,24 +2789,39 @@ void ZSafe::delCategory()
2783 2789
2784 } 2790 }
2785} 2791}
2786 2792
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
2803#ifdef DESKTOP 2824#ifdef DESKTOP
2804 QDir d(iconPath); 2825 QDir d(iconPath);
2805#else 2826#else
2806 QDir d(QPEApplication::qpeDir() + "/pics/"); 2827 QDir d(QPEApplication::qpeDir() + "/pics/");
@@ -2835,12 +2856,15 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2835 } 2856 }
2836 } 2857 }
2837} 2858}
2838 2859
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")));
2843 dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); 2867 dialog->Field3->setText(getFieldLabel (category, "3", tr("Password")));
2844 dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); 2868 dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment")));
2845 dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); 2869 dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4")));
2846 dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); 2870 dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5")));