qtmobility/src/contacts/filters/qcontactdetailrangefilter.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
    50   \class QContactDetailRangeFilter
    50   \class QContactDetailRangeFilter
    51   \brief The QContactDetailRangeFilter class provides a filter based around
    51   \brief The QContactDetailRangeFilter class provides a filter based around
    52   a detail value range criterion.
    52   a detail value range criterion.
    53   \ingroup contacts-filters
    53   \ingroup contacts-filters
    54  
    54  
    55   It may be used to select contacts which contain a detail of a particular definition with a particular value
    55   It may be used to select contacts which contain a detail of a particular definition with a particular value that lies in
       
    56   a range (either open or closed).
    56  */
    57  */
    57 
    58 
    58 Q_IMPLEMENT_CONTACTFILTER_PRIVATE(QContactDetailRangeFilter);
    59 Q_IMPLEMENT_CONTACTFILTER_PRIVATE(QContactDetailRangeFilter);
    59 
    60 
    60 /*!
    61 /*!
    63  */
    64  */
    64 
    65 
    65 /*!
    66 /*!
    66  * \enum QContactDetailRangeFilter::RangeFlag
    67  * \enum QContactDetailRangeFilter::RangeFlag
    67  * Enumerates the semantics of the boundary conditions of the detail range filter
    68  * Enumerates the semantics of the boundary conditions of the detail range filter
    68  * \value IncludeLower
    69  * \value IncludeLower The filter will match if the field value is equal to or greater than the minimum value
    69  * \value IncludeUpper
    70  * \value IncludeUpper The filter will match if the field value is equal to or less than the maximum value
    70  * \value ExcludeLower
    71  * \value ExcludeLower The filter will match if the field value is greater than the minimum value (but not equal)
    71  * \value ExcludeUpper
    72  * \value ExcludeUpper The filter will match if the field value is less than the maximum value (but not equal)
    72  */
    73  */
    73 
    74 
    74 /*!
    75 /*!
    75  * Constructs a new detail range filter
    76  * Constructs a new detail range filter
    76  */
    77  */
    78     : QContactFilter(new QContactDetailRangeFilterPrivate)
    79     : QContactFilter(new QContactDetailRangeFilterPrivate)
    79 {
    80 {
    80 }
    81 }
    81 
    82 
    82 /*!
    83 /*!
    83  * Sets the value range criterion of the filter to within \a min and \a max, with boundary conditions specified in the given \a flags
    84  * Sets the value range criterion of the filter to within \a min and \a max, with boundary conditions specified in the given \a flags.
       
    85  * If \a min or \a max is a null variant, that condition will not be checked.  For example, to check for
       
    86  * fields with a value greater than 7, you would specify:
       
    87  * \code
       
    88  * filter.setRange(7, QVariant(), QContactDetailRangeFilter::ExcludeLower);
       
    89  * \endcode
    84  * \sa minValue(), maxValue()
    90  * \sa minValue(), maxValue()
    85  */
    91  */
    86 void QContactDetailRangeFilter::setRange(const QVariant& min, const QVariant& max, RangeFlags flags)
    92 void QContactDetailRangeFilter::setRange(const QVariant& min, const QVariant& max, RangeFlags flags)
    87 {
    93 {
    88     Q_D(QContactDetailRangeFilter);
    94     Q_D(QContactDetailRangeFilter);
    91     d->m_rangeflags = flags;
    97     d->m_rangeflags = flags;
    92 }
    98 }
    93 
    99 
    94 /*!
   100 /*!
    95  * Sets the match flags of the filter criterion to \a flags
   101  * Sets the match flags of the filter criterion to \a flags
       
   102  *
       
   103  * Not all flags are supported by a range filter.  The supported flags include:
       
   104  *
       
   105  * \list
       
   106  * \o QContactFilter::MatchExactly
       
   107  * \o QContactFilter::MatchFixedString
       
   108  * \o QContactFilter::MatchCaseSensitive
       
   109  * \endlist
       
   110  *
       
   111  * Unsupported flags will be ignored.
       
   112  *
    96  * \sa matchFlags()
   113  * \sa matchFlags()
    97  */
   114  */
    98 void QContactDetailRangeFilter::setMatchFlags(QContactFilter::MatchFlags flags)
   115 void QContactDetailRangeFilter::setMatchFlags(QContactFilter::MatchFlags flags)
    99 {
   116 {
   100     Q_D(QContactDetailRangeFilter);
   117     Q_D(QContactDetailRangeFilter);
       
   118     flags &= (QContactFilter::MatchExactly | QContactFilter::MatchFixedString | QContactFilter::MatchCaseSensitive);
   101     d->m_flags = flags;
   119     d->m_flags = flags;
   102 }
   120 }
   103 
   121 
   104 /*!
   122 /*!
   105  * Sets the name of the detail definition of which type details will be inspected for matching values to \a definitionName,
   123  * Sets the name of the detail definition of which type details will be inspected for matching values to \a definitionName,
   112     d->m_defId = definitionName;
   130     d->m_defId = definitionName;
   113     d->m_fieldId = fieldName;
   131     d->m_fieldId = fieldName;
   114 }
   132 }
   115 
   133 
   116 /*!
   134 /*!
   117  * Returns the match flags of the criterion, which define semantics such as case sensitivity, prefix matching, exact matching, etc.
   135  * Returns the match flags of the criterion, which define semantics such as case sensitivity, and exact matching.
   118  * \sa setMatchFlags()
   136  * \sa setMatchFlags()
   119  */
   137  */
   120 QContactFilter::MatchFlags QContactDetailRangeFilter::matchFlags() const
   138 QContactFilter::MatchFlags QContactDetailRangeFilter::matchFlags() const
   121 {
   139 {
   122     Q_D(const QContactDetailRangeFilter);
   140     Q_D(const QContactDetailRangeFilter);
   142     Q_D(const QContactDetailRangeFilter);
   160     Q_D(const QContactDetailRangeFilter);
   143     return d->m_fieldId;
   161     return d->m_fieldId;
   144 }
   162 }
   145 
   163 
   146 /*!
   164 /*!
   147  * Returns the lower bound of the value range criterion
   165  * Returns the lower bound of the value range criterion.
       
   166  * If this value is null, there is no lower bound.
       
   167  * If it is valid, the \l rangeFlags() determines whether this value is included in the valid values.
   148  * \sa setRange()
   168  * \sa setRange()
   149  */
   169  */
   150 QVariant QContactDetailRangeFilter::minValue() const
   170 QVariant QContactDetailRangeFilter::minValue() const
   151 {
   171 {
   152     Q_D(const QContactDetailRangeFilter);
   172     Q_D(const QContactDetailRangeFilter);
   153     return d->m_minValue;
   173     return d->m_minValue;
   154 }
   174 }
   155 
   175 
   156 /*!
   176 /*!
   157  * Returns the upper bound of the value range criterion
   177  * Returns the upper bound of the value range criterion
       
   178  * If this value is null, there is no upper bound.
       
   179  * If it is valid, the \l rangeFlags() determines whether this value is included in the valid values.
   158  * \sa setRange()
   180  * \sa setRange()
   159  */
   181  */
   160 QVariant QContactDetailRangeFilter::maxValue() const
   182 QVariant QContactDetailRangeFilter::maxValue() const
   161 {
   183 {
   162     Q_D(const QContactDetailRangeFilter);
   184     Q_D(const QContactDetailRangeFilter);