diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 22:38:03 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 22:38:03 +0000 |
commit | dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch) | |
tree | 99e72842fe687baea16376a147619b6048d7e441 /kmymoney2/converter/mymoneystatementreader.h | |
download | kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.tar.gz kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.zip |
Added kmymoney
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/converter/mymoneystatementreader.h')
-rw-r--r-- | kmymoney2/converter/mymoneystatementreader.h | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/kmymoney2/converter/mymoneystatementreader.h b/kmymoney2/converter/mymoneystatementreader.h new file mode 100644 index 0000000..46d74d7 --- /dev/null +++ b/kmymoney2/converter/mymoneystatementreader.h @@ -0,0 +1,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 |