blob: 62df8fbd268a0d8bd09dd7efc24e946b771de15b (
plain)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/***************************************************************************
kmymoneyplugin.h
-------------------
begin : Wed Jan 5 2005
copyright : (C) 2005 Thomas Baumgart
email : ipwizard@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 KMYMONEYPLUGIN_H
#define KMYMONEYPLUGIN_H
// ----------------------------------------------------------------------------
// TQt Includes
#include <tqobject.h>
// ----------------------------------------------------------------------------
// TDE Includes
#include <kxmlguiclient.h>
class TDEAboutData;
class TDEInstance;
class TDEAction;
class TDEToggleAction;
// ----------------------------------------------------------------------------
// Project Includes
#include <kmymoney/viewinterface.h>
#include <kmymoney/statementinterface.h>
#include <kmymoney/importinterface.h>
#include <kmymoney/export.h>
namespace KMyMoneyPlugin {
/**
* This class describes the interface between the KMyMoney
* application and it's plugins. All plugins must be derived
* from this class.
*
* A good tutorial on how to design and develop a plugin
* structure for a KDE application (e.g. KMyMoney) can be found at
* http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html
*
*/
class KMYMONEY_EXPORT Plugin : public TQObject, public KXMLGUIClient
{
TQ_OBJECT
public:
Plugin(TQObject* parent, const char* name);
virtual ~Plugin();
protected:
/** See KMyMoney2App::action() for a description */
TDEAction* action(const TQString& name) const;
/** See KMyMoney2App::toggleAction() for a description */
TDEToggleAction* toggleAction(const TQString& name) const;
// define interface classes here. The interface classes provide a mechanism
// for the plugin to interact with KMyMoney
// they are defined in the following form for an interface
// named Xxx:
//
// XxxInterface* xxxInterface();
ViewInterface* viewInterface() const;
StatementInterface* statementInterface() const;
ImportInterface* importInterface() const;
};
/**
* This class describes the interface between the KMyMoney
* application and it's ONLINE-BANKING plugins. All online banking plugins
* must provide this interface.
*
* A good tutorial on how to design and develop a plugin
* structure for a KDE application (e.g. KMyMoney) can be found at
* http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html
*
*/
class KMYMONEY_EXPORT OnlinePlugin
{
public:
OnlinePlugin() {}
virtual ~OnlinePlugin() {}
virtual void protocols(TQStringList& protocolList) const = 0;
/**
* This method returns a pointer to a widget representing an additional
* tab that will be added to the KNewAccountDlg. The string referenced
* with @a tabName will be filled with the text that should be placed
* on the tab. It should return 0 if no additional tab is needed.
*
* Information about the account can be taken out of @a account.
*
* Once the pointer to the widget is returned to KMyMoney, it takes care
* of destruction of all included widgets when the dialog is closed. The plugin
* can access the widgets created after the call to storeConfigParameters()
* happened.
*/
virtual TQWidget* accountConfigTab(const MyMoneyAccount& account, TQString& tabName) = 0;
/**
* This method is called by the framework whenever it is time to store
* the configuration data maintained by the plugin. The plugin should use
* the widgets created in accountConfigTab() to extract the current values.
*
* @param current The @a current container contains the current settings
*/
virtual MyMoneyKeyValueContainer onlineBankingSettings(const MyMoneyKeyValueContainer& current) = 0;
/**
* This method is called by the framework when the user wants to map
* a KMyMoney account onto an online account. The KMyMoney account is identified
* by @a acc and the online provider should store its data in @a onlineBankingSettings
* upon success.
*
* @retval true if account is mapped
* @retval false if account is not mapped
*/
virtual bool mapAccount(const MyMoneyAccount& acc, MyMoneyKeyValueContainer& onlineBankingSettings) = 0;
/**
* This method is called by the framework when the user wants to update
* a KMyMoney account with data from an online account. The KMyMoney account is identified
* by @a acc. The online provider should read its data from acc.onlineBankingSettings().
* @a true is returned upon success. The plugin might consider to stack the requests
* in case @a moreAccounts is @p true. @a moreAccounts defaults to @p false.
*
* @retval true if account is updated
* @retval false if account is not updated
*/
virtual bool updateAccount(const MyMoneyAccount& acc, bool moreAccounts = false) = 0;
};
/**
* This class describes the interface between the KMyMoney
* application and it's IMPORTER plugins. All importer plugins
* must provide this interface.
*
* A good tutorial on how to design and develop a plugin
* structure for a KDE application (e.g. KMyMoney) can be found at
* http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html
*
*/
class KMYMONEY_EXPORT ImporterPlugin
{
public:
ImporterPlugin() {}
virtual ~ImporterPlugin() {}
/**
* 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 = 0;
/**
* 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 = 0;
/**
* 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 = 0;
/**
* Import a file
*
* @param filename File to import
*
* @return bool Whether the import was successful.
*/
virtual bool import( const TQString& filename) = 0;
/**
* 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 = 0;
};
}; // end of namespace
#endif
|