summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (show 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 @@
23 * $Log$ 23 * $Log$
24 * Revision 1.7 2002/11/13 14:14:51 eilers
25 * Added sorted for Contacts..
26 *
24 * Revision 1.6 2002/11/01 15:10:42 eilers 27 * Revision 1.6 2002/11/01 15:10:42 eilers
@@ -139,2 +142,7 @@ bool OContactAccess::hasQuerySettings ( int querySettings ) const
139} 142}
143ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
144{
145 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
146 return ( ORecordList<OContact>(matchingContacts, this) );
147}
140 148
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 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.5 2002/11/13 14:14:51 eilers
21 * Added sorted for Contacts..
22 *
20 * Revision 1.4 2002/11/01 15:10:42 eilers 23 * Revision 1.4 2002/11/01 15:10:42 eilers
@@ -93,2 +96,10 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
93 96
97 /** Return all Contacts in a sorted manner.
98 * @param ascending true: Sorted in acending order.
99 * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess
100 * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess
101 * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess
102 */
103 List sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const;
104
94 /** Return all possible settings. 105 /** 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 @@
21 * $Log$ 21 * $Log$
22 * Revision 1.4 2002/11/13 14:14:51 eilers
23 * Added sorted for Contacts..
24 *
22 * Revision 1.3 2002/11/01 15:10:42 eilers 25 * Revision 1.3 2002/11/01 15:10:42 eilers
@@ -78,2 +81,3 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
78 81
82 virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
79 83
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 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.4 2002/11/13 14:14:51 eilers
21 * Added sorted for Contacts..
22 *
20 * Revision 1.3 2002/11/11 16:41:09 kergoth 23 * Revision 1.3 2002/11/11 16:41:09 kergoth
@@ -180,2 +183,9 @@ bool OContactAccessBackend_VCard::wasChangedExternally()
180 183
184// Not implemented
185QArray<int> OContactAccessBackend_VCard::sorted( bool , int, int, int )
186{
187 QArray<int> ar(0);
188 return ar;
189}
190
181// *** Private stuff *** 191// *** 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 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.3 2002/11/13 14:14:51 eilers
21 * Added sorted for Contacts..
22 *
20 * Revision 1.2 2002/11/10 15:41:53 eilers 23 * Revision 1.2 2002/11/10 15:41:53 eilers
@@ -55,2 +58,3 @@ class OContactAccessBackend_VCard : public OContactAccessBackend {
55 bool hasQuerySettings (uint querySettings) const; 58 bool hasQuerySettings (uint querySettings) const;
59 QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat );
56 bool wasChangedExternally(); 60 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 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.6 2002/11/13 14:14:51 eilers
21 * Added sorted for Contacts..
22 *
20 * Revision 1.5 2002/11/01 15:10:42 eilers 23 * Revision 1.5 2002/11/01 15:10:42 eilers
@@ -49,2 +52,3 @@
49#include <qarray.h> 52#include <qarray.h>
53#include <qmap.h>
50 54
@@ -303,2 +307,30 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
303 307
308 // Currently only asc implemented..
309 QArray<int> sorted( bool asc, int , int , int )
310 {
311 QMap<QString, int> nameToUid;
312 QStringList names;
313 QArray<int> m_currentQuery( m_contactList.count() );
314
315 // First fill map and StringList with all Names ( better LastNames ? )
316 // Afterwards sort namelist and use map to fill array to return..
317 QValueListConstIterator<OContact> it;
318 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){
319 names.append( (*it).lastName() );
320 nameToUid.insert( (*it).lastName(), (*it).uid() );
321 }
322 names.sort();
323
324 int i = 0;
325 if ( asc ){
326 for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it )
327 m_currentQuery[i++] = nameToUid[ (*it) ];
328 }else{
329 for ( QStringList::Iterator it = names.end(); it != names.begin(); --it )
330 m_currentQuery[i++] = nameToUid[ (*it) ];
331 }
332
333 return m_currentQuery;
334
335 }
304 bool add ( const OContact &newcontact ) 336 bool add ( const OContact &newcontact )