summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp28
1 files changed, 3 insertions, 25 deletions
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()
1478 return QString( "/tmp/synccalendar.ics" ); 1478 return QString( "/tmp/synccalendar.ics" );
1479#endif 1479#endif
1480} 1480}
1481#include "koglobals.h"
1482#include <kcalendarsystem.h>
1481void MainWindow::updateWeek(QDate seda) 1483void MainWindow::updateWeek(QDate seda)
1482{ 1484{
1483 int weekNum = 0; 1485 int weekNum = KGlobal::locale()->weekNum ( seda );
1484 QDate d = QDate ( seda.year(), 1,1);
1485 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1486 if ( seda.addDays(6).year() != seda.year() ) {
1487 if ( seda.year() != d.year() ) {
1488 if ( d.dayOfWeek() > 4 )
1489 d = QDate ( seda.year(), 1,1);
1490 else
1491 weekNum = 1;
1492 } else {
1493 QDate dd( seda.year()+1, 1,1);
1494 if ( dd.dayOfWeek() <= 4 )
1495 weekNum = 1;
1496 }
1497 }
1498 if ( weekNum == 0 ){
1499 int dow = d.dayOfWeek();
1500 if ( dow <= 4 )
1501 d = d.addDays( 1-dow );
1502 else // 5,6,7
1503 d = d.addDays( 8-dow );
1504 // we have the first week of the year.we are on monday
1505 weekNum = d.daysTo( seda ) / 7 +1;
1506 }
1507
1508 mWeekPixmap.fill( mWeekBgColor ); 1486 mWeekPixmap.fill( mWeekBgColor );
1509 QPainter p ( &mWeekPixmap ); 1487 QPainter p ( &mWeekPixmap );
1510 p.setFont( mWeekFont ); 1488 p.setFont( mWeekFont );