diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 22:38:03 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 22:38:03 +0000 |
commit | dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch) | |
tree | 99e72842fe687baea16376a147619b6048d7e441 /kmymoney2/widgets/kmymoneyaccounttreebudget.cpp | |
download | kmymoney-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/kmymoneyaccounttreebudget.cpp')
-rw-r--r-- | kmymoney2/widgets/kmymoneyaccounttreebudget.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/kmymoney2/widgets/kmymoneyaccounttreebudget.cpp b/kmymoney2/widgets/kmymoneyaccounttreebudget.cpp new file mode 100644 index 0000000..cd1da0b --- /dev/null +++ b/kmymoney2/widgets/kmymoneyaccounttreebudget.cpp @@ -0,0 +1,84 @@ +/*************************************************************************** + kmymoneyaccounttreebudget.cpp - description + ------------------- + begin : Tue Feb 21 2006 + copyright : (C) 2005 by Darren Gould + email : Darren Gould <darren_gould@gmx.de> +***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +// ---------------------------------------------------------------------------- +// Project Includes +#include <kmymoneyaccounttreebudget.h> + +KMyMoneyAccountTreeBudget::KMyMoneyAccountTreeBudget(QWidget* parent, const char* name) : + KMyMoneyAccountTreeBase::KMyMoneyAccountTreeBase(parent, name) +{ + showType(); + showValue(); +} + +void KMyMoneyAccountTreeBudget::slotSelectObject(const QListViewItem* i) +{ + emit selectObject(MyMoneyInstitution()); + emit selectObject(MyMoneyAccount()); + + const KMyMoneyAccountTreeBaseItem* item = dynamic_cast<const KMyMoneyAccountTreeBaseItem*>(i); + if(item) { + emit openObject(item->itemObject()); + } +} + +KMyMoneyAccountTreeBudgetItem::KMyMoneyAccountTreeBudgetItem(KListView *parent, const MyMoneyAccount& account, const MyMoneyBudget &budget, const MyMoneySecurity& security, const QString& name) : + KMyMoneyAccountTreeBaseItem(parent, account, security, name), + m_budget(budget) +{ + updateAccount(true); +} + +KMyMoneyAccountTreeBudgetItem::KMyMoneyAccountTreeBudgetItem(KMyMoneyAccountTreeBudgetItem *parent, const MyMoneyAccount& account, const MyMoneyBudget& budget, const QValueList<MyMoneyPrice>& price, const MyMoneySecurity& security) : + KMyMoneyAccountTreeBaseItem(parent, account, price, security), + m_budget(budget) +{ + updateAccount(true); +} + + +KMyMoneyAccountTreeBudgetItem::~KMyMoneyAccountTreeBudgetItem() +{ +} + +void KMyMoneyAccountTreeBudgetItem::setBudget(const MyMoneyBudget& budget) +{ + m_budget = budget; + updateAccount(); +} + +MyMoneyMoney KMyMoneyAccountTreeBudgetItem::balance() const +{ + MyMoneyMoney result = MyMoneyMoney(); + // find out if the account is budgeted + MyMoneyBudget::AccountGroup budgetAccount = m_budget.account( m_account.id() ); + if ( budgetAccount.id() == m_account.id() ) { + result = budgetAccount.balance(); + switch(budgetAccount.budgetLevel()) { + case MyMoneyBudget::AccountGroup::eMonthly: + result = result * 12; + break; + + default: + break; + } + } + return result; +} + +#include "kmymoneyaccounttreebudget.moc" |