|
|
|
@ -36,7 +36,7 @@ class Field::FieldImpl
|
|
|
|
|
const TQString &app = TQString::null )
|
|
|
|
|
: mFieldId( fieldId ), mCategory( category ), mLabel( label ),
|
|
|
|
|
mKey( key ), mApp( app ) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum FieldId
|
|
|
|
|
{
|
|
|
|
|
CustomField,
|
|
|
|
@ -45,11 +45,11 @@ class Field::FieldImpl
|
|
|
|
|
|
|
|
|
|
int fieldId() { return mFieldId; }
|
|
|
|
|
int category() { return mCategory; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQString label() { return mLabel; }
|
|
|
|
|
TQString key() { return mKey; }
|
|
|
|
|
TQString app() { return mApp; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
int mFieldId;
|
|
|
|
|
int mCategory;
|
|
|
|
@ -184,8 +184,6 @@ TQString Field::value( const KABC::Addressee &a )
|
|
|
|
|
return a.phoneNumber( PhoneNumber::Pager ).number();
|
|
|
|
|
case FieldImpl::HomeAddressStreet:
|
|
|
|
|
return a.address( Address::Home ).street();
|
|
|
|
|
case FieldImpl::HomeAddressPostOfficeBox:
|
|
|
|
|
return a.address( Address::Home ).postOfficeBox();
|
|
|
|
|
case FieldImpl::HomeAddressLocality:
|
|
|
|
|
return a.address( Address::Home ).locality();
|
|
|
|
|
case FieldImpl::HomeAddressRegion:
|
|
|
|
@ -198,8 +196,6 @@ TQString Field::value( const KABC::Addressee &a )
|
|
|
|
|
return a.address( Address::Home ).label();
|
|
|
|
|
case FieldImpl::BusinessAddressStreet:
|
|
|
|
|
return a.address( Address::Work ).street();
|
|
|
|
|
case FieldImpl::BusinessAddressPostOfficeBox:
|
|
|
|
|
return a.address( Address::Work ).postOfficeBox();
|
|
|
|
|
case FieldImpl::BusinessAddressLocality:
|
|
|
|
|
return a.address( Address::Work ).locality();
|
|
|
|
|
case FieldImpl::BusinessAddressRegion:
|
|
|
|
@ -270,13 +266,6 @@ bool Field::setValue( KABC::Addressee &a, const TQString &value )
|
|
|
|
|
a.insertAddress( address );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case FieldImpl::HomeAddressPostOfficeBox:
|
|
|
|
|
{
|
|
|
|
|
KABC::Address address = a.address( Address::Home );
|
|
|
|
|
address.setPostOfficeBox( value );
|
|
|
|
|
a.insertAddress( address );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case FieldImpl::HomeAddressLocality:
|
|
|
|
|
{
|
|
|
|
|
KABC::Address address = a.address( Address::Home );
|
|
|
|
@ -319,13 +308,6 @@ bool Field::setValue( KABC::Addressee &a, const TQString &value )
|
|
|
|
|
a.insertAddress( address );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case FieldImpl::BusinessAddressPostOfficeBox:
|
|
|
|
|
{
|
|
|
|
|
KABC::Address address = a.address( Address::Work );
|
|
|
|
|
address.setPostOfficeBox( value );
|
|
|
|
|
a.insertAddress( address );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case FieldImpl::BusinessAddressLocality:
|
|
|
|
|
{
|
|
|
|
|
KABC::Address address = a.address( Address::Work );
|
|
|
|
@ -456,7 +438,7 @@ void Field::saveFields( KConfig *cfg, const TQString &identifier,
|
|
|
|
|
const Field::List &fields )
|
|
|
|
|
{
|
|
|
|
|
TQValueList<int> fieldIds;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int custom = 0;
|
|
|
|
|
Field::List::ConstIterator it;
|
|
|
|
|
for( it = fields.begin(); it != fields.end(); ++it ) {
|
|
|
|
@ -470,7 +452,7 @@ void Field::saveFields( KConfig *cfg, const TQString &identifier,
|
|
|
|
|
TQString::number( custom++ ), customEntry );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cfg->writeEntry( identifier, fieldIds );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -478,7 +460,7 @@ Field::List Field::restoreFields( const TQString &identifier )
|
|
|
|
|
{
|
|
|
|
|
KConfig *cfg = KGlobal::config();
|
|
|
|
|
KConfigGroupSaver( cfg, "KABCFields" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return restoreFields( cfg, identifier );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -503,7 +485,7 @@ Field::List Field::restoreFields( KConfig *cfg, const TQString &identifier )
|
|
|
|
|
}
|
|
|
|
|
fields.append( new Field( f ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -514,7 +496,7 @@ bool Field::equals( Field *field )
|
|
|
|
|
if ( !sameId ) return false;
|
|
|
|
|
|
|
|
|
|
if ( mImpl->fieldId() != FieldImpl::CustomField ) return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return mImpl->key() == field->mImpl->key();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|