summaryrefslogtreecommitdiff
path: root/libopie
Side-by-side diff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index 0f05b65..fcf3b26 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -403,109 +403,105 @@ OContact::~OContact()
/*! \fn QString OContact::field(int) const
\internal
*/
/*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null )
\internal
*/
/*! \fn void OContact::setUid( int id )
\internal
Sets the uid for this record to \a id.
*/
/*! \enum OContact::journal_action
\internal
*/
/*!
\internal
*/
QMap<int, QString> OContact::toMap() const
{
QMap<int, QString> map = mMap;
QString cats = idsToString( categories() );
if ( !cats.isEmpty() )
map.insert( Qtopia::AddressCategory, cats );
return map;
}
/*!
Returns a rich text formatted QString representing the contents the contact.
*/
QString OContact::toRichText() const
{
QString text;
QString value, comp, state;
QString str;
bool marker = false;
Config cfg("qpe");
cfg.setGroup("Appearance");
int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State );
// name, jobtitle and company
if ( !(value = fullName()).isEmpty() )
text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>";
if ( !(value = jobTitle()).isEmpty() )
- text += Qtopia::escapeString(value);
+ text += Qtopia::escapeString(value) + " ";
comp = company();
if ( !(value = department()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( comp )
- text += ", ";
- else
- text += "<br>";
- }
- if ( !comp.isEmpty() )
- text += Qtopia::escapeString(comp);
-
+ text += ", " + Qtopia::escapeString(comp);
+ }else if ( comp )
+ text += "<br>" + Qtopia::escapeString(comp);
text += "<br><hr>";
// defailt email
QString defEmail = defaultEmail();
if ( !defEmail.isEmpty() ){
text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>"
+ Qtopia::escapeString(defEmail);
marker = true;
}
// business address
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
!businessZip().isEmpty() || !businessCountry().isEmpty() ) {
text += QObject::tr( "<br><b>Work Address:</b>" );
marker = true;
}
if ( !(value = businessStreet()).isEmpty() ){
text += "<br>" + Qtopia::escapeString(value);
marker = true;
}
switch( addressformat ){
case Zip_City_State:{ // Zip_Code City, State
state = businessState();
if ( !(value = businessZip()).isEmpty() ){
text += "<br>" + Qtopia::escapeString(value) + " ";
marker = true;
}
if ( !(value = businessCity()).isEmpty() ) {
marker = true;
if ( businessZip().isEmpty() && !businessStreet().isEmpty() )
text += "<br>";
text += Qtopia::escapeString(value);
if ( state )
text += ", " + Qtopia::escapeString(state);
} else if ( !state.isEmpty() ){
text += "<br>" + Qtopia::escapeString(state);
marker = true;
}
break;
}
case City_State_Zip:{ // City, State Zip_Code
state = businessState();
if ( !(value = businessCity()).isEmpty() ) {
marker = true;
text += "<br>" + Qtopia::escapeString(value);