File indexing completed on 2025-02-02 04:57:01

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 #ifndef SKGIMPORTPLUGINMNY_H
0007 #define SKGIMPORTPLUGINMNY_H
0008 /** @file
0009 * This file is Skrooge plugin for Microsoft Money import.
0010 *
0011 * @author Stephane MANKOWSKI / Guillaume DE BURE
0012 */
0013 #include <qset.h>
0014 
0015 #include "skgimportplugin.h"
0016 
0017 class SKGUnitObject;
0018 class SKGAccountObject;
0019 class SKGCategoryObject;
0020 class SKGPayeeObject;
0021 
0022 /**
0023  * This file is Skrooge plugin for KMY import / export.
0024  */
0025 class SKGImportPluginMny : public SKGImportPlugin
0026 {
0027     Q_OBJECT
0028     Q_INTERFACES(SKGImportPlugin)
0029 
0030 public:
0031     /**
0032      * Default constructor
0033      * @param iImporter the parent importer
0034      * @param iArg the arguments
0035      */
0036     explicit SKGImportPluginMny(QObject* iImporter, const QVariantList& iArg);
0037 
0038     /**
0039      * Default Destructor
0040      */
0041     ~SKGImportPluginMny() override;
0042 
0043     /**
0044      * To know if import is possible with this plugin
0045      */
0046     bool isImportPossible() override;
0047 
0048     /**
0049      * Import a file
0050      * @return an object managing the error.
0051      *   @see SKGError
0052      */
0053     SKGError importFile() override;
0054 
0055     /**
0056      * Return the mime type filter
0057      * @return the mime type filter. Example: "*.csv|CSV file"
0058      */
0059     QString getMimeTypeFilter() const override;
0060 
0061 
0062 private:
0063     Q_DISABLE_COPY(SKGImportPluginMny)
0064 
0065     bool removeDir(const QString& dirName);
0066 
0067     SKGError readJsonFile(const QString& iFileName, QVariant& oVariant);
0068 
0069     static QMap<QString, SKGUnitObject> m_mapIdSecurity;
0070     static QMap<QString, SKGAccountObject> m_mapIdAccount;
0071     static QMap<QString, SKGCategoryObject> m_mapIdCategory;
0072     static QMap<QString, SKGPayeeObject> m_mapIdPayee;
0073 };
0074 
0075 #endif  // SKGIMPORTPLUGINMNY_H