kabc Library API Documentation

addressee.src.h

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KABC_ADDRESSEE_H
00022 #define KABC_ADDRESSEE_H
00023 
00024 #include <qdatetime.h>
00025 #include <qstring.h>
00026 #include <qstringlist.h>
00027 #include <qvaluelist.h>
00028 
00029 #include <ksharedptr.h>
00030 #include <kurl.h>
00031 
00032 #include "address.h"
00033 #include "agent.h"
00034 #include "geo.h"
00035 #include "key.h"
00036 #include "phonenumber.h"
00037 #include "picture.h"
00038 #include "secrecy.h"
00039 #include "sound.h"
00040 #include "timezone.h"
00041 
00042 namespace KABC {
00043 
00044 class Resource;
00045 class Field;
00046 
00073 class Addressee
00074 {
00075   friend QDataStream &operator<<( QDataStream &, const Addressee & );
00076   friend QDataStream &operator>>( QDataStream &, Addressee & );
00077 
00078   public:
00079     typedef QValueList<Addressee> List;
00080     typedef QMap<QString, Addressee> Map;
00081 
00085     Addressee();
00086     ~Addressee();
00087 
00088     Addressee( const Addressee & );
00089     Addressee &operator=( const Addressee & );
00090 
00091     bool operator==( const Addressee & ) const;
00092     bool operator!=( const Addressee & ) const;
00093 
00097     bool isEmpty() const;
00098 
00102     void setUid( const QString &uid );
00106     QString uid() const;
00110     static QString uidLabel();
00111 
00112     --DECLARATIONS--
00118     void setNameFromString( const QString & );
00119 
00124     QString realName() const;
00125 
00129     QString assembledName() const;
00130 
00137     QString fullEmail( const QString &email=QString::null ) const;
00138 
00147     void insertEmail( const QString &email, bool preferred=false );
00148 
00152     void removeEmail( const QString &email );
00153 
00158     QString preferredEmail() const;
00159 
00163     QStringList emails() const;
00164 
00170     void setEmails( const QStringList& list);
00171 
00176     void insertPhoneNumber( const PhoneNumber &phoneNumber );
00177 
00182     void removePhoneNumber( const PhoneNumber &phoneNumber );
00183 
00187     PhoneNumber phoneNumber( int type ) const;
00188 
00192     PhoneNumber::List phoneNumbers() const;
00193 
00197     PhoneNumber::List phoneNumbers( int type ) const;
00198 
00202     PhoneNumber findPhoneNumber( const QString &id ) const;
00203 
00208     void insertKey( const Key &key );
00209 
00214     void removeKey( const Key &key );
00215 
00222     Key key( int type, QString customTypeString = QString::null ) const;
00223 
00227     Key::List keys() const;
00228 
00233     void setKeys( const Key::List& keys);
00234 
00241     Key::List keys( int type, QString customTypeString = QString::null  ) const;
00242 
00246     Key findKey( const QString &id ) const;
00247 
00252     void insertAddress( const Address &address );
00253 
00258     void removeAddress( const Address &address );
00259 
00263     Address address( int type ) const;
00264 
00268     Address::List addresses() const;
00269 
00273     Address::List addresses( int type ) const;
00274 
00278     Address findAddress( const QString &id ) const;
00279 
00283     void insertCategory( const QString & );
00284 
00288     void removeCategory( const QString & );
00289 
00293     bool hasCategory( const QString & ) const;
00294 
00298     void setCategories( const QStringList & );
00299 
00303     QStringList categories() const;
00304 
00310     void insertCustom( const QString &app, const QString &name,
00311                        const QString &value );
00312 
00316     void removeCustom( const QString &app, const QString &name );
00317 
00321     QString custom( const QString &app, const QString &name ) const;
00322 
00326     void setCustoms( const QStringList & );
00327 
00331     QStringList customs() const;
00332 
00336     static void parseEmailAddress( const QString &rawEmail, QString &fullName,
00337                                    QString &email );
00338 
00342     void dump() const;
00343 
00347     QString asString() const;
00348 
00352     void setResource( Resource *resource );
00353 
00357     Resource *resource() const;
00358 
00362     void setChanged( bool value );
00363 
00367     bool changed() const;
00368 
00369     static void setSortKey( KABC::Field *field );
00370 
00371     bool operator< ( const Addressee &addr );
00372 
00373   private:
00374     void detach();
00375 
00376     struct AddresseeData;
00377     mutable KSharedPtr<AddresseeData> mData;
00378 
00379   private:
00380     static AddresseeData* shared_null;
00381     static AddresseeData* makeSharedNull();
00382     static KABC::Field *mSortField;
00383 };
00384 
00385 QDataStream &operator<<( QDataStream &, const Addressee & );
00386 QDataStream &operator>>( QDataStream &, Addressee & );
00387 
00388 }
00389 
00390 #endif
KDE Logo
This file is part of the documentation for kabc Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jan 22 16:50:30 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003