-rw-r--r-- | korganizer/calendarview.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 608b73b..e13d0be 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1144,6 +1144,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int Event* eventL; Event* eventRSync; Event* eventLSync; + clearAllViews(); QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); bool fullDateRange = false; @@ -1836,8 +1837,8 @@ bool CalendarView::openCalendar(QString filename, bool merge) } globalFlagBlockAgenda = 1; + clearAllViews(); if (!merge) { - mTodoList->clearList(); mViewManager->setDocumentId( filename ); mCalendar->close(); } @@ -1948,7 +1949,8 @@ bool CalendarView::checkFileVersion(QString fn) mSyncManager->mShowSyncSummary = false; syncCalendar( fn, 3 ); Event * e = getLastSyncEvent(); - mCalendar->deleteEvent ( e ); + if ( e ) + deleteEvent ( e ); updateView(); return true; } @@ -1981,6 +1983,7 @@ void CalendarView::closeCalendar() { // child windows no longer valid + clearAllViews(); emit closingDown(); mCalendar->close(); @@ -2432,6 +2435,17 @@ void CalendarView::updateView(const QDate &start, const QDate &end) //mDateNavigator->updateView(); } +void CalendarView::clearAllViews() +{ + mTodoList->clearList(); + mViewManager->clearAllViews(); + SearchDialog * sd = mDialogManager->getSearchDialog(); + if ( sd ) { + KOListView* kol = sd->listview(); + if ( kol ) + kol->clearList(); + } +} void CalendarView::updateView() { DateList tmpList = mNavigator->selectedDates(); @@ -3943,6 +3957,7 @@ void CalendarView::takeOverCalendar() { // TODO: Create Calendar::allIncidences() function and use it here + clearAllViews(); QPtrList<Event> events = mCalendar->events(); for(uint i=0; i<events.count(); ++i) { events.at(i)->setOrganizer(KOPrefs::instance()->email()); |