author | hakan <hakan> | 2002-03-09 14:19:20 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-03-09 14:19:20 (UTC) |
commit | 307ecafa73a7902aeadfeec9b5c2c064b68aed37 (patch) (side-by-side diff) | |
tree | c8b82b8b13aab55ede1763da27809e5cd9efa661 | |
parent | 62c21e8bdbb365a64f05dd363a98abd7fc1f0558 (diff) | |
download | opie-307ecafa73a7902aeadfeec9b5c2c064b68aed37.zip opie-307ecafa73a7902aeadfeec9b5c2c064b68aed37.tar.gz opie-307ecafa73a7902aeadfeec9b5c2c064b68aed37.tar.bz2 |
WeekLst extended to view two weeks at a time (opitonal)
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 67 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 44 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklstheader.ui | 99 |
3 files changed, 185 insertions, 25 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 @@ -10,2 +10,3 @@ #include <qpe/datebookmonth.h> +#include <qpe/config.h> @@ -45,2 +46,3 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); + connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); onMonday=onM; @@ -158,2 +160,3 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, connect(this, SIGNAL(clicked()), this, SLOT(editMe())); + setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); } @@ -165,3 +168,3 @@ void DateBookWeekLstEvent::editMe() { DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, - QDate &d, bool onM, + const QDate &d, bool onM, QWidget* parent, @@ -217,2 +220,35 @@ 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, @@ -232,3 +268,6 @@ 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(dateChanged(int,int)), + this, SLOT(dateChanged(int,int))); + connect(header, SIGNAL(setDbl(bool)), + this, SLOT(setDbl(bool))); @@ -241,4 +280,12 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, 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); } - @@ -251,2 +298,6 @@ void DateBookWeekLst::setDate(const QDate &d) { } +void DateBookWeekLst::setDbl(bool on) { + dbl=on; + redraw(); +} void DateBookWeekLst::redraw() {getEvents();} @@ -272,3 +323,11 @@ void DateBookWeekLst::getEvents() { 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); + } diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h index 39c956d..b0b0417 100644 --- a/core/pim/datebook/datebookweeklst.h +++ b/core/pim/datebook/datebookweeklst.h @@ -33,2 +33,3 @@ signals: void dateChanged(int y, int w); + void setDbl(bool on); private: @@ -75,3 +76,3 @@ class DateBookWeekLstView: public QWidget public: - DateBookWeekLstView(QValueList<EffectiveEvent> &ev, QDate &d, bool onM, + DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, QWidget* parent = 0, const char* name = 0, @@ -90,2 +91,17 @@ protected slots: +class DateBookWeekLstDblView: public QWidget { + Q_OBJECT +public: + DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, + QValueList<EffectiveEvent> &ev2, + QDate &d, bool onM, + QWidget* parent = 0, const char* name = 0, + WFlags fl = 0 ); +signals: + void editEvent(const Event &e); + void showDate(int y, int m, int d); + void addEvent(const QDateTime &start, const QDateTime &stop, + const QString &str); +}; + class DateBookWeekLst : public QWidget @@ -98,2 +114,3 @@ public: const char *name = 0 ); + ~DateBookWeekLst(); void setDate( int y, int w ); @@ -106,4 +123,6 @@ public slots: void dateChanged(int y, int w); + protected slots: void keyPressEvent(QKeyEvent *); + void setDbl(bool on); @@ -116,13 +135,14 @@ signals: private: - DateBookDB *db; - int startTime; - bool ampm; - bool onMonday; - int year, _week; - DateBookWeekLstHeader *header; - DateBookWeekLstView *view; - QVBoxLayout *layout; - QScrollView *scroll; - - void getEvents(); + DateBookDB *db; + int startTime; + bool ampm; + bool onMonday; + bool dbl; + int year, _week; + DateBookWeekLstHeader *header; + QWidget *view; + QVBoxLayout *layout; + QScrollView *scroll; + + void getEvents(); }; diff --git a/core/pim/datebook/datebookweeklstheader.ui b/core/pim/datebook/datebookweeklstheader.ui index 666e896..9de64ae 100644 --- a/core/pim/datebook/datebookweeklstheader.ui +++ b/core/pim/datebook/datebookweeklstheader.ui @@ -12,5 +12,5 @@ <x>0</x> - <y>51</y> - <width>535</width> - <height>25</height> + <y>183</y> + <width>447</width> + <height>45</height> </rect> @@ -37,3 +37,3 @@ <name>margin</name> - <number>0</number> + <number>11</number> </property> @@ -52,3 +52,3 @@ <sizepolicy> - <hsizetype>1</hsizetype> + <hsizetype>7</hsizetype> <vsizetype>0</vsizetype> @@ -65,2 +65,6 @@ <property stdset="1"> + <name>toggleButton</name> + <bool>false</bool> + </property> + <property stdset="1"> <name>autoRepeat</name> @@ -72,2 +76,10 @@ </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>false</bool> + </property> + <property> + <name>toolTip</name> + <string></string> + </property> </widget> @@ -118,2 +130,6 @@ <property stdset="1"> + <name>toggleButton</name> + <bool>false</bool> + </property> + <property stdset="1"> <name>autoRaise</name> @@ -121,2 +137,10 @@ </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>false</bool> + </property> + <property> + <name>toolTip</name> + <string></string> + </property> </widget> @@ -144,2 +168,63 @@ <widget> + <class>QToolButton</class> + <property stdset="1"> + <name>name</name> + <cstring>dbl</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>font</name> + <font> + <bold>1</bold> + </font> + </property> + <property stdset="1"> + <name>text</name> + <string>2</string> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>autoRaise</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property> + <name>toolTip</name> + <string></string> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer1_3_2</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget> <class>QLabel</class> @@ -166,6 +251,2 @@ </property> - <property stdset="1"> - <name>alignment</name> - <set>AlignCenter</set> - </property> <property> |