summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-02-21 16:57:40 (UTC)
committer harlekin <harlekin>2002-02-21 16:57:40 (UTC)
commitec52599a5a9ca3397e6375b7aeb4ee391c614bfb (patch) (unidiff)
tree5570c7a511f7d089e410a5fecadb2fee0fb73d63
parent4c965fa187f642cb3db4cd32d70a68cfa8c41022 (diff)
downloadopie-ec52599a5a9ca3397e6375b7aeb4ee391c614bfb.zip
opie-ec52599a5a9ca3397e6375b7aeb4ee391c614bfb.tar.gz
opie-ec52599a5a9ca3397e6375b7aeb4ee391c614bfb.tar.bz2
all day detection, bumped to 0.2.6
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/TODO4
-rw-r--r--core/pim/today/changelog6
-rw-r--r--core/pim/today/opie-today.control2
-rw-r--r--core/pim/today/today.cpp43
-rw-r--r--core/pim/today/todaybase.cpp16
5 files changed, 39 insertions, 32 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO
index 95b9b51..5876e2b 100644
--- a/core/pim/today/TODO
+++ b/core/pim/today/TODO
@@ -1,17 +1,13 @@
1TODO for today: 1TODO for today:
2 2
3* start the app on "resume" 3* start the app on "resume"
4 4
5* show alarm icons on alarm events 5* show alarm icons on alarm events
6 6
7* problems with updating
8
9* add am/pm mode instead of 24 h, take system default 7* add am/pm mode instead of 24 h, take system default
10 8
11 * fix 23 pm bug (done??) 9 * fix 23 pm bug (done??)
12 10
13* scrollbar?
14
15* qcop integration for updating events? 11* qcop integration for updating events?
16 12
17* sort todos by pri. \ No newline at end of file 13* sort todos by pri. \ No newline at end of file
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index 3f99052..692c0dc 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1,39 +1,45 @@
10.2.6
2
3* added scrollbars to dates and todo
4* all day detection
5* some smaller bugfixes
6
10.2.5 70.2.5
2 8
3* some other minor fixes regarding autoupdate 9* some other minor fixes regarding autoupdate
4* fixed segfault with todolist > 7 entries 10* fixed segfault with todolist > 7 entries
5* fixed the "ugly grey border around buttons" issue 11* fixed the "ugly grey border around buttons" issue
6* fixed the "empty calendar field" "bug" 12* fixed the "empty calendar field" "bug"
7* shown only later appointments as option 13* shown only later appointments as option
8 14
9 15
100.2.4 160.2.4
11 17
12* added support for email 18* added support for email
13* autoupdates after 1 min 19* autoupdates after 1 min
14* QCopEnvelope instead of system() 20* QCopEnvelope instead of system()
15* starting to use qvbox in gui 21* starting to use qvbox in gui
16 22
17 23
180.2.3 240.2.3
19 25
20* the 4 am release 26* the 4 am release
21* several bugfixes 27* several bugfixes
22 28
23 29
240.2.2 300.2.2
25 31
26* started working on calling other apps 32* started working on calling other apps
27* and finished it 33* and finished it
28 34
290.2.1 350.2.1
30 36
31* images no more inline 37* images no more inline
32* config dialog 38* config dialog
33 39
340.1.1 400.1.1
35 41
36* started changelog. 42* started changelog.
37* fixed segfault on empty/nonexistant todolist.xml 43* fixed segfault on empty/nonexistant todolist.xml
38* better handling for file location 44* better handling for file location
39 45
diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control
index 72e8f2b..f16ddfb 100644
--- a/core/pim/today/opie-today.control
+++ b/core/pim/today/opie-today.control
@@ -1,10 +1,10 @@
1Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png 1Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Maximilian Reiß <max.reiss@gmx.de> 4Maintainer: Maximilian Reiß <max.reiss@gmx.de>
5Architecture: arm 5Architecture: arm
6Version: 0.2.5 6Version: 0.2.6
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8License: GPL 8License: GPL
9Description: today screen 9Description: today screen
10 A short overview over current appointments and tasks. 10 A short overview over current appointments and tasks.
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 9e5c27e..1f6f34e 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,409 +1,424 @@
1/* 1/*
2 * today.cpp : main class 2 * today.cpp : main class
3 * 3 *
4 * --------------------- 4 * ---------------------
5 * 5 *
6 * begin : Sun 10 17:20:00 CEST 2002 6 * begin : Sun 10 17:20:00 CEST 2002
7 * copyright : (c) 2002 by Maximilian Reiß 7 * copyright : (c) 2002 by Maximilian Reiß
8 * email : max.reiss@gmx.de 8 * email : max.reiss@gmx.de
9 * 9 *
10 */ 10 */
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19 19
20#include "today.h" 20#include "today.h"
21#include "minidom.h" 21#include "minidom.h"
22#include "TodoItem.h" 22#include "TodoItem.h"
23 23
24#include <qpe/datebookdb.h> 24#include <qpe/datebookdb.h>
25#include <qpe/timestring.h> 25#include <qpe/timestring.h>
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#include <qpe/resource.h>
30 30
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qtextstream.h> 34#include <qtextstream.h>
35#include <qcheckbox.h> 35#include <qcheckbox.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qtimer.h> 39#include <qtimer.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41 41
42//#include <iostream.h> 42//#include <iostream.h>
43//#include <unistd.h> 43//#include <unistd.h>
44#include <stdlib.h> 44#include <stdlib.h>
45 45
46int MAX_LINES_TASK; 46int MAX_LINES_TASK;
47int MAX_CHAR_CLIP; 47int MAX_CHAR_CLIP;
48int MAX_LINES_MEET; 48int MAX_LINES_MEET;
49int SHOW_LOCATION; 49int SHOW_LOCATION;
50int SHOW_NOTES; 50int SHOW_NOTES;
51// show only later dates 51// show only later dates
52int ONLY_LATER; 52int ONLY_LATER;
53/* 53/*
54 * Constructs a Example which is a child of 'parent', with the 54 * Constructs a Example which is a child of 'parent', with the
55 * name 'name' and widget flags set to 'f' 55 * name 'name' and widget flags set to 'f'
56 */ 56 */
57Today::Today( QWidget* parent, const char* name, WFlags fl ) 57Today::Today( QWidget* parent, const char* name, WFlags fl )
58 : TodayBase( parent, name, fl ) 58 : TodayBase( parent, name, fl )
59{ 59{
60 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 60 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
61 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 61 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
62 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 62 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
63 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); 63 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
64 64
65 draw(); 65 draw();
66} 66}
67 67
68 68
69void Today::draw() 69void Today::draw()
70{ 70{
71 init(); 71 init();
72 getDates(); 72 getDates();
73 getMail(); 73 getMail();
74 getTodo(); 74 getTodo();
75 // how often refresh 75 // how often refresh
76 QTimer::singleShot( 5*1000, this, SLOT(draw()) ); 76 QTimer::singleShot( 5*1000, this, SLOT(draw()) );
77 77
78} 78}
79 79
80void Today::init() 80void Today::init()
81{ 81{
82 QDate date = QDate::currentDate(); 82 QDate date = QDate::currentDate();
83 QString time = (date.toString()); 83 QString time = (date.toString());
84 84
85 TextLabel1->setText("<qt><font color=white>" +time + "<font></qt>"); 85 TextLabel1->setText("<qt><font color=white>" +time + "<font></qt>");
86 db = new DateBookDB; 86 db = new DateBookDB;
87 87
88 // read config 88 // read config
89 Config cfg("today"); 89 Config cfg("today");
90 cfg.setGroup("BaseConfig"); 90 cfg.setGroup("BaseConfig");
91 91
92 // how many lines should be showed in the task section 92 // how many lines should be showed in the task section
93 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); 93 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5);
94 // after how many chars should the be cut off on tasks and notes 94 // after how many chars should the be cut off on tasks and notes
95 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30); 95 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30);
96 // how many lines should be showed in the datebook section 96 // how many lines should be showed in the datebook section
97 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); 97 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5);
98 // If location is to be showed too, 1 to activate it. 98 // If location is to be showed too, 1 to activate it.
99 SHOW_LOCATION = cfg.readNumEntry("showlocation",1); 99 SHOW_LOCATION = cfg.readNumEntry("showlocation",1);
100 // if notes should be shown 100 // if notes should be shown
101 SHOW_NOTES = cfg.readNumEntry("shownotes",0); 101 SHOW_NOTES = cfg.readNumEntry("shownotes",0);
102 ONLY_LATER = cfg.readNumEntry("onlylater",1); 102 ONLY_LATER = cfg.readNumEntry("onlylater",1);
103 103
104} 104}
105 105
106void Today::startConfig() 106void Today::startConfig()
107{ 107{
108 conf = new todayconfig ( this, "", true ); 108 conf = new todayconfig ( this, "", true );
109 109
110 110
111 //Config cfg = new Config("today"); 111 //Config cfg = new Config("today");
112 112
113 // read the config 113 // read the config
114 Config cfg("today"); 114 Config cfg("today");
115 cfg.setGroup("BaseConfig"); 115 cfg.setGroup("BaseConfig");
116 116
117 //init(); 117 //init();
118 118
119 conf->SpinBox1->setValue(MAX_LINES_MEET); 119 conf->SpinBox1->setValue(MAX_LINES_MEET);
120 // location show box 120 // location show box
121 conf->CheckBox1->setChecked(SHOW_LOCATION); 121 conf->CheckBox1->setChecked(SHOW_LOCATION);
122 // notes show box 122 // notes show box
123 conf->CheckBox2->setChecked(SHOW_NOTES); 123 conf->CheckBox2->setChecked(SHOW_NOTES);
124 // task lines 124 // task lines
125 conf->SpinBox2->setValue(MAX_LINES_TASK); 125 conf->SpinBox2->setValue(MAX_LINES_TASK);
126 // clip when? 126 // clip when?
127 conf->SpinBox7->setValue(MAX_CHAR_CLIP); 127 conf->SpinBox7->setValue(MAX_CHAR_CLIP);
128 // only later 128 // only later
129 conf->CheckBox3->setChecked(ONLY_LATER); 129 conf->CheckBox3->setChecked(ONLY_LATER);
130 130
131 conf->exec(); 131 conf->exec();
132 132
133 int maxlinestask = conf->SpinBox2->value(); 133 int maxlinestask = conf->SpinBox2->value();
134 int maxmeet = conf->SpinBox1->value(); 134 int maxmeet = conf->SpinBox1->value();
135 int location = conf->CheckBox1->isChecked(); 135 int location = conf->CheckBox1->isChecked();
136 int notes = conf->CheckBox2->isChecked(); 136 int notes = conf->CheckBox2->isChecked();
137 int maxcharclip = conf->SpinBox7->value(); 137 int maxcharclip = conf->SpinBox7->value();
138 int onlylater = conf->CheckBox3->isChecked(); 138 int onlylater = conf->CheckBox3->isChecked();
139 139
140 cfg.writeEntry("maxlinestask",maxlinestask); 140 cfg.writeEntry("maxlinestask",maxlinestask);
141 cfg.writeEntry("maxcharclip", maxcharclip); 141 cfg.writeEntry("maxcharclip", maxcharclip);
142 cfg.writeEntry("maxlinesmeet",maxmeet); 142 cfg.writeEntry("maxlinesmeet",maxmeet);
143 cfg.writeEntry("showlocation",location); 143 cfg.writeEntry("showlocation",location);
144 cfg.writeEntry("shownotes", notes); 144 cfg.writeEntry("shownotes", notes);
145 cfg.writeEntry("onlylater", onlylater); 145 cfg.writeEntry("onlylater", onlylater);
146 // sync it to "disk" 146 // sync it to "disk"
147 cfg.write(); 147 cfg.write();
148 148
149 draw(); 149 draw();
150} 150}
151 151
152 152
153/* 153/*
154 * Get all events that are in the datebook xml file for today 154 * Get all events that are in the datebook xml file for today
155 */ 155 */
156void Today::getDates() 156void Today::getDates()
157{ 157{
158 QDate date = QDate::currentDate(); 158 QDate date = QDate::currentDate();
159 QTime time = QTime::currentTime(); 159 QTime time = QTime::currentTime();
160 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); 160 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
161 161
162 Config config( "qpe" ); 162 Config config( "qpe" );
163 // if 24 h format 163 // if 24 h format
164 //bool ampm = config.readBoolEntry( "AMPM", TRUE ); 164 //bool ampm = config.readBoolEntry( "AMPM", TRUE );
165 165
166 int count=0; 166 int count=0;
167 167
168 if ( list.count() > 0 ) { 168 if ( list.count() > 0 ) {
169 QString msg; 169 QString msg;
170 170
171 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 171 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
172 it!=list.end(); ++it ) { 172 it!=list.end(); ++it ) {
173 173
174 count++; 174 count++;
175 175
176 if ( count <= MAX_LINES_MEET ) 176 if ( count <= MAX_LINES_MEET )
177 { 177 {
178 //cout << time.toString() << endl; 178 //cout << time.toString() << endl;
179 //cout << TimeString::dateString((*it).event().end()) << endl; 179 //cout << TimeString::dateString((*it).event().end()) << endl;
180 180
181 // decide if to get all day or only later appointments 181 // decide if to get all day or only later appointments
182 if (!ONLY_LATER) 182 if (!ONLY_LATER)
183 { 183 {
184 msg += "<B>" + (*it).description() + "</B>"; 184 msg += "<B>" + (*it).description() + "</B>";
185 if ( (*it).event().hasAlarm() ) 185 if ( (*it).event().hasAlarm() )
186 { 186 {
187 msg += " <b>[with alarm]</b>"; 187 msg += " <b>[with alarm]</b>";
188 } 188 }
189 // include location or not 189 // include location or not
190 if (SHOW_LOCATION == 1) 190 if (SHOW_LOCATION == 1)
191 { 191 {
192 msg+= "<BR>" + (*it).location(); 192 msg+= "<BR><i>" + (*it).location();
193 } 193 }
194 msg += "<BR>" 194 msg += "</i><BR>";
195 195
196 // start time of event 196 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") )
197 + TimeString::timeString(QTime((*it).event().start().time()) ) 197 {
198 // end time of event 198 msg += "All day";
199 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) 199 }
200 + "<BR>"; 200 else
201 {
202 // start time of event
203 msg += TimeString::timeString(QTime((*it).event().start().time()) )
204 // end time of event
205 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
206 }
207 msg += "<BR>";
201 // include possible note or not 208 // include possible note or not
202 if (SHOW_NOTES == 1) 209 if (SHOW_NOTES == 1)
203 { 210 {
204 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 211 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
205 } 212 }
206 } 213 }
207 else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) 214 else if ((time.toString() <= TimeString::dateString((*it).event().end())) )
208 { 215 {
209 msg += "<B>" + (*it).description() + "</B>"; 216 msg += "<B>" + (*it).description() + "</B>";
210 if ( (*it).event().hasAlarm() ) 217 if ( (*it).event().hasAlarm() )
211 { 218 {
212 msg += " <b>[with alarm]</b>"; 219 msg += " <b>[with alarm]</b>";
213 } 220 }
214 // include location or not 221 // include location or not
215 if (SHOW_LOCATION == 1) 222 if (SHOW_LOCATION == 1)
216 { 223 {
217 msg+= "<BR>" + (*it).location(); 224 msg+= "<BR><i>" + (*it).location();
218 } 225 }
219 msg += "<BR>" 226 msg += "</i><BR>";
220 // start time of event 227
221 + TimeString::timeString(QTime((*it).event().start().time()) ) 228 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") )
222 // end time of event 229 {
223 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) 230 msg += "All day";
224 + "<BR>"; 231 }
232 else
233 {
234 // start time of event
235 msg += TimeString::timeString(QTime((*it).event().start().time()) )
236 // end time of event
237 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
238 }
239 msg += "<BR>";
225 // include possible note or not 240 // include possible note or not
226 if (SHOW_NOTES == 1) 241 if (SHOW_NOTES == 1)
227 { 242 {
228 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 243 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
229 } 244 }
230 } 245 }
231 } 246 }
232 } 247 }
233 if (msg.isEmpty()) 248 if (msg.isEmpty())
234 { 249 {
235 msg = "No more appointments today"; 250 msg = "No more appointments today";
236 } 251 }
237 DatesField->setText(msg); 252 DatesField->setText(msg);
238 } 253 }
239} 254}
240 255
241/* 256/*
242 * Parse in the todolist.xml 257 * Parse in the todolist.xml
243 */ 258 */
244QList<TodoItem> Today::loadTodo(const char *filename) 259QList<TodoItem> Today::loadTodo(const char *filename)
245{ 260{
246 DOM *todo; 261 DOM *todo;
247 ELE *tasks; 262 ELE *tasks;
248 ELE **tasklist; 263 ELE **tasklist;
249 ATT **attlist; 264 ATT **attlist;
250 int i, j; 265 int i, j;
251 char *description; 266 char *description;
252 int completed; 267 int completed;
253 int priority; 268 int priority;
254 TodoItem *tmp; 269 TodoItem *tmp;
255 QList<TodoItem> loadtodolist; 270 QList<TodoItem> loadtodolist;
256 271
257 todo = minidom_load(filename); 272 todo = minidom_load(filename);
258 273
259 tasks = todo->el; 274 tasks = todo->el;
260 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ 275 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/
261 if(tasks) 276 if(tasks)
262 { 277 {
263 tasklist = tasks->el; 278 tasklist = tasks->el;
264 i = 0; 279 i = 0;
265 while((tasklist) && (tasklist[i])) 280 while((tasklist) && (tasklist[i]))
266 { 281 {
267 attlist = tasklist[i]->at; 282 attlist = tasklist[i]->at;
268 j = 0; 283 j = 0;
269 description = NULL; 284 description = NULL;
270 priority = -1; 285 priority = -1;
271 completed = -1; 286 completed = -1;
272 while((attlist) && (attlist[j])) 287 while((attlist) && (attlist[j]))
273 { 288 {
274 // SEGFAULT HERE WITH MORE THAN 7 ENTRIES 289 // SEGFAULT HERE WITH MORE THAN 7 ENTRIES
275 if(!attlist[j]->name) continue; 290 if(!attlist[j]->name) continue;
276 if(!strcmp(attlist[j]->name, "Description")) 291 if(!strcmp(attlist[j]->name, "Description"))
277 { 292 {
278 description = attlist[j]->value; 293 description = attlist[j]->value;
279 } 294 }
280 // get Completed tag (0 or 1) 295 // get Completed tag (0 or 1)
281 if(!strcmp(attlist[j]->name, "Completed")) 296 if(!strcmp(attlist[j]->name, "Completed"))
282 { 297 {
283 QString s = attlist[j]->name; 298 QString s = attlist[j]->name;
284 if(s == "Completed") 299 if(s == "Completed")
285 { 300 {
286 completed = QString(attlist[j]->value).toInt(); 301 completed = QString(attlist[j]->value).toInt();
287 } 302 }
288 } 303 }
289 // get Priority (1 to 5) 304 // get Priority (1 to 5)
290 if(!strcmp(attlist[j]->name, "Priority")) 305 if(!strcmp(attlist[j]->name, "Priority"))
291 { 306 {
292 QString s = attlist[j]->name; 307 QString s = attlist[j]->name;
293 if(s == "Priority") 308 if(s == "Priority")
294 { 309 {
295 priority = QString(attlist[j]->value).toInt(); 310 priority = QString(attlist[j]->value).toInt();
296 } 311 }
297 } 312 }
298 j++; 313 j++;
299 } 314 }
300 if(description) 315 if(description)
301 { 316 {
302 tmp = new TodoItem(description, completed, priority); 317 tmp = new TodoItem(description, completed, priority);
303 loadtodolist.append(tmp); 318 loadtodolist.append(tmp);
304 } 319 }
305 i++; 320 i++;
306 } 321 }
307 } 322 }
308 323
309 minidom_free(todo); 324 minidom_free(todo);
310 325
311 return loadtodolist; 326 return loadtodolist;
312} 327}
313 328
314 329
315void Today::getMail() 330void Today::getMail()
316{ 331{
317 Config cfg("opiemail"); 332 Config cfg("opiemail");
318 cfg.setGroup("today"); 333 cfg.setGroup("today");
319 334
320 // how many lines should be showed in the task section 335 // how many lines should be showed in the task section
321 int NEW_MAILS = cfg.readNumEntry("newmails",0); 336 int NEW_MAILS = cfg.readNumEntry("newmails",0);
322 int OUTGOING = cfg.readNumEntry("outgoing",0); 337 int OUTGOING = cfg.readNumEntry("outgoing",0);
323 338
324 QString output = tr("<b>%1</b> new mails, <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 339 QString output = tr("<b>%1</b> new mails, <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
325 340
326 341
327 MailField->setText(output); 342 MailField->setText(output);
328} 343}
329 344
330 345
331/* 346/*
332 * Get the todos 347 * Get the todos
333 * 348 *
334 */ 349 */
335void Today::getTodo() 350void Today::getTodo()
336{ 351{
337 QString output; 352 QString output;
338 QString tmpout; 353 QString tmpout;
339 int count = 0; 354 int count = 0;
340 355
341 QDir dir; 356 QDir dir;
342 QString homedir = dir.homeDirPath (); 357 QString homedir = dir.homeDirPath ();
343 // see if todolist.xml does exist. 358 // see if todolist.xml does exist.
344 QFile f(homedir +"/Applications/todolist/todolist.xml"); 359 QFile f(homedir +"/Applications/todolist/todolist.xml");
345 if ( f.exists() ) 360 if ( f.exists() )
346 { 361 {
347 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); 362 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml");
348 363
349 TodoItem *item; 364 TodoItem *item;
350 for( item = todolist.first(); item; item = todolist.next()) 365 for( item = todolist.first(); item; item = todolist.next())
351 { 366 {
352 if (!(item->getCompleted() == 1) ) 367 if (!(item->getCompleted() == 1) )
353 { 368 {
354 count++; 369 count++;
355 if (count <= MAX_LINES_TASK) 370 if (count <= MAX_LINES_TASK)
356 { 371 {
357 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); 372 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
358 } 373 }
359 } 374 }
360 } 375 }
361 } 376 }
362 377
363 if (count > 0) 378 if (count > 0)
364 { 379 {
365 output = QString("There are <b> %1</b> active tasks: <br>").arg(count); 380 output = QString("There are <b> %1</b> active tasks: <br>").arg(count);
366 output += tmpout; 381 output += tmpout;
367 } 382 }
368 else 383 else
369 { 384 {
370 output = ("No active tasks"); 385 output = ("No active tasks");
371 } 386 }
372 387
373 TodoField->setText(output); 388 TodoField->setText(output);
374} 389}
375 390
376/* 391/*
377 * launches datebook 392 * launches datebook
378 */ 393 */
379void Today::startDatebook() 394void Today::startDatebook()
380{ 395{
381 QCopEnvelope e("QPE/System", "execute(QString)"); 396 QCopEnvelope e("QPE/System", "execute(QString)");
382 e << QString("datebook"); 397 e << QString("datebook");
383} 398}
384 399
385/* 400/*
386 * launches todolist 401 * launches todolist
387 */ 402 */
388void Today::startTodo() 403void Today::startTodo()
389{ 404{
390 QCopEnvelope e("QPE/System", "execute(QString)"); 405 QCopEnvelope e("QPE/System", "execute(QString)");
391 e << QString("todolist"); 406 e << QString("todolist");
392} 407}
393 408
394/* 409/*
395 * launch opiemail 410 * launch opiemail
396 */ 411 */
397void Today::startMail() 412void Today::startMail()
398{ 413{
399 QCopEnvelope e("QPE/System", "execute(QString)"); 414 QCopEnvelope e("QPE/System", "execute(QString)");
400 e << QString("opiemail"); 415 e << QString("opiemail");
401} 416}
402 417
403/* 418/*
404 * Destroys the object and frees any allocated resources 419 * Destroys the object and frees any allocated resources
405 */ 420 */
406Today::~Today() 421Today::~Today()
407{ 422{
408 // no need to delete child widgets, Qt does it all for us 423 // no need to delete child widgets, Qt does it all for us
409} 424}
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index ff6001a..5c1dc24 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -1,203 +1,193 @@
1/* 1/*
2 * todaybase.cpp * 2 * todaybase.cpp *
3 * --------------------- 3 * ---------------------
4 * 4 *
5 * begin : Sun 10 17:20:00 CEST 2002 5 * begin : Sun 10 17:20:00 CEST 2002
6 * copyright : (c) 2002 by Maximilian Reiß 6 * copyright : (c) 2002 by Maximilian Reiß
7 * email : max.reiss@gmx.de 7 * email : max.reiss@gmx.de
8 * 8 *
9 */ 9 */
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by * 13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "todaybase.h" 19#include "todaybase.h"
20 20
21#include <qframe.h> 21#include <qframe.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qvariant.h> 25#include <qvariant.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qimage.h> 28#include <qimage.h>
29#include <qpixmap.h> 29#include <qpixmap.h>
30#include <qscrollview.h> 30#include <qscrollview.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35 35
36/* 36/*
37 * Constructs a TodayBase which is a child of 'parent', with the 37 * Constructs a TodayBase which is a child of 'parent', with the
38 * name 'name' and widget flags set to 'f' 38 * name 'name' and widget flags set to 'f'
39 */ 39 */
40TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) 40TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
41 : QWidget( parent, name, fl ) 41 : QWidget( parent, name, fl )
42{ 42{
43 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo 43 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo
44 QPixmap datebook = Resource::loadPixmap("DateBook"); // datebook 44 QPixmap datebook = Resource::loadPixmap("DateBook"); // datebook
45 QPixmap todo = Resource::loadPixmap( "TodoList" ); // todo 45 QPixmap todo = Resource::loadPixmap( "TodoList" ); // todo
46 QPixmap config = Resource::loadPixmap( "today/config" ); // config icon 46 QPixmap config = Resource::loadPixmap( "today/config" ); // config icon
47 QPixmap mail = Resource::loadPixmap( "today/mail" ); // mail icon 47 QPixmap mail = Resource::loadPixmap( "today/mail" ); // mail icon
48 48
49 QPalette pal = this->palette(); 49 QPalette pal = this->palette();
50 QColor col = pal.color(QPalette::Active, QColorGroup::Background); 50 QColor col = pal.color(QPalette::Active, QColorGroup::Background);
51 pal.setColor(QPalette::Active, QColorGroup::Button, col); 51 pal.setColor(QPalette::Active, QColorGroup::Button, col);
52 this->setPalette(pal); 52 this->setPalette(pal);
53 53
54 QWidget *d = QApplication::desktop(); 54 QWidget *d = QApplication::desktop();
55 int w=d->width(); 55 int w=d->width();
56 int h=d->height(); 56 int h=d->height();
57 resize( w , h ); // not good, what happens on rotation 57 resize( w , h );
58 58
59 // hehe, qt is ... 59 // hehe, qt is ...
60 getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" ); 60 getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" );
61 getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) ); 61 getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) );
62 62
63
64
65 QVBoxLayout * layout = new QVBoxLayout(this); 63 QVBoxLayout * layout = new QVBoxLayout(this);
66
67
68 64
69 // --- logo Section --- 65 // --- logo Section ---
70 QPalette pal2; 66 QPalette pal2;
71 QColorGroup cg; 67 QColorGroup cg;
72 cg.setColor( QColorGroup::Text, white ); 68 cg.setColor( QColorGroup::Text, white );
73 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) ); 69 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) );
74 pal2.setActive( cg ); 70 pal2.setActive( cg );
75 // today logo 71 // today logo
76 Frame = new QLabel( this, "Frame" ); 72 Frame = new QLabel( this, "Frame" );
77 Frame->setPalette( pal2 ); 73 Frame->setPalette( pal2 );
78 Frame->setFrameShape( QFrame::StyledPanel ); 74 Frame->setFrameShape( QFrame::StyledPanel );
79 Frame->setFrameShadow( QFrame::Raised ); 75 Frame->setFrameShadow( QFrame::Raised );
80 Frame->setLineWidth( 0 ); 76 Frame->setLineWidth( 0 );
81 Frame->setMaximumHeight(50); 77 Frame->setMaximumHeight(50);
82 Frame->setMinimumHeight(50); 78 Frame->setMinimumHeight(50);
83 // date 79 // date
84 TextLabel1 = new QLabel( Frame, "TextLabel1" ); 80 TextLabel1 = new QLabel( Frame, "TextLabel1" );
85 TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) ); 81 TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) );
86 QFont TextLabel1_font( TextLabel1->font() ); 82 QFont TextLabel1_font( TextLabel1->font() );
87 TextLabel1_font.setBold( TRUE ); 83 TextLabel1_font.setBold( TRUE );
88 TextLabel1->setFont( TextLabel1_font ); 84 TextLabel1->setFont( TextLabel1_font );
89 TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin ); 85 TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin );
90 TextLabel1->setTextFormat( RichText ); 86 TextLabel1->setTextFormat( RichText );
91 87
92 88
93 // --- dates section --- 89 // --- dates section ---
94 Frame4 = new QFrame( this, "Frame4" ); 90 Frame4 = new QFrame( this, "Frame4" );
95 Frame4->setPalette( pal ); 91 Frame4->setPalette( pal );
96 Frame4->setFrameShape( QScrollView::StyledPanel ); 92 Frame4->setFrameShape( QScrollView::StyledPanel );
97 Frame4->setFrameShadow( QScrollView::Sunken ); 93 Frame4->setFrameShadow( QScrollView::Sunken );
98 Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); 94 Frame4->setBackgroundOrigin( QScrollView::ParentOrigin );
99 Frame4->setFrameStyle( QFrame::NoFrame ); 95 Frame4->setFrameStyle( QFrame::NoFrame );
100 Frame4->setGeometry (QRect( 0, 0, this->width() , this->height()) ); 96 Frame4->setGeometry (QRect( 0, 0, this->width() , this->height()) );
101 97
102 QScrollView* sv1 = new QScrollView( Frame4 ); 98 QScrollView* sv1 = new QScrollView( Frame4 );
103 sv1->setResizePolicy(QScrollView::AutoOneFit); 99 sv1->setResizePolicy(QScrollView::AutoOneFit);
104 sv1->setHScrollBarMode( QScrollView::AlwaysOff ); 100 sv1->setHScrollBarMode( QScrollView::AlwaysOff );
105 // need to find a better way!!! 101 // need to find a better way!!!
106 sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) ); 102 sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) );
107 sv1->setFrameShape(QFrame::NoFrame); 103 sv1->setFrameShape(QFrame::NoFrame);
108 104
109 DatesButton = new QPushButton (Frame4, "DatesButton" ); 105 DatesButton = new QPushButton (Frame4, "DatesButton" );
110 DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); 106 DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) );
111 DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); 107 DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin );
112 DatesButton->setPalette( pal ); 108 DatesButton->setPalette( pal );
113 DatesButton->setPixmap( datebook ); 109 DatesButton->setPixmap( datebook );
114 DatesButton->setFlat( TRUE ); 110 DatesButton->setFlat( TRUE );
115 111
116 DatesField = new QLabel( sv1->viewport(), "DatesField" ); 112 DatesField = new QLabel( sv1->viewport(), "DatesField" );
117 sv1->addChild(DatesField); 113 sv1->addChild(DatesField);
118 DatesField->setText( tr( "No appointments today" ) ); 114 DatesField->setText( tr( "No appointments today" ) );
119 DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); 115 DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
120 116
121 117
122 // --- mail section --- 118 // --- mail section ---
123 MailFrame = new QFrame( this ,"MailFrame" ); 119 MailFrame = new QFrame( this ,"MailFrame" );
124 //MailFrame->setPalette( pal );
125 MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin ); 120 MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin );
126 //MailFrame->setFrameShape( QScrollView::StyledPanel );
127 //MailFrame->setFrameShadow( QScrollView::Sunken );
128 MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) ); 121 MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) );
129 MailFrame->setFrameStyle( QFrame::NoFrame ); 122 MailFrame->setFrameStyle( QFrame::NoFrame );
130 123
131 QFrame* Line1 = new QFrame( MailFrame); 124 QFrame* Line1 = new QFrame( MailFrame);
132 Line1->setGeometry( QRect( 0, 0, MailFrame->width(), 5 ) ); 125 Line1->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) );
133 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 126 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
134 127
135 MailButton = new QPushButton (MailFrame, "MailButton" ); 128 MailButton = new QPushButton (MailFrame, "MailButton" );
136 MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); 129 MailButton->setGeometry( QRect( 2, 3, 36, 19 ) );
137 MailButton->setPalette( pal ); 130 MailButton->setPalette( pal );
138 MailButton->setPixmap( mail ); 131 MailButton->setPixmap( mail );
139 MailButton->setFlat( TRUE ); 132 MailButton->setFlat( TRUE );
140 133
141 MailField = new QLabel( MailFrame, "MailField" ); 134 MailField = new QLabel( MailFrame, "MailField" );
142 MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) ); 135 MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) );
143 MailField->setText( tr( "Opiemail not installed" ) ); 136 MailField->setText( tr( "Opiemail not installed" ) );
144 MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); 137 MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
145 MailField->setMaximumHeight(40); 138 MailField->setMaximumHeight(40);
146 MailField->setMinimumHeight(15); 139 MailField->setMinimumHeight(15);
147 140
148 141
149 // --- todo section -- 142 // --- todo section --
150 Frame15 = new QFrame( this, "Frame15" ); 143 Frame15 = new QFrame( this, "Frame15" );
151 //Frame15->setFrameShape( QFrame::StyledPanel );
152 //Frame15->setFrameShadow( QFrame::Sunken );
153 Frame15->setFrameStyle( QFrame::NoFrame ); 144 Frame15->setFrameStyle( QFrame::NoFrame );
154 Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) ); 145 Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) );
155 146
156 QFrame* Line2 = new QFrame( Frame15); 147 QFrame* Line2 = new QFrame( Frame15);
157 Line2->setGeometry( QRect( 0, 0, MailFrame->width(), 5 ) ); 148 Line2->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) );
158 Line2->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 149 Line2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
159 150
160 TodoButton = new QPushButton (Frame15, "TodoButton" ); 151 TodoButton = new QPushButton (Frame15, "TodoButton" );
161 TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) ); 152 TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) );
162 TodoButton->setPalette( pal ); 153 TodoButton->setPalette( pal );
163 TodoButton->setPixmap( todo ); 154 TodoButton->setPixmap( todo );
164 TodoButton->setFlat( TRUE ); 155 TodoButton->setFlat( TRUE );
165 156
166 QScrollView* sv2 = new QScrollView( Frame15 ); 157 QScrollView* sv2 = new QScrollView( Frame15 );
167 sv2->setResizePolicy(QScrollView::AutoOneFit); 158 sv2->setResizePolicy(QScrollView::AutoOneFit);
168 sv2->setHScrollBarMode( QScrollView::AlwaysOff ); 159 sv2->setHScrollBarMode( QScrollView::AlwaysOff );
169 sv2->setGeometry (QRect( 40, 3, Frame15->width()-40 , (Frame15->height()/3) ) ); 160 sv2->setGeometry (QRect( 40, 3, Frame15->width()-40 , (Frame15->height()/3) ) );
170 sv2->setFrameShape(QFrame::NoFrame); 161 sv2->setFrameShape(QFrame::NoFrame);
171 162
172 TodoField = new QLabel( sv2->viewport(), "TodoField" ); 163 TodoField = new QLabel( sv2->viewport(), "TodoField" );
173 sv2->addChild(TodoField); 164 sv2->addChild(TodoField);
174 //TodoField->setGeometry( QRect( 40, 4, 196, 120 ) );
175 TodoField->setFrameShadow( QLabel::Plain ); 165 TodoField->setFrameShadow( QLabel::Plain );
176 //TodoField->setText( tr( "No current todos" ) ); 166 //TodoField->setText( tr( "No current todos" ) );
177 TodoField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); 167 TodoField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
178 168
179 PushButton1 = new QPushButton (Frame15, "PushButton1" ); 169 PushButton1 = new QPushButton (Frame15, "PushButton1" );
180 PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) ); 170 PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) );
181 PushButton1->setPixmap( config ); 171 PushButton1->setPixmap( config );
182 PushButton1->setPalette( pal ); 172 PushButton1->setPalette( pal );
183 PushButton1->setAutoDefault( TRUE ); 173 PushButton1->setAutoDefault( TRUE );
184 PushButton1->setFlat( TRUE ); 174 PushButton1->setFlat( TRUE );
185 175
186 // -- layout -- 176 // -- layout --
187 layout->addWidget(Frame); 177 layout->addWidget(Frame);
188 layout->addWidget(Frame4); 178 layout->addWidget(Frame4);
189 layout->addWidget(MailFrame); 179 layout->addWidget(MailFrame);
190 layout->addWidget(Frame15); 180 layout->addWidget(Frame15);
191 181
192 layout->setStretchFactor(Frame4,5); 182 layout->setStretchFactor(Frame4,5);
193 layout->setStretchFactor(MailFrame,1); 183 layout->setStretchFactor(MailFrame,1);
194 layout->setStretchFactor(Frame15,4); 184 layout->setStretchFactor(Frame15,4);
195} 185}
196 186
197/* 187/*
198 * Destroys the object and frees any allocated resources 188 * Destroys the object and frees any allocated resources
199 */ 189 */
200TodayBase::~TodayBase() 190TodayBase::~TodayBase()
201{ 191{
202} 192}
203 193