FreeDebks  1.0.3
 All Classes Files Functions Variables Friends Pages
FdCommandsCoa.hpp
Go to the documentation of this file.
1 // --------------------------------------------------------------------
2 // Copyright © 2011-2013 Mathieu Schopfer
3 //
4 // This file is part of FreeDebks.
5 //
6 // FreeDebks is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // FreeDebks is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with FreeDebks. If not, see <http://www.gnu.org/licenses/>.
18 // --------------------------------------------------------------------
19 
20 #ifndef FDCOACOMMANDS_HPP
21 #define FDCOACOMMANDS_HPP
22 
23 #include <QUndoCommand>
24 
25 #include "dataDefinitions.hpp"
26 
27 class FdCoaAddItem;
28 class FdCoaDragDrop;
29 class FdCoaSetData;
30 class FdCoaRemove;
31 
33 
40 class FdCoaAddItem : public QUndoCommand
41 {
42 private:
44  FdItemCoa_p mParent;
45  FdItemCoa_p mItem;
46  int mRow;
47  double mWasAccount;
48 
49 public:
50  FdCoaAddItem(FdModelCoa* coa, FdItemCoa_p parent, FdItemCoa_p item, int row);
51  void redo();
52  void undo();
53 };
54 
56 
61 class FdCoaDragDrop : public QUndoCommand
62 {
63 public:
64  FdCoaDragDrop(FdModelCoa* coa, QList<FdItemCoa_p> items, FdItemCoa_p newParent, int row);
65  void redo();
66  void undo();
67 private:
69  QList<FdItemCoa_p> mItems;
71  FdItemCoa_p mNewParent;
72  int mRow;
73  double mWasAccount;
74 };
75 
77 
80 class FdCoaSetData : public QUndoCommand
81 {
82 public:
83  FdCoaSetData(FdModelCoa* coa, FdItemCoa_p item, CoaColumn column, QVariant newValue);
84  void redo();
85  void undo();
86 private:
88  FdItemCoa_p mItem;
89  CoaColumn mColumn;
90  QVariant mOldValue;
91  QVariant mNewValue;
92 };
93 
97 struct locationCoa {
98  FdItemCoa_p item;
99  FdItemCoa_p parent;
100  int row;
101 };
102 
104 
109 class FdCoaRemove : public QUndoCommand
110 {
111 public:
112  FdCoaRemove(FdModelCoa* coa, QList<FdItemCoa_p> selected);
113  void redo();
114  void undo();
115 private:
116  FdModelCoa* mCoa;
117  QList<locationCoa> mMap;
118 };
119 
120 #endif // FDCOACOMMANDS_HPP