summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Unidiff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp48
1 files changed, 40 insertions, 8 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
@@ -32,12 +32,13 @@
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
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>
41#include <stdlib.h> 42#include <stdlib.h>
42 43
43int MAX_LINES_TASK; 44int MAX_LINES_TASK;
@@ -54,23 +55,32 @@ int ONLY_LATER = 1;
54Today::Today( QWidget* parent, const char* name, WFlags fl ) 55Today::Today( QWidget* parent, const char* name, WFlags fl )
55 : TodayBase( parent, name, fl ) 56 : TodayBase( parent, name, fl )
56{ 57{
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();
68 getTodo(); 76 getMail();
69} 77 getTodo();
78 QTimer::singleShot( 60*1000, this, SLOT(draw()) );
70 79
80}
71 81
72void Today::init() 82void Today::init()
73{ 83{
74 // read config 84 // read config
75 Config cfg("today"); 85 Config cfg("today");
76 cfg.setGroup("BaseConfig"); 86 cfg.setGroup("BaseConfig");
@@ -123,16 +133,13 @@ void Today::startConfig()
123 cfg.writeEntry("maxlinesmeet",maxmeet); 133 cfg.writeEntry("maxlinesmeet",maxmeet);
124 cfg.writeEntry("showlocation",location); 134 cfg.writeEntry("showlocation",location);
125 cfg.writeEntry("shownotes", notes); 135 cfg.writeEntry("shownotes", notes);
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
136/* 143/*
137 * Get all events that are in the datebook xml file for today 144 * Get all events that are in the datebook xml file for today
138 */ 145 */
@@ -259,12 +266,28 @@ QList<TodoItem> Today::loadTodo(const char *filename)
259 minidom_free(todo); 266 minidom_free(todo);
260 267
261 return loadtodolist; 268 return loadtodolist;
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 *
268 */ 291 */
269void Today::getTodo() 292void Today::getTodo()
270{ 293{
@@ -305,29 +328,38 @@ void Today::getTodo()
305 } 328 }
306 329
307 TodoField->setText(output); 330 TodoField->setText(output);
308} 331}
309 332
310/* 333/*
311 * lanches datebook 334 * launches datebook
312 */ 335 */
313void Today::startDatebook() 336void Today::startDatebook()
314{ 337{
315 QCopEnvelope e("QPE/System", "execute(QString)"); 338 QCopEnvelope e("QPE/System", "execute(QString)");
316 e << QString("datebook"); 339 e << QString("datebook");
317} 340}
318 341
319/* 342/*
320 * lanches todolist 343 * launches todolist
321 */ 344 */
322void Today::startTodo() 345void Today::startTodo()
323{ 346{
324 QCopEnvelope e("QPE/System", "execute(QString)"); 347 QCopEnvelope e("QPE/System", "execute(QString)");
325 e << QString("todolist"); 348 e << QString("todolist");
326} 349}
327 350
351/*
352 * launch opiemail
353 */
354void Today::startMail()
355{
356 QCopEnvelope e("QPE/System", "execute(QString)");
357 e << QString("opiemail");
358}
359
328/* 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()
332{ 364{
333 // no need to delete child widgets, Qt does it all for us 365 // no need to delete child widgets, Qt does it all for us