Exemple #1
0
void EntityModel::onEntitiesSearchFinished(Tpl::PendingOperation *operation)
{
    Tpl::PendingEntities *pendingEntities = qobject_cast<Tpl::PendingEntities*>(operation);

    Tpl::EntityPtrList newEntries = pendingEntities->entities();

    if (newEntries.size() > 0) {
        beginInsertRows(QModelIndex(), m_entities.size(), m_entities.size() + newEntries.size()-1);
        Q_FOREACH(const Tpl::EntityPtr entity, newEntries) {
            EntityModelItem item;
            item.account = pendingEntities->account();
            item.entity = entity;

            m_entities.append(item);
        }
void PendingTpLoggerEntities::entitiesRetrieved(Tpl::PendingOperation *op)
{
    if (op->isError()) {
        setError(op->errorName() + QLatin1String(": ") + op->errorMessage());
        emitFinished();
        return;
    }

    Tpl::PendingEntities *pe = qobject_cast<Tpl::PendingEntities*>(op);
    Q_ASSERT(pe);

    Tpl::EntityPtrList entities = pe->entities();
    QList<KTp::LogEntity> logEntities;
    Q_FOREACH (const Tpl::EntityPtr entity, entities) {
        logEntities << Utils::fromTplEntity(entity);
    }