-rw-r--r-- | core/pim/today/today.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 1f6f34e..c63a9ef 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -96,236 +96,236 @@ void Today::init() | |||
96 | // how many lines should be showed in the datebook section | 96 | // how many lines should be showed in the datebook section |
97 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); | 97 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); |
98 | // If location is to be showed too, 1 to activate it. | 98 | // If location is to be showed too, 1 to activate it. |
99 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); | 99 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); |
100 | // if notes should be shown | 100 | // if notes should be shown |
101 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); | 101 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); |
102 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | 102 | ONLY_LATER = cfg.readNumEntry("onlylater",1); |
103 | 103 | ||
104 | } | 104 | } |
105 | 105 | ||
106 | void Today::startConfig() | 106 | void Today::startConfig() |
107 | { | 107 | { |
108 | conf = new todayconfig ( this, "", true ); | 108 | conf = new todayconfig ( this, "", true ); |
109 | 109 | ||
110 | 110 | ||
111 | //Config cfg = new Config("today"); | 111 | //Config cfg = new Config("today"); |
112 | 112 | ||
113 | // read the config | 113 | // read the config |
114 | Config cfg("today"); | 114 | Config cfg("today"); |
115 | cfg.setGroup("BaseConfig"); | 115 | cfg.setGroup("BaseConfig"); |
116 | 116 | ||
117 | //init(); | 117 | //init(); |
118 | 118 | ||
119 | conf->SpinBox1->setValue(MAX_LINES_MEET); | 119 | conf->SpinBox1->setValue(MAX_LINES_MEET); |
120 | // location show box | 120 | // location show box |
121 | conf->CheckBox1->setChecked(SHOW_LOCATION); | 121 | conf->CheckBox1->setChecked(SHOW_LOCATION); |
122 | // notes show box | 122 | // notes show box |
123 | conf->CheckBox2->setChecked(SHOW_NOTES); | 123 | conf->CheckBox2->setChecked(SHOW_NOTES); |
124 | // task lines | 124 | // task lines |
125 | conf->SpinBox2->setValue(MAX_LINES_TASK); | 125 | conf->SpinBox2->setValue(MAX_LINES_TASK); |
126 | // clip when? | 126 | // clip when? |
127 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); | 127 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); |
128 | // only later | 128 | // only later |
129 | conf->CheckBox3->setChecked(ONLY_LATER); | 129 | conf->CheckBox3->setChecked(ONLY_LATER); |
130 | 130 | ||
131 | conf->exec(); | 131 | conf->exec(); |
132 | 132 | ||
133 | int maxlinestask = conf->SpinBox2->value(); | 133 | int maxlinestask = conf->SpinBox2->value(); |
134 | int maxmeet = conf->SpinBox1->value(); | 134 | int maxmeet = conf->SpinBox1->value(); |
135 | int location = conf->CheckBox1->isChecked(); | 135 | int location = conf->CheckBox1->isChecked(); |
136 | int notes = conf->CheckBox2->isChecked(); | 136 | int notes = conf->CheckBox2->isChecked(); |
137 | int maxcharclip = conf->SpinBox7->value(); | 137 | int maxcharclip = conf->SpinBox7->value(); |
138 | int onlylater = conf->CheckBox3->isChecked(); | 138 | int onlylater = conf->CheckBox3->isChecked(); |
139 | 139 | ||
140 | cfg.writeEntry("maxlinestask",maxlinestask); | 140 | cfg.writeEntry("maxlinestask",maxlinestask); |
141 | cfg.writeEntry("maxcharclip", maxcharclip); | 141 | cfg.writeEntry("maxcharclip", maxcharclip); |
142 | cfg.writeEntry("maxlinesmeet",maxmeet); | 142 | cfg.writeEntry("maxlinesmeet",maxmeet); |
143 | cfg.writeEntry("showlocation",location); | 143 | cfg.writeEntry("showlocation",location); |
144 | cfg.writeEntry("shownotes", notes); | 144 | cfg.writeEntry("shownotes", notes); |
145 | cfg.writeEntry("onlylater", onlylater); | 145 | cfg.writeEntry("onlylater", onlylater); |
146 | // sync it to "disk" | 146 | // sync it to "disk" |
147 | cfg.write(); | 147 | cfg.write(); |
148 | 148 | ||
149 | draw(); | 149 | draw(); |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | /* | 153 | /* |
154 | * Get all events that are in the datebook xml file for today | 154 | * Get all events that are in the datebook xml file for today |
155 | */ | 155 | */ |
156 | void Today::getDates() | 156 | void Today::getDates() |
157 | { | 157 | { |
158 | QDate date = QDate::currentDate(); | 158 | QDate date = QDate::currentDate(); |
159 | QTime time = QTime::currentTime(); | 159 | QTime time = QTime::currentTime(); |
160 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); | 160 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); |
161 | 161 | ||
162 | Config config( "qpe" ); | 162 | Config config( "qpe" ); |
163 | // if 24 h format | 163 | // if 24 h format |
164 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); | 164 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); |
165 | 165 | ||
166 | int count=0; | 166 | int count=0; |
167 | 167 | ||
168 | if ( list.count() > 0 ) { | 168 | if ( list.count() > 0 ) { |
169 | QString msg; | 169 | QString msg; |
170 | 170 | ||
171 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 171 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); |
172 | it!=list.end(); ++it ) { | 172 | it!=list.end(); ++it ) { |
173 | 173 | ||
174 | count++; | 174 | count++; |
175 | 175 | ||
176 | if ( count <= MAX_LINES_MEET ) | 176 | if ( count <= MAX_LINES_MEET ) |
177 | { | 177 | { |
178 | //cout << time.toString() << endl; | 178 | //cout << time.toString() << endl; |
179 | //cout << TimeString::dateString((*it).event().end()) << endl; | 179 | //cout << TimeString::dateString((*it).event().end()) << endl; |
180 | 180 | ||
181 | // decide if to get all day or only later appointments | 181 | // decide if to get all day or only later appointments |
182 | if (!ONLY_LATER) | 182 | if (!ONLY_LATER) |
183 | { | 183 | { |
184 | msg += "<B>" + (*it).description() + "</B>"; | 184 | msg += "<B>" + (*it).description() + "</B>"; |
185 | if ( (*it).event().hasAlarm() ) | 185 | if ( (*it).event().hasAlarm() ) |
186 | { | 186 | { |
187 | msg += " <b>[with alarm]</b>"; | 187 | msg += " <b>[with alarm]</b>"; |
188 | } | 188 | } |
189 | // include location or not | 189 | // include location or not |
190 | if (SHOW_LOCATION == 1) | 190 | if (SHOW_LOCATION == 1) |
191 | { | 191 | { |
192 | msg+= "<BR><i>" + (*it).location(); | 192 | msg += "<BR><i>" + (*it).location(); |
193 | msg += "</i>"; | ||
193 | } | 194 | } |
194 | msg += "</i><BR>"; | 195 | |
195 | |||
196 | if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) | 196 | if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) |
197 | { | 197 | { |
198 | msg += "All day"; | 198 | msg += "<br>All day"; |
199 | } | 199 | } |
200 | else | 200 | else |
201 | { | 201 | { |
202 | // start time of event | 202 | // start time of event |
203 | msg += TimeString::timeString(QTime((*it).event().start().time()) ) | 203 | msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) |
204 | // end time of event | 204 | // end time of event |
205 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); | 205 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); |
206 | } | 206 | } |
207 | msg += "<BR>"; | 207 | msg += "<BR>"; |
208 | // include possible note or not | 208 | // include possible note or not |
209 | if (SHOW_NOTES == 1) | 209 | if (SHOW_NOTES == 1) |
210 | { | 210 | { |
211 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 211 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
212 | } | 212 | } |
213 | } | 213 | } |
214 | else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) | 214 | else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) |
215 | { | 215 | { |
216 | msg += "<B>" + (*it).description() + "</B>"; | 216 | msg += "<B>" + (*it).description() + "</B>"; |
217 | if ( (*it).event().hasAlarm() ) | 217 | if ( (*it).event().hasAlarm() ) |
218 | { | 218 | { |
219 | msg += " <b>[with alarm]</b>"; | 219 | msg += " <b>[with alarm]</b>"; |
220 | } | 220 | } |
221 | // include location or not | 221 | // include location or not |
222 | if (SHOW_LOCATION == 1) | 222 | if (SHOW_LOCATION == 1) |
223 | { | 223 | { |
224 | msg+= "<BR><i>" + (*it).location(); | 224 | msg+= "<BR><i>" + (*it).location(); |
225 | msg += "</i>"; | ||
225 | } | 226 | } |
226 | msg += "</i><BR>"; | 227 | |
227 | |||
228 | if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) | 228 | if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) |
229 | { | 229 | { |
230 | msg += "All day"; | 230 | msg += "<br>All day"; |
231 | } | 231 | } |
232 | else | 232 | else |
233 | { | 233 | { |
234 | // start time of event | 234 | // start time of event |
235 | msg += TimeString::timeString(QTime((*it).event().start().time()) ) | 235 | msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) |
236 | // end time of event | 236 | // end time of event |
237 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); | 237 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); |
238 | } | 238 | } |
239 | msg += "<BR>"; | 239 | msg += "<BR>"; |
240 | // include possible note or not | 240 | // include possible note or not |
241 | if (SHOW_NOTES == 1) | 241 | if (SHOW_NOTES == 1) |
242 | { | 242 | { |
243 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 243 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
248 | if (msg.isEmpty()) | 248 | if (msg.isEmpty()) |
249 | { | 249 | { |
250 | msg = "No more appointments today"; | 250 | msg = "No more appointments today"; |
251 | } | 251 | } |
252 | DatesField->setText(msg); | 252 | DatesField->setText(msg); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * Parse in the todolist.xml | 257 | * Parse in the todolist.xml |
258 | */ | 258 | */ |
259 | QList<TodoItem> Today::loadTodo(const char *filename) | 259 | QList<TodoItem> Today::loadTodo(const char *filename) |
260 | { | 260 | { |
261 | DOM *todo; | 261 | DOM *todo; |
262 | ELE *tasks; | 262 | ELE *tasks; |
263 | ELE **tasklist; | 263 | ELE **tasklist; |
264 | ATT **attlist; | 264 | ATT **attlist; |
265 | int i, j; | 265 | int i, j; |
266 | char *description; | 266 | char *description; |
267 | int completed; | 267 | int completed; |
268 | int priority; | 268 | int priority; |
269 | TodoItem *tmp; | 269 | TodoItem *tmp; |
270 | QList<TodoItem> loadtodolist; | 270 | QList<TodoItem> loadtodolist; |
271 | 271 | ||
272 | todo = minidom_load(filename); | 272 | todo = minidom_load(filename); |
273 | 273 | ||
274 | tasks = todo->el; | 274 | tasks = todo->el; |
275 | tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ | 275 | tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ |
276 | if(tasks) | 276 | if(tasks) |
277 | { | 277 | { |
278 | tasklist = tasks->el; | 278 | tasklist = tasks->el; |
279 | i = 0; | 279 | i = 0; |
280 | while((tasklist) && (tasklist[i])) | 280 | while((tasklist) && (tasklist[i])) |
281 | { | 281 | { |
282 | attlist = tasklist[i]->at; | 282 | attlist = tasklist[i]->at; |
283 | j = 0; | 283 | j = 0; |
284 | description = NULL; | 284 | description = NULL; |
285 | priority = -1; | 285 | priority = -1; |
286 | completed = -1; | 286 | completed = -1; |
287 | while((attlist) && (attlist[j])) | 287 | while((attlist) && (attlist[j])) |
288 | { | 288 | { |
289 | // SEGFAULT HERE WITH MORE THAN 7 ENTRIES | 289 | // SEGFAULT HERE WITH MORE THAN 7 ENTRIES |
290 | if(!attlist[j]->name) continue; | 290 | if(!attlist[j]->name) continue; |
291 | if(!strcmp(attlist[j]->name, "Description")) | 291 | if(!strcmp(attlist[j]->name, "Description")) |
292 | { | 292 | { |
293 | description = attlist[j]->value; | 293 | description = attlist[j]->value; |
294 | } | 294 | } |
295 | // get Completed tag (0 or 1) | 295 | // get Completed tag (0 or 1) |
296 | if(!strcmp(attlist[j]->name, "Completed")) | 296 | if(!strcmp(attlist[j]->name, "Completed")) |
297 | { | 297 | { |
298 | QString s = attlist[j]->name; | 298 | QString s = attlist[j]->name; |
299 | if(s == "Completed") | 299 | if(s == "Completed") |
300 | { | 300 | { |
301 | completed = QString(attlist[j]->value).toInt(); | 301 | completed = QString(attlist[j]->value).toInt(); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | // get Priority (1 to 5) | 304 | // get Priority (1 to 5) |
305 | if(!strcmp(attlist[j]->name, "Priority")) | 305 | if(!strcmp(attlist[j]->name, "Priority")) |
306 | { | 306 | { |
307 | QString s = attlist[j]->name; | 307 | QString s = attlist[j]->name; |
308 | if(s == "Priority") | 308 | if(s == "Priority") |
309 | { | 309 | { |
310 | priority = QString(attlist[j]->value).toInt(); | 310 | priority = QString(attlist[j]->value).toInt(); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | j++; | 313 | j++; |
314 | } | 314 | } |
315 | if(description) | 315 | if(description) |
316 | { | 316 | { |
317 | tmp = new TodoItem(description, completed, priority); | 317 | tmp = new TodoItem(description, completed, priority); |
318 | loadtodolist.append(tmp); | 318 | loadtodolist.append(tmp); |
319 | } | 319 | } |
320 | i++; | 320 | i++; |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | minidom_free(todo); | 324 | minidom_free(todo); |
325 | 325 | ||
326 | return loadtodolist; | 326 | return loadtodolist; |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | void Today::getMail() | 330 | void Today::getMail() |
331 | { | 331 | { |