KIdentityManagement

identitymodel.h
1// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
2// SPDX-FileCopyrightText: 2023 Claudio Cambra <claudio.cambra@kde.org>
3// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
4
5#pragma once
6
7#include "kidentitymanagementcore_export.h"
8
9#include <QAbstractListModel>
10
11#include "identitymanager.h"
12
13namespace KIdentityManagementCore
14{
15
16class IdentityManager;
17
18class KIDENTITYMANAGEMENTCORE_EXPORT IdentityModel : public QAbstractListModel
19{
20 Q_OBJECT
21
22public:
23 enum Roles {
24 EmailRole = Qt::UserRole,
25 UoidRole,
26 IdentityNameRole,
27 DisplayNameRole,
28 DefaultRole,
29 };
30
31 explicit IdentityModel(QObject *parent = nullptr);
32 ~IdentityModel() override;
33
34 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
35 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
36 QHash<int, QByteArray> roleNames() const override;
37
38 /**
39 * @return the email address of the identity with the given uoid.
40 * @param uiod for the identity in question
41 */
42 Q_INVOKABLE QString email(uint uoid);
43
44private:
45 KIDENTITYMANAGEMENTCORE_NO_EXPORT void reloadUoidList();
46 QList<int> m_identitiesUoid;
47 IdentityManager *const m_identityManager;
48};
49}
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.