author | eilers <eilers> | 2002-11-14 17:04:24 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-14 17:04:24 (UTC) |
commit | f27919a0b1c36c568a0a7d4480e3a37e3f6e67af (patch) (side-by-side diff) | |
tree | e813dd2b10a2cd2658ee2511f008e3087c4bc801 | |
parent | fc44f2a2cb7522176289ae1d535415077d70c698 (diff) | |
download | opie-f27919a0b1c36c568a0a7d4480e3a37e3f6e67af.zip opie-f27919a0b1c36c568a0a7d4480e3a37e3f6e67af.tar.gz opie-f27919a0b1c36c568a0a7d4480e3a37e3f6e67af.tar.bz2 |
Sorting will now work if fullname is identical on some entries
-rw-r--r-- | libopie/pim/ocontactaccessbackend_xml.h | 7 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_xml.h | 7 |
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 @@ -4,32 +4,35 @@ * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) * * ===================================================================== * This program 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. * ===================================================================== * ToDo: XML-Backend: Automatic reload if something was changed... * * * ===================================================================== * Version: $Id$ * ===================================================================== * History: * $Log$ + * Revision 1.8 2002/11/14 17:04:24 eilers + * Sorting will now work if fullname is identical on some entries + * * Revision 1.7 2002/11/13 15:02:46 eilers * Small Bug in sorted fixed * * Revision 1.6 2002/11/13 14:14:51 eilers * Added sorted for Contacts.. * * Revision 1.5 2002/11/01 15:10:42 eilers * Added regExp-search in database for all fields in a contact. * * Revision 1.4 2002/10/16 10:52:40 eilers * Added some docu to the interface and now using the cache infrastucture by zecke.. :) * * Revision 1.3 2002/10/14 16:21:54 eilers * Some minor interface updates * * Revision 1.2 2002/10/07 17:34:24 eilers @@ -306,34 +309,34 @@ class OContactAccessBackend_XML : public OContactAccessBackend { default: return ( false ); } } // Currently only asc implemented.. QArray<int> sorted( bool asc, int , int , int ) { QMap<QString, int> nameToUid; QStringList names; QArray<int> m_currentQuery( m_contactList.count() ); // First fill map and StringList with all Names // Afterwards sort namelist and use map to fill array to return.. QValueListConstIterator<OContact> it; for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ - names.append( (*it).fileAs() ); - nameToUid.insert( (*it).fileAs(), (*it).uid() ); + names.append( (*it).fileAs() + QString::number( (*it).uid() ) ); + nameToUid.insert( (*it).fileAs() + QString::number( (*it).uid() ), (*it).uid() ); } names.sort(); int i = 0; if ( asc ){ for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it ) m_currentQuery[i++] = nameToUid[ (*it) ]; }else{ for ( QStringList::Iterator it = names.end(); it != names.begin(); --it ) m_currentQuery[i++] = nameToUid[ (*it) ]; } return m_currentQuery; } bool add ( const OContact &newcontact ) 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 @@ -4,32 +4,35 @@ * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) * * ===================================================================== * This program 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. * ===================================================================== * ToDo: XML-Backend: Automatic reload if something was changed... * * * ===================================================================== * Version: $Id$ * ===================================================================== * History: * $Log$ + * Revision 1.8 2002/11/14 17:04:24 eilers + * Sorting will now work if fullname is identical on some entries + * * Revision 1.7 2002/11/13 15:02:46 eilers * Small Bug in sorted fixed * * Revision 1.6 2002/11/13 14:14:51 eilers * Added sorted for Contacts.. * * Revision 1.5 2002/11/01 15:10:42 eilers * Added regExp-search in database for all fields in a contact. * * Revision 1.4 2002/10/16 10:52:40 eilers * Added some docu to the interface and now using the cache infrastucture by zecke.. :) * * Revision 1.3 2002/10/14 16:21:54 eilers * Some minor interface updates * * Revision 1.2 2002/10/07 17:34:24 eilers @@ -306,34 +309,34 @@ class OContactAccessBackend_XML : public OContactAccessBackend { default: return ( false ); } } // Currently only asc implemented.. QArray<int> sorted( bool asc, int , int , int ) { QMap<QString, int> nameToUid; QStringList names; QArray<int> m_currentQuery( m_contactList.count() ); // First fill map and StringList with all Names // Afterwards sort namelist and use map to fill array to return.. QValueListConstIterator<OContact> it; for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ - names.append( (*it).fileAs() ); - nameToUid.insert( (*it).fileAs(), (*it).uid() ); + names.append( (*it).fileAs() + QString::number( (*it).uid() ) ); + nameToUid.insert( (*it).fileAs() + QString::number( (*it).uid() ), (*it).uid() ); } names.sort(); int i = 0; if ( asc ){ for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it ) m_currentQuery[i++] = nameToUid[ (*it) ]; }else{ for ( QStringList::Iterator it = names.end(); it != names.begin(); --it ) m_currentQuery[i++] = nameToUid[ (*it) ]; } return m_currentQuery; } bool add ( const OContact &newcontact ) |