plugins/contacts/symbian/plugin/src/cntrelationshipgroup.cpp
changeset 5 603d3f8b6302
parent 0 876b1a06bc25
equal deleted inserted replaced
3:e4ebb16b39ea 5:603d3f8b6302
   111     CleanupStack::PopAndDestroy(groupContact);
   111     CleanupStack::PopAndDestroy(groupContact);
   112 
   112 
   113     *error = QContactManager::NoError;
   113     *error = QContactManager::NoError;
   114     return true;
   114     return true;
   115 }
   115 }
       
   116 
       
   117 #ifdef SYMBIAN_BACKEND_USE_SQLITE
       
   118 /*!
       
   119  * Save many relationships
       
   120  * 
       
   121  * \a affectedContactIds will include the affected contact ids 
       
   122  * \a relationship to be saved
       
   123  * \a error t
       
   124  */
       
   125 bool CntRelationshipGroup::saveRelationshipsL(QSet<QContactLocalId> *affectedContactIds, QList<QContactRelationship> *relationships, QContactManager::Error* error)
       
   126 {
       
   127     RArray<TContactItemId> idList;
       
   128 
       
   129     if (relationships->count() == 0) {
       
   130         return true;
       
   131     }
       
   132 
       
   133     QContactLocalId groupId = relationships->at(0).first().localId();
       
   134     affectedContactIds->insert(groupId);
       
   135     
       
   136     foreach (QContactRelationship relationship, *relationships) {
       
   137         affectedContactIds->insert(relationship.second().localId());
       
   138         idList.AppendL(TContactItemId(relationship.second().localId()));
       
   139     }
       
   140 
       
   141     database()->AddContactsToGroupL(idList, TContactItemId(groupId));
       
   142 
       
   143     *error = QContactManager::NoError;
       
   144     return true;
       
   145 }
       
   146 
       
   147 bool CntRelationshipGroup::removeRelationshipsL(QSet<QContactLocalId> *affectedContactIds, const QList<QContactRelationship> &relationships, QContactManager::Error* error)
       
   148 {
       
   149     RArray<TContactItemId> idList;
       
   150 
       
   151     if (relationships.count() == 0) {
       
   152         return true;
       
   153     }
       
   154 
       
   155     QContactLocalId groupId = relationships.at(0).first().localId();
       
   156     affectedContactIds->insert(groupId);
       
   157 
       
   158     foreach (QContactRelationship relationship, relationships) {
       
   159         affectedContactIds->insert(relationship.second().localId());
       
   160         idList.AppendL(TContactItemId(relationship.second().localId()));
       
   161     }
       
   162 
       
   163     database()->RemoveContactsFromGroupL(idList, TContactItemId(groupId));
       
   164 
       
   165     *error = QContactManager::NoError;
       
   166     return true;
       
   167 }
       
   168 #endif
   116 
   169 
   117 bool CntRelationshipGroup::validateRelationship(const QContactRelationship &relationship, QContactManager::Error* error)
   170 bool CntRelationshipGroup::validateRelationship(const QContactRelationship &relationship, QContactManager::Error* error)
   118 {
   171 {
   119     // check that "second" is in this manager
   172     // check that "second" is in this manager
   120     if (!relationship.second().managerUri().isEmpty() && relationship.second().managerUri() != managerUri()) {
   173     if (!relationship.second().managerUri().isEmpty() && relationship.second().managerUri() != managerUri()) {