author | harlekin <harlekin> | 2002-03-08 23:41:05 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-03-08 23:41:05 (UTC) |
commit | bc79d3f4a7503c4298a5396b80c65a3e268f4be3 (patch) (side-by-side diff) | |
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,2 +1,9 @@ +0.2.7 + +* check if todolist.xml was changed before parsing it +* check only every 30 sec for changes. +* some visual stuff +* as usual many little improvements .-) + 0.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 @@ -4,5 +4,5 @@ Section: opie/applications Maintainer: Maximilian Reiß <max.reiss@gmx.de> Architecture: arm -Version: 0.2.6 +Version: 0.2.7 Depends: opie-base ($QPE_VERSION) License: GPL 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 @@ -39,4 +39,5 @@ #include <qtimer.h> #include <qpixmap.h> +#include <qfileinfo.h> //#include <iostream.h> @@ -44,4 +45,5 @@ #include <stdlib.h> + int MAX_LINES_TASK; int MAX_CHAR_CLIP; @@ -90,7 +92,34 @@ void Today::draw() { getTodo(); // how often refresh - QTimer::singleShot( 5*1000, this, SLOT(draw()) ); + QTimer::singleShot( 30*1000, this, SLOT(draw()) ); +} + + +/* + * Check if the todolist.xml was modified (if there are new entries. + * Returns true if it was modified. + */ +bool Today::checkIfModified() { + + QDir dir; + QString homedir = dir.homeDirPath (); + QString time; + + Config cfg("today"); + cfg.setGroup("Files"); + time = cfg.readEntry("todolisttimestamp", ""); + + QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); + QDateTime fileTime = file.lastModified(); + if (time.compare(fileTime.toString()) == 0) { + return false; + } else { + cfg.writeEntry("todolisttimestamp", fileTime.toString() ); + cfg.write(); + return true; + } } + void Today::init() { QDate date = QDate::currentDate(); @@ -341,4 +370,10 @@ void Today::getMail() { */ void Today::getTodo() { + + // if the todolist.xml file was not modified in between, do not parse it. + if (!checkIfModified()) { + return; + } + QString output; QString tmpout; 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 @@ -50,4 +50,5 @@ class Today : public TodayBase void getMail(); void autoStart(); + bool checkIfModified(); QList<TodoItem> loadTodo(const char *filename); private: |