Warning, file /plasma/plasma-systemmonitor/src/ToolsModel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QAbstractListModel> 0010 #include <QQmlParserStatus> 0011 0012 #include <KService> 0013 0014 class QDBusInterface; 0015 0016 /** 0017 * @todo write docs 0018 */ 0019 class ToolsModel : public QAbstractListModel 0020 { 0021 Q_OBJECT 0022 0023 public: 0024 enum Roles { 0025 IdRole = Qt::UserRole, 0026 NameRole, 0027 IconRole, 0028 ShortcutRole, 0029 }; 0030 0031 explicit ToolsModel(QObject *parent = nullptr); 0032 0033 QHash<int, QByteArray> roleNames() const override; 0034 int rowCount(const QModelIndex &parent) const override; 0035 QVariant data(const QModelIndex &index, int role) const override; 0036 0037 Q_INVOKABLE void trigger(const QString &id); 0038 0039 private: 0040 void addFromService(const QString &serviceName); 0041 0042 struct Entry { 0043 QString id; 0044 QString name; 0045 QString icon; 0046 QString shortcut; 0047 KService::Ptr service; 0048 }; 0049 QVector<Entry> m_entries; 0050 };