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.cpp74
1 files changed, 44 insertions, 30 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index d1caff3..2290c53 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -69,71 +69,85 @@ void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
#endif
connect( v, SIGNAL( weekClicked( const QDate & ) ),
SIGNAL( weekClicked( const QDate & ) ) );
connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
- connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
- connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
- connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
- connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
+ connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) );
+ connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) );
+ connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) );
+ connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) );
connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
}
+void DateNavigatorContainer::slotgoNextYear()
+{
+ jumpMonth( 12 );
+ emit goNextYear();
+
+}
+void DateNavigatorContainer::slotgoPrevYear()
+{
+ jumpMonth( -12 );
+ emit goPrevYear();
+
+}
+void DateNavigatorContainer::slotgoPrevMonth()
+{
+ jumpMonth( -1 );
+ emit goPrevMonth();
+
+}
+void DateNavigatorContainer::slotgoNextMonth()
+{
+ jumpMonth( 1 );
+ emit goNextMonth();
+}
+void DateNavigatorContainer::jumpMonth( int month )
+{
+ QDate baseDate = mNavigatorView->baseDate();
+ computeMonthSelected( baseDate.month() + month, false );
+}
void DateNavigatorContainer::slotMonthSelected( int month )
{
- //qDebug("slotMonthSelected %d ", month);
+ computeMonthSelected( month, true );
+}
+void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
+{
+ //qDebug("slotMonthSelected %d ", month);
QDate baseDate = mNavigatorView->baseDate();
if ( baseDate.month() == month )
return;
//qDebug("month %d %d ",baseDate.month(),month);
QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
date = date.addDays( -(baseDate.month()-month ) *30 );
QDate newBase = QDate ( date.year(), date.month() , baseDate.day() );
-#if 0
- mFirstSelectedDate = dateList.first() ;
- mSelectedDateCount = dateList.count() ;
-
- KDateNavigator *view = mExtraViews.at( 0 );
- QDate date = view->baseDate();
-
- QDate curEnd = date.addDays( (mLastDisplayedDN)*30 +7);
- //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() );
- if ( lDate < curEnd && date.addDays( -30 ) < fDate) {
- mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
- mNavigatorView->dayMatrix()->repaint( false );
- for( uint i = 0; i < mLastDisplayedDN; ++i ) {
- KDateNavigator *n = mExtraViews.at( i );
- if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) {
- n->dayMatrix()->repaint( false );
- }
- }
- return;
- }
-#endif
//qDebug("NEW BASE %s", newBase.toString().latin1());
mNavigatorView->setBaseDate( newBase );
QDate last = lastAvailableDate();
QDate first = firstAvailableDate();
QDate selFirst = mFirstSelectedDate;
QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
- if ( selFirst >= first && selLast <= last ) {
+ if ( selFirst >= first && selLast <= last ) {
setBaseDates();
- updateDayMatrixDates();
+ if ( forceEmit )
+ updateDayMatrixDates();
}
else {
setBaseDates();
- updateDayMatrixDates();
- emit monthSelected( month );
+ if ( forceEmit )
+ updateDayMatrixDates();
+ if ( forceEmit )
+ emit monthSelected( month );
}
}
void DateNavigatorContainer::setCalendar( Calendar *cal )
{
mCalendar = cal;
mNavigatorView->setCalendar( cal );
for( uint i = 0; i < mLastDisplayedDN; ++i ) {
KDateNavigator *n = mExtraViews.at( i );