]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/folders/treeviewcontextmenu.h
Modernize: Use override where possible
[dolphin.git] / src / panels / folders / treeviewcontextmenu.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz19@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef TREEVIEWCONTEXTMENU_H
21 #define TREEVIEWCONTEXTMENU_H
22
23 #include <QObject>
24 #include <KFileItem>
25
26 class QMimeData;
27 class FoldersPanel;
28
29 /**
30 * @brief Represents the context menu which appears when doing a right
31 * click on an item of the treeview.
32 */
33 class TreeViewContextMenu : public QObject
34 {
35 Q_OBJECT
36
37 public:
38 /**
39 * @parent Pointer to the folders panel the context menu
40 * belongs to.
41 * @fileInfo Pointer to the file item the context menu
42 * is applied. If 0 is passed, the context menu
43 * is above the viewport.
44 */
45 TreeViewContextMenu(FoldersPanel* parent,
46 const KFileItem& fileInfo);
47
48 ~TreeViewContextMenu() override;
49
50 /** Opens the context menu modal. */
51 void open();
52
53 private slots:
54 /** Cuts the item m_fileItem. */
55 void cut();
56
57 /** Copies the item m_fileItem. */
58 void copy();
59
60 /** Paste the clipboard to m_fileItem. */
61 void paste();
62
63 /** Renames the item m_fileItem. */
64 void rename();
65
66 /** Moves the item m_fileItem to the trash. */
67 void moveToTrash();
68
69 /** Deletes the item m_fileItem. */
70 void deleteItem();
71
72 /** Shows the properties of the item m_fileItem. */
73 void showProperties();
74
75 /**
76 * Sets the 'Show Hidden Files' setting for the
77 * folders panel to \a show.
78 */
79 void setShowHiddenFiles(bool show);
80
81 /**
82 * Sets the 'Limit folders panel to home' setting for the
83 * folders panel to \a enable.
84 */
85 void setLimitFoldersPanelToHome(bool enable);
86
87 /**
88 * Sets the 'Automatic Scrolling' setting for the
89 * folders panel to \a enable.
90 */
91 void setAutoScrolling(bool enable);
92
93 private:
94 void populateMimeData(QMimeData* mimeData, bool cut);
95
96 private:
97 FoldersPanel* m_parent;
98 KFileItem m_fileItem;
99 };
100
101 #endif