summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-04-19 21:44:18 (UTC)
committer harlekin <harlekin>2002-04-19 21:44:18 (UTC)
commitf62cb71116d1aa16603fe6e87169e8b98125ce1f (patch) (unidiff)
tree6ffef9d90b7c86603e7fcbcc8304b21fcd9e5967
parent59aeb3bb66ad382201fe1e2cc3066564240d1cc1 (diff)
downloadopie-f62cb71116d1aa16603fe6e87169e8b98125ce1f.zip
opie-f62cb71116d1aa16603fe6e87169e8b98125ce1f.tar.gz
opie-f62cb71116d1aa16603fe6e87169e8b98125ce1f.tar.bz2
launch ALSO qtmail by clicking on mail icon
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 1cb4881..87a7970 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -199,409 +199,409 @@ void Today::init() {
199 199
200 // read config 200 // read config
201 Config cfg("today"); 201 Config cfg("today");
202 cfg.setGroup("BaseConfig"); 202 cfg.setGroup("BaseConfig");
203 203
204 // -- config file section -- 204 // -- config file section --
205 // how many lines should be showed in the task section 205 // how many lines should be showed in the task section
206 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); 206 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5);
207 // after how many chars should the be cut off on tasks and notes 207 // after how many chars should the be cut off on tasks and notes
208 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40); 208 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40);
209 // how many lines should be showed in the datebook section 209 // how many lines should be showed in the datebook section
210 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); 210 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5);
211 // If location is to be showed too, 1 to activate it. 211 // If location is to be showed too, 1 to activate it.
212 SHOW_LOCATION = cfg.readNumEntry("showlocation",1); 212 SHOW_LOCATION = cfg.readNumEntry("showlocation",1);
213 // if notes should be shown 213 // if notes should be shown
214 SHOW_NOTES = cfg.readNumEntry("shownotes",0); 214 SHOW_NOTES = cfg.readNumEntry("shownotes",0);
215 // should only later appointments be shown or all for the current day. 215 // should only later appointments be shown or all for the current day.
216 ONLY_LATER = cfg.readNumEntry("onlylater",1); 216 ONLY_LATER = cfg.readNumEntry("onlylater",1);
217 217
218 cfg.setGroup("Autostart"); 218 cfg.setGroup("Autostart");
219 AUTOSTART = cfg.readNumEntry("autostart",1); 219 AUTOSTART = cfg.readNumEntry("autostart",1);
220 AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0"); 220 AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0");
221 221
222 //db = new DateBookDB; 222 //db = new DateBookDB;
223} 223}
224 224
225/* 225/*
226 * The method for the configuration dialog. 226 * The method for the configuration dialog.
227 */ 227 */
228void Today::startConfig() { 228void Today::startConfig() {
229 229
230 conf = new todayconfig ( this, "", true ); 230 conf = new todayconfig ( this, "", true );
231 // read the config 231 // read the config
232 Config cfg("today"); 232 Config cfg("today");
233 cfg.setGroup("BaseConfig"); 233 cfg.setGroup("BaseConfig");
234 234
235 //init(); 235 //init();
236 236
237 conf->SpinBox1->setValue(MAX_LINES_MEET); 237 conf->SpinBox1->setValue(MAX_LINES_MEET);
238 // location show box 238 // location show box
239 conf->CheckBox1->setChecked(SHOW_LOCATION); 239 conf->CheckBox1->setChecked(SHOW_LOCATION);
240 // notes show box 240 // notes show box
241 conf->CheckBox2->setChecked(SHOW_NOTES); 241 conf->CheckBox2->setChecked(SHOW_NOTES);
242 // task lines 242 // task lines
243 conf->SpinBox2->setValue(MAX_LINES_TASK); 243 conf->SpinBox2->setValue(MAX_LINES_TASK);
244 // clip when? 244 // clip when?
245 conf->SpinBox7->setValue(MAX_CHAR_CLIP); 245 conf->SpinBox7->setValue(MAX_CHAR_CLIP);
246 // only later 246 // only later
247 conf->CheckBox3->setChecked(ONLY_LATER); 247 conf->CheckBox3->setChecked(ONLY_LATER);
248 // if today should be autostarted 248 // if today should be autostarted
249 conf->CheckBoxAuto->setChecked(AUTOSTART); 249 conf->CheckBoxAuto->setChecked(AUTOSTART);
250 // autostart only if device has been suspended for X minutes 250 // autostart only if device has been suspended for X minutes
251 conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() ); 251 conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() );
252 252
253 conf->exec(); 253 conf->exec();
254 254
255 int maxlinestask = conf->SpinBox2->value(); 255 int maxlinestask = conf->SpinBox2->value();
256 int maxmeet = conf->SpinBox1->value(); 256 int maxmeet = conf->SpinBox1->value();
257 int location = conf->CheckBox1->isChecked(); 257 int location = conf->CheckBox1->isChecked();
258 int notes = conf->CheckBox2->isChecked(); 258 int notes = conf->CheckBox2->isChecked();
259 int maxcharclip = conf->SpinBox7->value(); 259 int maxcharclip = conf->SpinBox7->value();
260 int onlylater = conf->CheckBox3->isChecked(); 260 int onlylater = conf->CheckBox3->isChecked();
261 int autostart = conf->CheckBoxAuto->isChecked(); 261 int autostart = conf->CheckBoxAuto->isChecked();
262 int autostartdelay = conf->SpinBoxTime->value(); 262 int autostartdelay = conf->SpinBoxTime->value();
263 263
264 cfg.writeEntry("maxlinestask",maxlinestask); 264 cfg.writeEntry("maxlinestask",maxlinestask);
265 cfg.writeEntry("maxcharclip", maxcharclip); 265 cfg.writeEntry("maxcharclip", maxcharclip);
266 cfg.writeEntry("maxlinesmeet",maxmeet); 266 cfg.writeEntry("maxlinesmeet",maxmeet);
267 cfg.writeEntry("showlocation",location); 267 cfg.writeEntry("showlocation",location);
268 cfg.writeEntry("shownotes", notes); 268 cfg.writeEntry("shownotes", notes);
269 cfg.writeEntry("onlylater", onlylater); 269 cfg.writeEntry("onlylater", onlylater);
270 cfg.setGroup("Autostart"); 270 cfg.setGroup("Autostart");
271 cfg.writeEntry("autostart", autostart); 271 cfg.writeEntry("autostart", autostart);
272 cfg.writeEntry("autostartdelay", autostartdelay); 272 cfg.writeEntry("autostartdelay", autostartdelay);
273 273
274 // sync it to "disk" 274 // sync it to "disk"
275 cfg.write(); 275 cfg.write();
276 NEW_START=1; 276 NEW_START=1;
277 draw(); 277 draw();
278 autoStart(); 278 autoStart();
279} 279}
280 280
281 281
282/* 282/*
283 * Get all events that are in the datebook xml file for today 283 * Get all events that are in the datebook xml file for today
284 */ 284 */
285void Today::getDates() { 285void Today::getDates() {
286 QDate date = QDate::currentDate(); 286 QDate date = QDate::currentDate();
287 287
288 if (AllDateBookEvents) delete AllDateBookEvents; 288 if (AllDateBookEvents) delete AllDateBookEvents;
289 AllDateBookEvents = new QWidget( ); 289 AllDateBookEvents = new QWidget( );
290 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); 290 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents);
291 291
292 if (db) { 292 if (db) {
293 delete db; 293 delete db;
294 } 294 }
295 db = new DateBookDB; 295 db = new DateBookDB;
296 296
297 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); 297 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
298 298
299 qBubbleSort(list); 299 qBubbleSort(list);
300 // printf("Get dates\n"); 300 // printf("Get dates\n");
301 301
302 Config config( "qpe" ); 302 Config config( "qpe" );
303 // if 24 h format 303 // if 24 h format
304 //bool ampm = config.readBoolEntry( "AMPM", TRUE ); 304 //bool ampm = config.readBoolEntry( "AMPM", TRUE );
305 305
306 int count=0; 306 int count=0;
307 307
308 if ( list.count() > 0 ) { 308 if ( list.count() > 0 ) {
309 309
310 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 310 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
311 it!=list.end(); ++it ) { 311 it!=list.end(); ++it ) {
312 312
313 313
314 if ( count <= MAX_LINES_MEET ) { 314 if ( count <= MAX_LINES_MEET ) {
315 315
316 QTime time = QTime::currentTime(); 316 QTime time = QTime::currentTime();
317 317
318 if (!ONLY_LATER) { 318 if (!ONLY_LATER) {
319 count++; 319 count++;
320 DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); 320 DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES);
321 layoutDates->addWidget(l); 321 layoutDates->addWidget(l);
322 connect (l, SIGNAL(editEvent(const Event &)), 322 connect (l, SIGNAL(editEvent(const Event &)),
323 this, SLOT(editEvent(const Event &))); 323 this, SLOT(editEvent(const Event &)));
324 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { 324 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) {
325 count++; 325 count++;
326 326
327 // show only later appointments 327 // show only later appointments
328 DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); 328 DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES);
329 layoutDates->addWidget(l); 329 layoutDates->addWidget(l);
330 connect (l, SIGNAL(editEvent(const Event &)), 330 connect (l, SIGNAL(editEvent(const Event &)),
331 this, SLOT(editEvent(const Event &))); 331 this, SLOT(editEvent(const Event &)));
332 } 332 }
333 } 333 }
334 } 334 }
335 if (ONLY_LATER && count==0) { 335 if (ONLY_LATER && count==0) {
336 QLabel* noMoreEvents = new QLabel(AllDateBookEvents); 336 QLabel* noMoreEvents = new QLabel(AllDateBookEvents);
337 noMoreEvents->setText(tr("No more appointments today")); 337 noMoreEvents->setText(tr("No more appointments today"));
338 layoutDates->addWidget(noMoreEvents); 338 layoutDates->addWidget(noMoreEvents);
339 } 339 }
340 } else { 340 } else {
341 QLabel* noEvents = new QLabel(AllDateBookEvents); 341 QLabel* noEvents = new QLabel(AllDateBookEvents);
342 noEvents->setText(tr("No appointments today")); 342 noEvents->setText(tr("No appointments today"));
343 layoutDates->addWidget(noEvents); 343 layoutDates->addWidget(noEvents);
344 } 344 }
345 345
346 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 346 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
347 sv1->addChild(AllDateBookEvents); 347 sv1->addChild(AllDateBookEvents);
348 AllDateBookEvents->show(); 348 AllDateBookEvents->show();
349} 349}
350 350
351 351
352void Today::getMail() { 352void Today::getMail() {
353 Config cfg("opiemail"); 353 Config cfg("opiemail");
354 cfg.setGroup("today"); 354 cfg.setGroup("today");
355 355
356 // how many lines should be showed in the task section 356 // how many lines should be showed in the task section
357 int NEW_MAILS = cfg.readNumEntry("newmails",0); 357 int NEW_MAILS = cfg.readNumEntry("newmails",0);
358 int OUTGOING = cfg.readNumEntry("outgoing",0); 358 int OUTGOING = cfg.readNumEntry("outgoing",0);
359 359
360 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 360 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
361 361
362 MailField->setText(output); 362 MailField->setText(output);
363} 363}
364 364
365 365
366/* 366/*
367 * Get the todos 367 * Get the todos
368 */ 368 */
369void Today::getTodo() { 369void Today::getTodo() {
370 370
371 QString output; 371 QString output;
372 QString tmpout; 372 QString tmpout;
373 int count = 0; 373 int count = 0;
374 int ammount = 0; 374 int ammount = 0;
375 375
376 // get overdue todos first 376 // get overdue todos first
377 QValueList<ToDoEvent> overDueList = todo->overDue(); 377 QValueList<ToDoEvent> overDueList = todo->overDue();
378 qBubbleSort(overDueList); 378 qBubbleSort(overDueList);
379 for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin(); 379 for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin();
380 it!=overDueList.end(); ++it ) { 380 it!=overDueList.end(); ++it ) {
381 if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) { 381 if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) {
382 tmpout += "<font color=#e00000><b>-" +((*it).description()).mid(0, MAX_CHAR_CLIP) + "</b></font><br>"; 382 tmpout += "<font color=#e00000><b>-" +((*it).description()).mid(0, MAX_CHAR_CLIP) + "</b></font><br>";
383 ammount++; 383 ammount++;
384 } 384 }
385 } 385 }
386 386
387 // get total number of still open todos 387 // get total number of still open todos
388 QValueList<ToDoEvent> open = todo->rawToDos(); 388 QValueList<ToDoEvent> open = todo->rawToDos();
389 qBubbleSort(open); 389 qBubbleSort(open);
390 for ( QValueList<ToDoEvent>::Iterator it=open.begin(); 390 for ( QValueList<ToDoEvent>::Iterator it=open.begin();
391 it!=open.end(); ++it ) { 391 it!=open.end(); ++it ) {
392 if (!(*it).isCompleted()){ 392 if (!(*it).isCompleted()){
393 count +=1; 393 count +=1;
394 // not the overdues, we allready got them, and not if we are 394 // not the overdues, we allready got them, and not if we are
395 // over the maxlines 395 // over the maxlines
396 if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) { 396 if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) {
397 tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>"; 397 tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>";
398 ammount++; 398 ammount++;
399 } 399 }
400 } 400 }
401 } 401 }
402 402
403 403
404 if (count > 0) { 404 if (count > 0) {
405 if( count == 1 ) { 405 if( count == 1 ) {
406 output = tr("There is <b> 1</b> active task: <br>" ); 406 output = tr("There is <b> 1</b> active task: <br>" );
407 } else { 407 } else {
408 output = tr("There are <b> %1</b> active tasks: <br>").arg(count); 408 output = tr("There are <b> %1</b> active tasks: <br>").arg(count);
409 } 409 }
410 output += tmpout; 410 output += tmpout;
411 } else { 411 } else {
412 output = tr("No active tasks"); 412 output = tr("No active tasks");
413 } 413 }
414 414
415 TodoField->setText(tr(output)); 415 TodoField->setText(tr(output));
416} 416}
417 417
418/* 418/*
419 * launches datebook 419 * launches datebook
420 */ 420 */
421void Today::startDatebook() { 421void Today::startDatebook() {
422 QCopEnvelope e("QPE/System", "execute(QString)"); 422 QCopEnvelope e("QPE/System", "execute(QString)");
423 e << QString("datebook"); 423 e << QString("datebook");
424} 424}
425 425
426/* 426/*
427 * starts the edit dialog as known from datebook 427 * starts the edit dialog as known from datebook
428 */ 428 */
429 429
430extern QPEApplication *todayApp; 430extern QPEApplication *todayApp;
431 431
432void Today::editEvent(const Event &e) { 432void Today::editEvent(const Event &e) {
433 startDatebook(); 433 startDatebook();
434 434
435 while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); 435 while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents();
436 QCopEnvelope env("QPE/Datebook", "editEvent(int)"); 436 QCopEnvelope env("QPE/Datebook", "editEvent(int)");
437 env << e.uid(); 437 env << e.uid();
438} 438}
439 439
440/* 440/*
441 * launches todolist 441 * launches todolist
442 */ 442 */
443void Today::startTodo() { 443void Today::startTodo() {
444 QCopEnvelope e("QPE/System", "execute(QString)"); 444 QCopEnvelope e("QPE/System", "execute(QString)");
445 e << QString("todolist"); 445 e << QString("todolist");
446} 446}
447 447
448/* 448/*
449 * launch opiemail 449 * launch opiemail
450 */ 450 */
451void Today::startMail() { 451void Today::startMail() {
452 QCopEnvelope e("QPE/System", "execute(QString)"); 452 QCopEnvelope e("QPE/System", "execute(QString)");
453 e << QString("opiemail"); 453 e << QString("opiemail");
454//Right now start both, maybe decide which to rum via config file .. 454//Right now start both, maybe decide which to rum via config file ..
455 QCopEnvelope e("QPE/System", "execute(QString)"); 455 QCopEnvelope f("QPE/System", "execute(QString)");
456 e << QString("qtmail"); 456 e << QString("qtmail");
457} 457}
458 458
459 459
460Today::~Today() { 460Today::~Today() {
461} 461}
462 462
463/* 463/*
464 * Gets the events for the current day, if it should get all dates 464 * Gets the events for the current day, if it should get all dates
465 */ 465 */
466DateBookEvent::DateBookEvent(const EffectiveEvent &ev, 466DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
467 QWidget* parent = 0, 467 QWidget* parent = 0,
468 int SHOW_LOCATION = 0, 468 int SHOW_LOCATION = 0,
469 int SHOW_NOTES = 0, 469 int SHOW_NOTES = 0,
470 const char* name = 0, 470 const char* name = 0,
471 WFlags fl = 0) : 471 WFlags fl = 0) :
472 ClickableLabel(parent,name,fl), event(ev) { 472 ClickableLabel(parent,name,fl), event(ev) {
473 473
474 QString msg; 474 QString msg;
475 //QTime time = QTime::currentTime(); 475 //QTime time = QTime::currentTime();
476 476
477 Config config( "qpe" ); 477 Config config( "qpe" );
478 // if 24 h format 478 // if 24 h format
479 ampm = config.readBoolEntry( "AMPM", TRUE ); 479 ampm = config.readBoolEntry( "AMPM", TRUE );
480 480
481 481
482 if (!ONLY_LATER) { 482 if (!ONLY_LATER) {
483 msg += "<B>" + (ev).description() + "</B>"; 483 msg += "<B>" + (ev).description() + "</B>";
484 if ( (ev).event().hasAlarm() ) { 484 if ( (ev).event().hasAlarm() ) {
485 msg += " <b>[with alarm]</b>"; 485 msg += " <b>[with alarm]</b>";
486 } 486 }
487 // include location or not 487 // include location or not
488 if (SHOW_LOCATION == 1) { 488 if (SHOW_LOCATION == 1) {
489 msg += "<BR><i>" + (ev).location() + "</i>"; 489 msg += "<BR><i>" + (ev).location() + "</i>";
490 } 490 }
491 491
492 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { 492 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
493 msg += "<br>All day"; 493 msg += "<br>All day";
494 } else { 494 } else {
495 // start time of event 495 // start time of event
496 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) 496 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) )
497 // end time of event 497 // end time of event
498 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); 498 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) );
499 } 499 }
500 500
501 // include possible note or not 501 // include possible note or not
502 if (SHOW_NOTES == 1) { 502 if (SHOW_NOTES == 1) {
503 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); 503 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP);
504 } 504 }
505 } 505 }
506 setText(msg); 506 setText(msg);
507 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 507 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
508 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 508 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
509} 509}
510 510
511 511
512QString DateBookEvent::ampmTime(QTime tm) { 512QString DateBookEvent::ampmTime(QTime tm) {
513 513
514 QString s; 514 QString s;
515 if( ampm ) { 515 if( ampm ) {
516 int hour = tm.hour(); 516 int hour = tm.hour();
517 if (hour == 0) 517 if (hour == 0)
518 hour = 12; 518 hour = 12;
519 if (hour > 12) 519 if (hour > 12)
520 hour -= 12; 520 hour -= 12;
521 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 521 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
522 (tm.hour() >= 12) ? "PM" : "AM" ); 522 (tm.hour() >= 12) ? "PM" : "AM" );
523 return s; 523 return s;
524 } else { 524 } else {
525 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 525 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
526 return s; 526 return s;
527 } 527 }
528 528
529} 529}
530 530
531 531
532DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, 532DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
533 QWidget* parent = 0, 533 QWidget* parent = 0,
534 int SHOW_LOCATION = 0, 534 int SHOW_LOCATION = 0,
535 int SHOW_NOTES = 0, 535 int SHOW_NOTES = 0,
536 const char* name = 0, 536 const char* name = 0,
537 WFlags fl = 0) : 537 WFlags fl = 0) :
538 ClickableLabel(parent,name,fl), event(ev) { 538 ClickableLabel(parent,name,fl), event(ev) {
539 539
540 QString msg; 540 QString msg;
541 QTime time = QTime::currentTime(); 541 QTime time = QTime::currentTime();
542 542
543 Config config( "qpe" ); 543 Config config( "qpe" );
544 // if 24 h format 544 // if 24 h format
545 ampm = config.readBoolEntry( "AMPM", TRUE ); 545 ampm = config.readBoolEntry( "AMPM", TRUE );
546 546
547 547
548 if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { 548 if ((time.toString() <= TimeString::dateString((ev).event().end())) ) {
549 // show only later appointments 549 // show only later appointments
550 msg += "<B>" + (ev).description() + "</B>"; 550 msg += "<B>" + (ev).description() + "</B>";
551 if ( (ev).event().hasAlarm() ) { 551 if ( (ev).event().hasAlarm() ) {
552 msg += " <b>[with alarm]</b>"; 552 msg += " <b>[with alarm]</b>";
553 } 553 }
554 // include location or not 554 // include location or not
555 if (SHOW_LOCATION == 1) { 555 if (SHOW_LOCATION == 1) {
556 msg += "<BR><i>" + (ev).location() + "</i>"; 556 msg += "<BR><i>" + (ev).location() + "</i>";
557 } 557 }
558 558
559 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { 559 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
560 msg += "<br>All day"; 560 msg += "<br>All day";
561 } else { 561 } else {
562 // start time of event 562 // start time of event
563 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) 563 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) )
564 // end time of event 564 // end time of event
565 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); 565 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) );
566 } 566 }
567 // include possible note or not 567 // include possible note or not
568 if (SHOW_NOTES == 1) { 568 if (SHOW_NOTES == 1) {
569 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); 569 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP);
570 } 570 }
571 } 571 }
572 572
573 setText(msg); 573 setText(msg);
574 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 574 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
575 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 575 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
576} 576}
577 577
578 578
579QString DateBookEventLater::ampmTime(QTime tm) { 579QString DateBookEventLater::ampmTime(QTime tm) {
580 580
581 QString s; 581 QString s;
582 if( ampm ) { 582 if( ampm ) {
583 int hour = tm.hour(); 583 int hour = tm.hour();
584 if (hour == 0) 584 if (hour == 0)
585 hour = 12; 585 hour = 12;
586 if (hour > 12) 586 if (hour > 12)
587 hour -= 12; 587 hour -= 12;
588 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 588 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
589 (tm.hour() >= 12) ? "PM" : "AM" ); 589 (tm.hour() >= 12) ? "PM" : "AM" );
590 return s; 590 return s;
591 } else { 591 } else {
592 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 592 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
593 return s; 593 return s;
594 } 594 }
595 595
596} 596}
597 597
598 598
599void DateBookEvent::editMe() { 599void DateBookEvent::editMe() {
600 emit editEvent(event.event()); 600 emit editEvent(event.event());
601} 601}
602 602
603void DateBookEventLater::editMe() { 603void DateBookEventLater::editMe() {
604 emit editEvent(event.event()); 604 emit editEvent(event.event());
605} 605}
606 606
607 607