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/widgets/selectedtransaction.h | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 kmymoney2/widgets/selectedtransaction.h (limited to 'kmymoney2/widgets/selectedtransaction.h') diff --git a/kmymoney2/widgets/selectedtransaction.h b/kmymoney2/widgets/selectedtransaction.h new file mode 100644 index 0000000..0b82020 --- /dev/null +++ b/kmymoney2/widgets/selectedtransaction.h @@ -0,0 +1,87 @@ +/*************************************************************************** + selectedtransaction.h - description + ------------------- + begin : Tue Jun 13 2006 + copyright : (C) 2000-2006 by Thomas Baumgart + email : Thomas Baumgart + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 SELECTEDTRANSACTION_H +#define SELECTEDTRANSACTION_H + +// ---------------------------------------------------------------------------- +// QT Includes + +// ---------------------------------------------------------------------------- +// KDE Includes + +// ---------------------------------------------------------------------------- +// Project Includes + +#include +#include +#include + +namespace KMyMoneyRegister { + +class SelectedTransaction +{ +public: + SelectedTransaction() {} + SelectedTransaction(const MyMoneyTransaction& t, const MyMoneySplit& s, const QString& scheduleId = QString()) : + m_transaction(t), m_split(s), m_scheduleId(scheduleId) {} + + MyMoneyTransaction& transaction(void) { return m_transaction; } + const MyMoneyTransaction& transaction(void) const { return m_transaction; } + MyMoneySplit& split(void) { return m_split; } + const MyMoneySplit& split(void) const { return m_split; } + + bool isScheduled(void) const { return !m_scheduleId.isEmpty(); } + const QString& scheduleId(void) const { return m_scheduleId; } + + /** + * checks the transaction for specific reasons which would + * speak against editing/modifying it. + * @retval 0 no sweat, user can modify + * @retval 1 at least one split has been reconciled already + * @retval 2 some transactions cannot be changed anymore - parts of them are frozen + * @retval 3 some transactions cannot be changed anymore - they touch closed accounts + */ + int warnLevel() const; + +private: + MyMoneyTransaction m_transaction; + MyMoneySplit m_split; + QString m_scheduleId; +}; + +class Register; + +class SelectedTransactions:public QValueList +{ +public: + SelectedTransactions() {} + SelectedTransactions(const Register* r); + + /** + * @return the highest warnLevel of all transactions in the list + */ + int warnLevel() const; + + bool canModify() const; + bool canDuplicate() const; +}; + +} // namespace + +#endif + -- cgit v1.2.1