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 DELETEKEYCOMMAND_HPP
10 : #define DELETEKEYCOMMAND_HPP
11 :
12 : #include "treeviewmodel.hpp"
13 : #include <QUndoCommand>
14 :
15 : /**
16 : * @brief The DeleteKeyCommand class. Remembers a node for redo/undo.
17 : */
18 0 : class DeleteKeyCommand : public QUndoCommand
19 : {
20 :
21 : public:
22 : /**
23 : * @brief The command to delete a ConfigNode.
24 : *
25 : * @param type Declares if the ConfigNode is a single key or a branch.
26 : * @param model The model that holds the ConfigNode that is deleted.
27 : * @param index The index of the ConfigNode that is deleted.
28 : * @param parent An optional parent command.
29 : */
30 : explicit DeleteKeyCommand (const QString & type, TreeViewModel * model, int index, QUndoCommand * parent = nullptr);
31 :
32 : virtual void undo () override;
33 : virtual void redo () override;
34 :
35 : private:
36 : TreeViewModel * m_model;
37 : ConfigNodePtr m_node;
38 : int m_index;
39 : bool m_isRoot;
40 : ConfigNodePtr m_root;
41 : };
42 :
43 : #endif // DELETEKEYCOMMAND_HPP
|