summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Unidiff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/today.cpp46
1 files changed, 39 insertions, 7 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 00a8842..eb8b50c 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -35,6 +35,7 @@
35#include <qspinbox.h> 35#include <qspinbox.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qtimer.h>
38 39
39//#include <iostream.h> 40//#include <iostream.h>
40//#include <unistd.h> 41//#include <unistd.h>
@@ -57,17 +58,26 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
57 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 58 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
58 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 59 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
59 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 60 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
61 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
60 62
61 QDate date = QDate::currentDate(); 63 QDate date = QDate::currentDate();
62 QString time = (date.toString()); 64 QString time = (date.toString());
63 TextLabel1->setText(time); 65 TextLabel1->setText(time);
64 db = new DateBookDB; 66 db = new DateBookDB;
65 67
68 draw();
69}
70
71
72void Today::draw()
73{
66 init(); 74 init();
67 getDates(); 75 getDates();
76 getMail();
68 getTodo(); 77 getTodo();
69} 78 QTimer::singleShot( 60*1000, this, SLOT(draw()) );
70 79
80}
71 81
72void Today::init() 82void Today::init()
73{ 83{
@@ -126,10 +136,7 @@ void Today::startConfig()
126 // sync it to "disk" 136 // sync it to "disk"
127 cfg.write(); 137 cfg.write();
128 138
129 init(); 139 draw();
130 getDates();
131 getTodo();
132 //cout << location << endl;
133} 140}
134 141
135 142
@@ -262,6 +269,22 @@ QList<TodoItem> Today::loadTodo(const char *filename)
262} 269}
263 270
264 271
272void Today::getMail()
273{
274 Config cfg("opiemail");
275 cfg.setGroup("today");
276
277 // how many lines should be showed in the task section
278 int NEW_MAILS = cfg.readNumEntry("newmails",0);
279 int OUTGOING = cfg.readNumEntry("outgoing",0);
280
281 QString output = tr("<b>%1</b> new mails, <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
282
283
284 MailField->setText(output);
285}
286
287
265/* 288/*
266 * Get the todos 289 * Get the todos
267 * 290 *
@@ -308,7 +331,7 @@ void Today::getTodo()
308} 331}
309 332
310/* 333/*
311 * lanches datebook 334 * launches datebook
312 */ 335 */
313void Today::startDatebook() 336void Today::startDatebook()
314{ 337{
@@ -317,7 +340,7 @@ void Today::startDatebook()
317} 340}
318 341
319/* 342/*
320 * lanches todolist 343 * launches todolist
321 */ 344 */
322void Today::startTodo() 345void Today::startTodo()
323{ 346{
@@ -326,6 +349,15 @@ void Today::startTodo()
326} 349}
327 350
328/* 351/*
352 * launch opiemail
353 */
354void Today::startMail()
355{
356 QCopEnvelope e("QPE/System", "execute(QString)");
357 e << QString("opiemail");
358}
359
360/*
329 * Destroys the object and frees any allocated resources 361 * Destroys the object and frees any allocated resources
330 */ 362 */
331Today::~Today() 363Today::~Today()