summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-10 13:17:21 (UTC)
committer zautrix <zautrix>2005-04-10 13:17:21 (UTC)
commitef11b9d4de01d601bfcfb8efacb0aeff1e657edb (patch) (unidiff)
tree5f4e6aa51ef357c6d9ecbe4d9a2908b8c2ca1228 /korganizer
parent04fe8f3523c46511e846a42e4bb92d6b8d33758b (diff)
downloadkdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.zip
kdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.tar.gz
kdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.tar.bz2
fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp25
-rw-r--r--korganizer/kotodoview.cpp6
2 files changed, 26 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c530037..bd7376a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2643,133 +2643,154 @@ void CalendarView::showTodoEditor()
2643 w = mTodoEditor->width(); 2643 w = mTodoEditor->width();
2644 h = mTodoEditor->height(); 2644 h = mTodoEditor->height();
2645 mTodoEditor->show(); 2645 mTodoEditor->show();
2646 mTodoEditor->setGeometry(x,y,w,h); 2646 mTodoEditor->setGeometry(x,y,w,h);
2647#else 2647#else
2648 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2648 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2649 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2649 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2650 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2650 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2651 qApp->processEvents(); 2651 qApp->processEvents();
2652 delete mTodoEditor; 2652 delete mTodoEditor;
2653 mTodoEditor = mDialogManager->getTodoEditor(); 2653 mTodoEditor = mDialogManager->getTodoEditor();
2654 topLevelWidget()->setCaption( i18n("") ); 2654 topLevelWidget()->setCaption( i18n("") );
2655 } 2655 }
2656 mTodoEditor->showMaximized(); 2656 mTodoEditor->showMaximized();
2657#endif 2657#endif
2658} 2658}
2659 2659
2660void CalendarView::cloneIncidence() 2660void CalendarView::cloneIncidence()
2661{ 2661{
2662 Incidence *incidence = currentSelection(); 2662 Incidence *incidence = currentSelection();
2663 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2663 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2664 if ( incidence ) { 2664 if ( incidence ) {
2665 cloneIncidence(incidence); 2665 cloneIncidence(incidence);
2666 } 2666 }
2667} 2667}
2668void CalendarView::moveIncidence() 2668void CalendarView::moveIncidence()
2669{ 2669{
2670 Incidence *incidence = currentSelection(); 2670 Incidence *incidence = currentSelection();
2671 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2671 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2672 if ( incidence ) { 2672 if ( incidence ) {
2673 moveIncidence(incidence); 2673 moveIncidence(incidence);
2674 } 2674 }
2675} 2675}
2676void CalendarView::beamIncidence() 2676void CalendarView::beamIncidence()
2677{ 2677{
2678 Incidence *incidence = currentSelection(); 2678 Incidence *incidence = currentSelection();
2679 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2679 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2680 if ( incidence ) { 2680 if ( incidence ) {
2681 beamIncidence(incidence); 2681 beamIncidence(incidence);
2682 } 2682 }
2683} 2683}
2684void CalendarView::toggleCancelIncidence() 2684void CalendarView::toggleCancelIncidence()
2685{ 2685{
2686 Incidence *incidence = currentSelection(); 2686 Incidence *incidence = currentSelection();
2687 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2687 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2688 if ( incidence ) { 2688 if ( incidence ) {
2689 cancelIncidence(incidence); 2689 cancelIncidence(incidence);
2690 } 2690 }
2691} 2691}
2692 2692
2693 2693
2694void CalendarView::cancelIncidence(Incidence * inc ) 2694void CalendarView::cancelIncidence(Incidence * inc )
2695{ 2695{
2696 inc->setCancelled( ! inc->cancelled() ); 2696 inc->setCancelled( ! inc->cancelled() );
2697 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2697 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2698 updateView(); 2698 updateView();
2699} 2699}
2700void CalendarView::cloneIncidence(Incidence * orgInc ) 2700void CalendarView::cloneIncidence(Incidence * orgInc )
2701{ 2701{
2702 Incidence * newInc = orgInc->clone(); 2702 Incidence * newInc = orgInc->clone();
2703 newInc->recreate(); 2703 newInc->recreate();
2704 2704
2705 if ( newInc->type() == "Todo" ) { 2705 if ( newInc->type() == "Todo" ) {
2706 Todo* t = (Todo*) newInc; 2706 Todo* t = (Todo*) newInc;
2707 bool cloneSub = false;
2708 if ( orgInc->relations().count() ) {
2709 int result = KMessageBox::warningYesNoCancel(this,
2710 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ),
2711 i18n("Todo has subtodos"),
2712 i18n("Yes"),
2713 i18n("No"));
2714
2715 if ( result == KMessageBox::Cancel ) {
2716 delete t;
2717 return;
2718 }
2719 if (result == KMessageBox::Yes) cloneSub = true;
2720 }
2707 showTodoEditor(); 2721 showTodoEditor();
2708 mTodoEditor->editTodo( t ); 2722 mTodoEditor->editTodo( t );
2709 if ( mTodoEditor->exec() ) { 2723 if ( mTodoEditor->exec() ) {
2710 mCalendar->addTodo( t ); 2724 if ( cloneSub ) {
2711 updateView(); 2725 orgInc->cloneRelations( t );
2726 mCalendar->addIncidenceBranch( t );
2727 updateView();
2728
2729 } else {
2730 mCalendar->addTodo( t );
2731 updateView();
2732 }
2712 } else { 2733 } else {
2713 delete t; 2734 delete t;
2714 } 2735 }
2715 } 2736 }
2716 else { 2737 else {
2717 Event* e = (Event*) newInc; 2738 Event* e = (Event*) newInc;
2718 showEventEditor(); 2739 showEventEditor();
2719 mEventEditor->editEvent( e ); 2740 mEventEditor->editEvent( e );
2720 if ( mEventEditor->exec() ) { 2741 if ( mEventEditor->exec() ) {
2721 mCalendar->addEvent( e ); 2742 mCalendar->addEvent( e );
2722 updateView(); 2743 updateView();
2723 } else { 2744 } else {
2724 delete e; 2745 delete e;
2725 } 2746 }
2726 } 2747 }
2727 setActiveWindow(); 2748 setActiveWindow();
2728} 2749}
2729 2750
2730void CalendarView::newEvent() 2751void CalendarView::newEvent()
2731{ 2752{
2732 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2753 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2733 KOAgendaView *aView = mViewManager->agendaView(); 2754 KOAgendaView *aView = mViewManager->agendaView();
2734 if (aView) { 2755 if (aView) {
2735 if (aView->selectionStart().isValid()) { 2756 if (aView->selectionStart().isValid()) {
2736 if (aView->selectedIsAllDay()) { 2757 if (aView->selectedIsAllDay()) {
2737 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2758 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2738 } else { 2759 } else {
2739 newEvent(aView->selectionStart(),aView->selectionEnd()); 2760 newEvent(aView->selectionStart(),aView->selectionEnd());
2740 } 2761 }
2741 return; 2762 return;
2742 } 2763 }
2743 } 2764 }
2744 2765
2745 QDate date = mNavigator->selectedDates().first(); 2766 QDate date = mNavigator->selectedDates().first();
2746 QDateTime current = QDateTime::currentDateTime(); 2767 QDateTime current = QDateTime::currentDateTime();
2747 if ( date <= current.date() ) { 2768 if ( date <= current.date() ) {
2748 int hour = current.time().hour() +1; 2769 int hour = current.time().hour() +1;
2749 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2770 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2750 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2771 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2751 } else 2772 } else
2752 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2773 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2753 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2774 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2754 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2775 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2755} 2776}
2756 2777
2757void CalendarView::newEvent(QDateTime fh) 2778void CalendarView::newEvent(QDateTime fh)
2758{ 2779{
2759 newEvent(fh, 2780 newEvent(fh,
2760 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2781 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2761} 2782}
2762 2783
2763void CalendarView::newEvent(QDate dt) 2784void CalendarView::newEvent(QDate dt)
2764{ 2785{
2765 newEvent(QDateTime(dt, QTime(0,0,0)), 2786 newEvent(QDateTime(dt, QTime(0,0,0)),
2766 QDateTime(dt, QTime(0,0,0)), true); 2787 QDateTime(dt, QTime(0,0,0)), true);
2767} 2788}
2768void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) 2789void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
2769{ 2790{
2770 newEvent(fromHint, toHint, false); 2791 newEvent(fromHint, toHint, false);
2771} 2792}
2772void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2793void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2773{ 2794{
2774 2795
2775 showEventEditor(); 2796 showEventEditor();
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 7ee1eef..9b5d4ce 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1058,141 +1058,141 @@ QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1058 it != KOPrefs::instance()->mCustomCategories.end (); 1058 it != KOPrefs::instance()->mCustomCategories.end ();
1059 ++it) { 1059 ++it) {
1060 int index = tempMenu->insertItem (*it); 1060 int index = tempMenu->insertItem (*it);
1061 mCategory[index] = *it; 1061 mCategory[index] = *it;
1062 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1062 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1063 } 1063 }
1064 1064
1065 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1065 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1066 return tempMenu; 1066 return tempMenu;
1067 1067
1068 1068
1069} 1069}
1070void KOTodoView::changedCategories(int index) 1070void KOTodoView::changedCategories(int index)
1071{ 1071{
1072 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1072 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1073 QStringList categories = mActiveItem->todo()->categories (); 1073 QStringList categories = mActiveItem->todo()->categories ();
1074 QString colcat = categories.first(); 1074 QString colcat = categories.first();
1075 if (categories.find (mCategory[index]) != categories.end ()) 1075 if (categories.find (mCategory[index]) != categories.end ())
1076 categories.remove (mCategory[index]); 1076 categories.remove (mCategory[index]);
1077 else 1077 else
1078 categories.insert (categories.end(), mCategory[index]); 1078 categories.insert (categories.end(), mCategory[index]);
1079 categories.sort (); 1079 categories.sort ();
1080 if ( !colcat.isEmpty() ) { 1080 if ( !colcat.isEmpty() ) {
1081 if ( categories.find ( colcat ) != categories.end () ) { 1081 if ( categories.find ( colcat ) != categories.end () ) {
1082 categories.remove( colcat ); 1082 categories.remove( colcat );
1083 categories.prepend( colcat ); 1083 categories.prepend( colcat );
1084 } 1084 }
1085 } 1085 }
1086 mActiveItem->todo()->setCategories (categories); 1086 mActiveItem->todo()->setCategories (categories);
1087 mActiveItem->construct(); 1087 mActiveItem->construct();
1088 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1088 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1089 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1089 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1090 } 1090 }
1091} 1091}
1092void KOTodoView::itemDoubleClicked(QListViewItem *item) 1092void KOTodoView::itemDoubleClicked(QListViewItem *item)
1093{ 1093{
1094 if ( pendingSubtodo != 0 ) { 1094 if ( pendingSubtodo != 0 ) {
1095 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1095 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1096 } 1096 }
1097 pendingSubtodo = 0; 1097 pendingSubtodo = 0;
1098 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1098 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1099 //qDebug("ROW %d ", row); 1099 //qDebug("ROW %d ", row);
1100 if (!item) { 1100 if (!item) {
1101 newTodo(); 1101 newTodo();
1102 return; 1102 return;
1103 } else { 1103 } else {
1104 if ( row == 2 ) { 1104 if ( row == 2 ) {
1105 mActiveItem = (KOTodoViewItem *) item; 1105 mActiveItem = (KOTodoViewItem *) item;
1106 newSubTodo(); 1106 newSubTodo();
1107 return; 1107 return;
1108 } 1108 }
1109 if ( row == 1 ) { 1109 if ( row == 1 ) {
1110 mActiveItem = (KOTodoViewItem *) item; 1110 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem(); 1111 toggleRunningItem();
1112 return; 1112 return;
1113 } 1113 }
1114 } 1114 }
1115 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1115 if ( KOPrefs::instance()->mEditOnDoubleClick )
1116 editItem( item ); 1116 editItem( item );
1117 else 1117 else
1118 showItem( item , QPoint(), 0 ); 1118 showItem( item , QPoint(), 0 );
1119} 1119}
1120void KOTodoView::toggleRunningItem() 1120void KOTodoView::toggleRunningItem()
1121{ 1121{
1122 qDebug("KOTodoView::toggleRunning() "); 1122 // qDebug("KOTodoView::toggleRunning() ");
1123 if ( ! mActiveItem ) 1123 if ( ! mActiveItem )
1124 return; 1124 return;
1125 Todo * t = mActiveItem->todo(); 1125 Todo * t = mActiveItem->todo();
1126 if ( t->isRunning() ) { 1126 if ( t->isRunning() ) {
1127 int result = KMessageBox::warningContinueCancel(this, 1127 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( 20 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); 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);
1129 if (result != KMessageBox::Continue) return; 1129 if (result != KMessageBox::Continue) return;
1130 t->setRunning( false ); 1130 t->setRunning( false );
1131 mActiveItem->construct(); 1131 mActiveItem->construct();
1132 } else { 1132 } else {
1133 int result = KMessageBox::warningContinueCancel(this, 1133 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( 20 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); 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);
1135 if (result != KMessageBox::Continue) return; 1135 if (result != KMessageBox::Continue) return;
1136 t->setRunning( true ); 1136 t->setRunning( true );
1137 mActiveItem->construct(); 1137 mActiveItem->construct();
1138 } 1138 }
1139} 1139}
1140 1140
1141void KOTodoView::itemClicked(QListViewItem *item) 1141void KOTodoView::itemClicked(QListViewItem *item)
1142{ 1142{
1143 //qDebug("KOTodoView::itemClicked %d", item); 1143 //qDebug("KOTodoView::itemClicked %d", item);
1144 if (!item) { 1144 if (!item) {
1145 if ( pendingSubtodo != 0 ) { 1145 if ( pendingSubtodo != 0 ) {
1146 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1146 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1147 } 1147 }
1148 pendingSubtodo = 0; 1148 pendingSubtodo = 0;
1149 return; 1149 return;
1150 } 1150 }
1151 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1151 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1152 if ( pendingSubtodo != 0 ) { 1152 if ( pendingSubtodo != 0 ) {
1153 bool allowReparent = true; 1153 bool allowReparent = true;
1154 QListViewItem *par = item; 1154 QListViewItem *par = item;
1155 while ( par ) { 1155 while ( par ) {
1156 if ( par == pendingSubtodo ) { 1156 if ( par == pendingSubtodo ) {
1157 allowReparent = false; 1157 allowReparent = false;
1158 break; 1158 break;
1159 } 1159 }
1160 par = par->parent(); 1160 par = par->parent();
1161 } 1161 }
1162 if ( !allowReparent ) { 1162 if ( !allowReparent ) {
1163 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1163 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1164 qDebug("Recursive reparenting not possible "); 1164 qDebug("Recursive reparenting not possible ");
1165 pendingSubtodo = 0; 1165 pendingSubtodo = 0;
1166 } else { 1166 } else {
1167 Todo* newParent = todoItem->todo(); 1167 Todo* newParent = todoItem->todo();
1168 Todo* newSub = pendingSubtodo->todo(); 1168 Todo* newSub = pendingSubtodo->todo();
1169 pendingSubtodo = 0; 1169 pendingSubtodo = 0;
1170 emit reparentTodoSignal( newParent,newSub ); 1170 emit reparentTodoSignal( newParent,newSub );
1171 return; 1171 return;
1172 } 1172 }
1173 } 1173 }
1174#if 0 1174#if 0
1175 // handled by the item itself 1175 // handled by the item itself
1176 bool completed = todoItem->todo()->isCompleted(); // Completed or not? 1176 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1177 qDebug("com %d ",completed ); 1177 qDebug("com %d ",completed );
1178 qDebug("itemclicked "); 1178 qDebug("itemclicked ");
1179 if (todoItem->isOn()) { 1179 if (todoItem->isOn()) {
1180 qDebug("on "); 1180 qDebug("on ");
1181 if (!completed) { 1181 if (!completed) {
1182 qDebug("set true "); 1182 qDebug("set true ");
1183 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 1183 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1184 } 1184 }
1185 } else { 1185 } else {
1186 qDebug("not on "); 1186 qDebug("not on ");
1187 if (completed) { 1187 if (completed) {
1188 qDebug("set false "); 1188 qDebug("set false ");
1189 todoItem->todo()->setCompleted(false); 1189 todoItem->todo()->setCompleted(false);
1190 } 1190 }
1191 } 1191 }
1192#endif 1192#endif
1193} 1193}
1194 1194
1195void KOTodoView::setDocumentId( const QString &id ) 1195void KOTodoView::setDocumentId( const QString &id )
1196{ 1196{
1197 kdDebug() << "KOTodoView::setDocumentId()" << endl; 1197 kdDebug() << "KOTodoView::setDocumentId()" << endl;
1198 1198