author | zcarsten <zcarsten> | 2003-08-01 07:01:38 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-08-01 07:01:38 (UTC) |
commit | cb45aa10043fdd6fddcab42ef0e07ddafc3d506d (patch) (unidiff) | |
tree | 3d9e33ec1a9d9d3e93a0b72b9adf9d6e3c08e2ba | |
parent | 274bfafbda8d1d9af6cc5d1ced828a97a47c3f55 (diff) | |
download | opie-cb45aa10043fdd6fddcab42ef0e07ddafc3d506d.zip opie-cb45aa10043fdd6fddcab42ef0e07ddafc3d506d.tar.gz opie-cb45aa10043fdd6fddcab42ef0e07ddafc3d506d.tar.bz2 |
editCategory improved: icon field is changed depending on the selected category
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index abf6511..ef16b46 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -2794,2 +2794,44 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) | |||
2794 | dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); | 2794 | dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); |
2795 | |||
2796 | QString icon; | ||
2797 | Category *cat= categories.find (selectedItem->text(0)); | ||
2798 | if (cat) | ||
2799 | { | ||
2800 | icon = cat->getIconName(); | ||
2801 | } | ||
2802 | |||
2803 | #ifdef DESKTOP | ||
2804 | QDir d(iconPath); | ||
2805 | #else | ||
2806 | QDir d(QPEApplication::qpeDir() + "/pics/"); | ||
2807 | #endif | ||
2808 | d.setFilter( QDir::Files); | ||
2809 | |||
2810 | const QFileInfoList *list = d.entryInfoList(); | ||
2811 | int i=0; | ||
2812 | QFileInfoListIterator it( *list ); // create list iterator | ||
2813 | QFileInfo *fi; // pointer for traversing | ||
2814 | if (icon.isEmpty() || icon.isNull()) | ||
2815 | { | ||
2816 | dialog->IconField->setCurrentItem(0); | ||
2817 | } | ||
2818 | else | ||
2819 | { | ||
2820 | while ( (fi=it.current()) ) | ||
2821 | { // for each file... | ||
2822 | QString fileName = fi->fileName(); | ||
2823 | if(fileName.right(4) == ".png") | ||
2824 | { | ||
2825 | fileName = fileName.mid(0,fileName.length()-4); | ||
2826 | |||
2827 | if(fileName+".png"==icon) | ||
2828 | { | ||
2829 | dialog->IconField->setCurrentItem(i+1); | ||
2830 | break; | ||
2831 | } | ||
2832 | ++i; | ||
2833 | } | ||
2834 | ++it; | ||
2835 | } | ||
2836 | } | ||
2795 | } | 2837 | } |
@@ -2804,2 +2846,44 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) | |||
2804 | dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); | 2846 | dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); |
2847 | |||
2848 | QString icon; | ||
2849 | Category *cat= categories.find (category); | ||
2850 | if (cat) | ||
2851 | { | ||
2852 | icon = cat->getIconName(); | ||
2853 | } | ||
2854 | |||
2855 | #ifdef DESKTOP | ||
2856 | QDir d(iconPath); | ||
2857 | #else | ||
2858 | QDir d(QPEApplication::qpeDir() + "/pics/"); | ||
2859 | #endif | ||
2860 | d.setFilter( QDir::Files); | ||
2861 | |||
2862 | const QFileInfoList *list = d.entryInfoList(); | ||
2863 | int i=0; | ||
2864 | QFileInfoListIterator it( *list ); // create list iterator | ||
2865 | QFileInfo *fi; // pointer for traversing | ||
2866 | if (icon.isEmpty() || icon.isNull()) | ||
2867 | { | ||
2868 | dialog->IconField->setCurrentItem(0); | ||
2869 | } | ||
2870 | else | ||
2871 | { | ||
2872 | while ( (fi=it.current()) ) | ||
2873 | { // for each file... | ||
2874 | QString fileName = fi->fileName(); | ||
2875 | if(fileName.right(4) == ".png") | ||
2876 | { | ||
2877 | fileName = fileName.mid(0,fileName.length()-4); | ||
2878 | |||
2879 | if(fileName+".png"==icon) | ||
2880 | { | ||
2881 | dialog->IconField->setCurrentItem(i+1); | ||
2882 | break; | ||
2883 | } | ||
2884 | ++i; | ||
2885 | } | ||
2886 | ++it; | ||
2887 | } | ||
2888 | } | ||
2805 | } | 2889 | } |