From 586dea6e61c766da49ba6cb55dd71851c0fafad3 Mon Sep 17 00:00:00 2001 From: drw Date: Sun, 18 May 2003 23:20:25 +0000 Subject: Updates to ocontact, oevent & otodo's toRichText() implementations --- (limited to 'libopie/pim') diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index a7ca975..a2fb68c 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp @@ -440,7 +440,8 @@ QString OContact::toRichText() const // name, jobtitle and company if ( !(value = fullName()).isEmpty() ) - text += "

" + Qtopia::escapeString(value) + "


"; + text += "

" + Qtopia::escapeString(value) + "

"; + if ( !(value = jobTitle()).isEmpty() ) text += Qtopia::escapeString(value) + "
"; @@ -455,17 +456,19 @@ QString OContact::toRichText() const if ( !comp.isEmpty() ) text += Qtopia::escapeString(comp) + "
"; + text += "

"; + + // defailt email QString defEmail = defaultEmail(); if ( !defEmail.isEmpty() ) - text += "" + QObject::tr("Default Email: ") + "" + text += "" + QObject::tr("Default Email: ") + "" + Qtopia::escapeString(defEmail) + "
"; - text += "
"; + text += "
"; // business address if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || !businessZip().isEmpty() || !businessCountry().isEmpty() ) { - text += "
"; text += QObject::tr( "Work Address:" ); text += "
"; marker = true; @@ -496,25 +499,25 @@ QString OContact::toRichText() const } str = businessWebpage(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Business Web Page: ") + "" + text += "" + QObject::tr("Business Web Page: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } str = businessPhone(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Business Phone: ") + "" + text += "" + QObject::tr("Business Phone: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } str = businessFax(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Business Fax: ") + "" + text += "" + QObject::tr("Business Fax: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } str = businessMobile(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Business Mobile: ") + "" + text += "" + QObject::tr("Business Mobile: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } @@ -525,10 +528,11 @@ QString OContact::toRichText() const marker = true; } + text += "
"; + // home address if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || !homeZip().isEmpty() || !homeCountry().isEmpty() ) { - text += "
"; text += QObject::tr( "Home Address:" ); text += "
"; } @@ -551,25 +555,25 @@ QString OContact::toRichText() const // rest of Home data str = homeWebpage(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Home Web Page: ") + "" + text += "" + QObject::tr("Home Web Page: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } str = homePhone(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Home Phone: ") + "" + text += "" + QObject::tr("Home Phone: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } str = homeFax(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Home Fax: ") + "" + text += "" + QObject::tr("Home Fax: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } str = homeMobile(); if ( !str.isEmpty() ){ - text += "" + QObject::tr("Home Mobile: ") + "" + text += "" + QObject::tr("Home Mobile: ") + "" + Qtopia::escapeString(str) + "
"; marker = true; } @@ -625,6 +629,7 @@ QString OContact::toRichText() const text += "" + QObject::tr("Nickname: ") + "" + Qtopia::escapeString(str) + "
"; + // categories if ( categoryNames("Contacts").count() ){ text += "" + QObject::tr( "Category:") + " "; text += categoryNames("Contacts").join(", "); diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp index 83b191f..e4f5d92 100644 --- a/libopie/pim/oevent.cpp +++ b/libopie/pim/oevent.cpp @@ -235,22 +235,54 @@ bool OEvent::match( const QRegExp& re )const { return false; } QString OEvent::toRichText()const { - QString text; + QString text, value; + + // description + text += "

"; if ( !description().isEmpty() ) { - text += "" + QObject::tr( "Description:") + "
"; - text += Qtopia::escapeString(description() ). - replace(QRegExp( "[\n]"), "
" ) + "
"; + text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); + } + text += "




"; + + // location + if ( !(value = location()).isEmpty() ) { + text += "" + QObject::tr( "Location:" ) + " "; + text += Qtopia::escapeString(value) + "
"; + } + + // all day event + if ( isAllDay() ) { + text += "" + QObject::tr( "This is an all day event" ) + "
"; } - if ( startDateTime().isValid() ) { - text += "" + QObject::tr( "Start:") + " "; - text += Qtopia::escapeString(startDateTime().toString() ). - replace(QRegExp( "[\n]"), "
" ) + "
"; + // multiple day event + else if ( isMultipleDay () ) { + text += "" + QObject::tr( "This is a multiple day event" ) + "
"; + } + // start & end times + else { + // start time + if ( startDateTime().isValid() ) { + text += "" + QObject::tr( "Start:") + " "; + text += Qtopia::escapeString(startDateTime().toString() ). + replace(QRegExp( "[\n]"), "
" ) + "
"; + } + + // end time + if ( endDateTime().isValid() ) { + text += "" + QObject::tr( "End:") + " "; + text += Qtopia::escapeString(endDateTime().toString() ). + replace(QRegExp( "[\n]"), "
" ) + "
"; + } } - if ( endDateTime().isValid() ) { - text += "" + QObject::tr( "End:") + " "; - text += Qtopia::escapeString(endDateTime().toString() ). - replace(QRegExp( "[\n]"), "
" ) + "
"; + + // categories + if ( categoryNames("Calendar").count() ){ + text += "" + QObject::tr( "Category:") + " "; + text += categoryNames("Calendar").join(", "); + text += "
"; } + + //notes if ( !note().isEmpty() ) { text += "" + QObject::tr( "Note:") + "
"; text += note(); 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 @@ -273,27 +273,61 @@ QString OTodo::toRichText() const QString text; QStringList catlist; - // Description of the todo + // summary + text += "

"; if ( !summary().isEmpty() ) { - text += "" + QObject::tr( "Summary:") + "
"; - text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "
" ) + "
"; + text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); } + text += "




"; + + // description if( !description().isEmpty() ){ text += "" + QObject::tr( "Description:" ) + "
"; text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "
" ) ; } - text += "


"; - text += "" + QObject::tr( "Priority:") +" " - + QString::number( priority() ) + "
"; + // priority + int priorityval = priority(); + text += "" + QObject::tr( "Priority:") +" "; +// text += "" + QObject::tr( "Priority:") +"
"; + switch ( priorityval ) + { + case 1 : text += QObject::tr( "Very high" ); + break; + case 2 : text += QObject::tr( "High" ); + break; + case 3 : text += QObject::tr( "Normal" ); + break; + case 4 : text += QObject::tr( "Low" ); + break; + case 5 : text += QObject::tr( "Very low" ); + break; + }; + text += "
"; + + // progress text += "" + QObject::tr( "Progress:") + " " + QString::number( progress() ) + " %
"; + + // due date if (hasDueDate() ){ - text += "" + QObject::tr( "Deadline:") + " "; - text += dueDate().toString(); - text += "
"; + QDate dd = dueDate(); + int off = QDate::currentDate().daysTo( dd ); + + text += "" + QObject::tr( "Deadline:" ) + " 0 ) + text += "#00FF00"; + + text += "\">" + dd.toString() + "
"; } - + + // categories text += "" + QObject::tr( "Category:") + " "; text += categoryNames( "Todo List" ).join(", "); text += "
"; -- cgit v0.9.0.2