File 0001-kbanking5-kmymoney-4.5.2.patch of Package kmymoney
Backport from http://reviewboard.kde.org/r/5524/
---
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/cmake/modules/FindAqBanking.cmake kmymoney-4.5.2-kbanking5/cmake/modules/FindAqBanking.cmake
--- kmymoney-4.5.2/cmake/modules/FindAqBanking.cmake 2010-12-23 10:21:31.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/cmake/modules/FindAqBanking.cmake 2011-01-15 12:11:43.334440631 +0100
@@ -8,14 +8,17 @@
set(AQBANKING_FOUND FALSE)
if(NOT AQBANKING_MIN_VERSION)
- set(AQBANKING_MIN_VERSION "4.2.4")
+ set(AQBANKING_MIN_VERSION "5.0.0")
endif(NOT AQBANKING_MIN_VERSION)
if(NOT AQBANKING_MAX_VERSION)
# for some unknown reason, we need to give a micro version number
- # with an offset of 1 to the PKG_CHECK_MODULES macro. The actual
- # version KBanking will work with is 4.99.8
- set(AQBANKING_MAX_VERSION "4.99.9")
+ # with an offset of 1 to the PKG_CHECK_MODULES macro.
+ # The actual version of KBanking will work with is 4.99.8
+
+ # set(AQBANKING_MAX_VERSION "4.99.9")
+
+ # Currently there is no max version necessary
endif(NOT AQBANKING_MAX_VERSION)
if(AQBANKING_INCLUDE_DIRS AND AQBANKING_LIBRARIES)
@@ -23,11 +26,10 @@
set(AQBANKING_FIND_QUIETLY TRUE)
endif(AQBANKING_INCLUDE_DIRS AND AQBANKING_LIBRARIES)
-PKG_CHECK_MODULES(AQBANKING aqbanking>=${AQBANKING_MIN_VERSION} aqbanking<=${AQBANKING_MAX_VERSION})
-
-if(${AQBANKING_FOUND})
- # if AqBanking has been found make sure to add the q4banking lib
- set(AQBANKING_LIBRARIES ${AQBANKING_LIBRARIES} q4banking)
-endif(${AQBANKING_FOUND})
+if(AQBANKING_MIN_VERSION AND AQBANKING_MAX_VERSION)
+ PKG_CHECK_MODULES(AQBANKING aqbanking>=${AQBANKING_MIN_VERSION} aqbanking<=${AQBANKING_MAX_VERSION})
+else (AQBANKING_MIN_VERSION AND AQBANKING_MAX_VERSION)
+ PKG_CHECK_MODULES(AQBANKING aqbanking>=${AQBANKING_MIN_VERSION})
+endif (AQBANKING_MIN_VERSION AND AQBANKING_MAX_VERSION)
mark_as_advanced(AQBANKING_INCLUDE_DIRS AQBANKING_LIBRARIES)
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/cmake/modules/FindGwenhywfar.cmake kmymoney-4.5.2-kbanking5/cmake/modules/FindGwenhywfar.cmake
--- kmymoney-4.5.2/cmake/modules/FindGwenhywfar.cmake 2010-12-23 10:21:31.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/cmake/modules/FindGwenhywfar.cmake 2011-01-15 11:56:31.985068977 +0100
@@ -8,7 +8,7 @@
set(GWENHYWFAR_FOUND FALSE)
if(NOT GWENHYWFAR_MIN_VERSION)
- set(GWENHYWFAR_MIN_VERSION "3.10.1")
+ set(GWENHYWFAR_MIN_VERSION "4.0.0")
endif(NOT GWENHYWFAR_MIN_VERSION)
if(GWENHYWFAR_INCLUDE_DIRS AND GWENHYWFAR_LIBRARIES)
@@ -19,12 +19,23 @@
PKG_CHECK_MODULES(GWENHYWFAR gwenhywfar>=${GWENHYWFAR_MIN_VERSION})
if(${GWENHYWFAR_FOUND})
- find_library(GWENHYWFAR_GUI_LIBRARY NAMES gwengui-qt4 libgwengui-qt4
- HINTS ${GWENHYWFAR_LIBRARY_DIRS})
- if(GWENHYWFAR_GUI_LIBRARY STREQUAL "GWENHYWFAR_GUI_LIBRARY-NOTFOUND")
- set(GWENHYWFAR_GUI_LIBRARY "")
- endif(GWENHYWFAR_GUI_LIBRARY STREQUAL "GWENHYWFAR_GUI_LIBRARY-NOTFOUND")
- set(GWENHYWFAR_LIBRARIES ${GWENHYWFAR_LIBRARIES} ${GWENHYWFAR_GUI_LIBRARY})
+ PKG_CHECK_MODULES(QT4GUI gwengui-qt4)
+ if (NOT ${QT4GUI_FOUND})
+ set(GWENHYWFAR_FOUND FALSE)
+ unset(GWENHYWFAR_INCLUDE_DIRS)
+ unset(GWENHYWFAR_LIBRARIES)
+ unset(GWENHYWFAR_VERSION)
+ message(STATUS "Gwenhywfar does not have the Q4Banking frontend enabled")
+ endif (NOT ${QT4GUI_FOUND})
+
+ if(${GWENHYWFAR_FOUND})
+ find_library(GWENHYWFAR_GUI_LIBRARY NAMES gwengui-qt4 libgwengui-qt4
+ HINTS ${GWENHYWFAR_LIBRARY_DIRS})
+ if(GWENHYWFAR_GUI_LIBRARY STREQUAL "GWENHYWFAR_GUI_LIBRARY-NOTFOUND")
+ set(GWENHYWFAR_GUI_LIBRARY "")
+ endif(GWENHYWFAR_GUI_LIBRARY STREQUAL "GWENHYWFAR_GUI_LIBRARY-NOTFOUND")
+ set(GWENHYWFAR_LIBRARIES ${GWENHYWFAR_LIBRARIES} ${GWENHYWFAR_GUI_LIBRARY})
+ endif(${GWENHYWFAR_FOUND})
endif(${GWENHYWFAR_FOUND})
mark_as_advanced(GWENHYWFAR_INCLUDE_DIRS GWENHYWFAR_LIBRARIES)
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/CMakeLists.txt kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/CMakeLists.txt
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/CMakeLists.txt 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/CMakeLists.txt 2011-01-15 11:56:31.992074382 +0100
@@ -17,7 +17,10 @@
########### next target ###############
-SET(kmm_kbanking_PART_SRCS kbanking.cpp mymoneybanking.cpp)
+SET(kmm_kbanking_PART_SRCS
+ mymoneybanking.cpp
+ banking.cpp
+ )
KDE4_ADD_PLUGIN(kmm_kbanking ${kmm_kbanking_PART_SRCS})
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/banking.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/banking.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/banking.cpp 1970-01-01 01:00:00.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/banking.cpp 2011-01-15 11:56:31.993068929 +0100
@@ -0,0 +1,462 @@
+/***************************************************************************
+ begin : Mon Mar 01 2004
+ copyright : (C) 2004 by Martin Preuss
+ email : martin@libchipcard.de
+
+ ***************************************************************************
+ * This file is part of the project "AqBanking". *
+ * Please see toplevel file COPYING of that project for license details. *
+ ***************************************************************************/
+
+
+#ifdef HAVE_CONFIG_H
+# include <config-kmymoney.h>
+#endif
+
+
+#include "banking.hpp"
+#include <aqbanking/banking_be.h>
+#include <aqbanking/banking_cfg.h>
+#include <assert.h>
+
+#include <gwenhywfar/inherit.h>
+#include <gwenhywfar/debug.h>
+
+
+
+AB_Banking::AB_Banking(const char *appname, const char *fname)
+{
+ assert(appname);
+ _banking = AB_Banking_new(appname, fname, 0);
+}
+
+
+
+AB_Banking::~AB_Banking()
+{
+ DBG_NOTICE(AQBANKING_LOGDOMAIN, "~AB_Banking: Freeing AB_Banking");
+ AB_Banking_free(_banking);
+}
+
+
+
+int AB_Banking::init()
+{
+ return AB_Banking_Init(_banking);
+}
+
+
+
+int AB_Banking::fini()
+{
+ return AB_Banking_Fini(_banking);
+}
+
+
+
+int AB_Banking::onlineInit()
+{
+ return AB_Banking_OnlineInit(_banking);
+}
+
+
+
+int AB_Banking::onlineFini()
+{
+ return AB_Banking_OnlineFini(_banking);
+}
+
+
+
+const char *AB_Banking::getAppName()
+{
+ return AB_Banking_GetAppName(_banking);
+}
+
+
+
+std::list<AB_ACCOUNT*> AB_Banking::getAccounts()
+{
+ AB_ACCOUNT_LIST2 *ll;
+ std::list<AB_ACCOUNT*> rl;
+
+ ll = AB_Banking_GetAccounts(_banking);
+ if (ll) {
+ AB_ACCOUNT *a;
+ AB_ACCOUNT_LIST2_ITERATOR *it;
+
+ it = AB_Account_List2_First(ll);
+ assert(it);
+ a = AB_Account_List2Iterator_Data(it);
+ assert(a);
+ while (a) {
+ rl.push_back(a);
+ a = AB_Account_List2Iterator_Next(it);
+ }
+ AB_Account_List2Iterator_free(it);
+ AB_Account_List2_free(ll);
+ }
+ return rl;
+}
+
+
+
+AB_ACCOUNT *AB_Banking::getAccount(uint32_t uniqueId)
+{
+ return AB_Banking_GetAccount(_banking, uniqueId);
+}
+
+
+
+std::list<AB_USER*> AB_Banking::getUsers()
+{
+ AB_USER_LIST2 *ll;
+ std::list<AB_USER*> rl;
+
+ ll = AB_Banking_GetUsers(_banking);
+ if (ll) {
+ AB_USER *a;
+ AB_USER_LIST2_ITERATOR *it;
+
+ it = AB_User_List2_First(ll);
+ assert(it);
+ a = AB_User_List2Iterator_Data(it);
+ assert(a);
+ while (a) {
+ rl.push_back(a);
+ a = AB_User_List2Iterator_Next(it);
+ }
+ AB_User_List2Iterator_free(it);
+ AB_User_List2_free(ll);
+ }
+ return rl;
+}
+
+
+
+int AB_Banking::getUserDataDir(GWEN_BUFFER *buf) const
+{
+ return AB_Banking_GetUserDataDir(_banking, buf);
+}
+
+
+
+int AB_Banking::getAppUserDataDir(GWEN_BUFFER *buf) const
+{
+ return AB_Banking_GetAppUserDataDir(_banking, buf);
+}
+
+
+
+AB_BANKING *AB_Banking::getCInterface()
+{
+ return _banking;
+}
+
+
+
+std::list<std::string> AB_Banking::getActiveProviders()
+{
+ const GWEN_STRINGLIST *sl;
+ std::list<std::string> l;
+
+ sl = AB_Banking_GetActiveProviders(_banking);
+ if (sl) {
+ GWEN_STRINGLISTENTRY *se;
+
+ se = GWEN_StringList_FirstEntry(sl);
+ assert(se);
+ while (se) {
+ const char *p;
+
+ p = GWEN_StringListEntry_Data(se);
+ assert(p);
+ l.push_back(p);
+ se = GWEN_StringListEntry_Next(se);
+ } /* while */
+ }
+ return l;
+}
+
+
+AB_PROVIDER *AB_Banking::getProvider(const char *name)
+{
+ return AB_Banking_GetProvider(_banking, name);
+}
+
+
+
+bool AB_Banking::importContext(AB_IMEXPORTER_CONTEXT *ctx, uint32_t flags)
+{
+ AB_IMEXPORTER_ACCOUNTINFO *ai;
+
+ ai = AB_ImExporterContext_GetFirstAccountInfo(ctx);
+ while (ai) {
+ if (!importAccountInfo(ai, flags))
+ return false;
+ ai = AB_ImExporterContext_GetNextAccountInfo(ctx);
+ }
+
+ return true;
+}
+
+
+
+bool AB_Banking::importAccountInfo(AB_IMEXPORTER_ACCOUNTINFO*, uint32_t)
+{
+ return false;
+}
+
+
+
+int AB_Banking::executeJobs(AB_JOB_LIST2 *jl, AB_IMEXPORTER_CONTEXT *ctx)
+{
+ return AB_Banking_ExecuteJobs(_banking, jl, ctx);
+}
+
+
+
+int AB_Banking::loadSharedConfig(const char *name, GWEN_DB_NODE **pDb)
+{
+ return AB_Banking_LoadSharedConfig(_banking, name, pDb);
+}
+
+
+
+int AB_Banking::saveSharedConfig(const char *name, GWEN_DB_NODE *db)
+{
+ return AB_Banking_SaveSharedConfig(_banking, name, db);
+}
+
+
+
+int AB_Banking::lockSharedConfig(const char *name)
+{
+ return AB_Banking_LockSharedConfig(_banking, name);
+}
+
+
+
+int AB_Banking::unlockSharedConfig(const char *name)
+{
+ return AB_Banking_UnlockSharedConfig(_banking, name);
+}
+
+
+
+int AB_Banking::loadSharedSubConfig(const char *name,
+ const char *subGroup,
+ GWEN_DB_NODE **pDb)
+{
+ GWEN_DB_NODE *dbShared = NULL;
+ int rv;
+
+ rv = loadSharedConfig(name, &dbShared);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to load config (%d)", rv);
+ GWEN_DB_Group_free(dbShared);
+ return rv;
+ } else {
+ GWEN_DB_NODE *dbSrc;
+
+ dbSrc = GWEN_DB_GetGroup(dbShared,
+ GWEN_PATH_FLAGS_NAMEMUSTEXIST,
+ subGroup);
+ if (dbSrc) {
+ *pDb = GWEN_DB_Group_dup(dbSrc);
+ } else {
+ *pDb = GWEN_DB_Group_new("config");
+ }
+ GWEN_DB_Group_free(dbShared);
+
+ return 0;
+ }
+}
+
+
+
+int AB_Banking::saveSharedSubConfig(const char *name,
+ const char *subGroup,
+ GWEN_DB_NODE *dbSrc)
+{
+ GWEN_DB_NODE *dbShared = NULL;
+ int rv;
+
+ rv = lockSharedConfig(name);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to lock config");
+ return rv;
+ } else {
+ rv = loadSharedConfig(name, &dbShared);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to load config (%d)", rv);
+ unlockSharedConfig(name);
+ return rv;
+ } else {
+ GWEN_DB_NODE *dbDst;
+
+ dbDst = GWEN_DB_GetGroup(dbShared,
+ GWEN_DB_FLAGS_OVERWRITE_GROUPS,
+ subGroup);
+ assert(dbDst);
+ if (dbSrc)
+ GWEN_DB_AddGroupChildren(dbDst, dbSrc);
+ rv = saveSharedConfig(name, dbShared);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to store config (%d)", rv);
+ unlockSharedConfig(name);
+ GWEN_DB_Group_free(dbShared);
+ return rv;
+ }
+ GWEN_DB_Group_free(dbShared);
+ }
+
+ rv = unlockSharedConfig(name);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to unlock config (%d)", rv);
+ return rv;
+ }
+ }
+ return 0;
+}
+
+
+int AB_Banking::loadAppConfig(GWEN_DB_NODE **pDb)
+{
+ return AB_Banking_LoadAppConfig(_banking, pDb);
+}
+
+
+
+int AB_Banking::saveAppConfig(GWEN_DB_NODE *db)
+{
+ return AB_Banking_SaveAppConfig(_banking, db);
+}
+
+
+
+int AB_Banking::lockAppConfig()
+{
+ return AB_Banking_LockAppConfig(_banking);
+}
+
+
+
+int AB_Banking::unlockAppConfig()
+{
+ return AB_Banking_UnlockAppConfig(_banking);
+}
+
+
+
+int AB_Banking::loadAppSubConfig(const char *subGroup,
+ GWEN_DB_NODE **pDb)
+{
+ GWEN_DB_NODE *dbApp = NULL;
+ int rv;
+
+ rv = loadAppConfig(&dbApp);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to load config (%d)", rv);
+ GWEN_DB_Group_free(dbApp);
+ return rv;
+ } else {
+ GWEN_DB_NODE *dbSrc;
+
+ dbSrc = GWEN_DB_GetGroup(dbApp,
+ GWEN_PATH_FLAGS_NAMEMUSTEXIST,
+ subGroup);
+ if (dbSrc) {
+ *pDb = GWEN_DB_Group_dup(dbSrc);
+ } else {
+ *pDb = GWEN_DB_Group_new("config");
+ }
+ GWEN_DB_Group_free(dbApp);
+
+ return 0;
+ }
+}
+
+
+
+int AB_Banking::saveAppSubConfig(const char *subGroup,
+ GWEN_DB_NODE *dbSrc)
+{
+ GWEN_DB_NODE *dbApp = NULL;
+ int rv;
+
+ rv = lockAppConfig();
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to lock config");
+ return rv;
+ } else {
+ rv = loadAppConfig(&dbApp);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to load config (%d)", rv);
+ unlockAppConfig();
+ return rv;
+ } else {
+ GWEN_DB_NODE *dbDst;
+
+ dbDst = GWEN_DB_GetGroup(dbApp,
+ GWEN_DB_FLAGS_OVERWRITE_GROUPS,
+ subGroup);
+ assert(dbDst);
+ if (dbSrc)
+ GWEN_DB_AddGroupChildren(dbDst, dbSrc);
+ rv = saveAppConfig(dbApp);
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to store config (%d)", rv);
+ unlockAppConfig();
+ GWEN_DB_Group_free(dbApp);
+ return rv;
+ }
+ GWEN_DB_Group_free(dbApp);
+ }
+
+ rv = unlockAppConfig();
+ if (rv < 0) {
+ DBG_ERROR(0, "Unable to unlock config (%d)", rv);
+ return rv;
+ }
+ }
+ return 0;
+}
+
+
+int AB_Banking::beginExclUseAccount(AB_ACCOUNT *a)
+{
+ return AB_Banking_BeginExclUseAccount(_banking, a);
+}
+
+
+
+int AB_Banking::endExclUseAccount(AB_ACCOUNT *a, int abandon)
+{
+ return AB_Banking_EndExclUseAccount(_banking, a, abandon);
+}
+
+
+
+int AB_Banking::beginExclUseUser(AB_USER *u)
+{
+ return AB_Banking_BeginExclUseUser(_banking, u);
+}
+
+
+
+int AB_Banking::endExclUseUser(AB_USER *u, int abandon)
+{
+ return AB_Banking_EndExclUseUser(_banking, u, abandon);
+}
+
+
+void AB_Banking::setAccountAlias(AB_ACCOUNT *a, const char *alias)
+{
+ AB_Banking_SetAccountAlias(_banking, a, alias);
+}
+
+
+
+
+
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/banking.hpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/banking.hpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/banking.hpp 1970-01-01 01:00:00.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/banking.hpp 2011-01-15 11:56:31.992074382 +0100
@@ -0,0 +1,185 @@
+/***************************************************************************
+ begin : Mon Mar 01 2004
+ copyright : (C) 2004 by Martin Preuss
+ email : martin@libchipcard.de
+
+ ***************************************************************************
+ * This file is part of the project "AqBanking". *
+ * Please see toplevel file COPYING of that project for license details. *
+ ***************************************************************************/
+
+/** @file
+ * @short A C++ wrapper of the main aqbanking interface
+ */
+
+#ifndef AQ_BANKING_CPP_H
+#define AQ_BANKING_CPP_H
+
+
+#include <aqbanking/banking.h>
+#include <aqbanking/system.h>
+
+#include <list>
+#include <string>
+
+
+/**
+ * @brief A C++ binding for the C module @ref AB_BANKING
+ *
+ * This class simply is a C++ binding for the C module @ref AB_BANKING.
+ * It redirects C callbacks used by AB_BANKING to virtual functions in
+ * this class. It als transforms some return values inconveniant for
+ * C++ into STL objects (such as "list<T>").
+ *
+ * @ingroup G_AB_CPP_INTERFACE
+ *
+ * @author Martin Preuss<martin@aquamaniac.de>
+ */
+class AB_Banking {
+private:
+ AB_BANKING *_banking;
+
+public:
+ AB_Banking(const char *appname,
+ const char *fname);
+ virtual ~AB_Banking();
+
+
+ AB_BANKING *getCInterface();
+
+
+ /**
+ * See @ref AB_Banking_Init
+ */
+ virtual int init();
+
+ /**
+ * See @ref AB_Banking_Fini
+ */
+ virtual int fini();
+
+
+ /**
+ * See @ref AB_Banking_OnlineInit
+ */
+ int onlineInit();
+
+ /**
+ * See @ref AB_Banking_OnlineFini
+ */
+ int onlineFini();
+
+ /**
+ * Loads a backend with the given name. You can use
+ * @ref AB_Banking_GetProviderDescrs to retrieve a list of available
+ * backends. Such a backend can then be asked to return an account list.
+ */
+ AB_PROVIDER *getProvider(const char *name);
+
+
+ /**
+ * Returns the application name as given to @ref AB_Banking_new.
+ */
+ const char *getAppName();
+
+ /**
+ * Returns a list of pointers to currently known accounts.
+ * Please note that the pointers in this list are still owned by
+ * AqBanking, so you MUST NOT free them.
+ * However, destroying the list will not free the accounts, so it is
+ * safe to do that.
+ */
+ std::list<AB_ACCOUNT*> getAccounts();
+
+ /**
+ * This function does an account lookup based on the given unique id.
+ * This id is assigned by AqBanking when an account is created.
+ * The pointer returned is still owned by AqBanking, so you MUST NOT free
+ * it.
+ */
+ AB_ACCOUNT *getAccount(uint32_t uniqueId);
+
+ /**
+ * Returns a list of pointers to currently known users.
+ * Please note that the pointers in this list are still owned by
+ * AqBanking, so you MUST NOT free them.
+ * However, destroying the list will not free the users, so it is
+ * safe to do that.
+ */
+ std::list<AB_USER*> getUsers();
+
+ int getUserDataDir(GWEN_BUFFER *buf) const ;
+ int getAppUserDataDir(GWEN_BUFFER *buf) const ;
+
+ int loadAppConfig(GWEN_DB_NODE **pDb);
+ int saveAppConfig(GWEN_DB_NODE *db);
+ int lockAppConfig();
+ int unlockAppConfig();
+
+ int loadAppSubConfig(const char *subGroup,
+ GWEN_DB_NODE **pDb);
+
+ int saveAppSubConfig(const char *subGroup,
+ GWEN_DB_NODE *dbSrc);
+
+
+ int loadSharedConfig(const char *name, GWEN_DB_NODE **pDb);
+ int saveSharedConfig(const char *name, GWEN_DB_NODE *db);
+ int lockSharedConfig(const char *name);
+ int unlockSharedConfig(const char *name);
+
+ int loadSharedSubConfig(const char *name,
+ const char *subGroup,
+ GWEN_DB_NODE **pDb);
+
+ int saveSharedSubConfig(const char *name,
+ const char *subGroup,
+ GWEN_DB_NODE *dbSrc);
+
+ int beginExclUseAccount(AB_ACCOUNT *a);
+ int endExclUseAccount(AB_ACCOUNT *a, int abandon);
+
+ int beginExclUseUser(AB_USER *u);
+ int endExclUseUser(AB_USER *u, int abandon);
+
+ std::list<std::string> getActiveProviders();
+
+ void setAccountAlias(AB_ACCOUNT *a, const char *alias);
+
+
+ /** @name Enqueueing, Dequeueing and Executing Jobs
+ *
+ * Enqueued jobs are preserved across shutdowns. As soon as a job has been
+ * sent to the appropriate backend it will be removed from the queue.
+ * Only those jobs are saved/reloaded which have been enqueued but never
+ * presented to the backend. This means after calling
+ * @ref AB_Banking_ExecuteQueue only those jobs are still in the queue which
+ * have not been processed (e.g. because they belonged to a second backend
+ * but the user aborted while the jobs for a first backend were in process).
+ */
+ /*@{*/
+ /**
+ * This function sends all jobs in the list to their corresponding backends
+ * and allows that backend to process it.
+ */
+ virtual int executeJobs(AB_JOB_LIST2 *jl,
+ AB_IMEXPORTER_CONTEXT *ctx);
+
+ /*@}*/
+
+ /**
+ * Let the application import a given statement context.
+ */
+ virtual bool importContext(AB_IMEXPORTER_CONTEXT *ctx,
+ uint32_t flags);
+
+ virtual bool importAccountInfo(AB_IMEXPORTER_ACCOUNTINFO *ai, uint32_t flags);
+
+};
+
+
+
+
+#endif /* AQ_BANKING_CPP_H */
+
+
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/CMakeLists.txt kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/CMakeLists.txt
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/CMakeLists.txt 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/CMakeLists.txt 2011-01-15 11:56:31.993068929 +0100
@@ -4,12 +4,13 @@
SET(kmm_kbanking_dialogs_la_SOURCES
kbaccountsettings.cpp
kbpickstartdate.cpp
- kbsettings.cpp
+ kbmapaccount.cpp
)
SET(kmm_kbanking_dialogs_UI
kbaccountsettings.ui
kbpickstartdate.ui
+ kbmapaccount.ui
)
KDE4_ADD_UI_FILES(kmm_kbanking_dialogs_la_SOURCES
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbmapaccount.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbmapaccount.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbmapaccount.cpp 1970-01-01 01:00:00.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbmapaccount.cpp 2011-01-15 11:56:31.993068929 +0100
@@ -0,0 +1,111 @@
+/***************************************************************************
+ begin : Mon Mar 01 2004
+ copyright : (C) 2004 by Martin Preuss
+ email : martin@libchipcard.de
+
+ ***************************************************************************
+ * Please see toplevel file COPYING for license details *
+ ***************************************************************************/
+
+
+#ifdef HAVE_CONFIG_H
+# include <config-kmymoney.h>
+#endif
+
+
+// QBanking includes
+#include "kbmapaccount.h"
+#include "kbaccountlist.h"
+#include "mymoneybanking.h"
+
+// QT includes
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qmessagebox.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+
+
+
+
+KBMapAccount::KBMapAccount(KMyMoneyBanking *kb,
+ const char *bankCode,
+ const char *accountId,
+ QWidget* parent,
+ Qt::WFlags fl)
+ : QDialog(parent, fl)
+ , _banking(kb)
+ , _account(0)
+{
+ _ui.setupUi(this);
+
+ _ui.accountList->setSelectionMode(QAbstractItemView::SingleSelection);
+
+ if (bankCode)
+ _ui.bankCodeEdit->setText(QString::fromUtf8(bankCode));
+ else
+ _ui.bankCodeEdit->setEnabled(false);
+ if (accountId)
+ _ui.accountIdEdit->setText(QString::fromUtf8(accountId));
+ else
+ _ui.accountIdEdit->setEnabled(false);
+
+ QObject::connect(_ui.accountList, SIGNAL(itemSelectionChanged()),
+ this, SLOT(slotSelectionChanged()));
+ QObject::connect(_ui.helpButton, SIGNAL(clicked()),
+ this, SLOT(slotHelpClicked()));
+
+ _ui.accountList->addAccounts(_banking->getAccounts());
+}
+
+
+KBMapAccount::~KBMapAccount()
+{
+}
+
+
+
+AB_ACCOUNT *KBMapAccount::getAccount()
+{
+ return _account;
+}
+
+
+
+void KBMapAccount::accept()
+{
+ if (_account)
+ QDialog::accept();
+}
+
+
+
+void KBMapAccount::slotSelectionChanged()
+{
+ std::list<AB_ACCOUNT*> al;
+ AB_ACCOUNT *a;
+
+ al = _ui.accountList->getSelectedAccounts();
+ if (al.empty()) {
+ _ui.assignButton->setEnabled(false);
+ _account = 0;
+ return;
+ }
+ a = al.front();
+ if (AB_Account_GetUniqueId(a) != 0) {
+ _account = a;
+ _ui.assignButton->setEnabled(true);
+ } else
+ _ui.assignButton->setEnabled(false);
+}
+
+
+
+void KBMapAccount::slotHelpClicked()
+{
+}
+
+
+
+
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbmapaccount.h kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbmapaccount.h
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbmapaccount.h 1970-01-01 01:00:00.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbmapaccount.h 2011-01-15 11:56:31.993068929 +0100
@@ -0,0 +1,54 @@
+/***************************************************************************
+ begin : Mon Mar 01 2004
+ copyright : (C) 2004 by Martin Preuss
+ email : martin@libchipcard.de
+
+ ***************************************************************************
+ * Please see toplevel file COPYING for license details *
+ ***************************************************************************/
+
+#ifndef QBANKING_MAPACCOUNT_H
+#define QBANKING_MAPACCOUNT_H
+
+#include "mymoneybanking.h"
+#include "kbaccountlist.h"
+#include "ui_kbmapaccount.h"
+
+#include <aqbanking/account.h>
+
+
+class KMyMoneyBanking;
+
+
+class KBMapAccount: public QDialog
+{
+ Q_OBJECT
+public:
+ KBMapAccount(KMyMoneyBanking *kb,
+ const char *bankCode,
+ const char *accountId,
+ QWidget* parent = 0,
+ Qt::WFlags fl = 0);
+ ~KBMapAccount();
+
+ AB_ACCOUNT *getAccount();
+
+ void accept();
+
+protected slots:
+ void slotSelectionChanged();
+ void slotHelpClicked();
+
+private:
+ Ui_KBMapAccountUi _ui;
+ KMyMoneyBanking *_banking;
+ AB_ACCOUNT *_account;
+ KBAccountListView *_accountList;
+};
+
+
+
+
+
+#endif /* QBANKING_MAPACCOUNT_H */
+
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbmapaccount.ui kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbmapaccount.ui
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbmapaccount.ui 1970-01-01 01:00:00.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbmapaccount.ui 2011-01-15 11:56:31.994345146 +0100
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>KBMapAccountUi</class>
+ <widget class="QDialog" name="KBMapAccountUi">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>743</width>
+ <height>534</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Account Mapping</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QLabel" name="textLabel1">
+ <property name="text">
+ <string><qt>
+Please choose the <b>online</b> account you want the
+<b>application</b> account to be mapped to from the list below.
+</qt></string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Application Account</string>
+ </property>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="textLabel2">
+ <property name="text">
+ <string>Bank Code</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="bankCodeEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="textLabel2_2">
+ <property name="text">
+ <string>Account Number</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="accountIdEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="accountBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Online Accounts</string>
+ </property>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="KBAccountListView" name="accountList" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QPushButton" name="helpButton">
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer1">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>326</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="assignButton">
+ <property name="text">
+ <string>Assign</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="abortButton">
+ <property name="text">
+ <string>Abort</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>KBAccountListView</class>
+ <extends>QWidget</extends>
+ <header>kbaccountlist.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>abortButton</sender>
+ <signal>clicked()</signal>
+ <receiver>KBMapAccountUi</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>676</x>
+ <y>521</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>512</x>
+ <y>430</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>assignButton</sender>
+ <signal>clicked()</signal>
+ <receiver>KBMapAccountUi</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>590</x>
+ <y>521</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>452</x>
+ <y>459</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.cpp 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.cpp 2011-01-15 11:56:31.994345146 +0100
@@ -25,7 +25,6 @@
// QBanking includes
#include "kbpickstartdate.h"
-#include <q4banking/qbanking.h>
// Gwenhywfar includes
#include <gwenhywfar/debug.h>
@@ -46,7 +45,7 @@
-KBPickStartDate::KBPickStartDate(QBanking *qb,
+KBPickStartDate::KBPickStartDate(KMyMoneyBanking* qb,
const QDate &firstPossible,
const QDate &lastUpdate,
const QString& accountName,
@@ -139,6 +138,5 @@
void KBPickStartDate::slotHelpClicked()
{
- _banking->invokeHelp("KBPickStartDate", "none");
}
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.h kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.h
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.h 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbpickstartdate.h 2011-01-15 11:56:31.994345146 +0100
@@ -25,8 +25,7 @@
#include <QDateTime>
#include <QDialog>
-
-class QBanking;
+#include "mymoneybanking.h"
/**
* Class derived from QBPickStartDate and modified to
@@ -39,11 +38,11 @@
{
Q_OBJECT
private:
- QBanking *_banking;
+ KMyMoneyBanking *_banking;
const QDate &_firstPossible;
const QDate &_lastUpdate;
public:
- KBPickStartDate(QBanking *banking,
+ KBPickStartDate(KMyMoneyBanking* qb,
const QDate &firstPossible,
const QDate &lastUpdate,
const QString& accountName,
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbsettings.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbsettings.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbsettings.cpp 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbsettings.cpp 2011-01-15 11:56:31.995451578 +0100
@@ -1,58 +0,0 @@
-/***************************************************************************
- * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
- * Copyright 2004 Martin Preuss aquamaniac@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) version 3 or any later version *
- * accepted by the membership of KDE e.V. (or its successor approved *
- * by the membership of KDE e.V.), which shall act as a proxy *
- * defined in Section 14 of version 3 of the license. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/> *
- ***************************************************************************/
-#ifdef HAVE_CONFIG_H
-# include <config-kmymoney.h>
-#endif
-
-#include "kbsettings.h"
-
-#include <gwenhywfar/debug.h>
-
-KBankingSettings::KBankingSettings(KBanking *ab,
- QWidget* parent,
- const char* name,
- Qt::WFlags fl)
- : QBCfgTabSettings(ab, parent, name, fl)
-{
- addUsersPage();
- addAccountsPage();
- addBackendsPage();
-}
-
-KBankingSettings::~KBankingSettings()
-{
-}
-
-int KBankingSettings::init()
-{
- if (!toGui()) {
- DBG_ERROR(0, "Could not init dialog");
- return -1;
- }
- return 0;
-}
-
-int KBankingSettings::fini()
-{
- if (!fromGui())
- return -1;
- return 0;
-}
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbsettings.h kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbsettings.h
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/dialogs/kbsettings.h 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/dialogs/kbsettings.h 2011-01-15 11:56:31.995451578 +0100
@@ -1,40 +0,0 @@
-/***************************************************************************
- * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
- * Copyright 2004 Martin Preuss aquamaniac@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) version 3 or any later version *
- * accepted by the membership of KDE e.V. (or its successor approved *
- * by the membership of KDE e.V.), which shall act as a proxy *
- * defined in Section 14 of version 3 of the license. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/> *
- ***************************************************************************/
-#ifndef KBANKING_KBSETTINGS_H
-#define KBANKING_KBSETTINGS_H
-
-#include "kbanking.h"
-#include <q4banking/qbcfgtabsettings.h>
-
-class KBankingSettings: public QBCfgTabSettings
-{
-private:
-public:
- explicit KBankingSettings(KBanking *ab,
- QWidget* parent = 0,
- const char* name = 0, Qt::WFlags fl = 0);
- ~KBankingSettings();
-
- int init();
- int fini();
-};
-
-#endif /* KBANKING_KBSETTINGS_H */
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/kbanking.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/kbanking.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/kbanking.cpp 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/kbanking.cpp 2011-01-15 11:56:31.996073240 +0100
@@ -1,162 +0,0 @@
-/***************************************************************************
- * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
- * Copyright 2004 Martin Preuss aquamaniac@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) version 3 or any later version *
- * accepted by the membership of KDE e.V. (or its successor approved *
- * by the membership of KDE e.V.), which shall act as a proxy *
- * defined in Section 14 of version 3 of the license. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/> *
- ***************************************************************************/
-#ifdef HAVE_CONFIG_H
-# include <config-kmymoney.h>
-#endif
-
-
-#include "kbanking.h"
-
-#include <assert.h>
-#include <QString>
-#include <QMessageBox>
-#include <QInputDialog>
-#include <QApplication>
-#include <QDateTime>
-#include <QWidget>
-
-#include <gwenhywfar/debug.h>
-#include <gwenhywfar/text.h>
-
-KBanking::KBanking(const char *appname,
- const char *cfgDir) :
- QBanking(appname, cfgDir),
- _jobQueue(0)
-{
-}
-
-
-
-KBanking::~KBanking()
-{
-}
-
-
-
-int KBanking::init()
-{
- int rv;
-
- rv = QBanking::init();
- if (rv < 0)
- return rv;
-
- rv = onlineInit();
- if (rv) {
- fprintf(stderr, "Error on online init (%d).\n", rv);
- QBanking::fini();
- return rv;
- }
-
- _jobQueue = AB_Job_List2_new();
-
- return 0;
-}
-
-
-
-int KBanking::fini()
-{
- int rv;
-
- if (_jobQueue) {
- AB_Job_List2_FreeAll(_jobQueue);
- _jobQueue = 0;
- }
-
- rv = onlineFini();
- if (rv) {
- QBanking::fini();
- return rv;
- }
- return QBanking::fini();
-}
-
-
-
-int KBanking::executeQueue(AB_IMEXPORTER_CONTEXT *ctx)
-{
- int rv;
- AB_JOB_LIST2 *oldQ;
-
- rv = AB_BANKING_QBANKING_EXECUTE_JOBS(_jobQueue, ctx);
- oldQ = _jobQueue;
- _jobQueue = AB_Job_List2_new();
- flagStaff()->queueUpdated();
- AB_Job_List2_FreeAll(oldQ);
- return rv;
-}
-
-
-
-std::list<AB_JOB*> KBanking::getEnqueuedJobs()
-{
- AB_JOB_LIST2 *ll;
- std::list<AB_JOB*> rl;
-
- ll = _jobQueue;
- if (ll && AB_Job_List2_GetSize(ll)) {
- AB_JOB *j;
- AB_JOB_LIST2_ITERATOR *it;
-
- it = AB_Job_List2_First(ll);
- assert(it);
- j = AB_Job_List2Iterator_Data(it);
- assert(j);
- while (j) {
- rl.push_back(j);
- j = AB_Job_List2Iterator_Next(it);
- }
- AB_Job_List2Iterator_free(it);
- }
- return rl;
-}
-
-
-
-int KBanking::enqueueJob(AB_JOB *j)
-{
- assert(_jobQueue);
- assert(j);
- AB_Job_Attach(j);
- AB_Job_List2_PushBack(_jobQueue, j);
- flagStaff()->queueUpdated();
- return 0;
-}
-
-
-
-int KBanking::dequeueJob(AB_JOB *j)
-{
- assert(_jobQueue);
- AB_Job_List2_Remove(_jobQueue, j);
- AB_Job_free(j);
- flagStaff()->queueUpdated();
- return 0;
-}
-
-
-
-
-
-
-
-
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/kbanking.h kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/kbanking.h
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/kbanking.h 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/kbanking.h 2011-01-15 11:56:31.995451578 +0100
@@ -1,86 +0,0 @@
-/***************************************************************************
- * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
- * Copyright 2004 Martin Preuss aquamaniac@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) version 3 or any later version *
- * accepted by the membership of KDE e.V. (or its successor approved *
- * by the membership of KDE e.V.), which shall act as a proxy *
- * defined in Section 14 of version 3 of the license. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/> *
- ***************************************************************************/
-#ifndef KBANKING_KBANKING_H
-#define KBANKING_KBANKING_H
-
-#include <aqbanking/version.h>
-#include <aqbanking/banking.h>
-#include <q4banking/qbanking.h>
-
-#ifndef AQB_MAKE_VERSION
-#define AQB_MAKE_VERSION(a,b,c,d) (((a)<<24) | ((b)<<16) | (c<<8) | (d))
-#endif
-
-#ifndef AQBANKING_VERSION
-#define AQBANKING_VERSION AQB_MAKE_VERSION(AQBANKING_VERSION_MAJOR,AQBANKING_VERSION_MINOR,AQBANKING_VERSION_PATCHLEVEL,AQBANKING_VERSION_BUILD)
-#endif
-
-#ifndef AQB_IS_VERSION
-#define AQB_IS_VERSION(a,b,c,d) (AQBANKING_VERSION >= AQB_MAKE_VERSION(a,b,c,d))
-#endif
-
-#ifndef KBANKING_GUIID
-#if AQB_IS_VERSION(4,99,0,0)
-# define AB_BANKING_QBANKING_EXECUTE_JOBS(a, b) QBanking::executeJobs(a, b)
-# define AB_BANKING_JOB_CHECKAVAILABILITY(a) AB_Job_CheckAvailability(a)
-# define AB_BANKING_GETACCOUNTBYALIAS(a, b) AB_Banking_GetAccountByAlias(a, b)
-#elif AQB_IS_VERSION(3,9,0,0)
-# define onlineInit() onlineInit(0)
-# define onlineFini() onlineFini(0)
-# define AB_BANKING_QBANKING_EXECUTE_JOBS(a, b) QBanking::executeJobs(a, b, 0)
-# define AB_BANKING_GETACCOUNTBYALIAS(a, b) AB_Banking_GetAccountByAlias(a, b, 0)
-# define AB_BANKING_JOB_CHECKAVAILABILITY(a) AB_Job_CheckAvailability(a, 0)
-#else
-# define AB_BANKING_GETACCOUNTBYALIAS(a, b) AB_Banking_GetAccountByAlias(a, b)
-#endif
-#endif
-
-
-#include <list>
-
-
-class KBanking: public QBanking
-{
-private:
- AB_JOB_LIST2 *_jobQueue;
-
-public:
- explicit KBanking(const char *appname,
- const char *cfgDir = 0);
- virtual ~KBanking();
-
- int init();
- int fini();
-
- int executeQueue(AB_IMEXPORTER_CONTEXT *ctx);
-
- int enqueueJob(AB_JOB *j);
- int dequeueJob(AB_JOB *j);
- std::list<AB_JOB*> getEnqueuedJobs();
-
-};
-
-
-
-
-#endif /* KBANKING_KBANKING_H */
-
-
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/mymoneybanking.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/mymoneybanking.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/mymoneybanking.cpp 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/mymoneybanking.cpp 2011-01-15 12:02:43.543075444 +0100
@@ -1,6 +1,7 @@
/***************************************************************************
- * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
* Copyright 2004 Martin Preuss aquamaniac@users.sourceforge.net *
+ * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
+ * Copyright 2010 Thomas Baumgart 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 *
@@ -33,6 +34,7 @@
#include <QRegExp>
#include <QCheckBox>
#include <QLabel>
+#include <QTimer>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -59,9 +61,12 @@
#include <aqbanking/jobgettransactions.h>
#include <aqbanking/jobgetbalance.h>
#include <aqbanking/job.h>
-#include <q4banking/qbgui.h>
+#include <aqbanking/abgui.h>
+#include <aqbanking/dlg_setup.h>
+#include <aqbanking/dlg_importer.h>
#include <gwenhywfar/logger.h>
#include <gwenhywfar/debug.h>
+#include <gwen-gui-qt4/qt4_gui.hpp>
// ----------------------------------------------------------------------------
// Project Includes
@@ -69,6 +74,7 @@
#include "kbjobview.h"
#include "kbsettings.h"
#include "kbaccountsettings.h"
+#include "kbmapaccount.h"
#include <kmymoney/mymoneyfile.h>
#include <kmymoney/kmymoneyview.h>
#include <kmymoney/mymoneykeyvaluecontainer.h>
@@ -80,7 +86,7 @@
class KBankingPlugin::Private
{
public:
- Private() {
+ Private() : passwordCacheTimer(0) {
QString gwenProxy = QString::fromLocal8Bit(qgetenv("GWEN_PROXY"));
if (gwenProxy.isEmpty()) {
KConfig *cfg = new KConfig("kioslaverc");
@@ -112,6 +118,8 @@
delete cfg;
}
}
+
+ QTimer *passwordCacheTimer;
};
KBankingPlugin::KBankingPlugin(QObject *parent, const QStringList&) :
@@ -122,10 +130,14 @@
{
m_kbanking = new KMyMoneyBanking(this, "KMyMoney");
+ d->passwordCacheTimer = new QTimer(this);
+ d->passwordCacheTimer->setSingleShot(true);
+ d->passwordCacheTimer->setInterval(60000);
+ connect(d->passwordCacheTimer, SIGNAL(timeout()), this, SLOT(slotClearPasswordCache()));
+
if (m_kbanking) {
- QBGui *gui;
+ QT4_Gui *gui;
-#if AQB_IS_VERSION(4,99,0,0)
if (AB_Banking_HasConf4(m_kbanking->getCInterface())) {
qDebug("KBankingPlugin: No AqB4 config found.");
if (AB_Banking_HasConf3(m_kbanking->getCInterface())) {
@@ -139,33 +151,20 @@
AB_Banking_ImportConf3(m_kbanking->getCInterface());
}
}
-#elif AQB_IS_VERSION(3,9,0,0)
- if (AB_Banking_HasConf4(m_kbanking->getCInterface(), 0)) {
- qDebug("KBankingPlugin: No AqB4 config found.");
- if (AB_Banking_HasConf3(m_kbanking->getCInterface(), 0)) {
- qDebug("KBankingPlugin: No AqB3 config found.");
- if (!AB_Banking_HasConf2(m_kbanking->getCInterface(), 0)) {
- qDebug("KBankingPlugin: AqB2 config found - converting.");
- AB_Banking_ImportConf2(m_kbanking->getCInterface(), 0);
- }
- } else {
- qDebug("KBankingPlugin: AqB3 config found - converting.");
- AB_Banking_ImportConf3(m_kbanking->getCInterface(), 0);
- }
- }
-#endif
- gui = new QBGui(m_kbanking);
+ gui = new QT4_Gui();
GWEN_Gui_SetGui(gui->getCInterface());
GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Info);
GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Debug);
- m_kbanking->setGui(gui);
if (m_kbanking->init() == 0) {
// Tell the host application to load my GUI component
setComponentData(KGenericFactory<KBankingPlugin>::componentData());
setXMLFile("kmm_kbanking.rc");
qDebug("KMyMoney kbanking plugin loaded");
+ // get certificate handling and dialog settings management
+ AB_Gui_Extend(gui->getCInterface(), m_kbanking->getCInterface());
+
// create view
createJobView();
@@ -281,6 +280,7 @@
QWidget* w = new KBJobView(m_kbanking, view, "JobView");
viewInterface()->addWidget(view, w);
connect(viewInterface(), SIGNAL(viewStateChanged(bool)), view, SLOT(setEnabled(bool)));
+ connect(this, SIGNAL(queueChanged()), w, SLOT(slotQueueUpdated()));
}
void KBankingPlugin::createActions(void)
@@ -298,15 +298,24 @@
void KBankingPlugin::slotSettings(void)
{
- QPointer<KBankingSettings> bs = new KBankingSettings(m_kbanking);
- if (bs->init())
- qWarning("Error on ini of settings dialog.");
- else {
- bs->exec();
- if (bs && bs->fini())
- qWarning("Error on fini of settings dialog.");
+ if (m_kbanking) {
+ GWEN_DIALOG *dlg;
+ int rv;
+
+ dlg = AB_SetupDialog_new(m_kbanking->getCInterface());
+ if (dlg == NULL) {
+ DBG_ERROR(0, "Could not create setup dialog.");
+ return;
+ }
+
+ rv = GWEN_Gui_ExecDialog(dlg, 0);
+ if (rv == 0) {
+ DBG_ERROR(0, "Aborted by user");
+ GWEN_Dialog_free(dlg);
+ return;
+ }
+ GWEN_Dialog_free(dlg);
}
- delete bs;
}
bool KBankingPlugin::mapAccount(const MyMoneyAccount& acc, MyMoneyKeyValueContainer& settings)
@@ -346,7 +355,7 @@
// at this point, the account should be mapped
// so we search it and setup the account reference in the KMyMoney object
AB_ACCOUNT* ab_acc;
- ab_acc = AB_BANKING_GETACCOUNTBYALIAS(m_kbanking->getCInterface(), acc.id().toUtf8().data());
+ ab_acc = AB_Banking_GetAccountByAlias(m_kbanking->getCInterface(), acc.id().toUtf8().data());
if (ab_acc) {
MyMoneyAccount a(acc);
setupAccountReference(a, ab_acc);
@@ -402,7 +411,7 @@
{
AB_ACCOUNT* ab_acc = 0;
if (m_kbanking)
- ab_acc = AB_BANKING_GETACCOUNTBYALIAS(m_kbanking->getCInterface(), acc.id().toUtf8().data());
+ ab_acc = AB_Banking_GetAccountByAlias(m_kbanking->getCInterface(), acc.id().toUtf8().data());
return ab_acc != 0;
}
@@ -427,7 +436,7 @@
QDate qd;
/* get AqBanking account */
- ba = AB_BANKING_GETACCOUNTBYALIAS(m_kbanking->getCInterface(), acc.id().toUtf8().data());
+ ba = AB_Banking_GetAccountByAlias(m_kbanking->getCInterface(), acc.id().toUtf8().data());
if (!ba) {
KMessageBox::error(0,
i18n("<qt>"
@@ -448,7 +457,7 @@
if (acc.onlineBankingSettings().value("kbanking-txn-download") != "no") {
/* create getTransactions job */
job = AB_JobGetTransactions_new(ba);
- rv = AB_BANKING_JOB_CHECKAVAILABILITY(job);
+ rv = AB_Job_CheckAvailability(job);
if (rv) {
DBG_ERROR(0, "Job \"GetTransactions\" is not available (%d)", rv);
KMessageBox::error(0,
@@ -540,7 +549,7 @@
/* create getBalance job */
job = AB_JobGetBalance_new(ba);
- rv = AB_BANKING_JOB_CHECKAVAILABILITY(job);
+ rv = AB_Job_CheckAvailability(job);
if (!rv)
rv = m_kbanking->enqueueJob(job);
else
@@ -559,6 +568,7 @@
// make sure, we have at least one job in the queue before we continue.
if (m_kbanking->getEnqueuedJobs().size() > 0) {
+ emit queueChanged();
// ask if the user want's to execute this job right away or spool it
// for later execution
@@ -607,9 +617,6 @@
DBG_ERROR(0, "Error: %d", rv);
}
AB_ImExporterContext_free(ctx);
-
- // let application emit signals to inform views
- m_kbanking->accountsUpdated();
}
rc = true;
}
@@ -617,7 +624,17 @@
return rc;
}
+void KBankingPlugin::startPasswordTimer(void)
+{
+ if (d->passwordCacheTimer->isActive())
+ d->passwordCacheTimer->stop();
+ d->passwordCacheTimer->start();
+}
+void KBankingPlugin::slotClearPasswordCache(void)
+{
+ m_kbanking->clearPasswordCache();
+}
void KBankingPlugin::slotImport(void)
{
@@ -644,13 +661,178 @@
KMyMoneyBanking::KMyMoneyBanking(KBankingPlugin* parent, const char* appname, const char* fname)
- : KBanking(appname, fname)
+ : AB_Banking(appname, fname)
, m_parent(parent)
+ , _jobQueue(0)
+{
+}
+
+int KMyMoneyBanking::init()
+{
+ int rv;
+
+ rv = AB_Banking::init();
+ if (rv < 0)
+ return rv;
+
+ rv = onlineInit();
+ if (rv) {
+ fprintf(stderr, "Error on online init (%d).\n", rv);
+ AB_Banking::fini();
+ return rv;
+ }
+
+ _jobQueue = AB_Job_List2_new();
+
+ return 0;
+}
+
+int KMyMoneyBanking::fini()
+{
+ int rv;
+
+ if (_jobQueue) {
+ AB_Job_List2_FreeAll(_jobQueue);
+ _jobQueue = 0;
+ }
+
+ rv = onlineFini();
+ if (rv) {
+ AB_Banking::fini();
+ return rv;
+ }
+ return AB_Banking::fini();
+}
+
+int KMyMoneyBanking::executeQueue(AB_IMEXPORTER_CONTEXT *ctx)
+{
+ int rv;
+ AB_JOB_LIST2 *oldQ;
+
+ m_parent->startPasswordTimer();
+
+ rv = AB_Banking::executeJobs(_jobQueue, ctx);
+ oldQ = _jobQueue;
+ _jobQueue = AB_Job_List2_new();
+ AB_Job_List2_FreeAll(oldQ);
+
+ emit m_parent->queueChanged();
+ m_parent->startPasswordTimer();
+
+ return rv;
+}
+
+void KMyMoneyBanking::clearPasswordCache(void)
+{
+ /* clear password DB */
+ GWEN_Gui_SetPasswordStatus(NULL, NULL, GWEN_Gui_PasswordStatus_Remove, 0);
+}
+
+std::list<AB_JOB*> KMyMoneyBanking::getEnqueuedJobs()
+{
+ AB_JOB_LIST2 *ll;
+ std::list<AB_JOB*> rl;
+
+ ll = _jobQueue;
+ if (ll && AB_Job_List2_GetSize(ll)) {
+ AB_JOB *j;
+ AB_JOB_LIST2_ITERATOR *it;
+
+ it = AB_Job_List2_First(ll);
+ assert(it);
+ j = AB_Job_List2Iterator_Data(it);
+ assert(j);
+ while (j) {
+ rl.push_back(j);
+ j = AB_Job_List2Iterator_Next(it);
+ }
+ AB_Job_List2Iterator_free(it);
+ }
+ return rl;
+}
+
+int KMyMoneyBanking::enqueueJob(AB_JOB *j)
{
+ assert(_jobQueue);
+ assert(j);
+ AB_Job_Attach(j);
+ AB_Job_List2_PushBack(_jobQueue, j);
+ return 0;
}
+int KMyMoneyBanking::dequeueJob(AB_JOB *j)
+{
+ assert(_jobQueue);
+ AB_Job_List2_Remove(_jobQueue, j);
+ AB_Job_free(j);
+ emit m_parent->queueChanged();
+ return 0;
+}
+
+bool KMyMoneyBanking::askMapAccount(const char *id,
+ const char *bankCode,
+ const char *accountId)
+{
+ KBMapAccount *w;
+
+ w = new KBMapAccount(this, bankCode, accountId);
+ if (w->exec() == QDialog::Accepted) {
+ AB_ACCOUNT *a;
+
+ a = w->getAccount();
+ assert(a);
+ DBG_NOTICE(0,
+ "Mapping application account \"%s\" to "
+ "online account \"%s/%s\"",
+ id,
+ AB_Account_GetBankCode(a),
+ AB_Account_GetAccountNumber(a));
+ setAccountAlias(a, id);
+ delete w;
+ return true;
+ }
+
+ delete w;
+ return false;
+}
+
+bool KMyMoneyBanking::interactiveImport()
+{
+ AB_IMEXPORTER_CONTEXT *ctx;
+ GWEN_DIALOG *dlg;
+ int rv;
+
+ ctx = AB_ImExporterContext_new();
+ dlg = AB_ImporterDialog_new(getCInterface(), ctx, NULL);
+ if (dlg == NULL) {
+ DBG_ERROR(0, "Could not create importer dialog.");
+ AB_ImExporterContext_free(ctx);
+ return false;
+ }
+
+ rv = GWEN_Gui_ExecDialog(dlg, 0);
+ if (rv == 0) {
+ DBG_ERROR(0, "Aborted by user");
+ GWEN_Dialog_free(dlg);
+ AB_ImExporterContext_free(ctx);
+ return false;
+ }
+
+ if (!importContext(ctx, 0)) {
+ DBG_ERROR(0, "Error on importContext");
+ GWEN_Dialog_free(dlg);
+ AB_ImExporterContext_free(ctx);
+ return false;
+ }
+
+ GWEN_Dialog_free(dlg);
+ AB_ImExporterContext_free(ctx);
+ return true;
+}
+
+
const AB_ACCOUNT_STATUS* KMyMoneyBanking::_getAccountStatus(AB_IMEXPORTER_ACCOUNTINFO *ai)
{
const AB_ACCOUNT_STATUS *ast;
@@ -719,7 +901,7 @@
while (se) {
p = GWEN_StringListEntry_Data(se);
assert(p);
- s = QString::fromUtf8(p);
+ s += QString::fromUtf8(p);
se = GWEN_StringListEntry_Next(se);
} // while
}
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/mymoneybanking.h kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/mymoneybanking.h
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/mymoneybanking.h 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/mymoneybanking.h 2011-01-15 11:56:31.996073240 +0100
@@ -1,6 +1,7 @@
/***************************************************************************
- * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
* Copyright 2004 Martin Preuss aquamaniac@users.sourceforge.net *
+ * Copyright 2009 Cristian Onet onet.cristian@gmail.com *
+ * Copyright 2010 Thomas Baumgart 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 *
@@ -25,6 +26,22 @@
#include <config-kmymoney.h>
#endif
+#include <aqbanking/version.h>
+#include <aqbanking/banking.h>
+#include "banking.hpp"
+
+#ifndef AQB_MAKE_VERSION
+#define AQB_MAKE_VERSION(a,b,c,d) (((a)<<24) | ((b)<<16) | (c<<8) | (d))
+#endif
+
+#ifndef AQBANKING_VERSION
+#define AQBANKING_VERSION AQB_MAKE_VERSION(AQBANKING_VERSION_MAJOR,AQBANKING_VERSION_MINOR,AQBANKING_VERSION_PATCHLEVEL,AQBANKING_VERSION_BUILD)
+#endif
+
+#ifndef AQB_IS_VERSION
+#define AQB_IS_VERSION(a,b,c,d) (AQBANKING_VERSION >= AQB_MAKE_VERSION(a,b,c,d))
+#endif
+
// ----------------------------------------------------------------------------
// QT Includes
@@ -39,7 +56,6 @@
// ----------------------------------------------------------------------------
// Project Includes
-#include "kbanking.h"
#include <kmymoney/kmymoneyplugin.h>
#include <kmymoney/mymoneyaccount.h>
#include <kmymoney/mymoneykeyvaluecontainer.h>
@@ -146,9 +162,18 @@
*/
bool updateAccount(const MyMoneyAccount& acc);
+ /**
+ * Trigger the password cache timer
+ */
+ void startPasswordTimer(void);
+
protected slots:
void slotSettings(void);
void slotImport(void);
+ void slotClearPasswordCache(void);
+
+signals:
+ void queueChanged(void);
private:
class Private;
@@ -162,27 +187,45 @@
};
/**
- * This class is the special implementation to glue the KBanking class
+ * This class is the special implementation to glue the AB_Banking class
* with the KMyMoneyPlugin structure.
*/
-class KMyMoneyBanking : public KBanking
+class KMyMoneyBanking : public AB_Banking
{
+ friend class KBankingPlugin;
public:
KMyMoneyBanking(KBankingPlugin* parent, const char* appname, const char* fname = 0);
virtual ~KMyMoneyBanking() {};
- bool importAccountInfo(AB_IMEXPORTER_ACCOUNTINFO *ai, uint32_t flags);
+ int executeQueue(AB_IMEXPORTER_CONTEXT *ctx);
+
+ int enqueueJob(AB_JOB *j);
+ int dequeueJob(AB_JOB *j);
+ std::list<AB_JOB*> getEnqueuedJobs();
+
+ bool askMapAccount(const char *id,
+ const char *bankCode,
+ const char *accountId);
+
+ virtual bool interactiveImport();
protected:
+ int init();
+ int fini();
+
+ bool importAccountInfo(AB_IMEXPORTER_ACCOUNTINFO *ai, uint32_t flags);
const AB_ACCOUNT_STATUS* _getAccountStatus(AB_IMEXPORTER_ACCOUNTINFO *ai);
void _xaToStatement(MyMoneyStatement &ks,
const MyMoneyAccount&,
const AB_TRANSACTION *t);
+ void clearPasswordCache(void);
private:
KBankingPlugin* m_parent;
QMap<QString, bool> m_hashMap;
+ AB_JOB_LIST2 *_jobQueue;
+
};
#endif
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/views/kbjobview.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/views/kbjobview.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/views/kbjobview.cpp 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/views/kbjobview.cpp 2011-01-15 11:56:31.998079514 +0100
@@ -38,14 +38,13 @@
#include <KIconLoader>
#include <KMessageBox>
-#include "kbanking.h"
#include <aqbanking/jobgetbalance.h>
#include <aqbanking/jobgettransactions.h>
#include <gwenhywfar/debug.h>
-KBJobView::KBJobView(KBanking *kb,
+KBJobView::KBJobView(KMyMoneyBanking *kb,
QWidget* parent,
const char* name,
Qt::WFlags fl) :
@@ -64,8 +63,6 @@
m_jobList = new KBJobListView(jobBox);
jobBoxLayout->addWidget(m_jobList);
- QObject::connect(m_app->flagStaff(), SIGNAL(signalQueueUpdated()),
- this, SLOT(slotQueueUpdated()));
QObject::connect(executeButton, SIGNAL(clicked()),
this, SLOT(slotExecute()));
QObject::connect(dequeueButton, SIGNAL(clicked()),
@@ -154,9 +151,6 @@
DBG_ERROR(0, "Error: %d", rv);
}
AB_ImExporterContext_free(ctx);
-
- // let App emit signals to inform account views
- m_app->accountsUpdated();
}
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/views/kbjobview.h kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/views/kbjobview.h
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/views/kbjobview.h 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/views/kbjobview.h 2011-01-15 11:56:31.997453173 +0100
@@ -32,14 +32,14 @@
#include "kbjoblist.h"
-#include "kbanking.h"
+#include "mymoneybanking.h"
class KBJobView: public QWidget, public Ui::KBJobViewUi
{
Q_OBJECT
public:
- explicit KBJobView(KBanking *kb,
+ explicit KBJobView(KMyMoneyBanking *kb,
QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
~KBJobView();
@@ -47,7 +47,7 @@
bool fini();
private:
- KBanking *m_app;
+ KMyMoneyBanking *m_app;
KBJobListView *m_jobList;
protected slots:
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/widgets/CMakeLists.txt kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/widgets/CMakeLists.txt
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/widgets/CMakeLists.txt 2010-12-23 10:21:40.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/widgets/CMakeLists.txt 2011-01-15 11:56:31.998079514 +0100
@@ -2,6 +2,7 @@
########### next target ###############
SET(kmm_kbanking_widgets_la_SOURCES
+ kbaccountlist.cpp
kbjoblist.cpp
)
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/widgets/kbaccountlist.cpp kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/widgets/kbaccountlist.cpp
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/widgets/kbaccountlist.cpp 1970-01-01 01:00:00.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/widgets/kbaccountlist.cpp 2011-01-15 11:56:31.998079514 +0100
@@ -0,0 +1,253 @@
+/***************************************************************************
+ begin : Mon Mar 01 2004
+ copyright : (C) 2004 by Martin Preuss
+ email : martin@libchipcard.de
+
+ ***************************************************************************
+ * Please see toplevel file COPYING for license details *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config-kmymoney.h>
+#endif
+
+
+#include "kbaccountlist.h"
+#include <assert.h>
+#include <QtCore/qstring.h>
+
+
+
+KBAccountListViewItem::KBAccountListViewItem(KBAccountListView *parent,
+ AB_ACCOUNT *acc)
+ : QTreeWidgetItem(parent)
+ , _account(acc)
+{
+ assert(acc);
+ _populate();
+}
+
+
+
+KBAccountListViewItem::KBAccountListViewItem(const KBAccountListViewItem &item)
+ : QTreeWidgetItem(item)
+ , _account(0)
+{
+
+ if (item._account) {
+ _account = item._account;
+ }
+}
+
+
+KBAccountListViewItem::KBAccountListViewItem(KBAccountListView *parent,
+ QTreeWidgetItem *after,
+ AB_ACCOUNT *acc)
+ : QTreeWidgetItem(parent, after)
+ , _account(acc)
+{
+ assert(acc);
+ _populate();
+}
+
+
+
+KBAccountListViewItem::~KBAccountListViewItem()
+{
+}
+
+
+
+AB_ACCOUNT *KBAccountListViewItem::getAccount()
+{
+ return _account;
+}
+
+
+void KBAccountListViewItem::_populate()
+{
+ QString tmp;
+ int i;
+
+ assert(_account);
+
+ i = 0;
+
+ // unique id
+ setText(i++, QString::number(AB_Account_GetUniqueId(_account)));
+
+ // bank code
+ setText(i++, QString::fromUtf8(AB_Account_GetBankCode(_account)));
+
+ // bank name
+ tmp = AB_Account_GetBankName(_account);
+ if (tmp.isEmpty())
+ tmp = "(unnamed)";
+ setText(i++, tmp);
+
+ // account id
+ setText(i++, QString::fromUtf8(AB_Account_GetAccountNumber(_account)));
+
+ // account name
+ tmp = QString::fromUtf8(AB_Account_GetAccountName(_account));
+ if (tmp.isEmpty())
+ tmp = "(unnamed)";
+ setText(i++, tmp);
+
+ tmp = QString::fromUtf8(AB_Account_GetOwnerName(_account));
+ if (tmp.isEmpty())
+ tmp = "";
+ setText(i++, tmp);
+
+ tmp = QString::fromUtf8(AB_Provider_GetName(AB_Account_GetProvider(_account)));
+ if (tmp.isEmpty())
+ tmp = "(unknown)";
+ setText(i++, tmp);
+
+}
+
+bool KBAccountListViewItem::operator< (const QTreeWidgetItem & other) const
+{
+ bool ok1, ok2;
+ int column = treeWidget() ? treeWidget()->sortColumn() : 0;
+ int a = text(column).toInt(&ok1);
+ int b = other.text(column).toInt(&ok2);
+ if (ok1 && ok2)
+ return a < b;
+ return QTreeWidgetItem::operator<(other);
+}
+
+
+QString KBAccountListViewItem::key(int column, bool) const
+{
+ QString result;
+
+ if (column == 0) {
+ ulong i;
+ bool ok;
+
+ // id
+ i = text(column).toULong(&ok);
+ if (ok) {
+ char numbuf[32];
+
+ snprintf(numbuf, sizeof(numbuf), "%012lu", i);
+ result = QString(numbuf);
+ } else
+ result = text(column);
+ } else
+ result = text(column);
+
+ return result;
+}
+
+
+
+
+
+
+
+
+
+KBAccountListView::KBAccountListView(QWidget *parent)
+ : QTreeWidget(parent)
+{
+ setAllColumnsShowFocus(true);
+ setColumnCount(7);
+ QStringList header;
+ header << QWidget::tr("Id");
+ header << QWidget::tr("Institute Code");
+ header << QWidget::tr("Institute Name");
+ header << QWidget::tr("Account Number");
+ header << QWidget::tr("Account Name");
+ header << QWidget::tr("Owner");
+ header << QWidget::tr("Backend");
+ setHeaderLabels(header);
+
+ setSortingEnabled(true);
+ sortItems(0, Qt::AscendingOrder);
+}
+
+
+
+KBAccountListView::~KBAccountListView()
+{
+}
+
+
+
+void KBAccountListView::addAccount(AB_ACCOUNT *acc)
+{
+ KBAccountListViewItem *entry;
+
+ entry = new KBAccountListViewItem(this, acc);
+}
+
+
+
+void KBAccountListView::addAccounts(const std::list<AB_ACCOUNT*> &accs)
+{
+ std::list<AB_ACCOUNT*>::const_iterator it;
+
+ for (it = accs.begin(); it != accs.end(); it++) {
+ KBAccountListViewItem *entry;
+
+ entry = new KBAccountListViewItem(this, *it);
+ } /* for */
+}
+
+
+
+AB_ACCOUNT *KBAccountListView::getCurrentAccount()
+{
+ KBAccountListViewItem *entry;
+
+ entry = dynamic_cast<KBAccountListViewItem*>(currentItem());
+ if (!entry) {
+ return 0;
+ }
+ return entry->getAccount();
+}
+
+
+
+std::list<AB_ACCOUNT*> KBAccountListView::getSelectedAccounts()
+{
+ std::list<AB_ACCOUNT*> accs;
+ KBAccountListViewItem *entry;
+
+ // Create an iterator and give the listview as argument
+ QTreeWidgetItemIterator it(this);
+ // iterate through all items of the listview
+ for (; *it; ++it) {
+ if ((*it)->isSelected()) {
+ entry = dynamic_cast<KBAccountListViewItem*>(*it);
+ if (entry)
+ accs.push_back(entry->getAccount());
+ }
+ } // for
+
+ return accs;
+}
+
+
+
+std::list<AB_ACCOUNT*> KBAccountListView::getSortedAccounts()
+{
+ std::list<AB_ACCOUNT*> accs;
+ KBAccountListViewItem *entry;
+
+ // Create an iterator and give the listview as argument
+ QTreeWidgetItemIterator it(this);
+ // iterate through all items of the listview
+ for (; *it; ++it) {
+ entry = dynamic_cast<KBAccountListViewItem*>(*it);
+ if (entry)
+ accs.push_back(entry->getAccount());
+ } // for
+
+ return accs;
+}
+
+
+
diff -U 3 -H -d -r -N -- kmymoney-4.5.2/kmymoney/plugins/kbanking/widgets/kbaccountlist.h kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/widgets/kbaccountlist.h
--- kmymoney-4.5.2/kmymoney/plugins/kbanking/widgets/kbaccountlist.h 1970-01-01 01:00:00.000000000 +0100
+++ kmymoney-4.5.2-kbanking5/kmymoney/plugins/kbanking/widgets/kbaccountlist.h 2011-01-15 11:56:31.998079514 +0100
@@ -0,0 +1,71 @@
+/***************************************************************************
+ begin : Mon Mar 01 2004
+ copyright : (C) 2004 by Martin Preuss
+ email : martin@libchipcard.de
+
+ ***************************************************************************
+ * Please see toplevel file COPYING for license details *
+ ***************************************************************************/
+
+#ifndef Q4BANKING_ACCOUNTLIST_H
+#define Q4BANKING_ACCOUNTLIST_H
+
+
+#include <QTreeWidget>
+
+#include <aqbanking/account.h>
+
+#include <list>
+
+class KBAccountListView;
+class KBAccountListViewItem;
+
+
+class KBAccountListViewItem: public QTreeWidgetItem
+{
+private:
+ AB_ACCOUNT *_account;
+
+ void _populate();
+ bool operator< (const QTreeWidgetItem & other) const; //!< correctly sort text columns, which contain numbers
+
+public:
+ KBAccountListViewItem(KBAccountListView *parent, AB_ACCOUNT *acc);
+ KBAccountListViewItem(KBAccountListView *parent,
+ QTreeWidgetItem *after,
+ AB_ACCOUNT *acc);
+ KBAccountListViewItem(const KBAccountListViewItem &item);
+
+ virtual ~KBAccountListViewItem();
+
+ AB_ACCOUNT *getAccount();
+
+ QString key(int column, bool ascending) const;
+};
+
+
+
+class KBAccountListView: public QTreeWidget
+{
+private:
+public:
+ KBAccountListView(QWidget *parent = 0);
+ virtual ~KBAccountListView();
+
+ void addAccount(AB_ACCOUNT *acc);
+ void addAccounts(const std::list<AB_ACCOUNT*> &accs);
+
+ AB_ACCOUNT *getCurrentAccount();
+ std::list<AB_ACCOUNT*> getSelectedAccounts();
+
+ std::list<AB_ACCOUNT*> getSortedAccounts();
+
+};
+
+
+
+
+#endif /* QBANKING_ACCOUNTLIST_H */
+
+
+