-rw-r--r-- | core/pim/today/today.cpp | 60 | ||||
-rw-r--r-- | core/pim/today/today.h | 14 |
2 files changed, 61 insertions, 13 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index d10082f..1cdc6b4 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -70,5 +70,4 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
70 | 70 | ||
71 | |||
72 | autoStart(); | ||
73 | draw(); | 71 | draw(); |
72 | autoStart(); | ||
74 | } | 73 | } |
@@ -96,3 +95,3 @@ void Today::draw() { | |||
96 | // how often refresh | 95 | // how often refresh |
97 | QTimer::singleShot( 30*1000, this, SLOT(draw()) ); | 96 | QTimer::singleShot( 10*1000, this, SLOT(draw() ) ); |
98 | } | 97 | } |
@@ -198,4 +197,4 @@ void Today::startConfig() { | |||
198 | cfg.write(); | 197 | cfg.write(); |
199 | autoStart(); | ||
200 | draw(); | 198 | draw(); |
199 | autoStart(); | ||
201 | } | 200 | } |
@@ -210,3 +209,2 @@ void Today::getDates() { | |||
210 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); | 209 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); |
211 | //QTime time = QTime::currentTime(); | ||
212 | 210 | ||
@@ -221,3 +219,2 @@ void Today::getDates() { | |||
221 | if ( list.count() > 0 ) { | 219 | if ( list.count() > 0 ) { |
222 | QString msg; | ||
223 | 220 | ||
@@ -230,3 +227,5 @@ void Today::getDates() { | |||
230 | 227 | ||
228 | QTime time = QTime::currentTime(); | ||
231 | 229 | ||
230 | if (!ONLY_LATER) { | ||
232 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); | 231 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); |
@@ -235,5 +234,21 @@ void Today::getDates() { | |||
235 | this, SIGNAL(editEvent(const Event &))); | 234 | this, SIGNAL(editEvent(const Event &))); |
235 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { | ||
236 | // show only later appointments | ||
237 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents); | ||
238 | layoutDates->addWidget(l); | ||
239 | connect (l, SIGNAL(editEvent(const Event &)), | ||
240 | this, SIGNAL(editEvent(const Event &))); | ||
241 | } else { | ||
242 | QLabel* noMoreEvents = new QLabel(AllDateBookEvents); | ||
243 | noMoreEvents->setText("No more appointments today"); | ||
244 | layoutDates->addWidget(noMoreEvents); | ||
236 | } | 245 | } |
237 | |||
238 | } | 246 | } |
247 | } | ||
248 | } else { | ||
249 | QLabel* noEvents = new QLabel(AllDateBookEvents); | ||
250 | noEvents->setText("No appointments today"); | ||
251 | layoutDates->addWidget(noEvents); | ||
252 | } | ||
253 | |||
239 | layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 254 | layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
@@ -241,7 +256,3 @@ void Today::getDates() { | |||
241 | 256 | ||
242 | //if (msg.isEmpty()) { | 257 | |
243 | // msg = tr("No more appointments today"); | ||
244 | //} | ||
245 | //DatesField->setText(msg); | ||
246 | } | ||
247 | } | 258 | } |
@@ -441,3 +452,20 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
441 | } | 452 | } |
442 | } else if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | 453 | } |
454 | setText(msg); | ||
455 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | ||
456 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | ||
457 | } | ||
458 | |||
459 | |||
460 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | ||
461 | QWidget* parent = 0, | ||
462 | const char* name = 0, | ||
463 | WFlags fl = 0) : | ||
464 | ClickableLabel(parent,name,fl), event(ev) { | ||
465 | |||
466 | QString msg; | ||
467 | QTime time = QTime::currentTime(); | ||
468 | |||
469 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | ||
470 | // show only later appointments | ||
443 | msg += "<B>" + (ev).description() + "</B>"; | 471 | msg += "<B>" + (ev).description() + "</B>"; |
@@ -466,2 +494,5 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
466 | 494 | ||
495 | // if (msg.isEmpty()) { | ||
496 | // msg = tr("No more appointments today"); | ||
497 | // } | ||
467 | setText(msg); | 498 | setText(msg); |
@@ -475,2 +506,5 @@ void DateBookEvent::editMe() { | |||
475 | 506 | ||
507 | void DateBookEventLater::editMe() { | ||
508 | emit editEvent(event.event()); | ||
509 | } | ||
476 | 510 | ||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 0a0837c..b3f0654 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -82,2 +82,16 @@ private: | |||
82 | 82 | ||
83 | class DateBookEventLater: public ClickableLabel { | ||
84 | Q_OBJECT | ||
85 | public: | ||
86 | DateBookEventLater(const EffectiveEvent &ev, | ||
87 | QWidget* parent = 0, const char* name = 0, | ||
88 | WFlags fl = 0); | ||
89 | signals: | ||
90 | void editEvent(const Event &e); | ||
91 | private slots: | ||
92 | void editMe(); | ||
93 | private: | ||
94 | const EffectiveEvent event; | ||
95 | }; | ||
96 | |||
83 | #endif // TODAY_H | 97 | #endif // TODAY_H |