author | harlekin <harlekin> | 2002-04-24 21:01:23 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-24 21:01:23 (UTC) |
commit | b15d6ac87e3579992234d4903a34f367d6fa58b4 (patch) (unidiff) | |
tree | 3160d16b2db8f62089a2e1ce0382735914aa405e | |
parent | feaa245515b0746f6f70f590411c38e0a54c88ee (diff) | |
download | opie-b15d6ac87e3579992234d4903a34f367d6fa58b4.zip opie-b15d6ac87e3579992234d4903a34f367d6fa58b4.tar.gz opie-b15d6ac87e3579992234d4903a34f367d6fa58b4.tar.bz2 |
fix
-rw-r--r-- | core/pim/today/today.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 87a7970..0ab7a2a 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,191 +1,193 @@ | |||
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 | //#include <iostream.h> | 46 | //#include <iostream.h> |
46 | #include <unistd.h> | 47 | #include <unistd.h> |
47 | #include <stdlib.h> | 48 | #include <stdlib.h> |
48 | 49 | ||
49 | int MAX_LINES_TASK; | 50 | int MAX_LINES_TASK; |
50 | int MAX_CHAR_CLIP; | 51 | int MAX_CHAR_CLIP; |
51 | int MAX_LINES_MEET; | 52 | int MAX_LINES_MEET; |
52 | int SHOW_LOCATION; | 53 | int SHOW_LOCATION; |
53 | int SHOW_NOTES; | 54 | int SHOW_NOTES; |
54 | // show only later dates | 55 | // show only later dates |
55 | int ONLY_LATER; | 56 | int ONLY_LATER; |
56 | int AUTOSTART; | 57 | int AUTOSTART; |
57 | int NEW_START=1; | 58 | int NEW_START=1; |
58 | QString AUTOSTART_TIMER; | 59 | QString AUTOSTART_TIMER; |
59 | 60 | ||
60 | /* | 61 | /* |
61 | * Constructs a Example which is a child of 'parent', with the | 62 | * Constructs a Example which is a child of 'parent', with the |
62 | * name 'name' and widget flags set to 'f' | 63 | * name 'name' and widget flags set to 'f' |
63 | */ | 64 | */ |
64 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 65 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
65 | : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { | 66 | : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { |
66 | QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); | 67 | QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); |
67 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); | 68 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); |
68 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); | 69 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); |
69 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); | 70 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); |
70 | 71 | ||
71 | #if defined(Q_WS_QWS) | 72 | #if defined(Q_WS_QWS) |
72 | #if !defined(QT_NO_COP) | 73 | #if !defined(QT_NO_COP) |
73 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); | 74 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); |
74 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 75 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
75 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); | 76 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); |
76 | #endif | 77 | #endif |
77 | #endif | 78 | #endif |
78 | 79 | ||
79 | 80 | ||
80 | 81 | ||
81 | db = NULL; | 82 | db = NULL; |
82 | setOwnerField(); | 83 | setOwnerField(); |
83 | todo = new ToDoDB; | 84 | todo = new ToDoDB; |
84 | getTodo(); | 85 | getTodo(); |
85 | draw(); | 86 | draw(); |
86 | autoStart(); | 87 | autoStart(); |
87 | } | 88 | } |
88 | 89 | ||
89 | /* | 90 | /* |
90 | * Qcop receive method. | 91 | * Qcop receive method. |
91 | */ | 92 | */ |
92 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { | 93 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { |
93 | QDataStream stream(data, IO_ReadOnly ); | 94 | QDataStream stream(data, IO_ReadOnly ); |
94 | if ( msg == "message(QString)" ) { | 95 | if ( msg == "message(QString)" ) { |
95 | QString message; | 96 | QString message; |
96 | stream >> message; | 97 | stream >> message; |
97 | setOwnerField(message); | 98 | setOwnerField(message); |
98 | } | 99 | } |
99 | 100 | ||
100 | } | 101 | } |
101 | 102 | ||
102 | /* | 103 | /* |
103 | * Initialises the owner field with the default value, the username | 104 | * Initialises the owner field with the default value, the username |
104 | */ | 105 | */ |
105 | void Today::setOwnerField() { | 106 | void Today::setOwnerField() { |
106 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); | 107 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); |
107 | if (QFile::exists(file)) { | 108 | if (QFile::exists(file)) { |
108 | Contact cont = Contact::readVCard(file)[0]; | 109 | Contact cont = Contact::readVCard(file)[0]; |
109 | QString returnString = cont.fullName(); | 110 | QString returnString = cont.fullName(); |
110 | OwnerField->setText( "<b>" +tr ("Owned by ") + returnString + "</b>"); | 111 | OwnerField->setText( "<b>" +tr ("Owned by ") + returnString + "</b>"); |
111 | } else { | 112 | } else { |
112 | OwnerField->setText( "<b>" + tr ("Please fill out the business card")+" </b>"); | 113 | OwnerField->setText( "<b>" + tr ("Please fill out the business card")+" </b>"); |
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||
116 | /* | 117 | /* |
117 | * Set the owner field with a given QString, for example per qcop. | 118 | * Set the owner field with a given QString, for example per qcop. |
118 | */ | 119 | */ |
119 | void Today::setOwnerField(QString &message) { | 120 | void Today::setOwnerField(QString &message) { |
120 | if (!message.isEmpty()) { | 121 | if (!message.isEmpty()) { |
121 | OwnerField->setText("<b>" + message + "</b>"); | 122 | OwnerField->setText("<b>" + message + "</b>"); |
122 | } | 123 | } |
123 | } | 124 | } |
124 | 125 | ||
125 | /* | 126 | /* |
126 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 127 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
127 | * If registered against that today ist started on each resume. | 128 | * If registered against that today ist started on each resume. |
128 | */ | 129 | */ |
129 | void Today::autoStart() { | 130 | void Today::autoStart() { |
130 | // Config cfg("today"); | 131 | Config cfg("today"); |
131 | //cfg.setGroup("Autostart"); | 132 | cfg.setGroup("Autostart"); |
132 | //AUTOSTART = cfg.readNumEntry("autostart",1); | 133 | int AUTOSTART = cfg.readNumEntry("autostart",1); |
133 | 134 | qDebug(QString("%1").arg(AUTOSTART)); | |
134 | if (AUTOSTART) { | 135 | if (AUTOSTART) { |
135 | QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)"); | 136 | QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)"); |
136 | e << QString("add"); | 137 | e << QString("add"); |
137 | e << QString("today"); | 138 | e << QString("today"); |
138 | e << AUTOSTART_TIMER; | 139 | e << AUTOSTART_TIMER; |
139 | } else { | 140 | } else { |
140 | QCopEnvelope e("QPE/System", "autoStart(QString, QString)"); | 141 | qDebug("Nun in else bei autostart"); |
141 | e << QString("remove"); | 142 | QCopEnvelope e("QPE/System", "autoStart(QString, QString)"); |
142 | e << QString("today"); | 143 | e << QString("remove"); |
143 | } | 144 | e << QString("today"); |
145 | } | ||
144 | } | 146 | } |
145 | 147 | ||
146 | /* | 148 | /* |
147 | * Repaint method. Reread all fields. | 149 | * Repaint method. Reread all fields. |
148 | */ | 150 | */ |
149 | void Today::draw() { | 151 | void Today::draw() { |
150 | init(); | 152 | init(); |
151 | getDates(); | 153 | getDates(); |
152 | getMail(); | 154 | getMail(); |
153 | 155 | ||
154 | // if the todolist.xml file was not modified in between, do not parse it. | 156 | // if the todolist.xml file was not modified in between, do not parse it. |
155 | if (checkIfModified()) { | 157 | if (checkIfModified()) { |
156 | if (todo) delete todo; | 158 | if (todo) delete todo; |
157 | todo = new ToDoDB; | 159 | todo = new ToDoDB; |
158 | getTodo(); | 160 | getTodo(); |
159 | } | 161 | } |
160 | 162 | ||
161 | // how often refresh | 163 | // how often refresh |
162 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); | 164 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); |
163 | } | 165 | } |
164 | 166 | ||
165 | /* | 167 | /* |
166 | * Check if the todolist.xml was modified (if there are new entries. | 168 | * Check if the todolist.xml was modified (if there are new entries. |
167 | * Returns true if it was modified. | 169 | * Returns true if it was modified. |
168 | */ | 170 | */ |
169 | bool Today::checkIfModified() { | 171 | bool Today::checkIfModified() { |
170 | 172 | ||
171 | QDir dir; | 173 | QDir dir; |
172 | QString homedir = dir.homeDirPath (); | 174 | QString homedir = dir.homeDirPath (); |
173 | QString time; | 175 | QString time; |
174 | 176 | ||
175 | Config cfg("today"); | 177 | Config cfg("today"); |
176 | cfg.setGroup("Files"); | 178 | cfg.setGroup("Files"); |
177 | time = cfg.readEntry("todolisttimestamp", ""); | 179 | time = cfg.readEntry("todolisttimestamp", ""); |
178 | 180 | ||
179 | QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); | 181 | QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); |
180 | QDateTime fileTime = file.lastModified(); | 182 | QDateTime fileTime = file.lastModified(); |
181 | if (time.compare(fileTime.toString()) == 0) { | 183 | if (time.compare(fileTime.toString()) == 0) { |
182 | return false; | 184 | return false; |
183 | } else { | 185 | } else { |
184 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); | 186 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); |
185 | cfg.write(); | 187 | cfg.write(); |
186 | return true; | 188 | return true; |
187 | } | 189 | } |
188 | } | 190 | } |
189 | 191 | ||
190 | 192 | ||
191 | /* | 193 | /* |
@@ -216,110 +218,112 @@ void Today::init() { | |||
216 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | 218 | ONLY_LATER = cfg.readNumEntry("onlylater",1); |
217 | 219 | ||
218 | cfg.setGroup("Autostart"); | 220 | cfg.setGroup("Autostart"); |
219 | AUTOSTART = cfg.readNumEntry("autostart",1); | 221 | AUTOSTART = cfg.readNumEntry("autostart",1); |
220 | AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0"); | 222 | AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0"); |
221 | 223 | ||
222 | //db = new DateBookDB; | 224 | //db = new DateBookDB; |
223 | } | 225 | } |
224 | 226 | ||
225 | /* | 227 | /* |
226 | * The method for the configuration dialog. | 228 | * The method for the configuration dialog. |
227 | */ | 229 | */ |
228 | void Today::startConfig() { | 230 | void Today::startConfig() { |
229 | 231 | ||
230 | conf = new todayconfig ( this, "", true ); | 232 | conf = new todayconfig ( this, "", true ); |
231 | // read the config | 233 | // read the config |
232 | Config cfg("today"); | 234 | Config cfg("today"); |
233 | cfg.setGroup("BaseConfig"); | 235 | cfg.setGroup("BaseConfig"); |
234 | 236 | ||
235 | //init(); | 237 | //init(); |
236 | 238 | ||
237 | conf->SpinBox1->setValue(MAX_LINES_MEET); | 239 | conf->SpinBox1->setValue(MAX_LINES_MEET); |
238 | // location show box | 240 | // location show box |
239 | conf->CheckBox1->setChecked(SHOW_LOCATION); | 241 | conf->CheckBox1->setChecked(SHOW_LOCATION); |
240 | // notes show box | 242 | // notes show box |
241 | conf->CheckBox2->setChecked(SHOW_NOTES); | 243 | conf->CheckBox2->setChecked(SHOW_NOTES); |
242 | // task lines | 244 | // task lines |
243 | conf->SpinBox2->setValue(MAX_LINES_TASK); | 245 | conf->SpinBox2->setValue(MAX_LINES_TASK); |
244 | // clip when? | 246 | // clip when? |
245 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); | 247 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); |
246 | // only later | 248 | // only later |
247 | conf->CheckBox3->setChecked(ONLY_LATER); | 249 | conf->CheckBox3->setChecked(ONLY_LATER); |
248 | // if today should be autostarted | 250 | // if today should be autostarted |
249 | conf->CheckBoxAuto->setChecked(AUTOSTART); | 251 | conf->CheckBoxAuto->setChecked(AUTOSTART); |
250 | // autostart only if device has been suspended for X minutes | 252 | // autostart only if device has been suspended for X minutes |
251 | conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() ); | 253 | conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() ); |
252 | 254 | ||
253 | conf->exec(); | 255 | conf->exec(); |
254 | 256 | ||
255 | int maxlinestask = conf->SpinBox2->value(); | 257 | int maxlinestask = conf->SpinBox2->value(); |
256 | int maxmeet = conf->SpinBox1->value(); | 258 | int maxmeet = conf->SpinBox1->value(); |
257 | int location = conf->CheckBox1->isChecked(); | 259 | int location = conf->CheckBox1->isChecked(); |
258 | int notes = conf->CheckBox2->isChecked(); | 260 | int notes = conf->CheckBox2->isChecked(); |
259 | int maxcharclip = conf->SpinBox7->value(); | 261 | int maxcharclip = conf->SpinBox7->value(); |
260 | int onlylater = conf->CheckBox3->isChecked(); | 262 | int onlylater = conf->CheckBox3->isChecked(); |
261 | int autostart = conf->CheckBoxAuto->isChecked(); | 263 | int autostart = conf->CheckBoxAuto->isChecked(); |
262 | int autostartdelay = conf->SpinBoxTime->value(); | 264 | int autostartdelay = conf->SpinBoxTime->value(); |
263 | 265 | ||
266 | |||
264 | cfg.writeEntry("maxlinestask",maxlinestask); | 267 | cfg.writeEntry("maxlinestask",maxlinestask); |
265 | cfg.writeEntry("maxcharclip", maxcharclip); | 268 | cfg.writeEntry("maxcharclip", maxcharclip); |
266 | cfg.writeEntry("maxlinesmeet",maxmeet); | 269 | cfg.writeEntry("maxlinesmeet",maxmeet); |
267 | cfg.writeEntry("showlocation",location); | 270 | cfg.writeEntry("showlocation",location); |
268 | cfg.writeEntry("shownotes", notes); | 271 | cfg.writeEntry("shownotes", notes); |
269 | cfg.writeEntry("onlylater", onlylater); | 272 | cfg.writeEntry("onlylater", onlylater); |
270 | cfg.setGroup("Autostart"); | 273 | cfg.setGroup("Autostart"); |
271 | cfg.writeEntry("autostart", autostart); | 274 | cfg.writeEntry("autostart", autostart); |
272 | cfg.writeEntry("autostartdelay", autostartdelay); | 275 | cfg.writeEntry("autostartdelay", autostartdelay); |
273 | 276 | ||
274 | // sync it to "disk" | 277 | // sync it to "disk" |
275 | cfg.write(); | 278 | cfg.write(); |
276 | NEW_START=1; | 279 | NEW_START=1; |
277 | draw(); | 280 | draw(); |
281 | AUTOSTART=autostart; | ||
278 | autoStart(); | 282 | autoStart(); |
279 | } | 283 | } |
280 | 284 | ||
281 | 285 | ||
282 | /* | 286 | /* |
283 | * Get all events that are in the datebook xml file for today | 287 | * Get all events that are in the datebook xml file for today |
284 | */ | 288 | */ |
285 | void Today::getDates() { | 289 | void Today::getDates() { |
286 | QDate date = QDate::currentDate(); | 290 | QDate date = QDate::currentDate(); |
287 | 291 | ||
288 | if (AllDateBookEvents) delete AllDateBookEvents; | 292 | if (AllDateBookEvents) delete AllDateBookEvents; |
289 | AllDateBookEvents = new QWidget( ); | 293 | AllDateBookEvents = new QWidget( ); |
290 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); | 294 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); |
291 | 295 | ||
292 | if (db) { | 296 | if (db) { |
293 | delete db; | 297 | delete db; |
294 | } | 298 | } |
295 | db = new DateBookDB; | 299 | db = new DateBookDB; |
296 | 300 | ||
297 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); | 301 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); |
298 | 302 | ||
299 | qBubbleSort(list); | 303 | qBubbleSort(list); |
300 | // printf("Get dates\n"); | 304 | // printf("Get dates\n"); |
301 | 305 | ||
302 | Config config( "qpe" ); | 306 | Config config( "qpe" ); |
303 | // if 24 h format | 307 | // if 24 h format |
304 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); | 308 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); |
305 | 309 | ||
306 | int count=0; | 310 | int count=0; |
307 | 311 | ||
308 | if ( list.count() > 0 ) { | 312 | if ( list.count() > 0 ) { |
309 | 313 | ||
310 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 314 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); |
311 | it!=list.end(); ++it ) { | 315 | it!=list.end(); ++it ) { |
312 | 316 | ||
313 | 317 | ||
314 | if ( count <= MAX_LINES_MEET ) { | 318 | if ( count <= MAX_LINES_MEET ) { |
315 | 319 | ||
316 | QTime time = QTime::currentTime(); | 320 | QTime time = QTime::currentTime(); |
317 | 321 | ||
318 | if (!ONLY_LATER) { | 322 | if (!ONLY_LATER) { |
319 | count++; | 323 | count++; |
320 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); | 324 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); |
321 | layoutDates->addWidget(l); | 325 | layoutDates->addWidget(l); |
322 | connect (l, SIGNAL(editEvent(const Event &)), | 326 | connect (l, SIGNAL(editEvent(const Event &)), |
323 | this, SLOT(editEvent(const Event &))); | 327 | this, SLOT(editEvent(const Event &))); |
324 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { | 328 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { |
325 | count++; | 329 | count++; |
@@ -408,97 +412,97 @@ void Today::getTodo() { | |||
408 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); | 412 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); |
409 | } | 413 | } |
410 | output += tmpout; | 414 | output += tmpout; |
411 | } else { | 415 | } else { |
412 | output = tr("No active tasks"); | 416 | output = tr("No active tasks"); |
413 | } | 417 | } |
414 | 418 | ||
415 | TodoField->setText(tr(output)); | 419 | TodoField->setText(tr(output)); |
416 | } | 420 | } |
417 | 421 | ||
418 | /* | 422 | /* |
419 | * launches datebook | 423 | * launches datebook |
420 | */ | 424 | */ |
421 | void Today::startDatebook() { | 425 | void Today::startDatebook() { |
422 | QCopEnvelope e("QPE/System", "execute(QString)"); | 426 | QCopEnvelope e("QPE/System", "execute(QString)"); |
423 | e << QString("datebook"); | 427 | e << QString("datebook"); |
424 | } | 428 | } |
425 | 429 | ||
426 | /* | 430 | /* |
427 | * starts the edit dialog as known from datebook | 431 | * starts the edit dialog as known from datebook |
428 | */ | 432 | */ |
429 | 433 | ||
430 | extern QPEApplication *todayApp; | 434 | extern QPEApplication *todayApp; |
431 | 435 | ||
432 | void Today::editEvent(const Event &e) { | 436 | void Today::editEvent(const Event &e) { |
433 | startDatebook(); | 437 | startDatebook(); |
434 | 438 | ||
435 | while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); | 439 | while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); |
436 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); | 440 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); |
437 | env << e.uid(); | 441 | env << e.uid(); |
438 | } | 442 | } |
439 | 443 | ||
440 | /* | 444 | /* |
441 | * launches todolist | 445 | * launches todolist |
442 | */ | 446 | */ |
443 | void Today::startTodo() { | 447 | void Today::startTodo() { |
444 | QCopEnvelope e("QPE/System", "execute(QString)"); | 448 | QCopEnvelope e("QPE/System", "execute(QString)"); |
445 | e << QString("todolist"); | 449 | e << QString("todolist"); |
446 | } | 450 | } |
447 | 451 | ||
448 | /* | 452 | /* |
449 | * launch opiemail | 453 | * launch opiemail |
450 | */ | 454 | */ |
451 | void Today::startMail() { | 455 | void Today::startMail() { |
452 | QCopEnvelope e("QPE/System", "execute(QString)"); | 456 | QCopEnvelope e("QPE/System", "execute(QString)"); |
453 | e << QString("opiemail"); | 457 | e << QString("opiemail"); |
454 | //Right now start both, maybe decide which to rum via config file .. | 458 | //Right now start both, maybe decide which to rum via config file .. |
455 | QCopEnvelope f("QPE/System", "execute(QString)"); | 459 | QCopEnvelope f("QPE/System", "execute(QString)"); |
456 | e << QString("qtmail"); | 460 | f << QString("qtmail"); |
457 | } | 461 | } |
458 | 462 | ||
459 | 463 | ||
460 | Today::~Today() { | 464 | Today::~Today() { |
461 | } | 465 | } |
462 | 466 | ||
463 | /* | 467 | /* |
464 | * Gets the events for the current day, if it should get all dates | 468 | * Gets the events for the current day, if it should get all dates |
465 | */ | 469 | */ |
466 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 470 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
467 | QWidget* parent = 0, | 471 | QWidget* parent = 0, |
468 | int SHOW_LOCATION = 0, | 472 | int SHOW_LOCATION = 0, |
469 | int SHOW_NOTES = 0, | 473 | int SHOW_NOTES = 0, |
470 | const char* name = 0, | 474 | const char* name = 0, |
471 | WFlags fl = 0) : | 475 | WFlags fl = 0) : |
472 | ClickableLabel(parent,name,fl), event(ev) { | 476 | ClickableLabel(parent,name,fl), event(ev) { |
473 | 477 | ||
474 | QString msg; | 478 | QString msg; |
475 | //QTime time = QTime::currentTime(); | 479 | //QTime time = QTime::currentTime(); |
476 | 480 | ||
477 | Config config( "qpe" ); | 481 | Config config( "qpe" ); |
478 | // if 24 h format | 482 | // if 24 h format |
479 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 483 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
480 | 484 | ||
481 | 485 | ||
482 | if (!ONLY_LATER) { | 486 | if (!ONLY_LATER) { |
483 | msg += "<B>" + (ev).description() + "</B>"; | 487 | msg += "<B>" + (ev).description() + "</B>"; |
484 | if ( (ev).event().hasAlarm() ) { | 488 | if ( (ev).event().hasAlarm() ) { |
485 | msg += " <b>[with alarm]</b>"; | 489 | msg += " <b>[with alarm]</b>"; |
486 | } | 490 | } |
487 | // include location or not | 491 | // include location or not |
488 | if (SHOW_LOCATION == 1) { | 492 | if (SHOW_LOCATION == 1) { |
489 | msg += "<BR><i>" + (ev).location() + "</i>"; | 493 | msg += "<BR><i>" + (ev).location() + "</i>"; |
490 | } | 494 | } |
491 | 495 | ||
492 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 496 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
493 | msg += "<br>All day"; | 497 | msg += "<br>All day"; |
494 | } else { | 498 | } else { |
495 | // start time of event | 499 | // start time of event |
496 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) | 500 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) |
497 | // end time of event | 501 | // end time of event |
498 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); | 502 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); |
499 | } | 503 | } |
500 | 504 | ||
501 | // include possible note or not | 505 | // include possible note or not |
502 | if (SHOW_NOTES == 1) { | 506 | if (SHOW_NOTES == 1) { |
503 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); | 507 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); |
504 | } | 508 | } |