1/* This file is part of the KDE project
2 Copyright 2008 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published
6 by the Free Software Foundation; either version 2 of the License or
7 ( at your option ) version 3 or, at the discretion of KDE e.V.
8 ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KONQ_COPYTOMENU_H
22#define KONQ_COPYTOMENU_H
23
24#include <kurl.h>
25#include <kfileitem.h>
26#include <libkonq_export.h>
27
28class QMenu;
29class KonqCopyToMenuPrivate;
30
31/**
32 * This class adds "Copy To" and "Move To" submenus to a popupmenu.
33 */
34class LIBKONQ_EXPORT KonqCopyToMenu
35{
36public:
37 /**
38 * Creates a KonqCopyToMenu instance.
39 * Note that this instance must stay alive for at least as long as the popupmenu;
40 * it has the slots for the actions created by addActionsTo.
41 * @deprecated
42 * KDE5: remove, so that passing a parent widget is mandatory
43 */
44 KonqCopyToMenu();
45
46 /**
47 * Creates a KonqCopyToMenu instance, with a parent widget for the file dialog
48 * and message boxes.
49 * Note that this instance (and the widget) must stay alive for at least as
50 * long as the popupmenu; it has the slots for the actions created by addActionsTo.
51 * @param widget note that this is not the parent of KonqCopyToMenu itself.
52 * @since 4.2
53 */
54 KonqCopyToMenu(QWidget* parentWidget);
55
56 /**
57 * Destructor
58 */
59 ~KonqCopyToMenu();
60
61 /**
62 * Sets the list of fileitems which the actions apply to.
63 * Either call this or setUrls.
64 */
65 void setItems(const KFileItemList& items);
66
67 /**
68 * Sets the URLs which the actions apply to.
69 * Either call this or setItems.
70 */
71 void setUrls(const KUrl::List& urls);
72
73 /**
74 * If setReadOnly(true) is called, the "Move To" submenu will not appear.
75 */
76 void setReadOnly(bool ro);
77
78 /**
79 * Generate the actions and submenus, and adds them to the @p menu.
80 * All actions are created as children of the menu.
81 */
82 void addActionsTo(QMenu* menu);
83
84private:
85 KonqCopyToMenuPrivate* const d;
86};
87
88#endif /* KONQ_COPYTOMENU_H */
89