-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend.h | 7 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_xml.h | 20 | ||||
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.h | 8 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.h | 4 |
5 files changed, 43 insertions, 4 deletions
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 | |||
@@ -20,4 +20,7 @@ | |||
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 |
@@ -39,4 +42,6 @@ | |||
39 | #include "opimaccessbackend.h" | 42 | #include "opimaccessbackend.h" |
40 | 43 | ||
44 | #include "qregexp.h" | ||
45 | |||
41 | class OContactAccessBackend: public OPimAccessBackend<OContact> { | 46 | class OContactAccessBackend: public OPimAccessBackend<OContact> { |
42 | public: | 47 | public: |
@@ -59,4 +64,6 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> { | |||
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 |
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 | |||
@@ -18,4 +18,7 @@ | |||
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.. :) |
@@ -255,4 +258,21 @@ class OContactAccessBackend_XML : public OContactAccessBackend { | |||
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() |
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 | |||
@@ -22,4 +22,7 @@ | |||
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.. :) |
@@ -121,4 +124,9 @@ bool OContactAccess::save () | |||
121 | } | 124 | } |
122 | 125 | ||
126 | ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{ | ||
127 | QArray<int> matchingContacts = m_backEnd -> matchRegexp( r ); | ||
128 | return ( ORecordList<OContact>(matchingContacts, this) ); | ||
129 | } | ||
130 | |||
123 | const uint OContactAccess::querySettings() | 131 | const uint OContactAccess::querySettings() |
124 | { | 132 | { |
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 | |||
@@ -18,4 +18,7 @@ | |||
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.. :) |
@@ -49,4 +52,5 @@ | |||
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 | */ |
52 | class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | 56 | class OContactAccess: public QObject, public OPimAccessTemplate<OContact> |
@@ -82,6 +86,10 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | |||
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 |
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 | |||
@@ -108,9 +108,5 @@ public: | |||
108 | 108 | ||
109 | bool match( const QString ®exp ) const; | 109 | bool match( const QString ®exp ) const; |
110 | |||
111 | // DON'T ATTEMPT TO USE THIS | ||
112 | #ifdef QTOPIA_INTERNAL_CONTACT_MRE | ||
113 | bool match( const QRegExp ®exp ) const; | 110 | bool match( const QRegExp ®exp ) const; |
114 | #endif | ||
115 | 111 | ||
116 | // // custom | 112 | // // custom |