-rw-r--r-- | libkdepim/categoryselectdialog.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index 8b2bc4e..8038934 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp @@ -81,156 +81,155 @@ CategorySelectDialog::~CategorySelectDialog() { } void CategorySelectDialog::setSelected(const QStringList &selList) { clear(); QStringList::ConstIterator it; QStringList notFound; bool found = false; for (it=selList.begin();it!=selList.end();++it) { //qDebug(" CategorySelectDialog::setSelected("); QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { if (item->text() == *it) { item->setOn(true); if ( ! found ) setColorItem( item ); found = true; break; } item = (QCheckListItem *)item->nextSibling(); } // if ( ! found ) { //emit updateCategoriesGlobal(); // QMessageBox::information( this, "KO/E: Information!", // "Categories found, which were not\n" // "in list of categories!\n" // "message", // "OK", "", 0, // 0, 1 ); // setSelected(selList); // return; // } } } QStringList CategorySelectDialog::selectedCategories() const { return mCategoryList; } void CategorySelectDialog::setColorEnabled() { mColorEnabled = true; mSetColorCat->show(); } void CategorySelectDialog::setColorCat() { QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem (); if ( !newColorItem ) { KMessageBox::error(this,i18n("There is no current item.")); return; } if ( !newColorItem->isOn() ) newColorItem->setOn( true ); setColorItem( newColorItem ); } void CategorySelectDialog::clicked ( QListViewItem * it ) { if ( ! it ) return; QCheckListItem *i = (QCheckListItem *) it; - qDebug("click %d ", i->isOn()); if ( !i->isOn() && i==mColorItem) { setColorItem( 0); QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { if (item->isOn()) { setColorItem( item ); break; } item = (QCheckListItem *)item->nextSibling(); } } else if ( i->isOn() && !mColorItem) { setColorItem( i); } } void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem ) { if ( !mColorEnabled ) return; if ( mColorItem == newColorItem) return; if ( mColorItem ) { mColorItem->setPixmap ( 0, QPixmap() ); mColorItem = 0; } if ( newColorItem ) { QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 ); - pix.fill(Qt::blue ); + pix.fill(Qt::red ); newColorItem->setPixmap ( 0, pix ); mColorItem = newColorItem; } } void CategorySelectDialog::slotApply() { QStringList categories; QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); QString colcat; while (item) { if (item->isOn()) { if ( item == mColorItem) colcat = item->text(); else categories.append(item->text()); } item = (QCheckListItem *)item->nextSibling(); } categories.sort(); if ( ! colcat.isEmpty() ) categories.prepend( colcat ); QString categoriesStr = categories.join(","); mCategoryList = categories; emit categoriesSelected(categories); emit categoriesSelected(categoriesStr); } void CategorySelectDialog::accept() { slotOk(); } void CategorySelectDialog::slotOk() { slotApply(); QDialog::accept(); } void CategorySelectDialog::clear() { QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { item->setOn(false); item = (QCheckListItem *)item->nextSibling(); } } void CategorySelectDialog::updateCategoryConfig() { QStringList selected; QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { if (item->isOn()) { selected.append(item->text()); } item = (QCheckListItem *)item->nextSibling(); } setCategories(); setSelected(selected); } |