]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/folders/treeviewcontextmenu.h
Make it compile against last kf5 version without deprecated methods
[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 <KFileItem>
24
25 #include <QObject>
26
27 class QMimeData;
28 class FoldersPanel;
29
30 /**
31 * @brief Represents the context menu which appears when doing a right
32 * click on an item of the treeview.
33 */
34 class TreeViewContextMenu : public QObject
35 {
36 Q_OBJECT
37
38 public:
39 /**
40 * @parent Pointer to the folders panel the context menu
41 * belongs to.
42 * @fileInfo Pointer to the file item the context menu
43 * is applied. If 0 is passed, the context menu
44 * is above the viewport.
45 */
46 TreeViewContextMenu(FoldersPanel* parent,
47 const KFileItem& fileInfo);
48
49 ~TreeViewContextMenu() override;
50
51 /** Opens the context menu modal. */
52 void open(const QPoint& pos);
53
54 private slots:
55 /** Cuts the item m_fileItem. */
56 void cut();
57
58 /** Copies the item m_fileItem. */
59 void copy();
60
61 /** Paste the clipboard to m_fileItem. */
62 void paste();
63
64 /** Renames the item m_fileItem. */
65 void rename();
66
67 /** Moves the item m_fileItem to the trash. */
68 void moveToTrash();
69
70 /** Deletes the item m_fileItem. */
71 void deleteItem();
72
73 /** Shows the properties of the item m_fileItem. */
74 void showProperties();
75
76 /**
77 * Sets the 'Show Hidden Files' setting for the
78 * folders panel to \a show.
79 */
80 void setShowHiddenFiles(bool show);
81
82 /**
83 * Sets the 'Limit folders panel to home' setting for the
84 * folders panel to \a enable.
85 */
86 void setLimitFoldersPanelToHome(bool enable);
87
88 /**
89 * Sets the 'Automatic Scrolling' setting for the
90 * folders panel to \a enable.
91 */
92 void setAutoScrolling(bool enable);
93
94 private:
95 void populateMimeData(QMimeData* mimeData, bool cut);
96
97 private:
98 FoldersPanel* m_parent;
99 KFileItem m_fileItem;
100 };
101
102 #endif