20 #include "FdCommandsCoa.hpp"
21 #include "FdModelCoa.hpp"
22 #include "FdItemCoa.hpp"
25 QUndoCommand(), mCoa(coa), mParent(parent), mItem(item), mRow(row)
28 setText(QObject::tr(
"add item",
"Add a new item to the chart of accounts, ie a new row."));
33 if(
mParent->type() == AccountType)
50 QUndoCommand(), mCoa(coa), mItems(items), mNewParent(newParent), mRow(row)
54 int count = mItems.size();
57 if(items[0]->type() == CategoryType)
58 text = QObject::tr(
"move category %1",
"Move an item in a drag and drop action. %1 is the item label").arg(items[0]->displayLabel());
60 text = QObject::tr(
"move account %1",
"Move an item in a drag and drop action. %1 is the item label").arg(items[0]->displayLabel());
63 text = QObject::tr(
"move %n item(s)",
"Move items in a drag and drop action.", count);
69 for(
int i = 0; i < mItems.size(); ++i)
71 FdItemCoa_p oldParent = mItems[i]->parent();
72 if(oldParent == mNewParent && row == newParent->childrenCount())
87 for(
int i = 0; i <
mItems.size(); ++i)
98 QUndoCommand(), mCoa(coa), mItem(item), mColumn(column), mNewValue(newValue)
100 mOldValue = mCoa->data(mItem, mColumn);
104 setText(QObject::tr(
"change id of %1",
"Will appear like this : Undo/Redo change id of ITEMLABEL.").arg(mItem->displayLabel()));
107 setText(QObject::tr(
"change label of %1",
"Will appear like this : Undo/Redo change label of ITEMLABEL.").arg(mItem->displayLabel()));
109 case CoaBalanceSheet:
110 setText(QObject::tr(
"change state (is on balance sheet) of %1",
"Will appear like this : Undo/Redo change state (is on balance sheet) of ITEMLABEL.").arg(mItem->displayLabel()));
113 setText(QObject::tr(
"change account signs %1",
"Will appear like this : Undo/Redo change signs of ITEMLABEL.").arg(mItem->displayLabel()));
116 setText(QObject::tr(
"change initial balance %1",
"Will appear like this : Undo/Redo change initial balance of ITEMLABEL.").arg(mItem->displayLabel()));
133 QUndoCommand(), mCoa(coa)
136 int count = selected.size();
139 if(selected[0]->type() == CategoryType)
140 text = QObject::tr(
"remove category %1",
"Will appear like this : Undo/Redo remove category ITEMLABEL.").arg(selected[0]->displayLabel());
142 text = QObject::tr(
"remove account %1",
"Will appear like this : Undo/Redo remove account ITEMLABEL.").arg(selected[0]->displayLabel());
145 text = QObject::tr(
"remove %n item(s)",
"Remove items from the chart of accounts.", count);
148 for(
int i = 0; i < count; ++i)
151 location.
item = selected[i];
152 location.parent = location.item->parent();
153 location.row = location.item->row();
160 for(
int i = 0; i <
mMap.size(); ++i)
168 for(
int i = 0; i <
mMap.size(); ++i)