-rw-r--r-- | korganizer/kotodoview.cpp | 31 |
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 | |||
@@ -695,45 +695,39 @@ void KOTodoView::updateView() | |||
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 | ||
732 | void KOTodoView::storeCurrentItem() | 726 | void 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) { |
@@ -899,33 +893,32 @@ void KOTodoView::showDates(const QDate &, const QDate &) | |||
899 | 893 | ||
900 | void KOTodoView::showEvents(QPtrList<Event>) | 894 | void 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 | ||
905 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 899 | void 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 | ||
913 | void KOTodoView::editItem(QListViewItem *item ) | 907 | void 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 | ||
919 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 912 | void 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 | ||
924 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 917 | void 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; |
@@ -1083,33 +1076,33 @@ void KOTodoView::changedCategories(int index) | |||
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 | } |
1091 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1084 | void 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 ) |
@@ -1157,51 +1150,33 @@ void KOTodoView::itemClicked(QListViewItem *item) | |||
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 | ||
1194 | void KOTodoView::setDocumentId( const QString &id ) | 1169 | void KOTodoView::setDocumentId( const QString &id ) |
1195 | { | 1170 | { |
1196 | 1171 | ||
1197 | mDocPrefs->setDoc( id ); | 1172 | mDocPrefs->setDoc( id ); |
1198 | } | 1173 | } |
1199 | 1174 | ||
1200 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1175 | void 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 | ||