-rw-r--r-- | korganizer/calendarview.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8512a07..c530037 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2980,70 +2980,58 @@ void CalendarView::appointment_edit() | |||
2980 | 2980 | ||
2981 | void CalendarView::appointment_delete() | 2981 | void CalendarView::appointment_delete() |
2982 | { | 2982 | { |
2983 | Event *anEvent = 0; | 2983 | Event *anEvent = 0; |
2984 | 2984 | ||
2985 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2985 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2986 | 2986 | ||
2987 | if (mViewManager->currentView()->isEventView()) { | 2987 | if (mViewManager->currentView()->isEventView()) { |
2988 | if ( incidence && incidence->type() == "Event" ) { | 2988 | if ( incidence && incidence->type() == "Event" ) { |
2989 | anEvent = static_cast<Event *>(incidence); | 2989 | anEvent = static_cast<Event *>(incidence); |
2990 | } | 2990 | } |
2991 | } | 2991 | } |
2992 | 2992 | ||
2993 | if (!anEvent) { | 2993 | if (!anEvent) { |
2994 | KNotifyClient::beep(); | 2994 | KNotifyClient::beep(); |
2995 | return; | 2995 | return; |
2996 | } | 2996 | } |
2997 | 2997 | ||
2998 | deleteEvent(anEvent); | 2998 | deleteEvent(anEvent); |
2999 | } | 2999 | } |
3000 | 3000 | ||
3001 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3001 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3002 | { | 3002 | { |
3003 | if (!sub) return; | 3003 | if (!sub) return; |
3004 | if (!parent) return; | 3004 | if ( sub->relatedTo() == parent ) |
3005 | if ( sub->relatedTo() ) | 3005 | return; |
3006 | sub->relatedTo()->removeRelation(sub); | ||
3007 | sub->setRelatedTo(parent); | 3006 | sub->setRelatedTo(parent); |
3008 | sub->setRelatedToUid(parent->uid()); | ||
3009 | parent->addRelation(sub); | ||
3010 | sub->updated(); | 3007 | sub->updated(); |
3011 | parent->updated(); | ||
3012 | setModified(true); | 3008 | setModified(true); |
3013 | updateView(); | 3009 | updateView(); |
3014 | } | 3010 | } |
3015 | void CalendarView::todo_unsub(Todo *anTodo ) | 3011 | void CalendarView::todo_unsub(Todo *anTodo ) |
3016 | { | 3012 | { |
3017 | // Todo *anTodo = selectedTodo(); | 3013 | todo_resub( 0, anTodo ); |
3018 | if (!anTodo) return; | ||
3019 | if (!anTodo->relatedTo()) return; | ||
3020 | anTodo->relatedTo()->removeRelation(anTodo); | ||
3021 | anTodo->setRelatedTo(0); | ||
3022 | anTodo->updated(); | ||
3023 | anTodo->setRelatedToUid(""); | ||
3024 | setModified(true); | ||
3025 | updateView(); | ||
3026 | } | 3014 | } |
3027 | 3015 | ||
3028 | void CalendarView::deleteTodo(Todo *todo) | 3016 | void CalendarView::deleteTodo(Todo *todo) |
3029 | { | 3017 | { |
3030 | if (!todo) { | 3018 | if (!todo) { |
3031 | KNotifyClient::beep(); | 3019 | KNotifyClient::beep(); |
3032 | return; | 3020 | return; |
3033 | } | 3021 | } |
3034 | if (KOPrefs::instance()->mConfirm) { | 3022 | if (KOPrefs::instance()->mConfirm) { |
3035 | QString text = todo->summary().left(20); | 3023 | QString text = todo->summary().left(20); |
3036 | if (!todo->relations().isEmpty()) { | 3024 | if (!todo->relations().isEmpty()) { |
3037 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3025 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3038 | 3026 | ||
3039 | } | 3027 | } |
3040 | switch (msgItemDelete(text)) { | 3028 | switch (msgItemDelete(text)) { |
3041 | case KMessageBox::Continue: // OK | 3029 | case KMessageBox::Continue: // OK |
3042 | bool deleteT = false; | 3030 | bool deleteT = false; |
3043 | if (!todo->relations().isEmpty()) { | 3031 | if (!todo->relations().isEmpty()) { |
3044 | deleteT = removeCompletedSubTodos( todo ); | 3032 | deleteT = removeCompletedSubTodos( todo ); |
3045 | } | 3033 | } |
3046 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3034 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3047 | if ( !deleteT ) { | 3035 | if ( !deleteT ) { |
3048 | checkExternalId( todo ); | 3036 | checkExternalId( todo ); |
3049 | calendar()->deleteTodo(todo); | 3037 | calendar()->deleteTodo(todo); |