summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h25
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h25
2 files changed, 46 insertions, 4 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index c6e6cbc..6a1c91d 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/libopie/pim/ocontactaccessbackend_xml.h
@@ -16,8 +16,11 @@
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.11 2003/01/03 12:31:28 eilers
21 * Bugfix for calculating data diffs..
22 *
20 * Revision 1.10 2003/01/02 14:27:12 eilers 23 * Revision 1.10 2003/01/02 14:27:12 eilers
21 * Improved query by example: Search by date is possible.. First step 24 * Improved query by example: Search by date is possible.. First step
22 * for a today plugin for birthdays.. 25 * for a today plugin for birthdays..
23 * 26 *
@@ -234,9 +237,9 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
234 QDate* checkDate = 0l; 237 QDate* checkDate = 0l;
235 bool allcorrect = true; 238 bool allcorrect = true;
236 for ( int i = 0; i < Qtopia::Groups; i++ ) { 239 for ( int i = 0; i < Qtopia::Groups; i++ ) {
237 // Birthday and anniversary are special nonstring fields and should 240 // Birthday and anniversary are special nonstring fields and should
238 // be handled especially 241 // be handled specially
239 switch ( i ){ 242 switch ( i ){
240 case Qtopia::Birthday: 243 case Qtopia::Birthday:
241 queryDate = new QDate( query.birthday() ); 244 queryDate = new QDate( query.birthday() );
242 checkDate = new QDate( (*it).birthday() ); 245 checkDate = new QDate( (*it).birthday() );
@@ -246,8 +249,9 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
246 checkDate = new QDate( (*it).anniversary() ); 249 checkDate = new QDate( (*it).anniversary() );
247 } 250 }
248 251
249 if ( queryDate->isValid() ){ 252 if ( queryDate->isValid() ){
253 if( checkDate->isValid() ){
250 if ( settings & OContactAccess::DateYear ){ 254 if ( settings & OContactAccess::DateYear ){
251 if ( queryDate->year() != checkDate->year() ) 255 if ( queryDate->year() != checkDate->year() )
252 allcorrect = false; 256 allcorrect = false;
253 } 257 }
@@ -260,13 +264,30 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
260 allcorrect = false; 264 allcorrect = false;
261 } 265 }
262 if ( settings & OContactAccess::DateDiff ) { 266 if ( settings & OContactAccess::DateDiff ) {
263 QDate current = QDate::currentDate(); 267 QDate current = QDate::currentDate();
268 // We have to equalize the year, otherwise
269 // the search will fail..
270 checkDate->setYMD( current.year(), checkDate->month(), checkDate->day() );
271 if ( *checkDate < current )
272 checkDate->setYMD( current.year()+1,
273 checkDate->month(),
274 checkDate->day() );
275 // qWarning("Checking if %s is between %s and %s ! ",
276 // checkDate->toString().latin1(),
277 // current.toString().latin1(),
278 // queryDate->toString().latin1() );
264 if ( current.daysTo( *queryDate ) > 0 ){ 279 if ( current.daysTo( *queryDate ) > 0 ){
265 if ( !( ( *checkDate >= current ) && 280 if ( !( ( *checkDate >= current ) &&
266 ( *checkDate <= *queryDate ) ) ) 281 ( *checkDate <= *queryDate ) ) ){
267 allcorrect = false; 282 allcorrect = false;
283 //qWarning (" Nope!..");
284 }
285 }
268 } 286 }
287 } else{
288 // checkDate is invalid. Therfore this entry is always rejected
289 allcorrect = false;
269 } 290 }
270 } 291 }
271 292
272 delete queryDate; 293 delete queryDate;
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index c6e6cbc..6a1c91d 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -16,8 +16,11 @@
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.11 2003/01/03 12:31:28 eilers
21 * Bugfix for calculating data diffs..
22 *
20 * Revision 1.10 2003/01/02 14:27:12 eilers 23 * Revision 1.10 2003/01/02 14:27:12 eilers
21 * Improved query by example: Search by date is possible.. First step 24 * Improved query by example: Search by date is possible.. First step
22 * for a today plugin for birthdays.. 25 * for a today plugin for birthdays..
23 * 26 *
@@ -234,9 +237,9 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
234 QDate* checkDate = 0l; 237 QDate* checkDate = 0l;
235 bool allcorrect = true; 238 bool allcorrect = true;
236 for ( int i = 0; i < Qtopia::Groups; i++ ) { 239 for ( int i = 0; i < Qtopia::Groups; i++ ) {
237 // Birthday and anniversary are special nonstring fields and should 240 // Birthday and anniversary are special nonstring fields and should
238 // be handled especially 241 // be handled specially
239 switch ( i ){ 242 switch ( i ){
240 case Qtopia::Birthday: 243 case Qtopia::Birthday:
241 queryDate = new QDate( query.birthday() ); 244 queryDate = new QDate( query.birthday() );
242 checkDate = new QDate( (*it).birthday() ); 245 checkDate = new QDate( (*it).birthday() );
@@ -246,8 +249,9 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
246 checkDate = new QDate( (*it).anniversary() ); 249 checkDate = new QDate( (*it).anniversary() );
247 } 250 }
248 251
249 if ( queryDate->isValid() ){ 252 if ( queryDate->isValid() ){
253 if( checkDate->isValid() ){
250 if ( settings & OContactAccess::DateYear ){ 254 if ( settings & OContactAccess::DateYear ){
251 if ( queryDate->year() != checkDate->year() ) 255 if ( queryDate->year() != checkDate->year() )
252 allcorrect = false; 256 allcorrect = false;
253 } 257 }
@@ -260,13 +264,30 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
260 allcorrect = false; 264 allcorrect = false;
261 } 265 }
262 if ( settings & OContactAccess::DateDiff ) { 266 if ( settings & OContactAccess::DateDiff ) {
263 QDate current = QDate::currentDate(); 267 QDate current = QDate::currentDate();
268 // We have to equalize the year, otherwise
269 // the search will fail..
270 checkDate->setYMD( current.year(), checkDate->month(), checkDate->day() );
271 if ( *checkDate < current )
272 checkDate->setYMD( current.year()+1,
273 checkDate->month(),
274 checkDate->day() );
275 // qWarning("Checking if %s is between %s and %s ! ",
276 // checkDate->toString().latin1(),
277 // current.toString().latin1(),
278 // queryDate->toString().latin1() );
264 if ( current.daysTo( *queryDate ) > 0 ){ 279 if ( current.daysTo( *queryDate ) > 0 ){
265 if ( !( ( *checkDate >= current ) && 280 if ( !( ( *checkDate >= current ) &&
266 ( *checkDate <= *queryDate ) ) ) 281 ( *checkDate <= *queryDate ) ) ){
267 allcorrect = false; 282 allcorrect = false;
283 //qWarning (" Nope!..");
284 }
285 }
268 } 286 }
287 } else{
288 // checkDate is invalid. Therfore this entry is always rejected
289 allcorrect = false;
269 } 290 }
270 } 291 }
271 292
272 delete queryDate; 293 delete queryDate;