1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/***************************************************************************
mymoneystatementreader
-------------------
begin : Mon Aug 30 2004
copyright : (C) 2000-2004 by Michael Edwardes
email : [email protected]
Javier Campos Morales <[email protected]>
Felix Rodriguez <[email protected]>
John C <[email protected]>
Thomas Baumgart <[email protected]>
Kevin Tambascio <[email protected]>
Ace Jones <[email protected]>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef MYMONEYSTATEMENTREADER_H
#define MYMONEYSTATEMENTREADER_H
// ----------------------------------------------------------------------------
// QT Headers
#include <qobject.h>
#include <qstring.h>
#include <qstringlist.h>
// ----------------------------------------------------------------------------
// KDE Headers
#include <ktempfile.h>
#include <kprocess.h>
// ----------------------------------------------------------------------------
// Project Headers
#include "mymoneyqifprofile.h"
#include "../mymoney/mymoneyaccount.h"
#include "../mymoney/mymoneystatement.h"
class MyMoneyFileTransaction;
class QStringList;
/**
* This is a pared-down version of a MyMoneyQifReader object
*
* @author Ace Jones
*/
class MyMoneyStatementReader : public QObject
{
Q_OBJECT
public:
MyMoneyStatementReader();
~MyMoneyStatementReader();
/**
* This method imports data from the MyMoneyStatement object @a s
* into the MyMoney engine. It leaves some statistical information
* in the @a messages string list
*
* @retval true the import was processed successfully
* @retval false the import resulted in a failure.
*/
bool import(const MyMoneyStatement& s, QStringList& messages);
/**
* This method is used to modify the auto payee creation flag.
* If this flag is set, records for payees that are not currently
* found in the engine will be automatically created with no
* further user interaction required. If this flag is no set,
* the user will be asked if the payee should be created or not.
* If the MyMoneyQifReader object is created auto payee creation
* is turned off.
*
* @param create flag if this feature should be turned on (@p true)
* or turned off (@p false)
*/
void setAutoCreatePayee(bool create);
void setAskPayeeCategory(bool ask);
const MyMoneyAccount& account() const { return m_account; };
void setProgressCallback(void(*callback)(int, int, const QString&));
/**
* Returns true in case any transaction has been added to the engine
* during the import of the statement. Only returns useful result
* after import() has been called.
*/
bool anyTransactionAdded(void) const;
private:
/**
* This method is used to update the progress information. It
* checks if an appropriate function is known and calls it.
*
* For a parameter description see KMyMoneyView::progressCallback().
*/
void signalProgress(int current, int total, const QString& = "");
void processTransactionEntry(const MyMoneyStatement::Transaction& t_in);
void processSecurityEntry(const MyMoneyStatement::Security& s_in);
void processPriceEntry(const MyMoneyStatement::Price& p_in);
enum SelectCreateMode {
Create = 0,
Select
};
/**
* This method is used to find an account using the account's name
* stored in @p account in the current MyMoneyFile object. If it does not
* exist, the user has the chance to create it or to skip processing
* of this account.
*
* Please see the documentation for this function in MyMoneyQifReader
*
* @param mode Is either Create or Select depending on the above table
* @param account Reference to MyMoneyAccount object
*/
bool selectOrCreateAccount(const SelectCreateMode mode, MyMoneyAccount& account);
signals:
/**
* This signal will be emitted when the import is finished.
*/
void importFinished(void);
private:
/// \internal d-pointer class.
class Private;
/// \internal d-pointer instance.
Private* const d;
MyMoneyAccount m_account;
QStringList m_dontAskAgain;
bool m_skipAccount;
bool m_userAbort;
bool m_autoCreatePayee;
bool m_askPayeeCategory;
MyMoneyFileTransaction* m_ft;
void (*m_progressCallback)(int, int, const QString&);
};
#endif
|