summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp42
-rw-r--r--korganizer/calendarview.h5
-rw-r--r--korganizer/koagendaview.cpp8
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/kotodoview.cpp6
-rw-r--r--korganizer/kotodoview.h1
-rw-r--r--korganizer/koviewmanager.cpp16
-rw-r--r--korganizer/koviewmanager.h7
8 files changed, 52 insertions, 34 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 28b17a5..31e103d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -365,8 +365,13 @@ 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;
mBlockShowDates = false;
@@ -660,11 +665,10 @@ 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 ) {
test->setTagged( false );
@@ -739,15 +743,15 @@ void CalendarView::nextConflict( bool all, bool allday )
mNavigator->slotDaySelect( conflict.date() );
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;
}
void CalendarView::conflictAll()
@@ -779,11 +783,10 @@ void CalendarView::setScrollBarStep(int val )
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;
if ( mDateScrollBar->lineStep () <= count ) {
@@ -793,15 +796,15 @@ void CalendarView::scrollBarValue(int val )
stepdays = day+stepdays;
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
}
void CalendarView::updateView(const QDate &start, const QDate &end)
@@ -838,11 +841,10 @@ void CalendarView::checkFiles()
if ( !message.isEmpty() ) {
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() ));
}
}
void CalendarView::checkAlarms()
@@ -3015,17 +3017,16 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
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) {
// If there is an event view visible update the display
@@ -3176,17 +3177,16 @@ 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 )
mTodoList->updateView();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 0924f07..80f7ed4 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -550,8 +550,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
private:
#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;
KSyncManager* mSyncManager;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index c1b149f..6e65a03 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -376,8 +376,9 @@ 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());
@@ -1141,12 +1142,11 @@ void KOAgendaView::fillAgenda()
if ( globalFlagBlockStartup )
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;
if ( globalFlagBlockAgenda == 0 )
@@ -1353,9 +1353,9 @@ void KOAgendaView::fillAgenda()
mAllDayAgenda->drawContentsToPainter();
mAgenda->drawContentsToPainter();
repaintAgenda();
startIdleTimeout();
- onlyOne = false;
+ flag_blockfillAgenda = false;
}
void KOAgendaView::repaintAgenda()
{
mAgenda->viewport()->repaint( false );
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 4b7ef5b..5e68146 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -255,8 +255,9 @@ class KOAgendaView : public KOEventView {
/** Updates data for selected timespan for all day event*/
void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
private:
+ bool flag_blockfillAgenda;
QTimer* mIdleTimer;
QDateTime mIdleStart;
// view widgets
QFrame *mDayLabels;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index a12c43e..d79a9b9 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -512,9 +512,9 @@ 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;
mCurItemAbove = 0;
@@ -949,8 +949,9 @@ void KOTodoView::storeCurrentItem()
mCurItem = 0;
mCurItemRootParent = 0;
mCurItemParent = 0;
mCurItemAbove = 0;
+ mIsActiveWindow = topLevelWidget()->isActiveWindow();
mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
if (mActiveItem) {
mCurItem = mActiveItem->todo();
KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
@@ -1017,9 +1018,10 @@ void KOTodoView::resetCurrentItem()
QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
}
void KOTodoView::resetFocusToList()
{
- topLevelWidget()->setActiveWindow();
+ if ( mIsActiveWindow )
+ topLevelWidget()->setActiveWindow();
mTodoListView->setFocus();
}
//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
bool KOTodoView::checkTodo( Todo * todo )
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index ecd0ad9..161ecb0 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -254,8 +254,9 @@ class KOTodoView : public KOrg::BaseView
void setTodoModified( Todo* );
void todoModified(Todo *, int );
private:
+ bool mIsActiveWindow;
void addQuickTodoPar( Todo * parentTodo);
/*
* the TodoEditor approach is rather unscaling in the long
* run.
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ba3bc05..4057ae0 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -59,8 +59,15 @@ 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;
mTodoView = 0;
@@ -112,12 +119,9 @@ 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)
lastMode = 0;
@@ -200,11 +204,9 @@ 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
@@ -103,8 +103,15 @@ class KOViewManager : public QObject
void showJournalView();
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;
void createMonthView();