summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1a1bce5..3011458 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -952,29 +952,36 @@ QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
953 } 953 }
954 954
955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
956 return tempMenu; 956 return tempMenu;
957 957
958 958
959} 959}
960void KOTodoView::changedCategories(int index) 960void KOTodoView::changedCategories(int index)
961{ 961{
962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
963 QStringList categories = mActiveItem->todo()->categories (); 963 QStringList categories = mActiveItem->todo()->categories ();
964 QString colcat = categories.first();
964 if (categories.find (mCategory[index]) != categories.end ()) 965 if (categories.find (mCategory[index]) != categories.end ())
965 categories.remove (mCategory[index]); 966 categories.remove (mCategory[index]);
966 else 967 else
967 categories.insert (categories.end(), mCategory[index]); 968 categories.insert (categories.end(), mCategory[index]);
968 categories.sort (); 969 categories.sort ();
970 if ( !colcat.isEmpty() ) {
971 if ( categories.find ( colcat ) != categories.end () ) {
972 categories.remove( colcat );
973 categories.prepend( colcat );
974 }
975 }
969 mActiveItem->todo()->setCategories (categories); 976 mActiveItem->todo()->setCategories (categories);
970 mActiveItem->construct(); 977 mActiveItem->construct();
971 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 978 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
972 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 979 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
973 } 980 }
974} 981}
975void KOTodoView::itemDoubleClicked(QListViewItem *item) 982void KOTodoView::itemDoubleClicked(QListViewItem *item)
976{ 983{
977 if ( pendingSubtodo != 0 ) { 984 if ( pendingSubtodo != 0 ) {
978 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 985 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
979 } 986 }
980 pendingSubtodo = 0; 987 pendingSubtodo = 0;