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