summaryrefslogtreecommitdiff
path: root/libopie2
authoreilers <eilers>2003-01-03 12:31:28 (UTC)
committer eilers <eilers>2003-01-03 12:31:28 (UTC)
commit54ebecbfd86a9ce6782dc55dad7ae15c73adef21 (patch) (unidiff)
treea3934153aafb2d5e05186a5965e45f6d4dc267ec /libopie2
parentf1a3efd2d335b59aaa63bbf542abba524774b2d3 (diff)
downloadopie-54ebecbfd86a9ce6782dc55dad7ae15c73adef21.zip
opie-54ebecbfd86a9ce6782dc55dad7ae15c73adef21.tar.gz
opie-54ebecbfd86a9ce6782dc55dad7ae15c73adef21.tar.bz2
Bugfix for calculating data diffs..
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h57
1 files changed, 39 insertions, 18 deletions
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
@@ -19,2 +19,5 @@
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
@@ -237,3 +240,3 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
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 ){
@@ -249,21 +252,39 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
249 if ( queryDate->isValid() ){ 252 if ( queryDate->isValid() ){
250 if ( settings & OContactAccess::DateYear ){ 253 if( checkDate->isValid() ){
251 if ( queryDate->year() != checkDate->year() ) 254 if ( settings & OContactAccess::DateYear ){
252 allcorrect = false; 255 if ( queryDate->year() != checkDate->year() )
253 } 256 allcorrect = false;
254 if ( settings & OContactAccess::DateMonth ){ 257 }
255 if ( queryDate->month() != checkDate->month() ) 258 if ( settings & OContactAccess::DateMonth ){
256 allcorrect = false; 259 if ( queryDate->month() != checkDate->month() )
257 } 260 allcorrect = false;
258 if ( settings & OContactAccess::DateDay ){ 261 }
259 if ( queryDate->day() != checkDate->day() ) 262 if ( settings & OContactAccess::DateDay ){
260 allcorrect = false; 263 if ( queryDate->day() != checkDate->day() )
261 }
262 if ( settings & OContactAccess::DateDiff ) {
263 QDate current = QDate::currentDate();
264 if ( current.daysTo( *queryDate ) > 0 ){
265 if ( !( ( *checkDate >= current ) &&
266 ( *checkDate <= *queryDate ) ) )
267 allcorrect = false; 264 allcorrect = false;
265 }
266 if ( settings & OContactAccess::DateDiff ) {
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() );
279 if ( current.daysTo( *queryDate ) > 0 ){
280 if ( !( ( *checkDate >= current ) &&
281 ( *checkDate <= *queryDate ) ) ){
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 }