addresseelist.h
/*
This file is part of libkabc.
Copyright (c) 2002 Jost Schenck <jost@schenck.de>
2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KABC_ADDRESSEELIST_H
#define KABC_ADDRESSEELIST_H
#include <qvaluelist.h>
#include "addressee.h"
namespace KABC {
class Field;
class SortField;
class SortMode;
namespace SortingTraits
{
class KABC_EXPORT Uid
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class KABC_EXPORT Name
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class KABC_EXPORT FormattedName
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class KABC_EXPORT FamilyName // fallback to given name
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class KABC_EXPORT GivenName // fallback to family name
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
}
typedef enum { Uid, Name, FormattedName, FamilyName, GivenName } SortingCriterion;
class KABC_EXPORT AddresseeList : public QValueList<Addressee>
{
public:
AddresseeList();
~AddresseeList();
AddresseeList( const AddresseeList & );
AddresseeList( const QValueList<Addressee> & );
void dump() const;
void setReverseSorting( bool r = true ) { mReverseSorting = r; }
bool reverseSorting() const { return mReverseSorting; }
void sortBy( SortingCriterion c );
void sortByField( Field *field = 0 );
void sortByMode( SortMode *mode = 0 );
void sort();
template<class Trait> void sortByTrait();
SortingCriterion sortingCriterion() const { return mActiveSortingCriterion; }
Field* sortingField() const;
private:
bool mReverseSorting;
SortingCriterion mActiveSortingCriterion;
//KDE 4.0 - add a d-pointer here!
};
}
#endif
KABC::AddresseeList
a QValueList of Addressee, with sorting functionality
Definition: addresseelist.h:112
KABC::SortMode
Sort method for sorting an addressee list.
Definition: sortmode.h:36
KABC::AddresseeList::sortingCriterion
SortingCriterion sortingCriterion() const
Returns the active sorting criterion, ie the sorting criterion that will be used by a sort call...
Definition: addresseelist.h:202
KABC::SortingCriterion
SortingCriterion
Addressee attribute used for sorting.
Definition: addresseelist.h:87
KABC::Addressee
address book entry
Definition: addressee.src.h:74
KABC::AddresseeList::setReverseSorting
void setReverseSorting(bool r=true)
Determines the direction of sorting.
Definition: addresseelist.h:130
KABC::AddresseeList::reverseSorting
bool reverseSorting() const
Returns the direction of sorting.
Definition: addresseelist.h:136

KDE Home | KDE Accessibility Home | Description of Access Keys