-rw-r--r-- | korganizer/calendarview.cpp | 42 | ||||
-rw-r--r-- | korganizer/calendarview.h | 5 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 8 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 16 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 7 |
8 files changed, 51 insertions, 33 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 28b17a5..31e103d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -366,6 +366,11 @@ CalendarView::CalendarView( Calendar *calendar, void CalendarView::init() { + flag_blockConflict = false; + flag_blockScrollBar = false; + flag_checkFileFirsttime = true; + flag_clearallviewsEventDisplay = false; + flag_clearallviewsupdateView = false; mNextAlarmDateTime = QDateTime::currentDateTime(); setFocusPolicy (NoFocus ); mViewerCallerIsSearchDialog = false; @@ -661,9 +666,8 @@ CalendarView::~CalendarView() void CalendarView::nextConflict( bool all, bool allday ) { - static bool block = false; - if ( block ) return; - block = true; + if ( flag_blockConflict ) return; + flag_blockConflict = true; QPtrList<Event> testlist = mCalendar->events(); Event * test = testlist.first(); while ( test ) { @@ -740,13 +744,13 @@ void CalendarView::nextConflict( bool all, bool allday ) int hour = conflict.time().hour(); mViewManager->agendaView()->setStartHour( hour ); topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); - block = false; + flag_blockConflict = false; return; } topLevelWidget()->setCaption( i18n("No conflict found") ); //qDebug("No conflict found "); - block = false; + flag_blockConflict = false; return; } @@ -780,9 +784,8 @@ void CalendarView::scrollBarValue(int val ) { #ifdef DESKTOP_VERSION if ( QApplication::desktop()->width() < 800 ) return; - static bool block = false; - if ( block ) return; - block = true; + if ( flag_blockScrollBar ) return; + flag_blockScrollBar = true; int count = mNavigator->selectedDates().count(); int day = mNavigator->selectedDates().first().dayOfYear(); int stepdays = val; @@ -794,13 +797,13 @@ void CalendarView::scrollBarValue(int val ) if ( stepdays < 0 ) stepdays = 0; } if ( stepdays == day ) { - block = false; + flag_blockScrollBar = false; return; } int year = mNavigator->selectedDates().first().year(); QDate d ( year,1,1 ); mNavigator->selectDates( d.addDays( stepdays-1) , count ); - block = false; + flag_blockScrollBar = false; #endif } @@ -839,9 +842,8 @@ void CalendarView::checkFiles() message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); } - static bool firstTime = true; - if ( firstTime ) { - firstTime = false; + if ( flag_checkFileFirsttime ) { + flag_checkFileFirsttime = false; QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); } } @@ -3016,15 +3018,14 @@ void CalendarView::changeEventDisplay(Event *which, int action) { // kdDebug() << "CalendarView::changeEventDisplay" << endl; changeIncidenceDisplay((Incidence *)which, action); - static bool clearallviews = false; if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { - if ( clearallviews ) { + if ( flag_clearallviewsEventDisplay ) { clearAllViews(); - clearallviews = false; + flag_clearallviewsEventDisplay = false; } return; } - clearallviews = true; + flag_clearallviewsEventDisplay = true; mDateNavigator->updateView(); //mDialogManager->updateSearchDialog(); if (which) { @@ -3177,15 +3178,14 @@ void CalendarView::clearAllViews() } void CalendarView::updateView() { - static bool clearallviews = false; if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { - if ( clearallviews ) { + if ( flag_clearallviewsupdateView ) { clearAllViews(); - clearallviews = false; + flag_clearallviewsupdateView = false; } return; } - clearallviews = true; + flag_clearallviewsupdateView = true; DateList tmpList = mNavigator->selectedDates(); if ( KOPrefs::instance()->mHideNonStartedTodos ) diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 0924f07..80f7ed4 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -551,6 +551,11 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser #ifdef DESKTOP_VERSION QScrollBar * mDateScrollBar; #endif + bool flag_blockConflict; + bool flag_blockScrollBar; + bool flag_checkFileFirsttime; + bool flag_clearallviewsEventDisplay; + bool flag_clearallviewsupdateView; QDateTime mNextAlarmDateTime; bool mViewerCallerIsSearchDialog; bool mBlockShowDates; diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c1b149f..6e65a03 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -377,6 +377,7 @@ void EventIndicator::enableColumn(int column, bool enable) KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : KOEventView (cal,parent,name) { + flag_blockfillAgenda = false; mBlockUpdating = true; mStartHour = 8; mSelectedDates.append(QDate::currentDate()); @@ -1142,10 +1143,9 @@ void KOAgendaView::fillAgenda() return; if ( globalFlagBlockAgenda == 1 ) return; - static bool onlyOne = false; - if ( onlyOne ) + if ( flag_blockfillAgenda ) return; - onlyOne = true; + flag_blockfillAgenda = true; //if ( globalFlagBlockAgenda == 2 ) //globalFlagBlockAgenda = 0; // globalFlagBlockPainting = false; @@ -1354,7 +1354,7 @@ void KOAgendaView::fillAgenda() mAgenda->drawContentsToPainter(); repaintAgenda(); startIdleTimeout(); - onlyOne = false; + flag_blockfillAgenda = false; } void KOAgendaView::repaintAgenda() { diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 4b7ef5b..5e68146 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -256,6 +256,7 @@ class KOAgendaView : public KOEventView { void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); private: + bool flag_blockfillAgenda; QTimer* mIdleTimer; QDateTime mIdleStart; // view widgets diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index a12c43e..d79a9b9 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -513,7 +513,7 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev) KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : KOrg::BaseView(calendar,parent,name) { - + mIsActiveWindow = false; mCurItem = 0; mCurItemRootParent = 0; mCurItemParent = 0; @@ -950,6 +950,7 @@ void KOTodoView::storeCurrentItem() mCurItemRootParent = 0; mCurItemParent = 0; mCurItemAbove = 0; + mIsActiveWindow = topLevelWidget()->isActiveWindow(); mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); if (mActiveItem) { mCurItem = mActiveItem->todo(); @@ -1018,6 +1019,7 @@ void KOTodoView::resetCurrentItem() } void KOTodoView::resetFocusToList() { + if ( mIsActiveWindow ) topLevelWidget()->setActiveWindow(); mTodoListView->setFocus(); } diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index ecd0ad9..161ecb0 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -255,6 +255,7 @@ class KOTodoView : public KOrg::BaseView void todoModified(Todo *, int ); private: + bool mIsActiveWindow; void addQuickTodoPar( Todo * parentTodo); /* * the TodoEditor approach is rather unscaling in the long diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index ba3bc05..4057ae0 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -60,6 +60,13 @@ int globalFlagBlockAgendaItemUpdate = 1; KOViewManager::KOViewManager( CalendarView *mainView ) : QObject(), mMainView( mainView ) { + + lastMode = 0; + lastCount = 0; + lastNDMode = false; + selecteddatescount = 0; + selecteddate = QDate ( 2000, 1, 1 ); + baseCycleDate = QDate ( 2000, 1, 1 ); mCurrentView = 0; flagResetViewChangeDate = 0; mWhatsNextView = 0; @@ -113,10 +120,7 @@ void KOViewManager::readSettings(KConfig *config) void KOViewManager::showDateView( int view, QDate date) { - static int lastMode = 0; - static int lastCount = 0; - static bool lastNDMode = false; - static QDate lastDate; + //qDebug("date %d %s", view, date.toString().latin1()); if (view != 9) @@ -201,9 +205,7 @@ void KOViewManager::writeSettings(KConfig *config) } void KOViewManager::showNextView() { - static int selecteddatescount = 0; - static QDate selecteddate = QDate ( 2000, 1, 1 ); - static QDate baseCycleDate = QDate ( 2000, 1, 1 ); + int newCount = mMainView->dateNavigator()->selectedDates().count(); if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { flagResetViewChangeDate = 1; diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 2e6aaed..2aa46d0 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -104,6 +104,13 @@ class KOViewManager : public QObject void showTimeSpanView(); private: + int lastMode; + int lastCount; + bool lastNDMode; + QDate lastDate; + int selecteddatescount; + QDate selecteddate; + QDate baseCycleDate; void resetDateSilent( QDate date , int days ); int flagResetViewChangeDate; QDate currentViewChangeDate; |