File indexing completed on 2024-04-28 16:29:36

0001 /*
0002     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef PLUGINLOADER_H
0007 #define PLUGINLOADER_H
0008 
0009 // ----------------------------------------------------------------------------
0010 // QT Includes
0011 
0012 // ----------------------------------------------------------------------------
0013 // KDE Includes
0014 
0015 // ----------------------------------------------------------------------------
0016 // Project Includes
0017 
0018 class KPluginMetaData;
0019 class KXMLGUIFactory;
0020 
0021 class QObject;
0022 class QString;
0023 
0024 template <class Key, class T> class QMap;
0025 
0026 namespace KMyMoneyPlugin
0027 {
0028 struct Container;
0029 enum class eListing;
0030 
0031 /**
0032  * @brief The Action enum is for specifying action on plugins
0033  */
0034 enum Action {
0035     Load,         // load all enabled plugins
0036     Unload,       // unload all loaded plugins
0037     Reorganize,   // load requested and unload unneeded plugins
0038 };
0039 
0040 /**
0041  * @brief The Category enum is some arbitrary categorization of plugins
0042  */
0043 enum Category {
0044     OnlineBankOperations,
0045     PayeeIdentifier,
0046     StandardPlugin,
0047 };
0048 
0049 Category pluginCategory(const KPluginMetaData& pluginInfo);
0050 
0051 /**
0052  * @brief It lists all kmymoney plugins
0053  * @param onlyEnabled = true if plugins should be listed according to on/off saved state in kmymoneyrc
0054  * @return
0055  */
0056 QMap<QString, KPluginMetaData> listPlugins(bool onlyEnabled);
0057 
0058 /**
0059  * @brief It should be used to handle all plugin actions
0060  * @param action Action to be taken to all plugins
0061  * @param ctnPlugins Plugin container to be loaded/unloaded with plugins
0062  * @param parent Parent of plugins. This should be KMyMoneyApp
0063  * @param guiFactory GUI Factory of plugins. This should be GUI Factory of KMyMoneyApp
0064  */
0065 void pluginHandling(Action action, Container& ctnPlugins, QObject* parent, KXMLGUIFactory* guiFactory);
0066 }
0067 
0068 #endif