1 /*************************************************************************** 2 * SPDX-FileCopyrightText: 2021 S. MANKOWSKI stephane@mankowski.fr 3 * SPDX-FileCopyrightText: 2021 G. DE BURE support@mankowski.fr 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 ***************************************************************************/ 6 #ifndef SKGIMPORTPLUGIN_H 7 #define SKGIMPORTPLUGIN_H 8 /** @file 9 * This file is a plugin interface definition. 10 * 11 * @author Stephane MANKOWSKI / Guillaume DE BURE 12 */ 13 #include <kparts/plugin.h> 14 15 #include "skgbankmodeler_export.h" 16 #include "skgerror.h" 17 #include "skgimportexportmanager.h" 18 19 20 /** 21 * This file is a plugin interface definition. 22 */ 23 class SKGBANKMODELER_EXPORT SKGImportPlugin : public KParts::Plugin 24 { 25 Q_OBJECT 26 public: 27 /** 28 * Default constructor 29 * @param iImporter the parent importer 30 */ 31 explicit SKGImportPlugin(QObject* iImporter = nullptr); 32 33 /** 34 * Default destructor 35 */ 36 ~SKGImportPlugin() override; 37 38 /** 39 * Get parameters for Import 40 * @return the parameters 41 */ getImportParameters()42 virtual inline QMap<QString, QString> getImportParameters() 43 { 44 return m_importParameters; 45 } 46 47 /** 48 * Set parameters for Import 49 * @param iParameters the parameters 50 */ setImportParameters(const QMap<QString,QString> & iParameters)51 virtual inline void setImportParameters(const QMap<QString, QString>& iParameters) 52 { 53 m_importParameters = iParameters; 54 } 55 56 /** 57 * Get parameters for Export 58 * @return the parameters 59 */ getExportParameters()60 virtual inline QMap<QString, QString> getExportParameters() 61 { 62 return m_exportParameters; 63 } 64 65 /** 66 * Set parameters for Export 67 * @param iParameters the parameters 68 */ setExportParameters(const QMap<QString,QString> & iParameters)69 virtual inline void setExportParameters(const QMap<QString, QString>& iParameters) 70 { 71 m_exportParameters = iParameters; 72 } 73 74 /** 75 * To know if import is possible with this plugin 76 * @return true or false 77 */ isImportPossible()78 virtual inline bool isImportPossible() 79 { 80 return false; 81 } 82 83 /** 84 * Import a file 85 * @return an object managing the error. 86 * @see SKGError 87 */ importFile()88 virtual inline SKGError importFile() 89 { 90 return SKGError(ERR_NOTIMPL, QLatin1String("")); 91 } 92 93 /** 94 * To know if export is possible with this plugin 95 * @return true or false 96 */ isExportPossible()97 virtual inline bool isExportPossible() 98 { 99 return false; 100 } 101 102 /** 103 * Export a file 104 * @return an object managing the error. 105 * @see SKGError 106 */ exportFile()107 virtual inline SKGError exportFile() 108 { 109 return SKGError(ERR_NOTIMPL, QLatin1String("")); 110 } 111 112 /** 113 * Return the mime type filter 114 * @return the mime type filter. Example: "*.csv|CSV file" 115 */ getMimeTypeFilter()116 virtual QString getMimeTypeFilter() const 117 { 118 return QLatin1String(""); 119 } 120 121 private: 122 Q_DISABLE_COPY(SKGImportPlugin) 123 124 protected: 125 SKGImportExportManager* m_importer; 126 QMap<QString, QString> m_importParameters; 127 QMap<QString, QString> m_exportParameters; 128 }; 129 130 /** 131 * This plugin interface definition. 132 */ 133 Q_DECLARE_INTERFACE(SKGImportPlugin, "skrooge.com.SKGImportPlugin/1.0") 134 135 #endif // SKGIMPORTPLUGIN_H 136