summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweeklst.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookweeklst.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index aad1f3a..24fb0ba 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -1,29 +1,14 @@
1#include "datebookweeklst.h" 1#include "datebookweeklst.h"
2 2
3#include "datebookweekheaderimpl.h"
4 3
5#include "datebook.h" 4#include "datebook.h"
6 5
7#include <qpe/calendar.h>
8#include <qpe/datebookdb.h>
9#include <qpe/event.h>
10#include <qpe/qpeapplication.h>
11#include <qpe/timestring.h>
12#include <qpe/datebookmonth.h> 6#include <qpe/datebookmonth.h>
13#include <qpe/config.h> 7#include <qpe/config.h>
14#include <qpe/resource.h> 8#include <qpe/resource.h>
9#include <qpe/calendar.h>
15 10
16#include <qdatetime.h>
17#include <qheader.h>
18#include <qlabel.h>
19#include <qlayout.h> 11#include <qlayout.h>
20#include <qpainter.h>
21#include <qpopupmenu.h>
22#include <qtimer.h>
23#include <qstyle.h>
24#include <qtoolbutton.h> 12#include <qtoolbutton.h>
25#include <qvbox.h>
26#include <qsizepolicy.h>
27#include <qabstractlayout.h>
28#include <qtl.h> 13#include <qtl.h>
29 14
@@ -74,8 +59,9 @@ void DateBookWeekLstHeader::setDate(const QDate &d) {
74 QDate stop=start.addDays(6); 59 QDate stop=start.addDays(6);
75 labelDate->setText( QString::number(start.day()) + "." + 60 labelDate->setText( QString::number(start.day()) + "." +
76 start.monthName(start.month()) + "-" + 61 Calendar::nameOfMonth( start.month() ) + "-" +
77 QString::number(stop.day()) + "." + 62 QString::number(stop.day()) + "." +
78 start.monthName(stop.month()) +" ("+ 63 Calendar::nameOfMonth( stop.month()) +" ("+
79 tr("w")+":"+QString::number( week ) +")"); 64 tr("w")+":"+QString::number( week ) +")");
65 date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
80 emit dateChanged(date); 66 emit dateChanged(date);
81} 67}
@@ -126,5 +112,7 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
126 char day=wdays[d.dayOfWeek()-1]; 112 char day=wdays[d.dayOfWeek()-1];
127 113
114 //dont use dayOfWeek() to save space !
128 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); 115 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
116
129 add->setText("+"); 117 add->setText("+");
130 118
@@ -342,6 +330,21 @@ QDate DateBookWeekLst::date() {
342} 330}
343 331
332// return the date at the beginning of the week...
333// copied from DateBookWeek
334QDate DateBookWeekLst::weekDate() const
335{
336 QDate d=bdate;
337
338 // Calculate offset to first day of week.
339 int dayoffset=d.dayOfWeek();
340 if(bStartOnMonday) dayoffset--;
341 else if( dayoffset == 7 )
342 dayoffset = 0;
343
344 return d.addDays(-dayoffset);
345}
346
344void DateBookWeekLst::getEvents() { 347void DateBookWeekLst::getEvents() {
345 QDate start = date(); 348 QDate start = weekDate(); //date();
346 QDate stop = start.addDays(6); 349 QDate stop = start.addDays(6);
347 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 350 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);