summaryrefslogtreecommitdiff
path: root/libopie/pim
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 /libopie/pim
parenteaecbed44924ece119c5b41db2828b4554f263d2 (diff)
downloadopie-2255284b2e80bdc2881ab9106e9afa614a08c140.zip
opie-2255284b2e80bdc2881ab9106e9afa614a08c140.tar.gz
opie-2255284b2e80bdc2881ab9106e9afa614a08c140.tar.bz2
Added sorted for Contacts..
Diffstat (limited to 'libopie/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccess.cpp8
-rw-r--r--libopie/pim/ocontactaccess.h11
-rw-r--r--libopie/pim/ocontactaccessbackend.h4
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.cpp10
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.h4
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h32
6 files changed, 69 insertions, 0 deletions
diff --git a/libopie/pim/ocontactaccess.cpp b/libopie/pim/ocontactaccess.cpp
index f868b53..9c9338e 100644
--- a/libopie/pim/ocontactaccess.cpp
+++ b/libopie/pim/ocontactaccess.cpp
@@ -23,2 +23,5 @@
* $Log$
+ * Revision 1.7 2002/11/13 14:14:51 eilers
+ * Added sorted for Contacts..
+ *
* Revision 1.6 2002/11/01 15:10:42 eilers
@@ -139,2 +142,7 @@ bool OContactAccess::hasQuerySettings ( int querySettings ) const
}
+ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
+{
+ QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
+ return ( ORecordList<OContact>(matchingContacts, this) );
+}
diff --git a/libopie/pim/ocontactaccess.h b/libopie/pim/ocontactaccess.h
index b4921d5..961968f 100644
--- a/libopie/pim/ocontactaccess.h
+++ b/libopie/pim/ocontactaccess.h
@@ -19,2 +19,5 @@
* $Log$
+ * Revision 1.5 2002/11/13 14:14:51 eilers
+ * Added sorted for Contacts..
+ *
* Revision 1.4 2002/11/01 15:10:42 eilers
@@ -93,2 +96,10 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
+ /** Return all Contacts in a sorted manner.
+ * @param ascending true: Sorted in acending order.
+ * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess
+ * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess
+ * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess
+ */
+ List sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const;
+
/** Return all possible settings.
diff --git a/libopie/pim/ocontactaccessbackend.h b/libopie/pim/ocontactaccessbackend.h
index c898f61..821f5bf 100644
--- a/libopie/pim/ocontactaccessbackend.h
+++ b/libopie/pim/ocontactaccessbackend.h
@@ -21,2 +21,5 @@
* $Log$
+ * Revision 1.4 2002/11/13 14:14:51 eilers
+ * Added sorted for Contacts..
+ *
* Revision 1.3 2002/11/01 15:10:42 eilers
@@ -78,2 +81,3 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
+ virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/libopie/pim/ocontactaccessbackend_vcard.cpp
index faa72b4..09ae37b 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.cpp
+++ b/libopie/pim/ocontactaccessbackend_vcard.cpp
@@ -19,2 +19,5 @@
* $Log$
+ * Revision 1.4 2002/11/13 14:14:51 eilers
+ * Added sorted for Contacts..
+ *
* Revision 1.3 2002/11/11 16:41:09 kergoth
@@ -180,2 +183,9 @@ bool OContactAccessBackend_VCard::wasChangedExternally()
+// Not implemented
+QArray<int> OContactAccessBackend_VCard::sorted( bool , int, int, int )
+{
+ QArray<int> ar(0);
+ return ar;
+}
+
// *** Private stuff ***
diff --git a/libopie/pim/ocontactaccessbackend_vcard.h b/libopie/pim/ocontactaccessbackend_vcard.h
index 177ec24..4437756 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.h
+++ b/libopie/pim/ocontactaccessbackend_vcard.h
@@ -19,2 +19,5 @@
* $Log$
+ * Revision 1.3 2002/11/13 14:14:51 eilers
+ * Added sorted for Contacts..
+ *
* Revision 1.2 2002/11/10 15:41:53 eilers
@@ -55,2 +58,3 @@ class OContactAccessBackend_VCard : public OContactAccessBackend {
bool hasQuerySettings (uint querySettings) const;
+ QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat );
bool wasChangedExternally();
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index f7e8207..8b95102 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/libopie/pim/ocontactaccessbackend_xml.h
@@ -19,2 +19,5 @@
* $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
@@ -49,2 +52,3 @@
#include <qarray.h>
+#include <qmap.h>
@@ -303,2 +307,30 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
+ // 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 )