author | eilers <eilers> | 2004-12-28 12:14:44 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-12-28 12:14:44 (UTC) |
commit | 4f0a67218237c83bdd02d339835f62ad064dc248 (patch) (unidiff) | |
tree | 26680f7a55cb0b09f158e1bf18b4bad4117e0db0 | |
parent | 97a3d431ba9e33a3e256955755b23a55a9a9ea05 (diff) | |
download | opie-4f0a67218237c83bdd02d339835f62ad064dc248.zip opie-4f0a67218237c83bdd02d339835f62ad064dc248.tar.gz opie-4f0a67218237c83bdd02d339835f62ad064dc248.tar.bz2 |
* Make improved query by example accessable via frontend
* Some API improvement
-rw-r--r-- | libopie2/opiepim/ChangeLog | 3 | ||||
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 76 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimtemplatebase.h | 2 |
4 files changed, 74 insertions, 9 deletions
diff --git a/libopie2/opiepim/ChangeLog b/libopie2/opiepim/ChangeLog index dd57259..564e92a 100644 --- a/libopie2/opiepim/ChangeLog +++ b/libopie2/opiepim/ChangeLog | |||
@@ -1,18 +1,21 @@ | |||
1 | 2004-12-28 Stefan Eilers <stefan@eilers-online.net> | ||
2 | * Make improved query by example accessable via frontend | ||
3 | * Some API improvement | ||
1 | 2004-11-23 Stefan Eilers <stefan@eilers-online.net> | 4 | 2004-11-23 Stefan Eilers <stefan@eilers-online.net> |
2 | * Implement fast and full featured version of sorted() for addressbook | 5 | * Implement fast and full featured version of sorted() for addressbook |
3 | * Implement generic queryByExample for all Addressboook backends. It allows incremental search. | 6 | * Implement generic queryByExample for all Addressboook backends. It allows incremental search. |
4 | * Update of API Documentation | 7 | * Update of API Documentation |
5 | 2004-11-18 Holger Freyther <freyther@handhelds.org> | 8 | 2004-11-18 Holger Freyther <freyther@handhelds.org> |
6 | * Every Access can give a set of Occurrences for a period or a datetime | 9 | * Every Access can give a set of Occurrences for a period or a datetime |
7 | * QueryByExample, Find, Sort can be generically accessed by OPimBase | 10 | * QueryByExample, Find, Sort can be generically accessed by OPimBase |
8 | pointer interface | 11 | pointer interface |
9 | * OPimBackendOccurrence gets split up to OPimOccurrences by | 12 | * OPimBackendOccurrence gets split up to OPimOccurrences by |
10 | OPimTemplateBase | 13 | OPimTemplateBase |
11 | * Add safeCast to various OPimRecords | 14 | * Add safeCast to various OPimRecords |
12 | * Kill memleak in OPimTodo | 15 | * Kill memleak in OPimTodo |
13 | * Add SortVector implementations for OPimTodo and OPimContact | 16 | * Add SortVector implementations for OPimTodo and OPimContact |
14 | 17 | ||
15 | 2004-??-??The Opie Team <opie@handhelds.org> | 18 | 2004-??-??The Opie Team <opie@handhelds.org> |
16 | * Implemented some important modifications to allow to use OPimRecords as it is, without | 19 | * Implemented some important modifications to allow to use OPimRecords as it is, without |
17 | have to cast them. This makes it possible to write applications which handling pim | 20 | have to cast them. This makes it possible to write applications which handling pim |
18 | data in a generic manner (see opimconvertion tool) (eilers) \ No newline at end of file | 21 | data in a generic manner (see opimconvertion tool) (eilers) \ No newline at end of file |
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h index bd85b4e..5051321 100644 --- a/libopie2/opiepim/core/ocontactaccess.h +++ b/libopie2/opiepim/core/ocontactaccess.h | |||
@@ -91,65 +91,65 @@ class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact> | |||
91 | SortSuffix, | 91 | SortSuffix, |
92 | SortEmail, | 92 | SortEmail, |
93 | SortNickname, | 93 | SortNickname, |
94 | SortFileAsName, | 94 | SortFileAsName, |
95 | SortAnniversary, | 95 | SortAnniversary, |
96 | SortBirthday, | 96 | SortBirthday, |
97 | SortGender | 97 | SortGender |
98 | }; | 98 | }; |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Create Database with contacts (addressbook). | 101 | * Create Database with contacts (addressbook). |
102 | * @param appname Name of application which wants access to the database | 102 | * @param appname Name of application which wants access to the database |
103 | * (i.e. "todolist") | 103 | * (i.e. "todolist") |
104 | * @param filename The name of the database file. If not set, the default one | 104 | * @param filename The name of the database file. If not set, the default one |
105 | * is used. | 105 | * is used. |
106 | * @param backend Pointer to an alternative Backend. If not set, we will use | 106 | * @param backend Pointer to an alternative Backend. If not set, we will use |
107 | * the default backend. | 107 | * the default backend. |
108 | * @param handlesync If <b>true</b> the database stores the current state | 108 | * @param handlesync If <b>true</b> the database stores the current state |
109 | * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> | 109 | * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> |
110 | * which are used before and after synchronisation. If the application wants | 110 | * which are used before and after synchronisation. If the application wants |
111 | * to react itself, it should be disabled by setting it to <b>false</b> | 111 | * to react itself, it should be disabled by setting it to <b>false</b> |
112 | * @see OPimContactAccessBackend | 112 | * @see OPimContactAccessBackend |
113 | */ | 113 | */ |
114 | OPimContactAccess (const QString appname, const QString filename = 0l, | 114 | OPimContactAccess (const QString appname, const QString filename = 0l, |
115 | OPimContactAccessBackend* backend = 0l, bool handlesync = true); | 115 | OPimContactAccessBackend* backend = 0l, bool handlesync = true); |
116 | ~OPimContactAccess (); | 116 | ~OPimContactAccess (); |
117 | 117 | ||
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Return all possible settings for queryByExample(). | 120 | * Return all possible settings for queryByExample(). |
121 | * @return All settings provided by the current backend | 121 | * @return All settings provided by the current backend |
122 | * (i.e.: WildCards & IgnoreCase) | 122 | * (i.e.: WildCards & IgnoreCase) |
123 | * @see QuerySettings in OPimBase for details of the parameter | 123 | * @see QuerySettings in OPimBase for details of the parameter, queryByExample() |
124 | */ | 124 | */ |
125 | const uint querySettings(); | 125 | const uint querySettings(); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Check whether settings are correct for queryByExample(). | 128 | * Check whether settings are correct for queryByExample(). |
129 | * @return <i>true</i> if the given settings are correct and possible. | 129 | * @return <i>true</i> if the given settings are correct and possible. |
130 | * @see QuerySettings in OPimBase for details of the parameter | 130 | * @see QuerySettings in OPimBase for details of the parameter |
131 | */ | 131 | */ |
132 | bool hasQuerySettings ( int querySettings ) const; | 132 | bool hasQuerySettings ( int querySettings ) const; |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * if the resource was changed externally. | 135 | * if the resource was changed externally. |
136 | * You should use the signal instead of polling possible changes ! | 136 | * You should use the signal instead of polling possible changes ! |
137 | */ | 137 | */ |
138 | bool wasChangedExternally()const; | 138 | bool wasChangedExternally()const; |
139 | 139 | ||
140 | 140 | ||
141 | /** Save contacts database. | 141 | /** Save contacts database. |
142 | * Save is more a "commit". After calling this function, all changes are public available. | 142 | * Save is more a "commit". After calling this function, all changes are public available. |
143 | * @return true if successful | 143 | * @return true if successful |
144 | */ | 144 | */ |
145 | bool save(); | 145 | bool save(); |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * Return identification of used records | 148 | * Return identification of used records |
149 | */ | 149 | */ |
150 | int rtti() const; | 150 | int rtti() const; |
151 | 151 | ||
152 | signals: | 152 | signals: |
153 | /* Signal is emitted if the database was changed. Therefore | 153 | /* Signal is emitted if the database was changed. Therefore |
154 | * we may need to reload to stay consistent. | 154 | * we may need to reload to stay consistent. |
155 | * @param which Pointer to the database who created this event. This pointer | 155 | * @param which Pointer to the database who created this event. This pointer |
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index 073d5f9..3875f09 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h | |||
@@ -57,65 +57,105 @@ class OPimAccessTemplatePrivate; | |||
57 | template <class T = OPimRecord > | 57 | template <class T = OPimRecord > |
58 | class OPimAccessTemplate : public OTemplateBase<T> { | 58 | class OPimAccessTemplate : public OTemplateBase<T> { |
59 | public: | 59 | public: |
60 | /** | 60 | /** |
61 | * | 61 | * |
62 | */ | 62 | */ |
63 | enum Access { | 63 | enum Access { |
64 | Random = 0, | 64 | Random = 0, |
65 | SortedAccess | 65 | SortedAccess |
66 | }; | 66 | }; |
67 | typedef OPimRecordList<T> List; | 67 | typedef OPimRecordList<T> List; |
68 | typedef OPimAccessBackend<T> BackEnd; | 68 | typedef OPimAccessBackend<T> BackEnd; |
69 | typedef OPimCache<T> Cache; | 69 | typedef OPimCache<T> Cache; |
70 | 70 | ||
71 | //@{ | 71 | //@{ |
72 | OPimAccessTemplate( BackEnd* end); | 72 | OPimAccessTemplate( BackEnd* end); |
73 | virtual ~OPimAccessTemplate(); | 73 | virtual ~OPimAccessTemplate(); |
74 | //@} | 74 | //@} |
75 | 75 | ||
76 | //@{ | 76 | //@{ |
77 | bool load(); | 77 | bool load(); |
78 | virtual bool reload(); | 78 | virtual bool reload(); |
79 | bool save(); | 79 | bool save(); |
80 | void clear() ; | 80 | void clear() ; |
81 | //@} | 81 | //@} |
82 | 82 | ||
83 | 83 | ||
84 | bool wasChangedExternally()const; | 84 | bool wasChangedExternally()const; |
85 | 85 | ||
86 | //@{ | 86 | //@{ |
87 | virtual List allRecords()const; | 87 | virtual List allRecords()const; |
88 | virtual List matchRegexp( const QRegExp &r ) const; | 88 | virtual List matchRegexp( const QRegExp &r ) const; |
89 | virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); | 89 | |
90 | /** | ||
91 | * Query by example search interface. | ||
92 | * "Query by Example" provides a very powerful search engine. Use the query object | ||
93 | * (this may be a contact, a todo or databook event) | ||
94 | * as a search mask which is converted into a query regarding the querySettings. If a time period is needed | ||
95 | * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the endperiod (the last parameter). | ||
96 | * @see QuerySettings in class OPimBase | ||
97 | * @param query The object which contains the query set | ||
98 | * @param querySettings This parameter defines what should be searched and how the query should be interpreted | ||
99 | * @param endperiod Defines the end of a period for some special queries. | ||
100 | */ | ||
101 | virtual List queryByExample( const T& query, int querySettings, const QDateTime& endperiod = QDateTime() ); | ||
102 | |||
103 | /** | ||
104 | * Generic query by example search interface. This is a special version which handles generic OPimRecord types. They are converted | ||
105 | * automatically into the right datatype. | ||
106 | * "Query by Example" provides a very powerful search engine. Use the query object (this may be a contact, a todo or databook event) | ||
107 | * as a search mask which is converted into a query regarding the querySettings. If a time period is needed | ||
108 | * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the endperiod (the last parameter). | ||
109 | * @see QuerySettings in class OPimBase | ||
110 | * @param query The object which contains the query set | ||
111 | * @param querySettings This parameter defines what should be searched and how the query should be interpreted | ||
112 | * @param endperiod Defines the end of a period for some special queries. | ||
113 | */ | ||
114 | virtual List queryByExample( const OPimRecord* query, int querySettings, const QDateTime& endperiod = QDateTime() ); | ||
115 | /** | ||
116 | * Incremental query by example search interface. Providing incremental search, this one provides the feature | ||
117 | * to search in a list of records which may be returned by an other search. | ||
118 | * "Query by Example" provides a very powerful search engine. Use the query object (this may be a contact, a todo or databook event) | ||
119 | * as a search mask which is converted into a query regarding the querySettings. If a time period is needed | ||
120 | * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the endperiod (the last parameter). | ||
121 | * @see QuerySettings in class OPimBase | ||
122 | * @param uidlist List of uid's which should be incorporated into the next search | ||
123 | * @param query The object which contains the query set | ||
124 | * @param querySettings This parameter defines what should be searched and how the query should be interpreted | ||
125 | * @param endperiod Defines the end of a period for some special queries. | ||
126 | */ | ||
127 | virtual List queryByExample( const OPimAccessTemplate::List& uidlist, const T& query, int querySettings, | ||
128 | const QDateTime& endperiod = QDateTime() ); | ||
129 | |||
90 | virtual T find( UID uid )const; | 130 | virtual T find( UID uid )const; |
91 | virtual T find( UID uid, const QArray<int>&, | 131 | virtual T find( UID uid, const QArray<int>&, |
92 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; | 132 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; |
93 | //@} | 133 | //@} |
94 | 134 | ||
95 | /** | 135 | /** |
96 | * Get sorted lists.. | 136 | * Get sorted lists.. |
97 | * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: | 137 | * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: |
98 | * @param list of UID's received by allRecords() or others... | 138 | * @param list of UID's received by allRecords() or others... |
99 | * @param sortOrder Setting the sort order defined by enum SortOrder | 139 | * @param sortOrder Setting the sort order defined by enum SortOrder |
100 | * @param ascending Sort in ascending order if true, otherwise descending | 140 | * @param ascending Sort in ascending order if true, otherwise descending |
101 | * @param sortFilter Setting the sort filter defined by enum SortFilter | 141 | * @param sortFilter Setting the sort filter defined by enum SortFilter |
102 | * @param cat number of category. | 142 | * @param cat number of category. |
103 | */ | 143 | */ |
104 | virtual List sorted( const List& list, bool ascending, int sortOrder, | 144 | virtual List sorted( const List& list, bool ascending, int sortOrder, |
105 | int sortFilter, int cat )const; | 145 | int sortFilter, int cat )const; |
106 | 146 | ||
107 | /** | 147 | /** |
108 | * Get sorted lists.. | 148 | * Get sorted lists.. |
109 | * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: | 149 | * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: |
110 | * @param list of UID's received by allRecords() or others... | 150 | * @param list of UID's received by allRecords() or others... |
111 | * @param sortOrder Setting the sort order defined by enum SortOrder | 151 | * @param sortOrder Setting the sort order defined by enum SortOrder |
112 | * @param ascending Sort in ascending order if true, otherwise descending | 152 | * @param ascending Sort in ascending order if true, otherwise descending |
113 | * @param sortFilter Setting the sort filter defined by enum SortFilter | 153 | * @param sortFilter Setting the sort filter defined by enum SortFilter |
114 | * @param cats List of categories. | 154 | * @param cats List of categories. |
115 | */ | 155 | */ |
116 | virtual List sorted( const List& list, bool ascending, int sortOrder, | 156 | virtual List sorted( const List& list, bool ascending, int sortOrder, |
117 | int sortFilter, const QArray<UID>& cats )const; | 157 | int sortFilter, const QArray<UID>& cats )const; |
118 | 158 | ||
119 | /** | 159 | /** |
120 | * Get sorted lists.. | 160 | * Get sorted lists.. |
121 | * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: | 161 | * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: |
@@ -240,78 +280,100 @@ bool OPimAccessTemplate<T>::save() { | |||
240 | 280 | ||
241 | /** | 281 | /** |
242 | * return a List of records | 282 | * return a List of records |
243 | * you can iterate over them | 283 | * you can iterate over them |
244 | */ | 284 | */ |
245 | template <class T> | 285 | template <class T> |
246 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { | 286 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { |
247 | QArray<int> ints = m_backEnd->allRecords(); | 287 | QArray<int> ints = m_backEnd->allRecords(); |
248 | List lis(ints, this ); | 288 | List lis(ints, this ); |
249 | return lis; | 289 | return lis; |
250 | } | 290 | } |
251 | 291 | ||
252 | /** | 292 | /** |
253 | * return a List of records | 293 | * return a List of records |
254 | * that match the regex | 294 | * that match the regex |
255 | */ | 295 | */ |
256 | template <class T> | 296 | template <class T> |
257 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { | 297 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { |
258 | QArray<int> ints = m_backEnd->matchRegexp( r ); | 298 | QArray<int> ints = m_backEnd->matchRegexp( r ); |
259 | List lis(ints, this ); | 299 | List lis(ints, this ); |
260 | return lis; | 300 | return lis; |
261 | } | 301 | } |
262 | 302 | ||
263 | /** | 303 | /** |
264 | * find the OPimRecord uid | 304 | * find the OPimRecord uid |
265 | */ | 305 | */ |
266 | template <class T> | 306 | template <class T> |
267 | QArray<int> OPimAccessTemplate<T>::records()const { | 307 | QArray<int> OPimAccessTemplate<T>::records()const { |
268 | return m_backEnd->allRecords(); | 308 | return m_backEnd->allRecords(); |
269 | } | 309 | } |
270 | 310 | ||
271 | 311 | ||
272 | /** | ||
273 | * queryByExample. | ||
274 | * @see otodoaccess, ocontactaccess | ||
275 | */ | ||
276 | template <class T> | 312 | template <class T> |
277 | typename OPimAccessTemplate<T>::List | 313 | typename OPimAccessTemplate<T>::List |
278 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { | 314 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { |
279 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); | 315 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); |
280 | 316 | ||
281 | List lis(ints, this ); | 317 | List list(ints, this ); |
282 | return lis; | 318 | return list; |
283 | } | 319 | } |
284 | 320 | ||
285 | template <class T> | 321 | template <class T> |
322 | typename OPimAccessTemplate<T>::List | ||
323 | OPimAccessTemplate<T>::queryByExample( const OPimRecord* t, int settings, const QDateTime& d ) { | ||
324 | T tempInstance; | ||
325 | |||
326 | if ( t->rtti() == tempInstance.rtti() ) { | ||
327 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); | ||
328 | List list( ints, this ); | ||
329 | return list; | ||
330 | } else { | ||
331 | owarn << "Query not possible: Objecttype mismatch" << oendl; | ||
332 | } | ||
333 | |||
334 | return List(); | ||
335 | } | ||
336 | |||
337 | template <class T> | ||
338 | typename OPimAccessTemplate<T>::List | ||
339 | OPimAccessTemplate<T>::queryByExample( const OPimAccessTemplate::List& uidlist, const T& t, int settings, const QDateTime& d ) { | ||
340 | QArray<int> ints = m_backEnd->queryByExample( uidlist.uids(), t, settings, d ); | ||
341 | |||
342 | List list( ints, this ); | ||
343 | return list; | ||
344 | } | ||
345 | |||
346 | |||
347 | template <class T> | ||
286 | T OPimAccessTemplate<T>::find( UID uid ) const{ | 348 | T OPimAccessTemplate<T>::find( UID uid ) const{ |
287 | // First search in cache.. | 349 | // First search in cache.. |
288 | if ( m_cache.contains( uid ) ) | 350 | if ( m_cache.contains( uid ) ) |
289 | return m_cache.find( uid ); | 351 | return m_cache.find( uid ); |
290 | 352 | ||
291 | T t = m_backEnd->find( uid ); | 353 | T t = m_backEnd->find( uid ); |
292 | cache( t ); | 354 | cache( t ); |
293 | 355 | ||
294 | return t; | 356 | return t; |
295 | } | 357 | } |
296 | 358 | ||
297 | 359 | ||
298 | /** | 360 | /** |
299 | * read ahead cache find method ;) | 361 | * read ahead cache find method ;) |
300 | */ | 362 | */ |
301 | template <class T> | 363 | template <class T> |
302 | T OPimAccessTemplate<T>::find( UID uid, const QArray<int>& ar, | 364 | T OPimAccessTemplate<T>::find( UID uid, const QArray<int>& ar, |
303 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { | 365 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { |
304 | /* | 366 | /* |
305 | * better do T.isEmpty() | 367 | * better do T.isEmpty() |
306 | * after a find this way we would | 368 | * after a find this way we would |
307 | * avoid two finds in QCache... | 369 | * avoid two finds in QCache... |
308 | */ | 370 | */ |
309 | if (m_cache.contains( uid ) ) | 371 | if (m_cache.contains( uid ) ) |
310 | return m_cache.find( uid ); | 372 | return m_cache.find( uid ); |
311 | 373 | ||
312 | 374 | ||
313 | T t = m_backEnd->find( uid, ar, current, dir ); | 375 | T t = m_backEnd->find( uid, ar, current, dir ); |
314 | cache( t ); | 376 | cache( t ); |
315 | return t; | 377 | return t; |
316 | } | 378 | } |
317 | 379 | ||
diff --git a/libopie2/opiepim/core/opimtemplatebase.h b/libopie2/opiepim/core/opimtemplatebase.h index c8abab4..075e573 100644 --- a/libopie2/opiepim/core/opimtemplatebase.h +++ b/libopie2/opiepim/core/opimtemplatebase.h | |||
@@ -105,65 +105,65 @@ struct OPimBase { | |||
105 | /** The month matches */ | 105 | /** The month matches */ |
106 | DateMonth = 0x0080, | 106 | DateMonth = 0x0080, |
107 | /** The day matches */ | 107 | /** The day matches */ |
108 | DateDay = 0x0100, | 108 | DateDay = 0x0100, |
109 | /** The last possible name matches */ | 109 | /** The last possible name matches */ |
110 | LastItem = 0xffff | 110 | LastItem = 0xffff |
111 | }; | 111 | }; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Common Attributes for the Sort Order | 114 | * Common Attributes for the Sort Order |
115 | */ | 115 | */ |
116 | enum SortOrderBase { | 116 | enum SortOrderBase { |
117 | /** Sort by a Summary of the records */ | 117 | /** Sort by a Summary of the records */ |
118 | SortSummary = 0, | 118 | SortSummary = 0, |
119 | /** Sort by Category */ | 119 | /** Sort by Category */ |
120 | SortByCategory = 1, | 120 | SortByCategory = 1, |
121 | /** Sort by Date */ | 121 | /** Sort by Date */ |
122 | SortByDate = 2, | 122 | SortByDate = 2, |
123 | /** The First available sort number for the OPimAccessTemplates */ | 123 | /** The First available sort number for the OPimAccessTemplates */ |
124 | SortCustom = 10, | 124 | SortCustom = 10, |
125 | /** make this enum 16bit large */ | 125 | /** make this enum 16bit large */ |
126 | LastSortOrderBase = 0xffff | 126 | LastSortOrderBase = 0xffff |
127 | }; | 127 | }; |
128 | 128 | ||
129 | /** | 129 | /** |
130 | * Sort a list of Items with the help of the sorted() function. | 130 | * Sort a list of Items with the help of the sorted() function. |
131 | * The Item you provide in SortOrder will be used | 131 | * The Item you provide in SortOrder will be used |
132 | * for sorting. | 132 | * for sorting. |
133 | * | 133 | * |
134 | * @see OPimAccessTemplate<>::sorted() | 134 | * @see OPimAccessTemplate<>::sorted() |
135 | */ | 135 | */ |
136 | enum SortFilterBase { | 136 | enum SortFilterBase { |
137 | /** Do not filter anything. */ | 137 | /** Do not filter anything. */ |
138 | FilterOff = 0, | 138 | FilterOff = 0, |
139 | /** Use given Categories for filter */ | 139 | /** Use given Categories for filter */ |
140 | FilterCategory = 1, | 140 | FilterCategory = 1, |
141 | /** The first available custom filter defined in the specialized frontends */ | 141 | /** The first available custom filter defined in the specialized frontends */ |
142 | FilterCustom = 1024, | 142 | FilterCustom = 1024, |
143 | LastSortFilterBase = 0xffffffff | 143 | LastSortFilterBase = 0xffffffff |
144 | }; | 144 | }; |
145 | 145 | ||
146 | virtual UIDArray matchRegexpSimple( const QRegExp& r )const = 0; | 146 | virtual UIDArray matchRegexpSimple( const QRegExp& r )const = 0; |
147 | virtual UIDArray queryByExampleSimple( const OPimRecord*, int settings, | 147 | virtual UIDArray queryByExampleSimple( const OPimRecord*, int settings, |
148 | const QDateTime& d = QDateTime() )const = 0; | 148 | const QDateTime& d = QDateTime() )const = 0; |
149 | virtual UIDArray sortedSimple( const UIDArray& uid, bool ascending, | 149 | virtual UIDArray sortedSimple( const UIDArray& uid, bool ascending, |
150 | int sortOrder, int sortFilter, int cat)const = 0; | 150 | int sortOrder, int sortFilter, int cat)const = 0; |
151 | virtual UIDArray sortedSimple( const UIDArray& uid, bool ascending, | 151 | virtual UIDArray sortedSimple( const UIDArray& uid, bool ascending, |
152 | int sortOrder, int sortFilter, const QArray<UID>& cats )const = 0; | 152 | int sortOrder, int sortFilter, const QArray<UID>& cats )const = 0; |
153 | virtual UIDArray sortedSimple( bool ascending, int sortOrder, int sortFilter, int cat)const = 0; | 153 | virtual UIDArray sortedSimple( bool ascending, int sortOrder, int sortFilter, int cat)const = 0; |
154 | virtual UIDArray sortedSimple( bool ascending, int sortOrder, int sortFilter, const QArray<UID>& cats )const = 0; | 154 | virtual UIDArray sortedSimple( bool ascending, int sortOrder, int sortFilter, const QArray<UID>& cats )const = 0; |
155 | virtual OPimOccurrence::List occurrences( const QDate& start, const QDate& end )const = 0; | 155 | virtual OPimOccurrence::List occurrences( const QDate& start, const QDate& end )const = 0; |
156 | virtual OPimOccurrence::List occurrences( const QDateTime& dt )const = 0; | 156 | virtual OPimOccurrence::List occurrences( const QDateTime& dt )const = 0; |
157 | //@} | 157 | //@} |
158 | 158 | ||
159 | 159 | ||
160 | protected: | 160 | protected: |
161 | OPimOccurrence::List convertOccurrenceFromBackend( const OPimBackendOccurrence::List& )const; | 161 | OPimOccurrence::List convertOccurrenceFromBackend( const OPimBackendOccurrence::List& )const; |
162 | 162 | ||
163 | private: | 163 | private: |
164 | OPimBasePrivate* d; | 164 | OPimBasePrivate* d; |
165 | }; | 165 | }; |
166 | 166 | ||
167 | 167 | ||
168 | /** | 168 | /** |
169 | * internal template base | 169 | * internal template base |