Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/recentusagemodel.h
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
61 | }; | 61 | }; | ||
62 | 62 | | |||
63 | class RecentUsageModel : public ForwardingModel, public QQmlParserStatus | 63 | class RecentUsageModel : public ForwardingModel, public QQmlParserStatus | ||
64 | { | 64 | { | ||
65 | Q_OBJECT | 65 | Q_OBJECT | ||
66 | Q_INTERFACES(QQmlParserStatus) | 66 | Q_INTERFACES(QQmlParserStatus) | ||
67 | 67 | | |||
68 | Q_PROPERTY(int ordering READ ordering WRITE setOrdering NOTIFY orderingChanged) | 68 | Q_PROPERTY(int ordering READ ordering WRITE setOrdering NOTIFY orderingChanged) | ||
69 | Q_PROPERTY(IncludeUsage shownItems READ shownItems WRITE setShownItems NOTIFY shownItemsChanged) | ||||
davidedmundson: Can we pick something a bit more specific.
Everything fits under "usage" | |||||
69 | 70 | | |||
70 | public: | 71 | public: | ||
71 | enum IncludeUsage { AppsAndDocs, OnlyApps, OnlyDocs }; | 72 | enum IncludeUsage { | ||
73 | AppsAndDocs, | ||||
74 | OnlyApps, | ||||
75 | OnlyDocs | ||||
76 | }; | ||||
77 | Q_ENUM(IncludeUsage) | ||||
78 | | ||||
72 | enum Ordering { Recent, Popular }; | 79 | enum Ordering { Recent, Popular }; | ||
73 | 80 | | |||
74 | explicit RecentUsageModel( | 81 | explicit RecentUsageModel( | ||
75 | QObject *parent = nullptr, | 82 | QObject *parent = nullptr, | ||
76 | IncludeUsage usage = AppsAndDocs, | 83 | IncludeUsage usage = AppsAndDocs, | ||
77 | int ordering = Recent); | 84 | int ordering = Recent); | ||
78 | ~RecentUsageModel() override; | 85 | ~RecentUsageModel() override; | ||
79 | 86 | | |||
80 | QString description() const override; | 87 | QString description() const override; | ||
81 | 88 | | |||
82 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | 89 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||
83 | 90 | | |||
84 | Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument) override; | 91 | Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument) override; | ||
85 | 92 | | |||
86 | bool hasActions() const override; | 93 | bool hasActions() const override; | ||
87 | QVariantList actions() const override; | 94 | QVariantList actions() const override; | ||
88 | 95 | | |||
89 | IncludeUsage usage() const; | 96 | void setShownItems(IncludeUsage usage); | ||
97 | IncludeUsage shownItems() const; | ||||
90 | 98 | | |||
91 | void setOrdering(int ordering); | 99 | void setOrdering(int ordering); | ||
92 | int ordering() const; | 100 | int ordering() const; | ||
93 | 101 | | |||
94 | void classBegin() override; | 102 | void classBegin() override; | ||
95 | void componentComplete() override; | 103 | void componentComplete() override; | ||
96 | 104 | | |||
97 | Q_SIGNALS: | 105 | Q_SIGNALS: | ||
98 | void orderingChanged(int ordering); | 106 | void orderingChanged(int ordering); | ||
107 | void shownItemsChanged(); | ||||
99 | 108 | | |||
100 | private Q_SLOTS: | 109 | private Q_SLOTS: | ||
101 | void refresh() override; | 110 | void refresh() override; | ||
102 | 111 | | |||
103 | private: | 112 | private: | ||
104 | QVariant appData(const QString &resource, int role) const; | 113 | QVariant appData(const QString &resource, int role) const; | ||
105 | QVariant docData(const QString &resource, int role) const; | 114 | QVariant docData(const QString &resource, int role) const; | ||
106 | 115 | | |||
Show All 16 Lines |
Can we pick something a bit more specific.
Everything fits under "usage"