summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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,12 +1,19 @@
+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
* added scrollbars to dates and todo
* all day detection
* some smaller bugfixes
0.2.5
* some other minor fixes regarding autoupdate
* fixed segfault with todolist > 7 entries
* fixed the "ugly grey border around buttons" issue
* fixed the "empty calendar field" "bug"
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
@@ -1,10 +1,10 @@
Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png
Priority: optional
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
Description: today screen
A short overview over current appointments and tasks.
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
@@ -29,29 +29,31 @@
#include <qpe/resource.h>
#include <qdir.h>
#include <qfile.h>
#include <qdatetime.h>
#include <qtextstream.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qpushbutton.h>
#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;
int SHOW_LOCATION;
int SHOW_NOTES;
// show only later dates
int ONLY_LATER;
int AUTOSTART;
/*
* Constructs a Example which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
@@ -80,27 +82,54 @@ void Today::autoStart() {
QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
e << QString("remove");
e << QString("today");
}
}
void Today::draw() {
init();
getDates();
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()) );
// QString time = (tr( date.toString()) , white);
TextLabel1->setText(time);
db = new DateBookDB;
// read config
Config cfg("today");
cfg.setGroup("BaseConfig");
@@ -331,24 +360,30 @@ void Today::getMail() {
QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
MailField->setText(output);
}
/*
* Get the todos
*
*/
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;
QDir dir;
QString homedir = dir.homeDirPath ();
// see if todolist.xml does exist.
QFile f(homedir +"/Applications/todolist/todolist.xml");
if ( f.exists() ) {
QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml");
TodoItem *item;
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
@@ -40,24 +40,25 @@ class Today : public TodayBase
private slots:
void startConfig();
void startTodo();
void startDatebook();
void startMail();
void draw();
private:
void init();
void getDates();
void getTodo();
void getMail();
void autoStart();
+ bool checkIfModified();
QList<TodoItem> loadTodo(const char *filename);
private:
DateBookDB *db;
todayconfig *conf;
//Config cfg;
int MAX_LINES_TASK;
int MAX_CHAR_CLIP;
int MAX_LINES_MEET;
int SHOW_LOCATION;
int SHOW_NOTES;
};
#endif // TODAY_H