kabc
contactgroup.h
00001 /* 00002 This file is part of libkabc. 00003 Copyright (c) 2008 Tobias Koenig <tokoe@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_CONTACTGROUP_H 00022 #define KABC_CONTACTGROUP_H 00023 00024 #include <QtCore/QList> 00025 #include <QtCore/QSharedDataPointer> 00026 00027 #include "kabc_export.h" 00028 00029 class QString; 00030 00031 namespace KABC { 00032 00045 class KABC_EXPORT ContactGroup 00046 { 00047 public: 00048 00052 class KABC_EXPORT ContactReference 00053 { 00054 public: 00058 typedef QList<ContactReference> List; 00059 00063 ContactReference(); 00064 00068 ContactReference( const ContactReference &other ); 00069 00073 ContactReference( const QString &uid ); 00074 00078 ~ContactReference(); 00079 00083 void setUid( const QString &uid ); 00084 00088 QString uid() const; 00089 00093 void setPreferredEmail( const QString &email ); 00094 00099 QString preferredEmail() const; 00100 00109 void insertCustom( const QString &key, const QString &value ); 00110 00114 void removeCustom( const QString &key ); 00115 00120 QString custom( const QString &key ) const; 00121 00125 ContactReference &operator=( const ContactReference & ); 00126 00130 bool operator==( const ContactReference & ) const; 00131 00132 private: 00133 class ContactReferencePrivate; 00134 QSharedDataPointer<ContactReferencePrivate> d; 00135 }; 00136 00140 class KABC_EXPORT ContactGroupReference 00141 { 00142 public: 00146 typedef QList<ContactGroupReference> List; 00147 00151 ContactGroupReference(); 00152 00156 ContactGroupReference( const ContactGroupReference &other ); 00157 00161 ContactGroupReference( const QString &uid ); 00162 00166 ~ContactGroupReference(); 00167 00171 void setUid( const QString &uid ); 00172 00176 QString uid() const; 00177 00186 void insertCustom( const QString &key, const QString &value ); 00187 00191 void removeCustom( const QString &key ); 00192 00197 QString custom( const QString &key ) const; 00198 00202 ContactGroupReference &operator=( const ContactGroupReference & ); 00203 00207 bool operator==( const ContactGroupReference & ) const; 00208 00209 private: 00210 class ContactGroupReferencePrivate; 00211 QSharedDataPointer<ContactGroupReferencePrivate> d; 00212 }; 00213 00217 class KABC_EXPORT Data 00218 { 00219 public: 00223 typedef QList<Data> List; 00224 00228 Data(); 00229 00233 Data( const Data &other ); 00234 00238 Data( const QString &name, const QString &email ); 00239 00243 ~Data(); 00244 00248 void setName( const QString &name ); 00249 00253 QString name() const; 00254 00258 void setEmail( const QString &email ); 00259 00263 QString email() const; 00264 00273 void insertCustom( const QString &key, const QString &value ); 00274 00278 void removeCustom( const QString &key ); 00279 00284 QString custom( const QString &key ) const; 00285 00289 Data &operator=( const Data & ); 00290 00294 bool operator==( const Data & ) const; 00295 00296 private: 00297 class DataPrivate; 00298 QSharedDataPointer<DataPrivate> d; 00299 }; 00300 00304 typedef QList<ContactGroup> List; 00305 00309 ContactGroup(); 00310 00314 ContactGroup( const ContactGroup &other ); 00315 00319 ContactGroup( const QString &name ); 00320 00324 ~ContactGroup(); 00325 00329 void setId( const QString &id ); 00330 00334 QString id() const; 00335 00339 void setName( const QString &name ); 00340 00344 QString name() const; 00345 00350 unsigned int count() const; 00351 00355 unsigned int contactReferenceCount() const; 00356 00360 unsigned int contactGroupReferenceCount() const; 00361 00365 unsigned int dataCount() const; 00366 00370 ContactReference &contactReference( unsigned int index ); 00371 00375 const ContactReference &contactReference( unsigned int index ) const; 00376 00380 ContactGroupReference &contactGroupReference( unsigned int index ); 00381 00385 const ContactGroupReference &contactGroupReference( unsigned int index ) const; 00386 00390 Data &data( unsigned int index ); 00391 00395 const Data &data( unsigned int index ) const; 00396 00400 void append( const ContactReference &reference ); 00401 00405 void append( const ContactGroupReference &reference ); 00406 00410 void append( const Data &data ); 00411 00415 void remove( const ContactReference &reference ); 00416 00420 void remove( const ContactGroupReference &reference ); 00421 00425 void remove( const Data &data ); 00426 00430 void removeAllContactReferences(); 00431 00435 void removeAllContactGroupReferences(); 00436 00440 void removeAllContactData(); 00441 00445 ContactGroup &operator=( const ContactGroup & ); 00446 00450 bool operator==( const ContactGroup & ) const; 00451 00455 static QString mimeType(); 00456 00457 private: 00458 class Private; 00459 QSharedDataPointer<Private> d; 00460 }; 00461 00462 } 00463 00464 #endif