From 0bbef196163a267722978e34db2ba3daaee76f88 Mon Sep 17 00:00:00 2001 From: zautrix Date: Tue, 07 Jun 2005 05:09:23 +0000 Subject: clear view fixes --- 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 eventRSyncSharp = remote->getExternLastSyncEvents(); QPtrList 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 events = mCalendar->events(); for(uint i=0; isetOrganizer(KOPrefs::instance()->email()); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 084b6db..4600090 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -331,6 +331,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void updateView(const QDate &start, const QDate &end); void updateView(); + void clearAllViews(); /** Full update of visible todo views */ void updateTodoViews(); diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index fd9bf29..1320a2e 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1331,6 +1331,13 @@ void KOAgendaView::clearView() mAllDayAgenda->clear(); mAgenda->clear(); } +void KOAgendaView::clearList() +{ + // kdDebug() << "ClearView" << endl; + clearView(); + mAllDayAgenda->hideUnused(); + mAgenda->hideUnused(); +} void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index c6e6602..cc953fc 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -166,6 +166,7 @@ class KOAgendaView : public KOEventView { /** Remove all events from view */ void clearView(); + void clearList(); KOAgenda *agenda() { return mAgenda;} virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 6e6a939..bc16037 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -78,6 +78,10 @@ void KOJournalView::flushView() mEntry->flushEntry(); } +void KOJournalView::clearList() +{ + mEntry->clear(); +} void KOJournalView::showDates(const QDate &start, const QDate &) { // kdDebug() << "KOJournalView::selectDates()" << endl; diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 1c0be82..445f940 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h @@ -43,6 +43,7 @@ class KOJournalView : public KOrg::BaseView ~KOJournalView(); virtual int currentDateCount(); + void clearList(); virtual QPtrList selectedIncidences(); DateList selectedDates() {DateList q; diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 5f32e79..bc52281 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -363,6 +363,10 @@ void KOListView::updateList() } +void KOListView::clearList() +{ + clear (); +} void KOListView::addCat( ) { setCategories( false ); diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index dee69f6..f4d6879 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -257,6 +257,7 @@ class KOListView : public KOEventView void readSettings(KConfig *config, QString setting = "KOListView Layout"); void writeSettings(KConfig *config, QString setting = "KOListView Layout"); void updateList(); + void clearList(); void setStartDate(const QDate &start); int count(); QString getWhatsThisText(QPoint p); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 8ee1363..678cab6 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1415,6 +1415,16 @@ void KOMonthView::updateDayLabels() } +void KOMonthView::clearList() +{ + unsigned int i; + for( i = 0; i < mCells.size(); ++i ) { + mCells[i]->clear(); + } + for( i = 0; i < mCellsW.size(); ++i ) { + mCellsW[i]->clear(); + } +} void KOMonthView::showDates(const QDate &start, const QDate &) { // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index de5c014..65b5e77 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -256,6 +256,7 @@ class KOMonthView: public KOEventView MonthViewCell * selectedCell(); bool skipResize; NavigatorBar* navigatorBar() { return mNavigatorBar ;} + void clearList(); public slots: void nextCell(); void prevCell(); diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index fb4de37..5d9af6d 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -358,6 +358,18 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) } +void KOViewManager::clearAllViews() +{ + + if ( mTodoView ) mTodoView->clearList(); + if ( mListView ) mListView->clearList(); + + if ( mAgendaView ) mAgendaView->clearList(); + if ( mMonthView ) mMonthView->clearList(); + if ( mWhatsNextView ) mWhatsNextView->clearList(); + if ( mJournalView ) mJournalView->clearList(); + +} void KOViewManager::updateView() { // qDebug("KOViewManager::updateView() "); @@ -832,7 +844,6 @@ void KOViewManager::addView(KOrg::BaseView *view) void KOViewManager::setDocumentId( const QString &id ) { if (mTodoView) { - mTodoView->clearList(); mTodoView->setDocumentId( id ); } } diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 8dc03e0..838583b 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -67,6 +67,7 @@ class KOViewManager : public QObject void setDocumentId( const QString & ); void updateView( const QDate &start, const QDate &end ); + void clearAllViews(); void raiseCurrentView( bool fullScreen = false , bool updateView = false); diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 65d8ac3..62d7ede 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -139,6 +139,11 @@ int KOWhatsNextView::currentDateCount() return 0; } +void KOWhatsNextView::clearList() +{ + mTimer->stop(); + mView->setText(" "); +} QPtrList KOWhatsNextView::selectedIncidences() { QPtrList eventList; diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index d6727ac..93574ef 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h @@ -59,6 +59,7 @@ class KOWhatsNextView : public KOrg::BaseView virtual int currentDateCount(); void setEventViewer(KOEventViewerDialog* v ); virtual QPtrList selectedIncidences(); + void clearList(); DateList selectedDates() {DateList q; return q;} diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 63053a5..d959a7a 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1670,6 +1670,7 @@ void MainWindow::enableIncidenceActions( bool enabled ) void MainWindow::importOL() { #ifdef _OL_IMPORT_ + mView->clearAllViews(); KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); id->exec(); delete id; -- cgit v0.9.0.2