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.cpp123
1 files changed, 66 insertions, 57 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 3d6a029..3c8fc89 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -3,4 +3,6 @@
#include "datebookweekheaderimpl.h"
+#include "datebook.h"
+
#include <qpe/calendar.h>
#include <qpe/datebookdb.h>
@@ -144,22 +146,42 @@ void DateBookWeekLstDayHdr::newEvent() {
}
DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
+ int weeklistviewconfig,
QWidget* parent,
const char* name,
- WFlags fl) :
- OClickableLabel(parent,name,fl),
- event(ev)
+ WFlags fl ) : OClickableLabel(parent,name,fl), event(ev)
{
- char s[10];
- if ( ev.startDate() != ev.date() ) { // multiday event (not first day)
- if ( ev.endDate() == ev.date() ) { // last day
- strcpy(s, "__|__");
- } else {
- strcpy(s, " |---");
+ // old values... lastday = "__|__", middle=" |---", Firstday="00:00",
+ QString s,start,middle,end,day;
+
+ qDebug("weeklistviewconfig=%d",weeklistviewconfig);
+ if(weeklistviewconfig==NONE) { // No times displayed.
+// start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
+// middle.sprintf("<--->");
+// end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
+// day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
+ } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time.
+ start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
+ middle.sprintf(" |---");
+ end.sprintf("__|__");
+ day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
+ } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times.
+ start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
+ middle.sprintf("<--->");
+ end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
+ day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
+ }
+
+ if(ev.event().type() == Event::Normal) {
+ if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event.
+ s=day;
+ } else if(ev.startDate()==ev.date()) { // start event.
+ s=start;
+ } else if(ev.endDate()==ev.date()) { // end event.
+ s=end;
+ } else { // middle day.
+ s=middle;
}
} else {
- if(ev.event().type() == Event::Normal )
- sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
- else
- sprintf(s," ");
+ s="";
}
setText(QString(s) + " " + ev.description());
@@ -178,4 +200,9 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
: QWidget( parent, name, fl )
{
+ Config config("DateBook");
+ config.setGroup("Main");
+ int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
+ qDebug("Read weeklistviewconfig: %d",weeklistviewconfig);
+
onMonday=onM;
setPalette(white);
@@ -189,7 +216,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
int dayOrder[7];
- if (onMonday)
+ if (onMonday) {
for (int d=0; d<7; d++) dayOrder[d]=d+1;
- else {
+ } else {
for (int d=0; d<7; d++) dayOrder[d]=d;
dayOrder[0]=7;
@@ -198,14 +225,9 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
for (int i=0; i<7; i++) {
// Header
- DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i),
- onMonday,this);
+ DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), onMonday,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 &)),
- this, SIGNAL(addEvent(const QDateTime &,
- const QDateTime &,
- const QString &, const QString &)));
+ connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
layout->addWidget(hdr);
@@ -213,8 +235,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day.
- DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this);
+ DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this);
layout->addWidget(l);
- connect (l, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
+ connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
}
it++;
@@ -238,24 +259,16 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
layout->addWidget(w);
- connect (w, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
- connect (w, SIGNAL(showDate(int,int,int)),
- this, SIGNAL(showDate(int,int,int)));
- connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &,const QString &)),
- this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)));
+ connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
+ connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &,const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
layout->addWidget(w);
- connect (w, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
- connect (w, SIGNAL(showDate(int,int,int)),
- this, SIGNAL(showDate(int,int,int)));
- connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)),
- this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)));
+ connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
+ connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
}
@@ -275,8 +288,6 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
header=new DateBookWeekLstHeader(onM, this);
layout->addWidget( header );
- connect(header, SIGNAL(dateChanged(int,int)),
- this, SLOT(dateChanged(int,int)));
- connect(header, SIGNAL(setDbl(bool)),
- this, SLOT(setDbl(bool)));
+ connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int)));
+ connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool)));
scroll=new QScrollView(this);
@@ -317,6 +328,9 @@ QDate DateBookWeekLst::date() const {
int dow= d.dayOfWeek();
if (!onMonday)
- if (dow==7) dow=1;
- else dow++;
+ if (dow==7) {
+ dow=1;
+ } else {
+ dow++;
+ }
d=d.addDays( (_week-1)*7 - dow + 1 );
@@ -334,5 +348,4 @@ void DateBookWeekLst::getEvents() {
stop=start2.addDays(6);
QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
-
view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
} else {
@@ -340,12 +353,8 @@ void DateBookWeekLst::getEvents() {
}
- connect (view, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
- connect (view, SIGNAL(showDate(int,int,int)),
- this, SIGNAL(showDate(int,int,int)));
- connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)),
- this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)));
+ connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
+ connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
scroll->addChild(view);