]> cloud.milkyroute.net Git - dolphin.git/blob - src/treeviewcontextmenu.h
Forwardport 773570:
[dolphin.git] / src / treeviewcontextmenu.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
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 <QtCore/QObject>
24 #include <KFileItem>
25
26 /**
27 * @brief Represents the context menu which appears when doing a right
28 * click on an item of the treeview.
29 */
30 class TreeViewContextMenu : public QObject
31 {
32 Q_OBJECT
33
34 public:
35 /**
36 * @parent Pointer to the parent widget the context menu
37 * belongs to.
38 * @fileInfo Pointer to the file item the context menu
39 * is applied. If 0 is passed, the context menu
40 * is above the viewport.
41 */
42 TreeViewContextMenu(QWidget* parent,
43 const KFileItem& fileInfo);
44
45 virtual ~TreeViewContextMenu();
46
47 /** Opens the context menu modal. */
48 void open();
49
50 private slots:
51 /** Cuts the item m_fileInfo. */
52 void cut();
53
54 /** Copies the item m_fileInfo. */
55 void copy();
56
57 /** Paste the clipboard to m_fileInfo. */
58 void paste();
59
60 /** Renames the item m_fileInfo. */
61 void rename();
62
63 /** Moves the item m_fileInfo to the trash. */
64 void moveToTrash();
65
66 /** Deletes the item m_fileInfo. */
67 void deleteItem();
68
69 /** Shows the properties of the item m_fileInfo. */
70 void showProperties();
71
72 private:
73 QWidget* m_parent;
74 KFileItem m_fileInfo;
75 };
76
77 #endif