summaryrefslogtreecommitdiff
path: root/core
authorharlekin <harlekin>2002-03-05 22:23:54 (UTC)
committer harlekin <harlekin>2002-03-05 22:23:54 (UTC)
commitc84da23a6ff2a8ff51b4da70f83b261f1e548be1 (patch) (unidiff)
tree4d87cf43f7b9c48765b4879e4ee5c6e9ca5841b3 /core
parent3ccfa79645d8bd99c7b559f9fa315d028db2c75d (diff)
downloadopie-c84da23a6ff2a8ff51b4da70f83b261f1e548be1.zip
opie-c84da23a6ff2a8ff51b4da70f83b261f1e548be1.tar.gz
opie-c84da23a6ff2a8ff51b4da70f83b261f1e548be1.tar.bz2
cosmetic changes on request from zecke
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp294
1 files changed, 127 insertions, 167 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index c63a9ef..6a0e9fc 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -57,4 +57,3 @@ int ONLY_LATER;
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{
60 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 59 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
@@ -68,4 +67,3 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
68 67
69void Today::draw() 68void Today::draw() {
70{
71 init(); 69 init();
@@ -76,7 +74,5 @@ void Today::draw()
76 QTimer::singleShot( 5*1000, this, SLOT(draw()) ); 74 QTimer::singleShot( 5*1000, this, SLOT(draw()) );
77
78} 75}
79 76
80void Today::init() 77void Today::init() {
81{
82 QDate date = QDate::currentDate(); 78 QDate date = QDate::currentDate();
@@ -105,4 +101,3 @@ void Today::init()
105 101
106void Today::startConfig() 102void Today::startConfig() {
107{
108 conf = new todayconfig ( this, "", true ); 103 conf = new todayconfig ( this, "", true );
@@ -155,4 +150,3 @@ void Today::startConfig()
155 */ 150 */
156void Today::getDates() 151void Today::getDates() {
157{
158 QDate date = QDate::currentDate(); 152 QDate date = QDate::currentDate();
@@ -175,78 +169,61 @@ void Today::getDates()
175 169
176 if ( count <= MAX_LINES_MEET ) 170 if ( count <= MAX_LINES_MEET ) {
177 { 171 //cout << time.toString() << endl;
178 //cout << time.toString() << endl; 172 //cout << TimeString::dateString((*it).event().end()) << endl;
179 //cout << TimeString::dateString((*it).event().end()) << endl; 173
174 // decide if to get all day or only later appointments
175 if (!ONLY_LATER) {
176 msg += "<B>" + (*it).description() + "</B>";
177 if ( (*it).event().hasAlarm() ) {
178 msg += " <b>[with alarm]</b>";
179 }
180 // include location or not
181 if (SHOW_LOCATION == 1) {
182 msg += "<BR><i>" + (*it).location();
183 msg += "</i>";
184 }
185
186 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
187 msg += "<br>All day";
188 } else {
189 // start time of event
190 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
191 // end time of event
192 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
193 }
194 msg += "<BR>";
195 // include possible note or not
196 if (SHOW_NOTES == 1) {
197 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
198 }
199 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) {
200 msg += "<B>" + (*it).description() + "</B>";
201 if ( (*it).event().hasAlarm() ) {
202 msg += " <b>[with alarm]</b>";
203 }
204 // include location or not
205 if (SHOW_LOCATION == 1) {
206 msg+= "<BR><i>" + (*it).location();
207 msg += "</i>";
208 }
180 209
181 // decide if to get all day or only later appointments 210 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
182 if (!ONLY_LATER) 211 msg += "<br>All day";
183 { 212 } else {
184 msg += "<B>" + (*it).description() + "</B>"; 213 // start time of event
185 if ( (*it).event().hasAlarm() ) 214 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
186 { 215 // end time of event
187 msg += " <b>[with alarm]</b>"; 216 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
188 } 217 }
189 // include location or not 218 msg += "<BR>";
190 if (SHOW_LOCATION == 1) 219 // include possible note or not
191 { 220 if (SHOW_NOTES == 1) {
192 msg += "<BR><i>" + (*it).location(); 221 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
193 msg += "</i>"; 222 }
194 }
195
196 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") )
197 {
198 msg += "<br>All day";
199 }
200 else
201 {
202 // start time of event
203 msg += "<br>" + 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>";
208 // include possible note or not
209 if (SHOW_NOTES == 1)
210 {
211 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
212 }
213 }
214 else if ((time.toString() <= TimeString::dateString((*it).event().end())) )
215 {
216 msg += "<B>" + (*it).description() + "</B>";
217 if ( (*it).event().hasAlarm() )
218 {
219 msg += " <b>[with alarm]</b>";
220 }
221 // include location or not
222 if (SHOW_LOCATION == 1)
223 {
224 msg+= "<BR><i>" + (*it).location();
225 msg += "</i>";
226 }
227
228 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") )
229 {
230 msg += "<br>All day";
231 }
232 else
233 {
234 // start time of event
235 msg += "<br>" + 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>";
240 // include possible note or not
241 if (SHOW_NOTES == 1)
242 {
243 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
244 }
245 }
246 } 223 }
247 }
248 if (msg.isEmpty())
249 {
250 msg = "No more appointments today";
251 } 224 }
225 }
226 if (msg.isEmpty()) {
227 msg = "No more appointments today";
228 }
252 DatesField->setText(msg); 229 DatesField->setText(msg);
@@ -258,4 +235,3 @@ void Today::getDates()
258 */ 235 */
259QList<TodoItem> Today::loadTodo(const char *filename) 236QList<TodoItem> Today::loadTodo(const char *filename) {
260{
261 DOM *todo; 237 DOM *todo;
@@ -275,50 +251,42 @@ QList<TodoItem> Today::loadTodo(const char *filename)
275 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ 251 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/
276 if(tasks) 252 if(tasks) {
277 { 253 tasklist = tasks->el;
278 tasklist = tasks->el; 254 i = 0;
279 i = 0; 255 while((tasklist) && (tasklist[i])) {
280 while((tasklist) && (tasklist[i])) 256 attlist = tasklist[i]->at;
281 { 257 j = 0;
282 attlist = tasklist[i]->at; 258 description = NULL;
283 j = 0; 259 priority = -1;
284 description = NULL; 260 completed = -1;
285 priority = -1; 261 while((attlist) && (attlist[j])) {
286 completed = -1; 262 if(!attlist[j]->name) {
287 while((attlist) && (attlist[j])) 263 continue;
288 {
289 // SEGFAULT HERE WITH MORE THAN 7 ENTRIES
290 if(!attlist[j]->name) continue;
291 if(!strcmp(attlist[j]->name, "Description"))
292 {
293 description = attlist[j]->value;
294 }
295 // get Completed tag (0 or 1)
296 if(!strcmp(attlist[j]->name, "Completed"))
297 {
298 QString s = attlist[j]->name;
299 if(s == "Completed")
300 {
301 completed = QString(attlist[j]->value).toInt();
302 }
303 }
304 // get Priority (1 to 5)
305 if(!strcmp(attlist[j]->name, "Priority"))
306 {
307 QString s = attlist[j]->name;
308 if(s == "Priority")
309 {
310 priority = QString(attlist[j]->value).toInt();
311 }
312 }
313 j++;
314 }
315 if(description)
316 {
317 tmp = new TodoItem(description, completed, priority);
318 loadtodolist.append(tmp);
319 }
320 i++;
321 } 264 }
265 if(!strcmp(attlist[j]->name, "Description")) {
266 description = attlist[j]->value;
267 }
268 // get Completed tag (0 or 1)
269 if(!strcmp(attlist[j]->name, "Completed")) {
270 QString s = attlist[j]->name;
271 if(s == "Completed") {
272 completed = QString(attlist[j]->value).toInt();
273 }
274 }
275 // get Priority (1 to 5)
276 if(!strcmp(attlist[j]->name, "Priority")) {
277 QString s = attlist[j]->name;
278 if(s == "Priority") {
279 priority = QString(attlist[j]->value).toInt();
280 }
281 }
282 j++;
283 }
284 if(description) {
285 tmp = new TodoItem(description, completed, priority);
286 loadtodolist.append(tmp);
287 }
288 i++;
322 } 289 }
323 290 }
291
324 minidom_free(todo); 292 minidom_free(todo);
@@ -329,4 +297,3 @@ QList<TodoItem> Today::loadTodo(const char *filename)
329 297
330void Today::getMail() 298void Today::getMail() {
331{
332 Config cfg("opiemail"); 299 Config cfg("opiemail");
@@ -338,3 +305,4 @@ void Today::getMail()
338 305
339 QString output = tr("<b>%1</b> new mails, <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 306
307 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
340 308
@@ -349,4 +317,3 @@ void Today::getMail()
349 */ 317 */
350void Today::getTodo() 318void Today::getTodo() {
351{
352 QString output; 319 QString output;
@@ -359,29 +326,26 @@ void Today::getTodo()
359 QFile f(homedir +"/Applications/todolist/todolist.xml"); 326 QFile f(homedir +"/Applications/todolist/todolist.xml");
360 if ( f.exists() ) 327 if ( f.exists() ) {
361 { 328 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml");
362 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); 329
363 330 TodoItem *item;
364 TodoItem *item; 331 for( item = todolist.first(); item; item = todolist.next()) {
365 for( item = todolist.first(); item; item = todolist.next()) 332 if (!(item->getCompleted() == 1) ) {
366 { 333 count++;
367 if (!(item->getCompleted() == 1) ) 334 if (count <= MAX_LINES_TASK) {
368 { 335 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
369 count++;
370 if (count <= MAX_LINES_TASK)
371 {
372 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
373 }
374 }
375 } 336 }
337 }
376 } 338 }
339 }
377 340
378 if (count > 0) 341 if (count > 0) {
379 { 342 if( count == 1 ) {
343 output = QString("There is <b> 1</b> active task: <br>" );
344 } else {
380 output = QString("There are <b> %1</b> active tasks: <br>").arg(count); 345 output = QString("There are <b> %1</b> active tasks: <br>").arg(count);
381 output += tmpout;
382 }
383 else
384 {
385 output = ("No active tasks");
386 } 346 }
347 output += tmpout;
348 } else {
349 output = ("No active tasks");
350 }
387 351
@@ -393,4 +357,3 @@ void Today::getTodo()
393 */ 357 */
394void Today::startDatebook() 358void Today::startDatebook() {
395{
396 QCopEnvelope e("QPE/System", "execute(QString)"); 359 QCopEnvelope e("QPE/System", "execute(QString)");
@@ -402,4 +365,3 @@ void Today::startDatebook()
402 */ 365 */
403void Today::startTodo() 366void Today::startTodo() {
404{
405 QCopEnvelope e("QPE/System", "execute(QString)"); 367 QCopEnvelope e("QPE/System", "execute(QString)");
@@ -411,4 +373,3 @@ void Today::startTodo()
411 */ 373 */
412void Today::startMail() 374void Today::startMail() {
413{
414 QCopEnvelope e("QPE/System", "execute(QString)"); 375 QCopEnvelope e("QPE/System", "execute(QString)");
@@ -420,4 +381,3 @@ void Today::startMail()
420 */ 381 */
421Today::~Today() 382Today::~Today() {
422{
423 // no need to delete child widgets, Qt does it all for us 383 // no need to delete child widgets, Qt does it all for us