-rw-r--r-- | core/pim/today/today.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index f5ed8d2..1cb4881 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -262,343 +262,346 @@ void Today::startConfig() { | |||
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 | */ |
285 | void Today::getDates() { | 285 | void 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 | ||
352 | void Today::getMail() { | 352 | void 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 | */ |
369 | void Today::getTodo() { | 369 | void 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 | */ |
421 | void Today::startDatebook() { | 421 | void 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 | ||
430 | extern QPEApplication *todayApp; | 430 | extern QPEApplication *todayApp; |
431 | 431 | ||
432 | void Today::editEvent(const Event &e) { | 432 | void 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 | */ |
443 | void Today::startTodo() { | 443 | void 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 | */ |
451 | void Today::startMail() { | 451 | void 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 .. | ||
455 | QCopEnvelope e("QPE/System", "execute(QString)"); | ||
456 | e << QString("qtmail"); | ||
454 | } | 457 | } |
455 | 458 | ||
456 | 459 | ||
457 | Today::~Today() { | 460 | Today::~Today() { |
458 | } | 461 | } |
459 | 462 | ||
460 | /* | 463 | /* |
461 | * 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 |
462 | */ | 465 | */ |
463 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 466 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
464 | QWidget* parent = 0, | 467 | QWidget* parent = 0, |
465 | int SHOW_LOCATION = 0, | 468 | int SHOW_LOCATION = 0, |
466 | int SHOW_NOTES = 0, | 469 | int SHOW_NOTES = 0, |
467 | const char* name = 0, | 470 | const char* name = 0, |
468 | WFlags fl = 0) : | 471 | WFlags fl = 0) : |
469 | ClickableLabel(parent,name,fl), event(ev) { | 472 | ClickableLabel(parent,name,fl), event(ev) { |
470 | 473 | ||
471 | QString msg; | 474 | QString msg; |
472 | //QTime time = QTime::currentTime(); | 475 | //QTime time = QTime::currentTime(); |
473 | 476 | ||
474 | Config config( "qpe" ); | 477 | Config config( "qpe" ); |
475 | // if 24 h format | 478 | // if 24 h format |
476 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 479 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
477 | 480 | ||
478 | 481 | ||
479 | if (!ONLY_LATER) { | 482 | if (!ONLY_LATER) { |
480 | msg += "<B>" + (ev).description() + "</B>"; | 483 | msg += "<B>" + (ev).description() + "</B>"; |
481 | if ( (ev).event().hasAlarm() ) { | 484 | if ( (ev).event().hasAlarm() ) { |
482 | msg += " <b>[with alarm]</b>"; | 485 | msg += " <b>[with alarm]</b>"; |
483 | } | 486 | } |
484 | // include location or not | 487 | // include location or not |
485 | if (SHOW_LOCATION == 1) { | 488 | if (SHOW_LOCATION == 1) { |
486 | msg += "<BR><i>" + (ev).location() + "</i>"; | 489 | msg += "<BR><i>" + (ev).location() + "</i>"; |
487 | } | 490 | } |
488 | 491 | ||
489 | 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") ) { |
490 | msg += "<br>All day"; | 493 | msg += "<br>All day"; |
491 | } else { | 494 | } else { |
492 | // start time of event | 495 | // start time of event |
493 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) | 496 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) |
494 | // end time of event | 497 | // end time of event |
495 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); | 498 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); |
496 | } | 499 | } |
497 | 500 | ||
498 | // include possible note or not | 501 | // include possible note or not |
499 | if (SHOW_NOTES == 1) { | 502 | if (SHOW_NOTES == 1) { |
500 | 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); |
501 | } | 504 | } |
502 | } | 505 | } |
503 | setText(msg); | 506 | setText(msg); |
504 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 507 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
505 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 508 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
506 | } | 509 | } |
507 | 510 | ||
508 | 511 | ||
509 | QString DateBookEvent::ampmTime(QTime tm) { | 512 | QString DateBookEvent::ampmTime(QTime tm) { |
510 | 513 | ||
511 | QString s; | 514 | QString s; |
512 | if( ampm ) { | 515 | if( ampm ) { |
513 | int hour = tm.hour(); | 516 | int hour = tm.hour(); |
514 | if (hour == 0) | 517 | if (hour == 0) |
515 | hour = 12; | 518 | hour = 12; |
516 | if (hour > 12) | 519 | if (hour > 12) |
517 | hour -= 12; | 520 | hour -= 12; |
518 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 521 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
519 | (tm.hour() >= 12) ? "PM" : "AM" ); | 522 | (tm.hour() >= 12) ? "PM" : "AM" ); |
520 | return s; | 523 | return s; |
521 | } else { | 524 | } else { |
522 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 525 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
523 | return s; | 526 | return s; |
524 | } | 527 | } |
525 | 528 | ||
526 | } | 529 | } |
527 | 530 | ||
528 | 531 | ||
529 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | 532 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, |
530 | QWidget* parent = 0, | 533 | QWidget* parent = 0, |
531 | int SHOW_LOCATION = 0, | 534 | int SHOW_LOCATION = 0, |
532 | int SHOW_NOTES = 0, | 535 | int SHOW_NOTES = 0, |
533 | const char* name = 0, | 536 | const char* name = 0, |
534 | WFlags fl = 0) : | 537 | WFlags fl = 0) : |
535 | ClickableLabel(parent,name,fl), event(ev) { | 538 | ClickableLabel(parent,name,fl), event(ev) { |
536 | 539 | ||
537 | QString msg; | 540 | QString msg; |
538 | QTime time = QTime::currentTime(); | 541 | QTime time = QTime::currentTime(); |
539 | 542 | ||
540 | Config config( "qpe" ); | 543 | Config config( "qpe" ); |
541 | // if 24 h format | 544 | // if 24 h format |
542 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 545 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
543 | 546 | ||
544 | 547 | ||
545 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | 548 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { |
546 | // show only later appointments | 549 | // show only later appointments |
547 | msg += "<B>" + (ev).description() + "</B>"; | 550 | msg += "<B>" + (ev).description() + "</B>"; |
548 | if ( (ev).event().hasAlarm() ) { | 551 | if ( (ev).event().hasAlarm() ) { |
549 | msg += " <b>[with alarm]</b>"; | 552 | msg += " <b>[with alarm]</b>"; |
550 | } | 553 | } |
551 | // include location or not | 554 | // include location or not |
552 | if (SHOW_LOCATION == 1) { | 555 | if (SHOW_LOCATION == 1) { |
553 | msg += "<BR><i>" + (ev).location() + "</i>"; | 556 | msg += "<BR><i>" + (ev).location() + "</i>"; |
554 | } | 557 | } |
555 | 558 | ||
556 | 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") ) { |
557 | msg += "<br>All day"; | 560 | msg += "<br>All day"; |
558 | } else { | 561 | } else { |
559 | // start time of event | 562 | // start time of event |
560 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) | 563 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) |
561 | // end time of event | 564 | // end time of event |
562 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); | 565 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); |
563 | } | 566 | } |
564 | // include possible note or not | 567 | // include possible note or not |
565 | if (SHOW_NOTES == 1) { | 568 | if (SHOW_NOTES == 1) { |
566 | 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); |
567 | } | 570 | } |
568 | } | 571 | } |
569 | 572 | ||
570 | setText(msg); | 573 | setText(msg); |
571 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 574 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
572 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 575 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
573 | } | 576 | } |
574 | 577 | ||
575 | 578 | ||
576 | QString DateBookEventLater::ampmTime(QTime tm) { | 579 | QString DateBookEventLater::ampmTime(QTime tm) { |
577 | 580 | ||
578 | QString s; | 581 | QString s; |
579 | if( ampm ) { | 582 | if( ampm ) { |
580 | int hour = tm.hour(); | 583 | int hour = tm.hour(); |
581 | if (hour == 0) | 584 | if (hour == 0) |
582 | hour = 12; | 585 | hour = 12; |
583 | if (hour > 12) | 586 | if (hour > 12) |
584 | hour -= 12; | 587 | hour -= 12; |
585 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 588 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
586 | (tm.hour() >= 12) ? "PM" : "AM" ); | 589 | (tm.hour() >= 12) ? "PM" : "AM" ); |
587 | return s; | 590 | return s; |
588 | } else { | 591 | } else { |
589 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 592 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
590 | return s; | 593 | return s; |
591 | } | 594 | } |
592 | 595 | ||
593 | } | 596 | } |
594 | 597 | ||
595 | 598 | ||
596 | void DateBookEvent::editMe() { | 599 | void DateBookEvent::editMe() { |
597 | emit editEvent(event.event()); | 600 | emit editEvent(event.event()); |
598 | } | 601 | } |
599 | 602 | ||
600 | void DateBookEventLater::editMe() { | 603 | void DateBookEventLater::editMe() { |
601 | emit editEvent(event.event()); | 604 | emit editEvent(event.event()); |
602 | } | 605 | } |
603 | 606 | ||
604 | 607 | ||