Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/csv/import/csvimporter.h
- This file was moved from kmymoney/plugins/csv/import/csvimporterplugin.h.
1 | /*************************************************************************** | 1 | /*************************************************************************** | ||
---|---|---|---|---|---|
2 | csvimporterplugin.h | 2 | csvimporter.h | ||
3 | ------------------- | 3 | ------------------- | ||
4 | begin : Sat Jan 01 2010 | 4 | begin : Sat Jan 01 2010 | ||
5 | copyright : (C) 2010 by Allan Anderson | 5 | copyright : (C) 2010 by Allan Anderson | ||
6 | email : agander93@gmail.com | 6 | email : agander93@gmail.com | ||
7 | copyright : (C) 2016-2017 by Łukasz Wojniłowicz | 7 | copyright : (C) 2016-2017 by Łukasz Wojniłowicz | ||
8 | email : lukasz.wojnilowicz@gmail.com | 8 | email : lukasz.wojnilowicz@gmail.com | ||
9 | ***************************************************************************/ | 9 | ***************************************************************************/ | ||
10 | 10 | | |||
11 | /*************************************************************************** | 11 | /*************************************************************************** | ||
12 | * * | 12 | * * | ||
13 | * This program is free software; you can redistribute it and/or modify * | 13 | * This program is free software; you can redistribute it and/or modify * | ||
14 | * it under the terms of the GNU General Public License as published by * | 14 | * it under the terms of the GNU General Public License as published by * | ||
15 | * the Free Software Foundation; either version 2 of the License, or * | 15 | * the Free Software Foundation; either version 2 of the License, or * | ||
16 | * (at your option) any later version. * | 16 | * (at your option) any later version. * | ||
17 | * * | 17 | * * | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #ifndef CSVIMPORTERPLUGIN_H | 20 | #ifndef CSVIMPORTER_H | ||
21 | #define CSVIMPORTERPLUGIN_H | 21 | #define CSVIMPORTER_H | ||
22 | 22 | | |||
23 | // ---------------------------------------------------------------------------- | 23 | // ---------------------------------------------------------------------------- | ||
24 | // KDE Includes | 24 | // KDE Includes | ||
25 | 25 | | |||
26 | // ---------------------------------------------------------------------------- | 26 | // ---------------------------------------------------------------------------- | ||
27 | // QT Includes | 27 | // QT Includes | ||
28 | 28 | | |||
29 | // Project Includes | 29 | // Project Includes | ||
30 | 30 | | |||
31 | #include "kmymoneyplugin.h" | 31 | #include "kmymoneyplugin.h" | ||
32 | 32 | | |||
33 | class CSVImporter; | 33 | class CSVImporterCore; | ||
34 | class CSVWizard; | 34 | class CSVWizard; | ||
35 | class MyMoneyStatement; | 35 | class MyMoneyStatement; | ||
36 | 36 | | |||
37 | class CsvImporterPlugin : public KMyMoneyPlugin::Plugin, public KMyMoneyPlugin::ImporterPlugin | 37 | class CSVImporter : public KMyMoneyPlugin::Plugin, public KMyMoneyPlugin::ImporterPlugin | ||
38 | { | 38 | { | ||
39 | Q_OBJECT | 39 | Q_OBJECT | ||
40 | Q_PLUGIN_METADATA(IID "org.kmymoney.plugins.csvimport" FILE "csvimport.json") | | |||
41 | Q_INTERFACES(KMyMoneyPlugin::ImporterPlugin) | 40 | Q_INTERFACES(KMyMoneyPlugin::ImporterPlugin) | ||
42 | 41 | | |||
43 | public: | 42 | public: | ||
44 | explicit CsvImporterPlugin(); | 43 | explicit CSVImporter(QObject *parent, const QVariantList &args); | ||
45 | ~CsvImporterPlugin(); | 44 | ~CSVImporter() override; | ||
46 | 45 | | |||
47 | QAction* m_action; | 46 | QAction* m_action; | ||
48 | CSVWizard* m_wizard; | 47 | CSVWizard* m_wizard; | ||
49 | CSVImporter* m_importer; | 48 | CSVImporterCore* m_importer; | ||
50 | 49 | | |||
51 | /** | 50 | /** | ||
52 | * This method returns the english-language name of the format | 51 | * This method returns the english-language name of the format | ||
53 | * this plugin imports, e.g. "OFX" | 52 | * this plugin imports, e.g. "OFX" | ||
54 | * | 53 | * | ||
55 | * @return QString Name of the format | 54 | * @return QString Name of the format | ||
56 | */ | 55 | */ | ||
57 | virtual QString formatName() const; | 56 | virtual QString formatName() const override; | ||
58 | 57 | | |||
59 | /** | 58 | /** | ||
60 | * This method returns the filename filter suitable for passing to | 59 | * This method returns the filename filter suitable for passing to | ||
61 | * KFileDialog::setFilter(), e.g. "*.csv" which describes how | 60 | * KFileDialog::setFilter(), e.g. "*.csv" which describes how | ||
62 | * files of this format are likely to be named in the file system | 61 | * files of this format are likely to be named in the file system | ||
63 | * | 62 | * | ||
64 | * @return QString Filename filter string | 63 | * @return QString Filename filter string | ||
65 | */ | 64 | */ | ||
66 | virtual QString formatFilenameFilter() const; | 65 | virtual QString formatFilenameFilter() const override; | ||
67 | 66 | | |||
68 | /** | 67 | /** | ||
69 | * This method returns whether this plugin is able to import | 68 | * This method returns whether this plugin is able to import | ||
70 | * a particular file. | 69 | * a particular file. | ||
71 | * | 70 | * | ||
72 | * @param filename Fully-qualified pathname to a file | 71 | * @param filename Fully-qualified pathname to a file | ||
73 | * | 72 | * | ||
74 | * @return bool Whether the indicated file is importable by this plugin | 73 | * @return bool Whether the indicated file is importable by this plugin | ||
75 | */ | 74 | */ | ||
76 | virtual bool isMyFormat(const QString& filename) const; | 75 | virtual bool isMyFormat(const QString& filename) const override; | ||
77 | 76 | | |||
78 | /** | 77 | /** | ||
79 | * Import a file | 78 | * Import a file | ||
80 | * | 79 | * | ||
81 | * @param filename File to import | 80 | * @param filename File to import | ||
82 | * | 81 | * | ||
83 | * @return bool Whether the import was successful. | 82 | * @return bool Whether the import was successful. | ||
84 | */ | 83 | */ | ||
85 | virtual bool import(const QString& filename); | 84 | virtual bool import(const QString& filename) override; | ||
86 | 85 | | |||
87 | /** | 86 | /** | ||
88 | * Returns the error result of the last import | 87 | * Returns the error result of the last import | ||
89 | * | 88 | * | ||
90 | * @return QString English-language name of the error encountered in the | 89 | * @return QString English-language name of the error encountered in the | ||
91 | * last import, or QString() if it was successful. | 90 | * last import, or QString() if it was successful. | ||
92 | * | 91 | * | ||
93 | */ | 92 | */ | ||
94 | virtual QString lastError() const; | 93 | virtual QString lastError() const override; | ||
95 | 94 | | |||
96 | private: | 95 | private: | ||
97 | bool m_silent; | 96 | bool m_silent; | ||
98 | public Q_SLOTS: | 97 | public Q_SLOTS: | ||
99 | bool slotGetStatement(MyMoneyStatement& s); | 98 | bool slotGetStatement(MyMoneyStatement& s); | ||
100 | 99 | | |||
101 | protected Q_SLOTS: | 100 | protected Q_SLOTS: | ||
102 | void startWizardRun(); | 101 | void startWizardRun(); | ||
103 | 102 | | |||
104 | protected: | 103 | protected: | ||
105 | void createActions(); | 104 | void createActions(); | ||
106 | }; | 105 | }; | ||
107 | 106 | | |||
108 | #endif | 107 | #endif |