author | zautrix <zautrix> | 2004-09-18 22:33:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 22:33:39 (UTC) |
commit | f370d0f89bcaeeb68bd60152a9812a9cd55e5d8a (patch) (side-by-side diff) | |
tree | c1a9de8b305200a7cec885764a0afb4beb92dabb /kabc/address.cpp | |
parent | 28f894fd2a0dfbd5f09f9e530f359981efe0198c (diff) | |
download | kdepimpi-f370d0f89bcaeeb68bd60152a9812a9cd55e5d8a.zip kdepimpi-f370d0f89bcaeeb68bd60152a9812a9cd55e5d8a.tar.gz kdepimpi-f370d0f89bcaeeb68bd60152a9812a9cd55e5d8a.tar.bz2 |
more AB sync
-rw-r--r-- | kabc/address.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kabc/address.cpp b/kabc/address.cpp index c820a6c..5ffe511 100644 --- a/kabc/address.cpp +++ b/kabc/address.cpp @@ -43,96 +43,109 @@ using namespace KABC; QMap<QString, QString> Address::mISOMap; Address::Address() : mEmpty( true ), mType( 0 ) { mId = KApplication::randomString( 10 ); } Address::Address( int type ) : mEmpty( true ), mType( type ) { mId = KApplication::randomString( 10 ); } bool Address::operator==( const Address &a ) const { if ( mPostOfficeBox != a.mPostOfficeBox ) return false; if ( mExtended != a.mExtended ) return false; if ( mStreet != a.mStreet ) return false; if ( mLocality != a.mLocality ) return false; if ( mRegion != a.mRegion ) return false; if ( mPostalCode != a.mPostalCode ) return false; if ( mCountry != a.mCountry ) return false; if ( mLabel != a.mLabel ) return false; return true; } bool Address::operator!=( const Address &a ) const { return !( a == *this ); } bool Address::isEmpty() const { if ( mPostOfficeBox.isEmpty() && mExtended.isEmpty() && mStreet.isEmpty() && mLocality.isEmpty() && mRegion.isEmpty() && mPostalCode.isEmpty() && mCountry.isEmpty() && mLabel.isEmpty() ) { return true; } return false; } +QStringList Address::asList() +{ + QStringList result; + if ( ! mPostOfficeBox.isEmpty() )result.append(mPostOfficeBox); + if ( ! mExtended.isEmpty())result.append(mExtended); + if ( ! mStreet.isEmpty())result.append(mStreet); + if ( ! mLocality.isEmpty() )result.append(mLocality); + if ( ! mRegion.isEmpty())result.append(mRegion); + if ( ! mPostalCode.isEmpty())result.append(mPostalCode); + if ( ! mCountry.isEmpty())result.append(mCountry); + if ( ! mLabel.isEmpty() )result.append(mLabel); + return result; +} void Address::clear() { *this = Address(); } void Address::setId( const QString &id ) { mEmpty = false; mId = id; } QString Address::id() const { return mId; } void Address::setType( int type ) { mEmpty = false; mType = type; } int Address::type() const { return mType; } QString Address::typeLabel() const { QString label; bool first = true; TypeList list = typeList(); TypeList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); if ( first ) first = false; } } return label; } |