Ejemplo n.º 1
0
QContact DummyEngine::contact(const QContactLocalId& contactId, const QContactFetchHint& fetchHint, QContactManager::Error* error) const
{
    Q_UNUSED(contactId);
    Q_UNUSED(fetchHint);
    *error = QContactManager::DoesNotExistError;
    return QContact();
}
Ejemplo n.º 2
0
void tst_QContactRelationship::operations()
{
    QContactRelationship r1;

    QContact contact1, contact2;

    QVERIFY(r1.first() == QContact());
    QVERIFY(r1.second() == QContact());
    QVERIFY(r1.relationshipType() == QString());

    r1.setFirst(contact1);
    QVERIFY(r1.first() == contact1);
    r1.setSecond(contact2);
    QVERIFY(r1.second() == contact2);
    QVERIFY(r1.first() == contact1);
    QVERIFY(r1.relationshipType() == QString());

    r1.setRelationshipType(QContactRelationship::HasSpouse());
    QVERIFY(r1.relationshipType() == QContactRelationship::HasSpouse());
}
/*!
 * Reads a contact from the Etel store.
 *
 * \param contactId The Id of the contact to be retrieved.
 * \param definitionRestrictions Definition restrictions.
 * \param error Qt error code.
 * \return A QContact for the requested QContactLocalId value or 0 if the read
 *  operation was unsuccessful (e.g. contact not found).
 */
QContact CntSymbianSimEngine::contact(const QContactLocalId& contactId, const QContactFetchHint& fetchHint, QContactManager::Error* error) const
{
    QContactFetchRequest req;
    QContactLocalIdFilter filter;
    filter.setIds(QList<QContactLocalId>() << contactId);
    req.setFilter(filter);
    req.setFetchHint(fetchHint);
    executeRequest(&req, error);
    if (req.contacts().count() == 0)
        return QContact();
    return req.contacts().at(0); 
}
Ejemplo n.º 4
0
void tst_QContactRelationship::emptiness()
{
    QContactRelationship r1, r2, r3;

    QContact contact1, contact2, contact3;
    contact1.setId(QContactIdMock::createId("test", 1));
    contact2.setId(QContactIdMock::createId("test", 2));
    contact3.setId(QContactIdMock::createId("test", 3));

    QVERIFY(r1.first() == QContact());
    QVERIFY(r1.second() == QContact());
    QVERIFY(r1.relationshipType() == QString());

    r1.setFirst(contact1);
    QVERIFY(r1.first() == contact1);
    r1.setSecond(contact2);
    QVERIFY(r1.second() == contact2);
    QVERIFY(r1.first() == contact1);
    QVERIFY(r1.relationshipType() == QString());

    r1.setRelationshipType(QContactRelationship::HasSpouse());
    QVERIFY(r1.relationshipType() == QContactRelationship::HasSpouse());

    r2 = r1;
    QVERIFY(r1 == r2);
    QVERIFY(r1 != r3);
    QVERIFY(r2 != r3);

    r3.setFirst(contact3);
    r3.setSecond(contact2);
    r3.setRelationshipType(QContactRelationship::HasAssistant());

    r2.setFirst(contact3);
    QVERIFY(r1 != r2);
    QVERIFY(r2 != r3);
    QVERIFY(r3 != r1);
}
/*!
 * Query the SQL database
 * 
 * \a id Id of the contact whose name to search
 * \a error On return, contains the possible error.
 * \return the list of matched contact ids
 */
QContact CntSymbianSrvConnection::searchContactName(QContactLocalId id, 
                                                    QContactManager::Error* error)
{
    QList<QContact> list;

    // Fetch results from the server
    TBuf<100> sqlQuery;
    sqlQuery.Format(_L("SELECT contact_id, first_name, last_name, company_name FROM contact WHERE contact_id = %d"), id);
    TRAPD(err, list = searchContactNamesL(sqlQuery));
    CntSymbianTransformError::transformError(err, error);
    
    if (list.size() == 0) {
        *error = QContactManager::DoesNotExistError;
        return QContact();
    }

    return list.at(0);
}
Ejemplo n.º 6
0
bool CntSimStorePrivate::write(const QContact &contact, QContactManager::Error *error)
{
    if (IsActive()) {
        *error = QContactManager::LockedError;
        return false;
    }
    
    if (m_storeInfo.m_readOnlyAccess) {
        *error = QContactManager::NotSupportedError;
        return false;    
    }
    
    // get index
    m_writeIndex = KErrNotFound;
    if (contact.id().managerUri() == m_managerUri &&
        contact.localId() > 0) {
        m_writeIndex = contact.localId();

        // TODO: check that the contact exist in the sim 
    }
    
    // encode
    m_buffer.Zero();
    m_buffer.ReAlloc(KOneSimContactBufferSize);
    m_convertedContact = QContact(contact);

    TRAPD(err, encodeSimContactL(&m_convertedContact, m_buffer));
    if (err != KErrNone) {
        CntSymbianSimTransformError::transformError(err, error);
        return false;
    }

    // start writing
    m_etelStore.Write(iStatus, m_buffer, m_writeIndex);
    SetActive();
    m_state = WriteState;
    
    *error = QContactManager::NoError;
    return true;
}
QDeclarativeContact::QDeclarativeContact(QObject *parent)
    :QObject(parent),
    d(new QDeclarativeContactMetaObject(this, QContact()))
{
    connect(this, SIGNAL(detailsChanged()), SLOT(setModified()));
}
//Clears the action data, is called after the result has been emitted to contact (emitResult function)
void MobBaseAction::resetAction()
{
	m_contact = QContact(); 
	m_detail  = QContactDetail();
}
Ejemplo n.º 9
0
QContact DummyEngine::contact(const QContactId& contactId, QContactManager::Error* error) const
{
    Q_UNUSED(contactId);
    *error = QContactManager::DoesNotExistError;
    return QContact();
}
/*!
 * Returns true if the target contact is not the default constructed contact.
 * The validity of any specified details is not checked by this function.
 */
bool QContactActionTarget::isValid() const
{
    return (d->m_contact != QContact());
}
Ejemplo n.º 11
0
QContact ContactBrowser::contact() const
{
    if (mDocument)
        return mDocument->contact();
    return QContact();
}