-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,2 +1,5 @@ | |||
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 |
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 | |||
@@ -121,5 +121,5 @@ class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact> | |||
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(); |
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 | |||
@@ -87,5 +87,45 @@ public: | |||
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>&, |
@@ -270,8 +310,4 @@ QArray<int> OPimAccessTemplate<T>::records()const { | |||
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 |
@@ -279,9 +315,35 @@ OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime | |||
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.. |
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 | |||
@@ -135,5 +135,5 @@ struct OPimBase { | |||
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 */ |