author | zautrix <zautrix> | 2005-01-29 17:48:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-29 17:48:05 (UTC) |
commit | 89bda246ae9bdd7e7afc8a15a14bcf7135713f26 (patch) (unidiff) | |
tree | 273195621cae2ee6e805c7613ceb6240eeeeee20 /korganizer | |
parent | 078f8bb7d4eca69b799d79ac39d098e1752778a8 (diff) | |
download | kdepimpi-89bda246ae9bdd7e7afc8a15a14bcf7135713f26.zip kdepimpi-89bda246ae9bdd7e7afc8a15a14bcf7135713f26.tar.gz kdepimpi-89bda246ae9bdd7e7afc8a15a14bcf7135713f26.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kotodoview.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 22486ba..1fb480d 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -787,426 +787,432 @@ void KOTodoView::reparentTodo() | |||
787 | qDebug("KOTodoView::reparentTodo() "); | 787 | qDebug("KOTodoView::reparentTodo() "); |
788 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 788 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
789 | pendingSubtodo = mActiveItem; | 789 | pendingSubtodo = mActiveItem; |
790 | } | 790 | } |
791 | } | 791 | } |
792 | void KOTodoView::editTodo() | 792 | void KOTodoView::editTodo() |
793 | { | 793 | { |
794 | if (mActiveItem) { | 794 | if (mActiveItem) { |
795 | emit editTodoSignal(mActiveItem->todo()); | 795 | emit editTodoSignal(mActiveItem->todo()); |
796 | } | 796 | } |
797 | } | 797 | } |
798 | void KOTodoView::cloneTodo() | 798 | void KOTodoView::cloneTodo() |
799 | { | 799 | { |
800 | if (mActiveItem) { | 800 | if (mActiveItem) { |
801 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 801 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
802 | } | 802 | } |
803 | } | 803 | } |
804 | void KOTodoView::cancelTodo() | 804 | void KOTodoView::cancelTodo() |
805 | { | 805 | { |
806 | if (mActiveItem) { | 806 | if (mActiveItem) { |
807 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 807 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
808 | } | 808 | } |
809 | } | 809 | } |
810 | void KOTodoView::moveTodo() | 810 | void KOTodoView::moveTodo() |
811 | { | 811 | { |
812 | if (mActiveItem) { | 812 | if (mActiveItem) { |
813 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 813 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
814 | } | 814 | } |
815 | } | 815 | } |
816 | void KOTodoView::beamTodo() | 816 | void KOTodoView::beamTodo() |
817 | { | 817 | { |
818 | if (mActiveItem) { | 818 | if (mActiveItem) { |
819 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 819 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
820 | } | 820 | } |
821 | } | 821 | } |
822 | 822 | ||
823 | 823 | ||
824 | void KOTodoView::showTodo() | 824 | void KOTodoView::showTodo() |
825 | { | 825 | { |
826 | if (mActiveItem) { | 826 | if (mActiveItem) { |
827 | emit showTodoSignal(mActiveItem->todo()); | 827 | emit showTodoSignal(mActiveItem->todo()); |
828 | } | 828 | } |
829 | } | 829 | } |
830 | 830 | ||
831 | void KOTodoView::deleteTodo() | 831 | void KOTodoView::deleteTodo() |
832 | { | 832 | { |
833 | if (mActiveItem) { | 833 | if (mActiveItem) { |
834 | emit deleteTodoSignal(mActiveItem->todo()); | 834 | emit deleteTodoSignal(mActiveItem->todo()); |
835 | } | 835 | } |
836 | } | 836 | } |
837 | 837 | ||
838 | void KOTodoView::setNewPriority(int index) | 838 | void KOTodoView::setNewPriority(int index) |
839 | { | 839 | { |
840 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 840 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
841 | mActiveItem->todo()->setPriority(mPriority[index]); | 841 | mActiveItem->todo()->setPriority(mPriority[index]); |
842 | mActiveItem->construct(); | 842 | mActiveItem->construct(); |
843 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 843 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
844 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 844 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
845 | } | 845 | } |
846 | } | 846 | } |
847 | 847 | ||
848 | void KOTodoView::setNewPercentage(int index) | 848 | void KOTodoView::setNewPercentage(int index) |
849 | { | 849 | { |
850 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 850 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
851 | if (mPercentage[index] == 100) { | 851 | if (mPercentage[index] == 100) { |
852 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 852 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
853 | } else { | 853 | } else { |
854 | mActiveItem->todo()->setCompleted(false); | 854 | mActiveItem->todo()->setCompleted(false); |
855 | } | 855 | } |
856 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 856 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
857 | mActiveItem->construct(); | 857 | mActiveItem->construct(); |
858 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 858 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
859 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 859 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
860 | } | 860 | } |
861 | } | 861 | } |
862 | 862 | ||
863 | 863 | ||
864 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 864 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
865 | { | 865 | { |
866 | QPopupMenu* tempMenu = new QPopupMenu (this); | 866 | QPopupMenu* tempMenu = new QPopupMenu (this); |
867 | QStringList checkedCategories = todoItem->todo()->categories (); | 867 | QStringList checkedCategories = todoItem->todo()->categories (); |
868 | 868 | ||
869 | tempMenu->setCheckable (true); | 869 | tempMenu->setCheckable (true); |
870 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 870 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
871 | it != KOPrefs::instance()->mCustomCategories.end (); | 871 | it != KOPrefs::instance()->mCustomCategories.end (); |
872 | ++it) { | 872 | ++it) { |
873 | int index = tempMenu->insertItem (*it); | 873 | int index = tempMenu->insertItem (*it); |
874 | mCategory[index] = *it; | 874 | mCategory[index] = *it; |
875 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 875 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
876 | } | 876 | } |
877 | 877 | ||
878 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 878 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
879 | return tempMenu; | 879 | return tempMenu; |
880 | 880 | ||
881 | 881 | ||
882 | } | 882 | } |
883 | void KOTodoView::changedCategories(int index) | 883 | void KOTodoView::changedCategories(int index) |
884 | { | 884 | { |
885 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 885 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
886 | QStringList categories = mActiveItem->todo()->categories (); | 886 | QStringList categories = mActiveItem->todo()->categories (); |
887 | if (categories.find (mCategory[index]) != categories.end ()) | 887 | if (categories.find (mCategory[index]) != categories.end ()) |
888 | categories.remove (mCategory[index]); | 888 | categories.remove (mCategory[index]); |
889 | else | 889 | else |
890 | categories.insert (categories.end(), mCategory[index]); | 890 | categories.insert (categories.end(), mCategory[index]); |
891 | categories.sort (); | 891 | categories.sort (); |
892 | mActiveItem->todo()->setCategories (categories); | 892 | mActiveItem->todo()->setCategories (categories); |
893 | mActiveItem->construct(); | 893 | mActiveItem->construct(); |
894 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 894 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
895 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 895 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
896 | } | 896 | } |
897 | } | 897 | } |
898 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 898 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
899 | { | 899 | { |
900 | if ( pendingSubtodo != 0 ) { | 900 | if ( pendingSubtodo != 0 ) { |
901 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 901 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
902 | } | 902 | } |
903 | pendingSubtodo = 0; | 903 | pendingSubtodo = 0; |
904 | if (!item) { | 904 | if (!item) { |
905 | newTodo(); | 905 | newTodo(); |
906 | return; | 906 | return; |
907 | } | 907 | } |
908 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 908 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
909 | editItem( item ); | 909 | editItem( item ); |
910 | else | 910 | else |
911 | showItem( item , QPoint(), 0 ); | 911 | showItem( item , QPoint(), 0 ); |
912 | } | 912 | } |
913 | void KOTodoView::itemClicked(QListViewItem *item) | 913 | void KOTodoView::itemClicked(QListViewItem *item) |
914 | { | 914 | { |
915 | 915 | ||
916 | if (!item) { | 916 | if (!item) { |
917 | if ( pendingSubtodo != 0 ) { | 917 | if ( pendingSubtodo != 0 ) { |
918 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 918 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
919 | } | 919 | } |
920 | pendingSubtodo = 0; | 920 | pendingSubtodo = 0; |
921 | return; | 921 | return; |
922 | } | 922 | } |
923 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 923 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
924 | if ( pendingSubtodo != 0 ) { | 924 | if ( pendingSubtodo != 0 ) { |
925 | bool allowReparent = true; | 925 | bool allowReparent = true; |
926 | QListViewItem *par = item; | 926 | QListViewItem *par = item; |
927 | while ( par ) { | 927 | while ( par ) { |
928 | if ( par == pendingSubtodo ) { | 928 | if ( par == pendingSubtodo ) { |
929 | allowReparent = false; | 929 | allowReparent = false; |
930 | break; | 930 | break; |
931 | } | 931 | } |
932 | par = par->parent(); | 932 | par = par->parent(); |
933 | } | 933 | } |
934 | if ( !allowReparent ) { | 934 | if ( !allowReparent ) { |
935 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 935 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
936 | qDebug("Recursive reparenting not possible "); | 936 | qDebug("Recursive reparenting not possible "); |
937 | pendingSubtodo = 0; | 937 | pendingSubtodo = 0; |
938 | } else { | 938 | } else { |
939 | Todo* newParent = todoItem->todo(); | 939 | Todo* newParent = todoItem->todo(); |
940 | Todo* newSub = pendingSubtodo->todo(); | 940 | Todo* newSub = pendingSubtodo->todo(); |
941 | pendingSubtodo = 0; | 941 | pendingSubtodo = 0; |
942 | emit reparentTodoSignal( newParent,newSub ); | 942 | emit reparentTodoSignal( newParent,newSub ); |
943 | return; | 943 | return; |
944 | } | 944 | } |
945 | } | 945 | } |
946 | int completed = todoItem->todo()->isCompleted(); // Completed or not? | 946 | int completed = todoItem->todo()->isCompleted(); // Completed or not? |
947 | 947 | ||
948 | if (todoItem->isOn()) { | 948 | if (todoItem->isOn()) { |
949 | if (!completed) { | 949 | if (!completed) { |
950 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 950 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
951 | } | 951 | } |
952 | } else { | 952 | } else { |
953 | if (completed) { | 953 | if (completed) { |
954 | todoItem->todo()->setCompleted(false); | 954 | todoItem->todo()->setCompleted(false); |
955 | } | 955 | } |
956 | } | 956 | } |
957 | } | 957 | } |
958 | 958 | ||
959 | void KOTodoView::setDocumentId( const QString &id ) | 959 | void KOTodoView::setDocumentId( const QString &id ) |
960 | { | 960 | { |
961 | kdDebug() << "KOTodoView::setDocumentId()" << endl; | 961 | kdDebug() << "KOTodoView::setDocumentId()" << endl; |
962 | 962 | ||
963 | mDocPrefs->setDoc( id ); | 963 | mDocPrefs->setDoc( id ); |
964 | } | 964 | } |
965 | 965 | ||
966 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 966 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
967 | { | 967 | { |
968 | if (!item) return; | 968 | if (!item) return; |
969 | 969 | ||
970 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 970 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
971 | 971 | ||
972 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 972 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
973 | 973 | ||
974 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 974 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
975 | } | 975 | } |
976 | 976 | ||
977 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 977 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
978 | { | 978 | { |
979 | mTodoListView->saveLayout(config,group); | 979 | mTodoListView->saveLayout(config,group); |
980 | } | 980 | } |
981 | 981 | ||
982 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 982 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
983 | { | 983 | { |
984 | mTodoListView->restoreLayout(config,group); | 984 | mTodoListView->restoreLayout(config,group); |
985 | } | 985 | } |
986 | 986 | ||
987 | void KOTodoView::processSelectionChange() | 987 | void KOTodoView::processSelectionChange() |
988 | { | 988 | { |
989 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 989 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
990 | 990 | ||
991 | KOTodoViewItem *item = | 991 | KOTodoViewItem *item = |
992 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 992 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
993 | 993 | ||
994 | if ( !item ) { | 994 | if ( !item ) { |
995 | emit incidenceSelected( 0 ); | 995 | emit incidenceSelected( 0 ); |
996 | } else { | 996 | } else { |
997 | emit incidenceSelected( item->todo() ); | 997 | emit incidenceSelected( item->todo() ); |
998 | } | 998 | } |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | void KOTodoView::modified(bool b) | 1001 | void KOTodoView::modified(bool b) |
1002 | { | 1002 | { |
1003 | emit isModified(b); | 1003 | emit isModified(b); |
1004 | } | 1004 | } |
1005 | void KOTodoView::setTodoModified( Todo* todo ) | 1005 | void KOTodoView::setTodoModified( Todo* todo ) |
1006 | { | 1006 | { |
1007 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1007 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1008 | } | 1008 | } |
1009 | void KOTodoView::clearSelection() | 1009 | void KOTodoView::clearSelection() |
1010 | { | 1010 | { |
1011 | mTodoListView->selectAll( false ); | 1011 | mTodoListView->selectAll( false ); |
1012 | } | 1012 | } |
1013 | void KOTodoView::setAllOpen() | 1013 | void KOTodoView::setAllOpen() |
1014 | { | 1014 | { |
1015 | if ( isFlatDisplay ) { | 1015 | if ( isFlatDisplay ) { |
1016 | isFlatDisplay = false; | 1016 | isFlatDisplay = false; |
1017 | mPopupMenu->setItemChecked( 8,false ); | 1017 | mPopupMenu->setItemChecked( 8,false ); |
1018 | updateView(); | 1018 | updateView(); |
1019 | } | 1019 | } |
1020 | setOpen(mTodoListView->firstChild(), true); | 1020 | setOpen(mTodoListView->firstChild(), true); |
1021 | } | 1021 | } |
1022 | void KOTodoView::setAllClose() | 1022 | void KOTodoView::setAllClose() |
1023 | { | 1023 | { |
1024 | if ( isFlatDisplay ) { | 1024 | if ( isFlatDisplay ) { |
1025 | isFlatDisplay = false; | 1025 | isFlatDisplay = false; |
1026 | mPopupMenu->setItemChecked( 8,false ); | 1026 | mPopupMenu->setItemChecked( 8,false ); |
1027 | updateView(); | 1027 | updateView(); |
1028 | } | 1028 | } |
1029 | setOpen(mTodoListView->firstChild(), false); | 1029 | setOpen(mTodoListView->firstChild(), false); |
1030 | } | 1030 | } |
1031 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1031 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1032 | { | 1032 | { |
1033 | 1033 | ||
1034 | while ( item ) { | 1034 | while ( item ) { |
1035 | setOpen( item->firstChild(), setOpenI ); | 1035 | setOpen( item->firstChild(), setOpenI ); |
1036 | item->setOpen( setOpenI ); | 1036 | item->setOpen( setOpenI ); |
1037 | item = item->nextSibling(); | 1037 | item = item->nextSibling(); |
1038 | } | 1038 | } |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | void KOTodoView::setAllFlat() | 1041 | void KOTodoView::setAllFlat() |
1042 | { | 1042 | { |
1043 | if ( isFlatDisplay ) { | ||
1044 | isFlatDisplay = false; | ||
1045 | mPopupMenu->setItemChecked( 8,false ); | ||
1046 | updateView(); | ||
1047 | return; | ||
1048 | } | ||
1043 | pendingSubtodo = 0; | 1049 | pendingSubtodo = 0; |
1044 | if ( mBlockUpdate ) { | 1050 | if ( mBlockUpdate ) { |
1045 | return; | 1051 | return; |
1046 | } | 1052 | } |
1047 | mPopupMenu->setItemChecked( 8,true ); | 1053 | mPopupMenu->setItemChecked( 8,true ); |
1048 | isFlatDisplay = true; | 1054 | isFlatDisplay = true; |
1049 | QPtrList<Todo> todoList = calendar()->todos(); | 1055 | QPtrList<Todo> todoList = calendar()->todos(); |
1050 | mTodoMap.clear(); | 1056 | mTodoMap.clear(); |
1051 | mTodoListView->clear(); | 1057 | mTodoListView->clear(); |
1052 | Todo *todo; | 1058 | Todo *todo; |
1053 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1059 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1054 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1060 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1055 | mTodoMap.insert(todo,todoItem); | 1061 | mTodoMap.insert(todo,todoItem); |
1056 | } | 1062 | } |
1057 | mTodoListView->setFocus(); | 1063 | mTodoListView->setFocus(); |
1058 | processSelectionChange(); | 1064 | processSelectionChange(); |
1059 | } | 1065 | } |
1060 | 1066 | ||
1061 | void KOTodoView::purgeCompleted() | 1067 | void KOTodoView::purgeCompleted() |
1062 | { | 1068 | { |
1063 | emit purgeCompletedSignal(); | 1069 | emit purgeCompletedSignal(); |
1064 | } | 1070 | } |
1065 | void KOTodoView::toggleQuickTodo() | 1071 | void KOTodoView::toggleQuickTodo() |
1066 | { | 1072 | { |
1067 | if ( mQuickAdd->isVisible() ) { | 1073 | if ( mQuickAdd->isVisible() ) { |
1068 | mQuickAdd->hide(); | 1074 | mQuickAdd->hide(); |
1069 | KOPrefs::instance()->mEnableQuickTodo = false; | 1075 | KOPrefs::instance()->mEnableQuickTodo = false; |
1070 | } | 1076 | } |
1071 | else { | 1077 | else { |
1072 | mQuickAdd->show(); | 1078 | mQuickAdd->show(); |
1073 | KOPrefs::instance()->mEnableQuickTodo = true; | 1079 | KOPrefs::instance()->mEnableQuickTodo = true; |
1074 | } | 1080 | } |
1075 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1081 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1076 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1082 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1077 | } | 1083 | } |
1078 | 1084 | ||
1079 | void KOTodoView::toggleRunning() | 1085 | void KOTodoView::toggleRunning() |
1080 | { | 1086 | { |
1081 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1087 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1082 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1088 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1083 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1089 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1084 | updateView(); | 1090 | updateView(); |
1085 | } | 1091 | } |
1086 | 1092 | ||
1087 | void KOTodoView::toggleCompleted() | 1093 | void KOTodoView::toggleCompleted() |
1088 | { | 1094 | { |
1089 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1095 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1090 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1096 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1091 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1097 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1092 | updateView(); | 1098 | updateView(); |
1093 | } | 1099 | } |
1094 | 1100 | ||
1095 | void KOTodoView::addQuickTodo() | 1101 | void KOTodoView::addQuickTodo() |
1096 | { | 1102 | { |
1097 | Todo *todo = new Todo(); | 1103 | Todo *todo = new Todo(); |
1098 | todo->setSummary(mQuickAdd->text()); | 1104 | todo->setSummary(mQuickAdd->text()); |
1099 | todo->setOrganizer(KOPrefs::instance()->email()); | 1105 | todo->setOrganizer(KOPrefs::instance()->email()); |
1100 | CalFilter * cf = mCalendar->filter(); | 1106 | CalFilter * cf = mCalendar->filter(); |
1101 | if ( cf ) { | 1107 | if ( cf ) { |
1102 | if ( cf->isEnabled()&& cf->showCategories()) { | 1108 | if ( cf->isEnabled()&& cf->showCategories()) { |
1103 | todo->setCategories(cf->categoryList()); | 1109 | todo->setCategories(cf->categoryList()); |
1104 | } | 1110 | } |
1105 | if ( cf->isEnabled() ) | 1111 | if ( cf->isEnabled() ) |
1106 | todo->setSecrecy( cf->getSecrecy()); | 1112 | todo->setSecrecy( cf->getSecrecy()); |
1107 | } | 1113 | } |
1108 | mCalendar->addTodo(todo); | 1114 | mCalendar->addTodo(todo); |
1109 | mQuickAdd->setText(""); | 1115 | mQuickAdd->setText(""); |
1110 | todoModified (todo, KOGlobals::EVENTADDED ); | 1116 | todoModified (todo, KOGlobals::EVENTADDED ); |
1111 | updateView(); | 1117 | updateView(); |
1112 | } | 1118 | } |
1113 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1119 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1114 | { | 1120 | { |
1115 | // e->ignore(); | 1121 | // e->ignore(); |
1116 | //return; | 1122 | //return; |
1117 | //qDebug("KOTodoView::keyPressEvent "); | 1123 | //qDebug("KOTodoView::keyPressEvent "); |
1118 | switch ( e->key() ) { | 1124 | switch ( e->key() ) { |
1119 | case Qt::Key_Down: | 1125 | case Qt::Key_Down: |
1120 | case Qt::Key_Up: | 1126 | case Qt::Key_Up: |
1121 | QWidget::keyPressEvent ( e ); | 1127 | QWidget::keyPressEvent ( e ); |
1122 | break; | 1128 | break; |
1123 | 1129 | ||
1124 | case Qt::Key_Q: | 1130 | case Qt::Key_Q: |
1125 | toggleQuickTodo(); | 1131 | toggleQuickTodo(); |
1126 | break; | 1132 | break; |
1127 | case Qt::Key_U: | 1133 | case Qt::Key_U: |
1128 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1134 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1129 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1135 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1130 | unparentTodo(); | 1136 | unparentTodo(); |
1131 | e->accept(); | 1137 | e->accept(); |
1132 | } else | 1138 | } else |
1133 | e->ignore(); | 1139 | e->ignore(); |
1134 | break; | 1140 | break; |
1135 | case Qt::Key_S: | 1141 | case Qt::Key_S: |
1136 | if ( e->state() == Qt::ControlButton ) { | 1142 | if ( e->state() == Qt::ControlButton ) { |
1137 | e->ignore(); | 1143 | e->ignore(); |
1138 | break; | 1144 | break; |
1139 | } | 1145 | } |
1140 | if ( e->state() == Qt::ShiftButton ) { | 1146 | if ( e->state() == Qt::ShiftButton ) { |
1141 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1147 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1142 | reparentTodo(); | 1148 | reparentTodo(); |
1143 | e->accept(); | 1149 | e->accept(); |
1144 | } else | 1150 | } else |
1145 | e->ignore(); | 1151 | e->ignore(); |
1146 | break; | 1152 | break; |
1147 | case Qt::Key_P: | 1153 | case Qt::Key_P: |
1148 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1154 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1149 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1155 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1150 | if ( pendingSubtodo ) | 1156 | if ( pendingSubtodo ) |
1151 | itemClicked(mActiveItem); | 1157 | itemClicked(mActiveItem); |
1152 | e->accept(); | 1158 | e->accept(); |
1153 | } else | 1159 | } else |
1154 | e->ignore(); | 1160 | e->ignore(); |
1155 | break; | 1161 | break; |
1156 | case Qt::Key_Escape: | 1162 | case Qt::Key_Escape: |
1157 | if ( pendingSubtodo ) { | 1163 | if ( pendingSubtodo ) { |
1158 | itemClicked(0); | 1164 | itemClicked(0); |
1159 | e->accept(); | 1165 | e->accept(); |
1160 | } else | 1166 | } else |
1161 | e->ignore(); | 1167 | e->ignore(); |
1162 | break; | 1168 | break; |
1163 | default: | 1169 | default: |
1164 | e->ignore(); | 1170 | e->ignore(); |
1165 | } | 1171 | } |
1166 | 1172 | ||
1167 | if ( true ) { | 1173 | if ( true ) { |
1168 | if ( e->key() == Qt::Key_I ) { | 1174 | if ( e->key() == Qt::Key_I ) { |
1169 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1175 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1170 | if ( cn ) { | 1176 | if ( cn ) { |
1171 | mActiveItem = cn; | 1177 | mActiveItem = cn; |
1172 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1178 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1173 | if ( ci ){ | 1179 | if ( ci ){ |
1174 | showTodo(); | 1180 | showTodo(); |
1175 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1181 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1176 | if ( cn ) { | 1182 | if ( cn ) { |
1177 | mTodoListView->setCurrentItem ( cn ); | 1183 | mTodoListView->setCurrentItem ( cn ); |
1178 | mTodoListView->ensureItemVisible ( cn ); | 1184 | mTodoListView->ensureItemVisible ( cn ); |
1179 | } | 1185 | } |
1180 | 1186 | ||
1181 | } | 1187 | } |
1182 | } | 1188 | } |
1183 | e->accept(); | 1189 | e->accept(); |
1184 | 1190 | ||
1185 | } | 1191 | } |
1186 | 1192 | ||
1187 | } | 1193 | } |
1188 | 1194 | ||
1189 | } | 1195 | } |
1190 | void KOTodoView::updateTodo( Todo * t, int type ) | 1196 | void KOTodoView::updateTodo( Todo * t, int type ) |
1191 | { | 1197 | { |
1192 | if ( mBlockUpdate) | 1198 | if ( mBlockUpdate) |
1193 | return; | 1199 | return; |
1194 | 1200 | ||
1195 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1201 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1196 | itemIterator = mTodoMap.find(t); | 1202 | itemIterator = mTodoMap.find(t); |
1197 | if (itemIterator != mTodoMap.end()) { | 1203 | if (itemIterator != mTodoMap.end()) { |
1198 | (*itemIterator)->construct(); | 1204 | (*itemIterator)->construct(); |
1199 | } else { | 1205 | } else { |
1200 | if ( type == KOGlobals::EVENTADDED ) { | 1206 | if ( type == KOGlobals::EVENTADDED ) { |
1201 | insertTodoItem( t ); | 1207 | insertTodoItem( t ); |
1202 | } | 1208 | } |
1203 | } | 1209 | } |
1204 | 1210 | ||
1205 | } | 1211 | } |
1206 | 1212 | ||
1207 | void KOTodoView::todoModified(Todo * t , int p ) | 1213 | void KOTodoView::todoModified(Todo * t , int p ) |
1208 | { | 1214 | { |
1209 | mBlockUpdate = true; | 1215 | mBlockUpdate = true; |
1210 | emit todoModifiedSignal ( t, p ); | 1216 | emit todoModifiedSignal ( t, p ); |
1211 | mBlockUpdate = false; | 1217 | mBlockUpdate = false; |
1212 | } | 1218 | } |