-rw-r--r-- | core/pim/today/today.cpp | 48 |
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 | |||
@@ -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 | |||
72 | void 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 | ||
72 | void Today::init() | 82 | void 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 | ||
272 | void 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 | */ |
313 | void Today::startDatebook() | 336 | void 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 | */ |
322 | void Today::startTodo() | 345 | void Today::startTodo() |
323 | { | 346 | { |
@@ -325,6 +348,15 @@ void Today::startTodo() | |||
325 | e << QString("todolist"); | 348 | e << QString("todolist"); |
326 | } | 349 | } |
327 | 350 | ||
351 | /* | ||
352 | * launch opiemail | ||
353 | */ | ||
354 | void 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 | */ |