Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/dialogs/kmymoneysplittable.h
Context not available. | |||||
9 | John C <thetacoturtle@users.sourceforge.net> | 9 | John C <thetacoturtle@users.sourceforge.net> | ||
---|---|---|---|---|---|
10 | Thomas Baumgart <ipwizard@users.sourceforge.net> | 10 | Thomas Baumgart <ipwizard@users.sourceforge.net> | ||
11 | Kevin Tambascio <ktambascio@users.sourceforge.net> | 11 | Kevin Tambascio <ktambascio@users.sourceforge.net> | ||
12 | (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> | ||||
12 | ***************************************************************************/ | 13 | ***************************************************************************/ | ||
13 | 14 | | |||
14 | /*************************************************************************** | 15 | /*************************************************************************** | ||
Context not available. | |||||
27 | // QT Includes | 28 | // QT Includes | ||
28 | 29 | | |||
29 | #include <QTableWidget> | 30 | #include <QTableWidget> | ||
30 | #include <QPointer> | | |||
31 | #include <QList> | | |||
32 | 31 | | |||
33 | // ---------------------------------------------------------------------------- | 32 | // ---------------------------------------------------------------------------- | ||
34 | // KDE Includes | 33 | // KDE Includes | ||
35 | 34 | | |||
36 | class QMenu; | | |||
37 | class QPushButton; | | |||
38 | class QFrame; | | |||
39 | // ---------------------------------------------------------------------------- | 35 | // ---------------------------------------------------------------------------- | ||
40 | // Project Includes | 36 | // Project Includes | ||
41 | 37 | | |||
42 | #include "mymoneysplit.h" | | |||
43 | #include "mymoneytransaction.h" | | |||
44 | #include "mymoneyaccount.h" | | |||
45 | | ||||
46 | class KMyMoneyCategory; | 38 | class KMyMoneyCategory; | ||
47 | class kMyMoneyLineEdit; | 39 | class MyMoneyMoney; | ||
48 | class kMyMoneyEdit; | 40 | class MyMoneySplit; | ||
41 | class MyMoneyTransaction; | ||||
42 | class MyMoneyAccount; | ||||
43 | | ||||
44 | template <class Key, class Value> class QMap; | ||||
49 | 45 | | |||
50 | /** | 46 | /** | ||
51 | * @author Thomas Baumgart | 47 | * @author Thomas Baumgart | ||
52 | */ | 48 | */ | ||
53 | class kMyMoneySplitTable : public QTableWidget | 49 | class KMyMoneySplitTablePrivate; | ||
50 | class KMyMoneySplitTable : public QTableWidget | ||||
54 | { | 51 | { | ||
55 | Q_OBJECT | 52 | Q_OBJECT | ||
53 | Q_DISABLE_COPY(KMyMoneySplitTable) | ||||
56 | public: | 54 | public: | ||
57 | explicit kMyMoneySplitTable(QWidget *parent = 0); | 55 | explicit KMyMoneySplitTable(QWidget *parent = nullptr); | ||
58 | virtual ~kMyMoneySplitTable(); | 56 | ~KMyMoneySplitTable(); | ||
59 | 57 | | |||
60 | /** | 58 | /** | ||
61 | * This method is used to load the widget with the information about | 59 | * This method is used to load the widget with the information about | ||
Context not available. | |||||
71 | /** | 69 | /** | ||
72 | * This method is used to retrieve the transaction from the widget. | 70 | * This method is used to retrieve the transaction from the widget. | ||
73 | */ | 71 | */ | ||
74 | const MyMoneyTransaction& transaction() const { | 72 | MyMoneyTransaction transaction() const; | ||
75 | return m_transaction; | | |||
76 | } | | |||
77 | 73 | | |||
78 | /** | 74 | /** | ||
79 | * Returns a list of MyMoneySplit objects. It contains all but the one | 75 | * Returns a list of MyMoneySplit objects. It contains all but the one | ||
Context not available. | |||||
82 | * @param t reference to transaction | 78 | * @param t reference to transaction | ||
83 | * @return list of splits | 79 | * @return list of splits | ||
84 | */ | 80 | */ | ||
85 | const QList<MyMoneySplit> getSplits(const MyMoneyTransaction& t) const; | 81 | QList<MyMoneySplit> getSplits(const MyMoneyTransaction& t) const; | ||
86 | 82 | | |||
87 | void setup(const QMap<QString, MyMoneyMoney>& priceInfo, int precision); | 83 | void setup(const QMap<QString, MyMoneyMoney>& priceInfo, int precision); | ||
88 | 84 | | |||
89 | int currentRow() const; | 85 | int currentRow() const; | ||
90 | 86 | | |||
91 | protected: | 87 | protected: | ||
92 | void mousePressEvent(QMouseEvent* e); | 88 | void mousePressEvent(QMouseEvent* e) override; | ||
93 | void mouseReleaseEvent(QMouseEvent* e); | 89 | void mouseReleaseEvent(QMouseEvent* e) override; | ||
94 | void mouseDoubleClickEvent(QMouseEvent* e); | 90 | void mouseDoubleClickEvent(QMouseEvent* e) override; | ||
95 | bool eventFilter(QObject *o, QEvent *e); | 91 | bool eventFilter(QObject *o, QEvent *e) override; | ||
96 | 92 | | |||
97 | void resizeEvent(QResizeEvent*); | 93 | void resizeEvent(QResizeEvent*) override; | ||
98 | KMyMoneyCategory* createEditWidgets(bool setFocus); | 94 | KMyMoneyCategory* createEditWidgets(bool setFocus); | ||
99 | void destroyEditWidgets(); | 95 | void destroyEditWidgets(); | ||
100 | void destroyEditWidget(int r, int c); | 96 | void destroyEditWidget(int r, int c); | ||
Context not available. | |||||
108 | * @param next true if forward-tab, false if backward-tab was | 104 | * @param next true if forward-tab, false if backward-tab was | ||
109 | * pressed by the user | 105 | * pressed by the user | ||
110 | */ | 106 | */ | ||
111 | virtual bool focusNextPrevChild(bool next); | 107 | bool focusNextPrevChild(bool next) override; | ||
112 | void addToTabOrder(QWidget* w); | 108 | void addToTabOrder(QWidget* w); | ||
113 | 109 | | |||
114 | void updateTransactionTableSize(); | 110 | void updateTransactionTableSize(); | ||
Context not available. | |||||
145 | 141 | | |||
146 | protected slots: | 142 | protected slots: | ||
147 | /// move the focus to the selected @p row. | 143 | /// move the focus to the selected @p row. | ||
148 | void slotSetFocus(const QModelIndex& index, int button = Qt::LeftButton); | 144 | void slotSetFocus(const QModelIndex& index); | ||
145 | void slotSetFocus(const QModelIndex& index, int button); | ||||
149 | 146 | | |||
150 | /** | 147 | /** | ||
151 | * Calling this slot refills the widget with the data | 148 | * Calling this slot refills the widget with the data | ||
Context not available. | |||||
205 | void objectCreation(bool state); | 202 | void objectCreation(bool state); | ||
206 | 203 | | |||
207 | private: | 204 | private: | ||
208 | /// the currently selected row (will be printed as selected) | 205 | KMyMoneySplitTablePrivate * const d_ptr; | ||
209 | int m_currentRow; | 206 | Q_DECLARE_PRIVATE(KMyMoneySplitTable) | ||
210 | | ||||
211 | /// the number of rows filled with data | | |||
212 | int m_maxRows; | | |||
213 | | ||||
214 | MyMoneyTransaction m_transaction; | | |||
215 | MyMoneyAccount m_account; | | |||
216 | MyMoneySplit m_split; | | |||
217 | MyMoneySplit m_hiddenSplit; | | |||
218 | | ||||
219 | /** | | |||
220 | * This member keeps the precision for the values | | |||
221 | */ | | |||
222 | int m_precision; | | |||
223 | | ||||
224 | /** | | |||
225 | * This member keeps a pointer to the context menu | | |||
226 | */ | | |||
227 | QMenu* m_contextMenu; | | |||
228 | | ||||
229 | /// keeps the QAction of the delete entry in the context menu | | |||
230 | QAction* m_contextMenuDelete; | | |||
231 | | ||||
232 | /// keeps the QAction of the duplicate entry in the context menu | | |||
233 | QAction* m_contextMenuDuplicate; | | |||
234 | | ||||
235 | /** | | |||
236 | * This member contains a pointer to the input widget for the category. | | |||
237 | * The widget will be created and destroyed dynamically in createInputWidgets() | | |||
238 | * and destroyInputWidgets(). | | |||
239 | */ | | |||
240 | QPointer<KMyMoneyCategory> m_editCategory; | | |||
241 | | ||||
242 | /** | | |||
243 | * This member contains a pointer to the input widget for the memo. | | |||
244 | * The widget will be created and destroyed dynamically in createInputWidgets() | | |||
245 | * and destroyInputWidgets(). | | |||
246 | */ | | |||
247 | QPointer<kMyMoneyLineEdit> m_editMemo; | | |||
248 | | ||||
249 | /** | | |||
250 | * This member contains a pointer to the input widget for the amount. | | |||
251 | * The widget will be created and destroyed dynamically in createInputWidgets() | | |||
252 | * and destroyInputWidgets(). | | |||
253 | */ | | |||
254 | QPointer<kMyMoneyEdit> m_editAmount; | | |||
255 | | ||||
256 | /** | | |||
257 | * This member keeps the tab order for the above widgets | | |||
258 | */ | | |||
259 | QWidgetList m_tabOrderWidgets; | | |||
260 | | ||||
261 | QPointer<QFrame> m_registerButtonFrame; | | |||
262 | QPointer<QPushButton> m_registerEnterButton; | | |||
263 | QPointer<QPushButton> m_registerCancelButton; | | |||
264 | | ||||
265 | QMap<QString, MyMoneyMoney> m_priceInfo; | | |||
266 | }; | 207 | }; | ||
267 | 208 | | |||
268 | #endif | 209 | #endif | ||
Context not available. |