File indexing completed on 2025-01-12 03:40:51

0001 /* This file is part of the dbusmenu-qt library
0002    SPDX-FileCopyrightText: 2009 Canonical
0003    Author: Aurelien Gateau <aurelien.gateau@canonical.com>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 #ifndef DBUSMENU_H
0008 #define DBUSMENU_H
0009 
0010 #include <QEvent>
0011 #include <QObject>
0012 
0013 class QAction;
0014 class QMenu;
0015 
0016 class DBusMenuExporter;
0017 
0018 /**
0019  * Internal class responsible for tracking changes in a menu and reporting them
0020  * through DBusMenuExporter
0021  * @internal
0022  */
0023 class DBusMenu : public QObject
0024 {
0025     Q_OBJECT
0026 public:
0027     DBusMenu(QMenu *menu, DBusMenuExporter *exporter, int parentId);
0028     ~DBusMenu() override;
0029 
0030 protected:
0031     bool eventFilter(QObject *obj, QEvent *event) override;
0032 
0033 private Q_SLOTS:
0034     void deleteMe();
0035 
0036 private:
0037     void addAction(QAction *action);
0038     void updateAction(QAction *action);
0039     void removeAction(QAction *action);
0040 
0041     DBusMenuExporter *const m_exporter;
0042     const int m_parentId;
0043 };
0044 
0045 #endif /* DBUSMENU_H */