summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp122
-rw-r--r--libopie2/opiepim/ocontact.cpp122
2 files changed, 154 insertions, 90 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index c9084ad..9230b8b 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -432,40 +432,50 @@ QMap<int, QString> OContact::toMap() const
/*!
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;
// name, jobtitle and company
if ( !(value = fullName()).isEmpty() )
- text += "<b>" + Qtopia::escapeString(value) + "</b><br>";
+ text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
if ( !(value = jobTitle()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
comp = company();
if ( !(value = department()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( comp )
text += ", ";
else
text += "<br>";
}
if ( !comp.isEmpty() )
text += Qtopia::escapeString(comp) + "<br>";
+ QString defEmail = defaultEmail();
+ if ( !defEmail.isEmpty() )
+ text += "<b>" + QObject::tr("Default Email: ") + "</b>"
+ + Qtopia::escapeString(defEmail) + "<br>";
+
+ text += "<hr>";
+
// business address
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
!businessZip().isEmpty() || !businessCountry().isEmpty() ) {
text += "<br>";
text += QObject::tr( "<b>Work Address:</b>" );
text += "<br>";
+ marker = true;
}
if ( !(value = businessStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = businessState();
if ( !(value = businessCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( state )
@@ -473,16 +483,54 @@ QString OContact::toRichText() const
text += "<br>";
} else if ( !state.isEmpty() )
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = businessZip()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
if ( !(value = businessCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
+ // rest of Business data
+ str = office();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Office: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessWebpage();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessPhone();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessFax();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessMobile();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessPager();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+
// home address
if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
!homeZip().isEmpty() || !homeCountry().isEmpty() ) {
text += "<br>";
text += QObject::tr( "<b>Home Address:</b>" );
text += "<br>";
}
@@ -496,65 +544,48 @@ QString OContact::toRichText() const
text += "<br>";
} else if (!state.isEmpty())
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = homeZip()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
if ( !(value = homeCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
- // the others...
- QString str;
- QString defEmail = defaultEmail();
- if ( !defEmail.isEmpty() )
- text += "<b>" + QObject::tr("Default Email: ") + "</b>"
- + Qtopia::escapeString(defEmail) + "<br>";
- str = emails();
- if ( !str.isEmpty() && ( str != defEmail ) )
- text += "<b>" + QObject::tr("All Emails: ") + "</b>"
+ // rest of Home data
+ str = homeWebpage();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
str = homePhone();
- if ( !str.isEmpty() )
+ if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
str = homeFax();
- if ( !str.isEmpty() )
+ if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
str = homeMobile();
- if ( !str.isEmpty() )
+ if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
- str = homeWebpage();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessWebpage();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = office();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Office: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessPhone();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessFax();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessMobile();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessPager();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
+ marker = true;
+ }
+
+ if ( marker )
+ text += "<br><hr><br>";
+ // the others...
+ str = emails();
+ if ( !str.isEmpty() && ( str != defEmail ) )
+ text += "<b>" + QObject::tr("All Emails: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = profession();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Profession: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = assistant();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Assistant: ") + "</b>"
@@ -598,22 +629,23 @@ QString OContact::toRichText() const
if ( categoryNames().count() ){
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames().join(", ");
text += "<br>";
}
// notes last
if ( (value = notes()) ) {
- QRegExp reg("\n");
+ text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
+ QRegExp reg("\n");
- //QString tmp = Qtopia::escapeString(value);
- QString tmp = QStyleSheet::convertFromPlainText(value);
- //tmp.replace( reg, "<br>" );
- text += "<br>" + tmp + "<br>";
+ //QString tmp = Qtopia::escapeString(value);
+ QString tmp = QStyleSheet::convertFromPlainText(value);
+ //tmp.replace( reg, "<br>" );
+ text += "<br>" + tmp + "<br>";
}
return text;
}
/*!
\internal
*/
void OContact::insert( int key, const QString &v )
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
@@ -432,40 +432,50 @@ QMap<int, QString> OContact::toMap() const
/*!
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;
// name, jobtitle and company
if ( !(value = fullName()).isEmpty() )
- text += "<b>" + Qtopia::escapeString(value) + "</b><br>";
+ text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
if ( !(value = jobTitle()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
comp = company();
if ( !(value = department()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( comp )
text += ", ";
else
text += "<br>";
}
if ( !comp.isEmpty() )
text += Qtopia::escapeString(comp) + "<br>";
+ QString defEmail = defaultEmail();
+ if ( !defEmail.isEmpty() )
+ text += "<b>" + QObject::tr("Default Email: ") + "</b>"
+ + Qtopia::escapeString(defEmail) + "<br>";
+
+ text += "<hr>";
+
// business address
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
!businessZip().isEmpty() || !businessCountry().isEmpty() ) {
text += "<br>";
text += QObject::tr( "<b>Work Address:</b>" );
text += "<br>";
+ marker = true;
}
if ( !(value = businessStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = businessState();
if ( !(value = businessCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( state )
@@ -473,16 +483,54 @@ QString OContact::toRichText() const
text += "<br>";
} else if ( !state.isEmpty() )
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = businessZip()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
if ( !(value = businessCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
+ // rest of Business data
+ str = office();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Office: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessWebpage();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessPhone();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessFax();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessMobile();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+ str = businessPager();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
+ + Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
+
// home address
if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
!homeZip().isEmpty() || !homeCountry().isEmpty() ) {
text += "<br>";
text += QObject::tr( "<b>Home Address:</b>" );
text += "<br>";
}
@@ -496,65 +544,48 @@ QString OContact::toRichText() const
text += "<br>";
} else if (!state.isEmpty())
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = homeZip()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
if ( !(value = homeCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
- // the others...
- QString str;
- QString defEmail = defaultEmail();
- if ( !defEmail.isEmpty() )
- text += "<b>" + QObject::tr("Default Email: ") + "</b>"
- + Qtopia::escapeString(defEmail) + "<br>";
- str = emails();
- if ( !str.isEmpty() && ( str != defEmail ) )
- text += "<b>" + QObject::tr("All Emails: ") + "</b>"
+ // rest of Home data
+ str = homeWebpage();
+ if ( !str.isEmpty() ){
+ text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
str = homePhone();
- if ( !str.isEmpty() )
+ if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
str = homeFax();
- if ( !str.isEmpty() )
+ if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ marker = true;
+ }
str = homeMobile();
- if ( !str.isEmpty() )
+ if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
- str = homeWebpage();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessWebpage();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = office();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Office: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessPhone();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessFax();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessMobile();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
- str = businessPager();
- if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
+ marker = true;
+ }
+
+ if ( marker )
+ text += "<br><hr><br>";
+ // the others...
+ str = emails();
+ if ( !str.isEmpty() && ( str != defEmail ) )
+ text += "<b>" + QObject::tr("All Emails: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = profession();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Profession: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = assistant();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Assistant: ") + "</b>"
@@ -598,22 +629,23 @@ QString OContact::toRichText() const
if ( categoryNames().count() ){
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames().join(", ");
text += "<br>";
}
// notes last
if ( (value = notes()) ) {
- QRegExp reg("\n");
+ text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
+ QRegExp reg("\n");
- //QString tmp = Qtopia::escapeString(value);
- QString tmp = QStyleSheet::convertFromPlainText(value);
- //tmp.replace( reg, "<br>" );
- text += "<br>" + tmp + "<br>";
+ //QString tmp = Qtopia::escapeString(value);
+ QString tmp = QStyleSheet::convertFromPlainText(value);
+ //tmp.replace( reg, "<br>" );
+ text += "<br>" + tmp + "<br>";
}
return text;
}
/*!
\internal
*/
void OContact::insert( int key, const QString &v )