Diffstat (limited to 'libopie/pim/opimaccesstemplate.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/opimaccesstemplate.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h index 6a3a0db..8ff205c 100644 --- a/libopie/pim/opimaccesstemplate.h +++ b/libopie/pim/opimaccesstemplate.h | |||
@@ -48,48 +48,54 @@ public: | |||
48 | * was changed. | 48 | * was changed. |
49 | * This function will load the external database and afterwards | 49 | * This function will load the external database and afterwards |
50 | * rejoin the local changes. Therefore the local database will be set consistent. | 50 | * rejoin the local changes. Therefore the local database will be set consistent. |
51 | */ | 51 | */ |
52 | virtual bool reload(); | 52 | virtual bool reload(); |
53 | 53 | ||
54 | /** Save contacts database. | 54 | /** Save contacts database. |
55 | * Save is more a "commit". After calling this function, all changes are public available. | 55 | * Save is more a "commit". After calling this function, all changes are public available. |
56 | * @return true if successful | 56 | * @return true if successful |
57 | */ | 57 | */ |
58 | bool save(); | 58 | bool save(); |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * if the resource was changed externally | 61 | * if the resource was changed externally |
62 | * You should use the signal handling instead of polling possible changes ! | 62 | * You should use the signal handling instead of polling possible changes ! |
63 | * zecke: Do you implement a signal for otodoaccess ? | 63 | * zecke: Do you implement a signal for otodoaccess ? |
64 | */ | 64 | */ |
65 | bool wasChangedExternally()const; | 65 | bool wasChangedExternally()const; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * return a List of records | 68 | * return a List of records |
69 | * you can iterate over them | 69 | * you can iterate over them |
70 | */ | 70 | */ |
71 | virtual List allRecords()const; | 71 | virtual List allRecords()const; |
72 | |||
73 | /** | ||
74 | * return a List of records | ||
75 | * that match the regex | ||
76 | */ | ||
77 | virtual List matchRegexp( const QRegExp &r ) const; | ||
72 | 78 | ||
73 | /** | 79 | /** |
74 | * queryByExample. | 80 | * queryByExample. |
75 | * @see otodoaccess, ocontactaccess | 81 | * @see otodoaccess, ocontactaccess |
76 | */ | 82 | */ |
77 | virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); | 83 | virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); |
78 | 84 | ||
79 | /** | 85 | /** |
80 | * find the OPimRecord uid | 86 | * find the OPimRecord uid |
81 | */ | 87 | */ |
82 | virtual T find( int uid )const; | 88 | virtual T find( int uid )const; |
83 | 89 | ||
84 | /** | 90 | /** |
85 | * read ahead cache find method ;) | 91 | * read ahead cache find method ;) |
86 | */ | 92 | */ |
87 | virtual T find( int uid, const QArray<int>&, | 93 | virtual T find( int uid, const QArray<int>&, |
88 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; | 94 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; |
89 | 95 | ||
90 | /* invalidate cache here */ | 96 | /* invalidate cache here */ |
91 | /** | 97 | /** |
92 | * clears the backend and invalidates the backend | 98 | * clears the backend and invalidates the backend |
93 | */ | 99 | */ |
94 | void clear() ; | 100 | void clear() ; |
95 | 101 | ||
@@ -160,48 +166,54 @@ OPimAccessTemplate<T>::~OPimAccessTemplate() { | |||
160 | qWarning("~OPimAccessTemplate<T>"); | 166 | qWarning("~OPimAccessTemplate<T>"); |
161 | delete m_backEnd; | 167 | delete m_backEnd; |
162 | } | 168 | } |
163 | template <class T> | 169 | template <class T> |
164 | bool OPimAccessTemplate<T>::load() { | 170 | bool OPimAccessTemplate<T>::load() { |
165 | invalidateCache(); | 171 | invalidateCache(); |
166 | return m_backEnd->load(); | 172 | return m_backEnd->load(); |
167 | } | 173 | } |
168 | template <class T> | 174 | template <class T> |
169 | bool OPimAccessTemplate<T>::reload() { | 175 | bool OPimAccessTemplate<T>::reload() { |
170 | invalidateCache(); // zecke: I think this should be added (se) | 176 | invalidateCache(); // zecke: I think this should be added (se) |
171 | return m_backEnd->reload(); | 177 | return m_backEnd->reload(); |
172 | } | 178 | } |
173 | template <class T> | 179 | template <class T> |
174 | bool OPimAccessTemplate<T>::save() { | 180 | bool OPimAccessTemplate<T>::save() { |
175 | return m_backEnd->save(); | 181 | return m_backEnd->save(); |
176 | } | 182 | } |
177 | template <class T> | 183 | template <class T> |
178 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { | 184 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { |
179 | QArray<int> ints = m_backEnd->allRecords(); | 185 | QArray<int> ints = m_backEnd->allRecords(); |
180 | List lis(ints, this ); | 186 | List lis(ints, this ); |
181 | return lis; | 187 | return lis; |
182 | } | 188 | } |
183 | template <class T> | 189 | template <class T> |
190 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { | ||
191 | QArray<int> ints = m_backEnd->matchRegexp( r ); | ||
192 | List lis(ints, this ); | ||
193 | return lis; | ||
194 | } | ||
195 | template <class T> | ||
184 | QArray<int> OPimAccessTemplate<T>::records()const { | 196 | QArray<int> OPimAccessTemplate<T>::records()const { |
185 | return m_backEnd->allRecords(); | 197 | return m_backEnd->allRecords(); |
186 | } | 198 | } |
187 | template <class T> | 199 | template <class T> |
188 | typename OPimAccessTemplate<T>::List | 200 | typename OPimAccessTemplate<T>::List |
189 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { | 201 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { |
190 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); | 202 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); |
191 | 203 | ||
192 | List lis(ints, this ); | 204 | List lis(ints, this ); |
193 | return lis; | 205 | return lis; |
194 | } | 206 | } |
195 | template <class T> | 207 | template <class T> |
196 | T OPimAccessTemplate<T>::find( int uid ) const{ | 208 | T OPimAccessTemplate<T>::find( int uid ) const{ |
197 | T t = m_backEnd->find( uid ); | 209 | T t = m_backEnd->find( uid ); |
198 | cache( t ); | 210 | cache( t ); |
199 | return t; | 211 | return t; |
200 | } | 212 | } |
201 | template <class T> | 213 | template <class T> |
202 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, | 214 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, |
203 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { | 215 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { |
204 | /* | 216 | /* |
205 | * better do T.isEmpty() | 217 | * better do T.isEmpty() |
206 | * after a find this way we would | 218 | * after a find this way we would |
207 | * avoid two finds in QCache... | 219 | * avoid two finds in QCache... |