author | harlekin <harlekin> | 2002-03-08 23:41:05 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-03-08 23:41:05 (UTC) |
commit | bc79d3f4a7503c4298a5396b80c65a3e268f4be3 (patch) (unidiff) | |
tree | ba27d1565f91458241a792091539683148086b2e | |
parent | 432eeb6cedecc0ee4dff3654803c18ebbac1f4d7 (diff) | |
download | opie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.zip opie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.tar.gz opie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.tar.bz2 |
check before parse
-rw-r--r-- | core/pim/today/changelog | 7 | ||||
-rw-r--r-- | core/pim/today/opie-today.control | 2 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 37 | ||||
-rw-r--r-- | core/pim/today/today.h | 1 |
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,12 +1,19 @@ | |||
1 | 0.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 | |||
1 | 0.2.6 | 8 | 0.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 | ||
7 | 0.2.5 | 14 | 0.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" |
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 @@ | |||
1 | Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png | 1 | Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> | 4 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 0.2.6 | 6 | Version: 0.2.7 |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | License: GPL | 8 | License: GPL |
9 | Description: today screen | 9 | Description: 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 | |||
@@ -29,29 +29,31 @@ | |||
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 | |||
46 | int MAX_LINES_TASK; | 48 | int MAX_LINES_TASK; |
47 | int MAX_CHAR_CLIP; | 49 | int MAX_CHAR_CLIP; |
48 | int MAX_LINES_MEET; | 50 | int MAX_LINES_MEET; |
49 | int SHOW_LOCATION; | 51 | int SHOW_LOCATION; |
50 | int SHOW_NOTES; | 52 | int SHOW_NOTES; |
51 | // show only later dates | 53 | // show only later dates |
52 | int ONLY_LATER; | 54 | int ONLY_LATER; |
53 | int AUTOSTART; | 55 | int 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 | */ |
@@ -80,27 +82,54 @@ void Today::autoStart() { | |||
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 | ||
86 | void Today::draw() { | 88 | void 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 | */ | ||
102 | bool 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 | |||
95 | void Today::init() { | 124 | void 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 | ||
@@ -331,24 +360,30 @@ void Today::getMail() { | |||
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 | */ |
342 | void Today::getTodo() { | 371 | void 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; |
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 | |||
@@ -40,24 +40,25 @@ class Today : public TodayBase | |||
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 |