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