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/mainwindow.cpp') diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2da592b..8e52968 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1478,33 +1478,11 @@ QString MainWindow::syncFileName() return QString( "/tmp/synccalendar.ics" ); #endif } +#include "koglobals.h" +#include void MainWindow::updateWeek(QDate seda) { - int weekNum = 0; - QDate d = QDate ( seda.year(), 1,1); - seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday - if ( seda.addDays(6).year() != seda.year() ) { - if ( seda.year() != d.year() ) { - if ( d.dayOfWeek() > 4 ) - d = QDate ( seda.year(), 1,1); - else - weekNum = 1; - } else { - QDate dd( seda.year()+1, 1,1); - if ( dd.dayOfWeek() <= 4 ) - weekNum = 1; - } - } - if ( weekNum == 0 ){ - int dow = d.dayOfWeek(); - if ( dow <= 4 ) - d = d.addDays( 1-dow ); - else // 5,6,7 - d = d.addDays( 8-dow ); - // we have the first week of the year.we are on monday - weekNum = d.daysTo( seda ) / 7 +1; - } - + int weekNum = KGlobal::locale()->weekNum ( seda ); mWeekPixmap.fill( mWeekBgColor ); QPainter p ( &mWeekPixmap ); p.setFont( mWeekFont ); -- cgit v0.9.0.2