]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/folders/treeviewcontextmenu.h
Apply 1 suggestion(s) to 1 file(s)
[dolphin.git] / src / panels / folders / treeviewcontextmenu.h
1 /*
2 * SPDX-FileCopyrightText: 2006 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef TREEVIEWCONTEXTMENU_H
8 #define TREEVIEWCONTEXTMENU_H
9
10 #include <KFileItem>
11
12 #include <QObject>
13
14 class QMimeData;
15 class FoldersPanel;
16
17 /**
18 * @brief Represents the context menu which appears when doing a right
19 * click on an item of the treeview.
20 */
21 class TreeViewContextMenu : public QObject
22 {
23 Q_OBJECT
24
25 public:
26 /**
27 * @parent Pointer to the folders panel the context menu
28 * belongs to.
29 * @fileInfo Pointer to the file item the context menu
30 * is applied. If 0 is passed, the context menu
31 * is above the viewport.
32 */
33 TreeViewContextMenu(FoldersPanel *parent, const KFileItem &fileInfo);
34
35 ~TreeViewContextMenu() override;
36
37 /** Opens the context menu modal. */
38 void open(const QPoint &pos);
39
40 private Q_SLOTS:
41 /** Cuts the item m_fileItem. */
42 void cut();
43
44 /** Copies the item m_fileItem. */
45 void copy();
46
47 /** Paste the clipboard to m_fileItem. */
48 void paste();
49
50 /** Renames the item m_fileItem. */
51 void rename();
52
53 /** Moves the item m_fileItem to the trash. */
54 void moveToTrash();
55
56 /** Deletes the item m_fileItem. */
57 void deleteItem();
58
59 /** Shows the properties of the item m_fileItem. */
60 void showProperties();
61
62 /**
63 * Sets the 'Show Hidden Files' setting for the
64 * folders panel to \a show.
65 */
66 void setShowHiddenFiles(bool show);
67
68 /**
69 * Sets the 'Limit folders panel to home' setting for the
70 * folders panel to \a enable.
71 */
72 void setLimitFoldersPanelToHome(bool enable);
73
74 /**
75 * Sets the 'Automatic Scrolling' setting for the
76 * folders panel to \a enable.
77 */
78 void setAutoScrolling(bool enable);
79
80 private:
81 void populateMimeData(QMimeData *mimeData, bool cut);
82
83 private:
84 FoldersPanel *m_parent;
85 KFileItem m_fileItem;
86 };
87
88 #endif