summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.h4
-rw-r--r--libopie/pim/ocontactaccess.cpp8
-rw-r--r--libopie/pim/ocontactaccess.h8
-rw-r--r--libopie/pim/ocontactaccessbackend.h7
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h20
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend.h7
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h20
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp8
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h8
-rw-r--r--libopie2/opiepim/ocontact.h4
10 files changed, 86 insertions, 8 deletions
diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h
index 382ab94..038a59f 100644
--- a/libopie/pim/ocontact.h
+++ b/libopie/pim/ocontact.h
@@ -102,21 +102,17 @@ public:
102 void setAnniversary( const QDate &v ); 102 void setAnniversary( const QDate &v );
103 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } 103 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
104 void setChildren( const QString &v ); 104 void setChildren( const QString &v );
105 105
106 // other 106 // other
107 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 107 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
108 108
109 bool match( const QString &regexp ) const; 109 bool match( const QString &regexp ) const;
110
111// DON'T ATTEMPT TO USE THIS
112#ifdef QTOPIA_INTERNAL_CONTACT_MRE
113 bool match( const QRegExp &regexp ) const; 110 bool match( const QRegExp &regexp ) const;
114#endif
115 111
116// // custom 112// // custom
117// void setCustomField( const QString &key, const QString &v ) 113// void setCustomField( const QString &key, const QString &v )
118// { replace(Custom- + key, v ); } 114// { replace(Custom- + key, v ); }
119 115
120 // name 116 // name
121 QString fullName() const; 117 QString fullName() const;
122 QString title() const { return find( Qtopia::Title ); } 118 QString title() const { return find( Qtopia::Title ); }
diff --git a/libopie/pim/ocontactaccess.cpp b/libopie/pim/ocontactaccess.cpp
index 2ca0283..f868b53 100644
--- a/libopie/pim/ocontactaccess.cpp
+++ b/libopie/pim/ocontactaccess.cpp
@@ -16,16 +16,19 @@
16 * ToDo: XML-Backend: Automatic reload if something was changed... 16 * ToDo: XML-Backend: Automatic reload if something was changed...
17 * 17 *
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.6 2002/11/01 15:10:42 eilers
25 * Added regExp-search in database for all fields in a contact.
26 *
24 * Revision 1.5 2002/10/16 10:52:40 eilers 27 * Revision 1.5 2002/10/16 10:52:40 eilers
25 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 28 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
26 * 29 *
27 * Revision 1.4 2002/10/14 16:21:54 eilers 30 * Revision 1.4 2002/10/14 16:21:54 eilers
28 * Some minor interface updates 31 * Some minor interface updates
29 * 32 *
30 * Revision 1.3 2002/10/07 17:34:24 eilers 33 * Revision 1.3 2002/10/07 17:34:24 eilers
31 * added OBackendFactory for advanced backend access 34 * added OBackendFactory for advanced backend access
@@ -115,16 +118,21 @@ bool OContactAccess::save ()
115 118
116 /* Now tell everyone that new data is available. 119 /* Now tell everyone that new data is available.
117 */ 120 */
118 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 121 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
119 122
120 return true; 123 return true;
121} 124}
122 125
126ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{
127 QArray<int> matchingContacts = m_backEnd -> matchRegexp( r );
128 return ( ORecordList<OContact>(matchingContacts, this) );
129}
130
123const uint OContactAccess::querySettings() 131const uint OContactAccess::querySettings()
124{ 132{
125 return ( m_backEnd->querySettings() ); 133 return ( m_backEnd->querySettings() );
126} 134}
127 135
128bool OContactAccess::hasQuerySettings ( int querySettings ) const 136bool OContactAccess::hasQuerySettings ( int querySettings ) const
129{ 137{
130 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 138 return ( m_backEnd->hasQuerySettings ( querySettings ) );
diff --git a/libopie/pim/ocontactaccess.h b/libopie/pim/ocontactaccess.h
index da9c942..b4921d5 100644
--- a/libopie/pim/ocontactaccess.h
+++ b/libopie/pim/ocontactaccess.h
@@ -12,16 +12,19 @@
12 * version. 12 * version.
13 * ===================================================================== 13 * =====================================================================
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.4 2002/11/01 15:10:42 eilers
21 * Added regExp-search in database for all fields in a contact.
22 *
20 * Revision 1.3 2002/10/16 10:52:40 eilers 23 * Revision 1.3 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 * 25 *
23 * Revision 1.2 2002/10/14 16:21:54 eilers 26 * Revision 1.2 2002/10/14 16:21:54 eilers
24 * Some minor interface updates 27 * Some minor interface updates
25 * 28 *
26 * Revision 1.1 2002/09/27 17:11:44 eilers 29 * Revision 1.1 2002/09/27 17:11:44 eilers
27 * Added API for accessing the Contact-Database ! It is compiling, but 30 * Added API for accessing the Contact-Database ! It is compiling, but
@@ -43,16 +46,17 @@
43 46
44#include "ocontact.h" 47#include "ocontact.h"
45#include "ocontactaccessbackend.h" 48#include "ocontactaccessbackend.h"
46#include "opimaccesstemplate.h" 49#include "opimaccesstemplate.h"
47 50
48/** Class to access the contacts database. 51/** Class to access the contacts database.
49 * This is just a frontend for the real database handling which is 52 * This is just a frontend for the real database handling which is
50 * done by the backend. 53 * done by the backend.
54 * @see OPimAccessTemplate
51 */ 55 */
52class OContactAccess: public QObject, public OPimAccessTemplate<OContact> 56class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
53{ 57{
54 Q_OBJECT 58 Q_OBJECT
55 59
56 public: 60 public:
57 /** Create Database with contacts (addressbook). 61 /** Create Database with contacts (addressbook).
58 * @param appname Name of application which wants access to the database 62 * @param appname Name of application which wants access to the database
@@ -76,18 +80,22 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
76 * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes ! 80 * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes !
77 * @see queryByExample() 81 * @see queryByExample()
78 */ 82 */
79 enum QuerySettings { 83 enum QuerySettings {
80 WildCards = 0x0001, 84 WildCards = 0x0001,
81 IgnoreCase = 0x0002, 85 IgnoreCase = 0x0002,
82 RegExp = 0x0004, 86 RegExp = 0x0004,
83 ExactMatch = 0x0008, 87 ExactMatch = 0x0008,
88 MatchOne = 0x0010 // Only one Entry must match
84 }; 89 };
85 90
91
92 ORecordList<OContact> matchRegexp( const QRegExp &r )const;
93
86 /** Return all possible settings. 94 /** Return all possible settings.
87 * @return All settings provided by the current backend 95 * @return All settings provided by the current backend
88 * (i.e.: query_WildCards & query_IgnoreCase) 96 * (i.e.: query_WildCards & query_IgnoreCase)
89 */ 97 */
90 const uint querySettings(); 98 const uint querySettings();
91 99
92 /** Check whether settings are correct. 100 /** Check whether settings are correct.
93 * @return <i>true</i> if the given settings are correct and possible. 101 * @return <i>true</i> if the given settings are correct and possible.
diff --git a/libopie/pim/ocontactaccessbackend.h b/libopie/pim/ocontactaccessbackend.h
index a651477..c898f61 100644
--- a/libopie/pim/ocontactaccessbackend.h
+++ b/libopie/pim/ocontactaccessbackend.h
@@ -14,16 +14,19 @@
14 * version. 14 * version.
15 * ===================================================================== 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.3 2002/11/01 15:10:42 eilers
23 * Added regExp-search in database for all fields in a contact.
24 *
22 * Revision 1.2 2002/10/07 17:34:24 eilers 25 * Revision 1.2 2002/10/07 17:34:24 eilers
23 * added OBackendFactory for advanced backend access 26 * added OBackendFactory for advanced backend access
24 * 27 *
25 * Revision 1.1 2002/09/27 17:11:44 eilers 28 * Revision 1.1 2002/09/27 17:11:44 eilers
26 * Added API for accessing the Contact-Database ! It is compiling, but 29 * Added API for accessing the Contact-Database ! It is compiling, but
27 * please do not expect that anything is working ! 30 * please do not expect that anything is working !
28 * I will debug that stuff in the next time .. 31 * I will debug that stuff in the next time ..
29 * Please read README_COMPILE for compiling ! 32 * Please read README_COMPILE for compiling !
@@ -33,16 +36,18 @@
33 */ 36 */
34 37
35#ifndef _OCONTACTACCESSBACKEND_H_ 38#ifndef _OCONTACTACCESSBACKEND_H_
36#define _OCONTACTACCESSBACKEND_H_ 39#define _OCONTACTACCESSBACKEND_H_
37 40
38#include "ocontact.h" 41#include "ocontact.h"
39#include "opimaccessbackend.h" 42#include "opimaccessbackend.h"
40 43
44#include "qregexp.h"
45
41class OContactAccessBackend: public OPimAccessBackend<OContact> { 46class OContactAccessBackend: public OPimAccessBackend<OContact> {
42 public: 47 public:
43 OContactAccessBackend() {} 48 OContactAccessBackend() {}
44 virtual ~OContactAccessBackend() {} 49 virtual ~OContactAccessBackend() {}
45 50
46 51
47 /** Return if database was changed externally. 52 /** Return if database was changed externally.
48 * This may just make sense on file based databases like a XML-File. 53 * This may just make sense on file based databases like a XML-File.
@@ -53,16 +58,18 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
53 * management system themselve, therefore this function should always return false in 58 * management system themselve, therefore this function should always return false in
54 * this case. It is not our problem to handle this conflict ... 59 * this case. It is not our problem to handle this conflict ...
55 * @return <i>true</i> if the database was changed and if save without reload will 60 * @return <i>true</i> if the database was changed and if save without reload will
56 * be dangerous. <i>false</i> if the database was not changed or it is save to write 61 * be dangerous. <i>false</i> if the database was not changed or it is save to write
57 * in this situation. 62 * in this situation.
58 */ 63 */
59 virtual bool wasChangedExternally() = 0; 64 virtual bool wasChangedExternally() = 0;
60 65
66 virtual QArray<int> matchRegexp( const QRegExp &r ) const = 0;
67
61 /** Return all possible settings. 68 /** Return all possible settings.
62 * @return All settings provided by the current backend 69 * @return All settings provided by the current backend
63 * (i.e.: query_WildCards & query_IgnoreCase) 70 * (i.e.: query_WildCards & query_IgnoreCase)
64 */ 71 */
65 virtual const uint querySettings() = 0; 72 virtual const uint querySettings() = 0;
66 73
67 /** Check whether settings are correct. 74 /** Check whether settings are correct.
68 * @return <i>true</i> if the given settings are correct and possible. 75 * @return <i>true</i> if the given settings are correct and possible.
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index 12a75ba..f7e8207 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/libopie/pim/ocontactaccessbackend_xml.h
@@ -12,16 +12,19 @@
12 * ToDo: XML-Backend: Automatic reload if something was changed... 12 * ToDo: XML-Backend: Automatic reload if something was changed...
13 * 13 *
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.5 2002/11/01 15:10:42 eilers
21 * Added regExp-search in database for all fields in a contact.
22 *
20 * Revision 1.4 2002/10/16 10:52:40 eilers 23 * Revision 1.4 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 * 25 *
23 * Revision 1.3 2002/10/14 16:21:54 eilers 26 * Revision 1.3 2002/10/14 16:21:54 eilers
24 * Some minor interface updates 27 * Some minor interface updates
25 * 28 *
26 * Revision 1.2 2002/10/07 17:34:24 eilers 29 * Revision 1.2 2002/10/07 17:34:24 eilers
27 * added OBackendFactory for advanced backend access 30 * added OBackendFactory for advanced backend access
@@ -249,16 +252,33 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
249 } 252 }
250 } 253 }
251 254
252 // Shrink to fit.. 255 // Shrink to fit..
253 m_currentQuery.resize(arraycounter); 256 m_currentQuery.resize(arraycounter);
254 257
255 return m_currentQuery; 258 return m_currentQuery;
256 } 259 }
260
261 QArray<int> matchRegexp( const QRegExp &r ) const{
262 QArray<int> m_currentQuery( m_contactList.count() );
263 QValueListConstIterator<OContact> it;
264 uint arraycounter = 0;
265
266 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){
267 if ( (*it).match( r ) ){
268 m_currentQuery[arraycounter++] = (*it).uid();
269 }
270
271 }
272 // Shrink to fit..
273 m_currentQuery.resize(arraycounter);
274
275 return m_currentQuery;
276 }
257 277
258 const uint querySettings() 278 const uint querySettings()
259 { 279 {
260 return ( OContactAccess::WildCards 280 return ( OContactAccess::WildCards
261 & OContactAccess::IgnoreCase 281 & OContactAccess::IgnoreCase
262 & OContactAccess::RegExp 282 & OContactAccess::RegExp
263 & OContactAccess::ExactMatch ); 283 & OContactAccess::ExactMatch );
264 } 284 }
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend.h b/libopie2/opiepim/backend/ocontactaccessbackend.h
index a651477..c898f61 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend.h
@@ -14,16 +14,19 @@
14 * version. 14 * version.
15 * ===================================================================== 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.3 2002/11/01 15:10:42 eilers
23 * Added regExp-search in database for all fields in a contact.
24 *
22 * Revision 1.2 2002/10/07 17:34:24 eilers 25 * Revision 1.2 2002/10/07 17:34:24 eilers
23 * added OBackendFactory for advanced backend access 26 * added OBackendFactory for advanced backend access
24 * 27 *
25 * Revision 1.1 2002/09/27 17:11:44 eilers 28 * Revision 1.1 2002/09/27 17:11:44 eilers
26 * Added API for accessing the Contact-Database ! It is compiling, but 29 * Added API for accessing the Contact-Database ! It is compiling, but
27 * please do not expect that anything is working ! 30 * please do not expect that anything is working !
28 * I will debug that stuff in the next time .. 31 * I will debug that stuff in the next time ..
29 * Please read README_COMPILE for compiling ! 32 * Please read README_COMPILE for compiling !
@@ -33,16 +36,18 @@
33 */ 36 */
34 37
35#ifndef _OCONTACTACCESSBACKEND_H_ 38#ifndef _OCONTACTACCESSBACKEND_H_
36#define _OCONTACTACCESSBACKEND_H_ 39#define _OCONTACTACCESSBACKEND_H_
37 40
38#include "ocontact.h" 41#include "ocontact.h"
39#include "opimaccessbackend.h" 42#include "opimaccessbackend.h"
40 43
44#include "qregexp.h"
45
41class OContactAccessBackend: public OPimAccessBackend<OContact> { 46class OContactAccessBackend: public OPimAccessBackend<OContact> {
42 public: 47 public:
43 OContactAccessBackend() {} 48 OContactAccessBackend() {}
44 virtual ~OContactAccessBackend() {} 49 virtual ~OContactAccessBackend() {}
45 50
46 51
47 /** Return if database was changed externally. 52 /** Return if database was changed externally.
48 * This may just make sense on file based databases like a XML-File. 53 * This may just make sense on file based databases like a XML-File.
@@ -53,16 +58,18 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
53 * management system themselve, therefore this function should always return false in 58 * management system themselve, therefore this function should always return false in
54 * this case. It is not our problem to handle this conflict ... 59 * this case. It is not our problem to handle this conflict ...
55 * @return <i>true</i> if the database was changed and if save without reload will 60 * @return <i>true</i> if the database was changed and if save without reload will
56 * be dangerous. <i>false</i> if the database was not changed or it is save to write 61 * be dangerous. <i>false</i> if the database was not changed or it is save to write
57 * in this situation. 62 * in this situation.
58 */ 63 */
59 virtual bool wasChangedExternally() = 0; 64 virtual bool wasChangedExternally() = 0;
60 65
66 virtual QArray<int> matchRegexp( const QRegExp &r ) const = 0;
67
61 /** Return all possible settings. 68 /** Return all possible settings.
62 * @return All settings provided by the current backend 69 * @return All settings provided by the current backend
63 * (i.e.: query_WildCards & query_IgnoreCase) 70 * (i.e.: query_WildCards & query_IgnoreCase)
64 */ 71 */
65 virtual const uint querySettings() = 0; 72 virtual const uint querySettings() = 0;
66 73
67 /** Check whether settings are correct. 74 /** Check whether settings are correct.
68 * @return <i>true</i> if the given settings are correct and possible. 75 * @return <i>true</i> if the given settings are correct and possible.
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index 12a75ba..f7e8207 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -12,16 +12,19 @@
12 * ToDo: XML-Backend: Automatic reload if something was changed... 12 * ToDo: XML-Backend: Automatic reload if something was changed...
13 * 13 *
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.5 2002/11/01 15:10:42 eilers
21 * Added regExp-search in database for all fields in a contact.
22 *
20 * Revision 1.4 2002/10/16 10:52:40 eilers 23 * Revision 1.4 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 * 25 *
23 * Revision 1.3 2002/10/14 16:21:54 eilers 26 * Revision 1.3 2002/10/14 16:21:54 eilers
24 * Some minor interface updates 27 * Some minor interface updates
25 * 28 *
26 * Revision 1.2 2002/10/07 17:34:24 eilers 29 * Revision 1.2 2002/10/07 17:34:24 eilers
27 * added OBackendFactory for advanced backend access 30 * added OBackendFactory for advanced backend access
@@ -249,16 +252,33 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
249 } 252 }
250 } 253 }
251 254
252 // Shrink to fit.. 255 // Shrink to fit..
253 m_currentQuery.resize(arraycounter); 256 m_currentQuery.resize(arraycounter);
254 257
255 return m_currentQuery; 258 return m_currentQuery;
256 } 259 }
260
261 QArray<int> matchRegexp( const QRegExp &r ) const{
262 QArray<int> m_currentQuery( m_contactList.count() );
263 QValueListConstIterator<OContact> it;
264 uint arraycounter = 0;
265
266 for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){
267 if ( (*it).match( r ) ){
268 m_currentQuery[arraycounter++] = (*it).uid();
269 }
270
271 }
272 // Shrink to fit..
273 m_currentQuery.resize(arraycounter);
274
275 return m_currentQuery;
276 }
257 277
258 const uint querySettings() 278 const uint querySettings()
259 { 279 {
260 return ( OContactAccess::WildCards 280 return ( OContactAccess::WildCards
261 & OContactAccess::IgnoreCase 281 & OContactAccess::IgnoreCase
262 & OContactAccess::RegExp 282 & OContactAccess::RegExp
263 & OContactAccess::ExactMatch ); 283 & OContactAccess::ExactMatch );
264 } 284 }
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 2ca0283..f868b53 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -16,16 +16,19 @@
16 * ToDo: XML-Backend: Automatic reload if something was changed... 16 * ToDo: XML-Backend: Automatic reload if something was changed...
17 * 17 *
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.6 2002/11/01 15:10:42 eilers
25 * Added regExp-search in database for all fields in a contact.
26 *
24 * Revision 1.5 2002/10/16 10:52:40 eilers 27 * Revision 1.5 2002/10/16 10:52:40 eilers
25 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 28 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
26 * 29 *
27 * Revision 1.4 2002/10/14 16:21:54 eilers 30 * Revision 1.4 2002/10/14 16:21:54 eilers
28 * Some minor interface updates 31 * Some minor interface updates
29 * 32 *
30 * Revision 1.3 2002/10/07 17:34:24 eilers 33 * Revision 1.3 2002/10/07 17:34:24 eilers
31 * added OBackendFactory for advanced backend access 34 * added OBackendFactory for advanced backend access
@@ -115,16 +118,21 @@ bool OContactAccess::save ()
115 118
116 /* Now tell everyone that new data is available. 119 /* Now tell everyone that new data is available.
117 */ 120 */
118 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 121 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
119 122
120 return true; 123 return true;
121} 124}
122 125
126ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{
127 QArray<int> matchingContacts = m_backEnd -> matchRegexp( r );
128 return ( ORecordList<OContact>(matchingContacts, this) );
129}
130
123const uint OContactAccess::querySettings() 131const uint OContactAccess::querySettings()
124{ 132{
125 return ( m_backEnd->querySettings() ); 133 return ( m_backEnd->querySettings() );
126} 134}
127 135
128bool OContactAccess::hasQuerySettings ( int querySettings ) const 136bool OContactAccess::hasQuerySettings ( int querySettings ) const
129{ 137{
130 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 138 return ( m_backEnd->hasQuerySettings ( querySettings ) );
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index da9c942..b4921d5 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -12,16 +12,19 @@
12 * version. 12 * version.
13 * ===================================================================== 13 * =====================================================================
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.4 2002/11/01 15:10:42 eilers
21 * Added regExp-search in database for all fields in a contact.
22 *
20 * Revision 1.3 2002/10/16 10:52:40 eilers 23 * Revision 1.3 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 24 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 * 25 *
23 * Revision 1.2 2002/10/14 16:21:54 eilers 26 * Revision 1.2 2002/10/14 16:21:54 eilers
24 * Some minor interface updates 27 * Some minor interface updates
25 * 28 *
26 * Revision 1.1 2002/09/27 17:11:44 eilers 29 * Revision 1.1 2002/09/27 17:11:44 eilers
27 * Added API for accessing the Contact-Database ! It is compiling, but 30 * Added API for accessing the Contact-Database ! It is compiling, but
@@ -43,16 +46,17 @@
43 46
44#include "ocontact.h" 47#include "ocontact.h"
45#include "ocontactaccessbackend.h" 48#include "ocontactaccessbackend.h"
46#include "opimaccesstemplate.h" 49#include "opimaccesstemplate.h"
47 50
48/** Class to access the contacts database. 51/** Class to access the contacts database.
49 * This is just a frontend for the real database handling which is 52 * This is just a frontend for the real database handling which is
50 * done by the backend. 53 * done by the backend.
54 * @see OPimAccessTemplate
51 */ 55 */
52class OContactAccess: public QObject, public OPimAccessTemplate<OContact> 56class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
53{ 57{
54 Q_OBJECT 58 Q_OBJECT
55 59
56 public: 60 public:
57 /** Create Database with contacts (addressbook). 61 /** Create Database with contacts (addressbook).
58 * @param appname Name of application which wants access to the database 62 * @param appname Name of application which wants access to the database
@@ -76,18 +80,22 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
76 * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes ! 80 * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes !
77 * @see queryByExample() 81 * @see queryByExample()
78 */ 82 */
79 enum QuerySettings { 83 enum QuerySettings {
80 WildCards = 0x0001, 84 WildCards = 0x0001,
81 IgnoreCase = 0x0002, 85 IgnoreCase = 0x0002,
82 RegExp = 0x0004, 86 RegExp = 0x0004,
83 ExactMatch = 0x0008, 87 ExactMatch = 0x0008,
88 MatchOne = 0x0010 // Only one Entry must match
84 }; 89 };
85 90
91
92 ORecordList<OContact> matchRegexp( const QRegExp &r )const;
93
86 /** Return all possible settings. 94 /** Return all possible settings.
87 * @return All settings provided by the current backend 95 * @return All settings provided by the current backend
88 * (i.e.: query_WildCards & query_IgnoreCase) 96 * (i.e.: query_WildCards & query_IgnoreCase)
89 */ 97 */
90 const uint querySettings(); 98 const uint querySettings();
91 99
92 /** Check whether settings are correct. 100 /** Check whether settings are correct.
93 * @return <i>true</i> if the given settings are correct and possible. 101 * @return <i>true</i> if the given settings are correct and possible.
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index 382ab94..038a59f 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -102,21 +102,17 @@ public:
102 void setAnniversary( const QDate &v ); 102 void setAnniversary( const QDate &v );
103 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } 103 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
104 void setChildren( const QString &v ); 104 void setChildren( const QString &v );
105 105
106 // other 106 // other
107 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 107 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
108 108
109 bool match( const QString &regexp ) const; 109 bool match( const QString &regexp ) const;
110
111// DON'T ATTEMPT TO USE THIS
112#ifdef QTOPIA_INTERNAL_CONTACT_MRE
113 bool match( const QRegExp &regexp ) const; 110 bool match( const QRegExp &regexp ) const;
114#endif
115 111
116// // custom 112// // custom
117// void setCustomField( const QString &key, const QString &v ) 113// void setCustomField( const QString &key, const QString &v )
118// { replace(Custom- + key, v ); } 114// { replace(Custom- + key, v ); }
119 115
120 // name 116 // name
121 QString fullName() const; 117 QString fullName() const;
122 QString title() const { return find( Qtopia::Title ); } 118 QString title() const { return find( Qtopia::Title ); }