summaryrefslogtreecommitdiff
path: root/libopie2
authoreilers <eilers>2002-10-14 16:21:54 (UTC)
committer eilers <eilers>2002-10-14 16:21:54 (UTC)
commitf48ddfb53e49550f9fe8e9502f2a44aeb8b359cc (patch) (unidiff)
tree7972f3fc9a1d61e22fe57ff0fa96fd9a0badb55d /libopie2
parentda3868438e739310862bf65b0d0c8ffa864392e8 (diff)
downloadopie-f48ddfb53e49550f9fe8e9502f2a44aeb8b359cc.zip
opie-f48ddfb53e49550f9fe8e9502f2a44aeb8b359cc.tar.gz
opie-f48ddfb53e49550f9fe8e9502f2a44aeb8b359cc.tar.bz2
Some minor interface updates
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h35
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp2
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.h2
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp4
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h49
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h12
6 files changed, 37 insertions, 67 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index 97ef40f..50ea329 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -17,6 +17,9 @@
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.3 2002/10/14 16:21:54 eilers
21 * Some minor interface updates
22 *
20 * Revision 1.2 2002/10/07 17:34:24 eilers 23 * Revision 1.2 2002/10/07 17:34:24 eilers
21 * added OBackendFactory for advanced backend access 24 * added OBackendFactory for advanced backend access
22 * 25 *
@@ -199,25 +202,25 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
199 for ( int i = 0; i < Qtopia::rid; i++ ) { 202 for ( int i = 0; i < Qtopia::rid; i++ ) {
200 /* Just compare fields which are not empty in the query object */ 203 /* Just compare fields which are not empty in the query object */
201 if ( !query.field(i).isEmpty() ){ 204 if ( !query.field(i).isEmpty() ){
202 switch ( settings & ~OContactAccess::query_IgnoreCase ){ 205 switch ( settings & ~OContactAccess::IgnoreCase ){
203 case OContactAccess::query_RegExp:{ 206 case OContactAccess::RegExp:{
204 QRegExp expr ( query.field(i), 207 QRegExp expr ( query.field(i),
205 !(settings & OContactAccess::query_IgnoreCase), 208 !(settings & OContactAccess::IgnoreCase),
206 false ); 209 false );
207 if ( expr.find ( (*it).field(i), 0 ) == -1 ) 210 if ( expr.find ( (*it).field(i), 0 ) == -1 )
208 allcorrect = false; 211 allcorrect = false;
209 } 212 }
210 break; 213 break;
211 case OContactAccess::query_WildCards:{ 214 case OContactAccess::WildCards:{
212 QRegExp expr ( query.field(i), 215 QRegExp expr ( query.field(i),
213 !(settings & OContactAccess::query_IgnoreCase), 216 !(settings & OContactAccess::IgnoreCase),
214 true ); 217 true );
215 if ( expr.find ( (*it).field(i), 0 ) == -1 ) 218 if ( expr.find ( (*it).field(i), 0 ) == -1 )
216 allcorrect = false; 219 allcorrect = false;
217 } 220 }
218 break; 221 break;
219 case OContactAccess::query_ExactMatch:{ 222 case OContactAccess::ExactMatch:{
220 if (settings & OContactAccess::query_IgnoreCase){ 223 if (settings & OContactAccess::IgnoreCase){
221 if ( query.field(i).upper() != 224 if ( query.field(i).upper() !=
222 (*it).field(i).upper() ) 225 (*it).field(i).upper() )
223 allcorrect = false; 226 allcorrect = false;
@@ -243,24 +246,24 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
243 246
244 const uint querySettings() 247 const uint querySettings()
245 { 248 {
246 return ( OContactAccess::query_WildCards 249 return ( OContactAccess::WildCards
247 & OContactAccess::query_IgnoreCase 250 & OContactAccess::IgnoreCase
248 & OContactAccess::query_RegExp 251 & OContactAccess::RegExp
249 & OContactAccess::query_ExactMatch ); 252 & OContactAccess::ExactMatch );
250 } 253 }
251 254
252 bool hasQuerySettings (uint querySettings) const 255 bool hasQuerySettings (uint querySettings) const
253 { 256 {
254 /* OContactAccess::query_IgnoreCase may be added with one 257 /* OContactAccess::IgnoreCase may be added with one
255 * of the other settings, but never used alone. 258 * of the other settings, but never used alone.
256 * The other settings are just valid alone... 259 * The other settings are just valid alone...
257 */ 260 */
258 switch ( querySettings & ~OContactAccess::query_IgnoreCase ){ 261 switch ( querySettings & ~OContactAccess::IgnoreCase ){
259 case OContactAccess::query_RegExp: 262 case OContactAccess::RegExp:
260 return ( true ); 263 return ( true );
261 case OContactAccess::query_WildCards: 264 case OContactAccess::WildCards:
262 return ( true ); 265 return ( true );
263 case OContactAccess::query_ExactMatch: 266 case OContactAccess::ExactMatch:
264 return ( true ); 267 return ( true );
265 default: 268 default:
266 return ( false ); 269 return ( false );
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index f3b0783..3b4cab2 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -187,7 +187,7 @@ QArray<int> OTodoAccessXML::allRecords()const {
187 } 187 }
188 return ids; 188 return ids;
189} 189}
190QArray<int> OTodoAccessXML::queryByExample( const OTodo&, int sort ) { 190QArray<int> OTodoAccessXML::queryByExample( const OTodo&, int ) {
191 QArray<int> ids(0); 191 QArray<int> ids(0);
192 return ids; 192 return ids;
193} 193}
diff --git a/libopie2/opiepim/backend/otodoaccessxml.h b/libopie2/opiepim/backend/otodoaccessxml.h
index 1e7e371..dc41c32 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.h
+++ b/libopie2/opiepim/backend/otodoaccessxml.h
@@ -24,7 +24,7 @@ public:
24 bool save(); 24 bool save();
25 25
26 QArray<int> allRecords()const; 26 QArray<int> allRecords()const;
27 QArray<int> queryByExample( const OTodo&, int sort ); 27 QArray<int> queryByExample( const OTodo&, int querysettings );
28 OTodo find( int uid )const; 28 OTodo find( int uid )const;
29 void clear(); 29 void clear();
30 bool add( const OTodo& ); 30 bool add( const OTodo& );
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index b5f358b..e8c0a45 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -21,6 +21,9 @@
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.4 2002/10/14 16:21:54 eilers
25 * Some minor interface updates
26 *
24 * Revision 1.3 2002/10/07 17:34:24 eilers 27 * Revision 1.3 2002/10/07 17:34:24 eilers
25 * added OBackendFactory for advanced backend access 28 * added OBackendFactory for advanced backend access
26 * 29 *
@@ -66,7 +69,6 @@ OContactAccess::OContactAccess ( const QString appname, const QString ,
66 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 69 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
67 */ 70 */
68 if( end == 0 ) { 71 if( end == 0 ) {
69 // __asm__("int3");
70 qWarning ("Using BackendFactory !"); 72 qWarning ("Using BackendFactory !");
71 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); 73 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
72 } 74 }
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index 54f7f07..adc66cf 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -17,6 +17,9 @@
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.2 2002/10/14 16:21:54 eilers
21 * Some minor interface updates
22 *
20 * Revision 1.1 2002/09/27 17:11:44 eilers 23 * Revision 1.1 2002/09/27 17:11:44 eilers
21 * Added API for accessing the Contact-Database ! It is compiling, but 24 * Added API for accessing the Contact-Database ! It is compiling, but
22 * please do not expect that anything is working ! 25 * please do not expect that anything is working !
@@ -47,38 +50,6 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
47{ 50{
48 Q_OBJECT 51 Q_OBJECT
49 52
50
51 /* class Iterator{
52 friend OContactAccess;
53 public:
54 Iterator();
55 Iterator ( const Iterator& copy );
56
57 bool operator== ( const Iterator& it );
58 bool operator!= ( const Iterator& it );
59 Iterator& operator= ( const Iterator& it );
60 Iterator& operator++ (); // prefix
61 Iterator operator++ ( int ); // postfix
62 Iterator& operator-- (); // prefix
63 Iterator operator-- ( int ); // postfix
64 Contact operator*() const;
65 Contact operator->() const;
66
67 Iterator begin();
68 Iterator end();
69
70 uint count() const;
71
72 private:
73 QValueList<int> m_uids;
74 int m_cur_position;
75 bool m_end_reached;
76 OContactAccess *m_db;
77
78 };
79
80 */
81
82 public: 53 public:
83 /** Create Database with contacts (addressbook). 54 /** Create Database with contacts (addressbook).
84 * @param appname Name of application which wants access to the database 55 * @param appname Name of application which wants access to the database
@@ -91,7 +62,7 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
91 * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> 62 * automatically if it receives the signals <i>flush()</i> and <i>reload()</i>
92 * which are used before and after synchronisation. If the application wants 63 * which are used before and after synchronisation. If the application wants
93 * to react itself, it should be disabled by setting it to <b>false</b> 64 * to react itself, it should be disabled by setting it to <b>false</b>
94 * @see OContactBackend 65 * @see OContactAccessBackend
95 */ 66 */
96 OContactAccess (const QString appname, const QString filename = 0l, 67 OContactAccess (const QString appname, const QString filename = 0l,
97 OContactAccessBackend* backend = 0l, bool handlesync = true); 68 OContactAccessBackend* backend = 0l, bool handlesync = true);
@@ -101,13 +72,13 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
101 * Use this constants to set the query parameters. 72 * Use this constants to set the query parameters.
102 * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes ! 73 * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes !
103 * @see queryByExample() 74 * @see queryByExample()
104 * - why not enum - zecke?
105 * -> Had some implementation problems .. Will use enum soon ! .. (se)
106 */ 75 */
107 static const int query_WildCards = 0x0001; 76 enum QuerySettings {
108 static const int query_IgnoreCase = 0x0002; 77 WildCards = 0x0001,
109 static const int query_RegExp = 0x0004; 78 IgnoreCase = 0x0002,
110 static const int query_ExactMatch = 0x0008; 79 RegExp = 0x0004,
80 ExactMatch = 0x0008,
81 };
111 82
112 /** Return all possible settings. 83 /** Return all possible settings.
113 * @return All settings provided by the current backend 84 * @return All settings provided by the current backend
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index a0d8f63..3e1f393 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -27,13 +27,6 @@ public:
27 typedef OPimCache<T> Cache; 27 typedef OPimCache<T> Cache;
28 28
29 /** 29 /**
30 * our sort order
31 * should be safe explaining
32 */
33 enum SortOrder { WildCards = 0, IgnoreCase = 1,
34 RegExp = 2, ExactMatch = 4 };
35
36 /**
37 * c'tor BackEnd 30 * c'tor BackEnd
38 */ 31 */
39 OPimAccessTemplate( BackEnd* end); 32 OPimAccessTemplate( BackEnd* end);
@@ -66,9 +59,10 @@ public:
66 virtual List allRecords()const; 59 virtual List allRecords()const;
67 60
68 /** 61 /**
69 * queryByExample 62 * queryByExample)
63 * @see otodoaccess, ocontactaccess
70 */ 64 */
71 virtual List queryByExample( const T& t, int sortOrder ); 65 virtual List queryByExample( const T& t, int querySettings );
72 66
73 /** 67 /**
74 * find the OPimRecord uid 68 * find the OPimRecord uid