-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 | |||
@@ -1141,12 +1141,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1141 | Event* eventR; | 1141 | Event* eventR; |
1142 | QString uid; | 1142 | QString uid; |
1143 | int take; | 1143 | int take; |
1144 | Event* eventL; | 1144 | Event* eventL; |
1145 | Event* eventRSync; | 1145 | Event* eventRSync; |
1146 | Event* eventLSync; | 1146 | Event* eventLSync; |
1147 | clearAllViews(); | ||
1147 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1148 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1148 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1149 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1149 | bool fullDateRange = false; | 1150 | bool fullDateRange = false; |
1150 | local->resetTempSyncStat(); | 1151 | local->resetTempSyncStat(); |
1151 | mLastCalendarSync = QDateTime::currentDateTime(); | 1152 | mLastCalendarSync = QDateTime::currentDateTime(); |
1152 | if ( mSyncManager->syncWithDesktop() ) { | 1153 | if ( mSyncManager->syncWithDesktop() ) { |
@@ -1833,14 +1834,14 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1833 | if (!QFile::exists(filename)) { | 1834 | if (!QFile::exists(filename)) { |
1834 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1835 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1835 | return false; | 1836 | return false; |
1836 | } | 1837 | } |
1837 | 1838 | ||
1838 | globalFlagBlockAgenda = 1; | 1839 | globalFlagBlockAgenda = 1; |
1840 | clearAllViews(); | ||
1839 | if (!merge) { | 1841 | if (!merge) { |
1840 | mTodoList->clearList(); | ||
1841 | mViewManager->setDocumentId( filename ); | 1842 | mViewManager->setDocumentId( filename ); |
1842 | mCalendar->close(); | 1843 | mCalendar->close(); |
1843 | } | 1844 | } |
1844 | mStorage->setFileName( filename ); | 1845 | mStorage->setFileName( filename ); |
1845 | 1846 | ||
1846 | if ( mStorage->load() ) { | 1847 | if ( mStorage->load() ) { |
@@ -1945,13 +1946,14 @@ bool CalendarView::checkFileVersion(QString fn) | |||
1945 | mSyncManager->mSyncAlgoPrefs = 3; | 1946 | mSyncManager->mSyncAlgoPrefs = 3; |
1946 | mSyncManager->mWriteBackFile = false; | 1947 | mSyncManager->mWriteBackFile = false; |
1947 | mSyncManager->mWriteBackExistingOnly = false; | 1948 | mSyncManager->mWriteBackExistingOnly = false; |
1948 | mSyncManager->mShowSyncSummary = false; | 1949 | mSyncManager->mShowSyncSummary = false; |
1949 | syncCalendar( fn, 3 ); | 1950 | syncCalendar( fn, 3 ); |
1950 | Event * e = getLastSyncEvent(); | 1951 | Event * e = getLastSyncEvent(); |
1951 | mCalendar->deleteEvent ( e ); | 1952 | if ( e ) |
1953 | deleteEvent ( e ); | ||
1952 | updateView(); | 1954 | updateView(); |
1953 | return true; | 1955 | return true; |
1954 | } | 1956 | } |
1955 | 1957 | ||
1956 | bool CalendarView::saveCalendar( QString filename ) | 1958 | bool CalendarView::saveCalendar( QString filename ) |
1957 | { | 1959 | { |
@@ -1978,12 +1980,13 @@ bool CalendarView::saveCalendar( QString filename ) | |||
1978 | } | 1980 | } |
1979 | 1981 | ||
1980 | void CalendarView::closeCalendar() | 1982 | void CalendarView::closeCalendar() |
1981 | { | 1983 | { |
1982 | 1984 | ||
1983 | // child windows no longer valid | 1985 | // child windows no longer valid |
1986 | clearAllViews(); | ||
1984 | emit closingDown(); | 1987 | emit closingDown(); |
1985 | 1988 | ||
1986 | mCalendar->close(); | 1989 | mCalendar->close(); |
1987 | setModified(false); | 1990 | setModified(false); |
1988 | updateView(); | 1991 | updateView(); |
1989 | } | 1992 | } |
@@ -2429,12 +2432,23 @@ void CalendarView::updateView(const QDate &start, const QDate &end) | |||
2429 | { | 2432 | { |
2430 | mTodoList->updateView(); | 2433 | mTodoList->updateView(); |
2431 | mViewManager->updateView(start, end); | 2434 | mViewManager->updateView(start, end); |
2432 | //mDateNavigator->updateView(); | 2435 | //mDateNavigator->updateView(); |
2433 | } | 2436 | } |
2434 | 2437 | ||
2438 | void CalendarView::clearAllViews() | ||
2439 | { | ||
2440 | mTodoList->clearList(); | ||
2441 | mViewManager->clearAllViews(); | ||
2442 | SearchDialog * sd = mDialogManager->getSearchDialog(); | ||
2443 | if ( sd ) { | ||
2444 | KOListView* kol = sd->listview(); | ||
2445 | if ( kol ) | ||
2446 | kol->clearList(); | ||
2447 | } | ||
2448 | } | ||
2435 | void CalendarView::updateView() | 2449 | void CalendarView::updateView() |
2436 | { | 2450 | { |
2437 | DateList tmpList = mNavigator->selectedDates(); | 2451 | DateList tmpList = mNavigator->selectedDates(); |
2438 | 2452 | ||
2439 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2453 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2440 | mTodoList->updateView(); | 2454 | mTodoList->updateView(); |
@@ -3940,12 +3954,13 @@ void CalendarView::takeOverEvent() | |||
3940 | } | 3954 | } |
3941 | 3955 | ||
3942 | void CalendarView::takeOverCalendar() | 3956 | void CalendarView::takeOverCalendar() |
3943 | { | 3957 | { |
3944 | // TODO: Create Calendar::allIncidences() function and use it here | 3958 | // TODO: Create Calendar::allIncidences() function and use it here |
3945 | 3959 | ||
3960 | clearAllViews(); | ||
3946 | QPtrList<Event> events = mCalendar->events(); | 3961 | QPtrList<Event> events = mCalendar->events(); |
3947 | for(uint i=0; i<events.count(); ++i) { | 3962 | for(uint i=0; i<events.count(); ++i) { |
3948 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3963 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3949 | events.at(i)->recreate(); | 3964 | events.at(i)->recreate(); |
3950 | events.at(i)->setReadOnly(false); | 3965 | events.at(i)->setReadOnly(false); |
3951 | } | 3966 | } |