-rw-r--r-- | core/pim/today/today.cpp | 28 | ||||
-rw-r--r-- | core/pim/today/today.h | 14 |
2 files changed, 25 insertions, 17 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 2dc96fc..58ba4f4 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -185,13 +185,12 @@ bool Today::checkIfModified() { | |||
185 | */ | 185 | */ |
186 | void Today::init() { | 186 | void Today::init() { |
187 | QDate date = QDate::currentDate(); | 187 | QDate date = QDate::currentDate(); |
188 | QString time = (tr( date.toString()) ); | 188 | QString time = (tr( date.toString()) ); |
189 | 189 | ||
190 | TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); | 190 | TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); |
191 | db = new DateBookDB; | ||
192 | 191 | ||
193 | // read config | 192 | // read config |
194 | Config cfg("today"); | 193 | Config cfg("today"); |
195 | cfg.setGroup("BaseConfig"); | 194 | cfg.setGroup("BaseConfig"); |
196 | 195 | ||
197 | // -- config file section -- | 196 | // -- config file section -- |
@@ -204,14 +203,15 @@ void Today::init() { | |||
204 | // If location is to be showed too, 1 to activate it. | 203 | // If location is to be showed too, 1 to activate it. |
205 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); | 204 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); |
206 | // if notes should be shown | 205 | // if notes should be shown |
207 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); | 206 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); |
208 | // should only later appointments be shown or all for the current day. | 207 | // should only later appointments be shown or all for the current day. |
209 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | 208 | ONLY_LATER = cfg.readNumEntry("onlylater",1); |
210 | } | ||
211 | 209 | ||
210 | db = new DateBookDB; | ||
211 | } | ||
212 | 212 | ||
213 | /* | 213 | /* |
214 | * The method for the configuration dialog. | 214 | * The method for the configuration dialog. |
215 | */ | 215 | */ |
216 | void Today::startConfig() { | 216 | void Today::startConfig() { |
217 | 217 | ||
@@ -293,21 +293,21 @@ void Today::getDates() { | |||
293 | if ( count <= MAX_LINES_MEET ) { | 293 | if ( count <= MAX_LINES_MEET ) { |
294 | 294 | ||
295 | QTime time = QTime::currentTime(); | 295 | QTime time = QTime::currentTime(); |
296 | 296 | ||
297 | if (!ONLY_LATER) { | 297 | if (!ONLY_LATER) { |
298 | count++; | 298 | count++; |
299 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); | 299 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); |
300 | layoutDates->addWidget(l); | 300 | layoutDates->addWidget(l); |
301 | connect (l, SIGNAL(editEvent(const Event &)), | 301 | connect (l, SIGNAL(editEvent(const Event &)), |
302 | this, SLOT(editEvent(const Event &))); | 302 | this, SLOT(editEvent(const Event &))); |
303 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { | 303 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { |
304 | count++; | 304 | count++; |
305 | 305 | ||
306 | // show only later appointments | 306 | // show only later appointments |
307 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents); | 307 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); |
308 | layoutDates->addWidget(l); | 308 | layoutDates->addWidget(l); |
309 | connect (l, SIGNAL(editEvent(const Event &)), | 309 | connect (l, SIGNAL(editEvent(const Event &)), |
310 | this, SLOT(editEvent(const Event &))); | 310 | this, SLOT(editEvent(const Event &))); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | } | 313 | } |
@@ -439,29 +439,30 @@ Today::~Today() { | |||
439 | 439 | ||
440 | 440 | ||
441 | /* | 441 | /* |
442 | * Gets the events for the current day, if it should get all dates | 442 | * Gets the events for the current day, if it should get all dates |
443 | */ | 443 | */ |
444 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 444 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
445 | QWidget* parent = 0, | 445 | QWidget* parent = 0, |
446 | const char* name = 0, | 446 | int SHOW_LOCATION = 0, |
447 | WFlags fl = 0) : | 447 | int SHOW_NOTES = 0, |
448 | const char* name = 0, | ||
449 | WFlags fl = 0) : | ||
448 | ClickableLabel(parent,name,fl), event(ev) { | 450 | ClickableLabel(parent,name,fl), event(ev) { |
449 | 451 | ||
450 | QString msg; | 452 | QString msg; |
451 | //QTime time = QTime::currentTime(); | 453 | //QTime time = QTime::currentTime(); |
452 | 454 | ||
453 | if (!ONLY_LATER) { | 455 | if (!ONLY_LATER) { |
454 | msg += "<B>" + (ev).description() + "</B>"; | 456 | msg += "<B>" + (ev).description() + "</B>"; |
455 | if ( (ev).event().hasAlarm() ) { | 457 | if ( (ev).event().hasAlarm() ) { |
456 | msg += " <b>[with alarm]</b>"; | 458 | msg += " <b>[with alarm]</b>"; |
457 | } | 459 | } |
458 | // include location or not | 460 | // include location or not |
459 | if (SHOW_LOCATION == 1) { | 461 | if (SHOW_LOCATION == 1) { |
460 | msg += "<BR><i>" + (ev).location(); | 462 | msg += "<BR><i>" + (ev).location() + "</i>"; |
461 | msg += "</i>"; | ||
462 | } | 463 | } |
463 | 464 | ||
464 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 465 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
465 | msg += "<br>All day"; | 466 | msg += "<br>All day"; |
466 | } else { | 467 | } else { |
467 | // start time of event | 468 | // start time of event |
@@ -469,23 +470,25 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
469 | // end time of event | 470 | // end time of event |
470 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 471 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); |
471 | } | 472 | } |
472 | 473 | ||
473 | // include possible note or not | 474 | // include possible note or not |
474 | if (SHOW_NOTES == 1) { | 475 | if (SHOW_NOTES == 1) { |
475 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 476 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); |
476 | } | 477 | } |
477 | } | 478 | } |
478 | setText(msg); | 479 | setText(msg); |
479 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 480 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
480 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 481 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
481 | } | 482 | } |
482 | 483 | ||
483 | 484 | ||
484 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | 485 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, |
485 | QWidget* parent = 0, | 486 | QWidget* parent = 0, |
487 | int SHOW_LOCATION = 0, | ||
488 | int SHOW_NOTES = 0, | ||
486 | const char* name = 0, | 489 | const char* name = 0, |
487 | WFlags fl = 0) : | 490 | WFlags fl = 0) : |
488 | ClickableLabel(parent,name,fl), event(ev) { | 491 | ClickableLabel(parent,name,fl), event(ev) { |
489 | 492 | ||
490 | QString msg; | 493 | QString msg; |
491 | QTime time = QTime::currentTime(); | 494 | QTime time = QTime::currentTime(); |
@@ -495,27 +498,26 @@ DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | |||
495 | msg += "<B>" + (ev).description() + "</B>"; | 498 | msg += "<B>" + (ev).description() + "</B>"; |
496 | if ( (ev).event().hasAlarm() ) { | 499 | if ( (ev).event().hasAlarm() ) { |
497 | msg += " <b>[with alarm]</b>"; | 500 | msg += " <b>[with alarm]</b>"; |
498 | } | 501 | } |
499 | // include location or not | 502 | // include location or not |
500 | if (SHOW_LOCATION == 1) { | 503 | if (SHOW_LOCATION == 1) { |
501 | msg += "<BR><i>" + (ev).location(); | 504 | msg += "<BR><i>" + (ev).location() + "</i>"; |
502 | msg += "</i>"; | ||
503 | } | 505 | } |
504 | 506 | ||
505 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 507 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
506 | msg += "<br>All day"; | 508 | msg += "<br>All day"; |
507 | } else { | 509 | } else { |
508 | // start time of event | 510 | // start time of event |
509 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) | 511 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) |
510 | // end time of event | 512 | // end time of event |
511 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 513 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); |
512 | } | 514 | } |
513 | // include possible note or not | 515 | // include possible note or not |
514 | if (SHOW_NOTES == 1) { | 516 | if (SHOW_NOTES == 1) { |
515 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 517 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); |
516 | } | 518 | } |
517 | } | 519 | } |
518 | 520 | ||
519 | setText(msg); | 521 | setText(msg); |
520 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 522 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
521 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 523 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 6048781..090e8f9 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -75,28 +75,34 @@ class Today : public TodayBase { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | class DateBookEvent: public ClickableLabel { | 77 | class DateBookEvent: public ClickableLabel { |
78 | Q_OBJECT | 78 | Q_OBJECT |
79 | public: | 79 | public: |
80 | DateBookEvent(const EffectiveEvent &ev, | 80 | DateBookEvent(const EffectiveEvent &ev, |
81 | QWidget* parent = 0, const char* name = 0, | 81 | QWidget* parent = 0, |
82 | WFlags fl = 0); | 82 | int SHOW_LOCATION = 0, |
83 | int SHOW_NOTES = 0, | ||
84 | const char* name = 0, | ||
85 | WFlags fl = 0); | ||
83 | signals: | 86 | signals: |
84 | void editEvent(const Event &e); | 87 | void editEvent(const Event &e); |
85 | private slots: | 88 | private slots: |
86 | void editMe(); | 89 | void editMe(); |
87 | private: | 90 | private: |
88 | const EffectiveEvent event; | 91 | const EffectiveEvent event; |
89 | }; | 92 | }; |
90 | 93 | ||
91 | class DateBookEventLater: public ClickableLabel { | 94 | class DateBookEventLater: public ClickableLabel { |
92 | Q_OBJECT | 95 | Q_OBJECT |
93 | public: | 96 | public: |
94 | DateBookEventLater(const EffectiveEvent &ev, | 97 | DateBookEventLater(const EffectiveEvent &ev, |
95 | QWidget* parent = 0, const char* name = 0, | 98 | QWidget* parent = 0, |
96 | WFlags fl = 0); | 99 | int SHOW_LOCATION = 0, |
100 | int SHOW_NOTES = 0, | ||
101 | const char* name = 0, | ||
102 | WFlags fl = 0); | ||
97 | signals: | 103 | signals: |
98 | void editEvent(const Event &e); | 104 | void editEvent(const Event &e); |
99 | private slots: | 105 | private slots: |
100 | void editMe(); | 106 | void editMe(); |
101 | private: | 107 | private: |
102 | const EffectiveEvent event; | 108 | const EffectiveEvent event; |