summaryrefslogtreecommitdiff
path: root/libopie/pim/otodo.cpp
Unidiff
Diffstat (limited to 'libopie/pim/otodo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/otodo.cpp52
1 files changed, 43 insertions, 9 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index e087a00..c84eeeb 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -264,45 +264,79 @@ void OTodo::setProgress(ushort progress )
264} 264}
265QString OTodo::toShortText() const { 265QString OTodo::toShortText() const {
266 return summary(); 266 return summary();
267} 267}
268/*! 268/*!
269 Returns a richt text string 269 Returns a richt text string
270*/ 270*/
271QString OTodo::toRichText() const 271QString OTodo::toRichText() const
272{ 272{
273 QString text; 273 QString text;
274 QStringList catlist; 274 QStringList catlist;
275 275
276 // Description of the todo 276 // summary
277 text += "<b><h3><img src=\"todo/TodoList\">";
277 if ( !summary().isEmpty() ) { 278 if ( !summary().isEmpty() ) {
278 text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; 279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
280 } 280 }
281 text += "</h3></b><br><hr><br>";
282
283 // description
281 if( !description().isEmpty() ){ 284 if( !description().isEmpty() ){
282 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 285 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
283 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 286 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
284 } 287 }
285 text += "<br><br><br>";
286 288
287 text += "<b>" + QObject::tr( "Priority:") +" </b>" 289 // priority
288 + QString::number( priority() ) + " <br>"; 290 int priorityval = priority();
291 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
292 QString::number( priorityval ) + "\">";
293// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" +
294// QString::number( priority() ) + "\"><br>";
295 switch ( priorityval )
296 {
297 case 1 : text += QObject::tr( "Very high" );
298 break;
299 case 2 : text += QObject::tr( "High" );
300 break;
301 case 3 : text += QObject::tr( "Normal" );
302 break;
303 case 4 : text += QObject::tr( "Low" );
304 break;
305 case 5 : text += QObject::tr( "Very low" );
306 break;
307 };
308 text += "<br>";
309
310 // progress
289 text += "<b>" + QObject::tr( "Progress:") + " </b>" 311 text += "<b>" + QObject::tr( "Progress:") + " </b>"
290 + QString::number( progress() ) + " %<br>"; 312 + QString::number( progress() ) + " %<br>";
313
314 // due date
291 if (hasDueDate() ){ 315 if (hasDueDate() ){
292 text += "<b>" + QObject::tr( "Deadline:") + " </b>"; 316 QDate dd = dueDate();
293 text += dueDate().toString(); 317 int off = QDate::currentDate().daysTo( dd );
294 text += "<br>"; 318
319 text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
320 if ( off < 0 )
321 text += "#FF0000";
322 else if ( off == 0 )
323 text += "#FFFF00";
324 else if ( off > 0 )
325 text += "#00FF00";
326
327 text += "\">" + dd.toString() + "</font><br>";
295 } 328 }
296 329
330 // categories
297 text += "<b>" + QObject::tr( "Category:") + "</b> "; 331 text += "<b>" + QObject::tr( "Category:") + "</b> ";
298 text += categoryNames( "Todo List" ).join(", "); 332 text += categoryNames( "Todo List" ).join(", ");
299 text += "<br>"; 333 text += "<br>";
300 334
301 return text; 335 return text;
302} 336}
303bool OTodo::hasNotifiers()const { 337bool OTodo::hasNotifiers()const {
304 if (!data->notifiers) return false; 338 if (!data->notifiers) return false;
305 return !data->notifiers->isEmpty(); 339 return !data->notifiers->isEmpty();
306} 340}
307OPimNotifyManager& OTodo::notifiers() { 341OPimNotifyManager& OTodo::notifiers() {
308 if (!data->notifiers ) 342 if (!data->notifiers )