summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
authorharlekin <harlekin>2002-02-20 20:04:58 (UTC)
committer harlekin <harlekin>2002-02-20 20:04:58 (UTC)
commit17e96f64d6b66fac5f0e206492149d461e2ad900 (patch) (side-by-side diff)
treea2af1d60dc0a44e6e7991fc25d5ed8d9646e3620 /core/pim/today/today.cpp
parentf5ce2ee04b4b9aed2a93e9a730ad22ced791dfd8 (diff)
downloadopie-17e96f64d6b66fac5f0e206492149d461e2ad900.zip
opie-17e96f64d6b66fac5f0e206492149d461e2ad900.tar.gz
opie-17e96f64d6b66fac5f0e206492149d461e2ad900.tar.bz2
new release fixing several bugs, look at changelog .-)
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp58
1 files changed, 35 insertions, 23 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 7a2d0c9..bed3a74 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -23,22 +23,24 @@
#include <qpe/datebookdb.h>
#include <qpe/timestring.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qprocess.h>
+#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 <iostream.h>
//#include <unistd.h>
#include <stdlib.h>
int MAX_LINES_TASK;
@@ -55,36 +57,37 @@ int ONLY_LATER;
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;
+ QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
draw();
}
void Today::draw()
{
init();
getDates();
getMail();
getTodo();
// how often refresh
- QTimer::singleShot( 30*1000, this, SLOT(draw()) );
+ QTimer::singleShot( 5*1000, this, SLOT(draw()) );
}
void Today::init()
{
+ QDate date = QDate::currentDate();
+ QString time = (date.toString());
+
+ TextLabel1->setText("<qt><font color=white>" +time + "<font></qt>");
+ db = new DateBookDB;
+
// read config
Config cfg("today");
cfg.setGroup("BaseConfig");
// how many lines should be showed in the task section
MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5);
@@ -144,24 +147,25 @@ void Today::startConfig()
cfg.write();
draw();
}
+
/*
* Get all events that are in the datebook xml file for today
*/
void Today::getDates()
{
QDate date = QDate::currentDate();
QTime time = QTime::currentTime();
QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
Config config( "qpe" );
// if 24 h format
- // bool ampm = config.readBoolEntry( "AMPM", TRUE );
+ //bool ampm = config.readBoolEntry( "AMPM", TRUE );
int count=0;
if ( list.count() > 0 ) {
QString msg;
@@ -177,33 +181,41 @@ void Today::getDates()
//cout << TimeString::dateString((*it).event().end()) << endl;
// still some bug in here, 1 h off
// decide if to get all day or only later appointments
if (!ONLY_LATER)
{
- msg += "<B>" + (*it).description() + "</B>";
- // include location or not
- if (SHOW_LOCATION == 1)
- {
+ msg += "<B>" + (*it).description() + "</B>";
+ if ( (*it).event().hasAlarm() )
+ {
+ msg += " <b>[with alarm]</b>";
+ }
+ // include location or not
+ if (SHOW_LOCATION == 1)
+ {
msg+= "<BR>" + (*it).location();
- }
- msg += "<BR>"
- // start time of event
- + TimeString::timeString(QTime((*it).event().start().time()) )
- // end time of event
- + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) )
- + "<BR>";
- // include possible note or not
- if (SHOW_NOTES == 1)
+ }
+ msg += "<BR>"
+ // start time of event
+ + TimeString::timeString(QTime((*it).event().start().time()) )
+ // end time of event
+ + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) )
+ + "<BR>";
+ // include possible note or not
+ if (SHOW_NOTES == 1)
{
msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
}
}
else if ((time.toString() <= TimeString::dateString((*it).event().end())) )
{
msg += "<B>" + (*it).description() + "</B>";
+ if ( (*it).event().hasAlarm() )
+ {
+ msg += " <b>[with alarm]</b>";
+ }
// include location or not
if (SHOW_LOCATION == 1)
{
msg+= "<BR>" + (*it).location();
}
msg += "<BR>"
@@ -227,13 +239,12 @@ void Today::getDates()
DatesField->setText(msg);
}
}
/*
* Parse in the todolist.xml
- *
*/
QList<TodoItem> Today::loadTodo(const char *filename)
{
DOM *todo;
ELE *tasks;
ELE **tasklist;
@@ -259,13 +270,14 @@ QList<TodoItem> Today::loadTodo(const char *filename)
j = 0;
description = NULL;
priority = -1;
completed = -1;
while((attlist) && (attlist[j]))
{
- if(!attlist[i]->name) continue;
+ // SEGFAULT HERE WITH MORE THAN 7 ENTRIES
+ if(!attlist[j]->name) continue;
if(!strcmp(attlist[j]->name, "Description"))
{
description = attlist[j]->value;
}
// get Completed tag (0 or 1)
if(!strcmp(attlist[j]->name, "Completed"))