author | hakan <hakan> | 2002-03-09 14:19:20 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-03-09 14:19:20 (UTC) |
commit | 307ecafa73a7902aeadfeec9b5c2c064b68aed37 (patch) (unidiff) | |
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 | |||
@@ -9,4 +9,5 @@ | |||
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> |
@@ -44,4 +45,5 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, | |||
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 | } |
@@ -157,4 +159,5 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | |||
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 | } |
160 | void DateBookWeekLstEvent::editMe() { | 163 | void DateBookWeekLstEvent::editMe() { |
@@ -164,5 +167,5 @@ void DateBookWeekLstEvent::editMe() { | |||
164 | 167 | ||
165 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 168 | DateBookWeekLstView::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) |
@@ -216,4 +219,37 @@ DateBookWeekLstView::~DateBookWeekLstView(){} | |||
216 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | 219 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} |
217 | 220 | ||
221 | DateBookWeekLstDblView::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 | |||
218 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | 254 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, |
219 | QWidget *parent, | 255 | QWidget *parent, |
@@ -231,5 +267,8 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | |||
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); |
@@ -240,6 +279,14 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | |||
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 | } | ||
286 | DateBookWeekLst::~DateBookWeekLst(){ | ||
287 | Config config("DateBook"); | ||
288 | config.setGroup("Main"); | ||
289 | config.writeEntry("weeklst_dbl", dbl); | ||
242 | } | 290 | } |
243 | |||
244 | 291 | ||
245 | void DateBookWeekLst::setDate(const QDate &d) { | 292 | void DateBookWeekLst::setDate(const QDate &d) { |
@@ -250,4 +297,8 @@ void DateBookWeekLst::setDate(const QDate &d) { | |||
250 | header->setDate(date()); | 297 | header->setDate(date()); |
251 | } | 298 | } |
299 | void DateBookWeekLst::setDbl(bool on) { | ||
300 | dbl=on; | ||
301 | redraw(); | ||
302 | } | ||
252 | void DateBookWeekLst::redraw() {getEvents();} | 303 | void DateBookWeekLst::redraw() {getEvents();} |
253 | 304 | ||
@@ -271,5 +322,13 @@ void DateBookWeekLst::getEvents() { | |||
271 | 322 | ||
272 | if (view) delete view; | 323 | if (view) delete view; |
273 | view=new DateBookWeekLstView(el,start,onMonday,scroll); | 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 { | ||
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 &)), |
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 | |||
@@ -32,4 +32,5 @@ public slots: | |||
32 | signals: | 32 | signals: |
33 | void dateChanged(int y, int w); | 33 | void dateChanged(int y, int w); |
34 | void setDbl(bool on); | ||
34 | private: | 35 | private: |
35 | QDate date; | 36 | QDate date; |
@@ -74,5 +75,5 @@ class DateBookWeekLstView: public QWidget | |||
74 | Q_OBJECT | 75 | Q_OBJECT |
75 | public: | 76 | public: |
76 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, QDate &d, bool onM, | 77 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, |
77 | QWidget* parent = 0, const char* name = 0, | 78 | QWidget* parent = 0, const char* name = 0, |
78 | WFlags fl = 0 ); | 79 | WFlags fl = 0 ); |
@@ -89,4 +90,19 @@ protected slots: | |||
89 | }; | 90 | }; |
90 | 91 | ||
92 | class DateBookWeekLstDblView: public QWidget { | ||
93 | Q_OBJECT | ||
94 | public: | ||
95 | DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | ||
96 | QValueList<EffectiveEvent> &ev2, | ||
97 | QDate &d, bool onM, | ||
98 | QWidget* parent = 0, const char* name = 0, | ||
99 | WFlags fl = 0 ); | ||
100 | signals: | ||
101 | void editEvent(const Event &e); | ||
102 | void showDate(int y, int m, int d); | ||
103 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
104 | const QString &str); | ||
105 | }; | ||
106 | |||
91 | class DateBookWeekLst : public QWidget | 107 | class DateBookWeekLst : public QWidget |
92 | { | 108 | { |
@@ -97,4 +113,5 @@ public: | |||
97 | QWidget *parent = 0, | 113 | QWidget *parent = 0, |
98 | const char *name = 0 ); | 114 | const char *name = 0 ); |
115 | ~DateBookWeekLst(); | ||
99 | void setDate( int y, int w ); | 116 | void setDate( int y, int w ); |
100 | void setDate(const QDate &d ); | 117 | void setDate(const QDate &d ); |
@@ -105,6 +122,8 @@ public slots: | |||
105 | void redraw(); | 122 | void redraw(); |
106 | void dateChanged(int y, int w); | 123 | void dateChanged(int y, int w); |
124 | |||
107 | protected slots: | 125 | protected slots: |
108 | void keyPressEvent(QKeyEvent *); | 126 | void keyPressEvent(QKeyEvent *); |
127 | void setDbl(bool on); | ||
109 | 128 | ||
110 | signals: | 129 | signals: |
@@ -115,15 +134,16 @@ signals: | |||
115 | 134 | ||
116 | private: | 135 | private: |
117 | DateBookDB *db; | 136 | DateBookDB *db; |
118 | int startTime; | 137 | int startTime; |
119 | bool ampm; | 138 | bool ampm; |
120 | bool onMonday; | 139 | bool onMonday; |
121 | int year, _week; | 140 | bool dbl; |
122 | DateBookWeekLstHeader *header; | 141 | int year, _week; |
123 | DateBookWeekLstView *view; | 142 | DateBookWeekLstHeader *header; |
124 | QVBoxLayout *layout; | 143 | QWidget *view; |
125 | QScrollView *scroll; | 144 | QVBoxLayout *layout; |
126 | 145 | QScrollView *scroll; | |
127 | void getEvents(); | 146 | |
147 | void getEvents(); | ||
128 | }; | 148 | }; |
129 | 149 | ||
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 | |||
@@ -11,7 +11,7 @@ | |||
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>51</y> | 13 | <y>183</y> |
14 | <width>535</width> | 14 | <width>447</width> |
15 | <height>25</height> | 15 | <height>45</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
@@ -36,5 +36,5 @@ | |||
36 | <property stdset="1"> | 36 | <property stdset="1"> |
37 | <name>margin</name> | 37 | <name>margin</name> |
38 | <number>0</number> | 38 | <number>11</number> |
39 | </property> | 39 | </property> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
@@ -51,5 +51,5 @@ | |||
51 | <name>sizePolicy</name> | 51 | <name>sizePolicy</name> |
52 | <sizepolicy> | 52 | <sizepolicy> |
53 | <hsizetype>1</hsizetype> | 53 | <hsizetype>7</hsizetype> |
54 | <vsizetype>0</vsizetype> | 54 | <vsizetype>0</vsizetype> |
55 | </sizepolicy> | 55 | </sizepolicy> |
@@ -64,4 +64,8 @@ | |||
64 | </property> | 64 | </property> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>toggleButton</name> | ||
67 | <bool>false</bool> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
66 | <name>autoRepeat</name> | 70 | <name>autoRepeat</name> |
67 | <bool>true</bool> | 71 | <bool>true</bool> |
@@ -71,4 +75,12 @@ | |||
71 | <bool>true</bool> | 75 | <bool>true</bool> |
72 | </property> | 76 | </property> |
77 | <property stdset="1"> | ||
78 | <name>toggleButton</name> | ||
79 | <bool>false</bool> | ||
80 | </property> | ||
81 | <property> | ||
82 | <name>toolTip</name> | ||
83 | <string></string> | ||
84 | </property> | ||
73 | </widget> | 85 | </widget> |
74 | <spacer> | 86 | <spacer> |
@@ -117,7 +129,19 @@ | |||
117 | </property> | 129 | </property> |
118 | <property stdset="1"> | 130 | <property stdset="1"> |
131 | <name>toggleButton</name> | ||
132 | <bool>false</bool> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
119 | <name>autoRaise</name> | 135 | <name>autoRaise</name> |
120 | <bool>false</bool> | 136 | <bool>false</bool> |
121 | </property> | 137 | </property> |
138 | <property stdset="1"> | ||
139 | <name>toggleButton</name> | ||
140 | <bool>false</bool> | ||
141 | </property> | ||
142 | <property> | ||
143 | <name>toolTip</name> | ||
144 | <string></string> | ||
145 | </property> | ||
122 | </widget> | 146 | </widget> |
123 | <spacer> | 147 | <spacer> |
@@ -143,4 +167,65 @@ | |||
143 | </spacer> | 167 | </spacer> |
144 | <widget> | 168 | <widget> |
169 | <class>QToolButton</class> | ||
170 | <property stdset="1"> | ||
171 | <name>name</name> | ||
172 | <cstring>dbl</cstring> | ||
173 | </property> | ||
174 | <property stdset="1"> | ||
175 | <name>sizePolicy</name> | ||
176 | <sizepolicy> | ||
177 | <hsizetype>3</hsizetype> | ||
178 | <vsizetype>0</vsizetype> | ||
179 | </sizepolicy> | ||
180 | </property> | ||
181 | <property stdset="1"> | ||
182 | <name>font</name> | ||
183 | <font> | ||
184 | <bold>1</bold> | ||
185 | </font> | ||
186 | </property> | ||
187 | <property stdset="1"> | ||
188 | <name>text</name> | ||
189 | <string>2</string> | ||
190 | </property> | ||
191 | <property stdset="1"> | ||
192 | <name>toggleButton</name> | ||
193 | <bool>true</bool> | ||
194 | </property> | ||
195 | <property stdset="1"> | ||
196 | <name>autoRaise</name> | ||
197 | <bool>false</bool> | ||
198 | </property> | ||
199 | <property stdset="1"> | ||
200 | <name>toggleButton</name> | ||
201 | <bool>true</bool> | ||
202 | </property> | ||
203 | <property> | ||
204 | <name>toolTip</name> | ||
205 | <string></string> | ||
206 | </property> | ||
207 | </widget> | ||
208 | <spacer> | ||
209 | <property> | ||
210 | <name>name</name> | ||
211 | <cstring>Spacer1_3_2</cstring> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>orientation</name> | ||
215 | <enum>Horizontal</enum> | ||
216 | </property> | ||
217 | <property stdset="1"> | ||
218 | <name>sizeType</name> | ||
219 | <enum>Expanding</enum> | ||
220 | </property> | ||
221 | <property> | ||
222 | <name>sizeHint</name> | ||
223 | <size> | ||
224 | <width>20</width> | ||
225 | <height>20</height> | ||
226 | </size> | ||
227 | </property> | ||
228 | </spacer> | ||
229 | <widget> | ||
145 | <class>QLabel</class> | 230 | <class>QLabel</class> |
146 | <property stdset="1"> | 231 | <property stdset="1"> |
@@ -165,8 +250,4 @@ | |||
165 | <string>00 Jan-00 Jan</string> | 250 | <string>00 Jan-00 Jan</string> |
166 | </property> | 251 | </property> |
167 | <property stdset="1"> | ||
168 | <name>alignment</name> | ||
169 | <set>AlignCenter</set> | ||
170 | </property> | ||
171 | <property> | 252 | <property> |
172 | <name>hAlign</name> | 253 | <name>hAlign</name> |