summaryrefslogtreecommitdiff
authoreilers <eilers>2002-11-14 17:04:24 (UTC)
committer eilers <eilers>2002-11-14 17:04:24 (UTC)
commitf27919a0b1c36c568a0a7d4480e3a37e3f6e67af (patch) (unidiff)
treee813dd2b10a2cd2658ee2511f008e3087c4bc801
parentfc44f2a2cb7522176289ae1d535415077d70c698 (diff)
downloadopie-f27919a0b1c36c568a0a7d4480e3a37e3f6e67af.zip
opie-f27919a0b1c36c568a0a7d4480e3a37e3f6e67af.tar.gz
opie-f27919a0b1c36c568a0a7d4480e3a37e3f6e67af.tar.bz2
Sorting will now work if fullname is identical on some entries
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h7
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h7
2 files changed, 10 insertions, 4 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index adc8dc3..ae6ec9e 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/libopie/pim/ocontactaccessbackend_xml.h
@@ -8,24 +8,27 @@
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * ToDo: XML-Backend: Automatic reload if something was changed... 12 * ToDo: XML-Backend: Automatic reload if something was changed...
13 * 13 *
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.8 2002/11/14 17:04:24 eilers
21 * Sorting will now work if fullname is identical on some entries
22 *
20 * Revision 1.7 2002/11/13 15:02:46 eilers 23 * Revision 1.7 2002/11/13 15:02:46 eilers
21 * Small Bug in sorted fixed 24 * Small Bug in sorted fixed
22 * 25 *
23 * Revision 1.6 2002/11/13 14:14:51 eilers 26 * Revision 1.6 2002/11/13 14:14:51 eilers
24 * Added sorted for Contacts.. 27 * Added sorted for Contacts..
25 * 28 *
26 * Revision 1.5 2002/11/01 15:10:42 eilers 29 * Revision 1.5 2002/11/01 15:10:42 eilers
27 * Added regExp-search in database for all fields in a contact. 30 * Added regExp-search in database for all fields in a contact.
28 * 31 *
29 * Revision 1.4 2002/10/16 10:52:40 eilers 32 * Revision 1.4 2002/10/16 10:52:40 eilers
30 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 33 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
31 * 34 *
@@ -310,26 +313,26 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
310 313
311 // Currently only asc implemented.. 314 // Currently only asc implemented..
312 QArray<int> sorted( bool asc, int , int , int ) 315 QArray<int> sorted( bool asc, int , int , int )
313 { 316 {
314 QMap<QString, int> nameToUid; 317 QMap<QString, int> nameToUid;
315 QStringList names; 318 QStringList names;
316 QArray<int> m_currentQuery( m_contactList.count() ); 319 QArray<int> m_currentQuery( m_contactList.count() );
317 320
318 // First fill map and StringList with all Names 321 // First fill map and StringList with all Names
319 // Afterwards sort namelist and use map to fill array to return.. 322 // Afterwards sort namelist and use map to fill array to return..
320 QValueListConstIterator<OContact> it; 323 QValueListConstIterator<OContact> it;
321 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ 324 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){
322 names.append( (*it).fileAs() ); 325 names.append( (*it).fileAs() + QString::number( (*it).uid() ) );
323 nameToUid.insert( (*it).fileAs(), (*it).uid() ); 326 nameToUid.insert( (*it).fileAs() + QString::number( (*it).uid() ), (*it).uid() );
324 } 327 }
325 names.sort(); 328 names.sort();
326 329
327 int i = 0; 330 int i = 0;
328 if ( asc ){ 331 if ( asc ){
329 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it ) 332 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it )
330 m_currentQuery[i++] = nameToUid[ (*it) ]; 333 m_currentQuery[i++] = nameToUid[ (*it) ];
331 }else{ 334 }else{
332 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it ) 335 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it )
333 m_currentQuery[i++] = nameToUid[ (*it) ]; 336 m_currentQuery[i++] = nameToUid[ (*it) ];
334 } 337 }
335 338
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index adc8dc3..ae6ec9e 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -8,24 +8,27 @@
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * ToDo: XML-Backend: Automatic reload if something was changed... 12 * ToDo: XML-Backend: Automatic reload if something was changed...
13 * 13 *
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.8 2002/11/14 17:04:24 eilers
21 * Sorting will now work if fullname is identical on some entries
22 *
20 * Revision 1.7 2002/11/13 15:02:46 eilers 23 * Revision 1.7 2002/11/13 15:02:46 eilers
21 * Small Bug in sorted fixed 24 * Small Bug in sorted fixed
22 * 25 *
23 * Revision 1.6 2002/11/13 14:14:51 eilers 26 * Revision 1.6 2002/11/13 14:14:51 eilers
24 * Added sorted for Contacts.. 27 * Added sorted for Contacts..
25 * 28 *
26 * Revision 1.5 2002/11/01 15:10:42 eilers 29 * Revision 1.5 2002/11/01 15:10:42 eilers
27 * Added regExp-search in database for all fields in a contact. 30 * Added regExp-search in database for all fields in a contact.
28 * 31 *
29 * Revision 1.4 2002/10/16 10:52:40 eilers 32 * Revision 1.4 2002/10/16 10:52:40 eilers
30 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 33 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
31 * 34 *
@@ -310,26 +313,26 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
310 313
311 // Currently only asc implemented.. 314 // Currently only asc implemented..
312 QArray<int> sorted( bool asc, int , int , int ) 315 QArray<int> sorted( bool asc, int , int , int )
313 { 316 {
314 QMap<QString, int> nameToUid; 317 QMap<QString, int> nameToUid;
315 QStringList names; 318 QStringList names;
316 QArray<int> m_currentQuery( m_contactList.count() ); 319 QArray<int> m_currentQuery( m_contactList.count() );
317 320
318 // First fill map and StringList with all Names 321 // First fill map and StringList with all Names
319 // Afterwards sort namelist and use map to fill array to return.. 322 // Afterwards sort namelist and use map to fill array to return..
320 QValueListConstIterator<OContact> it; 323 QValueListConstIterator<OContact> it;
321 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ 324 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){
322 names.append( (*it).fileAs() ); 325 names.append( (*it).fileAs() + QString::number( (*it).uid() ) );
323 nameToUid.insert( (*it).fileAs(), (*it).uid() ); 326 nameToUid.insert( (*it).fileAs() + QString::number( (*it).uid() ), (*it).uid() );
324 } 327 }
325 names.sort(); 328 names.sort();
326 329
327 int i = 0; 330 int i = 0;
328 if ( asc ){ 331 if ( asc ){
329 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it ) 332 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it )
330 m_currentQuery[i++] = nameToUid[ (*it) ]; 333 m_currentQuery[i++] = nameToUid[ (*it) ];
331 }else{ 334 }else{
332 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it ) 335 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it )
333 m_currentQuery[i++] = nameToUid[ (*it) ]; 336 m_currentQuery[i++] = nameToUid[ (*it) ];
334 } 337 }
335 338