-rw-r--r-- | korganizer/calendarview.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 98e0ac1..bc1c0c7 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2814,17 +2814,17 @@ void CalendarView::slotSelectPickerDate( QDate d) | |||
2814 | if ( len>0 ) | 2814 | if ( len>0 ) |
2815 | to->setDtStart(to->dtDue().addSecs( -len )); | 2815 | to->setDtStart(to->dtDue().addSecs( -len )); |
2816 | else | 2816 | else |
2817 | if (to->dtStart() > to->dtDue() ) | 2817 | if (to->dtStart() > to->dtDue() ) |
2818 | to->setDtStart(to->dtDue().addDays( -3 )); | 2818 | to->setDtStart(to->dtDue().addDays( -3 )); |
2819 | } | 2819 | } |
2820 | 2820 | ||
2821 | todoChanged( to ); | 2821 | todoChanged( to ); |
2822 | } else { | 2822 | } else if ( mMoveIncidence->typeID() == eventID ) { |
2823 | if ( mMoveIncidence->doesRecur() ) { | 2823 | if ( mMoveIncidence->doesRecur() ) { |
2824 | #if 0 | 2824 | #if 0 |
2825 | // PENDING implement this | 2825 | // PENDING implement this |
2826 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2826 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2827 | mCalendar()->addIncidence( newInc ); | 2827 | mCalendar()->addIncidence( newInc ); |
2828 | if ( mMoveIncidence->typeID() == todoID ) | 2828 | if ( mMoveIncidence->typeID() == todoID ) |
2829 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2829 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2830 | else | 2830 | else |
@@ -2834,18 +2834,22 @@ void CalendarView::slotSelectPickerDate( QDate d) | |||
2834 | #endif | 2834 | #endif |
2835 | } | 2835 | } |
2836 | QTime tim = mMoveIncidence->dtStart().time(); | 2836 | QTime tim = mMoveIncidence->dtStart().time(); |
2837 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2837 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2838 | QDateTime dt ( d,tim ); | 2838 | QDateTime dt ( d,tim ); |
2839 | mMoveIncidence->setDtStart( dt ); | 2839 | mMoveIncidence->setDtStart( dt ); |
2840 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2840 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2841 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2841 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2842 | } else if ( mMoveIncidence->typeID() == journalID ) { | ||
2843 | QTime tim = mMoveIncidence->dtStart().time(); | ||
2844 | QDateTime dt ( d,tim ); | ||
2845 | mMoveIncidence->setDtStart( dt ); | ||
2846 | updateView(); | ||
2842 | } | 2847 | } |
2843 | |||
2844 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2848 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2845 | } | 2849 | } |
2846 | } | 2850 | } |
2847 | 2851 | ||
2848 | void CalendarView::removeCategories() | 2852 | void CalendarView::removeCategories() |
2849 | { | 2853 | { |
2850 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2854 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2851 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2855 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
@@ -3180,26 +3184,29 @@ void CalendarView::cloneIncidence(Incidence * orgInc ) | |||
3180 | } else { | 3184 | } else { |
3181 | mCalendar->addTodo( t ); | 3185 | mCalendar->addTodo( t ); |
3182 | updateView(); | 3186 | updateView(); |
3183 | } | 3187 | } |
3184 | } else { | 3188 | } else { |
3185 | delete t; | 3189 | delete t; |
3186 | } | 3190 | } |
3187 | } | 3191 | } |
3188 | else { | 3192 | else if ( newInc->typeID() == eventID ) { |
3189 | Event* e = (Event*) newInc; | 3193 | Event* e = (Event*) newInc; |
3190 | showEventEditor(); | 3194 | showEventEditor(); |
3191 | mEventEditor->editEvent( e ); | 3195 | mEventEditor->editEvent( e ); |
3192 | if ( mEventEditor->exec() ) { | 3196 | if ( mEventEditor->exec() ) { |
3193 | mCalendar->addEvent( e ); | 3197 | mCalendar->addEvent( e ); |
3194 | updateView(); | 3198 | updateView(); |
3195 | } else { | 3199 | } else { |
3196 | delete e; | 3200 | delete e; |
3197 | } | 3201 | } |
3202 | } if ( newInc->typeID() == journalID ) { | ||
3203 | mCalendar->addJournal( (Journal*) newInc ); | ||
3204 | editJournal( (Journal*) newInc ); | ||
3198 | } | 3205 | } |
3199 | setActiveWindow(); | 3206 | setActiveWindow(); |
3200 | } | 3207 | } |
3201 | 3208 | ||
3202 | void CalendarView::newEvent() | 3209 | void CalendarView::newEvent() |
3203 | { | 3210 | { |
3204 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 3211 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
3205 | KOAgendaView *aView = mViewManager->agendaView(); | 3212 | KOAgendaView *aView = mViewManager->agendaView(); |
@@ -3493,17 +3500,17 @@ void CalendarView::deleteTodo(Todo *todo) | |||
3493 | return; | 3500 | return; |
3494 | } | 3501 | } |
3495 | if (KOPrefs::instance()->mConfirm) { | 3502 | if (KOPrefs::instance()->mConfirm) { |
3496 | QString text = todo->summary().left(20); | 3503 | QString text = todo->summary().left(20); |
3497 | if (!todo->relations().isEmpty()) { | 3504 | if (!todo->relations().isEmpty()) { |
3498 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3505 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3499 | 3506 | ||
3500 | } | 3507 | } |
3501 | switch (msgItemDelete(text)) { | 3508 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { |
3502 | case KMessageBox::Continue: // OK | 3509 | case KMessageBox::Continue: // OK |
3503 | bool deleteT = false; | 3510 | bool deleteT = false; |
3504 | if (!todo->relations().isEmpty()) { | 3511 | if (!todo->relations().isEmpty()) { |
3505 | deleteT = removeCompletedSubTodos( todo ); | 3512 | deleteT = removeCompletedSubTodos( todo ); |
3506 | } | 3513 | } |
3507 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3514 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3508 | if ( !deleteT ) { | 3515 | if ( !deleteT ) { |
3509 | checkExternalId( todo ); | 3516 | checkExternalId( todo ); |
@@ -3524,17 +3531,27 @@ void CalendarView::deleteTodo(Todo *todo) | |||
3524 | } | 3531 | } |
3525 | void CalendarView::deleteJournal(Journal *jour) | 3532 | void CalendarView::deleteJournal(Journal *jour) |
3526 | { | 3533 | { |
3527 | if (!jour) { | 3534 | if (!jour) { |
3528 | KNotifyClient::beep(); | 3535 | KNotifyClient::beep(); |
3529 | return; | 3536 | return; |
3530 | } | 3537 | } |
3531 | if (KOPrefs::instance()->mConfirm) { | 3538 | if (KOPrefs::instance()->mConfirm) { |
3532 | switch (msgItemDelete( jour->description().left(20))) { | 3539 | |
3540 | QString des; | ||
3541 | if ( !jour->summary().isEmpty() ) { | ||
3542 | des = jour->summary(); | ||
3543 | } else { | ||
3544 | des = jour->description().left(30); | ||
3545 | des = des.simplifyWhiteSpace (); | ||
3546 | des.replace (QRegExp ("\\n"),"" ); | ||
3547 | des.replace (QRegExp ("\\r"),"" ); | ||
3548 | } | ||
3549 | switch (msgItemDelete( i18n("Journal:") +"\n"+des.left(20))) { | ||
3533 | case KMessageBox::Continue: // OK | 3550 | case KMessageBox::Continue: // OK |
3534 | calendar()->deleteJournal(jour); | 3551 | calendar()->deleteJournal(jour); |
3535 | updateView(); | 3552 | updateView(); |
3536 | break; | 3553 | break; |
3537 | } // switch | 3554 | } // switch |
3538 | } else { | 3555 | } else { |
3539 | calendar()->deleteJournal(jour);; | 3556 | calendar()->deleteJournal(jour);; |
3540 | updateView(); | 3557 | updateView(); |