summaryrefslogtreecommitdiff
authoreilers <eilers>2005-01-03 16:44:42 (UTC)
committer eilers <eilers>2005-01-03 16:44:42 (UTC)
commit310c7dce0c9043f66725bc79449fe958a12ad459 (patch) (unidiff)
tree9d789c21b1fb88bdd8a1ad7470867b91c70276b2
parent0b3bbec6703c021a188c865e822f536bfa3045fc (diff)
downloadopie-310c7dce0c9043f66725bc79449fe958a12ad459.zip
opie-310c7dce0c9043f66725bc79449fe958a12ad459.tar.gz
opie-310c7dce0c9043f66725bc79449fe958a12ad459.tar.bz2
Fixing stupid API documentation error.
Moving hasQuerySettings() and querySettings up to OPimAccessTemplate to be available for all frontends..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ChangeLog3
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp1
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.cpp2
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.h2
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp9
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h15
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h43
7 files changed, 40 insertions, 35 deletions
diff --git a/libopie2/opiepim/ChangeLog b/libopie2/opiepim/ChangeLog
index 2007744..320b189 100644
--- a/libopie2/opiepim/ChangeLog
+++ b/libopie2/opiepim/ChangeLog
@@ -1,23 +1,26 @@
12005-01-03 Stefan Eilers <stefan@eilers-online.net>
2 * Fixing bug in API documentation
3 * Moving hasQuerySettings() and querySettings() to OPimAccessTemplate to be available for all frontends
12004-12-28 Stefan Eilers <stefan@eilers-online.net> 42004-12-28 Stefan Eilers <stefan@eilers-online.net>
2 * Make improved query by example accessable via frontend 5 * Make improved query by example accessable via frontend
3 * Some API documentation improvement 6 * Some API documentation improvement
4 * Cleanup of backend api.. 7 * Cleanup of backend api..
5 * Fixing bug #1501 8 * Fixing bug #1501
62004-11-23 Stefan Eilers <stefan@eilers-online.net> 92004-11-23 Stefan Eilers <stefan@eilers-online.net>
7 * Implement fast and full featured version of sorted() for addressbook 10 * Implement fast and full featured version of sorted() for addressbook
8 * Implement generic queryByExample for all Addressboook backends. It allows incremental search. 11 * Implement generic queryByExample for all Addressboook backends. It allows incremental search.
9 * Update of API Documentation 12 * Update of API Documentation
102004-11-18 Holger Freyther <freyther@handhelds.org> 132004-11-18 Holger Freyther <freyther@handhelds.org>
11 * Every Access can give a set of Occurrences for a period or a datetime 14 * Every Access can give a set of Occurrences for a period or a datetime
12 * QueryByExample, Find, Sort can be generically accessed by OPimBase 15 * QueryByExample, Find, Sort can be generically accessed by OPimBase
13 pointer interface 16 pointer interface
14 * OPimBackendOccurrence gets split up to OPimOccurrences by 17 * OPimBackendOccurrence gets split up to OPimOccurrences by
15 OPimTemplateBase 18 OPimTemplateBase
16 * Add safeCast to various OPimRecords 19 * Add safeCast to various OPimRecords
17 * Kill memleak in OPimTodo 20 * Kill memleak in OPimTodo
18 * Add SortVector implementations for OPimTodo and OPimContact 21 * Add SortVector implementations for OPimTodo and OPimContact
19 22
20 2004-??-??The Opie Team <opie@handhelds.org> 23 2004-??-??The Opie Team <opie@handhelds.org>
21 * Implemented some important modifications to allow to use OPimRecords as it is, without 24 * Implemented some important modifications to allow to use OPimRecords as it is, without
22 have to cast them. This makes it possible to write applications which handling pim 25 have to cast them. This makes it possible to write applications which handling pim
23 data in a generic manner (see opimconvertion tool) (eilers) \ No newline at end of file 26 data in a generic manner (see opimconvertion tool) (eilers) \ No newline at end of file
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index 41b714e..629e4da 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -187,48 +187,49 @@ void ODateBookAccessBackend_SQL::update()
187 // m_uids.clear(); 187 // m_uids.clear();
188 return; 188 return;
189 } 189 }
190 190
191 m_uids = extractUids( res ); 191 m_uids = extractUids( res );
192 192
193} 193}
194 194
195bool ODateBookAccessBackend_SQL::reload() 195bool ODateBookAccessBackend_SQL::reload()
196{ 196{
197 return load(); 197 return load();
198} 198}
199 199
200bool ODateBookAccessBackend_SQL::save() 200bool ODateBookAccessBackend_SQL::save()
201{ 201{
202 return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) 202 return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers)
203} 203}
204 204
205QArray<int> ODateBookAccessBackend_SQL::allRecords()const 205QArray<int> ODateBookAccessBackend_SQL::allRecords()const
206{ 206{
207 return m_uids; 207 return m_uids;
208} 208}
209 209
210QArray<int> ODateBookAccessBackend_SQL::queryByExample(const OPimEvent&, int, const QDateTime& ) { 210QArray<int> ODateBookAccessBackend_SQL::queryByExample(const OPimEvent&, int, const QDateTime& ) {
211 qDebug( "Accessing ODateBookAccessBackend_SQL::queryByExample() which is not implemented!" );
211 return QArray<int>(); 212 return QArray<int>();
212} 213}
213 214
214void ODateBookAccessBackend_SQL::clear() 215void ODateBookAccessBackend_SQL::clear()
215{ 216{
216 QString qu = "drop table datebook;"; 217 QString qu = "drop table datebook;";
217 qu += "drop table custom_data;"; 218 qu += "drop table custom_data;";
218 219
219 OSQLRawQuery raw( qu ); 220 OSQLRawQuery raw( qu );
220 OSQLResult res = m_driver->query( &raw ); 221 OSQLResult res = m_driver->query( &raw );
221 222
222 reload(); 223 reload();
223} 224}
224 225
225 226
226OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{ 227OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{
227 odebug << "ODateBookAccessBackend_SQL::find( " << uid << " )" << oendl; 228 odebug << "ODateBookAccessBackend_SQL::find( " << uid << " )" << oendl;
228 229
229 QString qu = "select *"; 230 QString qu = "select *";
230 qu += "from datebook where uid = " + QString::number(uid); 231 qu += "from datebook where uid = " + QString::number(uid);
231 232
232 odebug << "Query: " << qu << "" << oendl; 233 odebug << "Query: " << qu << "" << oendl;
233 234
234 OSQLRawQuery raw( qu ); 235 OSQLRawQuery raw( qu );
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.cpp b/libopie2/opiepim/backend/otodoaccessbackend.cpp
index f979976..c7ce123 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.cpp
+++ b/libopie2/opiepim/backend/otodoaccessbackend.cpp
@@ -33,49 +33,49 @@
33 33
34#include <qintdict.h> 34#include <qintdict.h>
35 35
36namespace Opie { 36namespace Opie {
37OPimTodoAccessBackend::OPimTodoAccessBackend() 37OPimTodoAccessBackend::OPimTodoAccessBackend()
38 : OPimAccessBackend<OPimTodo>() 38 : OPimAccessBackend<OPimTodo>()
39{ 39{
40} 40}
41OPimTodoAccessBackend::~OPimTodoAccessBackend() { 41OPimTodoAccessBackend::~OPimTodoAccessBackend() {
42 42
43} 43}
44 44
45const uint OPimTodoAccessBackend::querySettings() const 45const uint OPimTodoAccessBackend::querySettings() const
46{ 46{
47 return 0; 47 return 0;
48} 48}
49 49
50bool OPimTodoAccessBackend::hasQuerySettings (uint querySettings) const 50bool OPimTodoAccessBackend::hasQuerySettings (uint querySettings) const
51{ 51{
52 return false; 52 return false;
53} 53}
54 54
55 55
56UIDArray OPimTodoAccessBackend::queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings, 56UIDArray OPimTodoAccessBackend::queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings,
57 const QDateTime& endperiod )const 57 const QDateTime& startperiod )const
58{ 58{
59 qDebug( "Accessing OPimTodoAccessBackend::queryByExample() which is not implemented!" ); 59 qDebug( "Accessing OPimTodoAccessBackend::queryByExample() which is not implemented!" );
60 return UIDArray(); 60 return UIDArray();
61 61
62// odebug << "Using Unaccelerated OPimContactAccessBackend implementation of queryByExample!" << oendl; 62// odebug << "Using Unaccelerated OPimContactAccessBackend implementation of queryByExample!" << oendl;
63 63
64// UIDArray m_currentQuery( uid_array.count() ); 64// UIDArray m_currentQuery( uid_array.count() );
65// uint arraycounter = 0; 65// uint arraycounter = 0;
66 66
67// for( uint it = 0; it < uid_array.count(); ++it ){ 67// for( uint it = 0; it < uid_array.count(); ++it ){
68 // /* Search all fields and compare them with query object. Store them into list 68 // /* Search all fields and compare them with query object. Store them into list
69 // * if all fields matches. 69 // * if all fields matches.
70 // */ 70 // */
71// } 71// }
72 72
73 73
74} 74}
75 75
76UIDArray OPimTodoAccessBackend::sorted( const UIDArray& events, bool asc, 76UIDArray OPimTodoAccessBackend::sorted( const UIDArray& events, bool asc,
77 int sortOrder, int sortFilter, 77 int sortOrder, int sortFilter,
78 const QArray<int>& categories )const { 78 const QArray<int>& categories )const {
79 odebug << "Using Unaccelerated TodoList sorted Implementation" << oendl; 79 odebug << "Using Unaccelerated TodoList sorted Implementation" << oendl;
80 Internal::OPimTodoSortVector vector(events.count(), asc,sortOrder ); 80 Internal::OPimTodoSortVector vector(events.count(), asc,sortOrder );
81 int item = 0; 81 int item = 0;
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h
index 870ee57..06cece3 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.h
+++ b/libopie2/opiepim/backend/otodoaccessbackend.h
@@ -43,49 +43,49 @@ public:
43 const QDate& end, 43 const QDate& end,
44 bool includeNoDates )const = 0; 44 bool includeNoDates )const = 0;
45 virtual UIDArray overDue()const = 0; 45 virtual UIDArray overDue()const = 0;
46 virtual void removeAllCompleted() = 0; 46 virtual void removeAllCompleted() = 0;
47 47
48 /** 48 /**
49 * Common and probably inefficent implementation 49 * Common and probably inefficent implementation
50 * for queryByExample, matchRegexp, sorted 50 * for queryByExample, matchRegexp, sorted
51 * and occurrences 51 * and occurrences
52 */ 52 */
53 //@{ 53 //@{
54 /** 54 /**
55 * Return all possible settings. 55 * Return all possible settings.
56 * @return All settings provided by the current backend 56 * @return All settings provided by the current backend
57 * (i.e.: query_WildCards & query_IgnoreCase) 57 * (i.e.: query_WildCards & query_IgnoreCase)
58 */ 58 */
59 const uint querySettings() const; 59 const uint querySettings() const;
60 60
61 /** 61 /**
62 * Check whether settings are correct. 62 * Check whether settings are correct.
63 * @return <i>true</i> if the given settings are correct and possible. 63 * @return <i>true</i> if the given settings are correct and possible.
64 */ 64 */
65 bool hasQuerySettings (uint querySettings) const; 65 bool hasQuerySettings (uint querySettings) const;
66 66
67 UIDArray queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings, const QDateTime& endperiod = QDateTime() )const; 67 UIDArray queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings, const QDateTime& startperiod = QDateTime() )const;
68 UIDArray sorted( const UIDArray&, bool asc, int, int, const QArray<int>& )const; 68 UIDArray sorted( const UIDArray&, bool asc, int, int, const QArray<int>& )const;
69 OPimBackendOccurrence::List occurrences( const QDate&, const QDate& )const; 69 OPimBackendOccurrence::List occurrences( const QDate&, const QDate& )const;
70 //@} 70 //@}
71 71
72private: 72private:
73 class Private; 73 class Private;
74 Private *d; 74 Private *d;
75 75
76}; 76};
77} 77}
78 78
79 79
80/** 80/**
81 * \fn Opie::OPimBackendOccurrence::List Opie::OPimTodoAccessBackend::occurrences(const QDate& start,const QDate& end)const 81 * \fn Opie::OPimBackendOccurrence::List Opie::OPimTodoAccessBackend::occurrences(const QDate& start,const QDate& end)const
82 * \brief Return occurrences for a period of time 82 * \brief Return occurrences for a period of time
83 * 83 *
84 * This method will return the 'effective' Todos and also 84 * This method will return the 'effective' Todos and also
85 * 'Overdue' Todos. Overdues will be shown on the 'current' 85 * 'Overdue' Todos. Overdues will be shown on the 'current'
86 * day if it is in the range or on \par start. If the overdue 86 * day if it is in the range or on \par start. If the overdue
87 * is inside the 'Effective Todos' we will skip the 87 * is inside the 'Effective Todos' we will skip the
88 * special overdue handling. 88 * special overdue handling.
89 * 89 *
90 * 90 *
91 */ 91 */
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 9bbc820..9d18d47 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -97,57 +97,48 @@ OPimContactAccess::~OPimContactAccess ()
97 save(); 97 save();
98 // delete m_backEnd; is done by template.. 98 // delete m_backEnd; is done by template..
99} 99}
100 100
101 101
102bool OPimContactAccess::save () 102bool OPimContactAccess::save ()
103{ 103{
104 /* If the database was changed externally, we could not save the 104 /* If the database was changed externally, we could not save the
105 * Data. This will remove added items which is unacceptable ! 105 * Data. This will remove added items which is unacceptable !
106 * Therefore: Reload database and merge the data... 106 * Therefore: Reload database and merge the data...
107 */ 107 */
108 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() ) 108 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() )
109 reload(); 109 reload();
110 110
111 bool status = OPimAccessTemplate<OPimContact>::save(); 111 bool status = OPimAccessTemplate<OPimContact>::save();
112 if ( !status ) return false; 112 if ( !status ) return false;
113 113
114 /* Now tell everyone that new data is available. 114 /* Now tell everyone that new data is available.
115 */ 115 */
116 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 116 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
117 117
118 return true; 118 return true;
119} 119}
120 120
121const uint OPimContactAccess::querySettings()
122{
123 return ( m_backEnd->querySettings() );
124}
125
126bool OPimContactAccess::hasQuerySettings ( int querySettings ) const
127{
128 return ( m_backEnd->hasQuerySettings ( querySettings ) );
129}
130 121
131#if 0 122#if 0
132OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const 123OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
133{ 124{
134 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); 125 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
135 return ( OPimRecordList<OPimContact>(matchingContacts, this) ); 126 return ( OPimRecordList<OPimContact>(matchingContacts, this) );
136} 127}
137#endif 128#endif
138 129
139 130
140bool OPimContactAccess::wasChangedExternally()const 131bool OPimContactAccess::wasChangedExternally()const
141{ 132{
142 return ( m_backEnd->wasChangedExternally() ); 133 return ( m_backEnd->wasChangedExternally() );
143} 134}
144 135
145 136
146void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) 137void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & )
147{ 138{
148 if ( msg == "addressbookUpdated()" ){ 139 if ( msg == "addressbookUpdated()" ){
149 emit signalChanged ( this ); 140 emit signalChanged ( this );
150 } else if ( msg == "flush()" ) { 141 } else if ( msg == "flush()" ) {
151 save (); 142 save ();
152 } else if ( msg == "reload()" ) { 143 } else if ( msg == "reload()" ) {
153 reload (); 144 reload ();
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index 5051321..9a2ecaf 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -95,63 +95,48 @@ class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact>
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 /**
120 * Return all possible settings for queryByExample().
121 * @return All settings provided by the current backend
122 * (i.e.: WildCards & IgnoreCase)
123 * @see QuerySettings in OPimBase for details of the parameter, queryByExample()
124 */
125 const uint querySettings();
126
127 /**
128 * Check whether settings are correct for queryByExample().
129 * @return <i>true</i> if the given settings are correct and possible.
130 * @see QuerySettings in OPimBase for details of the parameter
131 */
132 bool hasQuerySettings ( int querySettings ) const;
133
134 /** 119 /**
135 * if the resource was changed externally. 120 * if the resource was changed externally.
136 * You should use the signal instead of polling possible changes ! 121 * You should use the signal instead of polling possible changes !
137 */ 122 */
138 bool wasChangedExternally()const; 123 bool wasChangedExternally()const;
139 124
140 125
141 /** Save contacts database. 126 /** Save contacts database.
142 * Save is more a "commit". After calling this function, all changes are public available. 127 * Save is more a "commit". After calling this function, all changes are public available.
143 * @return true if successful 128 * @return true if successful
144 */ 129 */
145 bool save(); 130 bool save();
146 131
147 /** 132 /**
148 * Return identification of used records 133 * Return identification of used records
149 */ 134 */
150 int rtti() const; 135 int rtti() const;
151 136
152 signals: 137 signals:
153 /* Signal is emitted if the database was changed. Therefore 138 /* Signal is emitted if the database was changed. Therefore
154 * we may need to reload to stay consistent. 139 * we may need to reload to stay consistent.
155 * @param which Pointer to the database who created this event. This pointer 140 * @param which Pointer to the database who created this event. This pointer
156 * is useful if an application has to handle multiple databases at the same time. 141 * is useful if an application has to handle multiple databases at the same time.
157 * @see reload() 142 * @see reload()
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 3875f09..823f03d 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -66,87 +66,102 @@ public:
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 89
90 /**
91 * Return all possible settings for queryByExample().
92 * @return All settings provided by the current backend
93 * (i.e.: WildCards & IgnoreCase)
94 * @see QuerySettings in OPimBase for details of the parameter, queryByExample()
95 */
96 const uint querySettings();
97
98 /**
99 * Check whether settings are correct for queryByExample().
100 * @return <i>true</i> if the given settings are correct and possible.
101 * @see QuerySettings in OPimBase for details of the parameter
102 */
103 bool hasQuerySettings ( int querySettings ) const;
104
90 /** 105 /**
91 * Query by example search interface. 106 * Query by example search interface.
92 * "Query by Example" provides a very powerful search engine. Use the query object 107 * "Query by Example" provides a very powerful search engine. Use the query object
93 * (this may be a contact, a todo or databook event) 108 * (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 109 * 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). 110 * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the startperiod (the last parameter).
96 * @see QuerySettings in class OPimBase 111 * @see QuerySettings in class OPimBase
97 * @param query The object which contains the query set 112 * @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 113 * @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. 114 * @param startperiod Defines the start of a period for some special queries.
100 */ 115 */
101 virtual List queryByExample( const T& query, int querySettings, const QDateTime& endperiod = QDateTime() ); 116 virtual List queryByExample( const T& query, int querySettings, const QDateTime& startperiod = QDateTime() );
102 117
103 /** 118 /**
104 * Generic query by example search interface. This is a special version which handles generic OPimRecord types. They are converted 119 * 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. 120 * 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) 121 * "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 122 * 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). 123 * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the startperiod (the last parameter).
109 * @see QuerySettings in class OPimBase 124 * @see QuerySettings in class OPimBase
110 * @param query The object which contains the query set 125 * @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 126 * @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. 127 * @param startperiod Defines the start of a period for some special queries.
113 */ 128 */
114 virtual List queryByExample( const OPimRecord* query, int querySettings, const QDateTime& endperiod = QDateTime() ); 129 virtual List queryByExample( const OPimRecord* query, int querySettings, const QDateTime& startperiod = QDateTime() );
115 /** 130 /**
116 * Incremental query by example search interface. Providing incremental search, this one provides the feature 131 * 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. 132 * 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) 133 * "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 134 * 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). 135 * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the startperiod (the last parameter).
121 * @see QuerySettings in class OPimBase 136 * @see QuerySettings in class OPimBase
122 * @param uidlist List of uid's which should be incorporated into the next search 137 * @param uidlist List of uid's which should be incorporated into the next search
123 * @param query The object which contains the query set 138 * @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 139 * @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. 140 * @param startperiod Defines the start of a period for some special queries.
126 */ 141 */
127 virtual List queryByExample( const OPimAccessTemplate::List& uidlist, const T& query, int querySettings, 142 virtual List queryByExample( const OPimAccessTemplate::List& uidlist, const T& query, int querySettings,
128 const QDateTime& endperiod = QDateTime() ); 143 const QDateTime& startperiod = QDateTime() );
129 144
130 virtual T find( UID uid )const; 145 virtual T find( UID uid )const;
131 virtual T find( UID uid, const QArray<int>&, 146 virtual T find( UID uid, const QArray<int>&,
132 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; 147 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const;
133 //@} 148 //@}
134 149
135 /** 150 /**
136 * Get sorted lists.. 151 * Get sorted lists..
137 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: 152 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
138 * @param list of UID's received by allRecords() or others... 153 * @param list of UID's received by allRecords() or others...
139 * @param sortOrder Setting the sort order defined by enum SortOrder 154 * @param sortOrder Setting the sort order defined by enum SortOrder
140 * @param ascending Sort in ascending order if true, otherwise descending 155 * @param ascending Sort in ascending order if true, otherwise descending
141 * @param sortFilter Setting the sort filter defined by enum SortFilter 156 * @param sortFilter Setting the sort filter defined by enum SortFilter
142 * @param cat number of category. 157 * @param cat number of category.
143 */ 158 */
144 virtual List sorted( const List& list, bool ascending, int sortOrder, 159 virtual List sorted( const List& list, bool ascending, int sortOrder,
145 int sortFilter, int cat )const; 160 int sortFilter, int cat )const;
146 161
147 /** 162 /**
148 * Get sorted lists.. 163 * Get sorted lists..
149 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params: 164 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
150 * @param list of UID's received by allRecords() or others... 165 * @param list of UID's received by allRecords() or others...
151 * @param sortOrder Setting the sort order defined by enum SortOrder 166 * @param sortOrder Setting the sort order defined by enum SortOrder
152 * @param ascending Sort in ascending order if true, otherwise descending 167 * @param ascending Sort in ascending order if true, otherwise descending
@@ -287,48 +302,58 @@ typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
287 QArray<int> ints = m_backEnd->allRecords(); 302 QArray<int> ints = m_backEnd->allRecords();
288 List lis(ints, this ); 303 List lis(ints, this );
289 return lis; 304 return lis;
290} 305}
291 306
292/** 307/**
293 * return a List of records 308 * return a List of records
294 * that match the regex 309 * that match the regex
295 */ 310 */
296template <class T> 311template <class T>
297typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { 312typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const {
298 QArray<int> ints = m_backEnd->matchRegexp( r ); 313 QArray<int> ints = m_backEnd->matchRegexp( r );
299 List lis(ints, this ); 314 List lis(ints, this );
300 return lis; 315 return lis;
301} 316}
302 317
303/** 318/**
304 * find the OPimRecord uid 319 * find the OPimRecord uid
305 */ 320 */
306template <class T> 321template <class T>
307QArray<int> OPimAccessTemplate<T>::records()const { 322QArray<int> OPimAccessTemplate<T>::records()const {
308 return m_backEnd->allRecords(); 323 return m_backEnd->allRecords();
309} 324}
310 325
326template <class T>
327const uint OPimAccessTemplate<T>::querySettings(){
328 return m_backEnd->querySettings();
329}
330
331template <class T>
332bool OPimAccessTemplate<T>::hasQuerySettings ( int querySettings ) const {
333 return m_backEnd->hasQuerySettings( querySettings );
334}
335
311 336
312template <class T> 337template <class T>
313typename OPimAccessTemplate<T>::List 338typename OPimAccessTemplate<T>::List
314OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { 339OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) {
315 QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); 340 QArray<int> ints = m_backEnd->queryByExample( t, settings, d );
316 341
317 List list(ints, this ); 342 List list(ints, this );
318 return list; 343 return list;
319} 344}
320 345
321template <class T> 346template <class T>
322typename OPimAccessTemplate<T>::List 347typename OPimAccessTemplate<T>::List
323OPimAccessTemplate<T>::queryByExample( const OPimRecord* t, int settings, const QDateTime& d ) { 348OPimAccessTemplate<T>::queryByExample( const OPimRecord* t, int settings, const QDateTime& d ) {
324 T tempInstance; 349 T tempInstance;
325 350
326 if ( t->rtti() == tempInstance.rtti() ) { 351 if ( t->rtti() == tempInstance.rtti() ) {
327 QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); 352 QArray<int> ints = m_backEnd->queryByExample( t, settings, d );
328 List list( ints, this ); 353 List list( ints, this );
329 return list; 354 return list;
330 } else { 355 } else {
331 owarn << "Query not possible: Objecttype mismatch" << oendl; 356 owarn << "Query not possible: Objecttype mismatch" << oendl;
332 } 357 }
333 358
334 return List(); 359 return List();