summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/changelog7
-rw-r--r--core/pim/today/opie-today.control2
-rw-r--r--core/pim/today/today.cpp37
-rw-r--r--core/pim/today/today.h1
4 files changed, 45 insertions, 2 deletions
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index 692c0dc..7111154 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1,45 +1,52 @@
10.2.7
2
3* check if todolist.xml was changed before parsing it
4* check only every 30 sec for changes.
5* some visual stuff
6* as usual many little improvements .-)
7
10.2.6 80.2.6
2 9
3* added scrollbars to dates and todo 10* added scrollbars to dates and todo
4* all day detection 11* all day detection
5* some smaller bugfixes 12* some smaller bugfixes
6 13
70.2.5 140.2.5
8 15
9* some other minor fixes regarding autoupdate 16* some other minor fixes regarding autoupdate
10* fixed segfault with todolist > 7 entries 17* fixed segfault with todolist > 7 entries
11* fixed the "ugly grey border around buttons" issue 18* fixed the "ugly grey border around buttons" issue
12* fixed the "empty calendar field" "bug" 19* fixed the "empty calendar field" "bug"
13* shown only later appointments as option 20* shown only later appointments as option
14 21
15 22
160.2.4 230.2.4
17 24
18* added support for email 25* added support for email
19* autoupdates after 1 min 26* autoupdates after 1 min
20* QCopEnvelope instead of system() 27* QCopEnvelope instead of system()
21* starting to use qvbox in gui 28* starting to use qvbox in gui
22 29
23 30
240.2.3 310.2.3
25 32
26* the 4 am release 33* the 4 am release
27* several bugfixes 34* several bugfixes
28 35
29 36
300.2.2 370.2.2
31 38
32* started working on calling other apps 39* started working on calling other apps
33* and finished it 40* and finished it
34 41
350.2.1 420.2.1
36 43
37* images no more inline 44* images no more inline
38* config dialog 45* config dialog
39 46
400.1.1 470.1.1
41 48
42* started changelog. 49* started changelog.
43* fixed segfault on empty/nonexistant todolist.xml 50* fixed segfault on empty/nonexistant todolist.xml
44* better handling for file location 51* better handling for file location
45 52
diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control
index f16ddfb..4c0a1c0 100644
--- a/core/pim/today/opie-today.control
+++ b/core/pim/today/opie-today.control
@@ -1,10 +1,10 @@
1Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png 1Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Maximilian Reiß <max.reiss@gmx.de> 4Maintainer: Maximilian Reiß <max.reiss@gmx.de>
5Architecture: arm 5Architecture: arm
6Version: 0.2.6 6Version: 0.2.7
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8License: GPL 8License: GPL
9Description: today screen 9Description: today screen
10 A short overview over current appointments and tasks. 10 A short overview over current appointments and tasks.
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index af1d4e4..d715fc1 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,142 +1,171 @@
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#include "minidom.h" 21#include "minidom.h"
22#include "TodoItem.h" 22#include "TodoItem.h"
23 23
24#include <qpe/datebookdb.h> 24#include <qpe/datebookdb.h>
25#include <qpe/timestring.h> 25#include <qpe/timestring.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/qprocess.h> 28#include <qpe/qprocess.h>
29#include <qpe/resource.h> 29#include <qpe/resource.h>
30 30
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qtextstream.h> 34#include <qtextstream.h>
35#include <qcheckbox.h> 35#include <qcheckbox.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qtimer.h> 39#include <qtimer.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qfileinfo.h>
41 42
42//#include <iostream.h> 43//#include <iostream.h>
43//#include <unistd.h> 44//#include <unistd.h>
44#include <stdlib.h> 45#include <stdlib.h>
45 46
47
46int MAX_LINES_TASK; 48int MAX_LINES_TASK;
47int MAX_CHAR_CLIP; 49int MAX_CHAR_CLIP;
48int MAX_LINES_MEET; 50int MAX_LINES_MEET;
49int SHOW_LOCATION; 51int SHOW_LOCATION;
50int SHOW_NOTES; 52int SHOW_NOTES;
51// show only later dates 53// show only later dates
52int ONLY_LATER; 54int ONLY_LATER;
53int AUTOSTART; 55int AUTOSTART;
54/* 56/*
55 * Constructs a Example which is a child of 'parent', with the 57 * Constructs a Example which is a child of 'parent', with the
56 * name 'name' and widget flags set to 'f' 58 * name 'name' and widget flags set to 'f'
57 */ 59 */
58Today::Today( QWidget* parent, const char* name, WFlags fl ) 60Today::Today( QWidget* parent, const char* name, WFlags fl )
59 : TodayBase( parent, name, fl ) { 61 : TodayBase( parent, name, fl ) {
60 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 62 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
61 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 63 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
62 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 64 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
63 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); 65 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
64 66
65 67
66 autoStart(); 68 autoStart();
67 draw(); 69 draw();
68} 70}
69 71
70 72
71void Today::autoStart() { 73void Today::autoStart() {
72 Config cfg("today"); 74 Config cfg("today");
73 cfg.setGroup("Autostart"); 75 cfg.setGroup("Autostart");
74 AUTOSTART = cfg.readNumEntry("autostart",1); 76 AUTOSTART = cfg.readNumEntry("autostart",1);
75 if (AUTOSTART) { 77 if (AUTOSTART) {
76 QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); 78 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
77 e << QString("add"); 79 e << QString("add");
78 e << QString("today"); 80 e << QString("today");
79 } else { 81 } else {
80 QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); 82 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
81 e << QString("remove"); 83 e << QString("remove");
82 e << QString("today"); 84 e << QString("today");
83 } 85 }
84} 86}
85 87
86void Today::draw() { 88void Today::draw() {
87 init(); 89 init();
88 getDates(); 90 getDates();
89 getMail(); 91 getMail();
90 getTodo(); 92 getTodo();
91 // how often refresh 93 // how often refresh
92 QTimer::singleShot( 5*1000, this, SLOT(draw()) ); 94 QTimer::singleShot( 30*1000, this, SLOT(draw()) );
95}
96
97
98/*
99 * Check if the todolist.xml was modified (if there are new entries.
100 * Returns true if it was modified.
101 */
102bool Today::checkIfModified() {
103
104 QDir dir;
105 QString homedir = dir.homeDirPath ();
106 QString time;
107
108 Config cfg("today");
109 cfg.setGroup("Files");
110 time = cfg.readEntry("todolisttimestamp", "");
111
112 QFileInfo file = (homedir +"/Applications/todolist/todolist.xml");
113 QDateTime fileTime = file.lastModified();
114 if (time.compare(fileTime.toString()) == 0) {
115 return false;
116 } else {
117 cfg.writeEntry("todolisttimestamp", fileTime.toString() );
118 cfg.write();
119 return true;
120 }
93} 121}
94 122
123
95void Today::init() { 124void Today::init() {
96 QDate date = QDate::currentDate(); 125 QDate date = QDate::currentDate();
97 QString time = (tr( date.toString()) ); 126 QString time = (tr( date.toString()) );
98// QString time = (tr( date.toString()) , white); 127// QString time = (tr( date.toString()) , white);
99 128
100 TextLabel1->setText(time); 129 TextLabel1->setText(time);
101 db = new DateBookDB; 130 db = new DateBookDB;
102 131
103 // read config 132 // read config
104 Config cfg("today"); 133 Config cfg("today");
105 cfg.setGroup("BaseConfig"); 134 cfg.setGroup("BaseConfig");
106 135
107 // how many lines should be showed in the task section 136 // how many lines should be showed in the task section
108 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); 137 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5);
109 // after how many chars should the be cut off on tasks and notes 138 // after how many chars should the be cut off on tasks and notes
110 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30); 139 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30);
111 // how many lines should be showed in the datebook section 140 // how many lines should be showed in the datebook section
112 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); 141 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5);
113 // If location is to be showed too, 1 to activate it. 142 // If location is to be showed too, 1 to activate it.
114 SHOW_LOCATION = cfg.readNumEntry("showlocation",1); 143 SHOW_LOCATION = cfg.readNumEntry("showlocation",1);
115 // if notes should be shown 144 // if notes should be shown
116 SHOW_NOTES = cfg.readNumEntry("shownotes",0); 145 SHOW_NOTES = cfg.readNumEntry("shownotes",0);
117 ONLY_LATER = cfg.readNumEntry("onlylater",1); 146 ONLY_LATER = cfg.readNumEntry("onlylater",1);
118 147
119} 148}
120 149
121void Today::startConfig() { 150void Today::startConfig() {
122 conf = new todayconfig ( this, "", true ); 151 conf = new todayconfig ( this, "", true );
123 152
124 153
125 //Config cfg = new Config("today"); 154 //Config cfg = new Config("today");
126 155
127 // read the config 156 // read the config
128 Config cfg("today"); 157 Config cfg("today");
129 cfg.setGroup("BaseConfig"); 158 cfg.setGroup("BaseConfig");
130 159
131 //init(); 160 //init();
132 161
133 conf->SpinBox1->setValue(MAX_LINES_MEET); 162 conf->SpinBox1->setValue(MAX_LINES_MEET);
134 // location show box 163 // location show box
135 conf->CheckBox1->setChecked(SHOW_LOCATION); 164 conf->CheckBox1->setChecked(SHOW_LOCATION);
136 // notes show box 165 // notes show box
137 conf->CheckBox2->setChecked(SHOW_NOTES); 166 conf->CheckBox2->setChecked(SHOW_NOTES);
138 // task lines 167 // task lines
139 conf->SpinBox2->setValue(MAX_LINES_TASK); 168 conf->SpinBox2->setValue(MAX_LINES_TASK);
140 // clip when? 169 // clip when?
141 conf->SpinBox7->setValue(MAX_CHAR_CLIP); 170 conf->SpinBox7->setValue(MAX_CHAR_CLIP);
142 // only later 171 // only later
@@ -295,96 +324,102 @@ QList<TodoItem> Today::loadTodo(const char *filename) {
295 if(s == "Completed") { 324 if(s == "Completed") {
296 completed = QString(attlist[j]->value).toInt(); 325 completed = QString(attlist[j]->value).toInt();
297 } 326 }
298 } 327 }
299 // get Priority (1 to 5) 328 // get Priority (1 to 5)
300 if(!strcmp(attlist[j]->name, "Priority")) { 329 if(!strcmp(attlist[j]->name, "Priority")) {
301 QString s = attlist[j]->name; 330 QString s = attlist[j]->name;
302 if(s == "Priority") { 331 if(s == "Priority") {
303 priority = QString(attlist[j]->value).toInt(); 332 priority = QString(attlist[j]->value).toInt();
304 } 333 }
305 } 334 }
306 j++; 335 j++;
307 } 336 }
308 if(description) { 337 if(description) {
309 tmp = new TodoItem(description, completed, priority); 338 tmp = new TodoItem(description, completed, priority);
310 loadtodolist.append(tmp); 339 loadtodolist.append(tmp);
311 } 340 }
312 i++; 341 i++;
313 } 342 }
314 } 343 }
315 344
316 minidom_free(todo); 345 minidom_free(todo);
317 346
318 return loadtodolist; 347 return loadtodolist;
319} 348}
320 349
321 350
322void Today::getMail() { 351void Today::getMail() {
323 Config cfg("opiemail"); 352 Config cfg("opiemail");
324 cfg.setGroup("today"); 353 cfg.setGroup("today");
325 354
326 // how many lines should be showed in the task section 355 // how many lines should be showed in the task section
327 int NEW_MAILS = cfg.readNumEntry("newmails",0); 356 int NEW_MAILS = cfg.readNumEntry("newmails",0);
328 int OUTGOING = cfg.readNumEntry("outgoing",0); 357 int OUTGOING = cfg.readNumEntry("outgoing",0);
329 358
330 359
331 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 360 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
332 361
333 362
334 MailField->setText(output); 363 MailField->setText(output);
335} 364}
336 365
337 366
338/* 367/*
339 * Get the todos 368 * Get the todos
340 * 369 *
341 */ 370 */
342void Today::getTodo() { 371void Today::getTodo() {
372
373 // if the todolist.xml file was not modified in between, do not parse it.
374 if (!checkIfModified()) {
375 return;
376 }
377
343 QString output; 378 QString output;
344 QString tmpout; 379 QString tmpout;
345 int count = 0; 380 int count = 0;
346 381
347 QDir dir; 382 QDir dir;
348 QString homedir = dir.homeDirPath (); 383 QString homedir = dir.homeDirPath ();
349 // see if todolist.xml does exist. 384 // see if todolist.xml does exist.
350 QFile f(homedir +"/Applications/todolist/todolist.xml"); 385 QFile f(homedir +"/Applications/todolist/todolist.xml");
351 if ( f.exists() ) { 386 if ( f.exists() ) {
352 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); 387 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml");
353 388
354 TodoItem *item; 389 TodoItem *item;
355 for( item = todolist.first(); item; item = todolist.next()) { 390 for( item = todolist.first(); item; item = todolist.next()) {
356 if (!(item->getCompleted() == 1) ) { 391 if (!(item->getCompleted() == 1) ) {
357 count++; 392 count++;
358 if (count <= MAX_LINES_TASK) { 393 if (count <= MAX_LINES_TASK) {
359 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); 394 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
360 } 395 }
361 } 396 }
362 } 397 }
363 } 398 }
364 399
365 if (count > 0) { 400 if (count > 0) {
366 if( count == 1 ) { 401 if( count == 1 ) {
367 output = tr("There is <b> 1</b> active task: <br>" ); 402 output = tr("There is <b> 1</b> active task: <br>" );
368 } else { 403 } else {
369 output = tr("There are <b> %1</b> active tasks: <br>").arg(count); 404 output = tr("There are <b> %1</b> active tasks: <br>").arg(count);
370 } 405 }
371 output += tmpout; 406 output += tmpout;
372 } else { 407 } else {
373 output = tr("No active tasks"); 408 output = tr("No active tasks");
374 } 409 }
375 410
376 TodoField->setText(tr(output)); 411 TodoField->setText(tr(output));
377} 412}
378 413
379/* 414/*
380 * launches datebook 415 * launches datebook
381 */ 416 */
382void Today::startDatebook() { 417void Today::startDatebook() {
383 QCopEnvelope e("QPE/System", "execute(QString)"); 418 QCopEnvelope e("QPE/System", "execute(QString)");
384 e << QString("datebook"); 419 e << QString("datebook");
385} 420}
386 421
387/* 422/*
388 * launches todolist 423 * launches todolist
389 */ 424 */
390void Today::startTodo() { 425void Today::startTodo() {
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 07bfd61..b3b7d01 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -4,61 +4,62 @@
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 20
21#ifndef TODAY_H 21#ifndef TODAY_H
22#define TODAY_H 22#define TODAY_H
23#include "todaybase.h" 23#include "todaybase.h"
24 24
25#include <qpe/datebookdb.h> 25#include <qpe/datebookdb.h>
26 26
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlist.h> 28#include <qlist.h>
29#include "TodoItem.h" 29#include "TodoItem.h"
30#include "todayconfig.h" 30#include "todayconfig.h"
31 31
32class Today : public TodayBase 32class Today : public TodayBase
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36 public: 36 public:
37 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 37 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
38 ~Today(); 38 ~Today();
39 39
40 private slots: 40 private slots:
41 void startConfig(); 41 void startConfig();
42 void startTodo(); 42 void startTodo();
43 void startDatebook(); 43 void startDatebook();
44 void startMail(); 44 void startMail();
45 void draw(); 45 void draw();
46 private: 46 private:
47 void init(); 47 void init();
48 void getDates(); 48 void getDates();
49 void getTodo(); 49 void getTodo();
50 void getMail(); 50 void getMail();
51 void autoStart(); 51 void autoStart();
52 bool checkIfModified();
52 QList<TodoItem> loadTodo(const char *filename); 53 QList<TodoItem> loadTodo(const char *filename);
53 private: 54 private:
54 DateBookDB *db; 55 DateBookDB *db;
55 todayconfig *conf; 56 todayconfig *conf;
56 //Config cfg; 57 //Config cfg;
57 int MAX_LINES_TASK; 58 int MAX_LINES_TASK;
58 int MAX_CHAR_CLIP; 59 int MAX_CHAR_CLIP;
59 int MAX_LINES_MEET; 60 int MAX_LINES_MEET;
60 int SHOW_LOCATION; 61 int SHOW_LOCATION;
61 int SHOW_NOTES; 62 int SHOW_NOTES;
62}; 63};
63#endif // TODAY_H 64#endif // TODAY_H
64 65