summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-03-08 23:41:05 (UTC)
committer harlekin <harlekin>2002-03-08 23:41:05 (UTC)
commitbc79d3f4a7503c4298a5396b80c65a3e268f4be3 (patch) (unidiff)
treeba27d1565f91458241a792091539683148086b2e
parent432eeb6cedecc0ee4dff3654803c18ebbac1f4d7 (diff)
downloadopie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.zip
opie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.tar.gz
opie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.tar.bz2
check before parse
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 +1,8 @@
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
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
@@ -5,3 +5,3 @@ Maintainer: 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)
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
@@ -40,2 +40,3 @@
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qfileinfo.h>
41 42
@@ -45,2 +46,3 @@
45 46
47
46int MAX_LINES_TASK; 48int MAX_LINES_TASK;
@@ -91,5 +93,32 @@ void Today::draw() {
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() {
@@ -342,2 +371,8 @@ void Today::getMail() {
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;
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
@@ -51,2 +51,3 @@ class Today : public TodayBase
51 void autoStart(); 51 void autoStart();
52 bool checkIfModified();
52 QList<TodoItem> loadTodo(const char *filename); 53 QList<TodoItem> loadTodo(const char *filename);