summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
authorharlekin <harlekin>2002-03-12 00:11:24 (UTC)
committer harlekin <harlekin>2002-03-12 00:11:24 (UTC)
commit4c020c281eb21a92175b47330fb7ac60184a2bca (patch) (unidiff)
treeb59dc913190b04728ae96ed3730d523c2b228e75 /core/pim/today/today.cpp
parent3c5feb8676f75f4e218ea0278f02d225e8985301 (diff)
downloadopie-4c020c281eb21a92175b47330fb7ac60184a2bca.zip
opie-4c020c281eb21a92175b47330fb7ac60184a2bca.tar.gz
opie-4c020c281eb21a92175b47330fb7ac60184a2bca.tar.bz2
fixes must obvious bugs
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp82
1 files changed, 58 insertions, 24 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
@@ -68,9 +68,8 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
68 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 68 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
69 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); 69 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
70 70
71
72 autoStart();
73 draw(); 71 draw();
72 autoStart();
74} 73}
75 74
76void Today::autoStart() { 75void Today::autoStart() {
@@ -94,7 +93,7 @@ void Today::draw() {
94 getMail(); 93 getMail();
95 getTodo(); 94 getTodo();
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}
99 98
100 99
@@ -196,8 +195,8 @@ void Today::startConfig() {
196 cfg.writeEntry("autostart", autostart); 195 cfg.writeEntry("autostart", autostart);
197 // sync it to "disk" 196 // sync it to "disk"
198 cfg.write(); 197 cfg.write();
199 autoStart();
200 draw(); 198 draw();
199 autoStart();
201} 200}
202 201
203 202
@@ -208,7 +207,6 @@ void Today::getDates() {
208 QDate date = QDate::currentDate(); 207 QDate date = QDate::currentDate();
209 QWidget* AllDateBookEvents = new QWidget( ); 208 QWidget* AllDateBookEvents = new QWidget( );
210 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); 209 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents);
211 //QTime time = QTime::currentTime();
212 210
213 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); 211 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
214 212
@@ -219,31 +217,44 @@ void Today::getDates() {
219 int count=0; 217 int count=0;
220 218
221 if ( list.count() > 0 ) { 219 if ( list.count() > 0 ) {
222 QString msg; 220
223
224 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 221 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
225 it!=list.end(); ++it ) { 222 it!=list.end(); ++it ) {
226 223
227 count++; 224 count++;
228 225
229 if ( count <= MAX_LINES_MEET ) { 226 if ( count <= MAX_LINES_MEET ) {
227
228 QTime time = QTime::currentTime();
230 229
231 230 if (!ONLY_LATER) {
232 DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); 231 DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents);
233 layoutDates->addWidget(l); 232 layoutDates->addWidget(l);
234 connect (l, SIGNAL(editEvent(const Event &)), 233 connect (l, SIGNAL(editEvent(const Event &)),
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);
245 }
236 } 246 }
237 247 }
238 } 248 } else {
239 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 249 QLabel* noEvents = new QLabel(AllDateBookEvents);
240 sv1->addChild(AllDateBookEvents); 250 noEvents->setText("No appointments today");
241 251 layoutDates->addWidget(noEvents);
242 //if (msg.isEmpty()) {
243 // msg = tr("No more appointments today");
244 //}
245 //DatesField->setText(msg);
246 } 252 }
253
254 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
255 sv1->addChild(AllDateBookEvents);
256
257
247} 258}
248 259
249/* 260/*
@@ -439,7 +450,24 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
439 if (SHOW_NOTES == 1) { 450 if (SHOW_NOTES == 1) {
440 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 451 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
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
460DateBookEventLater::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>";
444 if ( (ev).event().hasAlarm() ) { 472 if ( (ev).event().hasAlarm() ) {
445 msg += " <b>[with alarm]</b>"; 473 msg += " <b>[with alarm]</b>";
@@ -462,8 +490,11 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
462 if (SHOW_NOTES == 1) { 490 if (SHOW_NOTES == 1) {
463 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 491 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
464 } 492 }
465 } 493 }
466 494
495 // if (msg.isEmpty()) {
496 // msg = tr("No more appointments today");
497 // }
467 setText(msg); 498 setText(msg);
468 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 499 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
469 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 500 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
@@ -473,5 +504,8 @@ void DateBookEvent::editMe() {
473 emit editEvent(event.event()); 504 emit editEvent(event.event());
474} 505}
475 506
507void DateBookEventLater::editMe() {
508 emit editEvent(event.event());
509}
476 510
477 511