File indexing completed on 2024-04-28 05:06:07

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