From 4e7c45695672ecdbd0cd14cac0ea29a8e134ee78 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 28 Mar 2005 23:39:37 +0000 Subject: montview sunday fix --- (limited to 'korganizer/kdatenavigator.cpp') 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 ); -- cgit v0.9.0.2