qtmobility/plugins/contacts/qtcontacts-tracker/qtrackerrelationshipfetchrequest.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    55 
    55 
    56     QContactRelationshipFetchRequest* r = qobject_cast<QContactRelationshipFetchRequest*>(req);
    56     QContactRelationshipFetchRequest* r = qobject_cast<QContactRelationshipFetchRequest*>(req);
    57 
    57 
    58     if( !r )
    58     if( !r )
    59     {
    59     {
    60         QContactManagerEngine::updateRelationshipFetchRequest(r, QList<QContactRelationship>(), QContactManager::UnspecifiedError);
    60         QContactManagerEngine::updateRelationshipFetchRequest(r, QList<QContactRelationship>(), QContactManager::UnspecifiedError, QContactAbstractRequest::FinishedState);
    61         QContactManagerEngine::updateRequestState(req, QContactAbstractRequest::FinishedState);
       
    62         return;
    61         return;
    63     }
    62     }
    64     if (not r->relationshipType().isEmpty() && QContactRelationship::Is != r->relationshipType())
    63     if (not r->relationshipType().isEmpty() && QContactRelationship::IsSameAs != r->relationshipType())
    65     {
    64     {
    66         QContactManagerEngine::updateRelationshipFetchRequest(r, r->relationships(), QContactManager::NotSupportedError);
    65         QContactManagerEngine::updateRelationshipFetchRequest(r, r->relationships(), QContactManager::NotSupportedError, QContactAbstractRequest::FinishedState);
    67         QContactManagerEngine::updateRequestState(req, QContactAbstractRequest::FinishedState);
       
    68         return;
    66         return;
    69     }
    67     }
    70     QList<QContactManager::Error> dummy;
    68     QList<QContactManager::Error> dummy;
    71     QContactManagerEngine::updateRequestState(req, QContactAbstractRequest::ActiveState);
    69     QContactManagerEngine::updateRequestState(req, QContactAbstractRequest::ActiveState);
    72 
    70 
    99 {
    97 {
   100     QContactManagerEngine *engine = qobject_cast<QContactManagerEngine *> (parent());
    98     QContactManagerEngine *engine = qobject_cast<QContactManagerEngine *> (parent());
   101     QContactRelationshipFetchRequest* r = qobject_cast<QContactRelationshipFetchRequest*>(req);
    99     QContactRelationshipFetchRequest* r = qobject_cast<QContactRelationshipFetchRequest*>(req);
   102     if( !engine )
   100     if( !engine )
   103     {
   101     {
   104         QContactManagerEngine::updateRelationshipFetchRequest(r, QList<QContactRelationship>(), QContactManager::UnspecifiedError);
   102         QContactManagerEngine::updateRelationshipFetchRequest(r, QList<QContactRelationship>(), QContactManager::UnspecifiedError, QContactAbstractRequest::FinishedState);
   105         QContactManagerEngine::updateRequestState(req, QContactAbstractRequest::FinishedState);
       
   106         return;
   103         return;
   107     }
   104     }
   108 
   105 
   109     QList<QContactRelationship> result;
   106     QList<QContactRelationship> result;
   110     for(int i = 0; i < query->rowCount(); i++) {
   107     for(int i = 0; i < query->rowCount(); i++) {
   121             idsecond.setManagerUri(idfirst.managerUri());
   118             idsecond.setManagerUri(idfirst.managerUri());
   122 
   119 
   123             QContactRelationship rel;
   120             QContactRelationship rel;
   124             rel.setFirst(idfirst);
   121             rel.setFirst(idfirst);
   125             rel.setSecond(idsecond);
   122             rel.setSecond(idsecond);
   126             rel.setRelationshipType(QContactRelationship::Is);
   123             rel.setRelationshipType(QContactRelationship::IsSameAs);
   127             result.append(rel);
   124             result.append(rel);
   128         }
   125         }
   129     }
   126     }
   130 
   127 
   131     QContactManagerEngine::updateRelationshipFetchRequest(r, result, QContactManager::NoError);
   128     QContactManagerEngine::updateRelationshipFetchRequest(r, result, QContactManager::NoError, QContactAbstractRequest::FinishedState);
   132     QContactManagerEngine::updateRequestState(req, QContactAbstractRequest::FinishedState);
       
   133 }
   129 }
   134 
   130