summaryrefslogtreecommitdiff
path: root/src/lib/xdgdesktopentries.h
diff options
context:
space:
mode:
authorFabien Proriol <fabien.proriol@kazoe.org>2025-05-25 12:13:31 +0200
committerFabien Proriol <fabien.proriol@kazoe.org>2025-05-25 12:13:31 +0200
commit1dbc0e3c88ba271ba35bc3f82e7864c4f35e1236 (patch)
tree8c491cd196e2eff4c59f8c23f566f7ff26981586 /src/lib/xdgdesktopentries.h
Initial Commit
Diffstat (limited to 'src/lib/xdgdesktopentries.h')
-rw-r--r--src/lib/xdgdesktopentries.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/lib/xdgdesktopentries.h b/src/lib/xdgdesktopentries.h
new file mode 100644
index 0000000..89aff08
--- /dev/null
+++ b/src/lib/xdgdesktopentries.h
@@ -0,0 +1,58 @@
+#ifndef XDGDESKTOPENTRIES_H
+#define XDGDESKTOPENTRIES_H
+
+#include <QAbstractListModel>
+#include <QObject>
+#include "xdgentries.h"
+
+namespace xdg {
+ class DesktopEntries : public QAbstractListModel
+ {
+ Q_OBJECT
+ Q_PROPERTY(QStringList categories READ categories NOTIFY categoriesChanged)
+ xdg::Entries m_entries;
+
+ private slots:
+ bool _contains(QString path);
+ //void _reload(QString path);
+ QStringList _getEntriesFrom(QString path = "");
+ void _dataChanged(const QString appid, const QString item, const QString value);
+
+ public:
+ explicit DesktopEntries(QObject *parent = nullptr);
+
+ enum XdgDesktopEntriesRoles {
+ PathRole = Qt::UserRole + 1,
+ NameRole,
+ IconRole,
+ CategoryRole,
+ NoDisplayRole,
+ KeywordsRole,
+ ExecRole,
+ DesktopFileRole,
+ AppIdRole,
+ AppNameRole,
+ EntryRole
+ };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QHash<int, QByteArray> roleNames() const override;
+
+ QStringList categories();
+
+ public slots:
+ void start(QString path, const QStringList &args = QStringList());
+ void stop(QString path, const QStringList &args = QStringList());
+ QString appIdData(QString appid, QString key);
+
+ signals:
+ void raiseProcess(int pid);
+ void categoriesChanged(QStringList categories);
+
+ private:
+ QString m_sources;
+ };
+}
+
+#endif // XDGDESKTOPENTRIES_H