summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/selectedtransaction.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
commitdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch)
tree99e72842fe687baea16376a147619b6048d7e441 /kmymoney2/widgets/selectedtransaction.h
downloadkmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.tar.gz
kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.zip
Added kmymoney
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/widgets/selectedtransaction.h')
-rw-r--r--kmymoney2/widgets/selectedtransaction.h87
1 files changed, 87 insertions, 0 deletions
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 <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 SELECTEDTRANSACTION_H
+#define SELECTEDTRANSACTION_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneytransaction.h>
+#include <kmymoney/mymoneyscheduled.h>
+#include <kmymoney/mymoneysplit.h>
+
+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<SelectedTransaction>
+{
+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
+