summaryrefslogtreecommitdiff
authoreilers <eilers>2003-01-02 10:24:30 (UTC)
committer eilers <eilers>2003-01-02 10:24:30 (UTC)
commit8a56de0062724c2ed52481af0a22e0f69423ff51 (patch) (side-by-side diff)
tree7a9bf841e129d1e84d5b8b15887f37630ca32f06
parentbd26d4cab11d12f3382bb6fb6e0f7c7815975013 (diff)
downloadopie-8a56de0062724c2ed52481af0a22e0f69423ff51.zip
opie-8a56de0062724c2ed52481af0a22e0f69423ff51.tar.gz
opie-8a56de0062724c2ed52481af0a22e0f69423ff51.tar.bz2
Detailview cleanup..
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
@@ -312,428 +312,460 @@ OContact::~OContact()
Returns the department for the contact.
*/
/*! \fn QString OContact::office() const
Returns the office for the contact.
*/
/*! \fn QString OContact::jobTitle() const
Returns the job title of the contact.
*/
/*! \fn QString OContact::profession() const
Returns the profession of the contact.
*/
/*! \fn QString OContact::assistant() const
Returns the assistant of the contact.
*/
/*! \fn QString OContact::manager() const
Returns the manager of the contact.
*/
/*! \fn QString OContact::businessStreet() const
Returns the business street address of the contact.
*/
/*! \fn QString OContact::businessCity() const
Returns the business city of the contact.
*/
/*! \fn QString OContact::businessState() const
Returns the business state of the contact.
*/
/*! \fn QString OContact::businessZip() const
Returns the business zip of the contact.
*/
/*! \fn QString OContact::businessCountry() const
Returns the business country of the contact.
*/
/*! \fn QString OContact::businessPhone() const
Returns the business phone number of the contact.
*/
/*! \fn QString OContact::businessFax() const
Returns the business fax number of the contact.
*/
/*! \fn QString OContact::businessMobile() const
Returns the business mobile number of the contact.
*/
/*! \fn QString OContact::businessPager() const
Returns the business pager number of the contact.
*/
/*! \fn QString OContact::businessWebpage() const
Returns the business webpage of the contact.
*/
/*! \fn QString OContact::spouse() const
Returns the spouse of the contact.
*/
/*! \fn QString OContact::gender() const
Returns the gender of the contact.
*/
/*! \fn QString OContact::nickname() const
Returns the nickname of the contact.
*/
/*! \fn QString OContact::children() const
Returns the children of the contact.
*/
/*! \fn QString OContact::notes() const
Returns the notes relating to the the contact.
*/
/*! \fn QString OContact::groups() const
\internal
Returns the groups for the contact.
*/
/*! \fn QStringList OContact::groupList() const
\internal
*/
/*! \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;
// 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 )
text += ", " + Qtopia::escapeString(state);
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>";
}
if ( !(value = homeStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = homeState();
if ( !(value = homeCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( !state.isEmpty() )
text += ", " + Qtopia::escapeString(state);
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>"
+ Qtopia::escapeString(str) + "<br>";
str = manager();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Manager: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = gender();
if ( !str.isEmpty() && str.toInt() != 0 ) {
if ( str.toInt() == 1 )
str = QObject::tr( "Male" );
else if ( str.toInt() == 2 )
str = QObject::tr( "Female" );
text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
}
str = spouse();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Spouse: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
if ( birthday().isValid() ){
str = TimeString::numberDateString( birthday() );
text += "<b>" + QObject::tr("Birthday: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
if ( anniversary().isValid() ){
str = TimeString::numberDateString( anniversary() );
text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
str = children();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Children: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = nickname();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Nickname: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
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 )
{
QString value = v.stripWhiteSpace();
if ( value.isEmpty() )
mMap.remove( key );
else
mMap.insert( key, value );
}
/*!
\internal
*/
void OContact::replace( int key, const QString & v )
{
QString value = v.stripWhiteSpace();
if ( value.isEmpty() )
mMap.remove( key );
else
mMap.replace( key, value );
}
/*!
\internal
*/
QString OContact::find( int key ) const
{
return mMap[key];
}
/*!
\internal
*/
QString OContact::displayAddress( const QString &street,
const QString &city,
const QString &state,
const QString &zip,
const QString &country ) const
{
QString s = street;
if ( !street.isEmpty() )
s+= "\n";
s += city;
if ( !city.isEmpty() && !state.isEmpty() )
s += ", ";
s += state;
if ( !state.isEmpty() && !zip.isEmpty() )
s += " ";
s += zip;
if ( !country.isEmpty() && !s.isEmpty() )
s += "\n";
s += country;
return s;
}
/*!
\internal
*/
QString OContact::displayBusinessAddress() const
{
return displayAddress( businessStreet(), businessCity(),
businessState(), businessZip(),
businessCountry() );
}
/*!
\internal
*/
QString OContact::displayHomeAddress() const
{
return displayAddress( homeStreet(), homeCity(),
homeState(), homeZip(),
homeCountry() );
}
/*!
Returns the full name of the contact
*/
QString OContact::fullName() const
{
QString title = find( Qtopia::Title );
QString firstName = find( Qtopia::FirstName );
QString middleName = find( Qtopia::MiddleName );
QString lastName = find( Qtopia::LastName );
QString suffix = find( Qtopia::Suffix );
QString name = title;
if ( !firstName.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += firstName;
}
if ( !middleName.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += middleName;
}
if ( !lastName.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += lastName;
}
if ( !suffix.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += suffix;
}
return name.simplifyWhiteSpace();
}
/*!
Returns a list of the names of the children of the contact.
*/
QStringList OContact::childrenList() const
{
return QStringList::split( " ", find( Qtopia::Children ) );
}
/*! \fn void OContact::insertEmail( const QString &email )
Insert \a email into the email list. Ensures \a email can only be added
once. If there is no default email address set, it sets it to the \a email.
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
@@ -312,428 +312,460 @@ OContact::~OContact()
Returns the department for the contact.
*/
/*! \fn QString OContact::office() const
Returns the office for the contact.
*/
/*! \fn QString OContact::jobTitle() const
Returns the job title of the contact.
*/
/*! \fn QString OContact::profession() const
Returns the profession of the contact.
*/
/*! \fn QString OContact::assistant() const
Returns the assistant of the contact.
*/
/*! \fn QString OContact::manager() const
Returns the manager of the contact.
*/
/*! \fn QString OContact::businessStreet() const
Returns the business street address of the contact.
*/
/*! \fn QString OContact::businessCity() const
Returns the business city of the contact.
*/
/*! \fn QString OContact::businessState() const
Returns the business state of the contact.
*/
/*! \fn QString OContact::businessZip() const
Returns the business zip of the contact.
*/
/*! \fn QString OContact::businessCountry() const
Returns the business country of the contact.
*/
/*! \fn QString OContact::businessPhone() const
Returns the business phone number of the contact.
*/
/*! \fn QString OContact::businessFax() const
Returns the business fax number of the contact.
*/
/*! \fn QString OContact::businessMobile() const
Returns the business mobile number of the contact.
*/
/*! \fn QString OContact::businessPager() const
Returns the business pager number of the contact.
*/
/*! \fn QString OContact::businessWebpage() const
Returns the business webpage of the contact.
*/
/*! \fn QString OContact::spouse() const
Returns the spouse of the contact.
*/
/*! \fn QString OContact::gender() const
Returns the gender of the contact.
*/
/*! \fn QString OContact::nickname() const
Returns the nickname of the contact.
*/
/*! \fn QString OContact::children() const
Returns the children of the contact.
*/
/*! \fn QString OContact::notes() const
Returns the notes relating to the the contact.
*/
/*! \fn QString OContact::groups() const
\internal
Returns the groups for the contact.
*/
/*! \fn QStringList OContact::groupList() const
\internal
*/
/*! \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;
// 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 )
text += ", " + Qtopia::escapeString(state);
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>";
}
if ( !(value = homeStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = homeState();
if ( !(value = homeCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( !state.isEmpty() )
text += ", " + Qtopia::escapeString(state);
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>"
+ Qtopia::escapeString(str) + "<br>";
str = manager();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Manager: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = gender();
if ( !str.isEmpty() && str.toInt() != 0 ) {
if ( str.toInt() == 1 )
str = QObject::tr( "Male" );
else if ( str.toInt() == 2 )
str = QObject::tr( "Female" );
text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
}
str = spouse();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Spouse: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
if ( birthday().isValid() ){
str = TimeString::numberDateString( birthday() );
text += "<b>" + QObject::tr("Birthday: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
if ( anniversary().isValid() ){
str = TimeString::numberDateString( anniversary() );
text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
str = children();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Children: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = nickname();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Nickname: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
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 )
{
QString value = v.stripWhiteSpace();
if ( value.isEmpty() )
mMap.remove( key );
else
mMap.insert( key, value );
}
/*!
\internal
*/
void OContact::replace( int key, const QString & v )
{
QString value = v.stripWhiteSpace();
if ( value.isEmpty() )
mMap.remove( key );
else
mMap.replace( key, value );
}
/*!
\internal
*/
QString OContact::find( int key ) const
{
return mMap[key];
}
/*!
\internal
*/
QString OContact::displayAddress( const QString &street,
const QString &city,
const QString &state,
const QString &zip,
const QString &country ) const
{
QString s = street;
if ( !street.isEmpty() )
s+= "\n";
s += city;
if ( !city.isEmpty() && !state.isEmpty() )
s += ", ";
s += state;
if ( !state.isEmpty() && !zip.isEmpty() )
s += " ";
s += zip;
if ( !country.isEmpty() && !s.isEmpty() )
s += "\n";
s += country;
return s;
}
/*!
\internal
*/
QString OContact::displayBusinessAddress() const
{
return displayAddress( businessStreet(), businessCity(),
businessState(), businessZip(),
businessCountry() );
}
/*!
\internal
*/
QString OContact::displayHomeAddress() const
{
return displayAddress( homeStreet(), homeCity(),
homeState(), homeZip(),
homeCountry() );
}
/*!
Returns the full name of the contact
*/
QString OContact::fullName() const
{
QString title = find( Qtopia::Title );
QString firstName = find( Qtopia::FirstName );
QString middleName = find( Qtopia::MiddleName );
QString lastName = find( Qtopia::LastName );
QString suffix = find( Qtopia::Suffix );
QString name = title;
if ( !firstName.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += firstName;
}
if ( !middleName.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += middleName;
}
if ( !lastName.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += lastName;
}
if ( !suffix.isEmpty() ) {
if ( !name.isEmpty() )
name += " ";
name += suffix;
}
return name.simplifyWhiteSpace();
}
/*!
Returns a list of the names of the children of the contact.
*/
QStringList OContact::childrenList() const
{
return QStringList::split( " ", find( Qtopia::Children ) );
}
/*! \fn void OContact::insertEmail( const QString &email )
Insert \a email into the email list. Ensures \a email can only be added
once. If there is no default email address set, it sets it to the \a email.