summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweek.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookweek.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookweek.cpp63
1 files changed, 26 insertions, 37 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 2ad7aa9..ab7e963 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -22,9 +22,6 @@
22 22
23#include <qpe/calendar.h>
24#include <qpe/datebookdb.h> 23#include <qpe/datebookdb.h>
25#include <qpe/event.h>
26#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
27#include <qpe/timestring.h> 25#include <qpe/calendar.h>
28 26
29#include <qdatetime.h>
30#include <qheader.h> 27#include <qheader.h>
@@ -32,7 +29,3 @@
32#include <qlayout.h> 29#include <qlayout.h>
33#include <qpainter.h>
34#include <qpopupmenu.h>
35#include <qtimer.h> 30#include <qtimer.h>
36#include <qspinbox.h>
37#include <qstyle.h>
38 31
@@ -91,2 +84,6 @@ void DateBookWeekView::initNames()
91{ 84{
85#warning Please review this ! (eilers)
86
87 // Ok, I am Mr. Pedantic, but shouldn't we count until 6 instead of 7, if bOnMonday is false ? (eilers)
88
92 static bool bFirst = true; 89 static bool bFirst = true;
@@ -94,17 +91,11 @@ void DateBookWeekView::initNames()
94 if ( bOnMonday ) { 91 if ( bOnMonday ) {
95 header->addLabel( tr("Mo", "Monday" ) ); 92 for ( int i = 1; i<=7; i++ ) {
96 header->addLabel( tr("Tu", "Tuesday") ); 93 header->addLabel( Calendar::nameOfDay( i ) );
97 header->addLabel( tr("We", "Wednesday" ) ); 94 }
98 header->addLabel( tr("Th", "Thursday" ) ); 95
99 header->addLabel( tr("Fr", "Friday" ) );
100 header->addLabel( tr("Sa", "Saturday" ) );
101 header->addLabel( tr("Su", "Sunday" ) );
102 } else { 96 } else {
103 header->addLabel( tr("Su", "Sunday" ) ); 97 header->addLabel( Calendar::nameOfDay( 7 ) );
104 header->addLabel( tr("Mo", "Monday") ); 98 for ( int i = 1; i<7; i++ ) {
105 header->addLabel( tr("Tu", "Tuesday") ); 99 header->addLabel( Calendar::nameOfDay( i ) );
106 header->addLabel( tr("We", "Wednesday" ) ); 100 }
107 header->addLabel( tr("Th", "Thursday" ) );
108 header->addLabel( tr("Fr", "Friday" ) );
109 header->addLabel( tr("Sa", "Saturday" ) );
110 } 101 }
@@ -114,17 +105,12 @@ void DateBookWeekView::initNames()
114 if ( bOnMonday ) { 105 if ( bOnMonday ) {
115 header->setLabel( 1, tr("Mo", "Monday") ); 106 for ( int i = 1; i<=7; i++ ) {
116 header->setLabel( 2, tr("Tu", "Tuesday") ); 107 header->setLabel( i, Calendar::nameOfDay( i ) );
117 header->setLabel( 3, tr("We", "Wednesday" ) ); 108 }
118 header->setLabel( 4, tr("Th", "Thursday" ) ); 109
119 header->setLabel( 5, tr("Fr", "Friday" ) );
120 header->setLabel( 6, tr("Sa", "Saturday" ) );
121 header->setLabel( 7, tr("Su", "Sunday" ) );
122 } else { 110 } else {
123 header->setLabel( 1, tr("Su", "Sunday" ) ); 111 header->setLabel( 1, Calendar::nameOfDay( 7 ) );
124 header->setLabel( 2, tr("Mo", "Monday") ); 112 for ( int i = 1; i<7; i++ ) {
125 header->setLabel( 3, tr("Tu", "Tuesday") ); 113 header->setLabel( i+1, Calendar::nameOfDay( i ) );
126 header->setLabel( 4, tr("We", "Wednesday" ) ); 114 }
127 header->setLabel( 5, tr("Th", "Thursday" ) ); 115
128 header->setLabel( 6, tr("Fr", "Friday" ) );
129 header->setLabel( 7, tr("Sa", "Saturday" ) );
130 } 116 }
@@ -404,3 +390,4 @@ void DateBookWeek::showDay( int day )
404 // Calculate offset to first day of week. 390 // Calculate offset to first day of week.
405 int dayoffset=d.dayOfWeek(); 391 int dayoffset=d.dayOfWeek() % 7;
392
406 if(bStartOnMonday) dayoffset--; 393 if(bStartOnMonday) dayoffset--;
@@ -577,2 +564,4 @@ QDate DateBookWeek::weekDate() const
577 if(bStartOnMonday) dayoffset--; 564 if(bStartOnMonday) dayoffset--;
565 else if( dayoffset == 7 )
566 dayoffset = 0;
578 567