summaryrefslogtreecommitdiffstats
path: root/kmymoney2/plugins/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/plugins/interfaces')
-rw-r--r--kmymoney2/plugins/interfaces/Makefile.am13
-rw-r--r--kmymoney2/plugins/interfaces/kmmimportinterface.cpp41
-rw-r--r--kmymoney2/plugins/interfaces/kmmimportinterface.h60
-rw-r--r--kmymoney2/plugins/interfaces/kmmstatementinterface.cpp56
-rw-r--r--kmymoney2/plugins/interfaces/kmmstatementinterface.h77
-rw-r--r--kmymoney2/plugins/interfaces/kmmviewinterface.cpp60
-rw-r--r--kmymoney2/plugins/interfaces/kmmviewinterface.h79
7 files changed, 386 insertions, 0 deletions
diff --git a/kmymoney2/plugins/interfaces/Makefile.am b/kmymoney2/plugins/interfaces/Makefile.am
new file mode 100644
index 0000000..2b3c761
--- /dev/null
+++ b/kmymoney2/plugins/interfaces/Makefile.am
@@ -0,0 +1,13 @@
+KDE_OPTIONS = noautodist
+
+METASOURCES = AUTO
+INCLUDES = $(all_includes) -I$(top_srcdir) -I. -I$(top_srcdir)/kmymoney2/widgets
+
+SUBDIRS =
+
+noinst_LIBRARIES = libinterfaces.a
+
+libinterfaces_a_SOURCES = kmmviewinterface.cpp kmmstatementinterface.cpp kmmimportinterface.cpp
+
+noinst_HEADERS = kmmviewinterface.h kmmstatementinterface.h kmmimportinterface.h
+
diff --git a/kmymoney2/plugins/interfaces/kmmimportinterface.cpp b/kmymoney2/plugins/interfaces/kmmimportinterface.cpp
new file mode 100644
index 0000000..b3c54d8
--- /dev/null
+++ b/kmymoney2/plugins/interfaces/kmmimportinterface.cpp
@@ -0,0 +1,41 @@
+/***************************************************************************
+ kmmimportinterface.cpp
+ -------------------
+ begin : Mon Apr 14 2008
+ copyright : (C) 2008 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. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../../kmymoney2.h"
+#include "kmmimportinterface.h"
+
+KMyMoneyPlugin::KMMImportInterface::KMMImportInterface(KMyMoney2App* app, QObject* parent, const char* name) :
+ ImportInterface(parent, name),
+ m_app(app)
+{
+}
+
+KURL KMyMoneyPlugin::KMMImportInterface::selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode) const
+{
+ return m_app->selectFile(title, path, mask, mode);
+}
+
+#include "kmmimportinterface.moc"
diff --git a/kmymoney2/plugins/interfaces/kmmimportinterface.h b/kmymoney2/plugins/interfaces/kmmimportinterface.h
new file mode 100644
index 0000000..484a228
--- /dev/null
+++ b/kmymoney2/plugins/interfaces/kmmimportinterface.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ kmmimportinterface.h
+ -------------------
+ begin : Mon Apr 14 2008
+ copyright : (C) 2008 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 KMMIMPORTINTERFACE_H
+#define KMMIMPORTINTERFACE_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kfile.h>
+#include <kurl.h>
+class KMyMoney2App;
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../importinterface.h"
+
+namespace KMyMoneyPlugin {
+
+/**
+ * This class represents the implementation of the
+ * ViewInterface.
+ */
+class KMMImportInterface : public ImportInterface {
+ Q_OBJECT
+
+public:
+ KMMImportInterface(KMyMoney2App* app, QObject* parent, const char* name = 0);
+ ~KMMImportInterface() {}
+
+ KURL selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode) const;
+
+private:
+ KMyMoney2App* m_app;
+};
+
+}; // namespace
+#endif
diff --git a/kmymoney2/plugins/interfaces/kmmstatementinterface.cpp b/kmymoney2/plugins/interfaces/kmmstatementinterface.cpp
new file mode 100644
index 0000000..9e09db2
--- /dev/null
+++ b/kmymoney2/plugins/interfaces/kmmstatementinterface.cpp
@@ -0,0 +1,56 @@
+/***************************************************************************
+ kmmstatementinterface.cpp
+ -------------------
+ 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. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qstring.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmmstatementinterface.h"
+#include "../../kmymoney2.h"
+#include <kmymoney/mymoneyaccount.h>
+#include <kmymoney/mymoneykeyvaluecontainer.h>
+
+KMyMoneyPlugin::KMMStatementInterface::KMMStatementInterface(KMyMoney2App* app, QObject* parent, const char* name) :
+ StatementInterface(parent, name),
+ m_app(app)
+{
+}
+
+bool KMyMoneyPlugin::KMMStatementInterface::import(const MyMoneyStatement& s)
+{
+ qDebug("KMyMoneyPlugin::KMMStatementInterface::import start");
+ return m_app->slotStatementImport(s);
+}
+
+const MyMoneyAccount& KMyMoneyPlugin::KMMStatementInterface::account(const QString& key, const QString& value) const
+{
+ return m_app->account(key, value);
+}
+
+void KMyMoneyPlugin::KMMStatementInterface::setAccountOnlineParameters(const MyMoneyAccount& acc, const MyMoneyKeyValueContainer& kvps) const
+{
+ m_app->setAccountOnlineParameters(acc, kvps);
+}
+
+#include "kmmstatementinterface.moc"
diff --git a/kmymoney2/plugins/interfaces/kmmstatementinterface.h b/kmymoney2/plugins/interfaces/kmmstatementinterface.h
new file mode 100644
index 0000000..7890002
--- /dev/null
+++ b/kmymoney2/plugins/interfaces/kmmstatementinterface.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ kmmstatementinterface.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 KMMSTATEMENTINTERFACE_H
+#define KMMSTATEMENTINTERFACE_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+class KMyMoney2App;
+class MyMoneyAccount;
+class MyMoneyKeyValueContainer;
+
+#include "../statementinterface.h"
+
+namespace KMyMoneyPlugin {
+
+/**
+ * This class represents the implementation of the
+ * StatementInterface.
+ */
+class KMMStatementInterface : public StatementInterface
+{
+ Q_OBJECT
+
+public:
+ KMMStatementInterface(KMyMoney2App* app, QObject* parent, const char* name = 0);
+ ~KMMStatementInterface() {}
+
+ /**
+ * This method imports a MyMoneyStatement into the engine
+ */
+ bool import(const MyMoneyStatement& s);
+
+ /**
+ * This method returns the account for a given @a key - @a value pair.
+ * If the account is not found in the list of accounts, MyMoneyAccount()
+ * is returned.
+ */
+ const MyMoneyAccount& account(const QString& key, const QString& value) const;
+
+ /**
+ * This method stores the online parameters in @a kvps used by the plugin
+ * with the account @a acc.
+ */
+ void setAccountOnlineParameters(const MyMoneyAccount&acc, const MyMoneyKeyValueContainer& kvps) const;
+
+private:
+ KMyMoney2App* m_app;
+};
+
+}; // namespace
+#endif
diff --git a/kmymoney2/plugins/interfaces/kmmviewinterface.cpp b/kmymoney2/plugins/interfaces/kmmviewinterface.cpp
new file mode 100644
index 0000000..9779876
--- /dev/null
+++ b/kmymoney2/plugins/interfaces/kmmviewinterface.cpp
@@ -0,0 +1,60 @@
+/***************************************************************************
+ viewinterface.cpp
+ -------------------
+ 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. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../../kmymoney2.h"
+#include "../../views/kmymoneyview.h"
+#include "../../widgets/selectedtransaction.h"
+#include "kmmviewinterface.h"
+
+KMyMoneyPlugin::KMMViewInterface::KMMViewInterface(KMyMoney2App* app, KMyMoneyView* view, QObject* parent, const char* name) :
+ ViewInterface(parent, name),
+ m_app(app),
+ m_view(view)
+{
+ connect(app, SIGNAL(accountSelected(const MyMoneyAccount&)), this, SIGNAL(accountSelected(const MyMoneyAccount&)));
+ connect(app, SIGNAL(transactionsSelected(const KMyMoneyRegister::SelectedTransactions&)), this, SIGNAL(transactionsSelected(const KMyMoneyRegister::SelectedTransactions&)));
+ connect(app, SIGNAL(accountReconciled(const MyMoneyAccount&, const QDate&, const MyMoneyMoney&, const MyMoneyMoney&, const QValueList<QPair<MyMoneyTransaction, MyMoneySplit> >&)),
+ this, SIGNAL(accountReconciled(const MyMoneyAccount&, const QDate&, const MyMoneyMoney&, const MyMoneyMoney&, const QValueList<QPair<MyMoneyTransaction, MyMoneySplit> >&)));
+
+ connect(app, SIGNAL(institutionSelected(const MyMoneyInstitution&)), this, SIGNAL(institutionSelected(const MyMoneyInstitution&)));
+
+ connect(m_view, SIGNAL(viewStateChanged(bool)), this, SIGNAL(viewStateChanged(bool)));
+ connect(m_view, SIGNAL(kmmFilePlugin(unsigned int)), this, SIGNAL(kmmFilePlugin(unsigned int)));
+}
+
+KMyMoneyViewBase* KMyMoneyPlugin::KMMViewInterface::addPage(const QString& item, const QString& icon)
+{
+ return m_view->addPage(item, icon);
+}
+
+void KMyMoneyPlugin::KMMViewInterface::addWidget(KMyMoneyViewBase* view, QWidget* w)
+{
+ if(view && w)
+ view->addWidget(w);
+}
+
+
+#include "kmmviewinterface.moc"
diff --git a/kmymoney2/plugins/interfaces/kmmviewinterface.h b/kmymoney2/plugins/interfaces/kmmviewinterface.h
new file mode 100644
index 0000000..d06b4f8
--- /dev/null
+++ b/kmymoney2/plugins/interfaces/kmmviewinterface.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ kmmviewinterface.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 KMMVIEWINTERFACE_H
+#define KMMVIEWINTERFACE_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+class KMyMoney2App;
+class KMyMoneyView;
+class KMyMoneyViewBase;
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../viewinterface.h"
+
+namespace KMyMoneyPlugin {
+
+/**
+ * This class represents the implementation of the
+ * ViewInterface.
+ */
+class KMMViewInterface : public ViewInterface {
+ Q_OBJECT
+
+public:
+ KMMViewInterface(KMyMoney2App* app, KMyMoneyView* view, QObject* parent, const char* name = 0);
+ ~KMMViewInterface() {}
+
+ /**
+ * This method returns a pointer to a newly created view
+ * with title @p item and icon @p pixmap.
+ *
+ * @param item Name of view
+ * @param icon name for the icon to be used for the view
+ *
+ * @return pointer to KMyMoneyViewBase object
+ */
+ KMyMoneyViewBase* addPage(const QString& item, const QString& icon);
+
+ /**
+ * This method allows to add a widget to the view
+ * created with addPage()
+ *
+ * @param view pointer to view object
+ * @param w pointer to widget
+ */
+ void addWidget(KMyMoneyViewBase* view, QWidget* w);
+
+private:
+ KMyMoney2App* m_app;
+ KMyMoneyView* m_view;
+};
+
+}; // namespace
+#endif