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 @@ -1,186 +1,199 @@ /* This file is part of libkabc. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ //US added kglobal.h #include <kglobal.h> #include <kapplication.h> #include <kdebug.h> #include <klocale.h> #include <ksimpleconfig.h> #include <kstandarddirs.h> #include <qfile.h> #include "address.h" 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; } void Address::setPostOfficeBox( const QString &s ) { mEmpty = false; mPostOfficeBox = s; } QString Address::postOfficeBox() const { return mPostOfficeBox; } QString Address::postOfficeBoxLabel() { return i18n("Post Office Box"); } void Address::setExtended( const QString &s ) { mEmpty = false; mExtended = s; } QString Address::extended() const { return mExtended; } QString Address::extendedLabel() { return i18n("Extended Address Information"); } void Address::setStreet( const QString &s ) { mEmpty = false; mStreet = s; } QString Address::street() const { return mStreet; } |