-rw-r--r-- | korganizer/kolistview.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index bbf83d9..fd86095 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -371,8 +371,6 @@ void KOListView::setAlarm() KOAlarmPrefs kap( this); if ( !kap.exec() ) return; - - QStringList itemList; QPtrList<KOListViewItem> sel ; QListViewItem *qitem = mListView->firstChild (); @@ -428,11 +426,9 @@ void KOListView::setAlarm() alarm->setType(Alarm::Invalid); } } - temp = item; + ListItemVisitor v(item, mStartDate ); + inc->accept(v); item = sel.next(); - mUidDict.remove( inc->uid() ); - delete temp;; - addIncidence( inc ); } topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); qDebug("KO: Set alarm for %d items", count); @@ -443,6 +439,7 @@ void KOListView::setCategories( bool removeOld ) { KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); + csd->setColorEnabled(); if (! csd->exec()) { delete csd; return; @@ -451,7 +448,7 @@ void KOListView::setCategories( bool removeOld ) delete csd; // if ( catList.count() == 0 ) // return; - catList.sort(); + //catList.sort(); QString categoriesStr = catList.join(","); int i; QStringList itemList; @@ -465,25 +462,29 @@ void KOListView::setCategories( bool removeOld ) } KOListViewItem * item, *temp; item = sel.first(); - Incidence* inc; + if( item ) { + Incidence* inc = item->data() ; + bool setSub = false; + if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { + int result = KMessageBox::warningYesNoCancel(this, + i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), + i18n("Todo has subtodos"), + i18n("Yes"), + i18n("No")); + if (result == KMessageBox::Cancel) item = 0; + if (result == KMessageBox::Yes) setSub = true; + } while ( item ) { inc = item->data(); if ( removeOld ) { - inc->setCategories( categoriesStr ); + inc->setCategories( catList, setSub ); } else { - itemList = QStringList::split (",", inc->categoriesStr() ); - for( i = 0; i< catList.count(); ++i ) { - if ( !itemList.contains (catList[i])) - itemList.append( catList[i] ); - } - itemList.sort(); - inc->setCategories( itemList.join(",") ); + inc->addCategories( catList, setSub ); } - temp = item; + ListItemVisitor v(item, mStartDate ); + inc->accept(v); item = sel.next(); - mUidDict.remove( inc->uid() ); - delete temp;; - addIncidence( inc ); + } } QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); } |