Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : */
8 :
9 : #ifndef EDITKEYCOMMAND_HPP
10 : #define EDITKEYCOMMAND_HPP
11 :
12 : #include "datacontainer.hpp"
13 : #include "treeviewmodel.hpp"
14 : #include <QUndoCommand>
15 :
16 : /**
17 : * @brief The EditKeyCommand class. Remembers a node for redo/undo.
18 : */
19 0 : class EditKeyCommand : public QUndoCommand
20 : {
21 :
22 : public:
23 : /**
24 : * @brief The command to edit a ConfigNode.
25 : *
26 : * @param model The TreeViewModel that contains the ConfigNode to edit.
27 : * @param index The index of the ConfigNode to edit.
28 : * @param data The data needed to undo/redo the edit.
29 : * @param parent An optional parent command.
30 : */
31 : explicit EditKeyCommand (TreeViewModel * model, int index, DataContainer * data, QUndoCommand * parent = nullptr);
32 :
33 : virtual void undo () override;
34 : virtual void redo () override;
35 :
36 : private:
37 : TreeViewModel * m_model;
38 : int m_index;
39 :
40 : QString m_oldName;
41 : QString m_oldValue;
42 : QVariantMap m_oldMetaData;
43 :
44 : QString m_newName;
45 : QString m_newValue;
46 : QVariantMap m_newMetaData;
47 : };
48 :
49 : #endif // EDITKEYCOMMAND_HPP
|