summaryrefslogtreecommitdiff
authoreilers <eilers>2002-11-13 15:02:46 (UTC)
committer eilers <eilers>2002-11-13 15:02:46 (UTC)
commit2bc05c54b2ff1a9b2af7d6bd4d55428cfe0d8db3 (patch) (unidiff)
tree8fdc9e49e0a85927fee9497b9d8c5e34e96b049e
parent2255284b2e80bdc2881ab9106e9afa614a08c140 (diff)
downloadopie-2bc05c54b2ff1a9b2af7d6bd4d55428cfe0d8db3.zip
opie-2bc05c54b2ff1a9b2af7d6bd4d55428cfe0d8db3.tar.gz
opie-2bc05c54b2ff1a9b2af7d6bd4d55428cfe0d8db3.tar.bz2
Small Bug in sorted fixed
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h9
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h9
2 files changed, 12 insertions, 6 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index 8b95102..adc8dc3 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.7 2002/11/13 15:02:46 eilers
21 * Small Bug in sorted fixed
22 *
20 * Revision 1.6 2002/11/13 14:14:51 eilers 23 * Revision 1.6 2002/11/13 14:14:51 eilers
21 * Added sorted for Contacts.. 24 * Added sorted for Contacts..
22 * 25 *
23 * Revision 1.5 2002/11/01 15:10:42 eilers 26 * Revision 1.5 2002/11/01 15:10:42 eilers
24 * Added regExp-search in database for all fields in a contact. 27 * Added regExp-search in database for all fields in a contact.
25 * 28 *
26 * Revision 1.4 2002/10/16 10:52:40 eilers 29 * Revision 1.4 2002/10/16 10:52:40 eilers
27 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 30 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
28 * 31 *
29 * Revision 1.3 2002/10/14 16:21:54 eilers 32 * Revision 1.3 2002/10/14 16:21:54 eilers
30 * Some minor interface updates 33 * Some minor interface updates
31 * 34 *
@@ -303,30 +306,30 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
303 default: 306 default:
304 return ( false ); 307 return ( false );
305 } 308 }
306 } 309 }
307 310
308 // Currently only asc implemented.. 311 // Currently only asc implemented..
309 QArray<int> sorted( bool asc, int , int , int ) 312 QArray<int> sorted( bool asc, int , int , int )
310 { 313 {
311 QMap<QString, int> nameToUid; 314 QMap<QString, int> nameToUid;
312 QStringList names; 315 QStringList names;
313 QArray<int> m_currentQuery( m_contactList.count() ); 316 QArray<int> m_currentQuery( m_contactList.count() );
314 317
315 // First fill map and StringList with all Names ( better LastNames ? ) 318 // First fill map and StringList with all Names
316 // Afterwards sort namelist and use map to fill array to return.. 319 // Afterwards sort namelist and use map to fill array to return..
317 QValueListConstIterator<OContact> it; 320 QValueListConstIterator<OContact> it;
318 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ 321 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){
319 names.append( (*it).lastName() ); 322 names.append( (*it).fileAs() );
320 nameToUid.insert( (*it).lastName(), (*it).uid() ); 323 nameToUid.insert( (*it).fileAs(), (*it).uid() );
321 } 324 }
322 names.sort(); 325 names.sort();
323 326
324 int i = 0; 327 int i = 0;
325 if ( asc ){ 328 if ( asc ){
326 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it ) 329 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it )
327 m_currentQuery[i++] = nameToUid[ (*it) ]; 330 m_currentQuery[i++] = nameToUid[ (*it) ];
328 }else{ 331 }else{
329 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it ) 332 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it )
330 m_currentQuery[i++] = nameToUid[ (*it) ]; 333 m_currentQuery[i++] = nameToUid[ (*it) ];
331 } 334 }
332 335
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index 8b95102..adc8dc3 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.7 2002/11/13 15:02:46 eilers
21 * Small Bug in sorted fixed
22 *
20 * Revision 1.6 2002/11/13 14:14:51 eilers 23 * Revision 1.6 2002/11/13 14:14:51 eilers
21 * Added sorted for Contacts.. 24 * Added sorted for Contacts..
22 * 25 *
23 * Revision 1.5 2002/11/01 15:10:42 eilers 26 * Revision 1.5 2002/11/01 15:10:42 eilers
24 * Added regExp-search in database for all fields in a contact. 27 * Added regExp-search in database for all fields in a contact.
25 * 28 *
26 * Revision 1.4 2002/10/16 10:52:40 eilers 29 * Revision 1.4 2002/10/16 10:52:40 eilers
27 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 30 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
28 * 31 *
29 * Revision 1.3 2002/10/14 16:21:54 eilers 32 * Revision 1.3 2002/10/14 16:21:54 eilers
30 * Some minor interface updates 33 * Some minor interface updates
31 * 34 *
@@ -303,30 +306,30 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
303 default: 306 default:
304 return ( false ); 307 return ( false );
305 } 308 }
306 } 309 }
307 310
308 // Currently only asc implemented.. 311 // Currently only asc implemented..
309 QArray<int> sorted( bool asc, int , int , int ) 312 QArray<int> sorted( bool asc, int , int , int )
310 { 313 {
311 QMap<QString, int> nameToUid; 314 QMap<QString, int> nameToUid;
312 QStringList names; 315 QStringList names;
313 QArray<int> m_currentQuery( m_contactList.count() ); 316 QArray<int> m_currentQuery( m_contactList.count() );
314 317
315 // First fill map and StringList with all Names ( better LastNames ? ) 318 // First fill map and StringList with all Names
316 // Afterwards sort namelist and use map to fill array to return.. 319 // Afterwards sort namelist and use map to fill array to return..
317 QValueListConstIterator<OContact> it; 320 QValueListConstIterator<OContact> it;
318 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ 321 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){
319 names.append( (*it).lastName() ); 322 names.append( (*it).fileAs() );
320 nameToUid.insert( (*it).lastName(), (*it).uid() ); 323 nameToUid.insert( (*it).fileAs(), (*it).uid() );
321 } 324 }
322 names.sort(); 325 names.sort();
323 326
324 int i = 0; 327 int i = 0;
325 if ( asc ){ 328 if ( asc ){
326 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it ) 329 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it )
327 m_currentQuery[i++] = nameToUid[ (*it) ]; 330 m_currentQuery[i++] = nameToUid[ (*it) ];
328 }else{ 331 }else{
329 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it ) 332 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it )
330 m_currentQuery[i++] = nameToUid[ (*it) ]; 333 m_currentQuery[i++] = nameToUid[ (*it) ];
331 } 334 }
332 335