From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmymoney2/converter/mymoneytemplate.h | 94 +++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 kmymoney2/converter/mymoneytemplate.h (limited to 'kmymoney2/converter/mymoneytemplate.h') diff --git a/kmymoney2/converter/mymoneytemplate.h b/kmymoney2/converter/mymoneytemplate.h new file mode 100644 index 0000000..5c96b1f --- /dev/null +++ b/kmymoney2/converter/mymoneytemplate.h @@ -0,0 +1,94 @@ +/*************************************************************************** + mymoneytemplate.h - description + ------------------- + begin : Sat Aug 14 2004 + copyright : (C) 2004 by 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 MYMONEYTEMPLATE_H +#define MYMONEYTEMPLATE_H + +// ---------------------------------------------------------------------------- +// QT Includes + +#include +class QFile; +class QListViewItem; + +// ---------------------------------------------------------------------------- +// KDE Includes + +#include + +// ---------------------------------------------------------------------------- +// Project Includes + +#include +#include + +/** + * @author Thomas Baumgart + */ + +/** + * This class represents an account template handler. It is capable + * to read an XML formatted account template file and import it into + * the current engine. Also, it can save the current account structure + * of the engine to an XML formatted template file. + */ +class MyMoneyTemplate +{ +public: + MyMoneyTemplate(); + MyMoneyTemplate(const KURL& url); + ~MyMoneyTemplate(); + + bool loadTemplate(const KURL& url); + bool saveTemplate(const KURL& url); + bool importTemplate(void(*callback)(int, int, const QString&)); + bool exportTemplate(void(*callback)(int, int, const QString&)); + + const QString& title(void) const { return m_title; } + const QString& shortDescription(void) const { return m_shortDesc; } + const QString& longDescription(void) const { return m_longDesc; } + + void hierarchy(QMap& list); + +protected: + bool loadDescription(void); + bool createAccounts(MyMoneyAccount& parent, QDomNode account); + bool setFlags(MyMoneyAccount& acc, QDomNode flags); + bool saveToLocalFile(QFile* qfile); + bool addAccountStructure(QDomElement& parent, const MyMoneyAccount& acc); + bool hierarchy(QMap& list, const QString& parent, QDomNode account); + + /** + * 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& = ""); + +private: + QDomDocument m_doc; + QDomNode m_accounts; + QString m_title; + QString m_shortDesc; + QString m_longDesc; + KURL m_source; + void (*m_progressCallback)(int, int, const QString&); + int m_accountsRead; +}; + +#endif -- cgit v1.2.1