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