FreeDebks  1.0.3
 All Classes Files Functions Variables Friends Pages
FdCommandsJournal.cpp
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 #include "FdCommandsJournal.hpp"
21 #include "FdModelJournal.hpp"
22 #include "FdItemJournal.hpp"
23 
24 FdJournalSetData::FdJournalSetData(FdModelJournal *journal, FdItemJournal_p entry, JournalColumn column, QVariant newValue, QUndoCommand* parent) :
25  QUndoCommand(parent), mJournal(journal), mEntry(entry), mColumn(column), mNewValue(newValue)
26 {
27  mOldValue = mJournal->data(mEntry, mColumn);
28  switch(mColumn)
29  {
30  case JournalDate:
31  setText(QObject::tr("change date", "Will appear like this : Undo/Redo change date."));
32  break;
33  case JournalObject:
34  setText(QObject::tr("change object", "Will appear like this : Undo/Redo change object."));
35  break;
36  case JournalLabel:
37  setText(QObject::tr("change label", "Will appear like this : Undo/Redo change label."));
38  break;
39  case JournalDebitId:
40  case JournalDebitLabel:
41  setText(QObject::tr("change debit account", "Will appear like this : Undo/Redo change debit account."));
42  break;
43  case JournalCreditId:
44  case JournalCreditLabel:
45  setText(QObject::tr("change credit account", "Will appear like this : Undo/Redo change credit account."));
46  break;
47  case JournalAmount:
48  setText(QObject::tr("change amount", "Will appear like this : Undo/Redo change amount."));
49  break;
50  }
51 }
52 
54 {
56 }
57 
59 {
61 }
62 
63 FdJournalRemove::FdJournalRemove(FdModelJournal *journal, QList<FdItemJournal_p>entries) : mJournal(journal), mEntries(entries)
64 {
65  setText(QObject::tr("remove %n row(s)", "Undo/redo remove rows from the journal.", mEntries.size()));
66 }
67 
69 {
71 }
72 
74 {
76 }