author | zautrix <zautrix> | 2005-02-06 18:00:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 18:00:15 (UTC) |
commit | 282c7fc5b72f8a6ff78a408e10a6018c290ed9f0 (patch) (unidiff) | |
tree | 95291ead32969e45a6e4e405f15532c9f29543f7 /korganizer/kotodoview.cpp | |
parent | 002a447671cdec6a2ee7940bc183c630c61121fa (diff) | |
download | kdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.zip kdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.tar.gz kdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.tar.bz2 |
cat color better
-rw-r--r-- | korganizer/kotodoview.cpp | 7 |
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 | |||
@@ -940,53 +940,60 @@ void KOTodoView::setNewPercentage(int index) | |||
940 | 940 | ||
941 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 941 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
942 | { | 942 | { |
943 | QPopupMenu* tempMenu = new QPopupMenu (this); | 943 | QPopupMenu* tempMenu = new QPopupMenu (this); |
944 | QStringList checkedCategories = todoItem->todo()->categories (); | 944 | QStringList checkedCategories = todoItem->todo()->categories (); |
945 | 945 | ||
946 | tempMenu->setCheckable (true); | 946 | tempMenu->setCheckable (true); |
947 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 947 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
948 | it != KOPrefs::instance()->mCustomCategories.end (); | 948 | it != KOPrefs::instance()->mCustomCategories.end (); |
949 | ++it) { | 949 | ++it) { |
950 | int index = tempMenu->insertItem (*it); | 950 | int index = tempMenu->insertItem (*it); |
951 | mCategory[index] = *it; | 951 | mCategory[index] = *it; |
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 | } |
960 | void KOTodoView::changedCategories(int index) | 960 | void 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 | } |
975 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 982 | void 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; |
981 | if (!item) { | 988 | if (!item) { |
982 | newTodo(); | 989 | newTodo(); |
983 | return; | 990 | return; |
984 | } | 991 | } |
985 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 992 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
986 | editItem( item ); | 993 | editItem( item ); |
987 | else | 994 | else |
988 | showItem( item , QPoint(), 0 ); | 995 | showItem( item , QPoint(), 0 ); |
989 | } | 996 | } |
990 | void KOTodoView::itemClicked(QListViewItem *item) | 997 | void KOTodoView::itemClicked(QListViewItem *item) |
991 | { | 998 | { |
992 | 999 | ||