author | zcarsten <zcarsten> | 2003-08-06 20:59:20 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-08-06 20:59:20 (UTC) |
commit | 557e7a9f407e77a3f5bcfda5de9a8408379165ac (patch) (side-by-side diff) | |
tree | 4ad5296b9f4858b3e0791c321116449d7c99ef00 | |
parent | e14f10f07d8477ee49cd487587732e27a3307878 (diff) | |
download | opie-557e7a9f407e77a3f5bcfda5de9a8408379165ac.zip opie-557e7a9f407e77a3f5bcfda5de9a8408379165ac.tar.gz opie-557e7a9f407e77a3f5bcfda5de9a8408379165ac.tar.bz2 |
bug fixed: icon handling
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 4 |
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() // #ifndef WIN32 conf->removeEntry (selectedItem->text(0)); // #endif saveConf(); // Delete the selected item and all subitems // step through all subitems QListViewItem *si; for (si = selectedItem->firstChild(); si != NULL; ) { QListViewItem *_si = si; si = si->nextSibling(); selectedItem->takeItem(_si); // remove from view list if (_si) delete _si; } ListView->takeItem(selectedItem); delete selectedItem; selectedItem = NULL; break; case 1: // Don't delete break; } } } void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) { if (!dialog) return; QString icon; if (selectedItem) { 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 + icon = conf->readEntry(APP_KEY+selectedItem->text(0)); } 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 QDir d(iconPath); #else QDir d(QPEApplication::qpeDir() + "/pics/"); #endif d.setFilter( QDir::Files); const QFileInfoList *list = d.entryInfoList(); int i=0; QFileInfoListIterator it( *list ); // create list iterator QFileInfo *fi; // pointer for traversing if (icon.isEmpty() || icon.isNull()) { dialog->IconField->setCurrentItem(0); } else { while ( (fi=it.current()) ) { // for each file... QString fileName = fi->fileName(); if(fileName.right(4) == ".png") { fileName = fileName.mid(0,fileName.length()-4); if(fileName+".png"==icon) { dialog->IconField->setCurrentItem(i+1); break; } ++i; } ++it; } } } 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"))); dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); QString icon; Category *cat= categories.find (category); if (cat) { icon = cat->getIconName(); } + else + icon = conf->readEntry(APP_KEY+category); #ifdef DESKTOP QDir d(iconPath); #else QDir d(QPEApplication::qpeDir() + "/pics/"); #endif d.setFilter( QDir::Files); const QFileInfoList *list = d.entryInfoList(); int i=0; QFileInfoListIterator it( *list ); // create list iterator QFileInfo *fi; // pointer for traversing if (icon.isEmpty() || icon.isNull()) { dialog->IconField->setCurrentItem(0); } else { while ( (fi=it.current()) ) { // for each file... QString fileName = fi->fileName(); if(fileName.right(4) == ".png") { fileName = fileName.mid(0,fileName.length()-4); if(fileName+".png"==icon) { dialog->IconField->setCurrentItem(i+1); break; } ++i; } ++it; } } } void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) { QString app_key = APP_KEY; #ifndef DESKTOP conf->setGroup ("fieldDefs"); #else #ifndef WIN32 app_key += "/fieldDefs/"; #endif #endif QString category = dialog->CategoryField->currentText(); |