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) (unidiff)
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
@@ -26,6 +26,7 @@
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/qprocess.h> 28#include <qpe/qprocess.h>
29#include <qpe/resource.h>
29 30
30#include <qdir.h> 31#include <qdir.h>
31#include <qfile.h> 32#include <qfile.h>
@@ -36,6 +37,7 @@
36#include <qpushbutton.h> 37#include <qpushbutton.h>
37#include <qlabel.h> 38#include <qlabel.h>
38#include <qtimer.h> 39#include <qtimer.h>
40#include <qpixmap.h>
39 41
40//#include <iostream.h> 42//#include <iostream.h>
41//#include <unistd.h> 43//#include <unistd.h>
@@ -58,12 +60,7 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
58 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 60 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
59 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 61 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
60 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 62 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
61 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); 63 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
62
63 QDate date = QDate::currentDate();
64 QString time = (date.toString());
65 TextLabel1->setText(time);
66 db = new DateBookDB;
67 64
68 draw(); 65 draw();
69} 66}
@@ -76,12 +73,18 @@ void Today::draw()
76 getMail(); 73 getMail();
77 getTodo(); 74 getTodo();
78 // how often refresh 75 // how often refresh
79 QTimer::singleShot( 30*1000, this, SLOT(draw()) ); 76 QTimer::singleShot( 5*1000, this, SLOT(draw()) );
80 77
81} 78}
82 79
83void Today::init() 80void Today::init()
84{ 81{
82 QDate date = QDate::currentDate();
83 QString time = (date.toString());
84
85 TextLabel1->setText("<qt><font color=white>" +time + "<font></qt>");
86 db = new DateBookDB;
87
85 // read config 88 // read config
86 Config cfg("today"); 89 Config cfg("today");
87 cfg.setGroup("BaseConfig"); 90 cfg.setGroup("BaseConfig");
@@ -147,6 +150,7 @@ void Today::startConfig()
147} 150}
148 151
149 152
153
150/* 154/*
151 * Get all events that are in the datebook xml file for today 155 * Get all events that are in the datebook xml file for today
152 */ 156 */
@@ -158,7 +162,7 @@ void Today::getDates()
158 162
159 Config config( "qpe" ); 163 Config config( "qpe" );
160 // if 24 h format 164 // if 24 h format
161 // bool ampm = config.readBoolEntry( "AMPM", TRUE ); 165 //bool ampm = config.readBoolEntry( "AMPM", TRUE );
162 166
163 int count=0; 167 int count=0;
164 168
@@ -180,20 +184,24 @@ void Today::getDates()
180 // decide if to get all day or only later appointments 184 // decide if to get all day or only later appointments
181 if (!ONLY_LATER) 185 if (!ONLY_LATER)
182 { 186 {
183 msg += "<B>" + (*it).description() + "</B>"; 187 msg += "<B>" + (*it).description() + "</B>";
184 // include location or not 188 if ( (*it).event().hasAlarm() )
185 if (SHOW_LOCATION == 1) 189 {
186 { 190 msg += " <b>[with alarm]</b>";
191 }
192 // include location or not
193 if (SHOW_LOCATION == 1)
194 {
187 msg+= "<BR>" + (*it).location(); 195 msg+= "<BR>" + (*it).location();
188 } 196 }
189 msg += "<BR>" 197 msg += "<BR>"
190 // start time of event 198 // start time of event
191 + TimeString::timeString(QTime((*it).event().start().time()) ) 199 + TimeString::timeString(QTime((*it).event().start().time()) )
192 // end time of event 200 // end time of event
193 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) 201 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) )
194 + "<BR>"; 202 + "<BR>";
195 // include possible note or not 203 // include possible note or not
196 if (SHOW_NOTES == 1) 204 if (SHOW_NOTES == 1)
197 { 205 {
198 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 206 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
199 } 207 }
@@ -201,6 +209,10 @@ void Today::getDates()
201 else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) 209 else if ((time.toString() <= TimeString::dateString((*it).event().end())) )
202 { 210 {
203 msg += "<B>" + (*it).description() + "</B>"; 211 msg += "<B>" + (*it).description() + "</B>";
212 if ( (*it).event().hasAlarm() )
213 {
214 msg += " <b>[with alarm]</b>";
215 }
204 // include location or not 216 // include location or not
205 if (SHOW_LOCATION == 1) 217 if (SHOW_LOCATION == 1)
206 { 218 {
@@ -230,7 +242,6 @@ void Today::getDates()
230 242
231/* 243/*
232 * Parse in the todolist.xml 244 * Parse in the todolist.xml
233 *
234 */ 245 */
235QList<TodoItem> Today::loadTodo(const char *filename) 246QList<TodoItem> Today::loadTodo(const char *filename)
236{ 247{
@@ -262,7 +273,8 @@ QList<TodoItem> Today::loadTodo(const char *filename)
262 completed = -1; 273 completed = -1;
263 while((attlist) && (attlist[j])) 274 while((attlist) && (attlist[j]))
264 { 275 {
265 if(!attlist[i]->name) continue; 276 // SEGFAULT HERE WITH MORE THAN 7 ENTRIES
277 if(!attlist[j]->name) continue;
266 if(!strcmp(attlist[j]->name, "Description")) 278 if(!strcmp(attlist[j]->name, "Description"))
267 { 279 {
268 description = attlist[j]->value; 280 description = attlist[j]->value;