summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
authorharlekin <harlekin>2002-03-08 23:41:05 (UTC)
committer harlekin <harlekin>2002-03-08 23:41:05 (UTC)
commitbc79d3f4a7503c4298a5396b80c65a3e268f4be3 (patch) (side-by-side diff)
treeba27d1565f91458241a792091539683148086b2e /core/pim/today/today.cpp
parent432eeb6cedecc0ee4dff3654803c18ebbac1f4d7 (diff)
downloadopie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.zip
opie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.tar.gz
opie-bc79d3f4a7503c4298a5396b80c65a3e268f4be3.tar.bz2
check before parse
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (ignore 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
@@ -38,11 +38,13 @@
#include <qlabel.h>
#include <qtimer.h>
#include <qpixmap.h>
+#include <qfileinfo.h>
//#include <iostream.h>
//#include <unistd.h>
#include <stdlib.h>
+
int MAX_LINES_TASK;
int MAX_CHAR_CLIP;
int MAX_LINES_MEET;
@@ -89,9 +91,36 @@ void Today::draw() {
getMail();
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();
QString time = (tr( date.toString()) );
@@ -340,6 +369,12 @@ 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;
int count = 0;