1 /***************************************************************************
2                           pluginloader.h
3                              -------------------
4   (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
5  ***************************************************************************/
6 
7 /***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15 
16 #ifndef PLUGINLOADER_H
17 #define PLUGINLOADER_H
18 
19 // ----------------------------------------------------------------------------
20 // QT Includes
21 
22 // ----------------------------------------------------------------------------
23 // KDE Includes
24 
25 // ----------------------------------------------------------------------------
26 // Project Includes
27 
28 class KPluginMetaData;
29 class KXMLGUIFactory;
30 
31 class QObject;
32 class QString;
33 
34 template <class Key, class T> class QMap;
35 
36 namespace KMyMoneyPlugin
37 {
38   struct Container;
39   enum class eListing;
40 
41   /**
42    * @brief The Action enum is for specifying action on plugins
43    */
44   enum Action {
45     Load,         // load all enabled plugins
46     Unload,       // unload all loaded plugins
47     Reorganize    // load requested and unload unneeded plugins
48   };
49 
50   /**
51    * @brief The Category enum is some arbitrary categorization of plugins
52    */
53   enum Category {
54     OnlineBankOperations,
55     PayeeIdentifier,
56     StandardPlugin
57   };
58 
59   Category pluginCategory(const KPluginMetaData& pluginInfo);
60 
61   /**
62    * @brief It lists all kmymoney plugins
63    * @param onlyEnabled = true if plugins should be listed according to on/off saved state in kmymoneyrc
64    * @return
65    */
66   QMap<QString, KPluginMetaData> listPlugins(bool onlyEnabled);
67 
68   /**
69    * @brief It should be used to handle all plugin actions
70    * @param action Action to be taken to all plugins
71    * @param ctnPlugins Plugin container to be loaded/unloaded with plugins
72    * @param parent Parent of plugins. This should be KMyMoneyApp
73    * @param guiFactory GUI Factory of plugins. This should be GUI Factory of KMyMoneyApp
74    */
75   void pluginHandling(Action action, Container& ctnPlugins, QObject* parent, KXMLGUIFactory* guiFactory);
76 }
77 
78 #endif
79