summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/today.cpp37
1 files changed, 36 insertions, 1 deletions
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 @@
#include <qpixmap.h>
+#include <qfileinfo.h>
@@ -45,2 +46,3 @@
+
int MAX_LINES_TASK;
@@ -91,5 +93,32 @@ void Today::draw() {
// 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() {
@@ -342,2 +371,8 @@ 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;