qtmobility/src/contacts/filters/qcontactrelationshipfilter.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    78  */
    78  */
    79 
    79 
    80 Q_IMPLEMENT_CONTACTFILTER_PRIVATE(QContactRelationshipFilter)
    80 Q_IMPLEMENT_CONTACTFILTER_PRIVATE(QContactRelationshipFilter)
    81 
    81 
    82 /*!
    82 /*!
    83   \enum QContactRelationshipFilter::Role
       
    84   Describes the roles that a contact may take in a relationship
       
    85   \value First The contact is the first contact in the relationship
       
    86   \value Second The contact is the second contact in the relationship
       
    87   \value Either The contact is either the first or second contact in the relationship
       
    88  */
       
    89 
       
    90 /*!
       
    91   \fn QContactRelationshipFilter::QContactRelationshipFilter(const QContactFilter& other)
    83   \fn QContactRelationshipFilter::QContactRelationshipFilter(const QContactFilter& other)
    92   Constructs a copy of \a other if possible, else constructs a new QContactRelationshipFilter.
    84   Constructs a copy of \a other if possible, else constructs a new QContactRelationshipFilter.
    93  */
    85  */
    94 
    86 
    95 /*!
    87 /*!
   137 }
   129 }
   138 
   130 
   139 /*!
   131 /*!
   140   Sets the role in the relationship with the tested contact that the related contact must play in order for the tested contact to match this filter to be \a relatedContactRole
   132   Sets the role in the relationship with the tested contact that the related contact must play in order for the tested contact to match this filter to be \a relatedContactRole
   141  */
   133  */
   142 void QContactRelationshipFilter::setRelatedContactRole(QContactRelationshipFilter::Role relatedContactRole)
   134 void QContactRelationshipFilter::setRelatedContactRole(QContactRelationship::Role relatedContactRole)
   143 {
   135 {
   144     Q_D(QContactRelationshipFilter);
   136     Q_D(QContactRelationshipFilter);
   145     d->m_relatedContactRole = relatedContactRole;
   137     d->m_relatedContactRole = relatedContactRole;
   146 }
   138 }
   147 
   139 
   148 /*!
   140 /*!
   149   Returns the role in the relationship with the tested contact that the related contact must play in order for the tested contact to match this filter
   141   Returns the role in the relationship with the tested contact that the related contact must play in order for the tested contact to match this filter
   150  */
   142  */
   151 QContactRelationshipFilter::Role QContactRelationshipFilter::relatedContactRole() const
   143 QContactRelationship::Role QContactRelationshipFilter::relatedContactRole() const
   152 {
   144 {
   153     Q_D(const QContactRelationshipFilter);
   145     Q_D(const QContactRelationshipFilter);
   154     return d->m_relatedContactRole;
   146     return d->m_relatedContactRole;
   155 }
   147 }
   156 
   148 
   157 /*!
       
   158   \internal
       
   159   Sets the role in the relationship that a contact must be in order to match this filter to \a roleInRelationship
       
   160 
       
   161   This function has been deprecated - you should pass the opposite value (e.g. First instead of Second, Second
       
   162   instead of First) to \c setRelatedContactRole().
       
   163   \sa setRelatedContactRole()
       
   164  */
       
   165 void QContactRelationshipFilter::setRole(QContactRelationshipFilter::Role roleInRelationship)
       
   166 {
       
   167     Q_D(QContactRelationshipFilter);
       
   168     switch(roleInRelationship) {
       
   169         case QContactRelationshipFilter::Either:
       
   170             d->m_relatedContactRole = QContactRelationshipFilter::Either;
       
   171             break;
       
   172         case QContactRelationshipFilter::First:
       
   173             d->m_relatedContactRole = QContactRelationshipFilter::Second;
       
   174             break;
       
   175         case QContactRelationshipFilter::Second:
       
   176             d->m_relatedContactRole = QContactRelationshipFilter::First;
       
   177             break;
       
   178     }
       
   179 }
       
   180 
       
   181 /*!
       
   182   \internal
       
   183   Sets the contact id of the other participant which must be present in the relationship with the contact
       
   184   in order for the contact to match the filter to be \a id
       
   185  */
       
   186 void QContactRelationshipFilter::setOtherParticipantId(const QContactId& id)
       
   187 {
       
   188     Q_D(QContactRelationshipFilter);
       
   189     d->m_relatedContactId = id;
       
   190 }
       
   191 
       
   192 /*!
       
   193   \internal
       
   194   Returns the role that a contact must have in a relationship in order to match the filter
       
   195  */
       
   196 QContactRelationshipFilter::Role QContactRelationshipFilter::role() const
       
   197 {
       
   198     Q_D(const QContactRelationshipFilter);
       
   199     switch(d->m_relatedContactRole) {
       
   200         case QContactRelationshipFilter::First:
       
   201             return QContactRelationshipFilter::Second;
       
   202         case QContactRelationshipFilter::Second:
       
   203             return QContactRelationshipFilter::First;
       
   204         case QContactRelationshipFilter::Either:
       
   205         default:
       
   206             return QContactRelationshipFilter::Either;
       
   207     }
       
   208 }
       
   209 
       
   210 /*!
       
   211   \internal
       
   212   Returns the id of another contact with whom a contact must have a relationship in order to match the filter
       
   213  */
       
   214 QContactId QContactRelationshipFilter::otherParticipantId() const
       
   215 {
       
   216     Q_D(const QContactRelationshipFilter);
       
   217     return d->m_relatedContactId;
       
   218 }
       
   219 
       
   220 QTM_END_NAMESPACE
   149 QTM_END_NAMESPACE