author | bipolar <bipolar> | 2002-03-08 03:17:37 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-03-08 03:17:37 (UTC) |
commit | 5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3 (patch) (side-by-side diff) | |
tree | 4d40fb06ae37c1420723529e5f75bb7c41ae8c00 /core/pim/today | |
parent | 11b56113b6641e0b85c6015eafab802dd7663198 (diff) | |
download | opie-5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3.zip opie-5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3.tar.gz opie-5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3.tar.bz2 |
ljp: fixed QString problem
-rw-r--r-- | core/pim/today/today.cpp | 165 |
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() { // how often refresh QTimer::singleShot( 5*1000, this, SLOT(draw()) ); } void Today::init() { QDate date = QDate::currentDate(); - QString time = (tr( date.toString() ), white); + QString time = (tr( date.toString()) ); +// QString time = (tr( date.toString()) , white); TextLabel1->setText(time); db = new DateBookDB; // read config Config cfg("today"); @@ -183,70 +184,70 @@ void Today::getDates() { int count=0; if ( list.count() > 0 ) { QString msg; for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); - it!=list.end(); ++it ) { + it!=list.end(); ++it ) { count++; if ( count <= MAX_LINES_MEET ) { - //cout << time.toString() << endl; - //cout << TimeString::dateString((*it).event().end()) << endl; - - // decide if to get all day or only later appointments - if (!ONLY_LATER) { - msg += "<B>" + (*it).description() + "</B>"; - if ( (*it).event().hasAlarm() ) { - msg += " <b>[with alarm]</b>"; - } - // include location or not - if (SHOW_LOCATION == 1) { - msg += "<BR><i>" + (*it).location(); - msg += "</i>"; - } - - if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { - msg += "<br>All day"; - } else { - // start time of event - msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) - // end time of event - + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); - } - msg += "<BR>"; - // include possible note or not - if (SHOW_NOTES == 1) { - msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; - } - } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { - msg += "<B>" + (*it).description() + "</B>"; - if ( (*it).event().hasAlarm() ) { - msg += " <b>[with alarm]</b>"; - } - // include location or not - if (SHOW_LOCATION == 1) { - msg+= "<BR><i>" + (*it).location(); - msg += "</i>"; - } - - if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { - msg += "<br>All day"; - } else { - // start time of event - msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) - // end time of event - + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); - } - msg += "<BR>"; - // include possible note or not - if (SHOW_NOTES == 1) { - msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; - } - } + //cout << time.toString() << endl; + //cout << TimeString::dateString((*it).event().end()) << endl; + + // decide if to get all day or only later appointments + if (!ONLY_LATER) { + msg += "<B>" + (*it).description() + "</B>"; + if ( (*it).event().hasAlarm() ) { + msg += " <b>[with alarm]</b>"; + } + // include location or not + if (SHOW_LOCATION == 1) { + msg += "<BR><i>" + (*it).location(); + msg += "</i>"; + } + + if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { + msg += "<br>All day"; + } else { + // start time of event + msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) + // end time of event + + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); + } + msg += "<BR>"; + // include possible note or not + if (SHOW_NOTES == 1) { + msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; + } + } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { + msg += "<B>" + (*it).description() + "</B>"; + if ( (*it).event().hasAlarm() ) { + msg += " <b>[with alarm]</b>"; + } + // include location or not + if (SHOW_LOCATION == 1) { + msg+= "<BR><i>" + (*it).location(); + msg += "</i>"; + } + + if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) { + msg += "<br>All day"; + } else { + // start time of event + msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) ) + // end time of event + + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ); + } + msg += "<BR>"; + // include possible note or not + if (SHOW_NOTES == 1) { + msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; + } + } } } if (msg.isEmpty()) { msg = tr("No more appointments today"); } DatesField->setText(msg); @@ -279,37 +280,37 @@ QList<TodoItem> Today::loadTodo(const char *filename) { attlist = tasklist[i]->at; j = 0; description = NULL; priority = -1; completed = -1; while((attlist) && (attlist[j])) { - if(!attlist[j]->name) { - continue; - } - if(!strcmp(attlist[j]->name, "Description")) { - description = attlist[j]->value; - } - // get Completed tag (0 or 1) - if(!strcmp(attlist[j]->name, "Completed")) { - QString s = attlist[j]->name; - if(s == "Completed") { - completed = QString(attlist[j]->value).toInt(); - } - } - // get Priority (1 to 5) - if(!strcmp(attlist[j]->name, "Priority")) { - QString s = attlist[j]->name; - if(s == "Priority") { - priority = QString(attlist[j]->value).toInt(); - } - } - j++; + if(!attlist[j]->name) { + continue; + } + if(!strcmp(attlist[j]->name, "Description")) { + description = attlist[j]->value; + } + // get Completed tag (0 or 1) + if(!strcmp(attlist[j]->name, "Completed")) { + QString s = attlist[j]->name; + if(s == "Completed") { + completed = QString(attlist[j]->value).toInt(); + } + } + // get Priority (1 to 5) + if(!strcmp(attlist[j]->name, "Priority")) { + QString s = attlist[j]->name; + if(s == "Priority") { + priority = QString(attlist[j]->value).toInt(); + } + } + j++; } if(description) { - tmp = new TodoItem(description, completed, priority); - loadtodolist.append(tmp); + tmp = new TodoItem(description, completed, priority); + loadtodolist.append(tmp); } i++; } } minidom_free(todo); @@ -350,16 +351,16 @@ void Today::getTodo() { if ( f.exists() ) { QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); TodoItem *item; for( item = todolist.first(); item; item = todolist.next()) { if (!(item->getCompleted() == 1) ) { - count++; - if (count <= MAX_LINES_TASK) { - tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); - } + count++; + if (count <= MAX_LINES_TASK) { + tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); + } } } } if (count > 0) { if( count == 1 ) { |