File indexing completed on 2024-05-19 05:06:54
0001 /* 0002 0003 SPDX-FileCopyrightText: 2014 Christian Dávid <christian-david@web.de> 0004 SPDX-FileCopyrightText: 2021 Dawid Wróbel <me@dawidwrobel.com> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef ONLINEPLUGINEXTENDED_H 0009 #define ONLINEPLUGINEXTENDED_H 0010 0011 #include "kmymoneyplugin.h" 0012 0013 #include "mymoney/onlinejob.h" 0014 #include "onlinetasks/interfaces/tasks/ionlinetasksettings.h" 0015 0016 class onlineJob; 0017 class onlineTask; 0018 class payeeIdentifierData; 0019 0020 namespace KMyMoneyPlugin { 0021 0022 /** 0023 * @brief Interface between KMyMoney and Online Banking plugins for executing transactions 0024 * 0025 * This interface is under active development and will change often! Do not use it at the moment! 0026 * 0027 * @author Christian David (christian-david@web.de) 0028 */ 0029 class KMM_PLUGIN_EXPORT OnlinePluginExtended : public Plugin, public OnlinePlugin 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 OnlinePluginExtended(QObject* parent, const KPluginMetaData& metaData, const QVariantList& args); 0035 virtual ~OnlinePluginExtended() 0036 { 0037 } 0038 0039 /** 0040 * @brief List onlineJobs supported by an account 0041 * 0042 * KMyMoney will use this function to ask the online plugin which online jobs it supports. 0043 * Later changes can be made public using the jobAvailable signals. 0044 * 0045 * @return A QStringList with supported onlineTask::name()s as values. 0046 */ 0047 virtual QStringList availableJobs(QString accountId) const = 0; 0048 0049 /** 0050 * @brief Get settings for onlineTask 0051 * 0052 * @see onlineTask::settings 0053 */ 0054 virtual IonlineTaskSettings::ptr settings(QString accountId, QString taskName) = 0; 0055 0056 /** 0057 * @brief Send onlineJobs to bank 0058 * 0059 * @param jobs Do not delete the onlineJob objects. You can edit them but expect them to be deleted after 0060 * you returned from this function. 0061 */ 0062 virtual void sendOnlineJob(QList<onlineJob>& jobs) = 0; 0063 0064 virtual void plug(KXMLGUIFactory* guiFactory) override = 0; 0065 virtual void unplug() override = 0; 0066 0067 Q_SIGNALS: 0068 /** 0069 * @brief Emit to make onlineJob available 0070 * 0071 * In case a onlineJob got available during runtime, emit one of these signals. 0072 */ 0073 void jobAvailable(QString accountId, QString); 0074 void jobAvailable(QString accountId, QStringList); 0075 void jobUnavailable(QString accountId, QString); 0076 // void jobUnavailable( QString accountId ); 0077 }; 0078 0079 class KMM_PLUGIN_EXPORT onlineTaskFactory : public QObject 0080 { 0081 Q_OBJECT 0082 0083 public: 0084 onlineTaskFactory(QObject* parent, const QVariantList &args) 0085 : QObject(parent) 0086 { 0087 Q_UNUSED(args) 0088 } 0089 0090 public: 0091 virtual onlineTask* createOnlineTask(const QString& taskId) const = 0; 0092 0093 // Make g++ happy 0094 virtual ~onlineTaskFactory() 0095 { 0096 } 0097 }; 0098 0099 class KMM_PLUGIN_EXPORT payeeIdentifierDataFactory 0100 { 0101 public: 0102 virtual payeeIdentifierData* createPayeeIdentifier(const QString& payeeIdentifierIid) const = 0; 0103 // Make g+ happy 0104 virtual ~payeeIdentifierDataFactory() 0105 { 0106 } 0107 }; 0108 0109 } // namespace KMyMoneyPlugin 0110 0111 Q_DECLARE_INTERFACE(KMyMoneyPlugin::OnlinePluginExtended, "org.kmymoney.plugin.onlinepluginextended"); 0112 Q_DECLARE_INTERFACE(KMyMoneyPlugin::onlineTaskFactory, "org.kmymoney.plugin.onlinetaskfactory"); 0113 Q_DECLARE_INTERFACE(KMyMoneyPlugin::payeeIdentifierDataFactory, "org.kmymoney.plugin.payeeidentifierfactory"); 0114 0115 #endif // ONLINEPLUGINEXTENDED_H