sortmode.h

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2004 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_SORTMODE_H
00022 #define KABC_SORTMODE_H
00023 
00024 #include "kabc_export.h"
00025 #include "addressee.h"
00026 
00027 namespace KABC {
00028 
00029 class Field;
00030 
00037 class KABC_EXPORT SortMode
00038 {
00039   public:
00040     virtual ~SortMode();
00041 
00046     virtual bool lesser( const KABC::Addressee &first, const KABC::Addressee &second ) const = 0;
00047 };
00048 
00054 class KABC_EXPORT NameSortMode : public SortMode
00055 {
00056   public:
00060     enum NameType {
00061       FormattedName,    
00062       FamilyName,       
00063       GivenName         
00064     };
00065 
00071     NameSortMode();
00072 
00083     explicit NameSortMode( NameType type, bool ascending = true );
00084 
00085     virtual ~NameSortMode();
00086 
00090     virtual bool lesser( const KABC::Addressee &first, const KABC::Addressee &second ) const;
00091 
00092   private:
00093     class Private;
00094     Private *const d;
00095 
00096     Q_DISABLE_COPY( NameSortMode )
00097 };
00098 
00105 class KABC_EXPORT FieldSortMode : public SortMode
00106 {
00107   public:
00118     explicit FieldSortMode( KABC::Field *field, bool ascending = true );
00119 
00120     virtual ~FieldSortMode();
00121 
00125     virtual bool lesser( const KABC::Addressee &first, const KABC::Addressee &second ) const;
00126 
00127   private:
00128     class Private;
00129     Private *const d;
00130 
00131     Q_DISABLE_COPY( FieldSortMode )
00132 };
00133 
00134 }
00135 
00136 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys