-rw-r--r-- | libopie/pim/ocontactaccessbackend_xml.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.cpp b/libopie/pim/ocontactaccessbackend_xml.cpp index 4abf4d9..9fe3d1e 100644 --- a/libopie/pim/ocontactaccessbackend_xml.cpp +++ b/libopie/pim/ocontactaccessbackend_xml.cpp | |||
@@ -1,43 +1,47 @@ | |||
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.3 2003/03/21 12:26:28 eilers | ||
21 | * Fixing small bug: If we search a birthday from today to today, it returned | ||
22 | * every contact .. | ||
23 | * | ||
20 | * Revision 1.2 2003/03/21 10:33:09 eilers | 24 | * Revision 1.2 2003/03/21 10:33:09 eilers |
21 | * Merged speed optimized xml backend for contacts to main. | 25 | * Merged speed optimized xml backend for contacts to main. |
22 | * Added QDateTime to querybyexample. For instance, it is now possible to get | 26 | * Added QDateTime to querybyexample. For instance, it is now possible to get |
23 | * all Birthdays/Anniversaries between two dates. This should be used | 27 | * all Birthdays/Anniversaries between two dates. This should be used |
24 | * to show all birthdays in the datebook.. | 28 | * to show all birthdays in the datebook.. |
25 | * This change is sourcecode backward compatible but you have to upgrade | 29 | * This change is sourcecode backward compatible but you have to upgrade |
26 | * the binaries for today-addressbook. | 30 | * the binaries for today-addressbook. |
27 | * | 31 | * |
28 | * Revision 1.1.2.2 2003/02/11 12:17:28 eilers | 32 | * Revision 1.1.2.2 2003/02/11 12:17:28 eilers |
29 | * Speed optimization. Removed the sequential search loops. | 33 | * Speed optimization. Removed the sequential search loops. |
30 | * | 34 | * |
31 | * Revision 1.1.2.1 2003/02/10 15:31:38 eilers | 35 | * Revision 1.1.2.1 2003/02/10 15:31:38 eilers |
32 | * Writing offsets to debug output.. | 36 | * Writing offsets to debug output.. |
33 | * | 37 | * |
34 | * Revision 1.1 2003/02/09 15:05:01 eilers | 38 | * Revision 1.1 2003/02/09 15:05:01 eilers |
35 | * Nothing happened.. Just some cleanup before I will start.. | 39 | * Nothing happened.. Just some cleanup before I will start.. |
36 | * | 40 | * |
37 | * Revision 1.12 2003/01/03 16:58:03 eilers | 41 | * Revision 1.12 2003/01/03 16:58:03 eilers |
38 | * Reenable debug output | 42 | * Reenable debug output |
39 | * | 43 | * |
40 | * Revision 1.11 2003/01/03 12:31:28 eilers | 44 | * Revision 1.11 2003/01/03 12:31:28 eilers |
41 | * Bugfix for calculating data diffs.. | 45 | * Bugfix for calculating data diffs.. |
42 | * | 46 | * |
43 | * Revision 1.10 2003/01/02 14:27:12 eilers | 47 | * Revision 1.10 2003/01/02 14:27:12 eilers |
@@ -304,49 +308,49 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
304 | // will take this date instead of | 308 | // will take this date instead of |
305 | // the current one.. | 309 | // the current one.. |
306 | if ( !d.date().isValid() ) | 310 | if ( !d.date().isValid() ) |
307 | current = QDate::currentDate(); | 311 | current = QDate::currentDate(); |
308 | else | 312 | else |
309 | current = d.date(); | 313 | current = d.date(); |
310 | 314 | ||
311 | // We have to equalize the year, otherwise | 315 | // We have to equalize the year, otherwise |
312 | // the search will fail.. | 316 | // the search will fail.. |
313 | checkDate->setYMD( current.year(), | 317 | checkDate->setYMD( current.year(), |
314 | checkDate->month(), | 318 | checkDate->month(), |
315 | checkDate->day() ); | 319 | checkDate->day() ); |
316 | if ( *checkDate < current ) | 320 | if ( *checkDate < current ) |
317 | checkDate->setYMD( current.year()+1, | 321 | checkDate->setYMD( current.year()+1, |
318 | checkDate->month(), | 322 | checkDate->month(), |
319 | checkDate->day() ); | 323 | checkDate->day() ); |
320 | 324 | ||
321 | // Check whether the birthday/anniversary date is between | 325 | // Check whether the birthday/anniversary date is between |
322 | // the current/given date and the maximum date | 326 | // the current/given date and the maximum date |
323 | // ( maximum time range ) ! | 327 | // ( maximum time range ) ! |
324 | qWarning("Checking if %s is between %s and %s ! ", | 328 | qWarning("Checking if %s is between %s and %s ! ", |
325 | checkDate->toString().latin1(), | 329 | checkDate->toString().latin1(), |
326 | current.toString().latin1(), | 330 | current.toString().latin1(), |
327 | queryDate->toString().latin1() ); | 331 | queryDate->toString().latin1() ); |
328 | if ( current.daysTo( *queryDate ) > 0 ){ | 332 | if ( current.daysTo( *queryDate ) >= 0 ){ |
329 | if ( !( ( *checkDate >= current ) && | 333 | if ( !( ( *checkDate >= current ) && |
330 | ( *checkDate <= *queryDate ) ) ){ | 334 | ( *checkDate <= *queryDate ) ) ){ |
331 | allcorrect = false; | 335 | allcorrect = false; |
332 | qWarning (" Nope!.."); | 336 | qWarning (" Nope!.."); |
333 | } | 337 | } |
334 | } | 338 | } |
335 | } | 339 | } |
336 | } else{ | 340 | } else{ |
337 | // checkDate is invalid. Therefore this entry is always rejected | 341 | // checkDate is invalid. Therefore this entry is always rejected |
338 | allcorrect = false; | 342 | allcorrect = false; |
339 | } | 343 | } |
340 | } | 344 | } |
341 | 345 | ||
342 | delete queryDate; | 346 | delete queryDate; |
343 | queryDate = 0l; | 347 | queryDate = 0l; |
344 | delete checkDate; | 348 | delete checkDate; |
345 | checkDate = 0l; | 349 | checkDate = 0l; |
346 | break; | 350 | break; |
347 | default: | 351 | default: |
348 | /* Just compare fields which are not empty in the query object */ | 352 | /* Just compare fields which are not empty in the query object */ |
349 | if ( !query.field(i).isEmpty() ){ | 353 | if ( !query.field(i).isEmpty() ){ |
350 | switch ( settings & ~( OContactAccess::IgnoreCase | 354 | switch ( settings & ~( OContactAccess::IgnoreCase |
351 | | OContactAccess::DateDiff | 355 | | OContactAccess::DateDiff |
352 | | OContactAccess::DateYear | 356 | | OContactAccess::DateYear |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp index 4abf4d9..9fe3d1e 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | |||
@@ -1,43 +1,47 @@ | |||
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.3 2003/03/21 12:26:28 eilers | ||
21 | * Fixing small bug: If we search a birthday from today to today, it returned | ||
22 | * every contact .. | ||
23 | * | ||
20 | * Revision 1.2 2003/03/21 10:33:09 eilers | 24 | * Revision 1.2 2003/03/21 10:33:09 eilers |
21 | * Merged speed optimized xml backend for contacts to main. | 25 | * Merged speed optimized xml backend for contacts to main. |
22 | * Added QDateTime to querybyexample. For instance, it is now possible to get | 26 | * Added QDateTime to querybyexample. For instance, it is now possible to get |
23 | * all Birthdays/Anniversaries between two dates. This should be used | 27 | * all Birthdays/Anniversaries between two dates. This should be used |
24 | * to show all birthdays in the datebook.. | 28 | * to show all birthdays in the datebook.. |
25 | * This change is sourcecode backward compatible but you have to upgrade | 29 | * This change is sourcecode backward compatible but you have to upgrade |
26 | * the binaries for today-addressbook. | 30 | * the binaries for today-addressbook. |
27 | * | 31 | * |
28 | * Revision 1.1.2.2 2003/02/11 12:17:28 eilers | 32 | * Revision 1.1.2.2 2003/02/11 12:17:28 eilers |
29 | * Speed optimization. Removed the sequential search loops. | 33 | * Speed optimization. Removed the sequential search loops. |
30 | * | 34 | * |
31 | * Revision 1.1.2.1 2003/02/10 15:31:38 eilers | 35 | * Revision 1.1.2.1 2003/02/10 15:31:38 eilers |
32 | * Writing offsets to debug output.. | 36 | * Writing offsets to debug output.. |
33 | * | 37 | * |
34 | * Revision 1.1 2003/02/09 15:05:01 eilers | 38 | * Revision 1.1 2003/02/09 15:05:01 eilers |
35 | * Nothing happened.. Just some cleanup before I will start.. | 39 | * Nothing happened.. Just some cleanup before I will start.. |
36 | * | 40 | * |
37 | * Revision 1.12 2003/01/03 16:58:03 eilers | 41 | * Revision 1.12 2003/01/03 16:58:03 eilers |
38 | * Reenable debug output | 42 | * Reenable debug output |
39 | * | 43 | * |
40 | * Revision 1.11 2003/01/03 12:31:28 eilers | 44 | * Revision 1.11 2003/01/03 12:31:28 eilers |
41 | * Bugfix for calculating data diffs.. | 45 | * Bugfix for calculating data diffs.. |
42 | * | 46 | * |
43 | * Revision 1.10 2003/01/02 14:27:12 eilers | 47 | * Revision 1.10 2003/01/02 14:27:12 eilers |
@@ -304,49 +308,49 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
304 | // will take this date instead of | 308 | // will take this date instead of |
305 | // the current one.. | 309 | // the current one.. |
306 | if ( !d.date().isValid() ) | 310 | if ( !d.date().isValid() ) |
307 | current = QDate::currentDate(); | 311 | current = QDate::currentDate(); |
308 | else | 312 | else |
309 | current = d.date(); | 313 | current = d.date(); |
310 | 314 | ||
311 | // We have to equalize the year, otherwise | 315 | // We have to equalize the year, otherwise |
312 | // the search will fail.. | 316 | // the search will fail.. |
313 | checkDate->setYMD( current.year(), | 317 | checkDate->setYMD( current.year(), |
314 | checkDate->month(), | 318 | checkDate->month(), |
315 | checkDate->day() ); | 319 | checkDate->day() ); |
316 | if ( *checkDate < current ) | 320 | if ( *checkDate < current ) |
317 | checkDate->setYMD( current.year()+1, | 321 | checkDate->setYMD( current.year()+1, |
318 | checkDate->month(), | 322 | checkDate->month(), |
319 | checkDate->day() ); | 323 | checkDate->day() ); |
320 | 324 | ||
321 | // Check whether the birthday/anniversary date is between | 325 | // Check whether the birthday/anniversary date is between |
322 | // the current/given date and the maximum date | 326 | // the current/given date and the maximum date |
323 | // ( maximum time range ) ! | 327 | // ( maximum time range ) ! |
324 | qWarning("Checking if %s is between %s and %s ! ", | 328 | qWarning("Checking if %s is between %s and %s ! ", |
325 | checkDate->toString().latin1(), | 329 | checkDate->toString().latin1(), |
326 | current.toString().latin1(), | 330 | current.toString().latin1(), |
327 | queryDate->toString().latin1() ); | 331 | queryDate->toString().latin1() ); |
328 | if ( current.daysTo( *queryDate ) > 0 ){ | 332 | if ( current.daysTo( *queryDate ) >= 0 ){ |
329 | if ( !( ( *checkDate >= current ) && | 333 | if ( !( ( *checkDate >= current ) && |
330 | ( *checkDate <= *queryDate ) ) ){ | 334 | ( *checkDate <= *queryDate ) ) ){ |
331 | allcorrect = false; | 335 | allcorrect = false; |
332 | qWarning (" Nope!.."); | 336 | qWarning (" Nope!.."); |
333 | } | 337 | } |
334 | } | 338 | } |
335 | } | 339 | } |
336 | } else{ | 340 | } else{ |
337 | // checkDate is invalid. Therefore this entry is always rejected | 341 | // checkDate is invalid. Therefore this entry is always rejected |
338 | allcorrect = false; | 342 | allcorrect = false; |
339 | } | 343 | } |
340 | } | 344 | } |
341 | 345 | ||
342 | delete queryDate; | 346 | delete queryDate; |
343 | queryDate = 0l; | 347 | queryDate = 0l; |
344 | delete checkDate; | 348 | delete checkDate; |
345 | checkDate = 0l; | 349 | checkDate = 0l; |
346 | break; | 350 | break; |
347 | default: | 351 | default: |
348 | /* Just compare fields which are not empty in the query object */ | 352 | /* Just compare fields which are not empty in the query object */ |
349 | if ( !query.field(i).isEmpty() ){ | 353 | if ( !query.field(i).isEmpty() ){ |
350 | switch ( settings & ~( OContactAccess::IgnoreCase | 354 | switch ( settings & ~( OContactAccess::IgnoreCase |
351 | | OContactAccess::DateDiff | 355 | | OContactAccess::DateDiff |
352 | | OContactAccess::DateYear | 356 | | OContactAccess::DateYear |