Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/appsmodel.h
Show All 29 Lines | |||||
30 | 30 | | |||
31 | class QTimer; | 31 | class QTimer; | ||
32 | 32 | | |||
33 | class AppsModel : public AbstractModel | 33 | class AppsModel : public AbstractModel | ||
34 | { | 34 | { | ||
35 | Q_OBJECT | 35 | Q_OBJECT | ||
36 | 36 | | |||
37 | Q_PROPERTY(bool flat READ flat WRITE setFlat NOTIFY flatChanged) | 37 | Q_PROPERTY(bool flat READ flat WRITE setFlat NOTIFY flatChanged) | ||
38 | Q_PROPERTY(bool sorted READ sorted WRITE setSorted NOTIFY sortedChanged) | ||||
38 | Q_PROPERTY(bool showSeparators READ showSeparators WRITE setShowSeparators NOTIFY showSeparatorsChanged) | 39 | Q_PROPERTY(bool showSeparators READ showSeparators WRITE setShowSeparators NOTIFY showSeparatorsChanged) | ||
39 | Q_PROPERTY(int appNameFormat READ appNameFormat WRITE setAppNameFormat NOTIFY appNameFormatChanged) | 40 | Q_PROPERTY(int appNameFormat READ appNameFormat WRITE setAppNameFormat NOTIFY appNameFormatChanged) | ||
40 | Q_PROPERTY(QObject* appletInterface READ appletInterface WRITE setAppletInterface NOTIFY appletInterfaceChanged); | 41 | Q_PROPERTY(QObject* appletInterface READ appletInterface WRITE setAppletInterface NOTIFY appletInterfaceChanged); | ||
41 | 42 | | |||
42 | public: | 43 | public: | ||
43 | explicit AppsModel(const QString &entryPath = QString(), bool flat = false, bool separators = true, QObject *parent = 0); | 44 | explicit AppsModel(const QString &entryPath = QString(), bool flat = false, bool sorted = true, bool separators = true, QObject *parent = 0); | ||
44 | explicit AppsModel(const QList<AbstractEntry *> entryList, bool deleteEntriesOnDestruction, QObject *parent = 0); | 45 | explicit AppsModel(const QList<AbstractEntry *> entryList, bool deleteEntriesOnDestruction, QObject *parent = 0); | ||
45 | ~AppsModel(); | 46 | ~AppsModel(); | ||
46 | 47 | | |||
47 | QString description() const; | 48 | QString description() const; | ||
48 | void setDescription(const QString &text); | 49 | void setDescription(const QString &text); | ||
49 | 50 | | |||
50 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | 51 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | ||
51 | 52 | | |||
52 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; | 53 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; | ||
53 | 54 | | |||
54 | int rowCount(const QModelIndex &parent = QModelIndex()) const; | 55 | int rowCount(const QModelIndex &parent = QModelIndex()) const; | ||
55 | 56 | | |||
56 | Q_INVOKABLE virtual bool trigger(int row, const QString &actionId, const QVariant &argument); | 57 | Q_INVOKABLE virtual bool trigger(int row, const QString &actionId, const QVariant &argument); | ||
57 | 58 | | |||
58 | Q_INVOKABLE AbstractModel *modelForRow(int row); | 59 | Q_INVOKABLE AbstractModel *modelForRow(int row); | ||
59 | Q_INVOKABLE int rowForModel(AbstractModel *model); | 60 | Q_INVOKABLE int rowForModel(AbstractModel *model); | ||
60 | 61 | | |||
61 | int separatorCount() const; | 62 | int separatorCount() const; | ||
62 | 63 | | |||
63 | bool flat() const; | 64 | bool flat() const; | ||
64 | void setFlat(bool flat); | 65 | void setFlat(bool flat); | ||
65 | 66 | | |||
67 | bool sorted() const; | ||||
68 | void setSorted(bool sorted); | ||||
69 | | ||||
66 | bool showSeparators() const; | 70 | bool showSeparators() const; | ||
67 | void setShowSeparators(bool showSeparators); | 71 | void setShowSeparators(bool showSeparators); | ||
68 | 72 | | |||
69 | int appNameFormat() const; | 73 | int appNameFormat() const; | ||
70 | void setAppNameFormat(int format); | 74 | void setAppNameFormat(int format); | ||
71 | 75 | | |||
72 | QObject *appletInterface() const; | 76 | QObject *appletInterface() const; | ||
73 | void setAppletInterface(QObject *appletInterface); | 77 | void setAppletInterface(QObject *appletInterface); | ||
74 | 78 | | |||
75 | QStringList hiddenEntries() const; | 79 | QStringList hiddenEntries() const; | ||
76 | 80 | | |||
77 | void entryChanged(AbstractEntry *entry); | 81 | void entryChanged(AbstractEntry *entry); | ||
78 | 82 | | |||
79 | Q_SIGNALS: | 83 | Q_SIGNALS: | ||
80 | void cleared() const; | 84 | void cleared() const; | ||
81 | void flatChanged() const; | 85 | void flatChanged() const; | ||
86 | void sortedChanged() const; | ||||
82 | void showSeparatorsChanged() const; | 87 | void showSeparatorsChanged() const; | ||
83 | void appNameFormatChanged() const; | 88 | void appNameFormatChanged() const; | ||
84 | void appletInterfaceChanged() const; | 89 | void appletInterfaceChanged() const; | ||
85 | void hiddenEntriesChanged() const; | 90 | void hiddenEntriesChanged() const; | ||
86 | 91 | | |||
87 | protected Q_SLOTS: | 92 | protected Q_SLOTS: | ||
88 | virtual void refresh(); | 93 | virtual void refresh(); | ||
89 | 94 | | |||
Show All 14 Lines | 108 | private: | |||
104 | void processServiceGroup(KServiceGroup::Ptr group); | 109 | void processServiceGroup(KServiceGroup::Ptr group); | ||
105 | void sortEntries(); | 110 | void sortEntries(); | ||
106 | 111 | | |||
107 | QString m_description; | 112 | QString m_description; | ||
108 | QString m_entryPath; | 113 | QString m_entryPath; | ||
109 | bool m_staticEntryList; | 114 | bool m_staticEntryList; | ||
110 | QTimer *m_changeTimer; | 115 | QTimer *m_changeTimer; | ||
111 | bool m_flat; | 116 | bool m_flat; | ||
112 | bool m_sortNeeded; | 117 | bool m_sorted; | ||
113 | AppEntry::NameFormat m_appNameFormat; | 118 | AppEntry::NameFormat m_appNameFormat; | ||
114 | QStringList m_hiddenEntries; | 119 | QStringList m_hiddenEntries; | ||
115 | static MenuEntryEditor *m_menuEntryEditor; | 120 | static MenuEntryEditor *m_menuEntryEditor; | ||
116 | }; | 121 | }; | ||
117 | 122 | | |||
118 | #endif | 123 | #endif |