summaryrefslogtreecommitdiffabout
path: root/korganizer/datenavigatorcontainer.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/datenavigatorcontainer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp35
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
@@ -46,8 +46,11 @@ 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()
{
@@ -134,11 +137,26 @@ void DateNavigatorContainer::setCalendar( Calendar *cal )
KDateNavigator *n = mExtraViews.at( i );
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 );
mNavigatorView->dayMatrix()->repaint( false );
@@ -217,22 +235,8 @@ void DateNavigatorContainer::selectDates( const DateList &dateList )
return;
}
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) {
updateDayMatrixDates();
@@ -371,8 +375,9 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
}
view->setGeometry( x * width,
y * height, width, height );
}
+ mUpdateTimer->start( 250 );
//updateDayMatrixDates();
}
QSize DateNavigatorContainer::minimumSizeHint() const