summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
authoreilers <eilers>2002-11-13 14:14:51 (UTC)
committer eilers <eilers>2002-11-13 14:14:51 (UTC)
commit2255284b2e80bdc2881ab9106e9afa614a08c140 (patch) (side-by-side diff)
tree89e53028d842061371e6414ee037f96fa0fbef5e /libopie2/opiepim/backend/ocontactaccessbackend_xml.h
parenteaecbed44924ece119c5b41db2828b4554f263d2 (diff)
downloadopie-2255284b2e80bdc2881ab9106e9afa614a08c140.zip
opie-2255284b2e80bdc2881ab9106e9afa614a08c140.tar.gz
opie-2255284b2e80bdc2881ab9106e9afa614a08c140.tar.bz2
Added sorted for Contacts..
Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_xml.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index f7e8207..8b95102 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -8,24 +8,27 @@
* 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.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
* added OBackendFactory for advanced backend access
*
@@ -38,24 +41,25 @@
*
*/
#ifndef _OContactAccessBackend_XML_
#define _OContactAccessBackend_XML_
#include <qasciidict.h>
#include <qdatetime.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <qarray.h>
+#include <qmap.h>
#include <qpe/global.h>
#include <opie/xmltree.h>
#include "ocontactaccessbackend.h"
#include "ocontactaccess.h"
#include <stdlib.h>
#include <errno.h>
using namespace Opie;
@@ -292,24 +296,52 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
switch ( querySettings & ~OContactAccess::IgnoreCase ){
case OContactAccess::RegExp:
return ( true );
case OContactAccess::WildCards:
return ( true );
case OContactAccess::ExactMatch:
return ( true );
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 ( better LastNames ? )
+ // 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).lastName() );
+ nameToUid.insert( (*it).lastName(), (*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 )
{
//qWarning("odefaultbackend: ACTION::ADD");
updateJournal (newcontact, OContact::ACTION_ADD);
addContact_p( newcontact );
m_changed = true;
return true;
}
bool replace ( const OContact &contact )