1 | /* |
2 | SPDX-FileCopyrightText: 2021 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #ifndef SEARCHPRESETMODEL_H |
8 | #define SEARCHPRESETMODEL_H |
9 | |
10 | #include "provider.h" |
11 | #include "quickengine.h" |
12 | #include <QAbstractListModel> |
13 | |
14 | /** |
15 | * @brief The SearchPresetModel class |
16 | * |
17 | * this class handles search presets. |
18 | * @since 5.83 |
19 | */ |
20 | class SearchPresetModel : public QAbstractListModel |
21 | { |
22 | Q_OBJECT |
23 | public: |
24 | explicit SearchPresetModel(KNSCore::EngineBase *parent); |
25 | ~SearchPresetModel() override; |
26 | |
27 | enum Roles { |
28 | DisplayNameRole = Qt::UserRole + 1, |
29 | IconRole, |
30 | }; |
31 | Q_ENUM(Roles) |
32 | |
33 | QHash<int, QByteArray> roleNames() const override; |
34 | |
35 | QVariant data(const QModelIndex &index, int role = DisplayNameRole) const override; |
36 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
37 | |
38 | Q_INVOKABLE void loadSearch(const QModelIndex &index); |
39 | |
40 | private: |
41 | KNSCore::EngineBase *const m_engine; |
42 | }; |
43 | |
44 | #endif // SEARCHPRESETMODEL_H |
45 | |