-rw-r--r-- | core/pim/today/TODO | 2 | ||||
-rw-r--r-- | core/pim/today/changelog | 8 | ||||
-rw-r--r-- | core/pim/today/opie-today.control | 2 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 140 | ||||
-rw-r--r-- | core/pim/today/today.h | 11 | ||||
-rw-r--r-- | core/pim/today/today.pro | 6 |
6 files changed, 59 insertions, 110 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO index a3b01d2..0ff4758 100644 --- a/core/pim/today/TODO +++ b/core/pim/today/TODO | |||
@@ -1,14 +1,12 @@ | |||
1 | TODO for today: | 1 | TODO for today: |
2 | 2 | ||
3 | * start the app on "resume" (partly done) | 3 | * start the app on "resume" (partly done) |
4 | 4 | ||
5 | * show alarm icons on alarm events (partly done) | 5 | * show alarm icons on alarm events (partly done) |
6 | 6 | ||
7 | * add am/pm mode instead of 24 h, take system default | 7 | * add am/pm mode instead of 24 h, take system default |
8 | 8 | ||
9 | * qcop integration for updating events? | 9 | * qcop integration for updating events? |
10 | 10 | ||
11 | * sort todos by pri. | ||
12 | |||
13 | * make Opiezilla a clickable label wich is allway on the far right side of | 11 | * make Opiezilla a clickable label wich is allway on the far right side of |
14 | the screen , klick will open credits ,) \ No newline at end of file | 12 | the screen , klick will open credits ,) \ No newline at end of file |
diff --git a/core/pim/today/changelog b/core/pim/today/changelog index d0dd966..8ccff3c 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog | |||
@@ -1,63 +1,71 @@ | |||
1 | 0.3.0 | ||
2 | |||
3 | * today uses now tododb from libopie. So major changes in the todo part: | ||
4 | - overdue items on top | ||
5 | - then sorted by date, then by priority | ||
6 | * some cleanups | ||
7 | * speed optimisations | ||
8 | |||
1 | 0.2.9 | 9 | 0.2.9 |
2 | 10 | ||
3 | * Many bugfixes. | 11 | * Many bugfixes. |
4 | * Today now apparently sorts the dates _allways_ right, i would assume it | 12 | * Today now apparently sorts the dates _allways_ right, i would assume it |
5 | to be a qt bug | 13 | to be a qt bug |
6 | 14 | ||
7 | 0.2.8 | 15 | 0.2.8 |
8 | 16 | ||
9 | * Appointments are now clickable (connection to datebook still missing) | 17 | * Appointments are now clickable (connection to datebook still missing) |
10 | * autostart support (opie only) | 18 | * autostart support (opie only) |
11 | 19 | ||
12 | 0.2.7 | 20 | 0.2.7 |
13 | 21 | ||
14 | * check if todolist.xml was changed before parsing it | 22 | * check if todolist.xml was changed before parsing it |
15 | * check only every 30 sec for changes. | 23 | * check only every 30 sec for changes. |
16 | * some visual stuff | 24 | * some visual stuff |
17 | * as usual many little improvements .-) | 25 | * as usual many little improvements .-) |
18 | 26 | ||
19 | 0.2.6 | 27 | 0.2.6 |
20 | 28 | ||
21 | * added scrollbars to dates and todo | 29 | * added scrollbars to dates and todo |
22 | * all day detection | 30 | * all day detection |
23 | * some smaller bugfixes | 31 | * some smaller bugfixes |
24 | 32 | ||
25 | 0.2.5 | 33 | 0.2.5 |
26 | 34 | ||
27 | * some other minor fixes regarding autoupdate | 35 | * some other minor fixes regarding autoupdate |
28 | * fixed segfault with todolist > 7 entries | 36 | * fixed segfault with todolist > 7 entries |
29 | * fixed the "ugly grey border around buttons" issue | 37 | * fixed the "ugly grey border around buttons" issue |
30 | * fixed the "empty calendar field" "bug" | 38 | * fixed the "empty calendar field" "bug" |
31 | * shown only later appointments as option | 39 | * shown only later appointments as option |
32 | 40 | ||
33 | 41 | ||
34 | 0.2.4 | 42 | 0.2.4 |
35 | 43 | ||
36 | * added support for email | 44 | * added support for email |
37 | * autoupdates after 1 min | 45 | * autoupdates after 1 min |
38 | * QCopEnvelope instead of system() | 46 | * QCopEnvelope instead of system() |
39 | * starting to use qvbox in gui | 47 | * starting to use qvbox in gui |
40 | 48 | ||
41 | 49 | ||
42 | 0.2.3 | 50 | 0.2.3 |
43 | 51 | ||
44 | * the 4 am release | 52 | * the 4 am release |
45 | * several bugfixes | 53 | * several bugfixes |
46 | 54 | ||
47 | 55 | ||
48 | 0.2.2 | 56 | 0.2.2 |
49 | 57 | ||
50 | * started working on calling other apps | 58 | * started working on calling other apps |
51 | * and finished it | 59 | * and finished it |
52 | 60 | ||
53 | 0.2.1 | 61 | 0.2.1 |
54 | 62 | ||
55 | * images no more inline | 63 | * images no more inline |
56 | * config dialog | 64 | * config dialog |
57 | 65 | ||
58 | 0.1.1 | 66 | 0.1.1 |
59 | 67 | ||
60 | * started changelog. | 68 | * started changelog. |
61 | * fixed segfault on empty/nonexistant todolist.xml | 69 | * fixed segfault on empty/nonexistant todolist.xml |
62 | * better handling for file location | 70 | * better handling for file location |
63 | 71 | ||
diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control index 0c55e59..9d8444e 100644 --- a/core/pim/today/opie-today.control +++ b/core/pim/today/opie-today.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Files: bin/today apps/Applications/today.desktop pics/today | 1 | Files: bin/today apps/Applications/today.desktop pics/today |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> | 4 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 0.2.9-$SUB_VERSION | 6 | Version: 0.3.0-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | License: GPL | 8 | License: GPL |
9 | Description: today screen | 9 | Description: today screen |
10 | A short overview over current appointments and tasks. | 10 | A short overview over current appointments and tasks. |
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 1936518..2dc96fc 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,591 +1,533 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp : main class | 2 | * today.cpp : main class |
3 | * | 3 | * |
4 | * --------------------- | 4 | * --------------------- |
5 | * | 5 | * |
6 | * begin : Sun 10 17:20:00 CEST 2002 | 6 | * begin : Sun 10 17:20:00 CEST 2002 |
7 | * copyright : (c) 2002 by Maximilian Reiß | 7 | * copyright : (c) 2002 by Maximilian Reiß |
8 | * email : max.reiss@gmx.de | 8 | * email : max.reiss@gmx.de |
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | /*************************************************************************** | 11 | /*************************************************************************** |
12 | * * | 12 | * * |
13 | * This program is free software; you can redistribute it and/or modify * | 13 | * This program is free software; you can redistribute it and/or modify * |
14 | * it under the terms of the GNU General Public License as published by * | 14 | * it under the terms of the GNU General Public License as published by * |
15 | * the Free Software Foundation; either version 2 of the License, or * | 15 | * the Free Software Foundation; either version 2 of the License, or * |
16 | * (at your option) any later version. * | 16 | * (at your option) any later version. * |
17 | * * | 17 | * * |
18 | ***************************************************************************/ | 18 | ***************************************************************************/ |
19 | 19 | ||
20 | #include "today.h" | 20 | #include "today.h" |
21 | #include "minidom.h" | ||
22 | #include "TodoItem.h" | ||
23 | 21 | ||
24 | #include <qpe/datebookdb.h> | ||
25 | #include <qpe/timestring.h> | 22 | #include <qpe/timestring.h> |
26 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/qprocess.h> | 25 | #include <qpe/qprocess.h> |
29 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
30 | #include <qpe/contact.h> | 27 | #include <qpe/contact.h> |
31 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
32 | 29 | ||
33 | #include <qdir.h> | 30 | #include <qdir.h> |
34 | #include <qfile.h> | 31 | #include <qfile.h> |
35 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
36 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
37 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
38 | #include <qspinbox.h> | 35 | #include <qspinbox.h> |
39 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
40 | #include <qlabel.h> | 37 | #include <qlabel.h> |
41 | #include <qtimer.h> | 38 | #include <qtimer.h> |
42 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
43 | #include <qfileinfo.h> | 40 | #include <qfileinfo.h> |
44 | #include <qlayout.h> | 41 | #include <qlayout.h> |
45 | #include <qtl.h> | 42 | #include <qtl.h> |
46 | 43 | ||
47 | //#include <iostream.h> | 44 | //#include <iostream.h> |
48 | #include <unistd.h> | 45 | #include <unistd.h> |
49 | #include <stdlib.h> | 46 | #include <stdlib.h> |
50 | 47 | ||
51 | int MAX_LINES_TASK; | 48 | int MAX_LINES_TASK; |
52 | int MAX_CHAR_CLIP; | 49 | int MAX_CHAR_CLIP; |
53 | int MAX_LINES_MEET; | 50 | int MAX_LINES_MEET; |
54 | int SHOW_LOCATION; | 51 | int SHOW_LOCATION; |
55 | int SHOW_NOTES; | 52 | int SHOW_NOTES; |
56 | // show only later dates | 53 | // show only later dates |
57 | int ONLY_LATER; | 54 | int ONLY_LATER; |
58 | int AUTOSTART; | 55 | int AUTOSTART; |
59 | |||
60 | int NEW_START=1; | 56 | int NEW_START=1; |
57 | |||
61 | /* | 58 | /* |
62 | * Constructs a Example which is a child of 'parent', with the | 59 | * Constructs a Example which is a child of 'parent', with the |
63 | * name 'name' and widget flags set to 'f' | 60 | * name 'name' and widget flags set to 'f' |
64 | */ | 61 | */ |
65 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 62 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
66 | : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { | 63 | : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { |
67 | QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); | 64 | QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); |
68 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); | 65 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); |
69 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); | 66 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); |
70 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); | 67 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); |
71 | 68 | ||
72 | #if defined(Q_WS_QWS) | 69 | #if defined(Q_WS_QWS) |
73 | #if !defined(QT_NO_COP) | 70 | #if !defined(QT_NO_COP) |
74 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); | 71 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); |
75 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 72 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
76 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); | 73 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); |
77 | #endif | 74 | #endif |
78 | #endif | 75 | #endif |
79 | 76 | ||
80 | draw(); | ||
81 | setOwnerField(); | 77 | setOwnerField(); |
78 | todo = new ToDoDB; | ||
79 | getTodo(); | ||
80 | draw(); | ||
82 | autoStart(); | 81 | autoStart(); |
83 | } | 82 | } |
84 | 83 | ||
85 | /* | 84 | /* |
86 | * Qcop receive method. | 85 | * Qcop receive method. |
87 | */ | 86 | */ |
88 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { | 87 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { |
89 | QDataStream stream(data, IO_ReadOnly ); | 88 | QDataStream stream(data, IO_ReadOnly ); |
90 | if ( msg == "message(QString)" ) { | 89 | if ( msg == "message(QString)" ) { |
91 | QString message; | 90 | QString message; |
92 | stream >> message; | 91 | stream >> message; |
93 | setOwnerField(message); | 92 | setOwnerField(message); |
94 | } | 93 | } |
95 | 94 | ||
96 | } | 95 | } |
97 | 96 | ||
98 | /* | 97 | /* |
99 | * Initialises the owner field with the default value, the username | 98 | * Initialises the owner field with the default value, the username |
100 | */ | 99 | */ |
101 | void Today::setOwnerField() { | 100 | void Today::setOwnerField() { |
102 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); | 101 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); |
103 | if (QFile::exists(file)) { | 102 | if (QFile::exists(file)) { |
104 | Contact cont = Contact::readVCard(file)[0]; | 103 | Contact cont = Contact::readVCard(file)[0]; |
105 | QString returnString = cont.fullName(); | 104 | QString returnString = cont.fullName(); |
106 | OwnerField->setText( tr ("<b>Owned by " + returnString + "</b>")); | 105 | OwnerField->setText( tr ("<b>Owned by " + returnString + "</b>")); |
107 | } else { | 106 | } else { |
108 | OwnerField->setText( tr ("<b>Please fill out the business card </b>")); | 107 | OwnerField->setText( tr ("<b>Please fill out the business card </b>")); |
109 | } | 108 | } |
110 | } | 109 | } |
111 | 110 | ||
112 | /* | 111 | /* |
113 | * Set the owner field with a given QString, for example per qcop. | 112 | * Set the owner field with a given QString, for example per qcop. |
114 | */ | 113 | */ |
115 | void Today::setOwnerField(QString &message) { | 114 | void Today::setOwnerField(QString &message) { |
116 | if (!message.isEmpty()) { | 115 | if (!message.isEmpty()) { |
117 | OwnerField->setText("<b>" + message + "</b>"); | 116 | OwnerField->setText("<b>" + message + "</b>"); |
118 | } | 117 | } |
119 | } | 118 | } |
120 | 119 | ||
121 | /* | 120 | /* |
122 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 121 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
123 | * If registered against that today ist started on each resume. | 122 | * If registered against that today ist started on each resume. |
124 | */ | 123 | */ |
125 | void Today::autoStart() { | 124 | void Today::autoStart() { |
126 | Config cfg("today"); | 125 | Config cfg("today"); |
127 | cfg.setGroup("Autostart"); | 126 | cfg.setGroup("Autostart"); |
128 | AUTOSTART = cfg.readNumEntry("autostart",1); | 127 | AUTOSTART = cfg.readNumEntry("autostart",1); |
129 | if (AUTOSTART) { | 128 | if (AUTOSTART) { |
130 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | 129 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); |
131 | e << QString("add"); | 130 | e << QString("add"); |
132 | e << QString("today"); | 131 | e << QString("today"); |
133 | } else { | 132 | } else { |
134 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | 133 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); |
135 | e << QString("remove"); | 134 | e << QString("remove"); |
136 | e << QString("today"); | 135 | e << QString("today"); |
137 | } | 136 | } |
138 | } | 137 | } |
139 | 138 | ||
140 | /* | 139 | /* |
141 | * Repaint method. Reread all fields. | 140 | * Repaint method. Reread all fields. |
142 | */ | 141 | */ |
143 | void Today::draw() { | 142 | void Today::draw() { |
144 | init(); | 143 | init(); |
145 | getDates(); | 144 | getDates(); |
146 | getMail(); | 145 | getMail(); |
147 | getTodo(); | 146 | |
147 | // if the todolist.xml file was not modified in between, do not parse it. | ||
148 | if (checkIfModified()) { | ||
149 | todo = new ToDoDB; | ||
150 | getTodo(); | ||
151 | } | ||
152 | |||
148 | // how often refresh | 153 | // how often refresh |
149 | QTimer::singleShot( 10*1000, this, SLOT(draw() ) ); | 154 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); |
150 | } | 155 | } |
151 | 156 | ||
152 | /* | 157 | /* |
153 | * Check if the todolist.xml was modified (if there are new entries. | 158 | * Check if the todolist.xml was modified (if there are new entries. |
154 | * Returns true if it was modified. | 159 | * Returns true if it was modified. |
155 | */ | 160 | */ |
156 | bool Today::checkIfModified() { | 161 | bool Today::checkIfModified() { |
157 | 162 | ||
158 | QDir dir; | 163 | QDir dir; |
159 | QString homedir = dir.homeDirPath (); | 164 | QString homedir = dir.homeDirPath (); |
160 | QString time; | 165 | QString time; |
161 | 166 | ||
162 | Config cfg("today"); | 167 | Config cfg("today"); |
163 | cfg.setGroup("Files"); | 168 | cfg.setGroup("Files"); |
164 | time = cfg.readEntry("todolisttimestamp", ""); | 169 | time = cfg.readEntry("todolisttimestamp", ""); |
165 | 170 | ||
166 | QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); | 171 | QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); |
167 | QDateTime fileTime = file.lastModified(); | 172 | QDateTime fileTime = file.lastModified(); |
168 | if (time.compare(fileTime.toString()) == 0) { | 173 | if (time.compare(fileTime.toString()) == 0) { |
169 | return false; | 174 | return false; |
170 | } else { | 175 | } else { |
171 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); | 176 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); |
172 | cfg.write(); | 177 | cfg.write(); |
173 | return true; | 178 | return true; |
174 | } | 179 | } |
175 | } | 180 | } |
176 | 181 | ||
177 | 182 | ||
178 | /* | 183 | /* |
179 | * Init stuff needed for today. Reads the config file. | 184 | * Init stuff needed for today. Reads the config file. |
180 | */ | 185 | */ |
181 | void Today::init() { | 186 | void Today::init() { |
182 | QDate date = QDate::currentDate(); | 187 | QDate date = QDate::currentDate(); |
183 | QString time = (tr( date.toString()) ); | 188 | QString time = (tr( date.toString()) ); |
184 | 189 | ||
185 | TextLabel1->setText(time); | 190 | TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); |
186 | db = new DateBookDB; | 191 | db = new DateBookDB; |
187 | 192 | ||
188 | // read config | 193 | // read config |
189 | Config cfg("today"); | 194 | Config cfg("today"); |
190 | cfg.setGroup("BaseConfig"); | 195 | cfg.setGroup("BaseConfig"); |
191 | 196 | ||
192 | // -- config file section -- | 197 | // -- config file section -- |
193 | // how many lines should be showed in the task section | 198 | // how many lines should be showed in the task section |
194 | MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); | 199 | MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); |
195 | // after how many chars should the be cut off on tasks and notes | 200 | // after how many chars should the be cut off on tasks and notes |
196 | MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40); | 201 | MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40); |
197 | // how many lines should be showed in the datebook section | 202 | // how many lines should be showed in the datebook section |
198 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); | 203 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); |
199 | // If location is to be showed too, 1 to activate it. | 204 | // If location is to be showed too, 1 to activate it. |
200 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); | 205 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); |
201 | // if notes should be shown | 206 | // if notes should be shown |
202 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); | 207 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); |
203 | // should only later appointments be shown or all for the current day. | 208 | // should only later appointments be shown or all for the current day. |
204 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | 209 | ONLY_LATER = cfg.readNumEntry("onlylater",1); |
205 | } | 210 | } |
206 | 211 | ||
207 | 212 | ||
208 | /* | 213 | /* |
209 | * The method for the configuration dialog. | 214 | * The method for the configuration dialog. |
210 | */ | 215 | */ |
211 | void Today::startConfig() { | 216 | void Today::startConfig() { |
212 | 217 | ||
213 | conf = new todayconfig ( this, "", true ); | 218 | conf = new todayconfig ( this, "", true ); |
214 | // read the config | 219 | // read the config |
215 | Config cfg("today"); | 220 | Config cfg("today"); |
216 | cfg.setGroup("BaseConfig"); | 221 | cfg.setGroup("BaseConfig"); |
217 | 222 | ||
218 | //init(); | 223 | //init(); |
219 | 224 | ||
220 | conf->SpinBox1->setValue(MAX_LINES_MEET); | 225 | conf->SpinBox1->setValue(MAX_LINES_MEET); |
221 | // location show box | 226 | // location show box |
222 | conf->CheckBox1->setChecked(SHOW_LOCATION); | 227 | conf->CheckBox1->setChecked(SHOW_LOCATION); |
223 | // notes show box | 228 | // notes show box |
224 | conf->CheckBox2->setChecked(SHOW_NOTES); | 229 | conf->CheckBox2->setChecked(SHOW_NOTES); |
225 | // task lines | 230 | // task lines |
226 | conf->SpinBox2->setValue(MAX_LINES_TASK); | 231 | conf->SpinBox2->setValue(MAX_LINES_TASK); |
227 | // clip when? | 232 | // clip when? |
228 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); | 233 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); |
229 | // only later | 234 | // only later |
230 | conf->CheckBox3->setChecked(ONLY_LATER); | 235 | conf->CheckBox3->setChecked(ONLY_LATER); |
231 | // if today should be autostarted | 236 | // if today should be autostarted |
232 | conf->CheckBoxAuto->setChecked(AUTOSTART); | 237 | conf->CheckBoxAuto->setChecked(AUTOSTART); |
233 | 238 | ||
234 | conf->exec(); | 239 | conf->exec(); |
235 | 240 | ||
236 | int maxlinestask = conf->SpinBox2->value(); | 241 | int maxlinestask = conf->SpinBox2->value(); |
237 | int maxmeet = conf->SpinBox1->value(); | 242 | int maxmeet = conf->SpinBox1->value(); |
238 | int location = conf->CheckBox1->isChecked(); | 243 | int location = conf->CheckBox1->isChecked(); |
239 | int notes = conf->CheckBox2->isChecked(); | 244 | int notes = conf->CheckBox2->isChecked(); |
240 | int maxcharclip = conf->SpinBox7->value(); | 245 | int maxcharclip = conf->SpinBox7->value(); |
241 | int onlylater = conf->CheckBox3->isChecked(); | 246 | int onlylater = conf->CheckBox3->isChecked(); |
242 | int autostart =conf->CheckBoxAuto->isChecked(); | 247 | int autostart =conf->CheckBoxAuto->isChecked(); |
243 | 248 | ||
244 | cfg.writeEntry("maxlinestask",maxlinestask); | 249 | cfg.writeEntry("maxlinestask",maxlinestask); |
245 | cfg.writeEntry("maxcharclip", maxcharclip); | 250 | cfg.writeEntry("maxcharclip", maxcharclip); |
246 | cfg.writeEntry("maxlinesmeet",maxmeet); | 251 | cfg.writeEntry("maxlinesmeet",maxmeet); |
247 | cfg.writeEntry("showlocation",location); | 252 | cfg.writeEntry("showlocation",location); |
248 | cfg.writeEntry("shownotes", notes); | 253 | cfg.writeEntry("shownotes", notes); |
249 | cfg.writeEntry("onlylater", onlylater); | 254 | cfg.writeEntry("onlylater", onlylater); |
250 | cfg.setGroup("Autostart"); | 255 | cfg.setGroup("Autostart"); |
251 | cfg.writeEntry("autostart", autostart); | 256 | cfg.writeEntry("autostart", autostart); |
252 | 257 | ||
253 | // sync it to "disk" | 258 | // sync it to "disk" |
254 | cfg.write(); | 259 | cfg.write(); |
255 | NEW_START=1; | 260 | NEW_START=1; |
256 | draw(); | 261 | draw(); |
257 | autoStart(); | 262 | autoStart(); |
258 | } | 263 | } |
259 | 264 | ||
260 | 265 | ||
261 | /* | 266 | /* |
262 | * Get all events that are in the datebook xml file for today | 267 | * Get all events that are in the datebook xml file for today |
263 | */ | 268 | */ |
264 | void Today::getDates() { | 269 | void Today::getDates() { |
265 | QDate date = QDate::currentDate(); | 270 | QDate date = QDate::currentDate(); |
266 | 271 | ||
267 | if (AllDateBookEvents) delete AllDateBookEvents; | 272 | if (AllDateBookEvents) delete AllDateBookEvents; |
268 | AllDateBookEvents = new QWidget( ); | 273 | AllDateBookEvents = new QWidget( ); |
269 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); | 274 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); |
270 | 275 | ||
271 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); | 276 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); |
272 | 277 | ||
273 | qBubbleSort(list); | 278 | qBubbleSort(list); |
274 | // printf("Get dates\n"); | 279 | // printf("Get dates\n"); |
275 | 280 | ||
276 | Config config( "qpe" ); | 281 | Config config( "qpe" ); |
277 | // if 24 h format | 282 | // if 24 h format |
278 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); | 283 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); |
279 | 284 | ||
280 | int count=0; | 285 | int count=0; |
281 | 286 | ||
282 | if ( list.count() > 0 ) { | 287 | if ( list.count() > 0 ) { |
283 | 288 | ||
284 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 289 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); |
285 | it!=list.end(); ++it ) { | 290 | it!=list.end(); ++it ) { |
286 | 291 | ||
287 | 292 | ||
288 | if ( count <= MAX_LINES_MEET ) { | 293 | if ( count <= MAX_LINES_MEET ) { |
289 | 294 | ||
290 | QTime time = QTime::currentTime(); | 295 | QTime time = QTime::currentTime(); |
291 | 296 | ||
292 | if (!ONLY_LATER) { | 297 | if (!ONLY_LATER) { |
293 | count++; | 298 | count++; |
294 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); | 299 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); |
295 | layoutDates->addWidget(l); | 300 | layoutDates->addWidget(l); |
296 | connect (l, SIGNAL(editEvent(const Event &)), | 301 | connect (l, SIGNAL(editEvent(const Event &)), |
297 | this, SLOT(editEvent(const Event &))); | 302 | this, SLOT(editEvent(const Event &))); |
298 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { | 303 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { |
299 | count++; | 304 | count++; |
300 | 305 | ||
301 | // show only later appointments | 306 | // show only later appointments |
302 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents); | 307 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents); |
303 | layoutDates->addWidget(l); | 308 | layoutDates->addWidget(l); |
304 | connect (l, SIGNAL(editEvent(const Event &)), | 309 | connect (l, SIGNAL(editEvent(const Event &)), |
305 | this, SLOT(editEvent(const Event &))); | 310 | this, SLOT(editEvent(const Event &))); |
306 | } | 311 | } |
307 | } | 312 | } |
308 | } | 313 | } |
309 | if (ONLY_LATER && count==0) { | 314 | if (ONLY_LATER && count==0) { |
310 | QLabel* noMoreEvents = new QLabel(AllDateBookEvents); | 315 | QLabel* noMoreEvents = new QLabel(AllDateBookEvents); |
311 | noMoreEvents->setText("No more appointments today"); | 316 | noMoreEvents->setText("No more appointments today"); |
312 | layoutDates->addWidget(noMoreEvents); | 317 | layoutDates->addWidget(noMoreEvents); |
313 | } | 318 | } |
314 | } else { | 319 | } else { |
315 | QLabel* noEvents = new QLabel(AllDateBookEvents); | 320 | QLabel* noEvents = new QLabel(AllDateBookEvents); |
316 | noEvents->setText("No appointments today"); | 321 | noEvents->setText("No appointments today"); |
317 | layoutDates->addWidget(noEvents); | 322 | layoutDates->addWidget(noEvents); |
318 | } | 323 | } |
319 | 324 | ||
320 | layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 325 | layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
321 | sv1->addChild(AllDateBookEvents); | 326 | sv1->addChild(AllDateBookEvents); |
322 | AllDateBookEvents->show(); | 327 | AllDateBookEvents->show(); |
323 | } | 328 | } |
324 | 329 | ||
325 | /* | ||
326 | * Parse in the todolist.xml | ||
327 | */ | ||
328 | QList<TodoItem> Today::loadTodo(const char *filename) { | ||
329 | DOM *todo; | ||
330 | ELE *tasks; | ||
331 | ELE **tasklist; | ||
332 | ATT **attlist; | ||
333 | int i, j; | ||
334 | char *description; | ||
335 | int completed; | ||
336 | int priority; | ||
337 | TodoItem *tmp; | ||
338 | QList<TodoItem> loadtodolist; | ||
339 | |||
340 | todo = minidom_load(filename); | ||
341 | |||
342 | tasks = todo->el; | ||
343 | tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ | ||
344 | if(tasks) { | ||
345 | tasklist = tasks->el; | ||
346 | i = 0; | ||
347 | while((tasklist) && (tasklist[i])) { | ||
348 | attlist = tasklist[i]->at; | ||
349 | j = 0; | ||
350 | description = NULL; | ||
351 | priority = -1; | ||
352 | completed = -1; | ||
353 | while((attlist) && (attlist[j])) { | ||
354 | if(!attlist[j]->name) { | ||
355 | continue; | ||
356 | } | ||
357 | if(!strcmp(attlist[j]->name, "Description")) { | ||
358 | description = attlist[j]->value; | ||
359 | } | ||
360 | // get Completed tag (0 or 1) | ||
361 | if(!strcmp(attlist[j]->name, "Completed")) { | ||
362 | QString s = attlist[j]->name; | ||
363 | if(s == "Completed") { | ||
364 | completed = QString(attlist[j]->value).toInt(); | ||
365 | } | ||
366 | } | ||
367 | // get Priority (1 to 5) | ||
368 | if(!strcmp(attlist[j]->name, "Priority")) { | ||
369 | QString s = attlist[j]->name; | ||
370 | if(s == "Priority") { | ||
371 | priority = QString(attlist[j]->value).toInt(); | ||
372 | } | ||
373 | } | ||
374 | j++; | ||
375 | } | ||
376 | if(description) { | ||
377 | tmp = new TodoItem(description, completed, priority); | ||
378 | loadtodolist.append(tmp); | ||
379 | } | ||
380 | i++; | ||
381 | } | ||
382 | } | ||
383 | |||
384 | minidom_free(todo); | ||
385 | |||
386 | return loadtodolist; | ||
387 | } | ||
388 | |||
389 | 330 | ||
390 | void Today::getMail() { | 331 | void Today::getMail() { |
391 | Config cfg("opiemail"); | 332 | Config cfg("opiemail"); |
392 | cfg.setGroup("today"); | 333 | cfg.setGroup("today"); |
393 | 334 | ||
394 | // how many lines should be showed in the task section | 335 | // how many lines should be showed in the task section |
395 | int NEW_MAILS = cfg.readNumEntry("newmails",0); | 336 | int NEW_MAILS = cfg.readNumEntry("newmails",0); |
396 | int OUTGOING = cfg.readNumEntry("outgoing",0); | 337 | int OUTGOING = cfg.readNumEntry("outgoing",0); |
397 | 338 | ||
398 | QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); | 339 | QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); |
399 | 340 | ||
400 | MailField->setText(output); | 341 | MailField->setText(output); |
401 | } | 342 | } |
402 | 343 | ||
403 | 344 | ||
404 | /* | 345 | /* |
405 | * Get the todos | 346 | * Get the todos |
406 | */ | 347 | */ |
407 | void Today::getTodo() { | 348 | void Today::getTodo() { |
408 | 349 | ||
409 | // if the todolist.xml file was not modified in between, do not parse it. | ||
410 | if (!checkIfModified() && !NEW_START) { | ||
411 | return; | ||
412 | } | ||
413 | // since it was the new start or the return from config dialog, set it to 0 again. | ||
414 | NEW_START=0; | ||
415 | |||
416 | QString output; | 350 | QString output; |
417 | QString tmpout; | 351 | QString tmpout; |
418 | int count = 0; | 352 | int count = 0; |
419 | 353 | int ammount = 0; | |
420 | QDir dir; | 354 | |
421 | QString homedir = dir.homeDirPath (); | 355 | // get overdue todos first |
422 | // see if todolist.xml does exist. | 356 | QValueList<ToDoEvent> overDueList = todo->overDue(); |
423 | QFile f(homedir +"/Applications/todolist/todolist.xml"); | 357 | qBubbleSort(overDueList); |
424 | if ( f.exists() ) { | 358 | for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin(); |
425 | QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); | 359 | it!=overDueList.end(); ++it ) { |
426 | 360 | if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) { | |
427 | TodoItem *item; | 361 | tmpout += "<font color=#e00000><b>-" +((*it).description()).mid(0, MAX_CHAR_CLIP) + "</b></font><br>"; |
428 | for( item = todolist.first(); item; item = todolist.next()) { | 362 | ammount++; |
429 | if (!(item->getCompleted() == 1) ) { | 363 | } |
430 | count++; | ||
431 | if (count <= MAX_LINES_TASK) { | ||
432 | tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); | ||
433 | } | 364 | } |
365 | |||
366 | // get total number of still open todos | ||
367 | QValueList<ToDoEvent> open = todo->rawToDos(); | ||
368 | qBubbleSort(open); | ||
369 | for ( QValueList<ToDoEvent>::Iterator it=open.begin(); | ||
370 | it!=open.end(); ++it ) { | ||
371 | if (!(*it).isCompleted()){ | ||
372 | count +=1; | ||
373 | // not the overdues, we allready got them, and not if we are | ||
374 | // over the maxlines | ||
375 | if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) { | ||
376 | tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>"; | ||
377 | ammount++; | ||
434 | } | 378 | } |
435 | } | 379 | } |
436 | } | 380 | } |
437 | 381 | ||
382 | |||
438 | if (count > 0) { | 383 | if (count > 0) { |
439 | if( count == 1 ) { | 384 | if( count == 1 ) { |
440 | output = tr("There is <b> 1</b> active task: <br>" ); | 385 | output = tr("There is <b> 1</b> active task: <br>" ); |
441 | } else { | 386 | } else { |
442 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); | 387 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); |
443 | } | 388 | } |
444 | output += tmpout; | 389 | output += tmpout; |
445 | } else { | 390 | } else { |
446 | output = tr("No active tasks"); | 391 | output = tr("No active tasks"); |
447 | } | 392 | } |
448 | 393 | ||
449 | TodoField->setText(tr(output)); | 394 | TodoField->setText(tr(output)); |
450 | } | 395 | } |
451 | 396 | ||
452 | /* | 397 | /* |
453 | * launches datebook | 398 | * launches datebook |
454 | */ | 399 | */ |
455 | void Today::startDatebook() { | 400 | void Today::startDatebook() { |
456 | QCopEnvelope e("QPE/System", "execute(QString)"); | 401 | QCopEnvelope e("QPE/System", "execute(QString)"); |
457 | e << QString("datebook"); | 402 | e << QString("datebook"); |
458 | } | 403 | } |
459 | 404 | ||
460 | /* | 405 | /* |
461 | * starts the edit dialog as known from datebook | 406 | * starts the edit dialog as known from datebook |
462 | */ | 407 | */ |
463 | void Today::editEvent(const Event &e) { | 408 | void Today::editEvent(const Event &e) { |
464 | startDatebook(); | 409 | startDatebook(); |
465 | 410 | ||
466 | //Dissabled for now as uid's not working properly | 411 | //Dissabled for now as uid's not working properly |
467 | /* | 412 | /* |
468 | while(!QCopChannel::isRegistered("QPE/Datebook")) sleep(1); | 413 | while(!QCopChannel::isRegistered("QPE/Datebook")) sleep(1); |
469 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); | 414 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); |
470 | env << e.uid(); | 415 | env << e.uid(); |
471 | */ | 416 | */ |
472 | } | 417 | } |
473 | 418 | ||
474 | /* | 419 | /* |
475 | * launches todolist | 420 | * launches todolist |
476 | */ | 421 | */ |
477 | void Today::startTodo() { | 422 | void Today::startTodo() { |
478 | QCopEnvelope e("QPE/System", "execute(QString)"); | 423 | QCopEnvelope e("QPE/System", "execute(QString)"); |
479 | e << QString("todolist"); | 424 | e << QString("todolist"); |
480 | } | 425 | } |
481 | 426 | ||
482 | /* | 427 | /* |
483 | * launch opiemail | 428 | * launch opiemail |
484 | */ | 429 | */ |
485 | void Today::startMail() { | 430 | void Today::startMail() { |
486 | QCopEnvelope e("QPE/System", "execute(QString)"); | 431 | QCopEnvelope e("QPE/System", "execute(QString)"); |
487 | e << QString("opiemail"); | 432 | e << QString("opiemail"); |
488 | } | 433 | } |
489 | 434 | ||
490 | 435 | ||
491 | Today::~Today() { | 436 | Today::~Today() { |
492 | } | 437 | } |
493 | 438 | ||
494 | 439 | ||
495 | 440 | ||
496 | /* | 441 | /* |
497 | * Gets the events for the current day, if it should get all dates | 442 | * Gets the events for the current day, if it should get all dates |
498 | */ | 443 | */ |
499 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 444 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
500 | QWidget* parent = 0, | 445 | QWidget* parent = 0, |
501 | const char* name = 0, | 446 | const char* name = 0, |
502 | WFlags fl = 0) : | 447 | WFlags fl = 0) : |
503 | ClickableLabel(parent,name,fl), event(ev) { | 448 | ClickableLabel(parent,name,fl), event(ev) { |
504 | 449 | ||
505 | QString msg; | 450 | QString msg; |
506 | QTime time = QTime::currentTime(); | 451 | //QTime time = QTime::currentTime(); |
507 | 452 | ||
508 | if (!ONLY_LATER) { | 453 | if (!ONLY_LATER) { |
509 | msg += "<B>" + (ev).description() + "</B>"; | 454 | msg += "<B>" + (ev).description() + "</B>"; |
510 | if ( (ev).event().hasAlarm() ) { | 455 | if ( (ev).event().hasAlarm() ) { |
511 | msg += " <b>[with alarm]</b>"; | 456 | msg += " <b>[with alarm]</b>"; |
512 | } | 457 | } |
513 | // include location or not | 458 | // include location or not |
514 | if (SHOW_LOCATION == 1) { | 459 | if (SHOW_LOCATION == 1) { |
515 | msg += "<BR><i>" + (ev).location(); | 460 | msg += "<BR><i>" + (ev).location(); |
516 | msg += "</i>"; | 461 | msg += "</i>"; |
517 | } | 462 | } |
518 | 463 | ||
519 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 464 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
520 | msg += "<br>All day"; | 465 | msg += "<br>All day"; |
521 | } else { | 466 | } else { |
522 | // start time of event | 467 | // start time of event |
523 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) | 468 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) |
524 | // end time of event | 469 | // end time of event |
525 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 470 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); |
526 | } | 471 | } |
527 | 472 | ||
528 | // include possible note or not | 473 | // include possible note or not |
529 | if (SHOW_NOTES == 1) { | 474 | if (SHOW_NOTES == 1) { |
530 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 475 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
531 | } | 476 | } |
532 | } | 477 | } |
533 | setText(msg); | 478 | setText(msg); |
534 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 479 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
535 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 480 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
536 | } | 481 | } |
537 | 482 | ||
538 | 483 | ||
539 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | 484 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, |
540 | QWidget* parent = 0, | 485 | QWidget* parent = 0, |
541 | const char* name = 0, | 486 | const char* name = 0, |
542 | WFlags fl = 0) : | 487 | WFlags fl = 0) : |
543 | ClickableLabel(parent,name,fl), event(ev) { | 488 | ClickableLabel(parent,name,fl), event(ev) { |
544 | 489 | ||
545 | QString msg; | 490 | QString msg; |
546 | QTime time = QTime::currentTime(); | 491 | QTime time = QTime::currentTime(); |
547 | 492 | ||
548 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | 493 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { |
549 | // show only later appointments | 494 | // show only later appointments |
550 | msg += "<B>" + (ev).description() + "</B>"; | 495 | msg += "<B>" + (ev).description() + "</B>"; |
551 | if ( (ev).event().hasAlarm() ) { | 496 | if ( (ev).event().hasAlarm() ) { |
552 | msg += " <b>[with alarm]</b>"; | 497 | msg += " <b>[with alarm]</b>"; |
553 | } | 498 | } |
554 | // include location or not | 499 | // include location or not |
555 | if (SHOW_LOCATION == 1) { | 500 | if (SHOW_LOCATION == 1) { |
556 | msg += "<BR><i>" + (ev).location(); | 501 | msg += "<BR><i>" + (ev).location(); |
557 | msg += "</i>"; | 502 | msg += "</i>"; |
558 | } | 503 | } |
559 | 504 | ||
560 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 505 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
561 | msg += "<br>All day"; | 506 | msg += "<br>All day"; |
562 | } else { | 507 | } else { |
563 | // start time of event | 508 | // start time of event |
564 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) | 509 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) |
565 | // end time of event | 510 | // end time of event |
566 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 511 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); |
567 | } | 512 | } |
568 | // include possible note or not | 513 | // include possible note or not |
569 | if (SHOW_NOTES == 1) { | 514 | if (SHOW_NOTES == 1) { |
570 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 515 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
571 | } | 516 | } |
572 | } | 517 | } |
573 | 518 | ||
574 | // if (msg.isEmpty()) { | ||
575 | // msg = tr("No more appointments today"); | ||
576 | // } | ||
577 | setText(msg); | 519 | setText(msg); |
578 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 520 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
579 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 521 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
580 | } | 522 | } |
581 | 523 | ||
582 | 524 | ||
583 | void DateBookEvent::editMe() { | 525 | void DateBookEvent::editMe() { |
584 | emit editEvent(event.event()); | 526 | emit editEvent(event.event()); |
585 | } | 527 | } |
586 | 528 | ||
587 | void DateBookEventLater::editMe() { | 529 | void DateBookEventLater::editMe() { |
588 | emit editEvent(event.event()); | 530 | emit editEvent(event.event()); |
589 | } | 531 | } |
590 | 532 | ||
591 | 533 | ||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 6dec2c2..6048781 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -1,105 +1,106 @@ | |||
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> | ||
28 | |||
27 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
28 | #include <qlist.h> | 30 | #include <qlist.h> |
29 | 31 | ||
30 | #include "TodoItem.h" | ||
31 | #include "todayconfig.h" | 32 | #include "todayconfig.h" |
32 | #include "todaybase.h" | 33 | #include "todaybase.h" |
33 | #include "clickablelabel.h" | 34 | #include "clickablelabel.h" |
34 | 35 | ||
35 | class QVBoxLayout; | 36 | class QVBoxLayout; |
36 | 37 | ||
37 | class Today : public TodayBase { | 38 | class Today : public TodayBase { |
38 | Q_OBJECT | 39 | Q_OBJECT |
39 | 40 | ||
40 | public: | 41 | public: |
41 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 42 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
42 | ~Today(); | 43 | ~Today(); |
43 | 44 | ||
44 | private slots: | 45 | private slots: |
45 | void startConfig(); | 46 | void startConfig(); |
46 | void startTodo(); | 47 | void startTodo(); |
47 | void startDatebook(); | 48 | void startDatebook(); |
48 | void startMail(); | 49 | void startMail(); |
49 | void draw(); | 50 | void draw(); |
50 | void editEvent(const Event &e); | 51 | void editEvent(const Event &e); |
51 | private: | 52 | private: |
52 | void init(); | 53 | void init(); |
53 | void getDates(); | 54 | void getDates(); |
54 | void getTodo(); | 55 | void getTodo(); |
55 | void getMail(); | 56 | void getMail(); |
56 | void autoStart(); | 57 | void autoStart(); |
57 | bool checkIfModified(); | 58 | bool checkIfModified(); |
58 | void setOwnerField(); | 59 | void setOwnerField(); |
59 | void setOwnerField(QString &string); | 60 | void setOwnerField(QString &string); |
60 | QList<TodoItem> loadTodo(const char *filename); | 61 | private slots: |
61 | private slots: | 62 | void channelReceived(const QCString &msg, const QByteArray & data); |
62 | void channelReceived(const QCString &msg, const QByteArray & data); | 63 | |
63 | |||
64 | private: | 64 | private: |
65 | DateBookDB *db; | 65 | DateBookDB *db; |
66 | ToDoDB *todo; | ||
66 | todayconfig *conf; | 67 | todayconfig *conf; |
67 | QWidget* AllDateBookEvents; | 68 | QWidget* AllDateBookEvents; |
68 | //Config cfg; | 69 | //Config cfg; |
69 | int MAX_LINES_TASK; | 70 | int MAX_LINES_TASK; |
70 | int MAX_CHAR_CLIP; | 71 | int MAX_CHAR_CLIP; |
71 | int MAX_LINES_MEET; | 72 | int MAX_LINES_MEET; |
72 | int SHOW_LOCATION; | 73 | int SHOW_LOCATION; |
73 | int SHOW_NOTES; | 74 | int SHOW_NOTES; |
74 | }; | 75 | }; |
75 | 76 | ||
76 | class DateBookEvent: public ClickableLabel { | 77 | class DateBookEvent: public ClickableLabel { |
77 | Q_OBJECT | 78 | Q_OBJECT |
78 | public: | 79 | public: |
79 | DateBookEvent(const EffectiveEvent &ev, | 80 | DateBookEvent(const EffectiveEvent &ev, |
80 | QWidget* parent = 0, const char* name = 0, | 81 | QWidget* parent = 0, const char* name = 0, |
81 | WFlags fl = 0); | 82 | WFlags fl = 0); |
82 | signals: | 83 | signals: |
83 | void editEvent(const Event &e); | 84 | void editEvent(const Event &e); |
84 | private slots: | 85 | private slots: |
85 | void editMe(); | 86 | void editMe(); |
86 | private: | 87 | private: |
87 | const EffectiveEvent event; | 88 | const EffectiveEvent event; |
88 | }; | 89 | }; |
89 | 90 | ||
90 | class DateBookEventLater: public ClickableLabel { | 91 | class DateBookEventLater: public ClickableLabel { |
91 | Q_OBJECT | 92 | Q_OBJECT |
92 | public: | 93 | public: |
93 | DateBookEventLater(const EffectiveEvent &ev, | 94 | DateBookEventLater(const EffectiveEvent &ev, |
94 | QWidget* parent = 0, const char* name = 0, | 95 | QWidget* parent = 0, const char* name = 0, |
95 | WFlags fl = 0); | 96 | WFlags fl = 0); |
96 | signals: | 97 | signals: |
97 | void editEvent(const Event &e); | 98 | void editEvent(const Event &e); |
98 | private slots: | 99 | private slots: |
99 | void editMe(); | 100 | void editMe(); |
100 | private: | 101 | private: |
101 | const EffectiveEvent event; | 102 | const EffectiveEvent event; |
102 | }; | 103 | }; |
103 | 104 | ||
104 | #endif // TODAY_H | 105 | #endif // TODAY_H |
105 | 106 | ||
diff --git a/core/pim/today/today.pro b/core/pim/today/today.pro index e61480c..b20baea 100644 --- a/core/pim/today/today.pro +++ b/core/pim/today/today.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | #CONFIG = qt warn_on debug | 2 | #CONFIG = qt warn_on debug |
3 | CONFIG = qt warn_on release | 3 | CONFIG = qt warn_on release |
4 | HEADERS = today.h TodoItem.h minidom.h todaybase.h todayconfig.h clickablelabel.h | 4 | HEADERS = today.h todaybase.h todayconfig.h clickablelabel.h |
5 | SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp minidom.c TodoItem.cpp clickablelabel.cpp | 5 | SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp clickablelabel.cpp |
6 | 6 | ||
7 | INCLUDEPATH+= $(OPIEDIR)/include | 7 | INCLUDEPATH+= $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopie |
10 | INTERFACES= | 10 | INTERFACES= |
11 | TARGET = today | 11 | TARGET = today |
12 | DESTDIR = $(OPIEDIR)/bin | 12 | DESTDIR = $(OPIEDIR)/bin |
13 | TRANSLATIONS = ../i18n/pt_BR/today.ts | 13 | TRANSLATIONS = ../i18n/pt_BR/today.ts |