summaryrefslogtreecommitdiffabout
path: root/kabc/addresseelist.cpp
Unidiff
Diffstat (limited to 'kabc/addresseelist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addresseelist.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/kabc/addresseelist.cpp b/kabc/addresseelist.cpp
index 097e162..e1ba1ce 100644
--- a/kabc/addresseelist.cpp
+++ b/kabc/addresseelist.cpp
@@ -7,49 +7,51 @@
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22/* 22/*
23Enhanced Version of the file for platform independent KDE tools. 23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk 24Copyright (c) 2004 Ulf Schenk
25 25
26$Id$ 26$Id$
27*/ 27*/
28 28
29#include <kdebug.h> 29#include <kdebug.h>
30//US 30//US
31#include <qtl.h> 31#include <q3tl.h>
32//Added by qt3to4:
33#include <Q3ValueList>
32 34
33 35
34#include "addresseelist.h" 36#include "addresseelist.h"
35#include "field.h" 37#include "field.h"
36 38
37using namespace KABC; 39using namespace KABC;
38 40
39// 41//
40// 42//
41// Traits 43// Traits
42// 44//
43// 45//
44 46
45bool SortingTraits::Uid::eq( const Addressee &a1, const Addressee &a2 ) 47bool SortingTraits::Uid::eq( const Addressee &a1, const Addressee &a2 )
46{ 48{
47 // locale awareness doesn't make sense sorting ids 49 // locale awareness doesn't make sense sorting ids
48 return ( QString::compare( a1.uid(), a2.uid() ) == 0 ); 50 return ( QString::compare( a1.uid(), a2.uid() ) == 0 );
49} 51}
50 52
51bool SortingTraits::Uid::lt( const Addressee &a1, const Addressee &a2 ) 53bool SortingTraits::Uid::lt( const Addressee &a1, const Addressee &a2 )
52{ 54{
53 // locale awareness doesn't make sense sorting ids 55 // locale awareness doesn't make sense sorting ids
54 return ( QString::compare( a1.uid(), a2.uid() ) < 0 ); 56 return ( QString::compare( a1.uid(), a2.uid() ) < 0 );
55} 57}
@@ -100,68 +102,68 @@ bool SortingTraits::GivenName::eq( const Addressee &a1, const Addressee &a2 )
100{ 102{
101//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare 103//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
102 return ( QString::compare( a1.givenName(), a2.givenName() ) == 0 104 return ( QString::compare( a1.givenName(), a2.givenName() ) == 0
103 && QString::compare( a1.familyName(), a2.familyName() ) == 0 ); 105 && QString::compare( a1.familyName(), a2.familyName() ) == 0 );
104} 106}
105 107
106bool SortingTraits::GivenName::lt( const Addressee &a1, const Addressee &a2 ) 108bool SortingTraits::GivenName::lt( const Addressee &a1, const Addressee &a2 )
107{ 109{
108//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare 110//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
109 int given = QString::compare( a1.givenName(), a2.givenName() ); 111 int given = QString::compare( a1.givenName(), a2.givenName() );
110 if ( 0 == given ) { 112 if ( 0 == given ) {
111 return ( QString::compare( a1.familyName(), a2.familyName() ) < 0 ); 113 return ( QString::compare( a1.familyName(), a2.familyName() ) < 0 );
112 } else { 114 } else {
113 return given < 0; 115 return given < 0;
114 } 116 }
115} 117}
116 118
117// 119//
118// 120//
119// AddresseeList 121// AddresseeList
120// 122//
121// 123//
122 124
123AddresseeList::AddresseeList() 125AddresseeList::AddresseeList()
124 : QValueList<Addressee>() 126 : Q3ValueList<Addressee>()
125{ 127{
126 mReverseSorting = false; 128 mReverseSorting = false;
127 mActiveSortingCriterion = FormattedName; 129 mActiveSortingCriterion = FormattedName;
128 mActiveSortingField = 0; 130 mActiveSortingField = 0;
129} 131}
130 132
131AddresseeList::~AddresseeList() 133AddresseeList::~AddresseeList()
132{ 134{
133} 135}
134 136
135AddresseeList::AddresseeList( const AddresseeList &l ) 137AddresseeList::AddresseeList( const AddresseeList &l )
136 : QValueList<Addressee>( l ) 138 : Q3ValueList<Addressee>( l )
137{ 139{
138 mReverseSorting = l.reverseSorting(); 140 mReverseSorting = l.reverseSorting();
139 mActiveSortingCriterion = l.sortingCriterion(); 141 mActiveSortingCriterion = l.sortingCriterion();
140} 142}
141 143
142AddresseeList::AddresseeList( const QValueList<Addressee> &l ) 144AddresseeList::AddresseeList( const Q3ValueList<Addressee> &l )
143 : QValueList<Addressee>( l ) 145 : Q3ValueList<Addressee>( l )
144{ 146{
145 mReverseSorting = false; 147 mReverseSorting = false;
146} 148}
147 149
148void AddresseeList::dump() const 150void AddresseeList::dump() const
149{ 151{
150 kdDebug(5700) << "AddresseeList {" << endl; 152 kdDebug(5700) << "AddresseeList {" << endl;
151 kdDebug(5700) << "reverse order: " << ( mReverseSorting ? "true" : "false" ) << endl; 153 kdDebug(5700) << "reverse order: " << ( mReverseSorting ? "true" : "false" ) << endl;
152 154
153 QString crit; 155 QString crit;
154 if ( Uid == mActiveSortingCriterion ) { 156 if ( Uid == mActiveSortingCriterion ) {
155 crit = "Uid"; 157 crit = "Uid";
156 } else if ( Name == mActiveSortingCriterion ) { 158 } else if ( Name == mActiveSortingCriterion ) {
157 crit = "Name"; 159 crit = "Name";
158 } else if ( FormattedName == mActiveSortingCriterion ) { 160 } else if ( FormattedName == mActiveSortingCriterion ) {
159 crit = "FormattedName"; 161 crit = "FormattedName";
160 } else if ( FamilyName == mActiveSortingCriterion ) { 162 } else if ( FamilyName == mActiveSortingCriterion ) {
161 crit = "FamilyName"; 163 crit = "FamilyName";
162 } else if ( GivenName == mActiveSortingCriterion ) { 164 } else if ( GivenName == mActiveSortingCriterion ) {
163 crit = "GivenName"; 165 crit = "GivenName";
164 } else { 166 } else {
165 crit = "unknown -- update dump method"; 167 crit = "unknown -- update dump method";
166 } 168 }
167 169