summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp31
1 files changed, 3 insertions, 28 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index dd2c081..0a608dc 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -663,109 +663,103 @@ void KOTodoView::updateView()
663/* 663/*
664 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 664 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
665 Event *t; 665 Event *t;
666 for(t = todoList.first(); t; t = todoList.next()) { 666 for(t = todoList.first(); t; t = todoList.next()) {
667 kdDebug() << " " << t->getSummary() << endl; 667 kdDebug() << " " << t->getSummary() << endl;
668 668
669 if (t->getRelatedTo()) { 669 if (t->getRelatedTo()) {
670 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 670 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
671 } 671 }
672 672
673 QPtrList<Event> l = t->getRelations(); 673 QPtrList<Event> l = t->getRelations();
674 Event *c; 674 Event *c;
675 for(c=l.first();c;c=l.next()) { 675 for(c=l.first();c;c=l.next()) {
676 kdDebug() << " - relation: " << c->getSummary() << endl; 676 kdDebug() << " - relation: " << c->getSummary() << endl;
677 } 677 }
678 } 678 }
679*/ 679*/
680 680
681 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 681 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
682 // specific order of events. That means that we have to generate parent items 682 // specific order of events. That means that we have to generate parent items
683 // recursively for proper hierarchical display of Todos. 683 // recursively for proper hierarchical display of Todos.
684 mTodoMap.clear(); 684 mTodoMap.clear();
685 Todo *todo; 685 Todo *todo;
686 todo = todoList.first();// todo; todo = todoList.next()) { 686 todo = todoList.first();// todo; todo = todoList.next()) {
687 while ( todo ) { 687 while ( todo ) {
688 bool next = true; 688 bool next = true;
689 // qDebug("todo %s ", todo->summary().latin1()); 689 // qDebug("todo %s ", todo->summary().latin1());
690 Incidence *incidence = todo->relatedTo(); 690 Incidence *incidence = todo->relatedTo();
691 while ( incidence ) { 691 while ( incidence ) {
692 if ( incidence->type() == "Todo") { 692 if ( incidence->type() == "Todo") {
693 //qDebug("related %s ",incidence->summary().latin1() ); 693 //qDebug("related %s ",incidence->summary().latin1() );
694 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 694 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
695 //qDebug("related not found "); 695 //qDebug("related not found ");
696 todoList.remove( ); 696 todoList.remove( );
697 todo = todoList.current(); 697 todo = todoList.current();
698 next = false; 698 next = false;
699 incidence = 0; 699 incidence = 0;
700 700
701 } else { 701 } else {
702 //qDebug("related found "); 702 //qDebug("related found ");
703 incidence = incidence->relatedTo(); 703 incidence = incidence->relatedTo();
704 } 704 }
705 } else 705 } else
706 incidence = 0; 706 incidence = 0;
707 } 707 }
708 if ( next ) 708 if ( next )
709 todo = todoList.next(); 709 todo = todoList.next();
710 } 710 }
711// qDebug("again .... "); 711
712// for(todo = todoList.first(); todo; todo = todoList.next()) {
713
714// qDebug("yytodo %s ", todo->summary().latin1());
715// }
716 //qDebug("for ");
717 for(todo = todoList.first(); todo; todo = todoList.next()) { 712 for(todo = todoList.first(); todo; todo = todoList.next()) {
718 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 713 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
719 { 714 {
720 insertTodoItem(todo); 715 insertTodoItem(todo);
721 } 716 }
722 } 717 }
723 //qDebug("for end ");
724 // Restore opened/closed state 718 // Restore opened/closed state
725 mTodoListView->blockSignals( true ); 719 mTodoListView->blockSignals( true );
726 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 720 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
727 mTodoListView->blockSignals( false ); 721 mTodoListView->blockSignals( false );
728 resetCurrentItem(); 722 resetCurrentItem();
729 processSelectionChange(); 723 processSelectionChange();
730} 724}
731 725
732void KOTodoView::storeCurrentItem() 726void KOTodoView::storeCurrentItem()
733{ 727{
734 mCurItem = 0; 728 mCurItem = 0;
735 mCurItemRootParent = 0; 729 mCurItemRootParent = 0;
736 mCurItemParent = 0; 730 mCurItemParent = 0;
737 mCurItemAbove = 0; 731 mCurItemAbove = 0;
738 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 732 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
739 if (mActiveItem) { 733 if (mActiveItem) {
740 mCurItem = mActiveItem->todo(); 734 mCurItem = mActiveItem->todo();
741 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 735 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
742 if ( activeItemAbove ) 736 if ( activeItemAbove )
743 mCurItemAbove = activeItemAbove->todo(); 737 mCurItemAbove = activeItemAbove->todo();
744 mCurItemRootParent = mCurItem; 738 mCurItemRootParent = mCurItem;
745 mCurItemParent = mCurItemRootParent->relatedTo(); 739 mCurItemParent = mCurItemRootParent->relatedTo();
746 while ( mCurItemRootParent->relatedTo() != 0 ) 740 while ( mCurItemRootParent->relatedTo() != 0 )
747 mCurItemRootParent = mCurItemRootParent->relatedTo(); 741 mCurItemRootParent = mCurItemRootParent->relatedTo();
748 } 742 }
749 mActiveItem = 0; 743 mActiveItem = 0;
750} 744}
751 745
752void KOTodoView::resetCurrentItem() 746void KOTodoView::resetCurrentItem()
753{ 747{
754 mTodoListView->setFocus(); 748 mTodoListView->setFocus();
755 KOTodoViewItem* foundItem = 0; 749 KOTodoViewItem* foundItem = 0;
756 KOTodoViewItem* foundItemRoot = 0; 750 KOTodoViewItem* foundItemRoot = 0;
757 KOTodoViewItem* foundItemParent = 0; 751 KOTodoViewItem* foundItemParent = 0;
758 KOTodoViewItem* foundItemAbove = 0; 752 KOTodoViewItem* foundItemAbove = 0;
759 if ( mTodoListView->firstChild () ) { 753 if ( mTodoListView->firstChild () ) {
760 if ( mCurItem ) { 754 if ( mCurItem ) {
761 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 755 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
762 while ( item ) { 756 while ( item ) {
763 if ( item->todo() == mCurItem ) { 757 if ( item->todo() == mCurItem ) {
764 foundItem = item; 758 foundItem = item;
765 break; 759 break;
766 } else if ( item->todo() == mCurItemAbove ) { 760 } else if ( item->todo() == mCurItemAbove ) {
767 foundItemAbove = item; 761 foundItemAbove = item;
768 762
769 } 763 }
770 if ( item->todo() == mCurItemRootParent ) { 764 if ( item->todo() == mCurItemRootParent ) {
771 foundItemRoot = item; 765 foundItemRoot = item;
@@ -867,97 +861,96 @@ void KOTodoView::updateConfig()
867} 861}
868 862
869QPtrList<Incidence> KOTodoView::selectedIncidences() 863QPtrList<Incidence> KOTodoView::selectedIncidences()
870{ 864{
871 QPtrList<Incidence> selected; 865 QPtrList<Incidence> selected;
872 866
873 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 867 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
874// if (!item) item = mActiveItem; 868// if (!item) item = mActiveItem;
875 if (item) selected.append(item->todo()); 869 if (item) selected.append(item->todo());
876 870
877 return selected; 871 return selected;
878} 872}
879 873
880QPtrList<Todo> KOTodoView::selectedTodos() 874QPtrList<Todo> KOTodoView::selectedTodos()
881{ 875{
882 QPtrList<Todo> selected; 876 QPtrList<Todo> selected;
883 877
884 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 878 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
885// if (!item) item = mActiveItem; 879// if (!item) item = mActiveItem;
886 if (item) selected.append(item->todo()); 880 if (item) selected.append(item->todo());
887 881
888 return selected; 882 return selected;
889} 883}
890 884
891void KOTodoView::changeEventDisplay(Event *, int) 885void KOTodoView::changeEventDisplay(Event *, int)
892{ 886{
893 updateView(); 887 updateView();
894} 888}
895 889
896void KOTodoView::showDates(const QDate &, const QDate &) 890void KOTodoView::showDates(const QDate &, const QDate &)
897{ 891{
898} 892}
899 893
900void KOTodoView::showEvents(QPtrList<Event>) 894void KOTodoView::showEvents(QPtrList<Event>)
901{ 895{
902 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 896 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
903} 897}
904 898
905void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 899void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
906 const QDate &td) 900 const QDate &td)
907{ 901{
908#ifndef KORG_NOPRINTER 902#ifndef KORG_NOPRINTER
909 calPrinter->preview(CalPrinter::Todolist, fd, td); 903 calPrinter->preview(CalPrinter::Todolist, fd, td);
910#endif 904#endif
911} 905}
912 906
913void KOTodoView::editItem(QListViewItem *item ) 907void KOTodoView::editItem(QListViewItem *item )
914{ 908{
915 // qDebug("editItem(QListViewItem *item ) ");
916 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 909 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
917} 910}
918 911
919void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 912void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
920{ 913{
921 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 914 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
922} 915}
923 916
924void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 917void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
925{ 918{
926 pendingSubtodo = 0; 919 pendingSubtodo = 0;
927 mActiveItem = (KOTodoViewItem *)item; 920 mActiveItem = (KOTodoViewItem *)item;
928 if (item) { 921 if (item) {
929 switch (column){ 922 switch (column){
930 case 1: 923 case 1:
931 mPriorityPopupMenu->popup(QCursor::pos ()); break; 924 mPriorityPopupMenu->popup(QCursor::pos ()); break;
932 case 2: 925 case 2:
933 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 926 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
934 case 3: 927 case 3:
935 moveTodo(); 928 moveTodo();
936 break; 929 break;
937 case 8: 930 case 8:
938 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 931 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
939 default: 932 default:
940 mItemPopupMenu->popup(QCursor::pos()); 933 mItemPopupMenu->popup(QCursor::pos());
941 } 934 }
942 } else mPopupMenu->popup(QCursor::pos()); 935 } else mPopupMenu->popup(QCursor::pos());
943} 936}
944void KOTodoView::newTodo() 937void KOTodoView::newTodo()
945{ 938{
946 emit newTodoSignal(); 939 emit newTodoSignal();
947} 940}
948 941
949void KOTodoView::newSubTodo() 942void KOTodoView::newSubTodo()
950{ 943{
951 if (mActiveItem) { 944 if (mActiveItem) {
952 emit newSubTodoSignal(mActiveItem->todo()); 945 emit newSubTodoSignal(mActiveItem->todo());
953 } 946 }
954} 947}
955void KOTodoView::unparentTodo() 948void KOTodoView::unparentTodo()
956{ 949{
957 if (mActiveItem) { 950 if (mActiveItem) {
958 emit unparentTodoSignal(mActiveItem->todo()); 951 emit unparentTodoSignal(mActiveItem->todo());
959 } 952 }
960} 953}
961 954
962void KOTodoView::reparentTodo() 955void KOTodoView::reparentTodo()
963{ 956{
@@ -1051,189 +1044,171 @@ QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1051{ 1044{
1052 QPopupMenu* tempMenu = new QPopupMenu (this); 1045 QPopupMenu* tempMenu = new QPopupMenu (this);
1053 QStringList checkedCategories = todoItem->todo()->categories (); 1046 QStringList checkedCategories = todoItem->todo()->categories ();
1054 1047
1055 tempMenu->setCheckable (true); 1048 tempMenu->setCheckable (true);
1056 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1049 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1057 it != KOPrefs::instance()->mCustomCategories.end (); 1050 it != KOPrefs::instance()->mCustomCategories.end ();
1058 ++it) { 1051 ++it) {
1059 int index = tempMenu->insertItem (*it); 1052 int index = tempMenu->insertItem (*it);
1060 mCategory[index] = *it; 1053 mCategory[index] = *it;
1061 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1054 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1062 } 1055 }
1063 1056
1064 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1057 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1065 return tempMenu; 1058 return tempMenu;
1066 1059
1067 1060
1068} 1061}
1069void KOTodoView::changedCategories(int index) 1062void KOTodoView::changedCategories(int index)
1070{ 1063{
1071 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1064 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1072 QStringList categories = mActiveItem->todo()->categories (); 1065 QStringList categories = mActiveItem->todo()->categories ();
1073 QString colcat = categories.first(); 1066 QString colcat = categories.first();
1074 if (categories.find (mCategory[index]) != categories.end ()) 1067 if (categories.find (mCategory[index]) != categories.end ())
1075 categories.remove (mCategory[index]); 1068 categories.remove (mCategory[index]);
1076 else 1069 else
1077 categories.insert (categories.end(), mCategory[index]); 1070 categories.insert (categories.end(), mCategory[index]);
1078 categories.sort (); 1071 categories.sort ();
1079 if ( !colcat.isEmpty() ) { 1072 if ( !colcat.isEmpty() ) {
1080 if ( categories.find ( colcat ) != categories.end () ) { 1073 if ( categories.find ( colcat ) != categories.end () ) {
1081 categories.remove( colcat ); 1074 categories.remove( colcat );
1082 categories.prepend( colcat ); 1075 categories.prepend( colcat );
1083 } 1076 }
1084 } 1077 }
1085 mActiveItem->todo()->setCategories (categories); 1078 mActiveItem->todo()->setCategories (categories);
1086 mActiveItem->construct(); 1079 mActiveItem->construct();
1087 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1080 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1088 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1081 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1089 } 1082 }
1090} 1083}
1091void KOTodoView::itemDoubleClicked(QListViewItem *item) 1084void KOTodoView::itemDoubleClicked(QListViewItem *item)
1092{ 1085{
1093 if ( pendingSubtodo != 0 ) { 1086 if ( pendingSubtodo != 0 ) {
1094 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1087 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1095 } 1088 }
1096 pendingSubtodo = 0; 1089 pendingSubtodo = 0;
1097 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1090 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1098 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1091 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1099 qDebug("ROW %d ", row); 1092 //qDebug("ROW %d ", row);
1100 if (!item) { 1093 if (!item) {
1101 newTodo(); 1094 newTodo();
1102 return; 1095 return;
1103 } else { 1096 } else {
1104 if ( row == 2 || row == 1 ) { 1097 if ( row == 2 || row == 1 ) {
1105 mActiveItem = (KOTodoViewItem *) item; 1098 mActiveItem = (KOTodoViewItem *) item;
1106 newSubTodo(); 1099 newSubTodo();
1107 return; 1100 return;
1108 } 1101 }
1109 if ( row == 5 || row == 6 ) { 1102 if ( row == 5 || row == 6 ) {
1110 mActiveItem = (KOTodoViewItem *) item; 1103 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem(); 1104 toggleRunningItem();
1112 return; 1105 return;
1113 } 1106 }
1114 } 1107 }
1115 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1108 if ( KOPrefs::instance()->mEditOnDoubleClick )
1116 editItem( item ); 1109 editItem( item );
1117 else 1110 else
1118 showItem( item , QPoint(), 0 ); 1111 showItem( item , QPoint(), 0 );
1119} 1112}
1120void KOTodoView::toggleRunningItem() 1113void KOTodoView::toggleRunningItem()
1121{ 1114{
1122 // qDebug("KOTodoView::toggleRunning() "); 1115 // qDebug("KOTodoView::toggleRunning() ");
1123 if ( ! mActiveItem ) 1116 if ( ! mActiveItem )
1124 return; 1117 return;
1125 Todo * t = mActiveItem->todo(); 1118 Todo * t = mActiveItem->todo();
1126 if ( t->isRunning() ) { 1119 if ( t->isRunning() ) {
1127 int result = KMessageBox::warningContinueCancel(this, 1120 int result = KMessageBox::warningContinueCancel(this,
1128 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); 1121 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true);
1129 if (result != KMessageBox::Continue) return; 1122 if (result != KMessageBox::Continue) return;
1130 t->setRunning( false ); 1123 t->setRunning( false );
1131 mActiveItem->construct(); 1124 mActiveItem->construct();
1132 } else { 1125 } else {
1133 int result = KMessageBox::warningContinueCancel(this, 1126 int result = KMessageBox::warningContinueCancel(this,
1134 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); 1127 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true);
1135 if (result != KMessageBox::Continue) return; 1128 if (result != KMessageBox::Continue) return;
1136 t->setRunning( true ); 1129 t->setRunning( true );
1137 mActiveItem->construct(); 1130 mActiveItem->construct();
1138 } 1131 }
1139} 1132}
1140 1133
1141void KOTodoView::itemClicked(QListViewItem *item) 1134void KOTodoView::itemClicked(QListViewItem *item)
1142{ 1135{
1143 //qDebug("KOTodoView::itemClicked %d", item); 1136 //qDebug("KOTodoView::itemClicked %d", item);
1144 if (!item) { 1137 if (!item) {
1145 if ( pendingSubtodo != 0 ) { 1138 if ( pendingSubtodo != 0 ) {
1146 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1139 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1147 } 1140 }
1148 pendingSubtodo = 0; 1141 pendingSubtodo = 0;
1149 return; 1142 return;
1150 } 1143 }
1151 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1144 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1152 if ( pendingSubtodo != 0 ) { 1145 if ( pendingSubtodo != 0 ) {
1153 bool allowReparent = true; 1146 bool allowReparent = true;
1154 QListViewItem *par = item; 1147 QListViewItem *par = item;
1155 while ( par ) { 1148 while ( par ) {
1156 if ( par == pendingSubtodo ) { 1149 if ( par == pendingSubtodo ) {
1157 allowReparent = false; 1150 allowReparent = false;
1158 break; 1151 break;
1159 } 1152 }
1160 par = par->parent(); 1153 par = par->parent();
1161 } 1154 }
1162 if ( !allowReparent ) { 1155 if ( !allowReparent ) {
1163 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1156 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1164 pendingSubtodo = 0; 1157 pendingSubtodo = 0;
1165 } else { 1158 } else {
1166 Todo* newParent = todoItem->todo(); 1159 Todo* newParent = todoItem->todo();
1167 Todo* newSub = pendingSubtodo->todo(); 1160 Todo* newSub = pendingSubtodo->todo();
1168 pendingSubtodo = 0; 1161 pendingSubtodo = 0;
1169 emit reparentTodoSignal( newParent,newSub ); 1162 emit reparentTodoSignal( newParent,newSub );
1170 return; 1163 return;
1171 } 1164 }
1172 } 1165 }
1173#if 0 1166
1174 // handled by the item itself
1175 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1176 qDebug("com %d ",completed );
1177 qDebug("itemclicked ");
1178 if (todoItem->isOn()) {
1179 qDebug("on ");
1180 if (!completed) {
1181 qDebug("set true ");
1182 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1183 }
1184 } else {
1185 qDebug("not on ");
1186 if (completed) {
1187 qDebug("set false ");
1188 todoItem->todo()->setCompleted(false);
1189 }
1190 }
1191#endif
1192} 1167}
1193 1168
1194void KOTodoView::setDocumentId( const QString &id ) 1169void KOTodoView::setDocumentId( const QString &id )
1195{ 1170{
1196 1171
1197 mDocPrefs->setDoc( id ); 1172 mDocPrefs->setDoc( id );
1198} 1173}
1199 1174
1200void KOTodoView::itemStateChanged( QListViewItem *item ) 1175void KOTodoView::itemStateChanged( QListViewItem *item )
1201{ 1176{
1202 if (!item) return; 1177 if (!item) return;
1203 1178
1204 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1179 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1205 1180
1206// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1181// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1207 1182
1208 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1183 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1209} 1184}
1210 1185
1211void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1186void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1212{ 1187{
1213 mTodoListView->saveLayout(config,group); 1188 mTodoListView->saveLayout(config,group);
1214} 1189}
1215 1190
1216void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1191void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1217{ 1192{
1218 mTodoListView->restoreLayout(config,group); 1193 mTodoListView->restoreLayout(config,group);
1219} 1194}
1220 1195
1221void KOTodoView::processSelectionChange() 1196void KOTodoView::processSelectionChange()
1222{ 1197{
1223// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1198// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1224 1199
1225 KOTodoViewItem *item = 1200 KOTodoViewItem *item =
1226 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1201 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1227 1202
1228 if ( !item ) { 1203 if ( !item ) {
1229 emit incidenceSelected( 0 ); 1204 emit incidenceSelected( 0 );
1230 } else { 1205 } else {
1231 emit incidenceSelected( item->todo() ); 1206 emit incidenceSelected( item->todo() );
1232 } 1207 }
1233} 1208}
1234 1209
1235void KOTodoView::modified(bool b) 1210void KOTodoView::modified(bool b)
1236{ 1211{
1237 emit isModified(b); 1212 emit isModified(b);
1238} 1213}
1239void KOTodoView::setTodoModified( Todo* todo ) 1214void KOTodoView::setTodoModified( Todo* todo )