KMyMoneyAccountTreeBaseItem Class Reference

#include <kmymoneyaccounttreebase.h>

Inheritance diagram for KMyMoneyAccountTreeBaseItem:

KListViewItem KMyMoneyAccountTreeBudgetItem KMyMoneyAccountTreeForecastItem KMyMoneyAccountTreeItem
Collaboration diagram for KMyMoneyAccountTreeBaseItem:

Collaboration graph
[legend]

List of all members.

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)
KMyMoneyAccountTreeBaselistView (void) const
KMyMoneyAccountTreeItemType entryType (void) const
const MyMoneyObjectitemObject (void) const
const MyMoneyMoneytotalValue (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< MyMoneyPricem_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


Member Enumeration Documentation

Enumerator:
Account 
Institution 


Constructor & Destructor Documentation

KMyMoneyAccountTreeBaseItem::KMyMoneyAccountTreeBaseItem ( KListView parent,
const MyMoneyInstitution institution 
)

Constructor to be used to construct an institution entry object.

Parameters:
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.).

Parameters:
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 = QValueListMyMoneyPrice >(),
const MyMoneySecurity security = MyMoneySecurity() 
)

Constructor to be used to construct an account entry object.

Parameters:
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 (  ) 


Member Function Documentation

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

Parameters:
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.

Return values:
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.

Return values:
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

Returns:
const reference to id of object

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.

Parameters:
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

Returns:
type of this 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.

Returns:
reference to the MyMoneyObject of this entry

const MyMoneyMoney& KMyMoneyAccountTreeBaseItem::totalValue ( void   )  const [inline]

This method returns the value of this account and all it's subordinate accounts.

Returns:
value of this account including all subordinate accounts

void KMyMoneyAccountTreeBaseItem::adjustTotalValue ( const MyMoneyMoney diff  ) 

This method adjusts the current total value by diff.

Parameters:
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.

Parameters:
item pointer to other KMyMoneyAccountTreeItem that should be checked for parent/grand-parenthood of this object
Return values:
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.

Parameters:
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.

Parameters:
account Account to get the balance for
Returns:
Balance of this account

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.

Returns:
value of the account held by this item

void KMyMoneyAccountTreeBaseItem::setName (  )  [private]

fills the name column with text and pixmap


Member Data Documentation


The documentation for this class was generated from the following file:

Generated on Wed Jan 26 13:07:51 2011 for KMyMoney by  doxygen 1.5.6