summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweeklst.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweeklst.cpp67
1 files changed, 63 insertions, 4 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index dc141c0..7083bc5 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -5,12 +5,13 @@
#include <qpe/calendar.h>
#include <qpe/datebookdb.h>
#include <qpe/event.h>
#include <qpe/qpeapplication.h>
#include <qpe/timestring.h>
#include <qpe/datebookmonth.h>
+#include <qpe/config.h>
#include <qdatetime.h>
#include <qheader.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpainter.h>
@@ -40,12 +41,13 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
//setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
connect(back, SIGNAL(clicked()), this, SLOT(prevWeek()));
connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek()));
connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate()));
+ connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
onMonday=onM;
}
DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
void DateBookWeekLstHeader::setDate(const QDate &d) {
date=d;
@@ -153,20 +155,21 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
}
} else {
sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
}
setText(QString(s) + " " + ev.description());
connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
+ setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
}
void DateBookWeekLstEvent::editMe() {
emit editEvent(event.event());
}
DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
- QDate &d, bool onM,
+ const QDate &d, bool onM,
QWidget* parent,
const char* name, WFlags fl)
: QWidget( parent, name, fl )
{
onMonday=onM;
setPalette(white);
@@ -212,12 +215,45 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
}
DateBookWeekLstView::~DateBookWeekLstView(){}
void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
+DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
+ QValueList<EffectiveEvent> &ev2,
+ QDate &d, bool onM,
+ QWidget* parent,
+ const char* name, WFlags fl)
+ : QWidget( parent, name, fl )
+{
+ QHBoxLayout *layout = new QHBoxLayout( this );
+
+ 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 &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
+ 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 &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
+ const QString &)));
+}
+
DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
QWidget *parent,
const char *name )
: QWidget( parent, name ),
db( newDB ),
startTime( 0 ),
@@ -227,31 +263,46 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
setFocusPolicy(StrongFocus);
layout = new QVBoxLayout( this );
layout->setMargin(0);
header=new DateBookWeekLstHeader(onM, this);
layout->addWidget( header );
- connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int)));
+ connect(header, SIGNAL(dateChanged(int,int)),
+ this, SLOT(dateChanged(int,int)));
+ connect(header, SIGNAL(setDbl(bool)),
+ this, SLOT(setDbl(bool)));
scroll=new QScrollView(this);
//scroll->setVScrollBarMode(QScrollView::AlwaysOn);
//scroll->setHScrollBarMode(QScrollView::AlwaysOff);
scroll->setResizePolicy(QScrollView::AutoOneFit);
layout->addWidget(scroll);
view=NULL;
+ Config config("DateBook");
+ config.setGroup("Main");
+ dbl=config.readBoolEntry("weeklst_dbl", false);
+ header->dbl->setOn(dbl);
+}
+DateBookWeekLst::~DateBookWeekLst(){
+ Config config("DateBook");
+ config.setGroup("Main");
+ config.writeEntry("weeklst_dbl", dbl);
}
-
void DateBookWeekLst::setDate(const QDate &d) {
int w,y;
calcWeek(d,w,y,onMonday);
year=y;
_week=w;
header->setDate(date());
}
+void DateBookWeekLst::setDbl(bool on) {
+ dbl=on;
+ redraw();
+}
void DateBookWeekLst::redraw() {getEvents();}
QDate DateBookWeekLst::date() const {
QDate d;
d.setYMD(year,1,1);
@@ -267,13 +318,21 @@ QDate DateBookWeekLst::date() const {
void DateBookWeekLst::getEvents() {
QDate start = date();
QDate stop = start.addDays(6);
QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
if (view) delete view;
- view=new DateBookWeekLstView(el,start,onMonday,scroll);
+ if (dbl) {
+ QDate start2=start.addDays(7);
+ stop=start2.addDays(6);
+ QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
+
+ view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
+ } else {
+ view=new DateBookWeekLstView(el,start,onMonday,scroll);
+ }
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 &,