Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/dialogs/investtransactioneditor.h
Context not available. | |||||
4 | begin : Fri Dec 15 2006 | 4 | begin : Fri Dec 15 2006 | ||
---|---|---|---|---|---|
5 | copyright : (C) 2006 by Thomas Baumgart | 5 | copyright : (C) 2006 by Thomas Baumgart | ||
6 | email : Thomas Baumgart <ipwizard@users.sourceforge.net> | 6 | email : Thomas Baumgart <ipwizard@users.sourceforge.net> | ||
7 | (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> | ||||
7 | ***************************************************************************/ | 8 | ***************************************************************************/ | ||
8 | 9 | | |||
9 | /*************************************************************************** | 10 | /*************************************************************************** | ||
Context not available. | |||||
21 | // ---------------------------------------------------------------------------- | 22 | // ---------------------------------------------------------------------------- | ||
22 | // QT Includes | 23 | // QT Includes | ||
23 | 24 | | |||
24 | #include <QList> | | |||
25 | | ||||
26 | // ---------------------------------------------------------------------------- | 25 | // ---------------------------------------------------------------------------- | ||
27 | // KDE Includes | 26 | // KDE Includes | ||
28 | 27 | | |||
29 | | ||||
30 | // ---------------------------------------------------------------------------- | 28 | // ---------------------------------------------------------------------------- | ||
31 | // Project Includes | 29 | // Project Includes | ||
32 | 30 | | |||
33 | #include "transactioneditor.h" | 31 | #include "transactioneditor.h" | ||
34 | 32 | | |||
33 | class MyMoneyMoney; | ||||
34 | class MyMoneySecurity; | ||||
35 | | ||||
36 | namespace eDialogs { enum class PriceMode; } | ||||
37 | | ||||
38 | namespace KMyMoneyRegister { class InvestTransaction; } | ||||
39 | | ||||
40 | namespace eMyMoney { namespace Split { | ||||
41 | enum class InvestmentTransactionType; } } | ||||
42 | | ||||
43 | class InvestTransactionEditorPrivate; | ||||
35 | class InvestTransactionEditor : public TransactionEditor | 44 | class InvestTransactionEditor : public TransactionEditor | ||
36 | { | 45 | { | ||
37 | friend class InvestTransactionEditorPrivate; | | |||
38 | | ||||
39 | Q_OBJECT | 46 | Q_OBJECT | ||
47 | Q_DISABLE_COPY(InvestTransactionEditor) | ||||
40 | 48 | | |||
41 | public: | 49 | public: | ||
42 | typedef enum { | | |||
43 | Price = 0, | | |||
44 | PricePerShare, | | |||
45 | PricePerTransaction | | |||
46 | } priceModeE; | | |||
47 | | ||||
48 | InvestTransactionEditor(); | 50 | InvestTransactionEditor(); | ||
49 | InvestTransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::InvestTransaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate); | 51 | explicit InvestTransactionEditor(TransactionEditorContainer* regForm, | ||
50 | virtual ~InvestTransactionEditor(); | 52 | KMyMoneyRegister::InvestTransaction* item, | ||
53 | const KMyMoneyRegister::SelectedTransactions& list, | ||||
54 | const QDate& lastPostDate); | ||||
55 | ~InvestTransactionEditor() override; | ||||
51 | 56 | | |||
52 | /** | 57 | /** | ||
53 | * This method returns information about the completeness of the data | 58 | * This method returns information about the completeness of the data | ||
Context not available. | |||||
64 | * | 69 | * | ||
65 | * @sa transactionDataSufficient() | 70 | * @sa transactionDataSufficient() | ||
66 | */ | 71 | */ | ||
67 | virtual bool isComplete(QString& reason) const; | 72 | bool isComplete(QString& reason) const override; | ||
68 | 73 | | |||
69 | virtual QWidget* firstWidget() const; | 74 | QWidget* firstWidget() const override; | ||
70 | 75 | | |||
71 | virtual bool fixTransactionCommodity(const MyMoneyAccount& /* account */) { | 76 | bool fixTransactionCommodity(const MyMoneyAccount& /* account */) override; | ||
72 | return true; | | |||
73 | } | | |||
74 | 77 | | |||
75 | void totalAmount(MyMoneyMoney& amount) const; | 78 | void totalAmount(MyMoneyMoney& amount) const; | ||
76 | 79 | | |||
Context not available. | |||||
95 | * | 98 | * | ||
96 | * @note Usually not used directly. If unsure, use enterTransactions() instead. | 99 | * @note Usually not used directly. If unsure, use enterTransactions() instead. | ||
97 | */ | 100 | */ | ||
98 | bool createTransaction(MyMoneyTransaction& t, const MyMoneyTransaction& torig, const MyMoneySplit& sorig, bool skipPriceDialog = false); | 101 | bool createTransaction(MyMoneyTransaction& t, | ||
99 | 102 | const MyMoneyTransaction& torig, | |||
100 | priceModeE priceMode() const; | 103 | const MyMoneySplit& sorig, | ||
104 | bool skipPriceDialog = false) override; | ||||
101 | 105 | | |||
102 | const MyMoneySecurity& security() const { | 106 | eDialogs::PriceMode priceMode() const; | ||
103 | return m_security; | | |||
104 | } | | |||
105 | 107 | | |||
106 | const QList<MyMoneySplit>& feeSplits() const { | 108 | MyMoneySecurity security() const; | ||
107 | return m_feeSplits; | | |||
108 | } | | |||
109 | 109 | | |||
110 | const QList<MyMoneySplit>& interestSplits() const { | 110 | QList<MyMoneySplit> feeSplits() const; | ||
111 | return m_interestSplits; | 111 | QList<MyMoneySplit> interestSplits() const; | ||
112 | } | | |||
113 | 112 | | |||
114 | protected slots: | 113 | protected slots: | ||
115 | void slotCreateSecurity(const QString& name, QString& id); | 114 | void slotCreateSecurity(const QString& name, QString& id); | ||
Context not available. | |||||
135 | * This method creates all necessary widgets for this transaction editor. | 134 | * This method creates all necessary widgets for this transaction editor. | ||
136 | * All signals will be connected to the relevant slots. | 135 | * All signals will be connected to the relevant slots. | ||
137 | */ | 136 | */ | ||
138 | void createEditWidgets(); | 137 | void createEditWidgets() override; | ||
139 | 138 | | |||
140 | /** | 139 | /** | ||
141 | * This method (re-)loads the widgets with the transaction information | 140 | * This method (re-)loads the widgets with the transaction information | ||
Context not available. | |||||
144 | * @param action preset the edit wigdets for @a action if no transaction | 143 | * @param action preset the edit wigdets for @a action if no transaction | ||
145 | * is present | 144 | * is present | ||
146 | */ | 145 | */ | ||
147 | void loadEditWidgets(KMyMoneyRegister::Action action = KMyMoneyRegister::ActionNone); | 146 | void loadEditWidgets(KMyMoneyRegister::Action action) override; | ||
148 | 147 | void loadEditWidgets() override; | |||
149 | void activityFactory(eMyMoney::Split::InvestmentTransactionType type); | | |||
150 | | ||||
151 | MyMoneyMoney subtotal(const QList<MyMoneySplit>& splits) const; | | |||
152 | 148 | | |||
153 | /** | 149 | void setupFinalWidgets() override; | ||
154 | * This method creates a transaction to be used for the split fee/interest editor. | | |||
155 | * It has a reference to a phony account and the splits contained in @a splits . | | |||
156 | */ | | |||
157 | bool createPseudoTransaction(MyMoneyTransaction& t, const QList<MyMoneySplit>& splits); | | |||
158 | | ||||
159 | /** | | |||
160 | * Convenience method used by slotEditInterestSplits() and slotEditFeeSplits(). | | |||
161 | * | | |||
162 | * @param categoryWidgetName name of the category widget | | |||
163 | * @param amountWidgetName name of the amount widget | | |||
164 | * @param splits the splits that make up the transaction to be edited | | |||
165 | * @param isIncome @c false for fees, @c true for interest | | |||
166 | * @param slotEditSplits name of the slot to be connected to the focusIn signal of the | | |||
167 | * category widget named @p categoryWidgetName in case of multiple splits | | |||
168 | * in @p splits . | | |||
169 | */ | | |||
170 | int editSplits(const QString& categoryWidgetName, const QString& amountWidgetName, QList<MyMoneySplit>& splits, bool isIncome, const char* slotEditSplits); | | |||
171 | | ||||
172 | void updatePriceMode(const MyMoneySplit& split = MyMoneySplit()); | | |||
173 | | ||||
174 | void setupFinalWidgets(); | | |||
175 | 150 | | |||
176 | private: | 151 | private: | ||
177 | MyMoneySplit m_assetAccountSplit; | 152 | Q_DECLARE_PRIVATE(InvestTransactionEditor) | ||
178 | QList<MyMoneySplit> m_interestSplits; | | |||
179 | QList<MyMoneySplit> m_feeSplits; | | |||
180 | MyMoneySecurity m_security; | | |||
181 | MyMoneySecurity m_currency; | | |||
182 | eMyMoney::Split::InvestmentTransactionType m_transactionType; | | |||
183 | /// \internal d-pointer class. | | |||
184 | class Private; | | |||
185 | /// \internal d-pointer instance. | | |||
186 | Private* const d; | | |||
187 | }; | 153 | }; | ||
188 | 154 | | |||
189 | #endif // INVESTTRANSACTIONEDITOR_H | 155 | #endif // INVESTTRANSACTIONEDITOR_H | ||
Context not available. |