summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweeklst.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookweeklst.cpp10
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
DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
void DateBookWeekLstHeader::setDate(const QDate &d) {
int year,week,dayofweek;
date=d;
dayofweek=d.dayOfWeek();
- if(bStartOnMonday) dayofweek--;
+ if(bStartOnMonday)
+ dayofweek--;
+ else if( dayofweek == 7 )
+ /* we already have the right day -7 would lead to the same week */
+ dayofweek = 0;
+
date=date.addDays(-dayofweek);
calcWeek(date,week,year,bStartOnMonday);
QDate start=date;
QDate stop=start.addDays(6);
labelDate->setText( QString::number(start.day()) + "." +
@@ -114,13 +119,13 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
const char* name,
WFlags fl )
: DateBookWeekLstDayHdrBase(parent, name, fl) {
date=d;
- static const char *wdays={"MTWTFSSM"};
+ static const QString wdays=tr("MTWTFSSM", "Week days");
char day=wdays[d.dayOfWeek()-1];
label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
add->setText("+");
if (d == QDate::currentDate()) {
@@ -234,12 +239,13 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
dayOrder[0]=7;
}
// Calculate offset to first day of week.
int dayoffset=d.dayOfWeek();
if(bStartOnMonday) dayoffset--;
+ else if( dayoffset == 7 ) dayoffset = 0;
for (int i=0; i<7; i++) {
// Header
DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this);
connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),