/*! * Removes the specified contact object from the Etel store. * * \param contactId Id of the contact to be removed. * \param qtError Qt error code. * \return Error status. */ bool CntSymbianSimEngine::removeContacts(const QList<QContactLocalId>& contactIds, QMap<int, QContactManager::Error>* errorMap, QContactManager::Error* error) { QContactRemoveRequest req; req.setContactIds(contactIds); executeRequest(&req, error); if (errorMap) *errorMap = req.errorMap(); return (*error == QContactManager::NoError); }
void CntSimContactRemoveRequest::getReservedSlots() { QContactRemoveRequest *r = req<QContactRemoveRequest>(); if (!r->isActive()) return; QContactManager::Error error = QContactManager::NoError; if (!simStore()->getReservedSlots(&error)) { QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState); } }
void CntSimContactRemoveRequest::getReservedSlotsComplete(QList<int> reservedSlots, QContactManager::Error error) { QContactRemoveRequest *r = req<QContactRemoveRequest>(); if (!r->isActive()) return; if (error != QContactManager::NoError && error != QContactManager::DoesNotExistError) { QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState); return; } m_reservedSlots = reservedSlots; singleShotTimer(KRequestDelay, this, SLOT(removeNext())); }
void tst_StoragesLocationsMissing::init() { // Make sure all tests in this test case start with an empty system storage. QContactIdFetchRequest idFetchRequest; idFetchRequest.setManager(m_contactManager); idFetchRequest.setStorageLocations(QContactAbstractRequest::SystemStorage); idFetchRequest.start(); idFetchRequest.waitForFinished(); if (!idFetchRequest.ids().isEmpty()) { QContactRemoveRequest removeRequest; removeRequest.setManager(m_contactManager); removeRequest.setContactIds(idFetchRequest.ids()); removeRequest.start(); removeRequest.waitForFinished(); } }
void CntSimContactRemoveRequest::run() { QContactRemoveRequest *r = req<QContactRemoveRequest>(); if (!r->isActive()) return; m_contactIds = r->contactIds(); m_errorMap.clear(); m_index = 0; #ifdef SYMBIANSIM_BACKEND_CHECK_BEFORE_REMOVE m_reservedSlots.clear(); getReservedSlots(); #else removeNext(); #endif }
void CntSimContactRemoveRequest::removeNext() { QContactRemoveRequest *r = req<QContactRemoveRequest>(); if (!r->isActive()) return; if (r->contactIds().count() == 0) { QContactManagerEngine::updateContactRemoveRequest(r, QContactManager::BadArgumentError, m_errorMap, QContactAbstractRequest::FinishedState); return; } // All contacts removed? if (m_index >= m_contactIds.count()) { // Take first error from errormap (if any) QContactManager::Error error = QContactManager::NoError; if (m_errorMap.count()) error = m_errorMap.begin().value(); QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState); return; } // Remove next contact QContactLocalId contactId = m_contactIds.at(m_index); QContactManager::Error error = QContactManager::NoError; #ifdef SYMBIANSIM_BACKEND_CHECK_BEFORE_REMOVE if (m_reservedSlots.contains(contactId)) simStore()->remove(contactId, &error); else error = QContactManager::DoesNotExistError; #else simStore()->remove(contactId, &error); #endif if (error) { m_errorMap.insert(m_index, error); m_index++; singleShotTimer(KRequestDelay, this, SLOT(removeNext())); } }
void SeasidePeopleModel::removePerson(SeasidePerson *person) { MODEL_DEBUG() << Q_FUNC_INFO << "Removing " << person; QContactRemoveRequest *removeRequest = new QContactRemoveRequest(this); removeRequest->setManager(priv->manager); connect(removeRequest, SIGNAL(stateChanged(QContactAbstractRequest::State)), priv, SLOT(onRemoveStateChanged(QContactAbstractRequest::State))); removeRequest->setContactId(person->contact().id().localId()); MODEL_DEBUG() << Q_FUNC_INFO << "Removing " << person->contact().id().localId(); if (!removeRequest->start()) { qWarning() << Q_FUNC_INFO << "Remove request failed"; delete removeRequest; } // fake removal for slow managers priv->contactsRemoved(QList<QContactLocalId>() << person->id()); }