author | umopapisdn <umopapisdn> | 2003-04-12 03:56:46 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-04-12 03:56:46 (UTC) |
commit | 8c690a7bb709773217ba3d39d3ef769a2414cc72 (patch) (unidiff) | |
tree | a34bae70ee8dc46f40f60150e1703088fbc4da36 /core/pim/datebook/datebookweeklst.cpp | |
parent | 212aef7fd20182fe926644af2ab10a4b49549440 (diff) | |
download | opie-8c690a7bb709773217ba3d39d3ef769a2414cc72.zip opie-8c690a7bb709773217ba3d39d3ef769a2414cc72.tar.gz opie-8c690a7bb709773217ba3d39d3ef769a2414cc72.tar.bz2 |
New feature:
Added a configurable option to make the weeklist view display either no times at all, only start times, or both start and end time.
Also moved the configuration of default view from the menu into the preference dialog.
Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 123 |
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 @@ | |||
4 | 4 | ||
5 | #include "datebook.h" | ||
6 | |||
5 | #include <qpe/calendar.h> | 7 | #include <qpe/calendar.h> |
@@ -145,20 +147,40 @@ void DateBookWeekLstDayHdr::newEvent() { | |||
145 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 147 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
148 | int weeklistviewconfig, | ||
146 | QWidget* parent, | 149 | QWidget* parent, |
147 | const char* name, | 150 | const char* name, |
148 | WFlags fl) : | 151 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) |
149 | OClickableLabel(parent,name,fl), | ||
150 | event(ev) | ||
151 | { | 152 | { |
152 | char s[10]; | 153 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", |
153 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) | 154 | QString s,start,middle,end,day; |
154 | if ( ev.endDate() == ev.date() ) { // last day | 155 | |
155 | strcpy(s, "__|__"); | 156 | qDebug("weeklistviewconfig=%d",weeklistviewconfig); |
156 | } else { | 157 | if(weeklistviewconfig==NONE) {// No times displayed. |
157 | strcpy(s, " |---"); | 158 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
159 | // middle.sprintf("<--->"); | ||
160 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | ||
161 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | ||
162 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. | ||
163 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
164 | middle.sprintf(" |---"); | ||
165 | end.sprintf("__|__"); | ||
166 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
167 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | ||
168 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | ||
169 | middle.sprintf("<--->"); | ||
170 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | ||
171 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | ||
172 | } | ||
173 | |||
174 | if(ev.event().type() == Event::Normal) { | ||
175 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. | ||
176 | s=day; | ||
177 | } else if(ev.startDate()==ev.date()) {// start event. | ||
178 | s=start; | ||
179 | } else if(ev.endDate()==ev.date()) { // end event. | ||
180 | s=end; | ||
181 | } else {// middle day. | ||
182 | s=middle; | ||
158 | } | 183 | } |
159 | } else { | 184 | } else { |
160 | if(ev.event().type() == Event::Normal ) | 185 | s=""; |
161 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
162 | else | ||
163 | sprintf(s," "); | ||
164 | } | 186 | } |
@@ -179,2 +201,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
179 | { | 201 | { |
202 | Config config("DateBook"); | ||
203 | config.setGroup("Main"); | ||
204 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); | ||
205 | qDebug("Read weeklistviewconfig: %d",weeklistviewconfig); | ||
206 | |||
180 | onMonday=onM; | 207 | onMonday=onM; |
@@ -190,5 +217,5 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
190 | int dayOrder[7]; | 217 | int dayOrder[7]; |
191 | if (onMonday) | 218 | if (onMonday) { |
192 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 219 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
193 | else { | 220 | } else { |
194 | for (int d=0; d<7; d++) dayOrder[d]=d; | 221 | for (int d=0; d<7; d++) dayOrder[d]=d; |
@@ -199,12 +226,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
199 | // Header | 226 | // Header |
200 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), | 227 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), onMonday,this); |
201 | onMonday,this); | ||
202 | connect(hdr, SIGNAL(showDate(int,int,int)), | 228 | connect(hdr, SIGNAL(showDate(int,int,int)), |
203 | this, SIGNAL(showDate(int,int,int))); | 229 | this, SIGNAL(showDate(int,int,int))); |
204 | connect(hdr, SIGNAL(addEvent(const QDateTime &, | 230 | connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), |
205 | const QDateTime &, | 231 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); |
206 | const QString &, const QString &)), | ||
207 | this, SIGNAL(addEvent(const QDateTime &, | ||
208 | const QDateTime &, | ||
209 | const QString &, const QString &))); | ||
210 | layout->addWidget(hdr); | 232 | layout->addWidget(hdr); |
@@ -214,6 +236,5 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
214 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. | 236 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. |
215 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); | 237 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); |
216 | layout->addWidget(l); | 238 | layout->addWidget(l); |
217 | connect (l, SIGNAL(editEvent(const Event &)), | 239 | connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); |
218 | this, SIGNAL(editEvent(const Event &))); | ||
219 | } | 240 | } |
@@ -239,10 +260,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | |||
239 | layout->addWidget(w); | 260 | layout->addWidget(w); |
240 | connect (w, SIGNAL(editEvent(const Event &)), | 261 | connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); |
241 | this, SIGNAL(editEvent(const Event &))); | 262 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
242 | connect (w, SIGNAL(showDate(int,int,int)), | 263 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &,const QString &)), |
243 | this, SIGNAL(showDate(int,int,int))); | 264 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); |
244 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
245 | const QString &,const QString &)), | ||
246 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
247 | const QString &, const QString &))); | ||
248 | 265 | ||
@@ -251,10 +268,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | |||
251 | layout->addWidget(w); | 268 | layout->addWidget(w); |
252 | connect (w, SIGNAL(editEvent(const Event &)), | 269 | connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); |
253 | this, SIGNAL(editEvent(const Event &))); | 270 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
254 | connect (w, SIGNAL(showDate(int,int,int)), | 271 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), |
255 | this, SIGNAL(showDate(int,int,int))); | 272 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); |
256 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
257 | const QString &, const QString &)), | ||
258 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
259 | const QString &, const QString &))); | ||
260 | } | 273 | } |
@@ -276,6 +289,4 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | |||
276 | layout->addWidget( header ); | 289 | layout->addWidget( header ); |
277 | connect(header, SIGNAL(dateChanged(int,int)), | 290 | connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); |
278 | this, SLOT(dateChanged(int,int))); | 291 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); |
279 | connect(header, SIGNAL(setDbl(bool)), | ||
280 | this, SLOT(setDbl(bool))); | ||
281 | 292 | ||
@@ -318,4 +329,7 @@ QDate DateBookWeekLst::date() const { | |||
318 | if (!onMonday) | 329 | if (!onMonday) |
319 | if (dow==7) dow=1; | 330 | if (dow==7) { |
320 | else dow++; | 331 | dow=1; |
332 | } else { | ||
333 | dow++; | ||
334 | } | ||
321 | 335 | ||
@@ -335,3 +349,2 @@ void DateBookWeekLst::getEvents() { | |||
335 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); | 349 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); |
336 | |||
337 | view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); | 350 | view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); |
@@ -341,10 +354,6 @@ void DateBookWeekLst::getEvents() { | |||
341 | 354 | ||
342 | connect (view, SIGNAL(editEvent(const Event &)), | 355 | connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); |
343 | this, SIGNAL(editEvent(const Event &))); | 356 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
344 | connect (view, SIGNAL(showDate(int,int,int)), | 357 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), |
345 | this, SIGNAL(showDate(int,int,int))); | 358 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); |
346 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
347 | const QString &, const QString &)), | ||
348 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
349 | const QString &, const QString &))); | ||
350 | 359 | ||