summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
authordrw <drw>2003-05-18 23:20:25 (UTC)
committer drw <drw>2003-05-18 23:20:25 (UTC)
commit586dea6e61c766da49ba6cb55dd71851c0fafad3 (patch) (side-by-side diff)
tree6122bd75b327c4a29157a66e273bae9632ac22a0 /libopie2/opiepim
parent34c5b88459bcf5e02deae6b04e8bc17ee0de74c0 (diff)
downloadopie-586dea6e61c766da49ba6cb55dd71851c0fafad3.zip
opie-586dea6e61c766da49ba6cb55dd71851c0fafad3.tar.gz
opie-586dea6e61c766da49ba6cb55dd71851c0fafad3.tar.bz2
Updates to ocontact, oevent & otodo's toRichText() implementations
Diffstat (limited to 'libopie2/opiepim') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/ocontact.cpp31
-rw-r--r--libopie2/opiepim/oevent.cpp40
-rw-r--r--libopie2/opiepim/otodo.cpp52
3 files changed, 97 insertions, 26 deletions
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index a7ca975..a2fb68c 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -441,5 +441,6 @@ QString OContact::toRichText() const
// name, jobtitle and company
if ( !(value = fullName()).isEmpty() )
- text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
+ text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>";
+
if ( !(value = jobTitle()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
@@ -456,15 +457,17 @@ QString OContact::toRichText() const
text += Qtopia::escapeString(comp) + "<br>";
+ text += "<hr><br>";
+
+ // defailt email
QString defEmail = defaultEmail();
if ( !defEmail.isEmpty() )
- text += "<b>" + QObject::tr("Default Email: ") + "</b>"
+ text += "<b><img src=\"addressbook/email\">" + QObject::tr("Default Email: ") + "</b>"
+ Qtopia::escapeString(defEmail) + "<br>";
- text += "<hr>";
+ text += "<br>";
// business address
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
!businessZip().isEmpty() || !businessCountry().isEmpty() ) {
- text += "<br>";
text += QObject::tr( "<b>Work Address:</b>" );
text += "<br>";
@@ -497,5 +500,5 @@ QString OContact::toRichText() const
str = businessWebpage();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
+ text += "<b><img src=\"addressbook/webpagework\">" + QObject::tr("Business Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -503,5 +506,5 @@ QString OContact::toRichText() const
str = businessPhone();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
+ text += "<b><img src=\"addressbook/phonework\">" + QObject::tr("Business Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -509,5 +512,5 @@ QString OContact::toRichText() const
str = businessFax();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
+ text += "<b><img src=\"addressbook/faxwork\">" + QObject::tr("Business Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -515,5 +518,5 @@ QString OContact::toRichText() const
str = businessMobile();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
+ text += "<b><img src=\"addressbook/mobilework\">" + QObject::tr("Business Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -526,8 +529,9 @@ QString OContact::toRichText() const
}
+ text += "<br>";
+
// home address
if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
!homeZip().isEmpty() || !homeCountry().isEmpty() ) {
- text += "<br>";
text += QObject::tr( "<b>Home Address:</b>" );
text += "<br>";
@@ -552,5 +556,5 @@ QString OContact::toRichText() const
str = homeWebpage();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
+ text += "<b><img src=\"addressbook/webpagehome\">" + QObject::tr("Home Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -558,5 +562,5 @@ QString OContact::toRichText() const
str = homePhone();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
+ text += "<b><img src=\"addressbook/phonehome\">" + QObject::tr("Home Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -564,5 +568,5 @@ QString OContact::toRichText() const
str = homeFax();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
+ text += "<b><img src=\"addressbook/faxhome\">" + QObject::tr("Home Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -570,5 +574,5 @@ QString OContact::toRichText() const
str = homeMobile();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
+ text += "<b><img src=\"addressbook/mobilehome\">" + QObject::tr("Home Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
@@ -626,4 +630,5 @@ QString OContact::toRichText() const
+ Qtopia::escapeString(str) + "<br>";
+ // categories
if ( categoryNames("Contacts").count() ){
text += "<b>" + QObject::tr( "Category:") + "</b> ";
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index 83b191f..e4f5d92 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -236,10 +236,30 @@ bool OEvent::match( const QRegExp& re )const {
}
QString OEvent::toRichText()const {
- QString text;
+ QString text, value;
+
+ // description
+ text += "<b><h3><img src=\"datebook/DateBook\">";
if ( !description().isEmpty() ) {
- text += "<b>" + QObject::tr( "Description:") + "</b><br>";
- text += Qtopia::escapeString(description() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" );
+ }
+ text += "</h3></b><br><hr><br>";
+
+ // location
+ if ( !(value = location()).isEmpty() ) {
+ text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
+ text += Qtopia::escapeString(value) + "<br>";
+ }
+
+ // all day event
+ if ( isAllDay() ) {
+ text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
}
+ // multiple day event
+ else if ( isMultipleDay () ) {
+ text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>";
+ }
+ // start & end times
+ else {
+ // start time
if ( startDateTime().isValid() ) {
text += "<b>" + QObject::tr( "Start:") + "</b> ";
@@ -247,4 +267,6 @@ QString OEvent::toRichText()const {
replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
+
+ // end time
if ( endDateTime().isValid() ) {
text += "<b>" + QObject::tr( "End:") + "</b> ";
@@ -252,4 +274,14 @@ QString OEvent::toRichText()const {
replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
+ }
+
+ // categories
+ if ( categoryNames("Calendar").count() ){
+ text += "<b>" + QObject::tr( "Category:") + "</b> ";
+ text += categoryNames("Calendar").join(", ");
+ text += "<br>";
+ }
+
+ //notes
if ( !note().isEmpty() ) {
text += "<b>" + QObject::tr( "Note:") + "</b><br>";
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index e087a00..c84eeeb 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -274,25 +274,59 @@ QString OTodo::toRichText() const
QStringList catlist;
- // Description of the todo
+ // summary
+ text += "<b><h3><img src=\"todo/TodoList\">";
if ( !summary().isEmpty() ) {
- text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
- text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
}
+ text += "</h3></b><br><hr><br>";
+
+ // description
if( !description().isEmpty() ){
text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
}
- text += "<br><br><br>";
- text += "<b>" + QObject::tr( "Priority:") +" </b>"
- + QString::number( priority() ) + " <br>";
+ // priority
+ int priorityval = priority();
+ text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
+ QString::number( priorityval ) + "\">";
+// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" +
+// QString::number( priority() ) + "\"><br>";
+ 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 += "<br>";
+
+ // progress
text += "<b>" + QObject::tr( "Progress:") + " </b>"
+ QString::number( progress() ) + " %<br>";
+
+ // due date
if (hasDueDate() ){
- text += "<b>" + QObject::tr( "Deadline:") + " </b>";
- text += dueDate().toString();
- text += "<br>";
+ QDate dd = dueDate();
+ int off = QDate::currentDate().daysTo( dd );
+
+ text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
+ if ( off < 0 )
+ text += "#FF0000";
+ else if ( off == 0 )
+ text += "#FFFF00";
+ else if ( off > 0 )
+ text += "#00FF00";
+
+ text += "\">" + dd.toString() + "</font><br>";
}
+ // categories
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames( "Todo List" ).join(", ");