/* SPDX-FileCopyrightText: 2011 Lionel Chauvin SPDX-FileCopyrightText: 2011, 2012 Cédric Bellegarde SPDX-FileCopyrightText: 2016 Kai Uwe Broulik SPDX-License-Identifier: MIT */ #pragma once // Qt #include #include #include #include #include // For WId class QDBusServiceWatcher; class MenuImporter : public QObject, protected QDBusContext { Q_OBJECT public: explicit MenuImporter(QObject *); ~MenuImporter() override; bool connectToBus(); bool serviceExist(WId id) { return m_menuServices.contains(id); } QString serviceForWindow(WId id) { return m_menuServices.value(id); } bool pathExist(WId id) { return m_menuPaths.contains(id); } QString pathForWindow(WId id) { return m_menuPaths.value(id).path(); } QList ids() { return m_menuServices.keys(); } Q_SIGNALS: void WindowRegistered(WId id, const QString &service, const QDBusObjectPath &); void WindowUnregistered(WId id); public Q_SLOTS: Q_NOREPLY void RegisterWindow(WId id, const QDBusObjectPath &path); Q_NOREPLY void UnregisterWindow(WId id); QString GetMenuForWindow(WId id, QDBusObjectPath &path); private Q_SLOTS: void slotServiceUnregistered(const QString &service); private: QDBusServiceWatcher *m_serviceWatcher; QHash m_menuServices; QHash m_menuPaths; QHash m_windowClasses; };