summaryrefslogtreecommitdiff
path: root/core
authorbipolar <bipolar>2002-03-08 03:17:37 (UTC)
committer bipolar <bipolar>2002-03-08 03:17:37 (UTC)
commit5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3 (patch) (unidiff)
tree4d40fb06ae37c1420723529e5f75bb7c41ae8c00 /core
parent11b56113b6641e0b85c6015eafab802dd7663198 (diff)
downloadopie-5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3.zip
opie-5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3.tar.gz
opie-5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3.tar.bz2
ljp: fixed QString problem
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp165
1 files changed, 83 insertions, 82 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 0fa7ad5..af1d4e4 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -91,13 +91,14 @@ void Today::draw() {
91 // how often refresh 91 // how often refresh
92 QTimer::singleShot( 5*1000, this, SLOT(draw()) ); 92 QTimer::singleShot( 5*1000, this, SLOT(draw()) );
93} 93}
94 94
95void Today::init() { 95void Today::init() {
96 QDate date = QDate::currentDate(); 96 QDate date = QDate::currentDate();
97 QString time = (tr( date.toString() ), white); 97 QString time = (tr( date.toString()) );
98// QString time = (tr( date.toString()) , white);
98 99
99 TextLabel1->setText(time); 100 TextLabel1->setText(time);
100 db = new DateBookDB; 101 db = new DateBookDB;
101 102
102 // read config 103 // read config
103 Config cfg("today"); 104 Config cfg("today");
@@ -183,70 +184,70 @@ void Today::getDates() {
183 int count=0; 184 int count=0;
184 185
185 if ( list.count() > 0 ) { 186 if ( list.count() > 0 ) {
186 QString msg; 187 QString msg;
187 188
188 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 189 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
189 it!=list.end(); ++it ) { 190 it!=list.end(); ++it ) {
190 191
191 count++; 192 count++;
192 193
193 if ( count <= MAX_LINES_MEET ) { 194 if ( count <= MAX_LINES_MEET ) {
194 //cout << time.toString() << endl; 195 //cout << time.toString() << endl;
195 //cout << TimeString::dateString((*it).event().end()) << endl; 196 //cout << TimeString::dateString((*it).event().end()) << endl;
196 197
197 // decide if to get all day or only later appointments 198 // decide if to get all day or only later appointments
198 if (!ONLY_LATER) { 199 if (!ONLY_LATER) {
199 msg += "<B>" + (*it).description() + "</B>"; 200 msg += "<B>" + (*it).description() + "</B>";
200 if ( (*it).event().hasAlarm() ) { 201 if ( (*it).event().hasAlarm() ) {
201 msg += " <b>[with alarm]</b>"; 202 msg += " <b>[with alarm]</b>";
202 } 203 }
203 // include location or not 204 // include location or not
204 if (SHOW_LOCATION == 1) { 205 if (SHOW_LOCATION == 1) {
205 msg += "<BR><i>" + (*it).location(); 206 msg += "<BR><i>" + (*it).location();
206 msg += "</i>"; 207 msg += "</i>";
207 } 208 }
208 209
209 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { 210 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
210 msg += "<br>All day"; 211 msg += "<br>All day";
211 } else { 212 } else {
212 // start time of event 213 // start time of event
213 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) 214 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
214 // end time of event 215 // end time of event
215 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); 216 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
216 } 217 }
217 msg += "<BR>"; 218 msg += "<BR>";
218 // include possible note or not 219 // include possible note or not
219 if (SHOW_NOTES == 1) { 220 if (SHOW_NOTES == 1) {
220 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 221 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
221 } 222 }
222 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { 223 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) {
223 msg += "<B>" + (*it).description() + "</B>"; 224 msg += "<B>" + (*it).description() + "</B>";
224 if ( (*it).event().hasAlarm() ) { 225 if ( (*it).event().hasAlarm() ) {
225 msg += " <b>[with alarm]</b>"; 226 msg += " <b>[with alarm]</b>";
226 } 227 }
227 // include location or not 228 // include location or not
228 if (SHOW_LOCATION == 1) { 229 if (SHOW_LOCATION == 1) {
229 msg+= "<BR><i>" + (*it).location(); 230 msg+= "<BR><i>" + (*it).location();
230 msg += "</i>"; 231 msg += "</i>";
231 } 232 }
232 233
233 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { 234 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
234 msg += "<br>All day"; 235 msg += "<br>All day";
235 } else { 236 } else {
236 // start time of event 237 // start time of event
237 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) 238 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
238 // end time of event 239 // end time of event
239 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); 240 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
240 } 241 }
241 msg += "<BR>"; 242 msg += "<BR>";
242 // include possible note or not 243 // include possible note or not
243 if (SHOW_NOTES == 1) { 244 if (SHOW_NOTES == 1) {
244 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; 245 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
245 } 246 }
246 } 247 }
247 } 248 }
248 } 249 }
249 if (msg.isEmpty()) { 250 if (msg.isEmpty()) {
250 msg = tr("No more appointments today"); 251 msg = tr("No more appointments today");
251 } 252 }
252 DatesField->setText(msg); 253 DatesField->setText(msg);
@@ -279,37 +280,37 @@ QList<TodoItem> Today::loadTodo(const char *filename) {
279 attlist = tasklist[i]->at; 280 attlist = tasklist[i]->at;
280 j = 0; 281 j = 0;
281 description = NULL; 282 description = NULL;
282 priority = -1; 283 priority = -1;
283 completed = -1; 284 completed = -1;
284 while((attlist) && (attlist[j])) { 285 while((attlist) && (attlist[j])) {
285 if(!attlist[j]->name) { 286 if(!attlist[j]->name) {
286 continue; 287 continue;
287 } 288 }
288 if(!strcmp(attlist[j]->name, "Description")) { 289 if(!strcmp(attlist[j]->name, "Description")) {
289 description = attlist[j]->value; 290 description = attlist[j]->value;
290 } 291 }
291 // get Completed tag (0 or 1) 292 // get Completed tag (0 or 1)
292 if(!strcmp(attlist[j]->name, "Completed")) { 293 if(!strcmp(attlist[j]->name, "Completed")) {
293 QString s = attlist[j]->name; 294 QString s = attlist[j]->name;
294 if(s == "Completed") { 295 if(s == "Completed") {
295 completed = QString(attlist[j]->value).toInt(); 296 completed = QString(attlist[j]->value).toInt();
296 } 297 }
297 } 298 }
298 // get Priority (1 to 5) 299 // get Priority (1 to 5)
299 if(!strcmp(attlist[j]->name, "Priority")) { 300 if(!strcmp(attlist[j]->name, "Priority")) {
300 QString s = attlist[j]->name; 301 QString s = attlist[j]->name;
301 if(s == "Priority") { 302 if(s == "Priority") {
302 priority = QString(attlist[j]->value).toInt(); 303 priority = QString(attlist[j]->value).toInt();
303 } 304 }
304 } 305 }
305 j++; 306 j++;
306 } 307 }
307 if(description) { 308 if(description) {
308 tmp = new TodoItem(description, completed, priority); 309 tmp = new TodoItem(description, completed, priority);
309 loadtodolist.append(tmp); 310 loadtodolist.append(tmp);
310 } 311 }
311 i++; 312 i++;
312 } 313 }
313 } 314 }
314 315
315 minidom_free(todo); 316 minidom_free(todo);
@@ -350,16 +351,16 @@ void Today::getTodo() {
350 if ( f.exists() ) { 351 if ( f.exists() ) {
351 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); 352 QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml");
352 353
353 TodoItem *item; 354 TodoItem *item;
354 for( item = todolist.first(); item; item = todolist.next()) { 355 for( item = todolist.first(); item; item = todolist.next()) {
355 if (!(item->getCompleted() == 1) ) { 356 if (!(item->getCompleted() == 1) ) {
356 count++; 357 count++;
357 if (count <= MAX_LINES_TASK) { 358 if (count <= MAX_LINES_TASK) {
358 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); 359 tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>")));
359 } 360 }
360 } 361 }
361 } 362 }
362 } 363 }
363 364
364 if (count > 0) { 365 if (count > 0) {
365 if( count == 1 ) { 366 if( count == 1 ) {