summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-02-16 13:47:42 (UTC)
committer harlekin <harlekin>2002-02-16 13:47:42 (UTC)
commit992d35bb675392922fe1971cb24d76acd3a63747 (patch) (unidiff)
treef67ae67aebcfcba77b8198a4e5be25b3c2f15eec
parentf866bbd2fd77f07cff04a702eb52e59fcc0013b7 (diff)
downloadopie-992d35bb675392922fe1971cb24d76acd3a63747.zip
opie-992d35bb675392922fe1971cb24d76acd3a63747.tar.gz
opie-992d35bb675392922fe1971cb24d76acd3a63747.tar.bz2
QCopEnvelope instead of system()
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 381ae6b..00a8842 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,61 +1,61 @@
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 <qpushbutton.h>
25#include <qlabel.h>
26
27#include <qpe/datebookdb.h> 24#include <qpe/datebookdb.h>
28#include <qpe/timestring.h> 25#include <qpe/timestring.h>
29#include <qpe/config.h> 26#include <qpe/config.h>
30 27#include <qpe/qcopenvelope_qws.h>
31#include <qpe/qprocess.h> 28#include <qpe/qprocess.h>
29
32#include <qdir.h> 30#include <qdir.h>
33#include <qfile.h> 31#include <qfile.h>
34#include <qdatetime.h> 32#include <qdatetime.h>
35#include <qtextstream.h> 33#include <qtextstream.h>
36#include <qcheckbox.h> 34#include <qcheckbox.h>
37#include <qspinbox.h> 35#include <qspinbox.h>
36#include <qpushbutton.h>
37#include <qlabel.h>
38 38
39//#include <iostream.h> 39//#include <iostream.h>
40//#include <unistd.h> 40//#include <unistd.h>
41#include <stdlib.h> 41#include <stdlib.h>
42 42
43int MAX_LINES_TASK; 43int MAX_LINES_TASK;
44int MAX_CHAR_CLIP; 44int MAX_CHAR_CLIP;
45int MAX_LINES_MEET; 45int MAX_LINES_MEET;
46int SHOW_LOCATION; 46int SHOW_LOCATION;
47int SHOW_NOTES; 47int SHOW_NOTES;
48// show only later dates 48// show only later dates
49int ONLY_LATER = 1; 49int ONLY_LATER = 1;
50/* 50/*
51 * Constructs a Example which is a child of 'parent', with the 51 * Constructs a Example which is a child of 'parent', with the
52 * name 'name' and widget flags set to 'f' 52 * name 'name' and widget flags set to 'f'
53 */ 53 */
54Today::Today( QWidget* parent, const char* name, WFlags fl ) 54Today::Today( QWidget* parent, const char* name, WFlags fl )
55 : TodayBase( parent, name, fl ) 55 : TodayBase( parent, name, fl )
56{ 56{
57 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 57 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
58 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 58 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
59 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 59 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
60 60
61 QDate date = QDate::currentDate(); 61 QDate date = QDate::currentDate();
@@ -168,50 +168,50 @@ void Today::getDates()
168 // include location or not 168 // include location or not
169 if (SHOW_LOCATION == 1) 169 if (SHOW_LOCATION == 1)
170 { 170 {
171 msg+= "<BR>" + (*it).location(); 171 msg+= "<BR>" + (*it).location();
172 } 172 }
173 msg += "<BR>" 173 msg += "<BR>"
174 // start time of event 174 // start time of event
175 + TimeString::timeString(QTime((*it).event().start().time()) ) 175 + TimeString::timeString(QTime((*it).event().start().time()) )
176 // end time of event 176 // end time of event
177 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) 177 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) )
178 + "<BR>"; 178 + "<BR>";
179 // include possible note or not 179 // include possible note or not
180 if (SHOW_NOTES == 1) 180 if (SHOW_NOTES == 1)
181 { 181 {
182 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 182 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
183 } 183 }
184 } 184 }
185 } 185 }
186 } 186 }
187 DatesField->setText(msg); 187 DatesField->setText(msg);
188 } 188 }
189} 189}
190 190
191/* 191/*
192 * 192 * Parse in the todolist.xml
193 * 193 *
194 */ 194 */
195QList<TodoItem> Today::loadTodo(const char *filename) 195QList<TodoItem> Today::loadTodo(const char *filename)
196{ 196{
197 DOM *todo; 197 DOM *todo;
198 ELE *tasks; 198 ELE *tasks;
199 ELE **tasklist; 199 ELE **tasklist;
200 ATT **attlist; 200 ATT **attlist;
201 int i, j; 201 int i, j;
202 char *description; 202 char *description;
203 int completed; 203 int completed;
204 int priority; 204 int priority;
205 TodoItem *tmp; 205 TodoItem *tmp;
206 QList<TodoItem> loadtodolist; 206 QList<TodoItem> loadtodolist;
207 207
208 todo = minidom_load(filename); 208 todo = minidom_load(filename);
209 209
210 tasks = todo->el; 210 tasks = todo->el;
211 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ 211 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/
212 if(tasks) 212 if(tasks)
213 { 213 {
214 tasklist = tasks->el; 214 tasklist = tasks->el;
215 i = 0; 215 i = 0;
216 while((tasklist) && (tasklist[i])) 216 while((tasklist) && (tasklist[i]))
217 { 217 {
@@ -290,46 +290,45 @@ void Today::getTodo()
290 { 290 {
291 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); 291 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
292 } 292 }
293 } 293 }
294 } 294 }
295 } 295 }
296 296
297 if (count > 0) 297 if (count > 0)
298 { 298 {
299 output = QString("There are <b> %1</b> active tasks: <br>").arg(count); 299 output = QString("There are <b> %1</b> active tasks: <br>").arg(count);
300 output += tmpout; 300 output += tmpout;
301 } 301 }
302 else 302 else
303 { 303 {
304 output = ("No active tasks"); 304 output = ("No active tasks");
305 } 305 }
306 306
307 TodoField->setText(output); 307 TodoField->setText(output);
308} 308}
309 309
310/* 310/*
311 * lanches datebook 311 * lanches datebook
312 */ 312 */
313void Today::startDatebook() 313void Today::startDatebook()
314{ 314{
315 //ugly but working 315 QCopEnvelope e("QPE/System", "execute(QString)");
316 system("/opt/QtPalmtop/bin/datebook"); 316 e << QString("datebook");
317} 317}
318 318
319/* 319/*
320 * lanches todolist 320 * lanches todolist
321 */ 321 */
322void Today::startTodo() 322void Today::startTodo()
323{ 323{
324 // QProcess *datelanch = new QProcess( this, "datebook"); 324 QCopEnvelope e("QPE/System", "execute(QString)");
325 //datelanch->start(); 325 e << QString("todolist");
326 system("/opt/QtPalmtop/bin/todolist");
327} 326}
328 327
329/* 328/*
330 * Destroys the object and frees any allocated resources 329 * Destroys the object and frees any allocated resources
331 */ 330 */
332Today::~Today() 331Today::~Today()
333{ 332{
334 // no need to delete child widgets, Qt does it all for us 333 // no need to delete child widgets, Qt does it all for us
335} 334}