summaryrefslogtreecommitdiff
Unidiff
Diffstat (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
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend.h4
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp10
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.h4
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h32
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp8
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h11
12 files changed, 138 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
@@ -18,12 +18,15 @@
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
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
25 * Added regExp-search in database for all fields in a contact. 28 * Added regExp-search in database for all fields in a contact.
26 * 29 *
27 * Revision 1.5 2002/10/16 10:52:40 eilers 30 * Revision 1.5 2002/10/16 10:52:40 eilers
28 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 31 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
29 * 32 *
@@ -134,12 +137,17 @@ const uint OContactAccess::querySettings()
134} 137}
135 138
136bool OContactAccess::hasQuerySettings ( int querySettings ) const 139bool OContactAccess::hasQuerySettings ( int querySettings ) const
137{ 140{
138 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 141 return ( m_backEnd->hasQuerySettings ( querySettings ) );
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
141 149
142bool OContactAccess::wasChangedExternally()const 150bool OContactAccess::wasChangedExternally()const
143{ 151{
144 return ( m_backEnd->wasChangedExternally() ); 152 return ( m_backEnd->wasChangedExternally() );
145} 153}
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
@@ -14,12 +14,15 @@
14 * ToDo: Define enum for query settings 14 * ToDo: Define enum for query settings
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * Added regExp-search in database for all fields in a contact. 24 * Added regExp-search in database for all fields in a contact.
22 * 25 *
23 * Revision 1.3 2002/10/16 10:52:40 eilers 26 * Revision 1.3 2002/10/16 10:52:40 eilers
24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 27 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
25 * 28 *
@@ -88,12 +91,20 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
88 MatchOne = 0x0010 // Only one Entry must match 91 MatchOne = 0x0010 // Only one Entry must match
89 }; 92 };
90 93
91 94
92 ORecordList<OContact> matchRegexp( const QRegExp &r )const; 95 ORecordList<OContact> matchRegexp( const QRegExp &r )const;
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.
95 * @return All settings provided by the current backend 106 * @return All settings provided by the current backend
96 * (i.e.: query_WildCards & query_IgnoreCase) 107 * (i.e.: query_WildCards & query_IgnoreCase)
97 */ 108 */
98 const uint querySettings(); 109 const uint querySettings();
99 110
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
@@ -16,12 +16,15 @@
16 * ToDo: Define enum for query settings 16 * ToDo: Define enum for query settings
17 * ===================================================================== 17 * =====================================================================
18 * Version: $Id$ 18 * Version: $Id$
19 * ===================================================================== 19 * =====================================================================
20 * History: 20 * History:
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
23 * Added regExp-search in database for all fields in a contact. 26 * Added regExp-search in database for all fields in a contact.
24 * 27 *
25 * Revision 1.2 2002/10/07 17:34:24 eilers 28 * Revision 1.2 2002/10/07 17:34:24 eilers
26 * added OBackendFactory for advanced backend access 29 * added OBackendFactory for advanced backend access
27 * 30 *
@@ -73,9 +76,10 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
73 76
74 /** Check whether settings are correct. 77 /** Check whether settings are correct.
75 * @return <i>true</i> if the given settings are correct and possible. 78 * @return <i>true</i> if the given settings are correct and possible.
76 */ 79 */
77 virtual bool hasQuerySettings (uint querySettings) const = 0; 80 virtual bool hasQuerySettings (uint querySettings) const = 0;
78 81
82 virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
79 83
80}; 84};
81#endif 85#endif
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
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * no default arguments in implementation 24 * no default arguments in implementation
22 * 25 *
23 * Revision 1.2 2002/11/10 15:41:53 eilers 26 * Revision 1.2 2002/11/10 15:41:53 eilers
24 * Bugfixes.. 27 * Bugfixes..
25 * 28 *
@@ -175,12 +178,19 @@ bool OContactAccessBackend_VCard::hasQuerySettings (uint ) const
175 178
176bool OContactAccessBackend_VCard::wasChangedExternally() 179bool OContactAccessBackend_VCard::wasChangedExternally()
177{ 180{
178 return false; // Don't expect concurrent access 181 return false; // Don't expect concurrent access
179} 182}
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 ***
182 192
183 193
184OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) 194OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
185{ 195{
186 OContact c; 196 OContact c;
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
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * Bugfixes.. 24 * Bugfixes..
22 * 25 *
23 * Revision 1.1 2002/11/09 14:34:52 eilers 26 * Revision 1.1 2002/11/09 14:34:52 eilers
24 * Added VCard Backend. 27 * Added VCard Backend.
25 * 28 *
@@ -50,12 +53,13 @@ class OContactAccessBackend_VCard : public OContactAccessBackend {
50 QArray<int> allRecords() const; 53 QArray<int> allRecords() const;
51 QArray<int> queryByExample ( const OContact &query, int settings ); 54 QArray<int> queryByExample ( const OContact &query, int settings );
52 QArray<int> matchRegexp( const QRegExp &r ) const; 55 QArray<int> matchRegexp( const QRegExp &r ) const;
53 56
54 const uint querySettings(); 57 const uint querySettings();
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();
57 61
58private: 62private:
59 OContact parseVObject( VObject* obj ); 63 OContact parseVObject( VObject* obj );
60 VObject* createVObject( const OContact& c ); 64 VObject* createVObject( const OContact& c );
61 QDate convVCardDateToDate( const QString& datestr ); 65 QDate convVCardDateToDate( const QString& datestr );
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
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * Added regExp-search in database for all fields in a contact. 24 * Added regExp-search in database for all fields in a contact.
22 * 25 *
23 * Revision 1.4 2002/10/16 10:52:40 eilers 26 * Revision 1.4 2002/10/16 10:52:40 eilers
24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 27 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
25 * 28 *
@@ -44,12 +47,13 @@
44#include <qasciidict.h> 47#include <qasciidict.h>
45#include <qdatetime.h> 48#include <qdatetime.h>
46#include <qfile.h> 49#include <qfile.h>
47#include <qfileinfo.h> 50#include <qfileinfo.h>
48#include <qregexp.h> 51#include <qregexp.h>
49#include <qarray.h> 52#include <qarray.h>
53#include <qmap.h>
50 54
51#include <qpe/global.h> 55#include <qpe/global.h>
52 56
53#include <opie/xmltree.h> 57#include <opie/xmltree.h>
54#include "ocontactaccessbackend.h" 58#include "ocontactaccessbackend.h"
55#include "ocontactaccess.h" 59#include "ocontactaccess.h"
@@ -298,12 +302,40 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
298 return ( true ); 302 return ( true );
299 default: 303 default:
300 return ( false ); 304 return ( false );
301 } 305 }
302 } 306 }
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 )
305 { 337 {
306 //qWarning("odefaultbackend: ACTION::ADD"); 338 //qWarning("odefaultbackend: ACTION::ADD");
307 updateJournal (newcontact, OContact::ACTION_ADD); 339 updateJournal (newcontact, OContact::ACTION_ADD);
308 addContact_p( newcontact ); 340 addContact_p( newcontact );
309 341
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend.h b/libopie2/opiepim/backend/ocontactaccessbackend.h
index c898f61..821f5bf 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend.h
@@ -16,12 +16,15 @@
16 * ToDo: Define enum for query settings 16 * ToDo: Define enum for query settings
17 * ===================================================================== 17 * =====================================================================
18 * Version: $Id$ 18 * Version: $Id$
19 * ===================================================================== 19 * =====================================================================
20 * History: 20 * History:
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
23 * Added regExp-search in database for all fields in a contact. 26 * Added regExp-search in database for all fields in a contact.
24 * 27 *
25 * Revision 1.2 2002/10/07 17:34:24 eilers 28 * Revision 1.2 2002/10/07 17:34:24 eilers
26 * added OBackendFactory for advanced backend access 29 * added OBackendFactory for advanced backend access
27 * 30 *
@@ -73,9 +76,10 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
73 76
74 /** Check whether settings are correct. 77 /** Check whether settings are correct.
75 * @return <i>true</i> if the given settings are correct and possible. 78 * @return <i>true</i> if the given settings are correct and possible.
76 */ 79 */
77 virtual bool hasQuerySettings (uint querySettings) const = 0; 80 virtual bool hasQuerySettings (uint querySettings) const = 0;
78 81
82 virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
79 83
80}; 84};
81#endif 85#endif
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index faa72b4..09ae37b 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * no default arguments in implementation 24 * no default arguments in implementation
22 * 25 *
23 * Revision 1.2 2002/11/10 15:41:53 eilers 26 * Revision 1.2 2002/11/10 15:41:53 eilers
24 * Bugfixes.. 27 * Bugfixes..
25 * 28 *
@@ -175,12 +178,19 @@ bool OContactAccessBackend_VCard::hasQuerySettings (uint ) const
175 178
176bool OContactAccessBackend_VCard::wasChangedExternally() 179bool OContactAccessBackend_VCard::wasChangedExternally()
177{ 180{
178 return false; // Don't expect concurrent access 181 return false; // Don't expect concurrent access
179} 182}
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 ***
182 192
183 193
184OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) 194OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
185{ 195{
186 OContact c; 196 OContact c;
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
index 177ec24..4437756 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * Bugfixes.. 24 * Bugfixes..
22 * 25 *
23 * Revision 1.1 2002/11/09 14:34:52 eilers 26 * Revision 1.1 2002/11/09 14:34:52 eilers
24 * Added VCard Backend. 27 * Added VCard Backend.
25 * 28 *
@@ -50,12 +53,13 @@ class OContactAccessBackend_VCard : public OContactAccessBackend {
50 QArray<int> allRecords() const; 53 QArray<int> allRecords() const;
51 QArray<int> queryByExample ( const OContact &query, int settings ); 54 QArray<int> queryByExample ( const OContact &query, int settings );
52 QArray<int> matchRegexp( const QRegExp &r ) const; 55 QArray<int> matchRegexp( const QRegExp &r ) const;
53 56
54 const uint querySettings(); 57 const uint querySettings();
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();
57 61
58private: 62private:
59 OContact parseVObject( VObject* obj ); 63 OContact parseVObject( VObject* obj );
60 VObject* createVObject( const OContact& c ); 64 VObject* createVObject( const OContact& c );
61 QDate convVCardDateToDate( const QString& datestr ); 65 QDate convVCardDateToDate( const QString& datestr );
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
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * Added regExp-search in database for all fields in a contact. 24 * Added regExp-search in database for all fields in a contact.
22 * 25 *
23 * Revision 1.4 2002/10/16 10:52:40 eilers 26 * Revision 1.4 2002/10/16 10:52:40 eilers
24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 27 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
25 * 28 *
@@ -44,12 +47,13 @@
44#include <qasciidict.h> 47#include <qasciidict.h>
45#include <qdatetime.h> 48#include <qdatetime.h>
46#include <qfile.h> 49#include <qfile.h>
47#include <qfileinfo.h> 50#include <qfileinfo.h>
48#include <qregexp.h> 51#include <qregexp.h>
49#include <qarray.h> 52#include <qarray.h>
53#include <qmap.h>
50 54
51#include <qpe/global.h> 55#include <qpe/global.h>
52 56
53#include <opie/xmltree.h> 57#include <opie/xmltree.h>
54#include "ocontactaccessbackend.h" 58#include "ocontactaccessbackend.h"
55#include "ocontactaccess.h" 59#include "ocontactaccess.h"
@@ -298,12 +302,40 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
298 return ( true ); 302 return ( true );
299 default: 303 default:
300 return ( false ); 304 return ( false );
301 } 305 }
302 } 306 }
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 )
305 { 337 {
306 //qWarning("odefaultbackend: ACTION::ADD"); 338 //qWarning("odefaultbackend: ACTION::ADD");
307 updateJournal (newcontact, OContact::ACTION_ADD); 339 updateJournal (newcontact, OContact::ACTION_ADD);
308 addContact_p( newcontact ); 340 addContact_p( newcontact );
309 341
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index f868b53..9c9338e 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -18,12 +18,15 @@
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
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
25 * Added regExp-search in database for all fields in a contact. 28 * Added regExp-search in database for all fields in a contact.
26 * 29 *
27 * Revision 1.5 2002/10/16 10:52:40 eilers 30 * Revision 1.5 2002/10/16 10:52:40 eilers
28 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 31 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
29 * 32 *
@@ -134,12 +137,17 @@ const uint OContactAccess::querySettings()
134} 137}
135 138
136bool OContactAccess::hasQuerySettings ( int querySettings ) const 139bool OContactAccess::hasQuerySettings ( int querySettings ) const
137{ 140{
138 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 141 return ( m_backEnd->hasQuerySettings ( querySettings ) );
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
141 149
142bool OContactAccess::wasChangedExternally()const 150bool OContactAccess::wasChangedExternally()const
143{ 151{
144 return ( m_backEnd->wasChangedExternally() ); 152 return ( m_backEnd->wasChangedExternally() );
145} 153}
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index b4921d5..961968f 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -14,12 +14,15 @@
14 * ToDo: Define enum for query settings 14 * ToDo: Define enum for query settings
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
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
21 * Added regExp-search in database for all fields in a contact. 24 * Added regExp-search in database for all fields in a contact.
22 * 25 *
23 * Revision 1.3 2002/10/16 10:52:40 eilers 26 * Revision 1.3 2002/10/16 10:52:40 eilers
24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 27 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
25 * 28 *
@@ -88,12 +91,20 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
88 MatchOne = 0x0010 // Only one Entry must match 91 MatchOne = 0x0010 // Only one Entry must match
89 }; 92 };
90 93
91 94
92 ORecordList<OContact> matchRegexp( const QRegExp &r )const; 95 ORecordList<OContact> matchRegexp( const QRegExp &r )const;
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.
95 * @return All settings provided by the current backend 106 * @return All settings provided by the current backend
96 * (i.e.: query_WildCards & query_IgnoreCase) 107 * (i.e.: query_WildCards & query_IgnoreCase)
97 */ 108 */
98 const uint querySettings(); 109 const uint querySettings();
99 110