File indexing completed on 2024-11-17 04:18:47
0001 /* 0002 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #ifndef CLIENTMODEL_H 0007 #define CLIENTMODEL_H 0008 0009 #include "managementinterface.h" 0010 0011 #include <QAbstractListModel> 0012 0013 /** Model for all registered push notification client. */ 0014 class ClientModel : public QAbstractListModel 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit ClientModel(org::kde::kunifiedpush::Management *iface, QObject *parent = nullptr); 0019 ~ClientModel(); 0020 0021 enum Role { 0022 NameRole = Qt::DisplayRole, 0023 DescriptionRole = Qt::UserRole, 0024 IconNameRole, 0025 TokenRole, 0026 }; 0027 0028 int rowCount(const QModelIndex &parent) const override; 0029 QVariant data(const QModelIndex &index, int role) const override; 0030 QHash<int, QByteArray> roleNames() const override; 0031 0032 public Q_SLOTS: 0033 void reload(); 0034 0035 private: 0036 org::kde::kunifiedpush::Management *m_iface = nullptr; 0037 QList<KUnifiedPush::ClientInfo> m_clients; 0038 0039 }; 0040 0041 #endif // CLIENTMODEL_H