summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.cpp22
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp22
2 files changed, 44 insertions, 0 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.cpp b/libopie/pim/ocontactaccessbackend_xml.cpp
index 661cd51..097142b 100644
--- a/libopie/pim/ocontactaccessbackend_xml.cpp
+++ b/libopie/pim/ocontactaccessbackend_xml.cpp
@@ -14,12 +14,15 @@
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.6 2003/07/07 16:19:47 eilers
+ * Fixing serious bug in hasQuerySettings()
+ *
* Revision 1.5 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.4 2003/03/21 14:32:54 mickeyl
@@ -444,15 +447,32 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
{
/* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay
* may be added with any of the other settings. IgnoreCase should never used alone.
* Wildcards, RegExp, ExactMatch should never used at the same time...
*/
+ // Step 1: Check whether the given settings are supported by this backend
+ if ( ( querySettings & (
+ OContactAccess::IgnoreCase
+ | OContactAccess::WildCards
+ | OContactAccess::DateDiff
+ | OContactAccess::DateYear
+ | OContactAccess::DateMonth
+ | OContactAccess::DateDay
+ | OContactAccess::RegExp
+ | OContactAccess::ExactMatch
+ ) ) != querySettings )
+ return false;
+
+ // Step 2: Check whether the given combinations are ok..
+
+ // IngoreCase alone is invalid
if ( querySettings == OContactAccess::IgnoreCase )
return false;
+ // WildCards, RegExp and ExactMatch should never used at the same time
switch ( querySettings & ~( OContactAccess::IgnoreCase
| OContactAccess::DateDiff
| OContactAccess::DateYear
| OContactAccess::DateMonth
| OContactAccess::DateDay
)
@@ -460,12 +480,14 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
case OContactAccess::RegExp:
return ( true );
case OContactAccess::WildCards:
return ( true );
case OContactAccess::ExactMatch:
return ( true );
+ case 0: // one of the upper removed bits were set..
+ return ( true );
default:
return ( false );
}
}
// Currently only asc implemented..
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 @@
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.6 2003/07/07 16:19:47 eilers
+ * Fixing serious bug in hasQuerySettings()
+ *
* Revision 1.5 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.4 2003/03/21 14:32:54 mickeyl
@@ -444,15 +447,32 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
{
/* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay
* may be added with any of the other settings. IgnoreCase should never used alone.
* Wildcards, RegExp, ExactMatch should never used at the same time...
*/
+ // Step 1: Check whether the given settings are supported by this backend
+ if ( ( querySettings & (
+ OContactAccess::IgnoreCase
+ | OContactAccess::WildCards
+ | OContactAccess::DateDiff
+ | OContactAccess::DateYear
+ | OContactAccess::DateMonth
+ | OContactAccess::DateDay
+ | OContactAccess::RegExp
+ | OContactAccess::ExactMatch
+ ) ) != querySettings )
+ return false;
+
+ // Step 2: Check whether the given combinations are ok..
+
+ // IngoreCase alone is invalid
if ( querySettings == OContactAccess::IgnoreCase )
return false;
+ // WildCards, RegExp and ExactMatch should never used at the same time
switch ( querySettings & ~( OContactAccess::IgnoreCase
| OContactAccess::DateDiff
| OContactAccess::DateYear
| OContactAccess::DateMonth
| OContactAccess::DateDay
)
@@ -460,12 +480,14 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
case OContactAccess::RegExp:
return ( true );
case OContactAccess::WildCards:
return ( true );
case OContactAccess::ExactMatch:
return ( true );
+ case 0: // one of the upper removed bits were set..
+ return ( true );
default:
return ( false );
}
}
// Currently only asc implemented..