blob: 4a6ad3cfbacf8d704e54dc24bf861a087bd1a90d (
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/***************************************************************************
kcategoriesview.h - description
-------------------
begin : Sun Jan 20 2002
copyright : (C) 2000-2002 by Michael Edwardes
(C) 2005 by Thomas Baumgart
email : mte@users.sourceforge.net
Javier Campos Morales <javi_c@users.sourceforge.net>
Felix Rodriguez <frodriguez@users.sourceforge.net>
John C <thetacoturtle@users.sourceforge.net>
Thomas Baumgart <ipwizard@users.sourceforge.net>
Kevin Tambascio <ktambascio@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 KCATEGORIESVIEW_H
#define KCATEGORIESVIEW_H
// ----------------------------------------------------------------------------
// QT Includes
// ----------------------------------------------------------------------------
// KDE Includes
// ----------------------------------------------------------------------------
// Project Includes
#include <kmymoney/mymoneyaccount.h>
#include <kmymoney/kmymoneyaccounttree.h>
#include <kmymoney/mymoneyutils.h>
class KListViewSearchLineWidget;
#include "kcategoriesviewdecl.h"
/**
* @brief This class contains the implementation of the categories view.
* @author Michael Edwardes, Thomas Baumgart
*
* While named "categories view", this view actually displays all accounts
* that are children of the global "Income" and "Expense" accounts. Even though
* categories are internally just accounts as well, the distinction between
* categories and accounts in the user interface is done for better
* usability and clarity.
*
* The main functionality in the categories view is actually implemented
* in the KMyMoneyAccountTree. Signals from user actions are connect to
* other signals/slots in KCategoriesView and relayed to KMyMoneyView.
* A typical example is the selectObject() signal that eventually results
* in enabling/disabling the user actions for the categories view.
*
* For the categories view three user actions are important (all created in
* kmymoney2.cpp): category_new, category_edit and category_delete. They are
* accessible from either the main menu or the context menu.
*/
class KCategoriesView : public KCategoriesViewDecl
{
Q_OBJECT
public:
KCategoriesView(QWidget *parent=0, const char *name=0);
virtual ~KCategoriesView();
public slots:
void slotLoadAccounts(void);
/**
* Override the base class behaviour to include all updates that
* happened in the meantime.
*/
void show(void);
/**
* Override the base class behaviour to restore the layout. Do not
* do this in show() because show() itself may change the layout
* in undesired ways.
*/
void polish(void);
protected:
void loadAccounts(void);
bool loadSubAccounts(KMyMoneyAccountTreeItem* parent, const QStringList& accountList);
protected slots:
void slotUpdateProfit(void);
void slotExpandCollapse(void);
private:
/**
* This method returns an icon according to the account type
* passed in the argument @p type.
*
* @param type account type as defined in MyMoneyAccount::accountTypeE
*/
const QPixmap accountImage(const MyMoneyAccount::accountTypeE type) const;
signals:
/**
* This signal serves as proxy for KMyMoneyAccountTree::selectObject()
*/
void selectObject(const MyMoneyObject&);
/**
* This signal serves as proxy for
* KMyMoneyAccountTree::openContextMenu(const MyMoneyObject&)
*/
void openContextMenu(const MyMoneyObject& obj);
/**
* This signal will be emitted when the left mouse button is double
* clicked (actually the KDE executed setting is used) on an account.
*/
void openObject(const MyMoneyObject& obj);
/**
* This signal is emitted, when the user selected to reparent the
* account @p acc to be a subordinate account of @p parent.
*
* @param acc const reference to account to be reparented
* @param parent const reference to new parent account
*/
void reparent(const MyMoneyAccount& acc, const MyMoneyAccount& parent);
private:
QMap<QString, MyMoneySecurity> m_securityMap;
QMap<QString, unsigned long> m_transactionCountMap;
KMyMoneyAccountTreeItem* m_incomeItem;
KMyMoneyAccountTreeItem* m_expenseItem;
/**
* Search widget for the list
*/
KListViewSearchLineWidget* m_searchWidget;
/// set if a view needs to be reloaded during show()
bool m_needReload;
};
#endif
|