コード例 #1
0
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();
    }
}
コード例 #2
0
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());
}