summaryrefslogtreecommitdiffabout
path: root/korganizer/datenavigatorcontainer.cpp
authorzautrix <zautrix>2005-03-22 16:21:03 (UTC)
committer zautrix <zautrix>2005-03-22 16:21:03 (UTC)
commitab8db23d665b276caa28471bb4db37e6b0de44ef (patch) (unidiff)
tree4697da2d9426f155237614368f993328560d0b21 /korganizer/datenavigatorcontainer.cpp
parentf36f0308a955f869f18c88ab359f9d605e838f1c (diff)
downloadkdepimpi-ab8db23d665b276caa28471bb4db37e6b0de44ef.zip
kdepimpi-ab8db23d665b276caa28471bb4db37e6b0de44ef.tar.gz
kdepimpi-ab8db23d665b276caa28471bb4db37e6b0de44ef.tar.bz2
fix
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
@@ -47,6 +47,9 @@ DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
47 connectNavigatorView( mNavigatorView ); 47 connectNavigatorView( mNavigatorView );
48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
49 mLastDisplayedDN = 0; 49 mLastDisplayedDN = 0;
50 mUpdateTimer;
51 mUpdateTimer = new QTimer( this );
52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
50} 53}
51 54
52DateNavigatorContainer::~DateNavigatorContainer() 55DateNavigatorContainer::~DateNavigatorContainer()
@@ -135,9 +138,24 @@ void DateNavigatorContainer::setCalendar( Calendar *cal )
135 n->setCalendar( cal ); 138 n->setCalendar( cal );
136 } 139 }
137} 140}
141void DateNavigatorContainer::checkUpdateDayMatrixDates()
142{
143 QDate last = lastAvailableDate();
144 QDate first = firstAvailableDate();
145
146 QDate selFirst = mFirstSelectedDate;
147 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
148 if ( selFirst >= first && selLast <= last ) {
149 updateDayMatrixDates();
150 }
151 else {
152 updateDayMatrixDates();
153 emit monthSelected( mFirstSelectedDate.month() );
154 }
155}
138void DateNavigatorContainer::updateDayMatrixDates() 156void DateNavigatorContainer::updateDayMatrixDates()
139{ 157{
140 158 mUpdateTimer->stop();
141 QDate fDate = mFirstSelectedDate; 159 QDate fDate = mFirstSelectedDate;
142 QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); 160 QDate lDate = fDate.addDays( mSelectedDateCount - 1 );
143 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); 161 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
@@ -218,20 +236,6 @@ void DateNavigatorContainer::selectDates( const DateList &dateList )
218 } 236 }
219 QDate fDate = dateList.first(); 237 QDate fDate = dateList.first();
220 QDate lDate = dateList.last(); 238 QDate lDate = dateList.last();
221 if ( mLastDisplayedDN <= 2 ) {
222 mNavigatorView->selectDates( dateList );
223 KDateNavigator *view = mExtraViews.at( 0 );
224 QDate bDate = fDate.addDays( fDate.daysInMonth () - fDate.day() +1 );
225 view->setBaseDate( bDate, false );
226 view->dayMatrix()->setSelectedDaysFrom(fDate , lDate);
227 if ( mLastDisplayedDN == 2 ) {
228 view = mExtraViews.at( 1 );
229 bDate = bDate.addDays( bDate.daysInMonth () - bDate.day() +1 );
230 view->setBaseDate( bDate, false );
231 view->dayMatrix()->setSelectedDaysFrom(fDate , lDate);
232 }
233 return;
234 }
235 //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); 239 //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() );
236 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); 240 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() );
237 if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) { 241 if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) {
@@ -372,6 +376,7 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
372 view->setGeometry( x * width, 376 view->setGeometry( x * width,
373 y * height, width, height ); 377 y * height, width, height );
374 } 378 }
379 mUpdateTimer->start( 250 );
375 //updateDayMatrixDates(); 380 //updateDayMatrixDates();
376} 381}
377 382