1 /*
2  * %kadu copyright begin%
3  * Copyright 2012 Wojciech Treter (juzefwt@gmail.com)
4  * Copyright 2012, 2013 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
5  * %kadu copyright end%
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #pragma once
22 
23 #include "exports.h"
24 #include "kadu-menu.h"
25 
26 #include <QtCore/QObject>
27 #include <injeqt/injeqt.h>
28 
29 class QMenu;
30 class QWidget;
31 
32 class ActionContext;
33 class ActionDescription;
34 class Contact;
35 class InjectedFactory;
36 class ProtocolMenuManager;
37 
38 class KADUAPI MenuInventory : public QObject
39 {
40 	Q_OBJECT
41 
42 public:
43 	Q_INVOKABLE explicit MenuInventory(QObject *parent = nullptr);
44     virtual ~MenuInventory();
45 
46 	KaduMenu * menu(const QString &category);
47 
48 	void registerProtocolMenuManager(ProtocolMenuManager *manager);
49 	void unregisterProtocolMenuManager(ProtocolMenuManager *manager);
50 
protocolMenuManagers()51 	QList<ProtocolMenuManager *> & protocolMenuManagers() { return ProtocolMenuManagers; }
52 
53 private:
54 	QPointer<InjectedFactory> m_injectedFactory;
55 
56 	QMap<QString, KaduMenu *> Menus;
57 	QList<ProtocolMenuManager *> ProtocolMenuManagers;
58 
59 private slots:
60 	INJEQT_SET void setInjectedFactory(InjectedFactory *injectedFactory);
61 
62 };
63