Diffstat (limited to 'korganizer/datenavigatorcontainer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 9720146..ba97fa6 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp @@ -47,6 +47,9 @@ DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, connectNavigatorView( mNavigatorView ); //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); mLastDisplayedDN = 0; + mUpdateTimer; + mUpdateTimer = new QTimer( this ); + connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); } DateNavigatorContainer::~DateNavigatorContainer() @@ -135,9 +138,24 @@ void DateNavigatorContainer::setCalendar( Calendar *cal ) n->setCalendar( cal ); } } +void DateNavigatorContainer::checkUpdateDayMatrixDates() +{ + QDate last = lastAvailableDate(); + QDate first = firstAvailableDate(); + + QDate selFirst = mFirstSelectedDate; + QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); + if ( selFirst >= first && selLast <= last ) { + updateDayMatrixDates(); + } + else { + updateDayMatrixDates(); + emit monthSelected( mFirstSelectedDate.month() ); + } +} void DateNavigatorContainer::updateDayMatrixDates() { - + mUpdateTimer->stop(); QDate fDate = mFirstSelectedDate; QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); @@ -218,20 +236,6 @@ void DateNavigatorContainer::selectDates( const DateList &dateList ) } QDate fDate = dateList.first(); QDate lDate = dateList.last(); - if ( mLastDisplayedDN <= 2 ) { - mNavigatorView->selectDates( dateList ); - KDateNavigator *view = mExtraViews.at( 0 ); - QDate bDate = fDate.addDays( fDate.daysInMonth () - fDate.day() +1 ); - view->setBaseDate( bDate, false ); - view->dayMatrix()->setSelectedDaysFrom(fDate , lDate); - if ( mLastDisplayedDN == 2 ) { - view = mExtraViews.at( 1 ); - bDate = bDate.addDays( bDate.daysInMonth () - bDate.day() +1 ); - view->setBaseDate( bDate, false ); - view->dayMatrix()->setSelectedDaysFrom(fDate , lDate); - } - return; - } //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) { @@ -372,6 +376,7 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) view->setGeometry( x * width, y * height, width, height ); } + mUpdateTimer->start( 250 ); //updateDayMatrixDates(); } |