kabc Library API Documentation

addresseelist.h

00001 /* 00002 This file is part of libkabc. 00003 Copyright (c) 2002 Jost Schenck <jost@schenck.de> 00004 2003 Tobias Koenig <tokoe@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef KABC_ADDRESSEELIST_H 00023 #define KABC_ADDRESSEELIST_H 00024 00025 #include <qvaluelist.h> 00026 00027 #include "addressee.h" 00028 00029 namespace KABC { 00030 00031 class Field; 00032 00042 namespace SortingTraits 00043 { 00044 00045 class Uid 00046 { 00047 public: 00048 static bool eq( const Addressee &, const Addressee & ); 00049 static bool lt( const Addressee &, const Addressee & ); 00050 }; 00051 00052 class Name 00053 { 00054 public: 00055 static bool eq( const Addressee &, const Addressee & ); 00056 static bool lt( const Addressee &, const Addressee & ); 00057 }; 00058 00059 class FormattedName 00060 { 00061 public: 00062 static bool eq( const Addressee &, const Addressee & ); 00063 static bool lt( const Addressee &, const Addressee & ); 00064 }; 00065 00066 class FamilyName // fallback to given name 00067 { 00068 public: 00069 static bool eq( const Addressee &, const Addressee & ); 00070 static bool lt( const Addressee &, const Addressee & ); 00071 }; 00072 00073 class GivenName // fallback to family name 00074 { 00075 public: 00076 static bool eq( const Addressee &, const Addressee & ); 00077 static bool lt( const Addressee &, const Addressee & ); 00078 }; 00079 00080 } 00081 00085 typedef enum { Uid, Name, FormattedName, FamilyName, GivenName } SortingCriterion; 00086 00110 class AddresseeList : public QValueList<Addressee> 00111 { 00112 public: 00113 AddresseeList(); 00114 ~AddresseeList(); 00115 AddresseeList( const AddresseeList & ); 00116 AddresseeList( const QValueList<Addressee> & ); 00117 00121 void dump() const; 00122 00128 void setReverseSorting( bool r = true ) { mReverseSorting = r; } 00129 00134 bool reverseSorting() const { return mReverseSorting; } 00135 00140 void sortBy( SortingCriterion c ); 00141 00147 void sortByField( Field *field = 0 ); 00148 00158 void sort(); 00159 00187 template<class Trait> void sortByTrait(); 00188 00193 SortingCriterion sortingCriterion() const { return mActiveSortingCriterion; } 00194 00202 Field* sortingField() const; 00203 00204 private: 00205 bool mReverseSorting; 00206 SortingCriterion mActiveSortingCriterion; 00207 //KDE 4.0 - add a d-pointer here! 00208 }; 00209 00210 } 00211 00212 #endif
KDE Logo
This file is part of the documentation for kabc Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:56:00 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003