addressee.src.h
00001 /* 00002 This file is part of libtdeabc. 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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KABC_ADDRESSEE_H 00022 #define KABC_ADDRESSEE_H 00023 00024 #include <tqdatetime.h> 00025 #include <tqstring.h> 00026 #include <tqstringlist.h> 00027 #include <tqvaluelist.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 TDEABC { 00043 00044 class Resource; 00045 class Field; 00046 class SortMode; 00047 00074 class KABC_EXPORT Addressee 00075 { 00076 friend KABC_EXPORT TQDataStream &operator<<( TQDataStream &, const Addressee & ); 00077 friend KABC_EXPORT TQDataStream &operator>>( TQDataStream &, Addressee & ); 00078 00079 public: 00080 typedef TQValueList<Addressee> List; 00081 typedef TQMap<TQString, Addressee> Map; 00082 00086 Addressee(); 00087 ~Addressee(); 00088 00089 Addressee( const Addressee & ); 00090 Addressee &operator=( const Addressee & ); 00091 00092 bool operator==( const Addressee & ) const; 00093 bool operator!=( const Addressee & ) const; 00094 00098 bool isEmpty() const; 00099 00103 void setUid( const TQString &uid ); 00107 TQString uid() const; 00111 static TQString uidLabel(); 00112 00116 void setUri( const TQString &uid ); 00120 TQString uri() const; 00124 static TQString uriLabel(); 00125 00126 --DECLARATIONS-- 00132 void setNameFromString( const TQString & ); 00133 00138 TQString realName() const; 00139 00143 TQString assembledName() const; 00144 00151 TQString fullEmail( const TQString &email=TQString::null ) const; 00152 00161 void insertEmail( const TQString &email, bool preferred=false ); 00162 00166 void removeEmail( const TQString &email ); 00167 00172 TQString preferredEmail() const; 00173 00177 TQStringList emails() const; 00178 00184 void setEmails( const TQStringList& list); 00185 00190 void insertPhoneNumber( const PhoneNumber &phoneNumber ); 00191 00196 void removePhoneNumber( const PhoneNumber &phoneNumber ); 00197 00201 PhoneNumber phoneNumber( int type ) const; 00202 00206 PhoneNumber::List phoneNumbers() const; 00207 00211 PhoneNumber::List phoneNumbers( int type ) const; 00212 00216 PhoneNumber findPhoneNumber( const TQString &id ) const; 00217 00222 void insertKey( const Key &key ); 00223 00228 void removeKey( const Key &key ); 00229 00236 Key key( int type, TQString customTypeString = TQString::null ) const; 00237 00241 Key::List keys() const; 00242 00247 void setKeys( const Key::List& keys); 00248 00255 Key::List keys( int type, TQString customTypeString = TQString::null ) const; 00256 00260 Key findKey( const TQString &id ) const; 00261 00266 void insertAddress( const Address &address ); 00267 00272 void removeAddress( const Address &address ); 00273 00277 Address address( int type ) const; 00278 00282 Address::List addresses() const; 00283 00287 Address::List addresses( int type ) const; 00288 00292 Address findAddress( const TQString &id ) const; 00293 00297 void insertCategory( const TQString & ); 00298 00302 void removeCategory( const TQString & ); 00303 00307 bool hasCategory( const TQString & ) const; 00308 00312 void setCategories( const TQStringList & ); 00313 00317 TQStringList categories() const; 00318 00327 void insertCustom( const TQString &app, const TQString &name, 00328 const TQString &value ); 00329 00333 void removeCustom( const TQString &app, const TQString &name ); 00334 00338 TQString custom( const TQString &app, const TQString &name ) const; 00339 00343 void setCustoms( const TQStringList & ); 00344 00348 TQStringList customs() const; 00349 00353 static void parseEmailAddress( const TQString &rawEmail, TQString &fullName, 00354 TQString &email ); 00355 00359 void dump() const; 00360 00364 TQString asString() const; 00365 00369 void setResource( Resource *resource ); 00370 00374 Resource *resource() const; 00375 00379 void setChanged( bool value ); 00380 00384 bool changed() const; 00385 00386 static void setSortMode( TDEABC::SortMode *mode ); 00387 00388 bool operator< ( const Addressee &addr ); 00389 00390 private: 00391 void detach(); 00392 00393 struct AddresseeData; 00394 mutable TDESharedPtr<AddresseeData> mData; 00395 00396 private: 00397 static AddresseeData* shared_null; 00398 static AddresseeData* makeSharedNull(); 00399 static TDEABC::SortMode *mSortMode; 00400 }; 00401 00402 KABC_EXPORT TQDataStream &operator<<( TQDataStream &, const Addressee & ); 00403 KABC_EXPORT TQDataStream &operator>>( TQDataStream &, Addressee & ); 00404 00405 } 00406 00407 #endif