You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kmymoney/kmymoney2/plugins/ofximport/ofximporterplugin.h

147 lines
5.1 KiB

/***************************************************************************
ofxiimporterplugin.h
-------------------
begin : Sat Jan 01 2005
copyright : (C) 2005 by Ace Jones
email : Ace Jones <acejones@users.sourceforge.net>
***************************************************************************/
/***************************************************************************
* *
* 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 OFXIMPORTERPLUGIN_H
#define OFXIMPORTERPLUGIN_H
// ----------------------------------------------------------------------------
// TDE Includes
// ----------------------------------------------------------------------------
// TQt Includes
#include <tqstringlist.h>
// ----------------------------------------------------------------------------
// Library Includes
#include <libofx/libofx.h>
// ----------------------------------------------------------------------------
// Project Includes
#include "../kmymoneyplugin.h"
class KOnlineBankingStatus;
/**
@author Ace Jones
*/
class OfxImporterPlugin : public KMyMoneyPlugin::Plugin, public KMyMoneyPlugin::ImporterPlugin, public KMyMoneyPlugin::OnlinePlugin
{
TQ_OBJECT
public:
OfxImporterPlugin(TQObject *parent = 0, const char *name = 0, const TQStringList& = TQStringList());
~OfxImporterPlugin();
/**
* This method returns the english-language name of the format
* this plugin imports, e.g. "OFX"
*
* @return TQString Name of the format
*/
virtual TQString formatName(void) const;
/**
* This method returns the filename filter suitable for passing to
* KFileDialog::setFilter(), e.g. "*.ofx *.qfx" which describes how
* files of this format are likely to be named in the file system
*
* @return TQString Filename filter string
*/
virtual TQString formatFilenameFilter(void) const;
/**
* This method returns whether this plugin is able to import
* a particular file.
*
* @param filename Fully-qualified pathname to a file
*
* @return bool Whether the indicated file is importable by this plugin
*/
virtual bool isMyFormat( const TQString& filename ) const;
/**
* Import a file
*
* @param filename File to import
*
* @return bool Whether the import was successful.
*/
virtual bool import( const TQString& filename );
/**
* Returns the error result of the last import
*
* @return TQString English-language name of the error encountered in the
* last import, or TQString() if it was successful.
*
*/
virtual TQString lastError(void) const;
TQWidget* accountConfigTab(const MyMoneyAccount& acc, TQString& name);
MyMoneyKeyValueContainer onlineBankingSettings(const MyMoneyKeyValueContainer& current);
const MyMoneyAccount& account(const TQString& key, const TQString& value) const;
void protocols(TQStringList& protocolList) const;
bool mapAccount(const MyMoneyAccount& acc, MyMoneyKeyValueContainer& settings);
bool updateAccount(const MyMoneyAccount& acc, bool moreAccounts);
protected slots:
void slotImportFile(void);
void slotImportFile(const TQString& url);
protected:
void createActions(void);
void addnew(void) { m_statementlist.push_back(MyMoneyStatement()); }
MyMoneyStatement& back(void) { return m_statementlist.back(); }
bool isValid(void) const { return m_valid; }
void setValid(void) { m_valid = true; }
void addInfo(const TQString& _msg ) { m_infos+=_msg; }
void addWarning(const TQString& _msg ) { m_warnings+=_msg; }
void addError(const TQString& _msg ) { m_errors+=_msg; }
const TQStringList& infos(void) const { return m_infos; }
const TQStringList& warnings(void) const { return m_warnings; }
const TQStringList& errors(void) const { return m_errors; }
bool storeStatements(TQValueList<MyMoneyStatement>& statements);
bool importStatement(const MyMoneyStatement& s);
static int ofxTransactionCallback( struct OfxTransactionData, void* );
static int ofxStatementCallback( struct OfxStatementData, void* );
static int ofxAccountCallback( struct OfxAccountData, void* );
static int ofxStatusCallback( struct OfxStatusData, void* );
static int ofxSecurityCallback( struct OfxSecurityData, void* );
private:
bool m_valid;
bool m_preferName;
TQValueList<MyMoneyStatement> m_statementlist;
TQValueList<MyMoneyStatement::Security> m_securitylist;
TQString m_fatalerror;
TQStringList m_infos;
TQStringList m_warnings;
TQStringList m_errors;
KOnlineBankingStatus* m_statusDlg;
};
#endif