| 1 | /* This file is part of the dbusmenu-qt library |
| 2 | Copyright 2009 Canonical |
| 3 | Author: Aurelien Gateau <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Library General Public |
| 7 | License (LGPL) as published by the Free Software Foundation; |
| 8 | either version 2 of the License, or (at your option) any later |
| 9 | version. |
| 10 | |
| 11 | This library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | Library General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU Library General Public License |
| 17 | along with this library; see the file COPYING.LIB. If not, write to |
| 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. |
| 20 | */ |
| 21 | #ifndef DBUSMENU_H |
| 22 | #define DBUSMENU_H |
| 23 | |
| 24 | #include <QEvent> |
| 25 | #include <QObject> |
| 26 | |
| 27 | class QAction; |
| 28 | class QMenu; |
| 29 | |
| 30 | class DBusMenuExporter; |
| 31 | |
| 32 | /** |
| 33 | * Internal class responsible for tracking changes in a menu and reporting them |
| 34 | * through DBusMenuExporter |
| 35 | * @internal |
| 36 | */ |
| 37 | class DBusMenu : public QObject |
| 38 | { |
| 39 | Q_OBJECT |
| 40 | public: |
| 41 | DBusMenu(QMenu *menu, DBusMenuExporter *exporter, int parentId); |
| 42 | virtual ~DBusMenu(); |
| 43 | |
| 44 | protected: |
| 45 | virtual bool eventFilter(QObject *obj, QEvent *event); |
| 46 | |
| 47 | private Q_SLOTS: |
| 48 | void deleteMe(); |
| 49 | |
| 50 | private: |
| 51 | void addAction(QAction *action); |
| 52 | void updateAction(QAction *action); |
| 53 | void removeAction(QAction *action); |
| 54 | |
| 55 | DBusMenuExporter* m_exporter; |
| 56 | int m_parentId; |
| 57 | }; |
| 58 | |
| 59 | #endif /* DBUSMENU_H */ |