summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-04-07 07:42:53 (UTC)
committer zautrix <zautrix>2005-04-07 07:42:53 (UTC)
commitc82f9b40f6023dc7b39ac555cba8c4c313f15ca8 (patch) (side-by-side diff)
treee9e4f0c0ed3243ec060a475983b271bd27b40d15 /kabc
parent76e220bf1236ae6afa9d91f18f0cd9ced730cff0 (diff)
downloadkdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.zip
kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.tar.gz
kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.tar.bz2
added fields to kapi
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp25
-rw-r--r--kabc/addressee.h5
-rw-r--r--kabc/field.cpp20
-rw-r--r--kabc/phonenumber.cpp13
4 files changed, 55 insertions, 8 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 39d14bb..7f592e9 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -48,12 +48,13 @@ static bool matchBinaryPatternP( int value, int pattern );
struct Addressee::AddresseeData : public KShared
{
QString uid;
QString name;
QString formattedName;
+ QString defaultFormattedName;
QString familyName;
QString givenName;
QString additionalName;
QString prefix;
QString suffix;
QString nickName;
@@ -744,23 +745,39 @@ void Addressee::setFormattedName( const QString &formattedName )
{
if ( formattedName == mData->formattedName ) return;
detach();
mData->empty = false;
mData->formattedName = formattedName;
}
+void Addressee::setDefaultFormattedName( const QString &formattedName )
+{
+ if ( formattedName == mData->defaultFormattedName ) return;
+ detach();
+ mData->empty = false;
+ mData->defaultFormattedName = formattedName;
+}
QString Addressee::formattedName() const
{
return mData->formattedName;
}
+QString Addressee::defaultFormattedName() const
+{
+ return mData->defaultFormattedName;
+}
QString Addressee::formattedNameLabel()
{
return i18n("Formatted Name");
}
+QString Addressee::defaultFormattedNameLabel()
+{
+ return i18n("Def.Formatted Name");
+}
+
void Addressee::setFamilyName( const QString &familyName )
{
if ( familyName == mData->familyName ) return;
detach();
mData->empty = false;
@@ -977,12 +994,20 @@ QString Addressee::businessPhoneLabel()
QString Addressee::mobilePhoneLabel()
{
return i18n("Mobile Phone");
}
+QString Addressee::mobileWorkPhoneLabel()
+{
+ return i18n("Mobile (work)");
+}
+QString Addressee::mobileHomePhoneLabel()
+{
+ return i18n("Mobile (home)");
+}
QString Addressee::homeFaxLabel()
{
return i18n("Home Fax");
}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 8051fec..0d688f8 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -151,20 +151,23 @@ class Addressee
static QString nameLabel();
/**
Set formatted name.
*/
void setFormattedName( const QString &formattedName );
+ void setDefaultFormattedName( const QString &formattedName );
/**
Return formatted name.
*/
QString formattedName() const;
+ QString defaultFormattedName() const;
/**
Return translated label for formattedName field.
*/
static QString formattedNameLabel();
+ static QString defaultFormattedNameLabel();
/**
Set family name.
*/
void setFamilyName( const QString &familyName );
/**
@@ -325,12 +328,14 @@ class Addressee
static QString businessPhoneLabel();
/**
Return translated label for mobilePhone field.
*/
static QString mobilePhoneLabel();
+ static QString mobileWorkPhoneLabel();
+ static QString mobileHomePhoneLabel();
/**
Return translated label for homeFax field.
*/
static QString homeFaxLabel();
diff --git a/kabc/field.cpp b/kabc/field.cpp
index 89d0b77..5c561c3 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -83,13 +83,16 @@ class Field::FieldImpl
Title,
Role,
Organization,
Note,
Url,
Resource,
- Sip
+ Sip,
+ DefaultFormattedName,
+ MobileWorkPhone,
+ MobileHomePhone
};
int fieldId() { return mFieldId; }
int category() { return mCategory; }
QString label() { return mLabel; }
@@ -123,12 +126,14 @@ Field::~Field()
QString Field::label()
{
switch ( mImpl->fieldId() ) {
case FieldImpl::FormattedName:
return Addressee::formattedNameLabel();
+ case FieldImpl::DefaultFormattedName:
+ return Addressee::defaultFormattedNameLabel();
case FieldImpl::FamilyName:
return Addressee::familyNameLabel();
case FieldImpl::GivenName:
return Addressee::givenNameLabel();
case FieldImpl::AdditionalName:
return Addressee::additionalNameLabel();
@@ -167,12 +172,16 @@ QString Field::label()
case FieldImpl::HomePhone:
return Addressee::homePhoneLabel();
case FieldImpl::BusinessPhone:
return Addressee::businessPhoneLabel();
case FieldImpl::MobilePhone:
return Addressee::mobilePhoneLabel();
+ case FieldImpl::MobileHomePhone:
+ return Addressee::mobileHomePhoneLabel();
+ case FieldImpl::MobileWorkPhone:
+ return Addressee::mobileWorkPhoneLabel();
case FieldImpl::HomeFax:
return Addressee::homeFaxLabel();
case FieldImpl::BusinessFax:
return Addressee::businessFaxLabel();
case FieldImpl::CarPhone:
return Addressee::carPhoneLabel();
@@ -236,12 +245,14 @@ QString Field::categoryLabel( int category )
QString Field::value( const KABC::Addressee &a )
{
switch ( mImpl->fieldId() ) {
case FieldImpl::FormattedName:
return a.formattedName();
+ case FieldImpl::DefaultFormattedName:
+ return a.defaultFormattedName();
case FieldImpl::FamilyName:
return a.familyName();
case FieldImpl::GivenName:
return a.givenName();
case FieldImpl::AdditionalName:
return a.additionalName();
@@ -285,12 +296,16 @@ QString Field::value( const KABC::Addressee &a )
case FieldImpl::HomePhone:
return a.phoneNumber( PhoneNumber::Home ).number();
case FieldImpl::BusinessPhone:
return a.phoneNumber( PhoneNumber::Work ).number();
case FieldImpl::MobilePhone:
return a.phoneNumber( PhoneNumber::Cell ).number();
+ case FieldImpl::MobileWorkPhone:
+ return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Work ).number();
+ case FieldImpl::MobileHomePhone:
+ return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Home ).number();
case FieldImpl::HomeFax:
return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number();
case FieldImpl::BusinessFax:
return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number();
case FieldImpl::CarPhone:
return a.phoneNumber( PhoneNumber::Car ).number();
@@ -390,12 +405,13 @@ bool Field::isCustom()
}
Field::List Field::allFields()
{
if ( mAllFields.isEmpty() ) {
createField( FieldImpl::FormattedName, Frequent );
+ createField( FieldImpl::DefaultFormattedName, Frequent );
createField( FieldImpl::FamilyName, Frequent );
createField( FieldImpl::GivenName, Frequent );
createField( FieldImpl::AdditionalName );
createField( FieldImpl::Prefix );
createField( FieldImpl::Suffix );
createField( FieldImpl::NickName, Personal );
@@ -413,12 +429,14 @@ Field::List Field::allFields()
createField( FieldImpl::BusinessAddressPostalCode, Address|Organization );
createField( FieldImpl::BusinessAddressCountry, Address|Organization );
createField( FieldImpl::BusinessAddressLabel, Address|Organization );
createField( FieldImpl::HomePhone, Personal|Frequent );
createField( FieldImpl::BusinessPhone, Organization|Frequent );
createField( FieldImpl::MobilePhone, Frequent );
+ createField( FieldImpl::MobileHomePhone, Frequent );
+ createField( FieldImpl::MobileWorkPhone, Frequent );
createField( FieldImpl::HomeFax );
createField( FieldImpl::BusinessFax );
createField( FieldImpl::CarPhone );
createField( FieldImpl::Isdn );
createField( FieldImpl::Pager );
createField( FieldImpl::Email, Email|Frequent );
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 041effc..4c6231d 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -174,22 +174,21 @@ QString PhoneNumber::label( int type )
}
QString PhoneNumber::typeLabel( int type )
{
QString typeString;
+
+ if ((type & Cell) == Cell)
+ typeString += i18n("Mobile") +" ";
if ((type & Home) == Home)
- typeString += i18n("Home");
+ typeString += i18n("Home")+" ";
else if ((type & Work) == Work)
- typeString += i18n("Work");
+ typeString += i18n("Work")+" ";
- if (!typeString.isEmpty())
- typeString += " ";
- if ((type & Cell) == Cell)
- typeString += i18n("Mobile") +" ";
- if ((type & Sip) == Sip)
+ if ((type & Sip) == Sip)
typeString += i18n("SIP")+" ";
if ((type & Car) == Car)
typeString += i18n("Car")+" ";
if ((type & Fax) == Fax)
typeString += i18n("Fax");