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.cpp65
1 files changed, 62 insertions, 3 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
@@ -8,6 +8,7 @@
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/timestring.h> 9#include <qpe/timestring.h>
10#include <qpe/datebookmonth.h> 10#include <qpe/datebookmonth.h>
11#include <qpe/config.h>
11 12
12#include <qdatetime.h> 13#include <qdatetime.h>
13#include <qheader.h> 14#include <qheader.h>
@@ -43,6 +44,7 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
43 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); 44 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek()));
44 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); 45 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek()));
45 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); 46 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate()));
47 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
46 onMonday=onM; 48 onMonday=onM;
47} 49}
48DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 50DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
@@ -156,6 +158,7 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
156 } 158 }
157 setText(QString(s) + " " + ev.description()); 159 setText(QString(s) + " " + ev.description());
158 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 160 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
161 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
159} 162}
160void DateBookWeekLstEvent::editMe() { 163void DateBookWeekLstEvent::editMe() {
161 emit editEvent(event.event()); 164 emit editEvent(event.event());
@@ -163,7 +166,7 @@ void DateBookWeekLstEvent::editMe() {
163 166
164 167
165DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 168DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
166 QDate &d, bool onM, 169 const QDate &d, bool onM,
167 QWidget* parent, 170 QWidget* parent,
168 const char* name, WFlags fl) 171 const char* name, WFlags fl)
169 : QWidget( parent, name, fl ) 172 : QWidget( parent, name, fl )
@@ -215,6 +218,39 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
215DateBookWeekLstView::~DateBookWeekLstView(){} 218DateBookWeekLstView::~DateBookWeekLstView(){}
216void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 219void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
217 220
221DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
222 QValueList<EffectiveEvent> &ev2,
223 QDate &d, bool onM,
224 QWidget* parent,
225 const char* name, WFlags fl)
226 : QWidget( parent, name, fl )
227{
228 QHBoxLayout *layout = new QHBoxLayout( this );
229
230 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
231 layout->addWidget(w);
232 connect (w, SIGNAL(editEvent(const Event &)),
233 this, SIGNAL(editEvent(const Event &)));
234 connect (w, SIGNAL(showDate(int,int,int)),
235 this, SIGNAL(showDate(int,int,int)));
236 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
237 const QString &)),
238 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
239 const QString &)));
240
241
242 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
243 layout->addWidget(w);
244 connect (w, SIGNAL(editEvent(const Event &)),
245 this, SIGNAL(editEvent(const Event &)));
246 connect (w, SIGNAL(showDate(int,int,int)),
247 this, SIGNAL(showDate(int,int,int)));
248 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
249 const QString &)),
250 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
251 const QString &)));
252}
253
218DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, 254DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
219 QWidget *parent, 255 QWidget *parent,
220 const char *name ) 256 const char *name )
@@ -230,7 +266,10 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
230 266
231 header=new DateBookWeekLstHeader(onM, this); 267 header=new DateBookWeekLstHeader(onM, this);
232 layout->addWidget( header ); 268 layout->addWidget( header );
233 connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); 269 connect(header, SIGNAL(dateChanged(int,int)),
270 this, SLOT(dateChanged(int,int)));
271 connect(header, SIGNAL(setDbl(bool)),
272 this, SLOT(setDbl(bool)));
234 273
235 scroll=new QScrollView(this); 274 scroll=new QScrollView(this);
236 //scroll->setVScrollBarMode(QScrollView::AlwaysOn); 275 //scroll->setVScrollBarMode(QScrollView::AlwaysOn);
@@ -239,8 +278,16 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
239 layout->addWidget(scroll); 278 layout->addWidget(scroll);
240 279
241 view=NULL; 280 view=NULL;
281 Config config("DateBook");
282 config.setGroup("Main");
283 dbl=config.readBoolEntry("weeklst_dbl", false);
284 header->dbl->setOn(dbl);
285}
286DateBookWeekLst::~DateBookWeekLst(){
287 Config config("DateBook");
288 config.setGroup("Main");
289 config.writeEntry("weeklst_dbl", dbl);
242} 290}
243
244 291
245void DateBookWeekLst::setDate(const QDate &d) { 292void DateBookWeekLst::setDate(const QDate &d) {
246 int w,y; 293 int w,y;
@@ -249,6 +296,10 @@ void DateBookWeekLst::setDate(const QDate &d) {
249 _week=w; 296 _week=w;
250 header->setDate(date()); 297 header->setDate(date());
251} 298}
299void DateBookWeekLst::setDbl(bool on) {
300 dbl=on;
301 redraw();
302}
252void DateBookWeekLst::redraw() {getEvents();} 303void DateBookWeekLst::redraw() {getEvents();}
253 304
254QDate DateBookWeekLst::date() const { 305QDate DateBookWeekLst::date() const {
@@ -270,7 +321,15 @@ void DateBookWeekLst::getEvents() {
270 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 321 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
271 322
272 if (view) delete view; 323 if (view) delete view;
324 if (dbl) {
325 QDate start2=start.addDays(7);
326 stop=start2.addDays(6);
327 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
328
329 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
330 } else {
273 view=new DateBookWeekLstView(el,start,onMonday,scroll); 331 view=new DateBookWeekLstView(el,start,onMonday,scroll);
332 }
274 333
275 connect (view, SIGNAL(editEvent(const Event &)), 334 connect (view, SIGNAL(editEvent(const Event &)),
276 this, SIGNAL(editEvent(const Event &))); 335 this, SIGNAL(editEvent(const Event &)));