qtmobility/src/contacts/qcontactchangeset.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
   111 {
   111 {
   112     return d->m_dataChanged;
   112     return d->m_dataChanged;
   113 }
   113 }
   114 
   114 
   115 /*!
   115 /*!
   116    Returns a reference to the set of ids of contacts which have been added to
   116    Returns the set of ids of contacts which have been added to
   117    the database.
   117    the database.
   118  */
   118  */
   119 QSet<QContactLocalId>& QContactChangeSet::addedContacts()
   119 QSet<QContactLocalId> QContactChangeSet::addedContacts() const
   120 {
   120 {
   121     return d->m_addedContacts;
   121     return d->m_addedContacts;
   122 }
   122 }
   123 
   123 
   124 /*!
   124 /*!
   125    Returns a reference to the set of ids of contacts which have been changed in
   125   Inserts the given contact id \a addedContactId into the set of ids of contacts
       
   126   which have been added to the database.
       
   127  */
       
   128 void QContactChangeSet::insertAddedContact(QContactLocalId addedContactId)
       
   129 {
       
   130     d->m_addedContacts.insert(addedContactId);
       
   131 }
       
   132 
       
   133 /*!
       
   134   Inserts each of the given contact ids \a addedContactIds into the set of ids of contacts
       
   135   which have been added to the database.
       
   136  */
       
   137 void QContactChangeSet::insertAddedContacts(const QList<QContactLocalId>& addedContactIds)
       
   138 {
       
   139     foreach (const QContactLocalId& id, addedContactIds)
       
   140         d->m_addedContacts.insert(id);
       
   141 }
       
   142 
       
   143 /*!
       
   144   Clears the set of ids of contacts which have been added to the database
       
   145  */
       
   146 void QContactChangeSet::clearAddedContacts()
       
   147 {
       
   148     d->m_addedContacts.clear();
       
   149 }
       
   150 
       
   151 /*!
       
   152    Returns the set of ids of contacts which have been changed in
   126    the database.
   153    the database.
   127  */
   154  */
   128 QSet<QContactLocalId>& QContactChangeSet::changedContacts()
   155 QSet<QContactLocalId> QContactChangeSet::changedContacts() const
   129 {
   156 {
   130     return d->m_changedContacts;
   157     return d->m_changedContacts;
   131 }
   158 }
   132 
   159 
   133 /*!
   160 /*!
   134    Returns a reference to the set of ids of contacts which have been removed from
   161   Inserts the given contact id \a changedContactId into the set of ids of contacts
       
   162   which have been changed to the database.
       
   163  */
       
   164 void QContactChangeSet::insertChangedContact(QContactLocalId changedContactId)
       
   165 {
       
   166     d->m_changedContacts.insert(changedContactId);
       
   167 }
       
   168 
       
   169 /*!
       
   170   Inserts each of the given contact ids \a changedContactIds into the set of ids of contacts
       
   171   which have been changed to the database.
       
   172  */
       
   173 void QContactChangeSet::insertChangedContacts(const QList<QContactLocalId>& changedContactIds)
       
   174 {
       
   175     foreach (const QContactLocalId& id, changedContactIds)
       
   176         d->m_changedContacts.insert(id);
       
   177 }
       
   178 
       
   179 /*!
       
   180   Clears the set of ids of contacts which have been changed to the database
       
   181  */
       
   182 void QContactChangeSet::clearChangedContacts()
       
   183 {
       
   184     d->m_changedContacts.clear();
       
   185 }
       
   186 
       
   187 /*!
       
   188    Returns the set of ids of contacts which have been removed from
   135    the database.
   189    the database.
   136  */
   190  */
   137 QSet<QContactLocalId>& QContactChangeSet::removedContacts()
   191 QSet<QContactLocalId> QContactChangeSet::removedContacts() const
   138 {
   192 {
   139     return d->m_removedContacts;
   193     return d->m_removedContacts;
   140 }
   194 }
   141 
   195 
   142 /*!
   196 /*!
   143    Returns a reference to the set of ids of contacts which have been affected
   197   Inserts the given contact id \a removedContactId into the set of ids of contacts
       
   198   which have been removed to the database.
       
   199  */
       
   200 void QContactChangeSet::insertRemovedContact(QContactLocalId removedContactId)
       
   201 {
       
   202     d->m_removedContacts.insert(removedContactId);
       
   203 }
       
   204 
       
   205 /*!
       
   206   Inserts each of the given contact ids \a removedContactIds into the set of ids of contacts
       
   207   which have been removed to the database.
       
   208  */
       
   209 void QContactChangeSet::insertRemovedContacts(const QList<QContactLocalId>& removedContactIds)
       
   210 {
       
   211     foreach (const QContactLocalId& id, removedContactIds)
       
   212         d->m_removedContacts.insert(id);
       
   213 }
       
   214 
       
   215 /*!
       
   216   Clears the set of ids of contacts which have been removed to the database
       
   217  */
       
   218 void QContactChangeSet::clearRemovedContacts()
       
   219 {
       
   220     d->m_removedContacts.clear();
       
   221 }
       
   222 
       
   223 /*!
       
   224    Returns the set of ids of contacts which have been affected
   144    by the addition of relationships to the database.
   225    by the addition of relationships to the database.
   145  */
   226  */
   146 QSet<QContactLocalId>& QContactChangeSet::addedRelationshipsContacts()
   227 QSet<QContactLocalId> QContactChangeSet::addedRelationshipsContacts() const
   147 {
   228 {
   148     return d->m_addedRelationships;
   229     return d->m_addedRelationships;
   149 }
   230 }
   150 
   231 
   151 /*!
   232 /*!
   152    Returns a reference to the set of ids of contacts which have been affected
   233   Inserts the given contact id \a affectedContactId into the set of ids of contacts
       
   234   which have been affected by the addition of a relationship to the database.
       
   235  */
       
   236 void QContactChangeSet::insertAddedRelationshipsContact(QContactLocalId affectedContactId)
       
   237 {
       
   238     d->m_addedRelationships.insert(affectedContactId);
       
   239 }
       
   240 
       
   241 /*!
       
   242   Inserts each of the given contact ids \a affectedContactIds into the set of ids of contacts
       
   243   which have been affected by the addition of a relationship to the database.
       
   244  */
       
   245 void QContactChangeSet::insertAddedRelationshipsContacts(const QList<QContactLocalId>& affectedContactIds)
       
   246 {
       
   247     foreach (const QContactLocalId& id, affectedContactIds)
       
   248         d->m_addedRelationships.insert(id);
       
   249 }
       
   250 
       
   251 /*!
       
   252   Clears the set of ids of contacts which have been affected by the addition of a relationship to the database.
       
   253  */
       
   254 void QContactChangeSet::clearAddedRelationshipsContacts()
       
   255 {
       
   256     d->m_addedRelationships.clear();
       
   257 }
       
   258 
       
   259 /*!
       
   260    Returns the set of ids of contacts which have been affected
   153    by the removal of relationships from the database.
   261    by the removal of relationships from the database.
   154  */
   262  */
   155 QSet<QContactLocalId>& QContactChangeSet::removedRelationshipsContacts()
   263 QSet<QContactLocalId> QContactChangeSet::removedRelationshipsContacts() const
   156 {
   264 {
   157     return d->m_removedRelationships;
   265     return d->m_removedRelationships;
   158 }
   266 }
   159 
   267 
   160 /*!
   268 /*!
   161    Returns a reference to the pair of ids which represents the
   269   Inserts the given contact id \a affectedContactId into the set of ids of contacts
       
   270   which have been affected by the removal of a relationship to the database.
       
   271  */
       
   272 void QContactChangeSet::insertRemovedRelationshipsContact(QContactLocalId affectedContactId)
       
   273 {
       
   274     d->m_removedRelationships.insert(affectedContactId);
       
   275 }
       
   276 
       
   277 /*!
       
   278   Inserts each of the given contact ids \a affectedContactIds into the set of ids of contacts
       
   279   which have been affected by the removal of a relationship to the database.
       
   280  */
       
   281 void QContactChangeSet::insertRemovedRelationshipsContacts(const QList<QContactLocalId>& affectedContactIds)
       
   282 {
       
   283     foreach (const QContactLocalId& id, affectedContactIds)
       
   284         d->m_removedRelationships.insert(id);
       
   285 }
       
   286 
       
   287 /*!
       
   288   Clears the set of ids of contacts which have been affected by the removal of a relationship to the database.
       
   289  */
       
   290 void QContactChangeSet::clearRemovedRelationshipsContacts()
       
   291 {
       
   292     d->m_removedRelationships.clear();
       
   293 }
       
   294 
       
   295 /*!
       
   296   Sets the pair of ids which represent the old and new self contact ids
       
   297   to the given pair of ids \a oldAndNewContactId.
       
   298   The first id in the pair is the old self contact id, while the second
       
   299   id in the pair is the new self contact id.  If the new id is different
       
   300   to the old id at the point in time when emitSignals() is called,
       
   301   the QContactManagerEngine::selfContactIdChanged signal will be emitted.
       
   302  */
       
   303 void QContactChangeSet::setOldAndNewSelfContactId(const QPair<QContactLocalId, QContactLocalId> &oldAndNewContactId)
       
   304 {
       
   305     d->m_oldAndNewSelfContactId = oldAndNewContactId;
       
   306 }
       
   307 
       
   308 /*!
       
   309    Returns the pair of ids which represents the
   162    old and new self contact ids.  The first id in the pair is the
   310    old and new self contact ids.  The first id in the pair is the
   163    old self contact id, while the second id in the pair is the
   311    old self contact id, while the second id in the pair is the
   164    new self contact id.  If the new id is different to the old id
   312    new self contact id.  If the new id is different to the old id
   165    at the point in time when emitSignals() is called,
   313    at the point in time when emitSignals() is called,
   166    the QContactManagerEngine::selfContactIdChanged() signal will be emitted.
   314    the QContactManagerEngine::selfContactIdChanged() signal will be emitted.
   167  */
   315  */
   168 QPair<QContactLocalId, QContactLocalId>& QContactChangeSet::oldAndNewSelfContactId()
   316 QPair<QContactLocalId, QContactLocalId> QContactChangeSet::oldAndNewSelfContactId() const
   169 {
   317 {
   170     return d->m_oldAndNewSelfContactId;
   318     return d->m_oldAndNewSelfContactId;
   171 }
   319 }
   172 
   320 
   173 /*!
   321 /*!
   174    Clears all flags and sets of ids in this change set
   322    Clears all flags and sets of ids in this change set
   175  */
   323  */
   176 void QContactChangeSet::clear()
   324 void QContactChangeSet::clearAll()
   177 {
   325 {
   178     d->m_dataChanged = false;
   326     d->m_dataChanged = false;
   179     d->m_addedContacts.clear();
   327     d->m_addedContacts.clear();
   180     d->m_changedContacts.clear();
   328     d->m_changedContacts.clear();
   181     d->m_removedContacts.clear();
   329     d->m_removedContacts.clear();