-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 | |||
@@ -29,32 +29,33 @@ | |||
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 | /* |
@@ -114,46 +115,47 @@ void Today::setOwnerField() { | |||
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 | } |
@@ -248,46 +250,48 @@ void Today::startConfig() { | |||
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; |
@@ -440,33 +444,33 @@ void Today::editEvent(const Event &e) { | |||
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) { |