#include <kmymoneyaccounttreebase.h>


Public Types | |
| enum | KMyMoneyAccountTreeItemType { Account, Institution } |
Public Member Functions | |
| KMyMoneyAccountTreeBaseItem (KListView *parent, const MyMoneyInstitution &institution) | |
| KMyMoneyAccountTreeBaseItem (KListView *parent, const MyMoneyAccount &account, const MyMoneySecurity &security=MyMoneySecurity(), const QString &name=QString()) | |
| KMyMoneyAccountTreeBaseItem (KMyMoneyAccountTreeBaseItem *parent, const MyMoneyAccount &account, const QValueList< MyMoneyPrice > &price=QValueList< MyMoneyPrice >(), const MyMoneySecurity &security=MyMoneySecurity()) | |
| ~KMyMoneyAccountTreeBaseItem () | |
| virtual void | fillColumns () |
| void | updateAccount (bool forceTotalUpdate=false) |
| bool | isAccount (void) const |
| bool | isInstitution (void) const |
| const QString & | id (void) const |
| int | compare (QListViewItem *i, int col, bool ascending) const |
| virtual void | setOpen (bool o) |
| void | paintCell (QPainter *p, const QColorGroup &cg, int column, int width, int align) |
| KMyMoneyAccountTreeBase * | listView (void) const |
| KMyMoneyAccountTreeItemType | entryType (void) const |
| const MyMoneyObject & | itemObject (void) const |
| const MyMoneyMoney & | totalValue (void) const |
| void | adjustTotalValue (const MyMoneyMoney &diff) |
| bool | isChildOf (const QListViewItem *const item) const |
| void | setNegative (bool isNegative) |
| void | setText (int column, const QString &text, const bool &negative=false) |
Protected Member Functions | |
| virtual MyMoneyMoney | balance () const =0 |
| MyMoneyMoney | value () const |
Protected Attributes | |
| MyMoneyMoney | m_value |
| QValueList< MyMoneyPrice > | m_price |
| MyMoneySecurity | m_security |
| MyMoneyMoney | m_totalValue |
| MyMoneyAccount | m_account |
| QMap< int, QColor > | m_columnsColor |
| bool | m_negative |
Private Member Functions | |
| void | setName () |
Private Attributes | |
| MyMoneyInstitution | m_institution |
| KMyMoneyAccountTreeItemType | m_type |
| KMyMoneyAccountTreeBaseItem::KMyMoneyAccountTreeBaseItem | ( | KListView * | parent, | |
| const MyMoneyInstitution & | institution | |||
| ) |
Constructor to be used to construct an institution entry object.
| parent | pointer to the KListView object this entry should be added to. | |
| institution | const reference to MyMoneyInstitution for which the KListView entry is constructed |
| KMyMoneyAccountTreeBaseItem::KMyMoneyAccountTreeBaseItem | ( | KListView * | parent, | |
| const MyMoneyAccount & | account, | |||
| const MyMoneySecurity & | security = MyMoneySecurity(), |
|||
| const QString & | name = QString() | |||
| ) |
Constructor to be used to construct a standard account entry object (e.g. Asset, Liability, etc.).
| parent | pointer to the KListView object this entry should be added to. | |
| account | const reference to MyMoneyAccount for which the KListView entry is constructed | |
| security | const reference to the security used to show the value. Usually one should pass MyMoneyFile::baseCurrency() here. | |
| name | name of the account to be used instead of the one stored with account If empty, the one stored with account will be used. Default: empty |
| KMyMoneyAccountTreeBaseItem::KMyMoneyAccountTreeBaseItem | ( | KMyMoneyAccountTreeBaseItem * | parent, | |
| const MyMoneyAccount & | account, | |||
| const QValueList< MyMoneyPrice > & | price = QValueList< MyMoneyPrice >(), |
|||
| const MyMoneySecurity & | security = MyMoneySecurity() | |||
| ) |
Constructor to be used to construct an account entry object.
| parent | pointer to the parent KAccountListView object this entry should be added to. | |
| account | const reference to MyMoneyAccount for which the KListView entry is constructed | |
| price | price to be used to calculate value (defaults to 1) This is used for accounts denominated in foreign currencies or stocks | |
| security | const reference to the security used to show the value. Usually one should pass MyMoneyFile::baseCurrency() here. |
| KMyMoneyAccountTreeBaseItem::~KMyMoneyAccountTreeBaseItem | ( | ) |
| virtual void KMyMoneyAccountTreeBaseItem::fillColumns | ( | ) | [virtual] |
populates the columns. Derived classes should override this. The name column is already filled and should not be changed.
Reimplemented in KMyMoneyAccountTreeItem.
| void KMyMoneyAccountTreeBaseItem::updateAccount | ( | bool | forceTotalUpdate = false |
) |
This method loads new information into the item and updates the fields
| forceTotalUpdate | set to true to force update of total values (used in constructor, should not be necessary to be set by application code) |
| bool KMyMoneyAccountTreeBaseItem::isAccount | ( | void | ) | const [inline] |
This method checks, if the item contains an account or not.
| true | item holds an account | |
| false | item does not hold an account |
| bool KMyMoneyAccountTreeBaseItem::isInstitution | ( | void | ) | const [inline] |
This method checks, if the item contains an institution or not.
| true | item holds an institution | |
| false | item does not hold an institution |
| const QString& KMyMoneyAccountTreeBaseItem::id | ( | void | ) | const |
This method returns the id of the object held by this item
| int KMyMoneyAccountTreeBaseItem::compare | ( | QListViewItem * | i, | |
| int | col, | |||
| bool | ascending | |||
| ) | const |
Helper method to show the right order
| virtual void KMyMoneyAccountTreeBaseItem::setOpen | ( | bool | o | ) | [virtual] |
If o is TRUE all child items are shown initially. The user can hide them by clicking the - icon to the left of the item. If o is FALSE, the children of this item are initially hidden. The user can show them by clicking the + icon to the left of the item.
Overrides KListViewItem::setOpen() and exchanges the value field with either the value of this account and its subaccounts if o is false or the value of this account if o is true.
| o | show item open (true) or closed (false) |
Reimplemented in KMyMoneyAccountTreeForecastItem.
| void KMyMoneyAccountTreeBaseItem::paintCell | ( | QPainter * | p, | |
| const QColorGroup & | cg, | |||
| int | column, | |||
| int | width, | |||
| int | align | |||
| ) |
This method is re-implemented from QListViewItem::paintCell(). Besides the standard implementation, the QPainter is set according to the applications settings.
| KMyMoneyAccountTreeBase* KMyMoneyAccountTreeBaseItem::listView | ( | void | ) | const [inline] |
Convenience method to return casted pointer
| KMyMoneyAccountTreeItemType KMyMoneyAccountTreeBaseItem::entryType | ( | void | ) | const [inline] |
Return the type of entry
| const MyMoneyObject& KMyMoneyAccountTreeBaseItem::itemObject | ( | void | ) | const |
This method returns a const reference to this item (either the m_account or m_institution) depending on m_type.
| const MyMoneyMoney& KMyMoneyAccountTreeBaseItem::totalValue | ( | void | ) | const [inline] |
This method returns the value of this account and all it's subordinate accounts.
| void KMyMoneyAccountTreeBaseItem::adjustTotalValue | ( | const MyMoneyMoney & | diff | ) |
This method adjusts the current total value by diff.
| diff | difference to be added to the current value to get the new value |
| bool KMyMoneyAccountTreeBaseItem::isChildOf | ( | const QListViewItem *const | item | ) | const |
Checks whether this object is a child of the one passed by item.
| item | pointer to other KMyMoneyAccountTreeItem that should be checked for parent/grand-parenthood of this object |
| true | this object is a decendant of item | |
| false | this object is no decendant of item |
| void KMyMoneyAccountTreeBaseItem::setNegative | ( | bool | isNegative | ) |
Sets the whole item to be shown with negative colors
| void KMyMoneyAccountTreeBaseItem::setText | ( | int | column, | |
| const QString & | text, | |||
| const bool & | negative = false | |||
| ) |
Sets the text of a given column.
| negative | indicates whether it should be shown as negative number or not |
| virtual MyMoneyMoney KMyMoneyAccountTreeBaseItem::balance | ( | ) | const [protected, pure virtual] |
Returns the current balance of this account.
This is a pure virtual function, to allow subclasses to calculate the balance in different ways.
Parent items in the tree will only be recomputed if the balance() for a child changes.
| account | Account to get the balance for |
Implemented in KMyMoneyAccountTreeItem, KMyMoneyAccountTreeBudgetItem, and KMyMoneyAccountTreeForecastItem.
| MyMoneyMoney KMyMoneyAccountTreeBaseItem::value | ( | ) | const [protected] |
Computes and returns the current value of the account held by this item. This is the same as balance() but in the currency of the view. if value() changed since the item has been displayed, updateAccount() will notify the parent.
| void KMyMoneyAccountTreeBaseItem::setName | ( | ) | [private] |
fills the name column with text and pixmap
MyMoneyMoney KMyMoneyAccountTreeBaseItem::m_value [protected] |
QValueList<MyMoneyPrice> KMyMoneyAccountTreeBaseItem::m_price [protected] |
MyMoneyAccount KMyMoneyAccountTreeBaseItem::m_account [protected] |
QMap<int, QColor> KMyMoneyAccountTreeBaseItem::m_columnsColor [protected] |
bool KMyMoneyAccountTreeBaseItem::m_negative [protected] |
1.5.6