phonebookengines/cntactions/src/cntaction.cpp
changeset 71 7cc7d74059f9
parent 65 ae724a111993
equal deleted inserted replaced
65:ae724a111993 71:7cc7d74059f9
   158 }
   158 }
   159 
   159 
   160 //common code to perform a call, videocall action
   160 //common code to perform a call, videocall action
   161 void CntAction::performNumberAction(const QString &interface, const QString &operation)
   161 void CntAction::performNumberAction(const QString &interface, const QString &operation)
   162 {
   162 {
       
   163     QVariantList args;
   163     QVariant retValue;
   164     QVariant retValue;
   164     
   165     
   165     // XQApplicationManager is not supported by PhoneUI to initiate calls,
   166     delete m_request;
   166     // only old approarch using XQServiceRequest can be used. 
   167     m_request = NULL;
   167     XQServiceRequest snd(interface, operation); //sync request
   168     m_request = m_AppManager.create(interface, operation, false); // not embedded
       
   169     if (!m_request) {
       
   170         emitResult(GeneralError, retValue);
       
   171         return;
       
   172     }
   168 
   173 
   169     //QContactType == TypeGroup
   174     //QContactType == TypeGroup
   170     if (QContactType::TypeGroup == m_contact.type()) {
   175     if (QContactType::TypeGroup == m_contact.type()) {
   171         QContactPhoneNumber conferenceCall = m_contact.detail<QContactPhoneNumber>();
   176         QContactPhoneNumber conferenceCall = m_contact.detail<QContactPhoneNumber>();
   172         
   177         args << conferenceCall.number() << m_contact.localId() << m_contact.displayLabel();
   173         snd << conferenceCall.number() << m_contact.localId() << m_contact.displayLabel();
   178         m_request->setArguments(args);
   174         snd.send(retValue);
   179         m_request->setSynchronous(true);
   175         emitResult(snd.latestError(), retValue);
   180         m_request->send(retValue);
       
   181         emitResult(m_request->lastError(), retValue);
   176     }
   182     }
   177     //QContactType == TypeContact
   183     //QContactType == TypeContact
   178     //detail exist use it
   184     //detail exist use it
   179     else if (m_detail.definitionName() == QContactPhoneNumber::DefinitionName) {
   185     else if (m_detail.definitionName() == QContactPhoneNumber::DefinitionName) {
   180 		const QContactPhoneNumber &phoneNumber = static_cast<const QContactPhoneNumber &>(m_detail);
   186 		const QContactPhoneNumber &phoneNumber = static_cast<const QContactPhoneNumber &>(m_detail);
   181 		
   187 		args << phoneNumber.number() << m_contact.localId() << m_contact.displayLabel();
   182         snd << phoneNumber.number() << m_contact.localId() << m_contact.displayLabel();
   188 		m_request->setArguments(args);
   183         snd.send(retValue);
   189 		m_request->setSynchronous(true);
   184         emitResult(snd.latestError(), retValue);
   190         m_request->send(retValue);
       
   191         emitResult(m_request->lastError(), retValue);
   185 	}
   192 	}
   186     //QContactType == TypeContact
   193     //QContactType == TypeContact
   187     //if no detail, pick preferred
   194     //if no detail, pick preferred
   188 	else if (m_detail.isEmpty())
   195 	else if (m_detail.isEmpty())
   189 	{
   196 	{
   198 		//if not empty, cast detail to phonenumber
   205 		//if not empty, cast detail to phonenumber
   199 		else {
   206 		else {
   200 			phoneNumber = static_cast<QContactPhoneNumber>(detail);
   207 			phoneNumber = static_cast<QContactPhoneNumber>(detail);
   201 		}
   208 		}
   202 		
   209 		
   203         snd << phoneNumber.number() << m_contact.localId() << m_contact.displayLabel();
   210 	    args << phoneNumber.number() << m_contact.localId() << m_contact.displayLabel();
   204         snd.send(retValue);
   211 	    m_request->setArguments(args);
   205         emitResult(snd.latestError(), retValue);
   212 	    m_request->setSynchronous(true);
       
   213 	    m_request->send(retValue);
       
   214 	    emitResult(m_request->lastError(), retValue);
   206 	}
   215 	}
   207 	//else return an error
   216 	//else return an error
   208 	else {
   217 	else {
   209 		emitResult(GeneralError, retValue);
   218 		emitResult(GeneralError, retValue);
   210 	}
   219 	}