kabc Library API Documentation

KABC::AddresseeList Class Reference

a QValueList of Addressee, with sorting functionality More...

#include <addresseelist.h>

Inheritance diagram for KABC::AddresseeList:

QValueList< Addressee > List of all members.

Public Methods

void dump () const
void setReverseSorting (bool r=true)
bool reverseSorting () const
void sortBy (SortingCriterion c)
void sortByField (Field *field=0)
void sort ()
template<class Trait> void sortByTrait ()
SortingCriterion sortingCriterion () const
Field * sortingField () const

Detailed Description

a QValueList of Addressee, with sorting functionality

This class extends the functionality of QValueList with sorting methods specific to the Addressee class. It can be used just like any other QValueList but is no template class.

An AddresseeList does not automatically keep sorted when addressees are added or removed or the sorting order is changed, as this would slow down larger operations by sorting after every step. So after such operations you have to call or {@link #sortBy to create a defined order again.

Iterator usage is inherited by QValueList and extensively documented there. Please remember that the state of an iterator is undefined after any sorting operation.

For the enumeration Type SortingCriterion, which specifies the field by the collection will be sorted, the following values exist: Uid, Name, FormattedName, FamilyName, GivenName.

Author:
Jost Schenck jost@schenck.de

Definition at line 110 of file addresseelist.h.


Member Function Documentation

void AddresseeList::dump  
 

Debug output.

Definition at line 131 of file addresseelist.cpp.

References QValueList< Addressee >::begin(), QValueList< Addressee >::const_iterator(), and QValueList< Addressee >::end().

void KABC::AddresseeList::setReverseSorting bool    r = true [inline]
 

Determines the direction of sorting.

On change, the list will not automatically be resorted.

Parameters:
r  true if sorting should be done reverse, false otherwise

Definition at line 128 of file addresseelist.h.

bool KABC::AddresseeList::reverseSorting   const [inline]
 

Returns the direction of sorting.

Returns:
true if sorting is done reverse, false otherwise

Definition at line 134 of file addresseelist.h.

void AddresseeList::sortBy SortingCriterion    c
 

Sorts this list by a specific criterion.

Parameters:
c  the criterion by which should be sorted

Definition at line 160 of file addresseelist.cpp.

References KABC::SortingCriterion.

Referenced by sort().

void AddresseeList::sortByField Field *    field = 0
 

Sorts this list by a specific field.

If no parameter is given, the last used Field object will be used.

Parameters:
field  pointer to the Field object to be sorted by

Definition at line 219 of file addresseelist.cpp.

References QValueList< Addressee >::count().

void AddresseeList::sort  
 

Sorts this list by its active sorting criterion.

This normally is the criterion of the last sortBy operation or FormattedName if up to now there has been no sortBy operation.

Please note that the sorting trait of the last

Definition at line 178 of file addresseelist.cpp.

References sortBy().

template<class Trait>
void AddresseeList::sortByTrait  
 

Templated sort function.

You normally will not want to use this but and {@link #sort instead as the existing sorting criteria completely suffice for most cases.

However, if you do want to use some special sorting criterion, you can write a trait class that will be provided to this templated method. This trait class has to have a class declaration like the following:

 class MySortingTrait {
   public:
     // eq returns true if a1 and a2 are equal
     static bool eq(KABC::Addressee a1, KABC::Addressee a2);
     // lt returns true is a1 is "less than" a2
     static bool lt(KABC::Addressee a1, KABC::Addressee a2);
 };
You can then pass this class to the sortByTrait method like this:
 myAddresseelist.sortByTrait&lt;MySortingTrait&gt;();
Please note that the

Definition at line 184 of file addresseelist.cpp.

References QValueList< Addressee >::begin(), QValueList< Addressee >::end(), and QValueList< Addressee >::iterator().

SortingCriterion KABC::AddresseeList::sortingCriterion   const [inline]
 

Returns the active sorting criterion, ie the sorting criterion that will be used by a

Definition at line 193 of file addresseelist.h.

References KABC::SortingCriterion.

Field * AddresseeList::sortingField  
 

Returns the active sorting field, ie a pointer to the Field object which was used for the last

This function returns the last GLOBAL sorting field, not the class specific one. You're a lot better off by keeping track of this locally.

Definition at line 237 of file addresseelist.cpp.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kabc Library Version 3.2.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Feb 4 12:36:46 2004 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2003