Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/kopenwithdialog_p.h
Show All 16 Lines | 1 | /* This file is part of the KDE libraries | |||
---|---|---|---|---|---|
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef OPENWITHDIALOG_P_H | 21 | #ifndef OPENWITHDIALOG_P_H | ||
22 | #define OPENWITHDIALOG_P_H | 22 | #define OPENWITHDIALOG_P_H | ||
23 | 23 | | |||
24 | #include <QtCore/QAbstractItemModel> | 24 | #include <QtCore/QAbstractItemModel> | ||
25 | #include <QSortFilterProxyModel> | ||||
25 | #include <QTreeView> | 26 | #include <QTreeView> | ||
26 | 27 | | |||
27 | class KApplicationModelPrivate; | 28 | class KApplicationModelPrivate; | ||
28 | 29 | | |||
29 | /** | 30 | /** | ||
30 | * @internal | 31 | * @internal | ||
31 | */ | 32 | */ | ||
32 | class KApplicationModel : public QAbstractItemModel | 33 | class KApplicationModel : public QAbstractItemModel | ||
Show All 12 Lines | 44 | // Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; | |||
45 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | 46 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | ||
46 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | 47 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
47 | QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; | 48 | QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; | ||
48 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | 49 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
49 | 50 | | |||
50 | QString entryPathFor(const QModelIndex &index) const; | 51 | QString entryPathFor(const QModelIndex &index) const; | ||
51 | QString execFor(const QModelIndex &index) const; | 52 | QString execFor(const QModelIndex &index) const; | ||
52 | bool isDirectory(const QModelIndex &index) const; | 53 | bool isDirectory(const QModelIndex &index) const; | ||
54 | void fetchAll(const QModelIndex &parent); | ||||
53 | 55 | | |||
54 | private: | 56 | private: | ||
55 | friend class KApplicationModelPrivate; | 57 | friend class KApplicationModelPrivate; | ||
56 | KApplicationModelPrivate *const d; | 58 | KApplicationModelPrivate *const d; | ||
57 | 59 | | |||
58 | Q_DISABLE_COPY(KApplicationModel) | 60 | Q_DISABLE_COPY(KApplicationModel) | ||
59 | }; | 61 | }; | ||
60 | 62 | | |||
63 | /** | ||||
64 | * @internal | ||||
65 | */ | ||||
66 | class QTreeViewProxyFilter : public QSortFilterProxyModel | ||||
67 | { | ||||
68 | Q_OBJECT | ||||
69 | | ||||
70 | public: | ||||
71 | QTreeViewProxyFilter(QObject *parent = nullptr); | ||||
72 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; | ||||
73 | }; | ||||
74 | | ||||
61 | class KApplicationViewPrivate; | 75 | class KApplicationViewPrivate; | ||
62 | 76 | | |||
63 | /** | 77 | /** | ||
64 | * @internal | 78 | * @internal | ||
65 | */ | 79 | */ | ||
66 | class KApplicationView : public QTreeView | 80 | class KApplicationView : public QTreeView | ||
67 | { | 81 | { | ||
68 | Q_OBJECT | 82 | Q_OBJECT | ||
69 | 83 | | |||
70 | public: | 84 | public: | ||
71 | KApplicationView(QWidget *parent = nullptr); | 85 | KApplicationView(QWidget *parent = nullptr); | ||
72 | ~KApplicationView(); | 86 | ~KApplicationView(); | ||
73 | 87 | | |||
74 | void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; | 88 | void setModels(KApplicationModel *model, QSortFilterProxyModel *proxyModel); | ||
89 | QSortFilterProxyModel* proxyModel(); | ||||
75 | 90 | | |||
76 | bool isDirSel() const; | 91 | bool isDirSel() const; | ||
77 | 92 | | |||
78 | Q_SIGNALS: | 93 | Q_SIGNALS: | ||
79 | void selected(const QString &_name, const QString &_exec); | 94 | void selected(const QString &_name, const QString &_exec); | ||
80 | void highlighted(const QString &_name, const QString &_exec); | 95 | void highlighted(const QString &_name, const QString &_exec); | ||
81 | 96 | | |||
82 | protected Q_SLOTS: | 97 | protected Q_SLOTS: | ||
Show All 13 Lines |