Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/rootmodel.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | AbstractModel *GroupEntry::childModel() const | 60 | AbstractModel *GroupEntry::childModel() const | ||
61 | { | 61 | { | ||
62 | return m_childModel; | 62 | return m_childModel; | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | RootModel::RootModel(QObject *parent) : AppsModel(QString(), parent) | 65 | RootModel::RootModel(QObject *parent) : AppsModel(QString(), parent) | ||
66 | , m_complete(false) | | |||
67 | , m_favorites(new KAStatsFavoritesModel(this)) | 66 | , m_favorites(new KAStatsFavoritesModel(this)) | ||
68 | , m_systemModel(nullptr) | 67 | , m_systemModel(nullptr) | ||
69 | , m_autoPopulate(true) | | |||
70 | , m_showAllApps(false) | 68 | , m_showAllApps(false) | ||
71 | , m_showRecentApps(true) | 69 | , m_showRecentApps(true) | ||
72 | , m_showRecentDocs(true) | 70 | , m_showRecentDocs(true) | ||
73 | , m_showRecentContacts(false) | 71 | , m_showRecentContacts(false) | ||
74 | , m_recentOrdering(RecentUsageModel::Recent) | 72 | , m_recentOrdering(RecentUsageModel::Recent) | ||
75 | , m_showPowerSession(true) | 73 | , m_showPowerSession(true) | ||
76 | , m_recentAppsModel(0) | 74 | , m_recentAppsModel(0) | ||
77 | , m_recentDocsModel(0) | 75 | , m_recentDocsModel(0) | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 121 | if (entry->type() == AbstractEntry::GroupType) { | |||
140 | } else if (entry->childModel()->hasActions()) { | 138 | } else if (entry->childModel()->hasActions()) { | ||
141 | return entry->childModel()->trigger(-1, actionId, QVariant()); | 139 | return entry->childModel()->trigger(-1, actionId, QVariant()); | ||
142 | } | 140 | } | ||
143 | } | 141 | } | ||
144 | 142 | | |||
145 | return AppsModel::trigger(row, actionId, argument); | 143 | return AppsModel::trigger(row, actionId, argument); | ||
146 | } | 144 | } | ||
147 | 145 | | |||
148 | bool RootModel::autoPopulate() const | | |||
149 | { | | |||
150 | return m_autoPopulate; | | |||
151 | } | | |||
152 | | ||||
153 | void RootModel::setAutoPopulate(bool populate) | | |||
154 | { | | |||
155 | if (m_autoPopulate != populate) { | | |||
156 | m_autoPopulate = populate; | | |||
157 | | ||||
158 | emit autoPopulateChanged(); | | |||
159 | } | | |||
160 | } | | |||
161 | | ||||
162 | bool RootModel::showAllApps() const | 146 | bool RootModel::showAllApps() const | ||
163 | { | 147 | { | ||
164 | return m_showAllApps; | 148 | return m_showAllApps; | ||
165 | } | 149 | } | ||
166 | 150 | | |||
167 | void RootModel::setShowAllApps(bool show) | 151 | void RootModel::setShowAllApps(bool show) | ||
168 | { | 152 | { | ||
169 | if (m_showAllApps != show) { | 153 | if (m_showAllApps != show) { | ||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | |||||
264 | { | 248 | { | ||
265 | if (m_systemModel) { | 249 | if (m_systemModel) { | ||
266 | return m_systemModel->favoritesModel(); | 250 | return m_systemModel->favoritesModel(); | ||
267 | } | 251 | } | ||
268 | 252 | | |||
269 | return nullptr; | 253 | return nullptr; | ||
270 | } | 254 | } | ||
271 | 255 | | |||
272 | void RootModel::classBegin() | | |||
273 | { | | |||
274 | } | | |||
275 | | ||||
276 | void RootModel::componentComplete() | | |||
277 | { | | |||
278 | m_complete = true; | | |||
279 | | ||||
280 | if (m_autoPopulate) { | | |||
281 | refresh(); | | |||
282 | } | | |||
283 | } | | |||
284 | | ||||
285 | void RootModel::refresh() | 256 | void RootModel::refresh() | ||
286 | { | 257 | { | ||
287 | if (!m_complete) { | 258 | if (!m_complete) { | ||
288 | return; | 259 | return; | ||
289 | } | 260 | } | ||
290 | 261 | | |||
291 | beginResetModel(); | 262 | beginResetModel(); | ||
292 | 263 | | |||
▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines |