KIdentityManagementCore::IdentityTreeModel Class

class KIdentityManagementCore::IdentityTreeModel

The IdentityTreeModel class. More...

Header: #include <KIdentityManagementCore/IdentityTreeModel>
CMake: find_package(KPim6IdentityManagementCore REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::IdentityManagementCore)
Inherits: QAbstractListModel

Public Types

enum IdentityRoles { IdentityNameRole, DisplayIdentityNameRole, FullEmailRole, EmailRole, UoidRole, …, LastColumn }

Public Functions

IdentityTreeModel(KIdentityManagementCore::IdentityManager *manager, QObject *parent = nullptr)
virtual ~IdentityTreeModel() override
KIdentityManagementCore::IdentityManager *identityManager() const
uint identityUoid(int index) const
void removeIdentities(const QStringList &identitiesName)
void setShowDefault(bool show)
int uoidIndex(int uoid) const

Reimplemented Public Functions

virtual int columnCount(const QModelIndex &parent) const override
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override
virtual bool setData(const QModelIndex &modelIndex, const QVariant &value, int role = Qt::DisplayRole) override

Detailed Description

Author: Laurent Montel <montel@kde.org>

Member Type Documentation

enum IdentityTreeModel::IdentityRoles

Columns (and data roles) provided by the model.

ConstantValueDescription
KIdentityManagementCore::IdentityTreeModel::IdentityNameRole0The name of the identity
KIdentityManagementCore::IdentityTreeModel::DisplayIdentityNameRole1The name used to display the identity
KIdentityManagementCore::IdentityTreeModel::FullEmailRole2The full email address (name and address)
KIdentityManagementCore::IdentityTreeModel::EmailRole3The primary email address of the identity
KIdentityManagementCore::IdentityTreeModel::UoidRole4The unique object identifier of the identity
KIdentityManagementCore::IdentityTreeModel::DefaultRole5Whether the identity is the default one
KIdentityManagementCore::IdentityTreeModel::ActivitiesRole6The activities the identity is associated with
KIdentityManagementCore::IdentityTreeModel::EnabledActivitiesRole7Whether activities are enabled for the identity
KIdentityManagementCore::IdentityTreeModel::LastColumnEnabledActivitiesRoleThe last column of the model

Member Function Documentation

[explicit] IdentityTreeModel::IdentityTreeModel(KIdentityManagementCore::IdentityManager *manager, QObject *parent = nullptr)

Constructor manager the identity manager to use parent the parent object

[override virtual noexcept] IdentityTreeModel::~IdentityTreeModel()

Destructor

[override virtual] int IdentityTreeModel::columnCount(const QModelIndex &parent) const

Reimplements: QAbstractItemModel::columnCount(const QModelIndex &parent) const.

Returns the number of columns under the given parent parent the parent model index Returns the number of columns

[override virtual] QVariant IdentityTreeModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

Gets the data for the given model index index the model index to get data for role the data role to retrieve Returns the data at the given index for the specified role

See also setData().

[override virtual] Qt::ItemFlags IdentityTreeModel::flags(const QModelIndex &index) const

Reimplements: QAbstractListModel::flags(const QModelIndex &index) const.

Returns the item flags for the given index index the model index Returns the item flags

[override virtual] QVariant IdentityTreeModel::headerData(int section, Qt::Orientation orientation, int role) const

Reimplements: QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role) const.

Returns the header data for the given section section the column or row number orientation whether the section is horizontal (columns) or vertical (rows) role the data role to retrieve Returns the header data

KIdentityManagementCore::IdentityManager *IdentityTreeModel::identityManager() const

Returns the underlying identity manager Returns the identity manager

uint IdentityTreeModel::identityUoid(int index) const

Returns the UOID (Unique Object Identifier) of the identity at the given index index the row index Returns the UOID of the identity at that index

void IdentityTreeModel::removeIdentities(const QStringList &identitiesName)

Removes the identities with the given names identitiesName a list of identity names to remove

[override virtual] int IdentityTreeModel::rowCount(const QModelIndex &parent = QModelIndex()) const

Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

Returns the number of rows under the given parent parent the parent model index Returns the number of rows

[override virtual] bool IdentityTreeModel::setData(const QModelIndex &modelIndex, const QVariant &value, int role = Qt::DisplayRole)

Reimplements: QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role).

Sets the data for the given index modelIndex the model index to set data for value the value to set role the data role to set Returns true if the data was successfully set, false otherwise

See also data().

void IdentityTreeModel::setShowDefault(bool show)

Sets whether to show the default identity show true to show the default identity with "(default)" suffix

int IdentityTreeModel::uoidIndex(int uoid) const

Returns the row index for the identity with the given UOID uoid the unique object identifier to search for Returns the row index of the identity, or -1 if not found