summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/kmymoneyaccounttree.h
blob: a4b741dbd2fb34ace92dd32bbe1f4f38c8df4743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/***************************************************************************
                         kmymoneyaccounttree.h  -  description
                            -------------------
   begin                : Sat Jan 1 2005
   copyright            : (C) 2005 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 KMYMONEYACCOUNTTREE_H
#define KMYMONEYACCOUNTTREE_H


#include <kmymoney/kmymoneyaccounttreebase.h>

class KMyMoneyAccountTreeItem;

class KMyMoneyAccountTree : public KMyMoneyAccountTreeBase
{
  Q_OBJECT
public:
  KMyMoneyAccountTree(QWidget* parent = 0, const char *name = 0);
  int taxReportColumn(void) const { return m_taxReportColumn; }
  int vatCategoryColumn(void) const { return m_vatCategoryColumn; }
private:
  int m_taxReportColumn;
  int m_vatCategoryColumn;
};

class KMyMoneyAccountTreeItem : public KMyMoneyAccountTreeBaseItem
{
public:
  /**
 * Constructor to be used to construct an institution entry
 * object.
 *
 * @param parent pointer to the KListView object this entry should be
 *               added to.
 * @param institution const reference to MyMoneyInstitution for which
 *               the KListView entry is constructed
   */
  KMyMoneyAccountTreeItem(KListView *parent, const MyMoneyInstitution& institution);

  /**
   * Constructor to be used to construct a standard account entry object (e.g. Asset,
   * Liability, etc.).
   *
   * @param parent pointer to the KListView object this entry should be
   *               added to.
   * @param account const reference to MyMoneyAccount for which
   *               the KListView entry is constructed
   * @param security const reference to the security used to show the value. Usually
   *                 one should pass MyMoneyFile::baseCurrency() here.
   * @param name name of the account to be used instead of the one stored with @p account
   *               If empty, the one stored with @p account will be used. Default: empty
   */
  KMyMoneyAccountTreeItem(KListView *parent, const MyMoneyAccount& account, const MyMoneySecurity& security = MyMoneySecurity(), const QString& name = QString());

  /**
   * Constructor to be used to construct an account entry
   * object.
   *
   * @param parent pointer to the parent KAccountListView object this entry should be
   *               added to.
   * @param account const reference to MyMoneyAccount for which
   *               the KListView entry is constructed
   * @param price price to be used to calculate value (defaults to 1)
   *              This is used for accounts denominated in foreign currencies or stocks
   * @param security const reference to the security used to show the value. Usually
   *                 one should pass MyMoneyFile::baseCurrency() here.
   */
  KMyMoneyAccountTreeItem(KMyMoneyAccountTreeBaseItem *parent, const MyMoneyAccount& account, const QValueList<MyMoneyPrice>& price = QValueList<MyMoneyPrice>(), const MyMoneySecurity& security = MyMoneySecurity());

  void setReconciliation(bool);


protected:
  /**
    * 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 son changes.
    * @param account Account to get the balance for
    * @return Balance of this account
    */
    MyMoneyMoney balance() const;

    bool m_reconcileFlag;

    /**
     * populates the columns. Derived classes should override this. The
     * name column is already filled and should not be changed.
     */
    void fillColumns();
};

#endif