author | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
commit | 9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (side-by-side diff) | |
tree | 549192e9e27e8972e2b48cf40e1599118df12da5 /libkcal/calendarlocal.cpp | |
parent | 055928e26613f4ab249bd82be86890ed278372f6 (diff) | |
download | kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.zip kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.gz kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendarlocal.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e8c969f..1a1c6be 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -263,30 +263,17 @@ void CalendarLocal::close() mJournalList.clear(); mEventList.setAutoDelete( false ); mTodoList.setAutoDelete( false ); mJournalList.setAutoDelete( false ); setModified( false ); } - void CalendarLocal::clearUndo() -{ - if ( mUndoIncidence ) { - if ( mUndoIncidence->typeID() == eventID ) - delete ((Event*) mUndoIncidence) ; - else if ( mUndoIncidence->typeID() == todoID ) - delete ( (Todo*) mUndoIncidence ); - else if ( mUndoIncidence->typeID() == journalID ) - delete ( (Journal*) mUndoIncidence ); - else - delete mUndoIncidence; - } - mUndoIncidence = 0; -} + bool CalendarLocal::addAnniversaryNoDup( Event *event ) { QString cat; bool isBirthday = true; if( event->categoriesStr() == i18n( "Anniversary" ) ) { isBirthday = false; cat = i18n( "Anniversary" ); } else if( event->categoriesStr() == i18n( "Birthday" ) ) { @@ -335,18 +322,17 @@ bool CalendarLocal::addEvent( Event *event ) event->setCalID( mDefaultCalendar ); event->setCalEnabled( true ); return true; } void CalendarLocal::deleteEvent( Event *event ) { - clearUndo(); - mUndoIncidence = event; + clearUndo(event); if ( mEventList.removeRef( event ) ) { setModified( true ); } } Event *CalendarLocal::event( const QString &uid ) { @@ -390,19 +376,18 @@ bool CalendarLocal::addTodo( Todo *todo ) todo->setCalID( mDefaultCalendar ); todo->setCalEnabled( true ); return true; } void CalendarLocal::deleteTodo( Todo *todo ) { // Handle orphaned children - clearUndo(); removeRelations( todo ); - mUndoIncidence = todo; + clearUndo(todo); if ( mTodoList.removeRef( todo ) ) { setModified( true ); } } QPtrList<Todo> CalendarLocal::rawTodos() { @@ -894,18 +879,17 @@ bool CalendarLocal::addJournal(Journal *journal) if ( journal->calID() == 0 ) journal->setCalID( mDefaultCalendar ); journal->setCalEnabled( true ); return true; } void CalendarLocal::deleteJournal( Journal *journal ) { - clearUndo(); - mUndoIncidence = journal; + clearUndo(journal); if ( mJournalList.removeRef(journal) ) { setModified( true ); } } QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) { QPtrList<Journal> el; @@ -974,17 +958,17 @@ void CalendarLocal::setCalendarRemove( int id ) Journal * ev = JournalList.first(); while ( ev ) { if ( ev->calID() == id ) deleteJournal( ev ); ev = JournalList.next(); } } - clearUndo(); + clearUndo(0); } void CalendarLocal::setCalendarEnabled( int id, bool enable ) { for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) if ( it->calID() == id ) it->setCalEnabled( enable ); |