-rw-r--r-- | libopie/pim/ocontact.cpp | 18 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index 3473baa..e34feeb 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp @@ -429,213 +429,213 @@ QMap<int, QString> OContact::toMap() const 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); comp = company(); if ( !(value = department()).isEmpty() ) { text += Qtopia::escapeString(value); if ( comp ) text += ", "; else text += "<br>"; } if ( !comp.isEmpty() ) text += 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><br><b>Work Address:</b>" ); + 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; - } else - text += "<br>"; - + } 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); if ( state ) text += ", " + Qtopia::escapeString(state); } else if ( !state.isEmpty() ){ text += "<br>" + Qtopia::escapeString(state); marker = true; } if ( !(value = businessZip()).isEmpty() ){ text += " " + Qtopia::escapeString(value); marker = true; } break; } } if ( !(value = businessCountry()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value); marker = true; } // rest of Business data str = office(); if ( !str.isEmpty() ){ text += "<br><b>" + QObject::tr("Office: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessWebpage(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessPhone(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessFax(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessMobile(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessPager(); if ( !str.isEmpty() ){ text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" + Qtopia::escapeString(str); marker = true; } - text += "<br>"; + // text += "<br>"; // home address if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || !homeZip().isEmpty() || !homeCountry().isEmpty() ) { - text += QObject::tr( "<br><br><b>Home Address:</b>" ); + text += QObject::tr( "<br><b>Home Address:</b>" ); marker = true; } if ( !(value = homeStreet()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value); marker = true; } switch( addressformat ){ case Zip_City_State:{ // Zip_Code City, State state = homeState(); if ( !(value = homeZip()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value) + " "; marker = true; - } else - text += "<br>"; - + } if ( !(value = homeCity()).isEmpty() ) { marker = true; + if ( homeZip().isEmpty() && !homeStreet().isEmpty() ) + text += "<br>"; text += Qtopia::escapeString(value); if ( !state.isEmpty() ) 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 = homeState(); if ( !(value = homeCity()).isEmpty() ) { marker = true; text += "<br>" + Qtopia::escapeString(value); if ( state ) text += ", " + Qtopia::escapeString(state); } else if ( !state.isEmpty() ){ text += "<br>" + Qtopia::escapeString(state); marker = true; } if ( !(value = homeZip()).isEmpty() ){ text += " " + Qtopia::escapeString(value); marker = true; } break; } } if ( !(value = homeCountry()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value); marker = true; } // rest of Home data str = homeWebpage(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = homePhone(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = homeFax(); if ( !str.isEmpty() ){ diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index 3473baa..e34feeb 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp @@ -429,213 +429,213 @@ QMap<int, QString> OContact::toMap() const 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); comp = company(); if ( !(value = department()).isEmpty() ) { text += Qtopia::escapeString(value); if ( comp ) text += ", "; else text += "<br>"; } if ( !comp.isEmpty() ) text += 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><br><b>Work Address:</b>" ); + 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; - } else - text += "<br>"; - + } 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); if ( state ) text += ", " + Qtopia::escapeString(state); } else if ( !state.isEmpty() ){ text += "<br>" + Qtopia::escapeString(state); marker = true; } if ( !(value = businessZip()).isEmpty() ){ text += " " + Qtopia::escapeString(value); marker = true; } break; } } if ( !(value = businessCountry()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value); marker = true; } // rest of Business data str = office(); if ( !str.isEmpty() ){ text += "<br><b>" + QObject::tr("Office: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessWebpage(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessPhone(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessFax(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessMobile(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = businessPager(); if ( !str.isEmpty() ){ text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" + Qtopia::escapeString(str); marker = true; } - text += "<br>"; + // text += "<br>"; // home address if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || !homeZip().isEmpty() || !homeCountry().isEmpty() ) { - text += QObject::tr( "<br><br><b>Home Address:</b>" ); + text += QObject::tr( "<br><b>Home Address:</b>" ); marker = true; } if ( !(value = homeStreet()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value); marker = true; } switch( addressformat ){ case Zip_City_State:{ // Zip_Code City, State state = homeState(); if ( !(value = homeZip()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value) + " "; marker = true; - } else - text += "<br>"; - + } if ( !(value = homeCity()).isEmpty() ) { marker = true; + if ( homeZip().isEmpty() && !homeStreet().isEmpty() ) + text += "<br>"; text += Qtopia::escapeString(value); if ( !state.isEmpty() ) 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 = homeState(); if ( !(value = homeCity()).isEmpty() ) { marker = true; text += "<br>" + Qtopia::escapeString(value); if ( state ) text += ", " + Qtopia::escapeString(state); } else if ( !state.isEmpty() ){ text += "<br>" + Qtopia::escapeString(state); marker = true; } if ( !(value = homeZip()).isEmpty() ){ text += " " + Qtopia::escapeString(value); marker = true; } break; } } if ( !(value = homeCountry()).isEmpty() ){ text += "<br>" + Qtopia::escapeString(value); marker = true; } // rest of Home data str = homeWebpage(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = homePhone(); if ( !str.isEmpty() ){ text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" + Qtopia::escapeString(str); marker = true; } str = homeFax(); if ( !str.isEmpty() ){ |