00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KABC_ADDRESSEELIST_H
00023 #define KABC_ADDRESSEELIST_H
00024
00025 #include "kabc_export.h"
00026 #include <QtCore/QSharedDataPointer>
00027 #include <QtCore/QList>
00028
00029 namespace KABC {
00030
00031 class Field;
00032 class SortMode;
00033 class Addressee;
00034
00044 namespace SortingTraits
00045 {
00046
00047 class KABC_EXPORT Uid
00048 {
00049 public:
00053 Uid();
00054
00058 ~Uid();
00059
00069 static bool eq( const Addressee &, const Addressee & );
00070
00080 static bool lt( const Addressee &, const Addressee & );
00081
00082 private:
00083 class Private;
00084 Private *const d;
00085 };
00086
00087 class KABC_EXPORT Name
00088 {
00089 public:
00093 Name();
00094
00098 ~Name();
00099
00109 static bool eq( const Addressee &, const Addressee & );
00110
00120 static bool lt( const Addressee &, const Addressee & );
00121
00122 private:
00123 class Private;
00124 Private *const d;
00125 };
00126
00127 class KABC_EXPORT FormattedName
00128 {
00129 public:
00133 FormattedName();
00134
00138 ~FormattedName();
00139
00149 static bool eq( const Addressee &, const Addressee & );
00150
00160 static bool lt( const Addressee &, const Addressee & );
00161
00162 private:
00163 class Private;
00164 Private *const d;
00165 };
00166
00167 class KABC_EXPORT FamilyName
00168 {
00169 public:
00173 FamilyName();
00174
00178 ~FamilyName();
00179
00190 static bool eq( const Addressee &, const Addressee & );
00191
00203 static bool lt( const Addressee &, const Addressee & );
00204
00205 private:
00206 class Private;
00207 Private *const d;
00208 };
00209
00210 class KABC_EXPORT GivenName
00211 {
00212 public:
00216 GivenName();
00217
00221 ~GivenName();
00222
00233 static bool eq( const Addressee &, const Addressee & );
00234
00246 static bool lt( const Addressee &, const Addressee & );
00247
00248 private:
00249 class Private;
00250 Private *const d;
00251 };
00252
00253 }
00254
00258 typedef enum {
00259 Uid,
00260 Name,
00261 FormattedName,
00262 FamilyName,
00263 GivenName
00264 } SortingCriterion;
00265
00289 class KABC_EXPORT AddresseeList : public QList<Addressee>
00290 {
00291 public:
00295 AddresseeList();
00296
00300 AddresseeList( const AddresseeList & );
00301
00305 AddresseeList( const QList<Addressee> & );
00306
00310 ~AddresseeList();
00311
00318 AddresseeList &operator=( const AddresseeList &other );
00319
00326 void setReverseSorting( bool reverseSorting = true );
00327
00332 bool reverseSorting() const;
00333
00338 void sortBy( SortingCriterion c );
00339
00345 void sortByField( Field *field = 0 );
00346
00351 void sortByMode( SortMode *mode = 0 );
00352
00362 void sort();
00363
00391 template<class Trait> void sortByTrait();
00392
00397 SortingCriterion sortingCriterion() const;
00398
00406 Field *sortingField() const;
00407
00411 QString toString() const;
00412
00413 private:
00414 class Private;
00415 QSharedDataPointer<Private> d;
00416 };
00417
00418 }
00419
00420 #endif