summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp18
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
@@ -2992,46 +2992,34 @@ void CalendarView::appointment_delete()
if (!anEvent) {
KNotifyClient::beep();
return;
}
deleteEvent(anEvent);
}
void CalendarView::todo_resub( Todo * parent, Todo * sub )
{
if (!sub) return;
- if (!parent) return;
- if ( sub->relatedTo() )
- sub->relatedTo()->removeRelation(sub);
+ if ( sub->relatedTo() == parent )
+ return;
sub->setRelatedTo(parent);
- sub->setRelatedToUid(parent->uid());
- parent->addRelation(sub);
sub->updated();
- parent->updated();
setModified(true);
updateView();
}
void CalendarView::todo_unsub(Todo *anTodo )
{
- // Todo *anTodo = selectedTodo();
- if (!anTodo) return;
- if (!anTodo->relatedTo()) return;
- anTodo->relatedTo()->removeRelation(anTodo);
- anTodo->setRelatedTo(0);
- anTodo->updated();
- anTodo->setRelatedToUid("");
- setModified(true);
- updateView();
+ todo_resub( 0, anTodo );
}
void CalendarView::deleteTodo(Todo *todo)
{
if (!todo) {
KNotifyClient::beep();
return;
}
if (KOPrefs::instance()->mConfirm) {
QString text = todo->summary().left(20);
if (!todo->relations().isEmpty()) {
text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");