author | eilers <eilers> | 2003-01-03 16:58:03 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-01-03 16:58:03 (UTC) |
commit | 7a97cd36cbc4c1a82043cdd44c82f931e2cdbb7f (patch) (unidiff) | |
tree | 7b5b2eb5382b3b33ddc752d0b39312f5f00c04a7 | |
parent | d265299dd3d2ed39a343d3bdfd05eda6705a5c2c (diff) | |
download | opie-7a97cd36cbc4c1a82043cdd44c82f931e2cdbb7f.zip opie-7a97cd36cbc4c1a82043cdd44c82f931e2cdbb7f.tar.gz opie-7a97cd36cbc4c1a82043cdd44c82f931e2cdbb7f.tar.bz2 |
Reenable debug output
-rw-r--r-- | libopie/pim/ocontactaccessbackend_xml.h | 17 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_xml.h | 17 |
2 files changed, 22 insertions, 12 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h index 6a1c91d..6477705 100644 --- a/libopie/pim/ocontactaccessbackend_xml.h +++ b/libopie/pim/ocontactaccessbackend_xml.h | |||
@@ -1,67 +1,70 @@ | |||
1 | /* | 1 | /* |
2 | * XML Backend for the OPIE-Contact Database. | 2 | * XML Backend for the OPIE-Contact Database. |
3 | * | 3 | * |
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | 4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) |
5 | * | 5 | * |
6 | * ===================================================================== | 6 | * ===================================================================== |
7 | *This program is free software; you can redistribute it and/or | 7 | *This program is free software; you can redistribute it and/or |
8 | *modify it under the terms of the GNU Library General Public | 8 | *modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * ToDo: XML-Backend: Automatic reload if something was changed... | 12 | * ToDo: XML-Backend: Automatic reload if something was changed... |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * Version: $Id$ | 16 | * Version: $Id$ |
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * History: | 18 | * History: |
19 | * $Log$ | 19 | * $Log$ |
20 | * Revision 1.12 2003/01/03 16:58:03 eilers | ||
21 | * Reenable debug output | ||
22 | * | ||
20 | * Revision 1.11 2003/01/03 12:31:28 eilers | 23 | * Revision 1.11 2003/01/03 12:31:28 eilers |
21 | * Bugfix for calculating data diffs.. | 24 | * Bugfix for calculating data diffs.. |
22 | * | 25 | * |
23 | * Revision 1.10 2003/01/02 14:27:12 eilers | 26 | * Revision 1.10 2003/01/02 14:27:12 eilers |
24 | * Improved query by example: Search by date is possible.. First step | 27 | * Improved query by example: Search by date is possible.. First step |
25 | * for a today plugin for birthdays.. | 28 | * for a today plugin for birthdays.. |
26 | * | 29 | * |
27 | * Revision 1.9 2002/12/08 12:48:57 eilers | 30 | * Revision 1.9 2002/12/08 12:48:57 eilers |
28 | * Moved journal-enum from ocontact into i the xml-backend.. | 31 | * Moved journal-enum from ocontact into i the xml-backend.. |
29 | * | 32 | * |
30 | * Revision 1.8 2002/11/14 17:04:24 eilers | 33 | * Revision 1.8 2002/11/14 17:04:24 eilers |
31 | * Sorting will now work if fullname is identical on some entries | 34 | * Sorting will now work if fullname is identical on some entries |
32 | * | 35 | * |
33 | * Revision 1.7 2002/11/13 15:02:46 eilers | 36 | * Revision 1.7 2002/11/13 15:02:46 eilers |
34 | * Small Bug in sorted fixed | 37 | * Small Bug in sorted fixed |
35 | * | 38 | * |
36 | * Revision 1.6 2002/11/13 14:14:51 eilers | 39 | * Revision 1.6 2002/11/13 14:14:51 eilers |
37 | * Added sorted for Contacts.. | 40 | * Added sorted for Contacts.. |
38 | * | 41 | * |
39 | * Revision 1.5 2002/11/01 15:10:42 eilers | 42 | * Revision 1.5 2002/11/01 15:10:42 eilers |
40 | * Added regExp-search in database for all fields in a contact. | 43 | * Added regExp-search in database for all fields in a contact. |
41 | * | 44 | * |
42 | * Revision 1.4 2002/10/16 10:52:40 eilers | 45 | * Revision 1.4 2002/10/16 10:52:40 eilers |
43 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | 46 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) |
44 | * | 47 | * |
45 | * Revision 1.3 2002/10/14 16:21:54 eilers | 48 | * Revision 1.3 2002/10/14 16:21:54 eilers |
46 | * Some minor interface updates | 49 | * Some minor interface updates |
47 | * | 50 | * |
48 | * Revision 1.2 2002/10/07 17:34:24 eilers | 51 | * Revision 1.2 2002/10/07 17:34:24 eilers |
49 | * added OBackendFactory for advanced backend access | 52 | * added OBackendFactory for advanced backend access |
50 | * | 53 | * |
51 | * Revision 1.1 2002/09/27 17:11:44 eilers | 54 | * Revision 1.1 2002/09/27 17:11:44 eilers |
52 | * Added API for accessing the Contact-Database ! It is compiling, but | 55 | * Added API for accessing the Contact-Database ! It is compiling, but |
53 | * please do not expect that anything is working ! | 56 | * please do not expect that anything is working ! |
54 | * I will debug that stuff in the next time .. | 57 | * I will debug that stuff in the next time .. |
55 | * Please read README_COMPILE for compiling ! | 58 | * Please read README_COMPILE for compiling ! |
56 | * | 59 | * |
57 | * | 60 | * |
58 | */ | 61 | */ |
59 | 62 | ||
60 | #ifndef _OContactAccessBackend_XML_ | 63 | #ifndef _OContactAccessBackend_XML_ |
61 | #define _OContactAccessBackend_XML_ | 64 | #define _OContactAccessBackend_XML_ |
62 | 65 | ||
63 | #include <qasciidict.h> | 66 | #include <qasciidict.h> |
64 | #include <qdatetime.h> | 67 | #include <qdatetime.h> |
65 | #include <qfile.h> | 68 | #include <qfile.h> |
66 | #include <qfileinfo.h> | 69 | #include <qfileinfo.h> |
67 | #include <qregexp.h> | 70 | #include <qregexp.h> |
@@ -222,110 +225,112 @@ class OContactAccessBackend_XML : public OContactAccessBackend { | |||
222 | 225 | ||
223 | return ( foundContact ); | 226 | return ( foundContact ); |
224 | } | 227 | } |
225 | 228 | ||
226 | QArray<int> queryByExample ( const OContact &query, int settings ){ | 229 | QArray<int> queryByExample ( const OContact &query, int settings ){ |
227 | 230 | ||
228 | QArray<int> m_currentQuery( m_contactList.count() ); | 231 | QArray<int> m_currentQuery( m_contactList.count() ); |
229 | QValueListConstIterator<OContact> it; | 232 | QValueListConstIterator<OContact> it; |
230 | uint arraycounter = 0; | 233 | uint arraycounter = 0; |
231 | 234 | ||
232 | for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ | 235 | for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ |
233 | /* Search all fields and compare them with query object. Store them into list | 236 | /* Search all fields and compare them with query object. Store them into list |
234 | * if all fields matches. | 237 | * if all fields matches. |
235 | */ | 238 | */ |
236 | QDate* queryDate = 0l; | 239 | QDate* queryDate = 0l; |
237 | QDate* checkDate = 0l; | 240 | QDate* checkDate = 0l; |
238 | bool allcorrect = true; | 241 | bool allcorrect = true; |
239 | for ( int i = 0; i < Qtopia::Groups; i++ ) { | 242 | for ( int i = 0; i < Qtopia::Groups; i++ ) { |
240 | // Birthday and anniversary are special nonstring fields and should | 243 | // Birthday and anniversary are special nonstring fields and should |
241 | // be handled specially | 244 | // be handled specially |
242 | switch ( i ){ | 245 | switch ( i ){ |
243 | case Qtopia::Birthday: | 246 | case Qtopia::Birthday: |
244 | queryDate = new QDate( query.birthday() ); | 247 | queryDate = new QDate( query.birthday() ); |
245 | checkDate = new QDate( (*it).birthday() ); | 248 | checkDate = new QDate( (*it).birthday() ); |
246 | case Qtopia::Anniversary: | 249 | case Qtopia::Anniversary: |
247 | if ( queryDate == 0l ){ | 250 | if ( queryDate == 0l ){ |
248 | queryDate = new QDate( query.anniversary() ); | 251 | queryDate = new QDate( query.anniversary() ); |
249 | checkDate = new QDate( (*it).anniversary() ); | 252 | checkDate = new QDate( (*it).anniversary() ); |
250 | } | 253 | } |
251 | 254 | ||
252 | if ( queryDate->isValid() ){ | 255 | if ( queryDate->isValid() ){ |
253 | if( checkDate->isValid() ){ | 256 | if( checkDate->isValid() ){ |
254 | if ( settings & OContactAccess::DateYear ){ | 257 | if ( settings & OContactAccess::DateYear ){ |
255 | if ( queryDate->year() != checkDate->year() ) | 258 | if ( queryDate->year() != checkDate->year() ) |
256 | allcorrect = false; | 259 | allcorrect = false; |
257 | } | 260 | } |
258 | if ( settings & OContactAccess::DateMonth ){ | 261 | if ( settings & OContactAccess::DateMonth ){ |
259 | if ( queryDate->month() != checkDate->month() ) | 262 | if ( queryDate->month() != checkDate->month() ) |
260 | allcorrect = false; | 263 | allcorrect = false; |
261 | } | 264 | } |
262 | if ( settings & OContactAccess::DateDay ){ | 265 | if ( settings & OContactAccess::DateDay ){ |
263 | if ( queryDate->day() != checkDate->day() ) | 266 | if ( queryDate->day() != checkDate->day() ) |
264 | allcorrect = false; | 267 | allcorrect = false; |
265 | } | 268 | } |
266 | if ( settings & OContactAccess::DateDiff ) { | 269 | if ( settings & OContactAccess::DateDiff ) { |
267 | QDate current = QDate::currentDate(); | 270 | QDate current = QDate::currentDate(); |
268 | // We have to equalize the year, otherwise | 271 | // We have to equalize the year, otherwise |
269 | // the search will fail.. | 272 | // the search will fail.. |
270 | checkDate->setYMD( current.year(), checkDate->month(), checkDate->day() ); | 273 | checkDate->setYMD( current.year(), |
274 | checkDate->month(), | ||
275 | checkDate->day() ); | ||
271 | if ( *checkDate < current ) | 276 | if ( *checkDate < current ) |
272 | checkDate->setYMD( current.year()+1, | 277 | checkDate->setYMD( current.year()+1, |
273 | checkDate->month(), | 278 | checkDate->month(), |
274 | checkDate->day() ); | 279 | checkDate->day() ); |
275 | // qWarning("Checking if %s is between %s and %s ! ", | 280 | qWarning("Checking if %s is between %s and %s ! ", |
276 | // checkDate->toString().latin1(), | 281 | checkDate->toString().latin1(), |
277 | // current.toString().latin1(), | 282 | current.toString().latin1(), |
278 | // queryDate->toString().latin1() ); | 283 | queryDate->toString().latin1() ); |
279 | if ( current.daysTo( *queryDate ) > 0 ){ | 284 | if ( current.daysTo( *queryDate ) > 0 ){ |
280 | if ( !( ( *checkDate >= current ) && | 285 | if ( !( ( *checkDate >= current ) && |
281 | ( *checkDate <= *queryDate ) ) ){ | 286 | ( *checkDate <= *queryDate ) ) ){ |
282 | allcorrect = false; | 287 | allcorrect = false; |
283 | //qWarning (" Nope!.."); | 288 | qWarning (" Nope!.."); |
284 | } | 289 | } |
285 | } | 290 | } |
286 | } | 291 | } |
287 | } else{ | 292 | } else{ |
288 | // checkDate is invalid. Therfore this entry is always rejected | 293 | // checkDate is invalid. Therfore this entry is always rejected |
289 | allcorrect = false; | 294 | allcorrect = false; |
290 | } | 295 | } |
291 | } | 296 | } |
292 | 297 | ||
293 | delete queryDate; | 298 | delete queryDate; |
294 | queryDate = 0l; | 299 | queryDate = 0l; |
295 | delete checkDate; | 300 | delete checkDate; |
296 | checkDate = 0l; | 301 | checkDate = 0l; |
297 | break; | 302 | break; |
298 | default: | 303 | default: |
299 | /* Just compare fields which are not empty in the query object */ | 304 | /* Just compare fields which are not empty in the query object */ |
300 | if ( !query.field(i).isEmpty() ){ | 305 | if ( !query.field(i).isEmpty() ){ |
301 | switch ( settings & ~( OContactAccess::IgnoreCase | 306 | switch ( settings & ~( OContactAccess::IgnoreCase |
302 | | OContactAccess::DateDiff | 307 | | OContactAccess::DateDiff |
303 | | OContactAccess::DateYear | 308 | | OContactAccess::DateYear |
304 | | OContactAccess::DateMonth | 309 | | OContactAccess::DateMonth |
305 | | OContactAccess::DateDay | 310 | | OContactAccess::DateDay |
306 | | OContactAccess::MatchOne | 311 | | OContactAccess::MatchOne |
307 | ) ){ | 312 | ) ){ |
308 | 313 | ||
309 | case OContactAccess::RegExp:{ | 314 | case OContactAccess::RegExp:{ |
310 | QRegExp expr ( query.field(i), | 315 | QRegExp expr ( query.field(i), |
311 | !(settings & OContactAccess::IgnoreCase), | 316 | !(settings & OContactAccess::IgnoreCase), |
312 | false ); | 317 | false ); |
313 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) | 318 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) |
314 | allcorrect = false; | 319 | allcorrect = false; |
315 | } | 320 | } |
316 | break; | 321 | break; |
317 | case OContactAccess::WildCards:{ | 322 | case OContactAccess::WildCards:{ |
318 | QRegExp expr ( query.field(i), | 323 | QRegExp expr ( query.field(i), |
319 | !(settings & OContactAccess::IgnoreCase), | 324 | !(settings & OContactAccess::IgnoreCase), |
320 | true ); | 325 | true ); |
321 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) | 326 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) |
322 | allcorrect = false; | 327 | allcorrect = false; |
323 | } | 328 | } |
324 | break; | 329 | break; |
325 | case OContactAccess::ExactMatch:{ | 330 | case OContactAccess::ExactMatch:{ |
326 | if (settings & OContactAccess::IgnoreCase){ | 331 | if (settings & OContactAccess::IgnoreCase){ |
327 | if ( query.field(i).upper() != | 332 | if ( query.field(i).upper() != |
328 | (*it).field(i).upper() ) | 333 | (*it).field(i).upper() ) |
329 | allcorrect = false; | 334 | allcorrect = false; |
330 | }else{ | 335 | }else{ |
331 | if ( query.field(i) != (*it).field(i) ) | 336 | if ( query.field(i) != (*it).field(i) ) |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h index 6a1c91d..6477705 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h | |||
@@ -1,67 +1,70 @@ | |||
1 | /* | 1 | /* |
2 | * XML Backend for the OPIE-Contact Database. | 2 | * XML Backend for the OPIE-Contact Database. |
3 | * | 3 | * |
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | 4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) |
5 | * | 5 | * |
6 | * ===================================================================== | 6 | * ===================================================================== |
7 | *This program is free software; you can redistribute it and/or | 7 | *This program is free software; you can redistribute it and/or |
8 | *modify it under the terms of the GNU Library General Public | 8 | *modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * ToDo: XML-Backend: Automatic reload if something was changed... | 12 | * ToDo: XML-Backend: Automatic reload if something was changed... |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * Version: $Id$ | 16 | * Version: $Id$ |
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * History: | 18 | * History: |
19 | * $Log$ | 19 | * $Log$ |
20 | * Revision 1.12 2003/01/03 16:58:03 eilers | ||
21 | * Reenable debug output | ||
22 | * | ||
20 | * Revision 1.11 2003/01/03 12:31:28 eilers | 23 | * Revision 1.11 2003/01/03 12:31:28 eilers |
21 | * Bugfix for calculating data diffs.. | 24 | * Bugfix for calculating data diffs.. |
22 | * | 25 | * |
23 | * Revision 1.10 2003/01/02 14:27:12 eilers | 26 | * Revision 1.10 2003/01/02 14:27:12 eilers |
24 | * Improved query by example: Search by date is possible.. First step | 27 | * Improved query by example: Search by date is possible.. First step |
25 | * for a today plugin for birthdays.. | 28 | * for a today plugin for birthdays.. |
26 | * | 29 | * |
27 | * Revision 1.9 2002/12/08 12:48:57 eilers | 30 | * Revision 1.9 2002/12/08 12:48:57 eilers |
28 | * Moved journal-enum from ocontact into i the xml-backend.. | 31 | * Moved journal-enum from ocontact into i the xml-backend.. |
29 | * | 32 | * |
30 | * Revision 1.8 2002/11/14 17:04:24 eilers | 33 | * Revision 1.8 2002/11/14 17:04:24 eilers |
31 | * Sorting will now work if fullname is identical on some entries | 34 | * Sorting will now work if fullname is identical on some entries |
32 | * | 35 | * |
33 | * Revision 1.7 2002/11/13 15:02:46 eilers | 36 | * Revision 1.7 2002/11/13 15:02:46 eilers |
34 | * Small Bug in sorted fixed | 37 | * Small Bug in sorted fixed |
35 | * | 38 | * |
36 | * Revision 1.6 2002/11/13 14:14:51 eilers | 39 | * Revision 1.6 2002/11/13 14:14:51 eilers |
37 | * Added sorted for Contacts.. | 40 | * Added sorted for Contacts.. |
38 | * | 41 | * |
39 | * Revision 1.5 2002/11/01 15:10:42 eilers | 42 | * Revision 1.5 2002/11/01 15:10:42 eilers |
40 | * Added regExp-search in database for all fields in a contact. | 43 | * Added regExp-search in database for all fields in a contact. |
41 | * | 44 | * |
42 | * Revision 1.4 2002/10/16 10:52:40 eilers | 45 | * Revision 1.4 2002/10/16 10:52:40 eilers |
43 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | 46 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) |
44 | * | 47 | * |
45 | * Revision 1.3 2002/10/14 16:21:54 eilers | 48 | * Revision 1.3 2002/10/14 16:21:54 eilers |
46 | * Some minor interface updates | 49 | * Some minor interface updates |
47 | * | 50 | * |
48 | * Revision 1.2 2002/10/07 17:34:24 eilers | 51 | * Revision 1.2 2002/10/07 17:34:24 eilers |
49 | * added OBackendFactory for advanced backend access | 52 | * added OBackendFactory for advanced backend access |
50 | * | 53 | * |
51 | * Revision 1.1 2002/09/27 17:11:44 eilers | 54 | * Revision 1.1 2002/09/27 17:11:44 eilers |
52 | * Added API for accessing the Contact-Database ! It is compiling, but | 55 | * Added API for accessing the Contact-Database ! It is compiling, but |
53 | * please do not expect that anything is working ! | 56 | * please do not expect that anything is working ! |
54 | * I will debug that stuff in the next time .. | 57 | * I will debug that stuff in the next time .. |
55 | * Please read README_COMPILE for compiling ! | 58 | * Please read README_COMPILE for compiling ! |
56 | * | 59 | * |
57 | * | 60 | * |
58 | */ | 61 | */ |
59 | 62 | ||
60 | #ifndef _OContactAccessBackend_XML_ | 63 | #ifndef _OContactAccessBackend_XML_ |
61 | #define _OContactAccessBackend_XML_ | 64 | #define _OContactAccessBackend_XML_ |
62 | 65 | ||
63 | #include <qasciidict.h> | 66 | #include <qasciidict.h> |
64 | #include <qdatetime.h> | 67 | #include <qdatetime.h> |
65 | #include <qfile.h> | 68 | #include <qfile.h> |
66 | #include <qfileinfo.h> | 69 | #include <qfileinfo.h> |
67 | #include <qregexp.h> | 70 | #include <qregexp.h> |
@@ -222,110 +225,112 @@ class OContactAccessBackend_XML : public OContactAccessBackend { | |||
222 | 225 | ||
223 | return ( foundContact ); | 226 | return ( foundContact ); |
224 | } | 227 | } |
225 | 228 | ||
226 | QArray<int> queryByExample ( const OContact &query, int settings ){ | 229 | QArray<int> queryByExample ( const OContact &query, int settings ){ |
227 | 230 | ||
228 | QArray<int> m_currentQuery( m_contactList.count() ); | 231 | QArray<int> m_currentQuery( m_contactList.count() ); |
229 | QValueListConstIterator<OContact> it; | 232 | QValueListConstIterator<OContact> it; |
230 | uint arraycounter = 0; | 233 | uint arraycounter = 0; |
231 | 234 | ||
232 | for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ | 235 | for( it = m_contactList.begin(); it != m_contactList.end(); ++it ){ |
233 | /* Search all fields and compare them with query object. Store them into list | 236 | /* Search all fields and compare them with query object. Store them into list |
234 | * if all fields matches. | 237 | * if all fields matches. |
235 | */ | 238 | */ |
236 | QDate* queryDate = 0l; | 239 | QDate* queryDate = 0l; |
237 | QDate* checkDate = 0l; | 240 | QDate* checkDate = 0l; |
238 | bool allcorrect = true; | 241 | bool allcorrect = true; |
239 | for ( int i = 0; i < Qtopia::Groups; i++ ) { | 242 | for ( int i = 0; i < Qtopia::Groups; i++ ) { |
240 | // Birthday and anniversary are special nonstring fields and should | 243 | // Birthday and anniversary are special nonstring fields and should |
241 | // be handled specially | 244 | // be handled specially |
242 | switch ( i ){ | 245 | switch ( i ){ |
243 | case Qtopia::Birthday: | 246 | case Qtopia::Birthday: |
244 | queryDate = new QDate( query.birthday() ); | 247 | queryDate = new QDate( query.birthday() ); |
245 | checkDate = new QDate( (*it).birthday() ); | 248 | checkDate = new QDate( (*it).birthday() ); |
246 | case Qtopia::Anniversary: | 249 | case Qtopia::Anniversary: |
247 | if ( queryDate == 0l ){ | 250 | if ( queryDate == 0l ){ |
248 | queryDate = new QDate( query.anniversary() ); | 251 | queryDate = new QDate( query.anniversary() ); |
249 | checkDate = new QDate( (*it).anniversary() ); | 252 | checkDate = new QDate( (*it).anniversary() ); |
250 | } | 253 | } |
251 | 254 | ||
252 | if ( queryDate->isValid() ){ | 255 | if ( queryDate->isValid() ){ |
253 | if( checkDate->isValid() ){ | 256 | if( checkDate->isValid() ){ |
254 | if ( settings & OContactAccess::DateYear ){ | 257 | if ( settings & OContactAccess::DateYear ){ |
255 | if ( queryDate->year() != checkDate->year() ) | 258 | if ( queryDate->year() != checkDate->year() ) |
256 | allcorrect = false; | 259 | allcorrect = false; |
257 | } | 260 | } |
258 | if ( settings & OContactAccess::DateMonth ){ | 261 | if ( settings & OContactAccess::DateMonth ){ |
259 | if ( queryDate->month() != checkDate->month() ) | 262 | if ( queryDate->month() != checkDate->month() ) |
260 | allcorrect = false; | 263 | allcorrect = false; |
261 | } | 264 | } |
262 | if ( settings & OContactAccess::DateDay ){ | 265 | if ( settings & OContactAccess::DateDay ){ |
263 | if ( queryDate->day() != checkDate->day() ) | 266 | if ( queryDate->day() != checkDate->day() ) |
264 | allcorrect = false; | 267 | allcorrect = false; |
265 | } | 268 | } |
266 | if ( settings & OContactAccess::DateDiff ) { | 269 | if ( settings & OContactAccess::DateDiff ) { |
267 | QDate current = QDate::currentDate(); | 270 | QDate current = QDate::currentDate(); |
268 | // We have to equalize the year, otherwise | 271 | // We have to equalize the year, otherwise |
269 | // the search will fail.. | 272 | // the search will fail.. |
270 | checkDate->setYMD( current.year(), checkDate->month(), checkDate->day() ); | 273 | checkDate->setYMD( current.year(), |
274 | checkDate->month(), | ||
275 | checkDate->day() ); | ||
271 | if ( *checkDate < current ) | 276 | if ( *checkDate < current ) |
272 | checkDate->setYMD( current.year()+1, | 277 | checkDate->setYMD( current.year()+1, |
273 | checkDate->month(), | 278 | checkDate->month(), |
274 | checkDate->day() ); | 279 | checkDate->day() ); |
275 | // qWarning("Checking if %s is between %s and %s ! ", | 280 | qWarning("Checking if %s is between %s and %s ! ", |
276 | // checkDate->toString().latin1(), | 281 | checkDate->toString().latin1(), |
277 | // current.toString().latin1(), | 282 | current.toString().latin1(), |
278 | // queryDate->toString().latin1() ); | 283 | queryDate->toString().latin1() ); |
279 | if ( current.daysTo( *queryDate ) > 0 ){ | 284 | if ( current.daysTo( *queryDate ) > 0 ){ |
280 | if ( !( ( *checkDate >= current ) && | 285 | if ( !( ( *checkDate >= current ) && |
281 | ( *checkDate <= *queryDate ) ) ){ | 286 | ( *checkDate <= *queryDate ) ) ){ |
282 | allcorrect = false; | 287 | allcorrect = false; |
283 | //qWarning (" Nope!.."); | 288 | qWarning (" Nope!.."); |
284 | } | 289 | } |
285 | } | 290 | } |
286 | } | 291 | } |
287 | } else{ | 292 | } else{ |
288 | // checkDate is invalid. Therfore this entry is always rejected | 293 | // checkDate is invalid. Therfore this entry is always rejected |
289 | allcorrect = false; | 294 | allcorrect = false; |
290 | } | 295 | } |
291 | } | 296 | } |
292 | 297 | ||
293 | delete queryDate; | 298 | delete queryDate; |
294 | queryDate = 0l; | 299 | queryDate = 0l; |
295 | delete checkDate; | 300 | delete checkDate; |
296 | checkDate = 0l; | 301 | checkDate = 0l; |
297 | break; | 302 | break; |
298 | default: | 303 | default: |
299 | /* Just compare fields which are not empty in the query object */ | 304 | /* Just compare fields which are not empty in the query object */ |
300 | if ( !query.field(i).isEmpty() ){ | 305 | if ( !query.field(i).isEmpty() ){ |
301 | switch ( settings & ~( OContactAccess::IgnoreCase | 306 | switch ( settings & ~( OContactAccess::IgnoreCase |
302 | | OContactAccess::DateDiff | 307 | | OContactAccess::DateDiff |
303 | | OContactAccess::DateYear | 308 | | OContactAccess::DateYear |
304 | | OContactAccess::DateMonth | 309 | | OContactAccess::DateMonth |
305 | | OContactAccess::DateDay | 310 | | OContactAccess::DateDay |
306 | | OContactAccess::MatchOne | 311 | | OContactAccess::MatchOne |
307 | ) ){ | 312 | ) ){ |
308 | 313 | ||
309 | case OContactAccess::RegExp:{ | 314 | case OContactAccess::RegExp:{ |
310 | QRegExp expr ( query.field(i), | 315 | QRegExp expr ( query.field(i), |
311 | !(settings & OContactAccess::IgnoreCase), | 316 | !(settings & OContactAccess::IgnoreCase), |
312 | false ); | 317 | false ); |
313 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) | 318 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) |
314 | allcorrect = false; | 319 | allcorrect = false; |
315 | } | 320 | } |
316 | break; | 321 | break; |
317 | case OContactAccess::WildCards:{ | 322 | case OContactAccess::WildCards:{ |
318 | QRegExp expr ( query.field(i), | 323 | QRegExp expr ( query.field(i), |
319 | !(settings & OContactAccess::IgnoreCase), | 324 | !(settings & OContactAccess::IgnoreCase), |
320 | true ); | 325 | true ); |
321 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) | 326 | if ( expr.find ( (*it).field(i), 0 ) == -1 ) |
322 | allcorrect = false; | 327 | allcorrect = false; |
323 | } | 328 | } |
324 | break; | 329 | break; |
325 | case OContactAccess::ExactMatch:{ | 330 | case OContactAccess::ExactMatch:{ |
326 | if (settings & OContactAccess::IgnoreCase){ | 331 | if (settings & OContactAccess::IgnoreCase){ |
327 | if ( query.field(i).upper() != | 332 | if ( query.field(i).upper() != |
328 | (*it).field(i).upper() ) | 333 | (*it).field(i).upper() ) |
329 | allcorrect = false; | 334 | allcorrect = false; |
330 | }else{ | 335 | }else{ |
331 | if ( query.field(i) != (*it).field(i) ) | 336 | if ( query.field(i) != (*it).field(i) ) |