Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 7817042..aad1f3a 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -58,13 +58,18 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const ch | |||
58 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | 58 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} |
59 | 59 | ||
60 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 60 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
61 | int year,week,dayofweek; | 61 | int year,week,dayofweek; |
62 | date=d; | 62 | date=d; |
63 | dayofweek=d.dayOfWeek(); | 63 | dayofweek=d.dayOfWeek(); |
64 | if(bStartOnMonday) dayofweek--; | 64 | if(bStartOnMonday) |
65 | dayofweek--; | ||
66 | else if( dayofweek == 7 ) | ||
67 | /* we already have the right day -7 would lead to the same week */ | ||
68 | dayofweek = 0; | ||
69 | |||
65 | date=date.addDays(-dayofweek); | 70 | date=date.addDays(-dayofweek); |
66 | 71 | ||
67 | calcWeek(date,week,year,bStartOnMonday); | 72 | calcWeek(date,week,year,bStartOnMonday); |
68 | QDate start=date; | 73 | QDate start=date; |
69 | QDate stop=start.addDays(6); | 74 | QDate stop=start.addDays(6); |
70 | labelDate->setText( QString::number(start.day()) + "." + | 75 | labelDate->setText( QString::number(start.day()) + "." + |
@@ -114,13 +119,13 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | |||
114 | const char* name, | 119 | const char* name, |
115 | WFlags fl ) | 120 | WFlags fl ) |
116 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | 121 | : DateBookWeekLstDayHdrBase(parent, name, fl) { |
117 | 122 | ||
118 | date=d; | 123 | date=d; |
119 | 124 | ||
120 | static const char *wdays={"MTWTFSSM"}; | 125 | static const QString wdays=tr("MTWTFSSM", "Week days"); |
121 | char day=wdays[d.dayOfWeek()-1]; | 126 | char day=wdays[d.dayOfWeek()-1]; |
122 | 127 | ||
123 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); | 128 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); |
124 | add->setText("+"); | 129 | add->setText("+"); |
125 | 130 | ||
126 | if (d == QDate::currentDate()) { | 131 | if (d == QDate::currentDate()) { |
@@ -234,12 +239,13 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
234 | dayOrder[0]=7; | 239 | dayOrder[0]=7; |
235 | } | 240 | } |
236 | 241 | ||
237 | // Calculate offset to first day of week. | 242 | // Calculate offset to first day of week. |
238 | int dayoffset=d.dayOfWeek(); | 243 | int dayoffset=d.dayOfWeek(); |
239 | if(bStartOnMonday) dayoffset--; | 244 | if(bStartOnMonday) dayoffset--; |
245 | else if( dayoffset == 7 ) dayoffset = 0; | ||
240 | 246 | ||
241 | for (int i=0; i<7; i++) { | 247 | for (int i=0; i<7; i++) { |
242 | // Header | 248 | // Header |
243 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); | 249 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); |
244 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 250 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
245 | connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), | 251 | connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), |