Changeset View
Changeset View
Standalone View
Standalone View
Modules/samba/ksambasharemodel.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org> | ||||
3 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL | ||||
4 | */ | ||||
5 | | ||||
6 | #ifndef KSAMBASHAREMODEL_H | ||||
7 | #define KSAMBASHAREMODEL_H | ||||
8 | | ||||
9 | #include <QAbstractListModel> | ||||
10 | #include <KIOCore/KSambaShareData> | ||||
11 | | ||||
12 | /** | ||||
13 | * Model of ksamabasharedata. Implementing properties | ||||
14 | * as columns rather than roles. | ||||
15 | */ | ||||
16 | class KSambaShareModel : public QAbstractListModel | ||||
17 | { | ||||
18 | Q_OBJECT | ||||
19 | public: | ||||
20 | enum class ColumnRole { | ||||
21 | Name, | ||||
22 | Path, | ||||
23 | Comment, | ||||
24 | ColumnCount, // End marker | ||||
25 | }; | ||||
26 | | ||||
27 | explicit KSambaShareModel(QObject *parent = nullptr); | ||||
28 | ~KSambaShareModel() override; | ||||
29 | | ||||
30 | int rowCount(const QModelIndex &parent) const override; | ||||
31 | int columnCount(const QModelIndex &parent) const override; | ||||
32 | QVariant headerData(int section, Qt::Orientation orientation, int role) const override; | ||||
33 | QVariant data(const QModelIndex &index, int role) const override; | ||||
34 | bool hasChildren(const QModelIndex &parent) const override; | ||||
35 | | ||||
36 | public slots: | ||||
37 | void reloadData(); | ||||
38 | | ||||
39 | private: | ||||
40 | QList<KSambaShareData> m_list; | ||||
41 | }; | ||||
42 | | ||||
43 | #endif // KSAMBASHAREMODEL_H |