author | harlekin <harlekin> | 2002-02-16 19:59:21 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-02-16 19:59:21 (UTC) |
commit | 4e6ec847f469a3669be864db69dee0d8b0e4a93b (patch) (side-by-side diff) | |
tree | db92798a54f2eca93aa71fcf4d9aab3d116f0c5e /core/pim/today/today.cpp | |
parent | be1704ffdb21c6d304ba36bfd5ef1f5db622baea (diff) | |
download | opie-4e6ec847f469a3669be864db69dee0d8b0e4a93b.zip opie-4e6ec847f469a3669be864db69dee0d8b0e4a93b.tar.gz opie-4e6ec847f469a3669be864db69dee0d8b0e4a93b.tar.bz2 |
new features: auto update and opiemail support
-rw-r--r-- | core/pim/today/today.cpp | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 00a8842..eb8b50c 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -32,12 +32,13 @@ #include <qdatetime.h> #include <qtextstream.h> #include <qcheckbox.h> #include <qspinbox.h> #include <qpushbutton.h> #include <qlabel.h> +#include <qtimer.h> //#include <iostream.h> //#include <unistd.h> #include <stdlib.h> int MAX_LINES_TASK; @@ -54,23 +55,32 @@ int ONLY_LATER = 1; Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl ) { QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); + QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); QDate date = QDate::currentDate(); QString time = (date.toString()); TextLabel1->setText(time); db = new DateBookDB; + draw(); +} + + +void Today::draw() +{ init(); getDates(); + getMail(); getTodo(); -} + QTimer::singleShot( 60*1000, this, SLOT(draw()) ); +} void Today::init() { // read config Config cfg("today"); cfg.setGroup("BaseConfig"); @@ -123,16 +133,13 @@ void Today::startConfig() cfg.writeEntry("maxlinesmeet",maxmeet); cfg.writeEntry("showlocation",location); cfg.writeEntry("shownotes", notes); // sync it to "disk" cfg.write(); - init(); - getDates(); - getTodo(); - //cout << location << endl; + draw(); } /* * Get all events that are in the datebook xml file for today */ @@ -259,12 +266,28 @@ QList<TodoItem> Today::loadTodo(const char *filename) minidom_free(todo); return loadtodolist; } +void Today::getMail() +{ + Config cfg("opiemail"); + cfg.setGroup("today"); + + // how many lines should be showed in the task section + int NEW_MAILS = cfg.readNumEntry("newmails",0); + int OUTGOING = cfg.readNumEntry("outgoing",0); + + QString output = tr("<b>%1</b> new mails, <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); + + + MailField->setText(output); +} + + /* * Get the todos * */ void Today::getTodo() { @@ -305,30 +328,39 @@ void Today::getTodo() } TodoField->setText(output); } /* - * lanches datebook + * launches datebook */ void Today::startDatebook() { QCopEnvelope e("QPE/System", "execute(QString)"); e << QString("datebook"); } /* - * lanches todolist + * launches todolist */ void Today::startTodo() { QCopEnvelope e("QPE/System", "execute(QString)"); e << QString("todolist"); } /* + * launch opiemail + */ +void Today::startMail() +{ + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString("opiemail"); +} + +/* * Destroys the object and frees any allocated resources */ Today::~Today() { // no need to delete child widgets, Qt does it all for us } |