From 8a56de0062724c2ed52481af0a22e0f69423ff51 Mon Sep 17 00:00:00 2001 From: eilers Date: Thu, 02 Jan 2003 10:24:30 +0000 Subject: Detailview cleanup.. --- (limited to 'libopie2/opiepim/ocontact.cpp') diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index c9084ad..9230b8b 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp @@ -437,10 +437,12 @@ QString OContact::toRichText() const { QString text; QString value, comp, state; + QString str; + bool marker = false; // 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,12 +457,20 @@ QString OContact::toRichText() const if ( !comp.isEmpty() ) text += Qtopia::escapeString(comp) + "
"; + QString defEmail = defaultEmail(); + if ( !defEmail.isEmpty() ) + text += "" + QObject::tr("Default Email: ") + "" + + Qtopia::escapeString(defEmail) + "
"; + + text += "
"; + // business address if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || !businessZip().isEmpty() || !businessCountry().isEmpty() ) { text += "
"; text += QObject::tr( "Work Address:" ); text += "
"; + marker = true; } if ( !(value = businessStreet()).isEmpty() ) @@ -478,6 +488,44 @@ QString OContact::toRichText() const if ( !(value = businessCountry()).isEmpty() ) text += Qtopia::escapeString(value) + "
"; + // rest of Business data + str = office(); + if ( !str.isEmpty() ){ + text += "" + QObject::tr("Office: ") + "" + + Qtopia::escapeString(str) + "
"; + marker = true; + } + str = businessWebpage(); + if ( !str.isEmpty() ){ + text += "" + QObject::tr("Business Web Page: ") + "" + + Qtopia::escapeString(str) + "
"; + marker = true; + } + str = businessPhone(); + if ( !str.isEmpty() ){ + text += "" + QObject::tr("Business Phone: ") + "" + + Qtopia::escapeString(str) + "
"; + marker = true; + } + str = businessFax(); + if ( !str.isEmpty() ){ + text += "" + QObject::tr("Business Fax: ") + "" + + Qtopia::escapeString(str) + "
"; + marker = true; + } + str = businessMobile(); + if ( !str.isEmpty() ){ + text += "" + QObject::tr("Business Mobile: ") + "" + + Qtopia::escapeString(str) + "
"; + marker = true; + } + str = businessPager(); + if ( !str.isEmpty() ){ + text += "" + QObject::tr("Business Pager: ") + "" + + Qtopia::escapeString(str) + "
"; + marker = true; + } + // home address if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || !homeZip().isEmpty() || !homeCountry().isEmpty() ) { @@ -501,55 +549,38 @@ QString OContact::toRichText() const if ( !(value = homeCountry()).isEmpty() ) text += Qtopia::escapeString(value) + "
"; - // the others... - QString str; - QString defEmail = defaultEmail(); - if ( !defEmail.isEmpty() ) - text += "" + QObject::tr("Default Email: ") + "" - + Qtopia::escapeString(defEmail) + "
"; - str = emails(); - if ( !str.isEmpty() && ( str != defEmail ) ) - text += "" + QObject::tr("All Emails: ") + "" + // rest of Home data + str = homeWebpage(); + if ( !str.isEmpty() ){ + text += "" + QObject::tr("Home Web Page: ") + "" + Qtopia::escapeString(str) + "
"; + marker = true; + } str = homePhone(); - if ( !str.isEmpty() ) + if ( !str.isEmpty() ){ text += "" + QObject::tr("Home Phone: ") + "" + Qtopia::escapeString(str) + "
"; + marker = true; + } str = homeFax(); - if ( !str.isEmpty() ) + if ( !str.isEmpty() ){ text += "" + QObject::tr("Home Fax: ") + "" + Qtopia::escapeString(str) + "
"; + marker = true; + } str = homeMobile(); - if ( !str.isEmpty() ) + if ( !str.isEmpty() ){ text += "" + QObject::tr("Home Mobile: ") + "" + Qtopia::escapeString(str) + "
"; - str = homeWebpage(); - if ( !str.isEmpty() ) - text += "" + QObject::tr("Home Web Page: ") + "" - + Qtopia::escapeString(str) + "
"; - str = businessWebpage(); - if ( !str.isEmpty() ) - text += "" + QObject::tr("Business Web Page: ") + "" - + Qtopia::escapeString(str) + "
"; - str = office(); - if ( !str.isEmpty() ) - text += "" + QObject::tr("Office: ") + "" - + Qtopia::escapeString(str) + "
"; - str = businessPhone(); - if ( !str.isEmpty() ) - text += "" + QObject::tr("Business Phone: ") + "" - + Qtopia::escapeString(str) + "
"; - str = businessFax(); - if ( !str.isEmpty() ) - text += "" + QObject::tr("Business Fax: ") + "" - + Qtopia::escapeString(str) + "
"; - str = businessMobile(); - if ( !str.isEmpty() ) - text += "" + QObject::tr("Business Mobile: ") + "" - + Qtopia::escapeString(str) + "
"; - str = businessPager(); - if ( !str.isEmpty() ) - text += "" + QObject::tr("Business Pager: ") + "" + marker = true; + } + + if ( marker ) + text += "


"; + // the others... + str = emails(); + if ( !str.isEmpty() && ( str != defEmail ) ) + text += "" + QObject::tr("All Emails: ") + "" + Qtopia::escapeString(str) + "
"; str = profession(); if ( !str.isEmpty() ) @@ -603,12 +634,13 @@ QString OContact::toRichText() const // notes last if ( (value = notes()) ) { - QRegExp reg("\n"); + text += "

" + QObject::tr( "Notes:") + " "; + QRegExp reg("\n"); - //QString tmp = Qtopia::escapeString(value); - QString tmp = QStyleSheet::convertFromPlainText(value); - //tmp.replace( reg, "
" ); - text += "
" + tmp + "
"; + //QString tmp = Qtopia::escapeString(value); + QString tmp = QStyleSheet::convertFromPlainText(value); + //tmp.replace( reg, "
" ); + text += "
" + tmp + "
"; } return text; } -- cgit v0.9.0.2