summaryrefslogtreecommitdiff
authorzcarsten <zcarsten>2003-08-06 20:59:20 (UTC)
committer zcarsten <zcarsten>2003-08-06 20:59:20 (UTC)
commit557e7a9f407e77a3f5bcfda5de9a8408379165ac (patch) (unidiff)
tree4ad5296b9f4858b3e0791c321116449d7c99ef00
parente14f10f07d8477ee49cd487587732e27a3307878 (diff)
downloadopie-557e7a9f407e77a3f5bcfda5de9a8408379165ac.zip
opie-557e7a9f407e77a3f5bcfda5de9a8408379165ac.tar.gz
opie-557e7a9f407e77a3f5bcfda5de9a8408379165ac.tar.bz2
bug fixed: icon handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index e86b3d2..9341425 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -2765,161 +2765,165 @@ void ZSafe::delCategory()
2765// #ifndef WIN32 2765// #ifndef WIN32
2766 conf->removeEntry (selectedItem->text(0)); 2766 conf->removeEntry (selectedItem->text(0));
2767// #endif 2767// #endif
2768 saveConf(); 2768 saveConf();
2769 2769
2770 // Delete the selected item and all subitems 2770 // Delete the selected item and all subitems
2771 // step through all subitems 2771 // step through all subitems
2772 QListViewItem *si; 2772 QListViewItem *si;
2773 for (si = selectedItem->firstChild(); 2773 for (si = selectedItem->firstChild();
2774 si != NULL; ) 2774 si != NULL; )
2775 { 2775 {
2776 QListViewItem *_si = si; 2776 QListViewItem *_si = si;
2777 si = si->nextSibling(); 2777 si = si->nextSibling();
2778 selectedItem->takeItem(_si); // remove from view list 2778 selectedItem->takeItem(_si); // remove from view list
2779 if (_si) delete _si; 2779 if (_si) delete _si;
2780 } 2780 }
2781 ListView->takeItem(selectedItem); 2781 ListView->takeItem(selectedItem);
2782 delete selectedItem; 2782 delete selectedItem;
2783 2783
2784 selectedItem = NULL; 2784 selectedItem = NULL;
2785 break; 2785 break;
2786 case 1: // Don't delete 2786 case 1: // Don't delete
2787 break; 2787 break;
2788 } 2788 }
2789 2789
2790 } 2790 }
2791} 2791}
2792 2792
2793void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) 2793void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2794{ 2794{
2795 if (!dialog) 2795 if (!dialog)
2796 return; 2796 return;
2797 2797
2798 QString icon; 2798 QString icon;
2799 if (selectedItem) 2799 if (selectedItem)
2800 { 2800 {
2801 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 2801 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
2802 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 2802 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
2803 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 2803 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
2804 dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 2804 dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
2805 dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4"))); 2805 dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
2806 dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); 2806 dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
2807 2807
2808 Category *cat= categories.find (selectedItem->text(0)); 2808 Category *cat= categories.find (selectedItem->text(0));
2809 if (cat) 2809 if (cat)
2810 { 2810 {
2811 icon = cat->getIconName(); 2811 icon = cat->getIconName();
2812 } 2812 }
2813 else
2814 icon = conf->readEntry(APP_KEY+selectedItem->text(0));
2813 } 2815 }
2814 else 2816 else
2815 { 2817 {
2816 dialog->Field1->setText(tr("Name")); 2818 dialog->Field1->setText(tr("Name"));
2817 dialog->Field2->setText(tr("Username")); 2819 dialog->Field2->setText(tr("Username"));
2818 dialog->Field3->setText(tr("Password")); 2820 dialog->Field3->setText(tr("Password"));
2819 dialog->Field4->setText(tr("Comment")); 2821 dialog->Field4->setText(tr("Comment"));
2820 dialog->Field5->setText(tr("Field 4")); 2822 dialog->Field5->setText(tr("Field 4"));
2821 dialog->Field6->setText(tr("Field 5")); 2823 dialog->Field6->setText(tr("Field 5"));
2822 } 2824 }
2823 2825
2824#ifdef DESKTOP 2826#ifdef DESKTOP
2825 QDir d(iconPath); 2827 QDir d(iconPath);
2826#else 2828#else
2827 QDir d(QPEApplication::qpeDir() + "/pics/"); 2829 QDir d(QPEApplication::qpeDir() + "/pics/");
2828#endif 2830#endif
2829 d.setFilter( QDir::Files); 2831 d.setFilter( QDir::Files);
2830 2832
2831 const QFileInfoList *list = d.entryInfoList(); 2833 const QFileInfoList *list = d.entryInfoList();
2832 int i=0; 2834 int i=0;
2833 QFileInfoListIterator it( *list ); // create list iterator 2835 QFileInfoListIterator it( *list ); // create list iterator
2834 QFileInfo *fi; // pointer for traversing 2836 QFileInfo *fi; // pointer for traversing
2835 if (icon.isEmpty() || icon.isNull()) 2837 if (icon.isEmpty() || icon.isNull())
2836 { 2838 {
2837 dialog->IconField->setCurrentItem(0); 2839 dialog->IconField->setCurrentItem(0);
2838 } 2840 }
2839 else 2841 else
2840 { 2842 {
2841 while ( (fi=it.current()) ) 2843 while ( (fi=it.current()) )
2842 { // for each file... 2844 { // for each file...
2843 QString fileName = fi->fileName(); 2845 QString fileName = fi->fileName();
2844 if(fileName.right(4) == ".png") 2846 if(fileName.right(4) == ".png")
2845 { 2847 {
2846 fileName = fileName.mid(0,fileName.length()-4); 2848 fileName = fileName.mid(0,fileName.length()-4);
2847 2849
2848 if(fileName+".png"==icon) 2850 if(fileName+".png"==icon)
2849 { 2851 {
2850 dialog->IconField->setCurrentItem(i+1); 2852 dialog->IconField->setCurrentItem(i+1);
2851 break; 2853 break;
2852 } 2854 }
2853 ++i; 2855 ++i;
2854 } 2856 }
2855 ++it; 2857 ++it;
2856 } 2858 }
2857 } 2859 }
2858} 2860}
2859 2861
2860void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) 2862void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
2861{ 2863{
2862 if (!dialog) 2864 if (!dialog)
2863 return; 2865 return;
2864 2866
2865 dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); 2867 dialog->Field1->setText(getFieldLabel (category, "1", tr("Name")));
2866 dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); 2868 dialog->Field2->setText(getFieldLabel (category, "2", tr("Username")));
2867 dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); 2869 dialog->Field3->setText(getFieldLabel (category, "3", tr("Password")));
2868 dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); 2870 dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment")));
2869 dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); 2871 dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4")));
2870 dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); 2872 dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5")));
2871 2873
2872 QString icon; 2874 QString icon;
2873 Category *cat= categories.find (category); 2875 Category *cat= categories.find (category);
2874 if (cat) 2876 if (cat)
2875 { 2877 {
2876 icon = cat->getIconName(); 2878 icon = cat->getIconName();
2877 } 2879 }
2880 else
2881 icon = conf->readEntry(APP_KEY+category);
2878 2882
2879#ifdef DESKTOP 2883#ifdef DESKTOP
2880 QDir d(iconPath); 2884 QDir d(iconPath);
2881#else 2885#else
2882 QDir d(QPEApplication::qpeDir() + "/pics/"); 2886 QDir d(QPEApplication::qpeDir() + "/pics/");
2883#endif 2887#endif
2884 d.setFilter( QDir::Files); 2888 d.setFilter( QDir::Files);
2885 2889
2886 const QFileInfoList *list = d.entryInfoList(); 2890 const QFileInfoList *list = d.entryInfoList();
2887 int i=0; 2891 int i=0;
2888 QFileInfoListIterator it( *list ); // create list iterator 2892 QFileInfoListIterator it( *list ); // create list iterator
2889 QFileInfo *fi; // pointer for traversing 2893 QFileInfo *fi; // pointer for traversing
2890 if (icon.isEmpty() || icon.isNull()) 2894 if (icon.isEmpty() || icon.isNull())
2891 { 2895 {
2892 dialog->IconField->setCurrentItem(0); 2896 dialog->IconField->setCurrentItem(0);
2893 } 2897 }
2894 else 2898 else
2895 { 2899 {
2896 while ( (fi=it.current()) ) 2900 while ( (fi=it.current()) )
2897 { // for each file... 2901 { // for each file...
2898 QString fileName = fi->fileName(); 2902 QString fileName = fi->fileName();
2899 if(fileName.right(4) == ".png") 2903 if(fileName.right(4) == ".png")
2900 { 2904 {
2901 fileName = fileName.mid(0,fileName.length()-4); 2905 fileName = fileName.mid(0,fileName.length()-4);
2902 2906
2903 if(fileName+".png"==icon) 2907 if(fileName+".png"==icon)
2904 { 2908 {
2905 dialog->IconField->setCurrentItem(i+1); 2909 dialog->IconField->setCurrentItem(i+1);
2906 break; 2910 break;
2907 } 2911 }
2908 ++i; 2912 ++i;
2909 } 2913 }
2910 ++it; 2914 ++it;
2911 } 2915 }
2912 } 2916 }
2913} 2917}
2914 2918
2915void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) 2919void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
2916{ 2920{
2917 QString app_key = APP_KEY; 2921 QString app_key = APP_KEY;
2918#ifndef DESKTOP 2922#ifndef DESKTOP
2919 conf->setGroup ("fieldDefs"); 2923 conf->setGroup ("fieldDefs");
2920#else 2924#else
2921#ifndef WIN32 2925#ifndef WIN32
2922 app_key += "/fieldDefs/"; 2926 app_key += "/fieldDefs/";
2923#endif 2927#endif
2924#endif 2928#endif
2925 QString category = dialog->CategoryField->currentText(); 2929 QString category = dialog->CategoryField->currentText();