summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp41
-rw-r--r--core/pim/today/today.h1
-rw-r--r--core/pim/today/todayconfig.cpp14
-rw-r--r--core/pim/today/todayconfig.h2
4 files changed, 48 insertions, 10 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 6a0e9fc..0fa7ad5 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,384 +1,407 @@
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;
53int AUTOSTART;
53/* 54/*
54 * Constructs a Example which is a child of 'parent', with the 55 * Constructs a Example which is a child of 'parent', with the
55 * name 'name' and widget flags set to 'f' 56 * name 'name' and widget flags set to 'f'
56 */ 57 */
57Today::Today( QWidget* parent, const char* name, WFlags fl ) 58Today::Today( QWidget* parent, const char* name, WFlags fl )
58 : TodayBase( parent, name, fl ) { 59 : TodayBase( parent, name, fl ) {
59 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 60 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
60 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 61 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
61 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 62 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
62 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); 63 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
63 64
65
66 autoStart();
64 draw(); 67 draw();
65} 68}
66 69
67 70
71void Today::autoStart() {
72 Config cfg("today");
73 cfg.setGroup("Autostart");
74 AUTOSTART = cfg.readNumEntry("autostart",1);
75 if (AUTOSTART) {
76 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
77 e << QString("add");
78 e << QString("today");
79 } else {
80 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
81 e << QString("remove");
82 e << QString("today");
83 }
84}
85
68void Today::draw() { 86void Today::draw() {
69 init(); 87 init();
70 getDates(); 88 getDates();
71 getMail(); 89 getMail();
72 getTodo(); 90 getTodo();
73 // how often refresh 91 // how often refresh
74 QTimer::singleShot( 5*1000, this, SLOT(draw()) ); 92 QTimer::singleShot( 5*1000, this, SLOT(draw()) );
75} 93}
76 94
77void Today::init() { 95void Today::init() {
78 QDate date = QDate::currentDate(); 96 QDate date = QDate::currentDate();
79 QString time = (date.toString()); 97 QString time = (tr( date.toString() ), white);
80 98
81 TextLabel1->setText("<qt><font color=white>" +time + "<font></qt>"); 99 TextLabel1->setText(time);
82 db = new DateBookDB; 100 db = new DateBookDB;
83 101
84 // read config 102 // read config
85 Config cfg("today"); 103 Config cfg("today");
86 cfg.setGroup("BaseConfig"); 104 cfg.setGroup("BaseConfig");
87 105
88 // how many lines should be showed in the task section 106 // how many lines should be showed in the task section
89 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); 107 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5);
90 // after how many chars should the be cut off on tasks and notes 108 // after how many chars should the be cut off on tasks and notes
91 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30); 109 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30);
92 // how many lines should be showed in the datebook section 110 // how many lines should be showed in the datebook section
93 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); 111 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5);
94 // If location is to be showed too, 1 to activate it. 112 // If location is to be showed too, 1 to activate it.
95 SHOW_LOCATION = cfg.readNumEntry("showlocation",1); 113 SHOW_LOCATION = cfg.readNumEntry("showlocation",1);
96 // if notes should be shown 114 // if notes should be shown
97 SHOW_NOTES = cfg.readNumEntry("shownotes",0); 115 SHOW_NOTES = cfg.readNumEntry("shownotes",0);
98 ONLY_LATER = cfg.readNumEntry("onlylater",1); 116 ONLY_LATER = cfg.readNumEntry("onlylater",1);
99 117
100} 118}
101 119
102void Today::startConfig() { 120void Today::startConfig() {
103 conf = new todayconfig ( this, "", true ); 121 conf = new todayconfig ( this, "", true );
104 122
105 123
106 //Config cfg = new Config("today"); 124 //Config cfg = new Config("today");
107 125
108 // read the config 126 // read the config
109 Config cfg("today"); 127 Config cfg("today");
110 cfg.setGroup("BaseConfig"); 128 cfg.setGroup("BaseConfig");
111 129
112 //init(); 130 //init();
113 131
114 conf->SpinBox1->setValue(MAX_LINES_MEET); 132 conf->SpinBox1->setValue(MAX_LINES_MEET);
115 // location show box 133 // location show box
116 conf->CheckBox1->setChecked(SHOW_LOCATION); 134 conf->CheckBox1->setChecked(SHOW_LOCATION);
117 // notes show box 135 // notes show box
118 conf->CheckBox2->setChecked(SHOW_NOTES); 136 conf->CheckBox2->setChecked(SHOW_NOTES);
119 // task lines 137 // task lines
120 conf->SpinBox2->setValue(MAX_LINES_TASK); 138 conf->SpinBox2->setValue(MAX_LINES_TASK);
121 // clip when? 139 // clip when?
122 conf->SpinBox7->setValue(MAX_CHAR_CLIP); 140 conf->SpinBox7->setValue(MAX_CHAR_CLIP);
123 // only later 141 // only later
124 conf->CheckBox3->setChecked(ONLY_LATER); 142 conf->CheckBox3->setChecked(ONLY_LATER);
125 143
144 conf->CheckBoxAuto->setChecked(AUTOSTART);
145
126 conf->exec(); 146 conf->exec();
127 147
128 int maxlinestask = conf->SpinBox2->value(); 148 int maxlinestask = conf->SpinBox2->value();
129 int maxmeet = conf->SpinBox1->value(); 149 int maxmeet = conf->SpinBox1->value();
130 int location = conf->CheckBox1->isChecked(); 150 int location = conf->CheckBox1->isChecked();
131 int notes = conf->CheckBox2->isChecked(); 151 int notes = conf->CheckBox2->isChecked();
132 int maxcharclip = conf->SpinBox7->value(); 152 int maxcharclip = conf->SpinBox7->value();
133 int onlylater = conf->CheckBox3->isChecked(); 153 int onlylater = conf->CheckBox3->isChecked();
134 154 int autostart =conf->CheckBoxAuto->isChecked();
155
135 cfg.writeEntry("maxlinestask",maxlinestask); 156 cfg.writeEntry("maxlinestask",maxlinestask);
136 cfg.writeEntry("maxcharclip", maxcharclip); 157 cfg.writeEntry("maxcharclip", maxcharclip);
137 cfg.writeEntry("maxlinesmeet",maxmeet); 158 cfg.writeEntry("maxlinesmeet",maxmeet);
138 cfg.writeEntry("showlocation",location); 159 cfg.writeEntry("showlocation",location);
139 cfg.writeEntry("shownotes", notes); 160 cfg.writeEntry("shownotes", notes);
140 cfg.writeEntry("onlylater", onlylater); 161 cfg.writeEntry("onlylater", onlylater);
162 cfg.setGroup("Autostart");
163 cfg.writeEntry("autostart", autostart);
141 // sync it to "disk" 164 // sync it to "disk"
142 cfg.write(); 165 cfg.write();
143 166 autoStart();
144 draw(); 167 draw();
145} 168}
146 169
147 170
148/* 171/*
149 * Get all events that are in the datebook xml file for today 172 * Get all events that are in the datebook xml file for today
150 */ 173 */
151void Today::getDates() { 174void Today::getDates() {
152 QDate date = QDate::currentDate(); 175 QDate date = QDate::currentDate();
153 QTime time = QTime::currentTime(); 176 QTime time = QTime::currentTime();
154 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); 177 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
155 178
156 Config config( "qpe" ); 179 Config config( "qpe" );
157 // if 24 h format 180 // if 24 h format
158 //bool ampm = config.readBoolEntry( "AMPM", TRUE ); 181 //bool ampm = config.readBoolEntry( "AMPM", TRUE );
159 182
160 int count=0; 183 int count=0;
161 184
162 if ( list.count() > 0 ) { 185 if ( list.count() > 0 ) {
163 QString msg; 186 QString msg;
164 187
165 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 188 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
166 it!=list.end(); ++it ) { 189 it!=list.end(); ++it ) {
167 190
168 count++; 191 count++;
169 192
170 if ( count <= MAX_LINES_MEET ) { 193 if ( count <= MAX_LINES_MEET ) {
171 //cout << time.toString() << endl; 194 //cout << time.toString() << endl;
172 //cout << TimeString::dateString((*it).event().end()) << endl; 195 //cout << TimeString::dateString((*it).event().end()) << endl;
173 196
174 // decide if to get all day or only later appointments 197 // decide if to get all day or only later appointments
175 if (!ONLY_LATER) { 198 if (!ONLY_LATER) {
176 msg += "<B>" + (*it).description() + "</B>"; 199 msg += "<B>" + (*it).description() + "</B>";
177 if ( (*it).event().hasAlarm() ) { 200 if ( (*it).event().hasAlarm() ) {
178 msg += " <b>[with alarm]</b>"; 201 msg += " <b>[with alarm]</b>";
179 } 202 }
180 // include location or not 203 // include location or not
181 if (SHOW_LOCATION == 1) { 204 if (SHOW_LOCATION == 1) {
182 msg += "<BR><i>" + (*it).location(); 205 msg += "<BR><i>" + (*it).location();
183 msg += "</i>"; 206 msg += "</i>";
184 } 207 }
185 208
186 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { 209 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
187 msg += "<br>All day"; 210 msg += "<br>All day";
188 } else { 211 } else {
189 // start time of event 212 // start time of event
190 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) 213 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
191 // end time of event 214 // end time of event
192 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); 215 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
193 } 216 }
194 msg += "<BR>"; 217 msg += "<BR>";
195 // include possible note or not 218 // include possible note or not
196 if (SHOW_NOTES == 1) { 219 if (SHOW_NOTES == 1) {
197 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 220 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
198 } 221 }
199 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { 222 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) {
200 msg += "<B>" + (*it).description() + "</B>"; 223 msg += "<B>" + (*it).description() + "</B>";
201 if ( (*it).event().hasAlarm() ) { 224 if ( (*it).event().hasAlarm() ) {
202 msg += " <b>[with alarm]</b>"; 225 msg += " <b>[with alarm]</b>";
203 } 226 }
204 // include location or not 227 // include location or not
205 if (SHOW_LOCATION == 1) { 228 if (SHOW_LOCATION == 1) {
206 msg+= "<BR><i>" + (*it).location(); 229 msg+= "<BR><i>" + (*it).location();
207 msg += "</i>"; 230 msg += "</i>";
208 } 231 }
209 232
210 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { 233 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
211 msg += "<br>All day"; 234 msg += "<br>All day";
212 } else { 235 } else {
213 // start time of event 236 // start time of event
214 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) 237 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
215 // end time of event 238 // end time of event
216 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); 239 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
217 } 240 }
218 msg += "<BR>"; 241 msg += "<BR>";
219 // include possible note or not 242 // include possible note or not
220 if (SHOW_NOTES == 1) { 243 if (SHOW_NOTES == 1) {
221 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 244 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
222 } 245 }
223 } 246 }
224 } 247 }
225 } 248 }
226 if (msg.isEmpty()) { 249 if (msg.isEmpty()) {
227 msg = "No more appointments today"; 250 msg = tr("No more appointments today");
228 } 251 }
229 DatesField->setText(msg); 252 DatesField->setText(msg);
230 } 253 }
231} 254}
232 255
233/* 256/*
234 * Parse in the todolist.xml 257 * Parse in the todolist.xml
235 */ 258 */
236QList<TodoItem> Today::loadTodo(const char *filename) { 259QList<TodoItem> Today::loadTodo(const char *filename) {
237 DOM *todo; 260 DOM *todo;
238 ELE *tasks; 261 ELE *tasks;
239 ELE **tasklist; 262 ELE **tasklist;
240 ATT **attlist; 263 ATT **attlist;
241 int i, j; 264 int i, j;
242 char *description; 265 char *description;
243 int completed; 266 int completed;
244 int priority; 267 int priority;
245 TodoItem *tmp; 268 TodoItem *tmp;
246 QList<TodoItem> loadtodolist; 269 QList<TodoItem> loadtodolist;
247 270
248 todo = minidom_load(filename); 271 todo = minidom_load(filename);
249 272
250 tasks = todo->el; 273 tasks = todo->el;
251 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ 274 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/
252 if(tasks) { 275 if(tasks) {
253 tasklist = tasks->el; 276 tasklist = tasks->el;
254 i = 0; 277 i = 0;
255 while((tasklist) && (tasklist[i])) { 278 while((tasklist) && (tasklist[i])) {
256 attlist = tasklist[i]->at; 279 attlist = tasklist[i]->at;
257 j = 0; 280 j = 0;
258 description = NULL; 281 description = NULL;
259 priority = -1; 282 priority = -1;
260 completed = -1; 283 completed = -1;
261 while((attlist) && (attlist[j])) { 284 while((attlist) && (attlist[j])) {
262 if(!attlist[j]->name) { 285 if(!attlist[j]->name) {
263 continue; 286 continue;
264 } 287 }
265 if(!strcmp(attlist[j]->name, "Description")) { 288 if(!strcmp(attlist[j]->name, "Description")) {
266 description = attlist[j]->value; 289 description = attlist[j]->value;
267 } 290 }
268 // get Completed tag (0 or 1) 291 // get Completed tag (0 or 1)
269 if(!strcmp(attlist[j]->name, "Completed")) { 292 if(!strcmp(attlist[j]->name, "Completed")) {
270 QString s = attlist[j]->name; 293 QString s = attlist[j]->name;
271 if(s == "Completed") { 294 if(s == "Completed") {
272 completed = QString(attlist[j]->value).toInt(); 295 completed = QString(attlist[j]->value).toInt();
273 } 296 }
274 } 297 }
275 // get Priority (1 to 5) 298 // get Priority (1 to 5)
276 if(!strcmp(attlist[j]->name, "Priority")) { 299 if(!strcmp(attlist[j]->name, "Priority")) {
277 QString s = attlist[j]->name; 300 QString s = attlist[j]->name;
278 if(s == "Priority") { 301 if(s == "Priority") {
279 priority = QString(attlist[j]->value).toInt(); 302 priority = QString(attlist[j]->value).toInt();
280 } 303 }
281 } 304 }
282 j++; 305 j++;
283 } 306 }
284 if(description) { 307 if(description) {
285 tmp = new TodoItem(description, completed, priority); 308 tmp = new TodoItem(description, completed, priority);
286 loadtodolist.append(tmp); 309 loadtodolist.append(tmp);
287 } 310 }
288 i++; 311 i++;
289 } 312 }
290 } 313 }
291 314
292 minidom_free(todo); 315 minidom_free(todo);
293 316
294 return loadtodolist; 317 return loadtodolist;
295} 318}
296 319
297 320
298void Today::getMail() { 321void Today::getMail() {
299 Config cfg("opiemail"); 322 Config cfg("opiemail");
300 cfg.setGroup("today"); 323 cfg.setGroup("today");
301 324
302 // how many lines should be showed in the task section 325 // how many lines should be showed in the task section
303 int NEW_MAILS = cfg.readNumEntry("newmails",0); 326 int NEW_MAILS = cfg.readNumEntry("newmails",0);
304 int OUTGOING = cfg.readNumEntry("outgoing",0); 327 int OUTGOING = cfg.readNumEntry("outgoing",0);
305 328
306 329
307 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 330 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
308 331
309 332
310 MailField->setText(output); 333 MailField->setText(output);
311} 334}
312 335
313 336
314/* 337/*
315 * Get the todos 338 * Get the todos
316 * 339 *
317 */ 340 */
318void Today::getTodo() { 341void Today::getTodo() {
319 QString output; 342 QString output;
320 QString tmpout; 343 QString tmpout;
321 int count = 0; 344 int count = 0;
322 345
323 QDir dir; 346 QDir dir;
324 QString homedir = dir.homeDirPath (); 347 QString homedir = dir.homeDirPath ();
325 // see if todolist.xml does exist. 348 // see if todolist.xml does exist.
326 QFile f(homedir +"/Applications/todolist/todolist.xml"); 349 QFile f(homedir +"/Applications/todolist/todolist.xml");
327 if ( f.exists() ) { 350 if ( f.exists() ) {
328 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); 351 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml");
329 352
330 TodoItem *item; 353 TodoItem *item;
331 for( item = todolist.first(); item; item = todolist.next()) { 354 for( item = todolist.first(); item; item = todolist.next()) {
332 if (!(item->getCompleted() == 1) ) { 355 if (!(item->getCompleted() == 1) ) {
333 count++; 356 count++;
334 if (count <= MAX_LINES_TASK) { 357 if (count <= MAX_LINES_TASK) {
335 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); 358 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
336 } 359 }
337 } 360 }
338 } 361 }
339 } 362 }
340 363
341 if (count > 0) { 364 if (count > 0) {
342 if( count == 1 ) { 365 if( count == 1 ) {
343 output = QString("There is <b> 1</b> active task: <br>" ); 366 output = tr("There is <b> 1</b> active task: <br>" );
344 } else { 367 } else {
345 output = QString("There are <b> %1</b> active tasks: <br>").arg(count); 368 output = tr("There are <b> %1</b> active tasks: <br>").arg(count);
346 } 369 }
347 output += tmpout; 370 output += tmpout;
348 } else { 371 } else {
349 output = ("No active tasks"); 372 output = tr("No active tasks");
350 } 373 }
351 374
352 TodoField->setText(output); 375 TodoField->setText(tr(output));
353} 376}
354 377
355/* 378/*
356 * launches datebook 379 * launches datebook
357 */ 380 */
358void Today::startDatebook() { 381void Today::startDatebook() {
359 QCopEnvelope e("QPE/System", "execute(QString)"); 382 QCopEnvelope e("QPE/System", "execute(QString)");
360 e << QString("datebook"); 383 e << QString("datebook");
361} 384}
362 385
363/* 386/*
364 * launches todolist 387 * launches todolist
365 */ 388 */
366void Today::startTodo() { 389void Today::startTodo() {
367 QCopEnvelope e("QPE/System", "execute(QString)"); 390 QCopEnvelope e("QPE/System", "execute(QString)");
368 e << QString("todolist"); 391 e << QString("todolist");
369} 392}
370 393
371/* 394/*
372 * launch opiemail 395 * launch opiemail
373 */ 396 */
374void Today::startMail() { 397void Today::startMail() {
375 QCopEnvelope e("QPE/System", "execute(QString)"); 398 QCopEnvelope e("QPE/System", "execute(QString)");
376 e << QString("opiemail"); 399 e << QString("opiemail");
377} 400}
378 401
379/* 402/*
380 * Destroys the object and frees any allocated resources 403 * Destroys the object and frees any allocated resources
381 */ 404 */
382Today::~Today() { 405Today::~Today() {
383 // no need to delete child widgets, Qt does it all for us 406 // no need to delete child widgets, Qt does it all for us
384} 407}
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 6b8c0bf..07bfd61 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -1,63 +1,64 @@
1/* 1/*
2 * today.h 2 * today.h
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 20
21#ifndef TODAY_H 21#ifndef TODAY_H
22#define TODAY_H 22#define TODAY_H
23#include "todaybase.h" 23#include "todaybase.h"
24 24
25#include <qpe/datebookdb.h> 25#include <qpe/datebookdb.h>
26 26
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlist.h> 28#include <qlist.h>
29#include "TodoItem.h" 29#include "TodoItem.h"
30#include "todayconfig.h" 30#include "todayconfig.h"
31 31
32class Today : public TodayBase 32class Today : public TodayBase
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36 public: 36 public:
37 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 37 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
38 ~Today(); 38 ~Today();
39 39
40 private slots: 40 private slots:
41 void startConfig(); 41 void startConfig();
42 void startTodo(); 42 void startTodo();
43 void startDatebook(); 43 void startDatebook();
44 void startMail(); 44 void startMail();
45 void draw(); 45 void draw();
46 private: 46 private:
47 void init(); 47 void init();
48 void getDates(); 48 void getDates();
49 void getTodo(); 49 void getTodo();
50 void getMail(); 50 void getMail();
51 void autoStart();
51 QList<TodoItem> loadTodo(const char *filename); 52 QList<TodoItem> loadTodo(const char *filename);
52 private: 53 private:
53 DateBookDB *db; 54 DateBookDB *db;
54 todayconfig *conf; 55 todayconfig *conf;
55 //Config cfg; 56 //Config cfg;
56 int MAX_LINES_TASK; 57 int MAX_LINES_TASK;
57 int MAX_CHAR_CLIP; 58 int MAX_CHAR_CLIP;
58 int MAX_LINES_MEET; 59 int MAX_LINES_MEET;
59 int SHOW_LOCATION; 60 int SHOW_LOCATION;
60 int SHOW_NOTES; 61 int SHOW_NOTES;
61}; 62};
62#endif // TODAY_H 63#endif // TODAY_H
63 64
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 4f2633d..7c690a7 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,135 +1,147 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'todayconfig.ui' 2** Form implementation generated from reading ui file 'todayconfig.ui'
3** 3**
4** Created: Thu Feb 14 15:04:33 2002 4** Created: Thu Feb 14 15:04:33 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "todayconfig.h" 9#include "todayconfig.h"
10 10
11#include <qcheckbox.h> 11#include <qcheckbox.h>
12#include <qframe.h> 12#include <qframe.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qspinbox.h> 14#include <qspinbox.h>
15#include <qtabwidget.h> 15#include <qtabwidget.h>
16#include <qwidget.h> 16#include <qwidget.h>
17#include <qlayout.h> 17#include <qlayout.h>
18#include <qvariant.h> 18#include <qvariant.h>
19#include <qtooltip.h> 19#include <qtooltip.h>
20#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21 21
22/* 22/*
23 * Constructs a todayconfig which is a child of 'parent', with the 23 * Constructs a todayconfig which is a child of 'parent', with the
24 * name 'name' and widget flags set to 'f' 24 * name 'name' and widget flags set to 'f'
25 * 25 *
26 * The dialog will by default be modeless, unless you set 'modal' to 26 * The dialog will by default be modeless, unless you set 'modal' to
27 * TRUE to construct a modal dialog. 27 * TRUE to construct a modal dialog.
28 */ 28 */
29todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags fl ) 29todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags fl )
30 : QDialog( parent, name, modal, fl ) 30 : QDialog( parent, name, modal, fl )
31{ 31{
32 if ( !name ) 32 if ( !name )
33 setName( "todayconfig" ); 33 setName( "todayconfig" );
34 resize( 175, 232 ); 34 resize( 175, 232 );
35 setCaption( tr( "Today config" ) ); 35 setCaption( tr( "Today config" ) );
36 36
37 TabWidget3 = new QTabWidget( this, "TabWidget3" ); 37 TabWidget3 = new QTabWidget( this, "TabWidget3" );
38 TabWidget3->setGeometry( QRect( 0, 0, 220, 320 ) ); 38 TabWidget3->setGeometry( QRect( 0, 0, 220, 320 ) );
39 TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); 39 TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) );
40 TabWidget3->setAutoMask( FALSE ); 40 TabWidget3->setAutoMask( FALSE );
41 TabWidget3->setTabShape( QTabWidget::Rounded ); 41 TabWidget3->setTabShape( QTabWidget::Rounded );
42 42
43 tab = new QWidget( TabWidget3, "tab" ); 43 tab = new QWidget( TabWidget3, "tab" );
44 44
45 Frame8 = new QFrame( tab, "Frame8" ); 45 Frame8 = new QFrame( tab, "Frame8" );
46 Frame8->setGeometry( QRect( -5, 0, 200, 300 ) ); 46 Frame8->setGeometry( QRect( -5, 0, 200, 300 ) );
47 Frame8->setFrameShape( QFrame::StyledPanel ); 47 Frame8->setFrameShape( QFrame::StyledPanel );
48 Frame8->setFrameShadow( QFrame::Raised ); 48 Frame8->setFrameShadow( QFrame::Raised );
49 49
50 TextLabel4 = new QLabel( Frame8, "TextLabel4" ); 50 TextLabel4 = new QLabel( Frame8, "TextLabel4" );
51 TextLabel4->setGeometry( QRect( 20, 65, 100, 60 ) ); 51 TextLabel4->setGeometry( QRect( 20, 65, 100, 60 ) );
52 TextLabel4->setText( tr( "Should the \n" 52 TextLabel4->setText( tr( "Should the \n"
53 "location \n" 53 "location \n"
54 "be shown?" ) ); 54 "be shown?" ) );
55 55
56 TextLabel5 = new QLabel( Frame8, "TextLabel5" ); 56 TextLabel5 = new QLabel( Frame8, "TextLabel5" );
57 TextLabel5->setGeometry( QRect( 20, 160, 120, 40 ) ); 57 TextLabel5->setGeometry( QRect( 20, 160, 120, 40 ) );
58 TextLabel5->setText( tr( "Should the notes \n" 58 TextLabel5->setText( tr( "Should the notes \n"
59 "be shown?" ) ); 59 "be shown?" ) );
60 60
61 CheckBox2 = new QCheckBox( Frame8, "CheckBox2" ); 61 CheckBox2 = new QCheckBox( Frame8, "CheckBox2" );
62 CheckBox2->setGeometry( QRect( 158, 170, 27, 21 ) ); 62 CheckBox2->setGeometry( QRect( 158, 170, 27, 21 ) );
63 //CheckBox2->setText( tr( "" ) ); 63 //CheckBox2->setText( tr( "" ) );
64 64
65 CheckBox1 = new QCheckBox( Frame8, "CheckBox1" ); 65 CheckBox1 = new QCheckBox( Frame8, "CheckBox1" );
66 CheckBox1->setGeometry( QRect( 158, 65, 27, 50 ) ); 66 CheckBox1->setGeometry( QRect( 158, 65, 27, 50 ) );
67 //CheckBox1->setText( tr( "" ) ); 67 //CheckBox1->setText( tr( "" ) );
68 68
69 CheckBox3 = new QCheckBox (Frame8, "CheckBox3" ); 69 CheckBox3 = new QCheckBox (Frame8, "CheckBox3" );
70 CheckBox3->setGeometry( QRect( 158, 125, 27, 21 ) ); 70 CheckBox3->setGeometry( QRect( 158, 125, 27, 21 ) );
71 71
72 TextLabel6 = new QLabel( Frame8, "All Day"); 72 TextLabel6 = new QLabel( Frame8, "All Day");
73 TextLabel6->setGeometry( QRect( 20, 120, 100, 30 ) ); 73 TextLabel6->setGeometry( QRect( 20, 120, 100, 30 ) );
74 TextLabel6->setText( tr( "Show only later\n" 74 TextLabel6->setText( tr( "Show only later\n"
75 "appointments") ); 75 "appointments") );
76 76
77 SpinBox1 = new QSpinBox( Frame8, "SpinBox1" ); 77 SpinBox1 = new QSpinBox( Frame8, "SpinBox1" );
78 SpinBox1->setGeometry( QRect( 115, 20, 58, 25 ) ); 78 SpinBox1->setGeometry( QRect( 115, 20, 58, 25 ) );
79 SpinBox1->setMaxValue( 10 ); 79 SpinBox1->setMaxValue( 10 );
80 SpinBox1->setValue( 5 ); 80 SpinBox1->setValue( 5 );
81 81
82 TextLabel3 = new QLabel( Frame8, "TextLabel3" ); 82 TextLabel3 = new QLabel( Frame8, "TextLabel3" );
83 TextLabel3->setGeometry( QRect( 20, 10, 90, 60 ) ); 83 TextLabel3->setGeometry( QRect( 20, 10, 90, 60 ) );
84 TextLabel3->setText( tr( "How many \n" 84 TextLabel3->setText( tr( "How many \n"
85 "appointment\n" 85 "appointment\n"
86 "should should \n" 86 "should should \n"
87 "be shown?" ) ); 87 "be shown?" ) );
88 TabWidget3->insertTab( tab, tr( "Calendar" ) ); 88 TabWidget3->insertTab( tab, tr( "Calendar" ) );
89 89
90 tab_2 = new QWidget( TabWidget3, "tab_2" ); 90 tab_2 = new QWidget( TabWidget3, "tab_2" );
91 91
92 Frame9 = new QFrame( tab_2, "Frame9" ); 92 Frame9 = new QFrame( tab_2, "Frame9" );
93 Frame9->setGeometry( QRect( -5, 0, 230, 310 ) ); 93 Frame9->setGeometry( QRect( -5, 0, 230, 310 ) );
94 Frame9->setFrameShape( QFrame::StyledPanel ); 94 Frame9->setFrameShape( QFrame::StyledPanel );
95 Frame9->setFrameShadow( QFrame::Raised ); 95 Frame9->setFrameShadow( QFrame::Raised );
96 96
97 TextLabel6 = new QLabel( Frame9, "TextLabel6" ); 97 TextLabel6 = new QLabel( Frame9, "TextLabel6" );
98 TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) ); 98 TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) );
99 TextLabel6->setText( tr( "How many\n" 99 TextLabel6->setText( tr( "How many\n"
100 "tasks should \n" 100 "tasks should \n"
101 "be shown?" ) ); 101 "be shown?" ) );
102 102
103 SpinBox2 = new QSpinBox( Frame9, "SpinBox2" ); 103 SpinBox2 = new QSpinBox( Frame9, "SpinBox2" );
104 SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) ); 104 SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) );
105 SpinBox2->setMaxValue( 20 ); 105 SpinBox2->setMaxValue( 20 );
106 SpinBox2->setValue( 5 ); 106 SpinBox2->setValue( 5 );
107 TabWidget3->insertTab( tab_2, tr( "Tasks" ) ); 107 TabWidget3->insertTab( tab_2, tr( "Tasks" ) );
108 108
109 tab_3 = new QWidget( TabWidget3, "tab_3" ); 109 tab_3 = new QWidget( TabWidget3, "tab_3" );
110 110
111 Frame14 = new QFrame( tab_3, "Frame14" ); 111 Frame14 = new QFrame( tab_3, "Frame14" );
112 Frame14->setGeometry( QRect( -5, 0, 200, 220 ) ); 112 Frame14->setGeometry( QRect( -5, 0, 200, 220 ) );
113 Frame14->setFrameShape( QFrame::StyledPanel ); 113 Frame14->setFrameShape( QFrame::StyledPanel );
114 Frame14->setFrameShadow( QFrame::Raised ); 114 Frame14->setFrameShadow( QFrame::Raised );
115 115
116 TextLabel1 = new QLabel( Frame14, "TextLabel1" ); 116 TextLabel1 = new QLabel( Frame14, "TextLabel1" );
117 TextLabel1->setGeometry( QRect( 20, 20, 100, 30 ) ); 117 TextLabel1->setGeometry( QRect( 20, 20, 100, 30 ) );
118 TextLabel1->setText( tr( "Clip after how\n" 118 TextLabel1->setText( tr( "Clip after how\n"
119 "many letters" ) ); 119 "many letters" ) );
120 120
121 SpinBox7 = new QSpinBox( Frame14, "SpinBox7" ); 121 SpinBox7 = new QSpinBox( Frame14, "SpinBox7" );
122 SpinBox7->setGeometry( QRect( 115, 20, 58, 25 ) ); 122 SpinBox7->setGeometry( QRect( 115, 20, 58, 25 ) );
123 SpinBox7->setMaxValue( 80 ); 123 SpinBox7->setMaxValue( 80 );
124 SpinBox7->setValue( 30 ); 124 SpinBox7->setValue( 30 );
125 TabWidget3->insertTab( tab_3, tr( "All" ) ); 125
126 TextLabel2 = new QLabel( Frame14, "AutoStart" );
127 TextLabel2->setGeometry( QRect( 20, 60, 100, 45 ) );
128 TextLabel2->setText( tr( "Should today be\n"
129 "autostarted on\n"
130 "resume ?"
131 " (Opie only)" ) );
132
133 CheckBoxAuto = new QCheckBox (Frame14, "CheckBoxAuto" );
134 CheckBoxAuto->setGeometry( QRect( 158, 60, 27, 21 ) );
135
136 TabWidget3->insertTab( tab_3, tr( "Misc" ) );
137
126} 138}
127 139
128/* 140/*
129 * Destroys the object and frees any allocated resources 141 * Destroys the object and frees any allocated resources
130 */ 142 */
131todayconfig::~todayconfig() 143todayconfig::~todayconfig()
132{ 144{
133 // no need to delete child widgets, Qt does it all for us 145 // no need to delete child widgets, Qt does it all for us
134} 146}
135 147
diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h
index 7facf85..020097d 100644
--- a/core/pim/today/todayconfig.h
+++ b/core/pim/today/todayconfig.h
@@ -1,53 +1,55 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file 'todayconfig.ui' 2** Form interface generated from reading ui file 'todayconfig.ui'
3** 3**
4** Created: Thu Feb 14 15:04:33 2002 4** Created: Thu Feb 14 15:04:33 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#ifndef TODAYCONFIG_H 9#ifndef TODAYCONFIG_H
10#define TODAYCONFIG_H 10#define TODAYCONFIG_H
11 11
12#include <qvariant.h> 12#include <qvariant.h>
13#include <qdialog.h> 13#include <qdialog.h>
14class QVBoxLayout; 14class QVBoxLayout;
15class QHBoxLayout; 15class QHBoxLayout;
16class QGridLayout; 16class QGridLayout;
17class QCheckBox; 17class QCheckBox;
18class QFrame; 18class QFrame;
19class QLabel; 19class QLabel;
20class QSpinBox; 20class QSpinBox;
21class QTabWidget; 21class QTabWidget;
22class QWidget; 22class QWidget;
23 23
24class todayconfig : public QDialog 24class todayconfig : public QDialog
25{ 25{
26 Q_OBJECT 26 Q_OBJECT
27 27
28public: 28public:
29 todayconfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 29 todayconfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
30 ~todayconfig(); 30 ~todayconfig();
31 31
32 QTabWidget* TabWidget3; 32 QTabWidget* TabWidget3;
33 QWidget* tab; 33 QWidget* tab;
34 QFrame* Frame8; 34 QFrame* Frame8;
35 QLabel* TextLabel4; 35 QLabel* TextLabel4;
36 QLabel* TextLabel5; 36 QLabel* TextLabel5;
37 QLabel* TextLabel2;
37 QCheckBox* CheckBox3; 38 QCheckBox* CheckBox3;
38 QCheckBox* CheckBox2; 39 QCheckBox* CheckBox2;
39 QCheckBox* CheckBox1; 40 QCheckBox* CheckBox1;
41 QCheckBox* CheckBoxAuto;
40 QSpinBox* SpinBox1; 42 QSpinBox* SpinBox1;
41 QLabel* TextLabel3; 43 QLabel* TextLabel3;
42 QWidget* tab_2; 44 QWidget* tab_2;
43 QFrame* Frame9; 45 QFrame* Frame9;
44 QLabel* TextLabel6; 46 QLabel* TextLabel6;
45 QSpinBox* SpinBox2; 47 QSpinBox* SpinBox2;
46 QWidget* tab_3; 48 QWidget* tab_3;
47 QFrame* Frame14; 49 QFrame* Frame14;
48 QLabel* TextLabel1; 50 QLabel* TextLabel1;
49 QSpinBox* SpinBox7; 51 QSpinBox* SpinBox7;
50 52
51}; 53};
52 54
53#endif // TODAYCONFIG_H 55#endif // TODAYCONFIG_H