summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp40
1 files changed, 23 insertions, 17 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index ad1ec90..62becb0 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,70 +1,67 @@
1/* 1/*
2 * today.cpp : main class 2 * today.cpp : main class
3 * 3 *
4 * --------------------- 4 * ---------------------
5 * 5 *
6 * begin : Sun 10 17:20:00 CEST 2002 6 * begin : Sun 10 17:20:00 CEST 2002
7 * copyright : (c) 2002 by Maximilian Reiß 7 * copyright : (c) 2002 by Maximilian Reiß
8 * email : max.reiss@gmx.de 8 * email : max.reiss@gmx.de
9 * 9 *
10 */ 10 */
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19 19
20#include "today.h" 20#include "today.h"
21 21
22#include <qpe/timestring.h> 22#include <qpe/timestring.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25//#include <qpe/qprocess.h>
26#include <qpe/resource.h> 25#include <qpe/resource.h>
27#include <qpe/contact.h> 26#include <qpe/contact.h>
28#include <qpe/global.h> 27#include <qpe/global.h>
29#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
30 29
31#include <qdir.h> 30#include <qdir.h>
32#include <qfile.h> 31#include <qfile.h>
33#include <qdatetime.h> 32#include <qdatetime.h>
34#include <qtextstream.h> 33#include <qtextstream.h>
35#include <qcheckbox.h> 34#include <qcheckbox.h>
36#include <qspinbox.h> 35#include <qspinbox.h>
37#include <qpushbutton.h> 36#include <qpushbutton.h>
38#include <qlabel.h> 37#include <qlabel.h>
39#include <qtimer.h> 38#include <qtimer.h>
40#include <qpixmap.h> 39#include <qpixmap.h>
41//#include <qfileinfo.h>
42#include <qlayout.h> 40#include <qlayout.h>
43#include <qtl.h> 41#include <qtl.h>
44 42
45 43
46//#include <iostream.h>
47#include <unistd.h> 44#include <unistd.h>
48#include <stdlib.h> 45#include <stdlib.h>
49 46
50int MAX_LINES_TASK; 47int MAX_LINES_TASK;
51int MAX_CHAR_CLIP; 48int MAX_CHAR_CLIP;
52int MAX_LINES_MEET; 49int MAX_LINES_MEET;
53int SHOW_LOCATION; 50int SHOW_LOCATION;
54int SHOW_NOTES; 51int SHOW_NOTES;
55// show only later dates 52// show only later dates
56int ONLY_LATER; 53int ONLY_LATER;
57int AUTOSTART; 54int AUTOSTART;
58int NEW_START=1; 55int NEW_START=1;
59QString AUTOSTART_TIMER; 56QString AUTOSTART_TIMER;
60int NEXTDAYS=1; 57int NEXTDAYS=1;
61 58
62 59
63/* Constructs a Example which is a child of 'parent', with the 60/* Constructs a Example which is a child of 'parent', with the
64 * name 'name' and widget flags set to 'f' 61 * name 'name' and widget flags set to 'f'
65 */ 62 */
66Today::Today( QWidget* parent, const char* name, WFlags fl ) 63Today::Today( QWidget* parent, const char* name, WFlags fl )
67 : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { 64 : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) {
68 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 65 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
69 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 66 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
70 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 67 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
@@ -363,110 +360,119 @@ void Today::getMail() {
363 int NEW_MAILS = cfg.readNumEntry("newmails",0); 360 int NEW_MAILS = cfg.readNumEntry("newmails",0);
364 int OUTGOING = cfg.readNumEntry("outgoing",0); 361 int OUTGOING = cfg.readNumEntry("outgoing",0);
365 362
366 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 363 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
367 364
368 MailField->setText(output); 365 MailField->setText(output);
369} 366}
370 367
371 368
372/* 369/*
373 * Get the todos 370 * Get the todos
374 */ 371 */
375void Today::getTodo() { 372void Today::getTodo() {
376 373
377 QString output; 374 QString output;
378 QString tmpout; 375 QString tmpout;
379 int count = 0; 376 int count = 0;
380 int ammount = 0; 377 int ammount = 0;
381 378
382 // get overdue todos first 379 // get overdue todos first
383 QValueList<ToDoEvent> overDueList = todo->overDue(); 380 QValueList<ToDoEvent> overDueList = todo->overDue();
384 qBubbleSort(overDueList); 381 qBubbleSort(overDueList);
385 for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin(); 382 for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin();
386 it!=overDueList.end(); ++it ) { 383 it!=overDueList.end(); ++it ) {
387 if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) { 384 if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) {
388 tmpout += "<font color=#e00000><b>-" +((*it).description()).mid(0, MAX_CHAR_CLIP) + "</b></font><br>"; 385 QString desc = (*it).summary();
389 ammount++; 386 if( desc.isEmpty() ) {
390 } 387 desc = (*it).description();
388 }
389 tmpout += "<font color=#e00000><b>-" + desc.mid(0, MAX_CHAR_CLIP) + "</b></font><br>";
390
391 ammount++;
392 }
391 } 393 }
392 394
393 // get total number of still open todos 395 // get total number of still open todos
394 QValueList<ToDoEvent> openTodo = todo->rawToDos(); 396 QValueList<ToDoEvent> openTodo = todo->rawToDos();
395 qBubbleSort(openTodo); 397 qBubbleSort(openTodo);
396 for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin(); 398 for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin();
397 it!=openTodo.end(); ++it ) { 399 it!=openTodo.end(); ++it ) {
398 if (!(*it).isCompleted()){ 400 if (!(*it).isCompleted()){
399 count +=1; 401 count +=1;
400 // not the overdues, we allready got them, and not if we are 402 // not the overdues, we allready got them, and not if we are
401 // over the maxlines 403 // over the maxlines
402 if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) { 404 if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) {
403 tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>"; 405 QString desc = (*it).summary();
404 ammount++; 406 if( desc.isEmpty() ) {
407 desc = (*it).description();
408 }
409 tmpout += "<b>-</b>" + desc.mid(0, MAX_CHAR_CLIP) + "<br>";
410 ammount++;
411 }
405 } 412 }
406 }
407 } 413 }
408 414
409 415
410 if (count > 0) { 416 if (count > 0) {
411 if( count == 1 ) { 417 if( count == 1 ) {
412 output = tr("There is <b> 1</b> active task: <br>" ); 418 output = tr("There is <b> 1</b> active task: <br>" );
413 } else { 419 } else {
414 output = tr("There are <b> %1</b> active tasks: <br>").arg(count); 420 output = tr("There are <b> %1</b> active tasks: <br>").arg(count);
415 } 421 }
416 output += tmpout; 422 output += tmpout;
417 } else { 423 } else {
418 output = tr("No active tasks"); 424 output = tr("No active tasks");
419 } 425 }
420 426
421 TodoField->setText(tr(output)); 427 TodoField->setText(tr(output));
422} 428}
423 429
424 430
425void Today::startAddressbook() { 431void Today::startAddressbook() {
426 QCopEnvelope e("QPE/System", "execute(QString)"); 432 QCopEnvelope e("QPE/System", "execute(QString)");
427 e << QString("addressbook"); 433 e << QString("addressbook");
428} 434}
429 435
430extern QPEApplication *todayApp; 436extern QPEApplication *todayApp;
431 437
432/* 438/*
433 * launch addressbook (personal card) 439 * launch addressbook (personal card)
434 */ 440 */
435void Today::editCard() { 441void Today::editCard() {
436 442
437 startAddressbook(); 443 startAddressbook();
438 444
439 while( !QCopChannel::isRegistered("QPE/Addressbook")) todayApp->processEvents(); 445 while( !QCopChannel::isRegistered("QPE/Addressbook")) todayApp->processEvents();
440 QCopEnvelope v("QPE/Addressbook", "editPersonalAndClose()"); 446 QCopEnvelope v("QPE/Addressbook", "editPersonalAndClose()");
441} 447}
442 448
443/* 449/*
444 * launches datebook 450 * launches datebook
445 */ 451 */
446void Today::startDatebook() { 452void Today::startDatebook() {
447 QCopEnvelope e("QPE/System", "execute(QString)"); 453 QCopEnvelope e("QPE/System", "execute(QString)");
448 e << QString("datebook"); 454 e << QString("datebook");
449} 455}
450 456
451/* 457/*
452 * starts the edit dialog as known from datebook 458 * starts the edit dialog as known from datebook
453 */ 459 */
454void Today::editEvent(const Event &e) { 460void Today::editEvent(const Event &e) {
455 startDatebook(); 461 startDatebook();
456 462
457 while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); 463 while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents();
458 QCopEnvelope env("QPE/Datebook", "editEvent(int)"); 464 QCopEnvelope env("QPE/Datebook", "editEvent(int)");
459 env << e.uid(); 465 env << e.uid();
460} 466}
461 467
462/* 468/*
463 * launches todolist 469 * launches todolist
464 */ 470 */
465void Today::startTodo() { 471void Today::startTodo() {
466 QCopEnvelope e("QPE/System", "execute(QString)"); 472 QCopEnvelope e("QPE/System", "execute(QString)");
467 e << QString("todolist"); 473 e << QString("todolist");
468} 474}
469 475
470/* 476/*
471 * launch opiemail 477 * launch opiemail
472 */ 478 */