Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/rootmodel.h
Show All 16 Lines | |||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #ifndef ROOTMODEL_H | 20 | #ifndef ROOTMODEL_H | ||
21 | #define ROOTMODEL_H | 21 | #define ROOTMODEL_H | ||
22 | 22 | | |||
23 | #include "appsmodel.h" | 23 | #include "appsmodel.h" | ||
24 | 24 | | |||
25 | #include <QQmlParserStatus> | | |||
26 | | ||||
27 | class KAStatsFavoritesModel; | 25 | class KAStatsFavoritesModel; | ||
28 | class RecentContactsModel; | 26 | class RecentContactsModel; | ||
29 | class RecentUsageModel; | 27 | class RecentUsageModel; | ||
30 | class SystemModel; | 28 | class SystemModel; | ||
31 | 29 | | |||
32 | class RootModel; | 30 | class RootModel; | ||
33 | 31 | | |||
34 | class GroupEntry : public AbstractGroupEntry | 32 | class GroupEntry : public AbstractGroupEntry | ||
Show All 9 Lines | 34 | public: | |||
44 | AbstractModel *childModel() const override; | 42 | AbstractModel *childModel() const override; | ||
45 | 43 | | |||
46 | private: | 44 | private: | ||
47 | QString m_name; | 45 | QString m_name; | ||
48 | QString m_iconName; | 46 | QString m_iconName; | ||
49 | QPointer<AbstractModel> m_childModel; | 47 | QPointer<AbstractModel> m_childModel; | ||
50 | }; | 48 | }; | ||
51 | 49 | | |||
52 | class RootModel : public AppsModel, public QQmlParserStatus | 50 | class RootModel : public AppsModel | ||
53 | { | 51 | { | ||
54 | Q_OBJECT | 52 | Q_OBJECT | ||
55 | Q_INTERFACES(QQmlParserStatus) | | |||
56 | | ||||
57 | Q_PROPERTY(bool autoPopulate READ autoPopulate WRITE setAutoPopulate NOTIFY autoPopulateChanged) | | |||
58 | 53 | | |||
59 | Q_PROPERTY(QObject* systemFavoritesModel READ systemFavoritesModel NOTIFY systemFavoritesModelChanged) | 54 | Q_PROPERTY(QObject* systemFavoritesModel READ systemFavoritesModel NOTIFY systemFavoritesModelChanged) | ||
60 | Q_PROPERTY(bool showAllApps READ showAllApps WRITE setShowAllApps NOTIFY showAllAppsChanged) | 55 | Q_PROPERTY(bool showAllApps READ showAllApps WRITE setShowAllApps NOTIFY showAllAppsChanged) | ||
61 | Q_PROPERTY(bool showRecentApps READ showRecentApps WRITE setShowRecentApps NOTIFY showRecentAppsChanged) | 56 | Q_PROPERTY(bool showRecentApps READ showRecentApps WRITE setShowRecentApps NOTIFY showRecentAppsChanged) | ||
62 | Q_PROPERTY(bool showRecentDocs READ showRecentDocs WRITE setShowRecentDocs NOTIFY showRecentDocsChanged) | 57 | Q_PROPERTY(bool showRecentDocs READ showRecentDocs WRITE setShowRecentDocs NOTIFY showRecentDocsChanged) | ||
63 | Q_PROPERTY(bool showRecentContacts READ showRecentContacts WRITE setShowRecentContacts NOTIFY showRecentContactsChanged) | 58 | Q_PROPERTY(bool showRecentContacts READ showRecentContacts WRITE setShowRecentContacts NOTIFY showRecentContactsChanged) | ||
64 | Q_PROPERTY(int recentOrdering READ recentOrdering WRITE setRecentOrdering NOTIFY recentOrderingChanged) | 59 | Q_PROPERTY(int recentOrdering READ recentOrdering WRITE setRecentOrdering NOTIFY recentOrderingChanged) | ||
65 | Q_PROPERTY(bool showPowerSession READ showPowerSession WRITE setShowPowerSession NOTIFY showPowerSessionChanged) | 60 | Q_PROPERTY(bool showPowerSession READ showPowerSession WRITE setShowPowerSession NOTIFY showPowerSessionChanged) | ||
66 | 61 | | |||
67 | public: | 62 | public: | ||
68 | explicit RootModel(QObject *parent = 0); | 63 | explicit RootModel(QObject *parent = 0); | ||
69 | ~RootModel(); | 64 | ~RootModel(); | ||
70 | 65 | | |||
71 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | 66 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||
72 | 67 | | |||
73 | Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument) override; | 68 | Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument) override; | ||
74 | 69 | | |||
75 | bool autoPopulate() const; | | |||
76 | void setAutoPopulate(bool populate); | | |||
77 | | ||||
78 | bool showAllApps() const; | 70 | bool showAllApps() const; | ||
79 | void setShowAllApps(bool show); | 71 | void setShowAllApps(bool show); | ||
80 | 72 | | |||
81 | bool showRecentApps() const; | 73 | bool showRecentApps() const; | ||
82 | void setShowRecentApps(bool show); | 74 | void setShowRecentApps(bool show); | ||
83 | 75 | | |||
84 | bool showRecentDocs() const; | 76 | bool showRecentDocs() const; | ||
85 | void setShowRecentDocs(bool show); | 77 | void setShowRecentDocs(bool show); | ||
86 | 78 | | |||
87 | bool showRecentContacts() const; | 79 | bool showRecentContacts() const; | ||
88 | void setShowRecentContacts(bool show); | 80 | void setShowRecentContacts(bool show); | ||
89 | 81 | | |||
90 | int recentOrdering() const; | 82 | int recentOrdering() const; | ||
91 | void setRecentOrdering(int ordering); | 83 | void setRecentOrdering(int ordering); | ||
92 | 84 | | |||
93 | bool showPowerSession() const; | 85 | bool showPowerSession() const; | ||
94 | void setShowPowerSession(bool show); | 86 | void setShowPowerSession(bool show); | ||
95 | 87 | | |||
96 | AbstractModel* favoritesModel() override; | 88 | AbstractModel* favoritesModel() override; | ||
97 | AbstractModel* systemFavoritesModel(); | 89 | AbstractModel* systemFavoritesModel(); | ||
98 | 90 | | |||
99 | void classBegin() override; | | |||
100 | void componentComplete() override; | | |||
101 | | ||||
102 | Q_SIGNALS: | 91 | Q_SIGNALS: | ||
103 | void refreshed() const; | 92 | void refreshed() const; | ||
104 | void systemFavoritesModelChanged() const; | 93 | void systemFavoritesModelChanged() const; | ||
105 | void autoPopulateChanged() const; | | |||
106 | void showAllAppsChanged() const; | 94 | void showAllAppsChanged() const; | ||
107 | void showRecentAppsChanged() const; | 95 | void showRecentAppsChanged() const; | ||
108 | void showRecentDocsChanged() const; | 96 | void showRecentDocsChanged() const; | ||
109 | void showRecentContactsChanged() const; | 97 | void showRecentContactsChanged() const; | ||
110 | void showPowerSessionChanged() const; | 98 | void showPowerSessionChanged() const; | ||
111 | void recentOrderingChanged() const; | 99 | void recentOrderingChanged() const; | ||
112 | void recentAppsModelChanged() const; | 100 | void recentAppsModelChanged() const; | ||
113 | 101 | | |||
114 | protected Q_SLOTS: | 102 | protected Q_SLOTS: | ||
115 | void refresh() override; | 103 | void refresh() override; | ||
116 | 104 | | |||
117 | private: | 105 | private: | ||
118 | bool m_complete; | | |||
119 | | ||||
120 | KAStatsFavoritesModel *m_favorites; | 106 | KAStatsFavoritesModel *m_favorites; | ||
121 | SystemModel *m_systemModel; | 107 | SystemModel *m_systemModel; | ||
122 | 108 | | |||
123 | bool m_autoPopulate; | | |||
124 | | ||||
125 | bool m_showAllApps; | 109 | bool m_showAllApps; | ||
126 | bool m_showRecentApps; | 110 | bool m_showRecentApps; | ||
127 | bool m_showRecentDocs; | 111 | bool m_showRecentDocs; | ||
128 | bool m_showRecentContacts; | 112 | bool m_showRecentContacts; | ||
129 | int m_recentOrdering; | 113 | int m_recentOrdering; | ||
130 | bool m_showPowerSession; | 114 | bool m_showPowerSession; | ||
131 | 115 | | |||
132 | RecentUsageModel *m_recentAppsModel; | 116 | RecentUsageModel *m_recentAppsModel; | ||
133 | RecentUsageModel *m_recentDocsModel; | 117 | RecentUsageModel *m_recentDocsModel; | ||
134 | RecentContactsModel *m_recentContactsModel; | 118 | RecentContactsModel *m_recentContactsModel; | ||
135 | }; | 119 | }; | ||
136 | 120 | | |||
137 | #endif | 121 | #endif |