-rw-r--r-- | korganizer/kdatenavigator.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 38bddc2..2fca49e 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -322,25 +322,23 @@ void KDateNavigator::updateView() // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; daymatrix->updateView(); - + int sub = 4; + if ( ! KGlobal::locale()->weekStartsMonday() ) + --sub; // set the week numbers. for(i = 0; i < 6; i++) { - QString weeknum; // remember, according to ISO 8601, the first week of the year is the // first week that contains a thursday. Thus we must subtract off 4, // not just 1. //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); - int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); - - int add = 0; - if ( ! KGlobal::locale()->weekStartsMonday() ) - ++add; + int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-sub))); + int weekNo; if (dayOfYear % 7 != 0) - weeknum.setNum(dayOfYear / 7 + 1+add); + weekNo = (dayOfYear / 7 + 1); else - weeknum.setNum(dayOfYear / 7 +add); - weeknos[i]->setText(weeknum); + weekNo = (dayOfYear / 7); + weeknos[i]->setText(QString::number( weekNo )); } setUpdatesEnabled( true ); |