Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/recentusagemodel.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 38 | { | |||
---|---|---|---|---|---|
51 | private: | 51 | private: | ||
52 | QPointer<AbstractModel> m_parentModel; | 52 | QPointer<AbstractModel> m_parentModel; | ||
53 | }; | 53 | }; | ||
54 | 54 | | |||
55 | class RecentUsageModel : public ForwardingModel | 55 | class RecentUsageModel : public ForwardingModel | ||
56 | { | 56 | { | ||
57 | Q_OBJECT | 57 | Q_OBJECT | ||
58 | 58 | | |||
59 | Q_PROPERTY(int ordering READ ordering WRITE setOrdering NOTIFY orderingChanged) | ||||
60 | | ||||
59 | public: | 61 | public: | ||
60 | enum IncludeUsage { AppsAndDocs, OnlyApps, OnlyDocs }; | 62 | enum IncludeUsage { AppsAndDocs, OnlyApps, OnlyDocs }; | ||
63 | enum Ordering { Recent, Popular }; | ||||
61 | 64 | | |||
62 | explicit RecentUsageModel(QObject *parent = 0, IncludeUsage usage = AppsAndDocs); | 65 | explicit RecentUsageModel( | ||
66 | QObject *parent = 0, | ||||
67 | IncludeUsage usage = AppsAndDocs, | ||||
68 | int ordering = Recent); | ||||
63 | ~RecentUsageModel(); | 69 | ~RecentUsageModel(); | ||
64 | 70 | | |||
65 | QString description() const; | 71 | QString description() const; | ||
66 | 72 | | |||
67 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | 73 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | ||
68 | 74 | | |||
69 | Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument); | 75 | Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument); | ||
70 | 76 | | |||
71 | bool hasActions() const; | 77 | bool hasActions() const; | ||
72 | QVariantList actions() const; | 78 | QVariantList actions() const; | ||
73 | 79 | | |||
74 | IncludeUsage usage() const; | 80 | IncludeUsage usage() const; | ||
75 | 81 | | |||
82 | void setOrdering(int ordering); | ||||
83 | int ordering() const; | ||||
84 | | ||||
85 | Q_SIGNALS: | ||||
86 | void orderingChanged(int ordering); | ||||
87 | | ||||
76 | private Q_SLOTS: | 88 | private Q_SLOTS: | ||
77 | void refresh(); | 89 | void refresh(); | ||
78 | 90 | | |||
79 | private: | 91 | private: | ||
80 | QVariant appData(const QString &resource, int role) const; | 92 | QVariant appData(const QString &resource, int role) const; | ||
81 | QVariant docData(const QString &resource, int role) const; | 93 | QVariant docData(const QString &resource, int role) const; | ||
82 | 94 | | |||
83 | QString resourceAt(int row) const; | 95 | QString resourceAt(int row) const; | ||
84 | 96 | | |||
85 | QString forgetAllActionName() const; | 97 | QString forgetAllActionName() const; | ||
86 | 98 | | |||
87 | IncludeUsage m_usage; | 99 | IncludeUsage m_usage; | ||
88 | QPointer<QAbstractItemModel> m_activitiesModel; | 100 | QPointer<QAbstractItemModel> m_activitiesModel; | ||
101 | | ||||
102 | Ordering m_ordering; | ||||
89 | }; | 103 | }; | ||
90 | 104 | | |||
91 | #endif | 105 | #endif |