summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp109
-rw-r--r--core/pim/today/today.h5
-rw-r--r--core/pim/today/todaybase.cpp25
-rw-r--r--core/pim/today/todaybase.h2
4 files changed, 101 insertions, 40 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 81d4d36..08efe2d 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,530 +1,591 @@
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#include <qpe/contact.h>
31#include <qpe/global.h>
30 32
31#include <qdir.h> 33#include <qdir.h>
32#include <qfile.h> 34#include <qfile.h>
33#include <qdatetime.h> 35#include <qdatetime.h>
34#include <qtextstream.h> 36#include <qtextstream.h>
35#include <qcheckbox.h> 37#include <qcheckbox.h>
36#include <qspinbox.h> 38#include <qspinbox.h>
37#include <qpushbutton.h> 39#include <qpushbutton.h>
38#include <qlabel.h> 40#include <qlabel.h>
39#include <qtimer.h> 41#include <qtimer.h>
40#include <qpixmap.h> 42#include <qpixmap.h>
41#include <qfileinfo.h> 43#include <qfileinfo.h>
42#include <qlayout.h> 44#include <qlayout.h>
43#include <qtl.h> 45#include <qtl.h>
44 46
45//#include <iostream.h> 47//#include <iostream.h>
46#include <unistd.h> 48#include <unistd.h>
47#include <stdlib.h> 49#include <stdlib.h>
48 50
49int MAX_LINES_TASK; 51int MAX_LINES_TASK;
50int MAX_CHAR_CLIP; 52int MAX_CHAR_CLIP;
51int MAX_LINES_MEET; 53int MAX_LINES_MEET;
52int SHOW_LOCATION; 54int SHOW_LOCATION;
53int SHOW_NOTES; 55int SHOW_NOTES;
54// show only later dates 56// show only later dates
55int ONLY_LATER; 57int ONLY_LATER;
56int AUTOSTART; 58int AUTOSTART;
57 59
58int NEW_START=1; 60int NEW_START=1;
59/* 61/*
60 * Constructs a Example which is a child of 'parent', with the 62 * Constructs a Example which is a child of 'parent', with the
61 * name 'name' and widget flags set to 'f' 63 * name 'name' and widget flags set to 'f'
62 */ 64 */
63Today::Today( QWidget* parent, const char* name, WFlags fl ) 65Today::Today( QWidget* parent, const char* name, WFlags fl )
64 : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { 66 : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) {
65 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 67 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
66 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 68 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
67 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 69 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
68 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); 70 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
69 71
72#if defined(Q_WS_QWS)
73#if !defined(QT_NO_COP)
74 QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this );
75 connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)),
76 this, SLOT ( channelReceived(const QCString &, const QByteArray &)) );
77#endif
78#endif
79
70 draw(); 80 draw();
81 setOwnerField();
71 autoStart(); 82 autoStart();
72} 83}
73 84
85/*
86 * Qcop receive method.
87 */
88void Today::channelReceived(const QCString &msg, const QByteArray & data) {
89 QDataStream stream(data, IO_ReadOnly );
90 if ( msg == "message(QString)" ) {
91 QString message;
92 stream >> message;
93 setOwnerField(message);
94 }
95
96}
97
98/*
99 * Initialises the owner field with the default value, the username
100 */
101void Today::setOwnerField() {
102 QString file = Global::applicationFileName("addressbook", "businesscard.vcf");
103 if (QFile::exists(file)) {
104 Contact cont = Contact::readVCard(file)[0];
105 QString returnString = cont.fullName();
106 OwnerField->setText( tr ("<b>Owned by " + returnString + "</b>"));
107 } else {
108 OwnerField->setText( tr ("<b>to lame to fill out the business card </b>"));
109 }
110}
111
112/*
113 * Set the owner field with a given QString, for example per qcop.
114 */
115void Today::setOwnerField(QString &message) {
116 if (!message.isEmpty()) {
117 OwnerField->setText("<b>" + message + "</b>");
118 }
119}
120
121/*
122 * Autostart, uses the new (opie only) autostart method in the launcher code.
123 * If registered against that today ist started on each resume.
124 */
74void Today::autoStart() { 125void Today::autoStart() {
75 Config cfg("today"); 126 Config cfg("today");
76 cfg.setGroup("Autostart"); 127 cfg.setGroup("Autostart");
77 AUTOSTART = cfg.readNumEntry("autostart",1); 128 AUTOSTART = cfg.readNumEntry("autostart",1);
78 if (AUTOSTART) { 129 if (AUTOSTART) {
79 QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); 130 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
80 e << QString("add"); 131 e << QString("add");
81 e << QString("today"); 132 e << QString("today");
82 } else { 133 } else {
83 QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); 134 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
84 e << QString("remove"); 135 e << QString("remove");
85 e << QString("today"); 136 e << QString("today");
86 } 137 }
87} 138}
88 139
140/*
141 * Repaint method. Reread all fields.
142 */
89void Today::draw() { 143void Today::draw() {
90 init(); 144 init();
91 getDates(); 145 getDates();
92 getMail(); 146 getMail();
93 getTodo(); 147 getTodo();
94 // how often refresh 148 // how often refresh
95 QTimer::singleShot( 10*1000, this, SLOT(draw() ) ); 149 QTimer::singleShot( 10*1000, this, SLOT(draw() ) );
96} 150}
97 151
98
99/* 152/*
100 * Check if the todolist.xml was modified (if there are new entries. 153 * Check if the todolist.xml was modified (if there are new entries.
101 * Returns true if it was modified. 154 * Returns true if it was modified.
102 */ 155 */
103bool Today::checkIfModified() { 156bool Today::checkIfModified() {
104 157
105 QDir dir; 158 QDir dir;
106 QString homedir = dir.homeDirPath (); 159 QString homedir = dir.homeDirPath ();
107 QString time; 160 QString time;
108 161
109 Config cfg("today"); 162 Config cfg("today");
110 cfg.setGroup("Files"); 163 cfg.setGroup("Files");
111 time = cfg.readEntry("todolisttimestamp", ""); 164 time = cfg.readEntry("todolisttimestamp", "");
112 165
113 QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); 166 QFileInfo file = (homedir +"/Applications/todolist/todolist.xml");
114 QDateTime fileTime = file.lastModified(); 167 QDateTime fileTime = file.lastModified();
115 if (time.compare(fileTime.toString()) == 0) { 168 if (time.compare(fileTime.toString()) == 0) {
116 return false; 169 return false;
117 } else { 170 } else {
118 cfg.writeEntry("todolisttimestamp", fileTime.toString() ); 171 cfg.writeEntry("todolisttimestamp", fileTime.toString() );
119 cfg.write(); 172 cfg.write();
120 return true; 173 return true;
121 } 174 }
122} 175}
123 176
124 177
178/*
179 * Init stuff needed for today. Reads the config file.
180 */
125void Today::init() { 181void Today::init() {
126 QDate date = QDate::currentDate(); 182 QDate date = QDate::currentDate();
127 QString time = (tr( date.toString()) ); 183 QString time = (tr( date.toString()) );
128// QString time = (tr( date.toString()) , white);
129 184
130 TextLabel1->setText(time); 185 TextLabel1->setText(time);
131 db = new DateBookDB; 186 db = new DateBookDB;
132 187
133 // read config 188 // read config
134 Config cfg("today"); 189 Config cfg("today");
135 cfg.setGroup("BaseConfig"); 190 cfg.setGroup("BaseConfig");
136 191
192 // -- config file section --
137 // how many lines should be showed in the task section 193 // how many lines should be showed in the task section
138 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); 194 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5);
139 // after how many chars should the be cut off on tasks and notes 195 // after how many chars should the be cut off on tasks and notes
140 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30); 196 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40);
141 // how many lines should be showed in the datebook section 197 // how many lines should be showed in the datebook section
142 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); 198 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5);
143 // If location is to be showed too, 1 to activate it. 199 // If location is to be showed too, 1 to activate it.
144 SHOW_LOCATION = cfg.readNumEntry("showlocation",1); 200 SHOW_LOCATION = cfg.readNumEntry("showlocation",1);
145 // if notes should be shown 201 // if notes should be shown
146 SHOW_NOTES = cfg.readNumEntry("shownotes",0); 202 SHOW_NOTES = cfg.readNumEntry("shownotes",0);
203 // should only later appointments be shown or all for the current day.
147 ONLY_LATER = cfg.readNumEntry("onlylater",1); 204 ONLY_LATER = cfg.readNumEntry("onlylater",1);
148
149} 205}
150 206
207
208/*
209 * The method for the configuration dialog.
210 */
151void Today::startConfig() { 211void Today::startConfig() {
152 conf = new todayconfig ( this, "", true );
153
154
155 //Config cfg = new Config("today");
156 212
213 conf = new todayconfig ( this, "", true );
157 // read the config 214 // read the config
158 Config cfg("today"); 215 Config cfg("today");
159 cfg.setGroup("BaseConfig"); 216 cfg.setGroup("BaseConfig");
160 217
161 //init(); 218 //init();
162 219
163 conf->SpinBox1->setValue(MAX_LINES_MEET); 220 conf->SpinBox1->setValue(MAX_LINES_MEET);
164 // location show box 221 // location show box
165 conf->CheckBox1->setChecked(SHOW_LOCATION); 222 conf->CheckBox1->setChecked(SHOW_LOCATION);
166 // notes show box 223 // notes show box
167 conf->CheckBox2->setChecked(SHOW_NOTES); 224 conf->CheckBox2->setChecked(SHOW_NOTES);
168 // task lines 225 // task lines
169 conf->SpinBox2->setValue(MAX_LINES_TASK); 226 conf->SpinBox2->setValue(MAX_LINES_TASK);
170 // clip when? 227 // clip when?
171 conf->SpinBox7->setValue(MAX_CHAR_CLIP); 228 conf->SpinBox7->setValue(MAX_CHAR_CLIP);
172 // only later 229 // only later
173 conf->CheckBox3->setChecked(ONLY_LATER); 230 conf->CheckBox3->setChecked(ONLY_LATER);
174 231 // if today should be autostarted
175 conf->CheckBoxAuto->setChecked(AUTOSTART); 232 conf->CheckBoxAuto->setChecked(AUTOSTART);
176 233
177 conf->exec(); 234 conf->exec();
178 235
179 int maxlinestask = conf->SpinBox2->value(); 236 int maxlinestask = conf->SpinBox2->value();
180 int maxmeet = conf->SpinBox1->value(); 237 int maxmeet = conf->SpinBox1->value();
181 int location = conf->CheckBox1->isChecked(); 238 int location = conf->CheckBox1->isChecked();
182 int notes = conf->CheckBox2->isChecked(); 239 int notes = conf->CheckBox2->isChecked();
183 int maxcharclip = conf->SpinBox7->value(); 240 int maxcharclip = conf->SpinBox7->value();
184 int onlylater = conf->CheckBox3->isChecked(); 241 int onlylater = conf->CheckBox3->isChecked();
185 int autostart =conf->CheckBoxAuto->isChecked(); 242 int autostart =conf->CheckBoxAuto->isChecked();
186 243
187 cfg.writeEntry("maxlinestask",maxlinestask); 244 cfg.writeEntry("maxlinestask",maxlinestask);
188 cfg.writeEntry("maxcharclip", maxcharclip); 245 cfg.writeEntry("maxcharclip", maxcharclip);
189 cfg.writeEntry("maxlinesmeet",maxmeet); 246 cfg.writeEntry("maxlinesmeet",maxmeet);
190 cfg.writeEntry("showlocation",location); 247 cfg.writeEntry("showlocation",location);
191 cfg.writeEntry("shownotes", notes); 248 cfg.writeEntry("shownotes", notes);
192 cfg.writeEntry("onlylater", onlylater); 249 cfg.writeEntry("onlylater", onlylater);
193 cfg.setGroup("Autostart"); 250 cfg.setGroup("Autostart");
194 cfg.writeEntry("autostart", autostart); 251 cfg.writeEntry("autostart", autostart);
252
195 // sync it to "disk" 253 // sync it to "disk"
196 cfg.write(); 254 cfg.write();
197 NEW_START=1; 255 NEW_START=1;
198 draw(); 256 draw();
199 autoStart(); 257 autoStart();
200} 258}
201 259
202 260
203/* 261/*
204 * Get all events that are in the datebook xml file for today 262 * Get all events that are in the datebook xml file for today
205 */ 263 */
206void Today::getDates() { 264void Today::getDates() {
207 QDate date = QDate::currentDate(); 265 QDate date = QDate::currentDate();
208 266
209 if (AllDateBookEvents) delete AllDateBookEvents; 267 if (AllDateBookEvents) delete AllDateBookEvents;
210 AllDateBookEvents = new QWidget( ); 268 AllDateBookEvents = new QWidget( );
211 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); 269 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents);
212 270
213 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); 271 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
214 272
215 qBubbleSort(list); 273 qBubbleSort(list);
216 // printf("Get dates\n"); 274 // printf("Get dates\n");
217 275
218 Config config( "qpe" ); 276 Config config( "qpe" );
219 // if 24 h format 277 // if 24 h format
220 //bool ampm = config.readBoolEntry( "AMPM", TRUE ); 278 //bool ampm = config.readBoolEntry( "AMPM", TRUE );
221 279
222 int count=0; 280 int count=0;
223 281
224 if ( list.count() > 0 ) { 282 if ( list.count() > 0 ) {
225 283
226 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 284 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
227 it!=list.end(); ++it ) { 285 it!=list.end(); ++it ) {
228 286
229 287
230 if ( count <= MAX_LINES_MEET ) { 288 if ( count <= MAX_LINES_MEET ) {
231 289
232 QTime time = QTime::currentTime(); 290 QTime time = QTime::currentTime();
233 291
234 if (!ONLY_LATER) { 292 if (!ONLY_LATER) {
235 count++; 293 count++;
236 DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); 294 DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents);
237 layoutDates->addWidget(l); 295 layoutDates->addWidget(l);
238 connect (l, SIGNAL(editEvent(const Event &)), 296 connect (l, SIGNAL(editEvent(const Event &)),
239 this, SLOT(editEvent(const Event &))); 297 this, SLOT(editEvent(const Event &)));
240 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { 298 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) {
241 count++; 299 count++;
242 300
243 // show only later appointments 301 // show only later appointments
244 DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents); 302 DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents);
245 layoutDates->addWidget(l); 303 layoutDates->addWidget(l);
246 connect (l, SIGNAL(editEvent(const Event &)), 304 connect (l, SIGNAL(editEvent(const Event &)),
247 this, SLOT(editEvent(const Event &))); 305 this, SLOT(editEvent(const Event &)));
248 } 306 }
249 } 307 }
250 } 308 }
251 if (ONLY_LATER && count==0) { 309 if (ONLY_LATER && count==0) {
252 QLabel* noMoreEvents = new QLabel(AllDateBookEvents); 310 QLabel* noMoreEvents = new QLabel(AllDateBookEvents);
253 noMoreEvents->setText("No more appointments today"); 311 noMoreEvents->setText("No more appointments today");
254 layoutDates->addWidget(noMoreEvents); 312 layoutDates->addWidget(noMoreEvents);
255 } 313 }
256 } else { 314 } else {
257 QLabel* noEvents = new QLabel(AllDateBookEvents); 315 QLabel* noEvents = new QLabel(AllDateBookEvents);
258 noEvents->setText("No appointments today"); 316 noEvents->setText("No appointments today");
259 layoutDates->addWidget(noEvents); 317 layoutDates->addWidget(noEvents);
260 } 318 }
261 319
262 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 320 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
263 sv1->addChild(AllDateBookEvents); 321 sv1->addChild(AllDateBookEvents);
264 AllDateBookEvents->show(); 322 AllDateBookEvents->show();
265
266
267} 323}
268 324
269/* 325/*
270 * Parse in the todolist.xml 326 * Parse in the todolist.xml
271 */ 327 */
272QList<TodoItem> Today::loadTodo(const char *filename) { 328QList<TodoItem> Today::loadTodo(const char *filename) {
273 DOM *todo; 329 DOM *todo;
274 ELE *tasks; 330 ELE *tasks;
275 ELE **tasklist; 331 ELE **tasklist;
276 ATT **attlist; 332 ATT **attlist;
277 int i, j; 333 int i, j;
278 char *description; 334 char *description;
279 int completed; 335 int completed;
280 int priority; 336 int priority;
281 TodoItem *tmp; 337 TodoItem *tmp;
282 QList<TodoItem> loadtodolist; 338 QList<TodoItem> loadtodolist;
283 339
284 todo = minidom_load(filename); 340 todo = minidom_load(filename);
285 341
286 tasks = todo->el; 342 tasks = todo->el;
287 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ 343 tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/
288 if(tasks) { 344 if(tasks) {
289 tasklist = tasks->el; 345 tasklist = tasks->el;
290 i = 0; 346 i = 0;
291 while((tasklist) && (tasklist[i])) { 347 while((tasklist) && (tasklist[i])) {
292 attlist = tasklist[i]->at; 348 attlist = tasklist[i]->at;
293 j = 0; 349 j = 0;
294 description = NULL; 350 description = NULL;
295 priority = -1; 351 priority = -1;
296 completed = -1; 352 completed = -1;
297 while((attlist) && (attlist[j])) { 353 while((attlist) && (attlist[j])) {
298 if(!attlist[j]->name) { 354 if(!attlist[j]->name) {
299 continue; 355 continue;
300 } 356 }
301 if(!strcmp(attlist[j]->name, "Description")) { 357 if(!strcmp(attlist[j]->name, "Description")) {
302 description = attlist[j]->value; 358 description = attlist[j]->value;
303 } 359 }
304 // get Completed tag (0 or 1) 360 // get Completed tag (0 or 1)
305 if(!strcmp(attlist[j]->name, "Completed")) { 361 if(!strcmp(attlist[j]->name, "Completed")) {
306 QString s = attlist[j]->name; 362 QString s = attlist[j]->name;
307 if(s == "Completed") { 363 if(s == "Completed") {
308 completed = QString(attlist[j]->value).toInt(); 364 completed = QString(attlist[j]->value).toInt();
309 } 365 }
310 } 366 }
311 // get Priority (1 to 5) 367 // get Priority (1 to 5)
312 if(!strcmp(attlist[j]->name, "Priority")) { 368 if(!strcmp(attlist[j]->name, "Priority")) {
313 QString s = attlist[j]->name; 369 QString s = attlist[j]->name;
314 if(s == "Priority") { 370 if(s == "Priority") {
315 priority = QString(attlist[j]->value).toInt(); 371 priority = QString(attlist[j]->value).toInt();
316 } 372 }
317 } 373 }
318 j++; 374 j++;
319 } 375 }
320 if(description) { 376 if(description) {
321 tmp = new TodoItem(description, completed, priority); 377 tmp = new TodoItem(description, completed, priority);
322 loadtodolist.append(tmp); 378 loadtodolist.append(tmp);
323 } 379 }
324 i++; 380 i++;
325 } 381 }
326 } 382 }
327 383
328 minidom_free(todo); 384 minidom_free(todo);
329 385
330 return loadtodolist; 386 return loadtodolist;
331} 387}
332 388
333 389
334void Today::getMail() { 390void Today::getMail() {
335 Config cfg("opiemail"); 391 Config cfg("opiemail");
336 cfg.setGroup("today"); 392 cfg.setGroup("today");
337 393
338 // how many lines should be showed in the task section 394 // how many lines should be showed in the task section
339 int NEW_MAILS = cfg.readNumEntry("newmails",0); 395 int NEW_MAILS = cfg.readNumEntry("newmails",0);
340 int OUTGOING = cfg.readNumEntry("outgoing",0); 396 int OUTGOING = cfg.readNumEntry("outgoing",0);
341 397
342
343 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 398 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
344 399
345
346 MailField->setText(output); 400 MailField->setText(output);
347} 401}
348 402
349 403
350/* 404/*
351 * Get the todos 405 * Get the todos
352 *
353 */ 406 */
354void Today::getTodo() { 407void Today::getTodo() {
355 408
356 // if the todolist.xml file was not modified in between, do not parse it. 409 // if the todolist.xml file was not modified in between, do not parse it.
357 if (!checkIfModified() && !NEW_START) { 410 if (!checkIfModified() && !NEW_START) {
358 return; 411 return;
359 } 412 }
413 // since it was the new start or the return from config dialog, set it to 0 again.
360 NEW_START=0; 414 NEW_START=0;
361 415
362 QString output; 416 QString output;
363 QString tmpout; 417 QString tmpout;
364 int count = 0; 418 int count = 0;
365 419
366 QDir dir; 420 QDir dir;
367 QString homedir = dir.homeDirPath (); 421 QString homedir = dir.homeDirPath ();
368 // see if todolist.xml does exist. 422 // see if todolist.xml does exist.
369 QFile f(homedir +"/Applications/todolist/todolist.xml"); 423 QFile f(homedir +"/Applications/todolist/todolist.xml");
370 if ( f.exists() ) { 424 if ( f.exists() ) {
371 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); 425 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml");
372 426
373 TodoItem *item; 427 TodoItem *item;
374 for( item = todolist.first(); item; item = todolist.next()) { 428 for( item = todolist.first(); item; item = todolist.next()) {
375 if (!(item->getCompleted() == 1) ) { 429 if (!(item->getCompleted() == 1) ) {
376 count++; 430 count++;
377 if (count <= MAX_LINES_TASK) { 431 if (count <= MAX_LINES_TASK) {
378 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); 432 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
379 } 433 }
380 } 434 }
381 } 435 }
382 } 436 }
383 437
384 if (count > 0) { 438 if (count > 0) {
385 if( count == 1 ) { 439 if( count == 1 ) {
386 output = tr("There is <b> 1</b> active task: <br>" ); 440 output = tr("There is <b> 1</b> active task: <br>" );
387 } else { 441 } else {
388 output = tr("There are <b> %1</b> active tasks: <br>").arg(count); 442 output = tr("There are <b> %1</b> active tasks: <br>").arg(count);
389 } 443 }
390 output += tmpout; 444 output += tmpout;
391 } else { 445 } else {
392 output = tr("No active tasks"); 446 output = tr("No active tasks");
393 } 447 }
394 448
395 TodoField->setText(tr(output)); 449 TodoField->setText(tr(output));
396} 450}
397 451
398/* 452/*
399 * launches datebook 453 * launches datebook
400 */ 454 */
401void Today::startDatebook() { 455void Today::startDatebook() {
402 QCopEnvelope e("QPE/System", "execute(QString)"); 456 QCopEnvelope e("QPE/System", "execute(QString)");
403 e << QString("datebook"); 457 e << QString("datebook");
404} 458}
459
460/*
461 * starts the edit dialog as known from datebook
462 */
405void Today::editEvent(const Event &e) { 463void Today::editEvent(const Event &e) {
406 startDatebook(); 464 startDatebook();
407 465
408 //Dissabled for now as uid's not working properly 466 //Dissabled for now as uid's not working properly
409 /* 467 /*
410 while(!QCopChannel::isRegistered("QPE/Datebook")) sleep(1); 468 while(!QCopChannel::isRegistered("QPE/Datebook")) sleep(1);
411 QCopEnvelope env("QPE/Datebook", "editEvent(int)"); 469 QCopEnvelope env("QPE/Datebook", "editEvent(int)");
412 env << e.uid(); 470 env << e.uid();
413 */ 471 */
414} 472}
415 473
416/* 474/*
417 * launches todolist 475 * launches todolist
418 */ 476 */
419void Today::startTodo() { 477void Today::startTodo() {
420 QCopEnvelope e("QPE/System", "execute(QString)"); 478 QCopEnvelope e("QPE/System", "execute(QString)");
421 e << QString("todolist"); 479 e << QString("todolist");
422} 480}
423 481
424/* 482/*
425 * launch opiemail 483 * launch opiemail
426 */ 484 */
427void Today::startMail() { 485void Today::startMail() {
428 QCopEnvelope e("QPE/System", "execute(QString)"); 486 QCopEnvelope e("QPE/System", "execute(QString)");
429 e << QString("opiemail"); 487 e << QString("opiemail");
430} 488}
431 489
432/* 490
433 * Destroys the object and frees any allocated resources
434 */
435Today::~Today() { 491Today::~Today() {
436 // no need to delete child widgets, Qt does it all for us
437} 492}
438 493
439 494
495
496/*
497 * Gets the events for the current day, if it should get all dates
498 */
440DateBookEvent::DateBookEvent(const EffectiveEvent &ev, 499DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
441 QWidget* parent = 0, 500 QWidget* parent = 0,
442 const char* name = 0, 501 const char* name = 0,
443 WFlags fl = 0) : 502 WFlags fl = 0) :
444 ClickableLabel(parent,name,fl), event(ev) { 503 ClickableLabel(parent,name,fl), event(ev) {
445 504
446 QString msg; 505 QString msg;
447 QTime time = QTime::currentTime(); 506 QTime time = QTime::currentTime();
448 507
449 if (!ONLY_LATER) { 508 if (!ONLY_LATER) {
450 msg += "<B>" + (ev).description() + "</B>"; 509 msg += "<B>" + (ev).description() + "</B>";
451 if ( (ev).event().hasAlarm() ) { 510 if ( (ev).event().hasAlarm() ) {
452 msg += " <b>[with alarm]</b>"; 511 msg += " <b>[with alarm]</b>";
453 } 512 }
454 // include location or not 513 // include location or not
455 if (SHOW_LOCATION == 1) { 514 if (SHOW_LOCATION == 1) {
456 msg += "<BR><i>" + (ev).location(); 515 msg += "<BR><i>" + (ev).location();
457 msg += "</i>"; 516 msg += "</i>";
458 } 517 }
459 518
460 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { 519 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
461 msg += "<br>All day"; 520 msg += "<br>All day";
462 } else { 521 } else {
463 // start time of event 522 // start time of event
464 msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) 523 msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) )
465 // end time of event 524 // end time of event
466 + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); 525 + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) );
467 } 526 }
527
468 // include possible note or not 528 // include possible note or not
469 if (SHOW_NOTES == 1) { 529 if (SHOW_NOTES == 1) {
470 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 530 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
471 } 531 }
472 } 532 }
473 setText(msg); 533 setText(msg);
474 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 534 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
475 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 535 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
476} 536}
477 537
478 538
479DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, 539DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
480 QWidget* parent = 0, 540 QWidget* parent = 0,
481 const char* name = 0, 541 const char* name = 0,
482 WFlags fl = 0) : 542 WFlags fl = 0) :
483 ClickableLabel(parent,name,fl), event(ev) { 543 ClickableLabel(parent,name,fl), event(ev) {
484 544
485 QString msg; 545 QString msg;
486 QTime time = QTime::currentTime(); 546 QTime time = QTime::currentTime();
487 547
488 if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { 548 if ((time.toString() <= TimeString::dateString((ev).event().end())) ) {
489 // show only later appointments 549 // show only later appointments
490 msg += "<B>" + (ev).description() + "</B>"; 550 msg += "<B>" + (ev).description() + "</B>";
491 if ( (ev).event().hasAlarm() ) { 551 if ( (ev).event().hasAlarm() ) {
492 msg += " <b>[with alarm]</b>"; 552 msg += " <b>[with alarm]</b>";
493 } 553 }
494 // include location or not 554 // include location or not
495 if (SHOW_LOCATION == 1) { 555 if (SHOW_LOCATION == 1) {
496 msg += "<BR><i>" + (ev).location(); 556 msg += "<BR><i>" + (ev).location();
497 msg += "</i>"; 557 msg += "</i>";
498 } 558 }
499 559
500 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { 560 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
501 msg += "<br>All day"; 561 msg += "<br>All day";
502 } else { 562 } else {
503 // start time of event 563 // start time of event
504 msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) 564 msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) )
505 // end time of event 565 // end time of event
506 + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); 566 + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) );
507 } 567 }
508 // include possible note or not 568 // include possible note or not
509 if (SHOW_NOTES == 1) { 569 if (SHOW_NOTES == 1) {
510 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 570 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
511 } 571 }
512 } 572 }
513 573
514 // if (msg.isEmpty()) { 574 // if (msg.isEmpty()) {
515 // msg = tr("No more appointments today"); 575 // msg = tr("No more appointments today");
516 // } 576 // }
517 setText(msg); 577 setText(msg);
518 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 578 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
519 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 579 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
520} 580}
521 581
582
522void DateBookEvent::editMe() { 583void DateBookEvent::editMe() {
523 emit editEvent(event.event()); 584 emit editEvent(event.event());
524} 585}
525 586
526void DateBookEventLater::editMe() { 587void DateBookEventLater::editMe() {
527 emit editEvent(event.event()); 588 emit editEvent(event.event());
528} 589}
529 590
530 591
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 0b4356c..6dec2c2 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -1,100 +1,105 @@
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 23
24#include <qpe/datebookdb.h> 24#include <qpe/datebookdb.h>
25#include <qpe/event.h> 25#include <qpe/event.h>
26 26
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlist.h> 28#include <qlist.h>
29 29
30#include "TodoItem.h" 30#include "TodoItem.h"
31#include "todayconfig.h" 31#include "todayconfig.h"
32#include "todaybase.h" 32#include "todaybase.h"
33#include "clickablelabel.h" 33#include "clickablelabel.h"
34 34
35class QVBoxLayout; 35class QVBoxLayout;
36 36
37class Today : public TodayBase { 37class Today : public TodayBase {
38 Q_OBJECT 38 Q_OBJECT
39 39
40 public: 40 public:
41 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 41 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
42 ~Today(); 42 ~Today();
43 43
44 private slots: 44 private slots:
45 void startConfig(); 45 void startConfig();
46 void startTodo(); 46 void startTodo();
47 void startDatebook(); 47 void startDatebook();
48 void startMail(); 48 void startMail();
49 void draw(); 49 void draw();
50 void editEvent(const Event &e); 50 void editEvent(const Event &e);
51 private: 51 private:
52 void init(); 52 void init();
53 void getDates(); 53 void getDates();
54 void getTodo(); 54 void getTodo();
55 void getMail(); 55 void getMail();
56 void autoStart(); 56 void autoStart();
57 bool checkIfModified(); 57 bool checkIfModified();
58 void setOwnerField();
59 void setOwnerField(QString &string);
58 QList<TodoItem> loadTodo(const char *filename); 60 QList<TodoItem> loadTodo(const char *filename);
61private slots:
62 void channelReceived(const QCString &msg, const QByteArray & data);
63
59 private: 64 private:
60 DateBookDB *db; 65 DateBookDB *db;
61 todayconfig *conf; 66 todayconfig *conf;
62 QWidget* AllDateBookEvents; 67 QWidget* AllDateBookEvents;
63 //Config cfg; 68 //Config cfg;
64 int MAX_LINES_TASK; 69 int MAX_LINES_TASK;
65 int MAX_CHAR_CLIP; 70 int MAX_CHAR_CLIP;
66 int MAX_LINES_MEET; 71 int MAX_LINES_MEET;
67 int SHOW_LOCATION; 72 int SHOW_LOCATION;
68 int SHOW_NOTES; 73 int SHOW_NOTES;
69}; 74};
70 75
71class DateBookEvent: public ClickableLabel { 76class DateBookEvent: public ClickableLabel {
72 Q_OBJECT 77 Q_OBJECT
73public: 78public:
74 DateBookEvent(const EffectiveEvent &ev, 79 DateBookEvent(const EffectiveEvent &ev,
75 QWidget* parent = 0, const char* name = 0, 80 QWidget* parent = 0, const char* name = 0,
76 WFlags fl = 0); 81 WFlags fl = 0);
77signals: 82signals:
78 void editEvent(const Event &e); 83 void editEvent(const Event &e);
79private slots: 84private slots:
80 void editMe(); 85 void editMe();
81private: 86private:
82 const EffectiveEvent event; 87 const EffectiveEvent event;
83}; 88};
84 89
85class DateBookEventLater: public ClickableLabel { 90class DateBookEventLater: public ClickableLabel {
86 Q_OBJECT 91 Q_OBJECT
87public: 92public:
88 DateBookEventLater(const EffectiveEvent &ev, 93 DateBookEventLater(const EffectiveEvent &ev,
89 QWidget* parent = 0, const char* name = 0, 94 QWidget* parent = 0, const char* name = 0,
90 WFlags fl = 0); 95 WFlags fl = 0);
91signals: 96signals:
92 void editEvent(const Event &e); 97 void editEvent(const Event &e);
93private slots: 98private slots:
94 void editMe(); 99 void editMe();
95private: 100private:
96 const EffectiveEvent event; 101 const EffectiveEvent event;
97}; 102};
98 103
99#endif // TODAY_H 104#endif // TODAY_H
100 105
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index 552e2eb..c0b8d34 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -1,197 +1,192 @@
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 54
55 QWidget *d = QApplication::desktop(); 55 QWidget *d = QApplication::desktop();
56 int w=d->width(); 56 int w=d->width();
57 int h=d->height(); 57 int h=d->height();
58 resize( w , h ); 58 resize( w , h );
59 59
60 // hehe, qt is ... 60 // hehe, qt is ...
61 getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" ); 61 getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" );
62 getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) ); 62 getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) );
63 63
64 QVBoxLayout * layout = new QVBoxLayout(this); 64 QVBoxLayout * layout = new QVBoxLayout(this);
65 65
66 // --- logo Section --- 66 // --- logo Section ---
67 QPalette pal2; 67 QPalette pal2;
68 QColorGroup cg; 68 QColorGroup cg;
69 cg.setColor( QColorGroup::Text, white ); 69 cg.setColor( QColorGroup::Text, white );
70 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) ); 70 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) );
71 pal2.setActive( cg ); 71 pal2.setActive( cg );
72 // today logo 72 // today logo
73 Frame = new QLabel( this, "Frame" ); 73 Frame = new QLabel( this, "Frame" );
74 Frame->setPalette( pal2 ); 74 Frame->setPalette( pal2 );
75 Frame->setFrameShape( QFrame::StyledPanel ); 75 Frame->setFrameShape( QFrame::StyledPanel );
76 Frame->setFrameShadow( QFrame::Raised ); 76 Frame->setFrameShadow( QFrame::Raised );
77 Frame->setLineWidth( 0 ); 77 Frame->setLineWidth( 0 );
78 Frame->setMaximumHeight(50); 78 Frame->setMaximumHeight(50);
79 Frame->setMinimumHeight(50); 79 Frame->setMinimumHeight(50);
80 // date 80 // date
81 TextLabel1 = new QLabel( Frame, "TextLabel1" ); 81 TextLabel1 = new QLabel( Frame, "TextLabel1" );
82 TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) ); 82 TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) );
83 QFont TextLabel1_font( TextLabel1->font() ); 83 QFont TextLabel1_font( TextLabel1->font() );
84 TextLabel1_font.setBold( TRUE ); 84 TextLabel1_font.setBold( TRUE );
85 TextLabel1->setFont( TextLabel1_font ); 85 TextLabel1->setFont( TextLabel1_font );
86 TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin ); 86 TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin );
87 TextLabel1->setTextFormat( RichText ); 87 TextLabel1->setTextFormat( RichText );
88 88
89 89 OwnerField = new QLabel(this , "Owner" );
90 OwnerField->setGeometry(QRect(0,0, this->width(), 12 ));
91 OwnerField->setAlignment(int (QLabel::AlignTop | QLabel::AlignLeft ) );
92 OwnerField->setMaximumHeight(12);
93
90 // --- dates section --- 94 // --- dates section ---
91 Frame4 = new QFrame( this, "Frame4" ); 95 Frame4 = new QFrame( this, "Frame4" );
92 Frame4->setPalette( pal ); 96 Frame4->setPalette( pal );
93 Frame4->setFrameShape( QScrollView::StyledPanel ); 97 Frame4->setFrameShape( QScrollView::StyledPanel );
94 Frame4->setFrameShadow( QScrollView::Sunken ); 98 Frame4->setFrameShadow( QScrollView::Sunken );
95 Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); 99 Frame4->setBackgroundOrigin( QScrollView::ParentOrigin );
96 Frame4->setFrameStyle( QFrame::NoFrame ); 100 Frame4->setFrameStyle( QFrame::NoFrame );
97 Frame4->setGeometry (QRect( 0, 0, this->width() , this->height()) ); 101 Frame4->setGeometry (QRect( 0, 8, this->width() , this->height()) );
98 102
99 // QScrollView* sv1 = new QScrollView( Frame4 );
100 sv1 = new QScrollView( Frame4 ); 103 sv1 = new QScrollView( Frame4 );
101 sv1->setResizePolicy(QScrollView::AutoOneFit); 104 sv1->setResizePolicy(QScrollView::AutoOneFit);
102 sv1->setHScrollBarMode( QScrollView::AlwaysOff ); 105 sv1->setHScrollBarMode( QScrollView::AlwaysOff );
103 // need to find a better way!!! 106 // need to find a better way!!!
104 sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) ); 107 sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) );
105 sv1->setFrameShape(QFrame::NoFrame); 108 sv1->setFrameShape(QFrame::NoFrame);
106 109
107 DatesButton = new QPushButton (Frame4, "DatesButton" ); 110 DatesButton = new QPushButton (Frame4, "DatesButton" );
108 DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); 111 DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) );
109 DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); 112 DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin );
110 DatesButton->setPalette( pal ); 113 DatesButton->setPalette( pal );
111 DatesButton->setPixmap( datebook ); 114 DatesButton->setPixmap( datebook );
112 DatesButton->setFlat( TRUE ); 115 DatesButton->setFlat( TRUE );
113 116
114 //DatesField = new QLabel( sv1->viewport(), "DatesField" ); 117 // --- mail section ---)
115 //DatesField = new QVBox(sv1->viewport());
116 //QWidget *dummy = new QWidget(sv1->viewport());
117 //sv1->addChild(DatesField);
118 //DatesField->setText( tr( "No appointments today" ) );
119 // DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
120
121
122 // --- mail section ---)
123 MailFrame = new QFrame( this ,"MailFrame" ); 118 MailFrame = new QFrame( this ,"MailFrame" );
124 MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin ); 119 MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin );
125 MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) ); 120 MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) );
126 MailFrame->setFrameStyle( QFrame::NoFrame ); 121 MailFrame->setFrameStyle( QFrame::NoFrame );
127 122
128 QFrame* Line1 = new QFrame( MailFrame); 123 QFrame* Line1 = new QFrame( MailFrame);
129 Line1->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) ); 124 Line1->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) );
130 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 125 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
131 126
132 MailButton = new QPushButton (MailFrame, "MailButton" ); 127 MailButton = new QPushButton (MailFrame, "MailButton" );
133 MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); 128 MailButton->setGeometry( QRect( 2, 3, 36, 19 ) );
134 MailButton->setPalette( pal ); 129 MailButton->setPalette( pal );
135 MailButton->setPixmap( mail ); 130 MailButton->setPixmap( mail );
136 MailButton->setFlat( TRUE ); 131 MailButton->setFlat( TRUE );
137 132
138 MailField = new QLabel( MailFrame, "MailField" ); 133 MailField = new QLabel( MailFrame, "MailField" );
139 MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) ); 134 MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) );
140 MailField->setText( tr( "Opiemail not installed" ) ); 135 MailField->setText( tr( "Opiemail not installed" ) );
141 MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); 136 MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
142 MailField->setMaximumHeight(40); 137 MailField->setMaximumHeight(40);
143 MailField->setMinimumHeight(15); 138 MailField->setMinimumHeight(15);
144 139
145
146 // --- todo section -- 140 // --- todo section --
147 Frame15 = new QFrame( this, "Frame15" ); 141 Frame15 = new QFrame( this, "Frame15" );
148 Frame15->setFrameStyle( QFrame::NoFrame ); 142 Frame15->setFrameStyle( QFrame::NoFrame );
149 Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) ); 143 Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) );
150 144
151 QFrame* Line2 = new QFrame( Frame15); 145 QFrame* Line2 = new QFrame( Frame15);
152 Line2->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) ); 146 Line2->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) );
153 Line2->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 147 Line2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
154 148
155 TodoButton = new QPushButton (Frame15, "TodoButton" ); 149 TodoButton = new QPushButton (Frame15, "TodoButton" );
156 TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) ); 150 TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) );
157 TodoButton->setPalette( pal ); 151 TodoButton->setPalette( pal );
158 TodoButton->setPixmap( todo ); 152 TodoButton->setPixmap( todo );
159 TodoButton->setFlat( TRUE ); 153 TodoButton->setFlat( TRUE );
160 154
161 QScrollView* sv2 = new QScrollView( Frame15 ); 155 QScrollView* sv2 = new QScrollView( Frame15 );
162 sv2->setResizePolicy(QScrollView::AutoOneFit); 156 sv2->setResizePolicy(QScrollView::AutoOneFit);
163 sv2->setHScrollBarMode( QScrollView::AlwaysOff ); 157 sv2->setHScrollBarMode( QScrollView::AlwaysOff );
164 sv2->setGeometry (QRect( 40, 3, Frame15->width()-40 , (Frame15->height()/3) ) ); 158 sv2->setGeometry (QRect( 40, 3, Frame15->width()-40 , (Frame15->height()/3) ) );
165 sv2->setFrameShape(QFrame::NoFrame); 159 sv2->setFrameShape(QFrame::NoFrame);
166 160
167 TodoField = new QLabel( sv2->viewport(), "TodoField" ); 161 TodoField = new QLabel( sv2->viewport(), "TodoField" );
168 sv2->addChild(TodoField); 162 sv2->addChild(TodoField);
169 TodoField->setFrameShadow( QLabel::Plain ); 163 TodoField->setFrameShadow( QLabel::Plain );
170 //TodoField->setText( tr( "No current todos" ) ); 164 //TodoField->setText( tr( "No current todos" ) );
171 TodoField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); 165 TodoField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
172 166
173 PushButton1 = new QPushButton (Frame15, "PushButton1" ); 167 PushButton1 = new QPushButton (Frame15, "PushButton1" );
174 PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) ); 168 PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) );
175 PushButton1->setPixmap( config ); 169 PushButton1->setPixmap( config );
176 PushButton1->setPalette( pal ); 170 PushButton1->setPalette( pal );
177 PushButton1->setAutoDefault( TRUE ); 171 PushButton1->setAutoDefault( TRUE );
178 PushButton1->setFlat( TRUE ); 172 PushButton1->setFlat( TRUE );
179 173
180 // -- layout -- 174 // -- layout --
181 layout->addWidget(Frame); 175 layout->addWidget(Frame);
176 layout->addWidget(OwnerField);
182 layout->addWidget(Frame4); 177 layout->addWidget(Frame4);
183 layout->addWidget(MailFrame); 178 layout->addWidget(MailFrame);
184 layout->addWidget(Frame15); 179 layout->addWidget(Frame15);
185 180
186 layout->setStretchFactor(Frame4,5); 181 layout->setStretchFactor(Frame4,5);
187 layout->setStretchFactor(MailFrame,1); 182 layout->setStretchFactor(MailFrame,1);
188 layout->setStretchFactor(Frame15,4); 183 layout->setStretchFactor(Frame15,4);
189} 184}
190 185
191/* 186/*
192 * Destroys the object and frees any allocated resources 187 * Destroys the object and frees any allocated resources
193 */ 188 */
194TodayBase::~TodayBase() 189TodayBase::~TodayBase()
195{ 190{
196} 191}
197 192
diff --git a/core/pim/today/todaybase.h b/core/pim/today/todaybase.h
index 8840125..0118faa 100644
--- a/core/pim/today/todaybase.h
+++ b/core/pim/today/todaybase.h
@@ -1,54 +1,54 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file 'todaybase.ui' 2** Form interface generated from reading ui file 'todaybase.ui'
3** 3**
4** Created: Wed Feb 13 19:36:45 2002 4** Created: Wed Feb 13 19:36:45 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 TODAYBASE_H 9#ifndef TODAYBASE_H
10#define TODAYBASE_H 10#define TODAYBASE_H
11 11
12#include <qvariant.h> 12#include <qvariant.h>
13#include <qwidget.h> 13#include <qwidget.h>
14#include <qscrollview.h> 14#include <qscrollview.h>
15#include <qsplitter.h> 15#include <qsplitter.h>
16 16
17class QVBox; 17class QVBox;
18class QHBoxLayout; 18class QHBoxLayout;
19class QGridLayout; 19class QGridLayout;
20class QFrame; 20class QFrame;
21class QLabel; 21class QLabel;
22class QPushButton; 22class QPushButton;
23 23
24class TodayBase : public QWidget 24class TodayBase : public QWidget
25{ 25{
26 Q_OBJECT 26 Q_OBJECT
27 27
28public: 28public:
29 TodayBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 29 TodayBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
30 ~TodayBase(); 30 ~TodayBase();
31 31
32 //QScrollView* Frame4; 32 //QScrollView* Frame4;
33 QFrame* Frame4; 33 QFrame* Frame4;
34 QPushButton* DatesButton; 34 QPushButton* DatesButton;
35 //QLabel* DatesField; 35 QLabel* OwnerField;
36 QLabel* Frame; 36 QLabel* Frame;
37 QFrame* MailFrame; 37 QFrame* MailFrame;
38 QLabel* TextLabel1; 38 QLabel* TextLabel1;
39 QScrollView* sv1; 39 QScrollView* sv1;
40 QVBox* DatesField; 40 QVBox* DatesField;
41 QFrame* Frame15; 41 QFrame* Frame15;
42 QLabel* TodoField; 42 QLabel* TodoField;
43 QLabel* MailField; 43 QLabel* MailField;
44 QPushButton* PushButton1; 44 QPushButton* PushButton1;
45 QPushButton* TodoButton; 45 QPushButton* TodoButton;
46 QPushButton* MailButton; 46 QPushButton* MailButton;
47 QPushButton* getridoffuckingstrippeldlinesbutton; 47 QPushButton* getridoffuckingstrippeldlinesbutton;
48 48
49protected: 49protected:
50 50
51 51
52}; 52};
53 53
54#endif // TODAYBASE_H 54#endif // TODAYBASE_H