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
@@ -4,2 +4,4 @@
+#include "datebook.h"
+
#include <qpe/calendar.h>
@@ -145,20 +147,40 @@ 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="";
}
@@ -179,2 +201,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
{
+ Config config("DateBook");
+ config.setGroup("Main");
+ int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
+ qDebug("Read weeklistviewconfig: %d",weeklistviewconfig);
+
onMonday=onM;
@@ -190,5 +217,5 @@ 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;
@@ -199,12 +226,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
// 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);
@@ -214,6 +236,5 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
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 &)));
}
@@ -239,10 +260,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
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 &)));
@@ -251,10 +268,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
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 &)));
}
@@ -276,6 +289,4 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
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)));
@@ -318,4 +329,7 @@ QDate DateBookWeekLst::date() const {
if (!onMonday)
- if (dow==7) dow=1;
- else dow++;
+ if (dow==7) {
+ dow=1;
+ } else {
+ dow++;
+ }
@@ -335,3 +349,2 @@ void DateBookWeekLst::getEvents() {
QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
-
view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
@@ -341,10 +354,6 @@ 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 &)));