dbus/dbusmenu: separate menu handles from status notifier items

No api changes yet.
This commit is contained in:
outfoxxed 2024-07-25 01:30:23 -07:00
parent a71a6fb3ac
commit acdbe73c10
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
6 changed files with 157 additions and 60 deletions

View file

@ -157,4 +157,35 @@ public:
QByteArray data;
};
class DBusMenuHandle;
QDebug operator<<(QDebug debug, const DBusMenuHandle* handle);
class DBusMenuHandle: public menu::QsMenuHandle {
Q_OBJECT;
QML_ELEMENT;
QML_UNCREATABLE("");
public:
explicit DBusMenuHandle(QObject* parent): menu::QsMenuHandle(parent) {}
void setAddress(const QString& service, const QString& path);
void ref() override;
void unref() override;
[[nodiscard]] QsMenuEntry* menu() const override;
private:
void onMenuPathChanged();
QString service;
QString path;
DBusMenu* mMenu = nullptr;
bool loaded = false;
quint32 refcount = 0;
friend QDebug operator<<(QDebug debug, const DBusMenuHandle* handle);
};
} // namespace qs::dbus::dbusmenu