-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,3 +1,10 @@ | |||
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 |
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 | |||
@@ -3,7 +3,7 @@ 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 |
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 | |||
@@ -38,11 +38,13 @@ | |||
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; |
@@ -89,9 +91,36 @@ void Today::draw() { | |||
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()) ); |
@@ -340,6 +369,12 @@ void Today::getMail() { | |||
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; |
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 | |||
@@ -49,6 +49,7 @@ class Today : public TodayBase | |||
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; |