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 CUTKEYCOMMAND_H
10 : #define CUTKEYCOMMAND_H
11 :
12 : #include "treeviewmodel.hpp"
13 : #include <QUndoCommand>
14 :
15 : /**
16 : * @brief The CutKeyCommand class
17 : *
18 : * This class allows undoing/redoing copy and paste of a ConfigNode.
19 : */
20 0 : class CutKeyCommand : public QUndoCommand
21 : {
22 : public:
23 : /**
24 : * @brief The command to cut and paste a ConfigNode.
25 : *
26 : * @param type Declares if the ConfigNode is a single key or a branch.
27 : * @param source The ConfigNode that is cut.
28 : * @param target The ConfigNode that is the new parent node of the cut ConfigNode.
29 : * @param sourceIndex The index of the cut ConfigNode, needed to remove the cut ConfigNode.
30 : * @param parent
31 : */
32 : explicit CutKeyCommand (QString type, ConfigNodePtr source, ConfigNodePtr target, int sourceIndex, QUndoCommand * parent = nullptr);
33 :
34 : /**
35 : * @copydoc QUndoCommand::undo()
36 : */
37 : virtual void undo () override;
38 :
39 : /**
40 : * @copydoc QUndoCommand::redo()
41 : */
42 : virtual void redo () override;
43 :
44 : private:
45 : TreeViewModel * m_sourceParentModel;
46 : ConfigNodePtr m_source;
47 : ConfigNodePtr m_target;
48 : bool m_isExpanded;
49 : int m_sourceIndex;
50 : int m_targetIndex;
51 : };
52 :
53 : #endif // CUTKEYCOMMAND_H
|