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 00086 void setUid( const QString &uid ); 00087 00094 QString uid() const; 00095 00099 void setPreferredEmail( const QString &email ); 00100 00105 QString preferredEmail() const; 00106 00115 void insertCustom( const QString &key, const QString &value ); 00116 00120 void removeCustom( const QString &key ); 00121 00126 QString custom( const QString &key ) const; 00127 00131 ContactReference &operator=( const ContactReference & ); 00132 00136 bool operator==( const ContactReference & ) const; 00137 00138 private: 00139 class ContactReferencePrivate; 00140 QSharedDataPointer<ContactReferencePrivate> d; 00141 }; 00142 00146 class KABC_EXPORT ContactGroupReference 00147 { 00148 public: 00152 typedef QList<ContactGroupReference> List; 00153 00157 ContactGroupReference(); 00158 00162 ContactGroupReference( const ContactGroupReference &other ); 00163 00167 ContactGroupReference( const QString &uid ); 00168 00172 ~ContactGroupReference(); 00173 00177 void setUid( const QString &uid ); 00178 00182 QString uid() const; 00183 00192 void insertCustom( const QString &key, const QString &value ); 00193 00197 void removeCustom( const QString &key ); 00198 00203 QString custom( const QString &key ) const; 00204 00208 ContactGroupReference &operator=( const ContactGroupReference & ); 00209 00213 bool operator==( const ContactGroupReference & ) const; 00214 00215 private: 00216 class ContactGroupReferencePrivate; 00217 QSharedDataPointer<ContactGroupReferencePrivate> d; 00218 }; 00219 00223 class KABC_EXPORT Data 00224 { 00225 public: 00229 typedef QList<Data> List; 00230 00234 Data(); 00235 00239 Data( const Data &other ); 00240 00244 Data( const QString &name, const QString &email ); 00245 00249 ~Data(); 00250 00254 void setName( const QString &name ); 00255 00259 QString name() const; 00260 00264 void setEmail( const QString &email ); 00265 00269 QString email() const; 00270 00279 void insertCustom( const QString &key, const QString &value ); 00280 00284 void removeCustom( const QString &key ); 00285 00290 QString custom( const QString &key ) const; 00291 00295 Data &operator=( const Data & ); 00296 00300 bool operator==( const Data & ) const; 00301 00302 private: 00303 class DataPrivate; 00304 QSharedDataPointer<DataPrivate> d; 00305 }; 00306 00310 typedef QList<ContactGroup> List; 00311 00315 ContactGroup(); 00316 00320 ContactGroup( const ContactGroup &other ); 00321 00325 ContactGroup( const QString &name ); 00326 00330 ~ContactGroup(); 00331 00335 void setId( const QString &id ); 00336 00340 QString id() const; 00341 00345 void setName( const QString &name ); 00346 00350 QString name() const; 00351 00356 unsigned int count() const; 00357 00361 unsigned int contactReferenceCount() const; 00362 00366 unsigned int contactGroupReferenceCount() const; 00367 00371 unsigned int dataCount() const; 00372 00376 ContactReference &contactReference( unsigned int index ); 00377 00381 const ContactReference &contactReference( unsigned int index ) const; 00382 00386 ContactGroupReference &contactGroupReference( unsigned int index ); 00387 00391 const ContactGroupReference &contactGroupReference( unsigned int index ) const; 00392 00396 Data &data( unsigned int index ); 00397 00401 const Data &data( unsigned int index ) const; 00402 00406 void append( const ContactReference &reference ); 00407 00411 void append( const ContactGroupReference &reference ); 00412 00416 void append( const Data &data ); 00417 00421 void remove( const ContactReference &reference ); 00422 00426 void remove( const ContactGroupReference &reference ); 00427 00431 void remove( const Data &data ); 00432 00436 void removeAllContactReferences(); 00437 00441 void removeAllContactGroupReferences(); 00442 00446 void removeAllContactData(); 00447 00451 ContactGroup &operator=( const ContactGroup & ); 00452 00456 bool operator==( const ContactGroup & ) const; 00457 00461 static QString mimeType(); 00462 00463 private: 00464 class Private; 00465 QSharedDataPointer<Private> d; 00466 }; 00467 00468 } 00469 00470 #endif
KDE 4.4 API Reference