-rw-r--r-- | libkcal/calendarlocal.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index ca64e66..cce798f 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -214,25 +214,26 @@ bool CalendarLocal::addEventNoDup( Event *event ) } } return addEvent( event ); } bool CalendarLocal::addEvent( Event *event ) { insertEvent( event ); event->registerObserver( this ); setModified( true ); - event->setCalID( mDefaultCalendar ); + if ( event->calID() == 0 ) + event->setCalID( mDefaultCalendar ); event->setCalEnabled( true ); return true; } void CalendarLocal::deleteEvent( Event *event ) { if ( mUndoIncidence ) delete mUndoIncidence; mUndoIncidence = event->clone(); if ( mEventList.removeRef( event ) ) { setModified( true ); } @@ -268,24 +269,25 @@ bool CalendarLocal::addTodoNoDup( Todo *todo ) return addTodo( todo ); } bool CalendarLocal::addTodo( Todo *todo ) { mTodoList.append( todo ); todo->registerObserver( this ); // Set up subtask relations setupRelations( todo ); setModified( true ); + if ( todo->calID() == 0 ) todo->setCalID( mDefaultCalendar ); todo->setCalEnabled( true ); return true; } void CalendarLocal::deleteTodo( Todo *todo ) { // Handle orphaned children if ( mUndoIncidence ) delete mUndoIncidence; removeRelations( todo ); mUndoIncidence = todo->clone(); @@ -772,25 +774,26 @@ QPtrList<Event> CalendarLocal::rawEvents() for ( Event *it = mEventList.first(); it; it = mEventList.next() ) if ( it->calEnabled() ) el.append( it ); return el; } bool CalendarLocal::addJournal(Journal *journal) { mJournalList.append(journal); journal->registerObserver( this ); setModified( true ); - journal->setCalID( mDefaultCalendar ); + if ( journal->calID() == 0 ) + journal->setCalID( mDefaultCalendar ); journal->setCalEnabled( true ); return true; } void CalendarLocal::deleteJournal( Journal *journal ) { if ( mUndoIncidence ) delete mUndoIncidence; mUndoIncidence = journal->clone(); mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); if ( mJournalList.removeRef(journal) ) { setModified( true ); } |