Пример #1
0
KTp::LogEntity Utils::fromTplEntity(const Tpl::EntityPtr& entity)
{
    return KTp::LogEntity(entity->entityType() == Tpl::EntityTypeContact ?
                            Tp::HandleTypeContact : Tp::HandleTypeRoom,
                          entity->identifier(),
                          entity->alias());
}
Пример #2
0
QVariant EntityModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid()) {
        return QVariant();
    }

    Tpl::EntityPtr entity = m_entities[index.row()].entity;

    switch (role) {
    case Qt::DisplayRole:
        return entity->alias();
    case Qt::DecorationRole:
        return QPixmap(entity->avatarToken());
    case EntityModel::IdRole:
        return entity->identifier();
    case EntityModel::TypeRole:
        return entity->entityType();
    case EntityModel::EntityRole:
        return QVariant::fromValue(entity);
    case EntityModel::AccountRole:
        return QVariant::fromValue(m_entities[index.row()].account);
    }
    return QVariant();
}