summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
authoreilers <eilers>2003-07-07 16:19:47 (UTC)
committer eilers <eilers>2003-07-07 16:19:47 (UTC)
commit7fed22ccbc1272fe0c5fb1c7f47bc330f118b854 (patch) (unidiff)
tree73bd04b4fa6592f2a4caeee503c9a32ac89e24e8 /libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
parent1c24ec58bd7fc8a0a46cdaf41e4c6b7e68e4dba6 (diff)
downloadopie-7fed22ccbc1272fe0c5fb1c7f47bc330f118b854.zip
opie-7fed22ccbc1272fe0c5fb1c7f47bc330f118b854.tar.gz
opie-7fed22ccbc1272fe0c5fb1c7f47bc330f118b854.tar.bz2
Fixing serious bug in hasQuerySettings()
Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index 661cd51..097142b 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.6 2003/07/07 16:19:47 eilers
21 * Fixing serious bug in hasQuerySettings()
22 *
20 * Revision 1.5 2003/04/13 18:07:10 zecke 23 * Revision 1.5 2003/04/13 18:07:10 zecke
21 * More API doc 24 * More API doc
22 * QString -> const QString& 25 * QString -> const QString&
23 * QString = 0l -> QString::null 26 * QString = 0l -> QString::null
24 * 27 *
25 * Revision 1.4 2003/03/21 14:32:54 mickeyl 28 * Revision 1.4 2003/03/21 14:32:54 mickeyl
@@ -444,15 +447,32 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
444{ 447{
445 /* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay 448 /* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay
446 * may be added with any of the other settings. IgnoreCase should never used alone. 449 * may be added with any of the other settings. IgnoreCase should never used alone.
447 * Wildcards, RegExp, ExactMatch should never used at the same time... 450 * Wildcards, RegExp, ExactMatch should never used at the same time...
448 */ 451 */
449 452
453 // Step 1: Check whether the given settings are supported by this backend
454 if ( ( querySettings & (
455 OContactAccess::IgnoreCase
456 | OContactAccess::WildCards
457 | OContactAccess::DateDiff
458 | OContactAccess::DateYear
459 | OContactAccess::DateMonth
460 | OContactAccess::DateDay
461 | OContactAccess::RegExp
462 | OContactAccess::ExactMatch
463 ) ) != querySettings )
464 return false;
465
466 // Step 2: Check whether the given combinations are ok..
467
468 // IngoreCase alone is invalid
450 if ( querySettings == OContactAccess::IgnoreCase ) 469 if ( querySettings == OContactAccess::IgnoreCase )
451 return false; 470 return false;
452 471
472 // WildCards, RegExp and ExactMatch should never used at the same time
453 switch ( querySettings & ~( OContactAccess::IgnoreCase 473 switch ( querySettings & ~( OContactAccess::IgnoreCase
454 | OContactAccess::DateDiff 474 | OContactAccess::DateDiff
455 | OContactAccess::DateYear 475 | OContactAccess::DateYear
456 | OContactAccess::DateMonth 476 | OContactAccess::DateMonth
457 | OContactAccess::DateDay 477 | OContactAccess::DateDay
458 ) 478 )
@@ -460,12 +480,14 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
460 case OContactAccess::RegExp: 480 case OContactAccess::RegExp:
461 return ( true ); 481 return ( true );
462 case OContactAccess::WildCards: 482 case OContactAccess::WildCards:
463 return ( true ); 483 return ( true );
464 case OContactAccess::ExactMatch: 484 case OContactAccess::ExactMatch:
465 return ( true ); 485 return ( true );
486 case 0: // one of the upper removed bits were set..
487 return ( true );
466 default: 488 default:
467 return ( false ); 489 return ( false );
468 } 490 }
469} 491}
470 492
471// Currently only asc implemented.. 493// Currently only asc implemented..