1 | /* |
2 | SPDX-FileCopyrightText: 2008, 2015 David Faure <faure@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #ifndef KFILECOPYTOMENU_H |
8 | #define |
9 | |
10 | #include <QObject> |
11 | #include <QUrl> |
12 | |
13 | #include <kiofilewidgets_export.h> |
14 | |
15 | #include <memory> |
16 | |
17 | class ; |
18 | class ; |
19 | |
20 | /*! |
21 | * \class KFileCopyToMenu |
22 | * \inmodule KIOFileWidgets |
23 | * |
24 | * \brief This class adds "Copy To" and "Move To" submenus to a popupmenu. |
25 | */ |
26 | class KIOFILEWIDGETS_EXPORT : public QObject |
27 | { |
28 | Q_OBJECT |
29 | public: |
30 | /*! |
31 | * Creates a KFileCopyToMenu instance |
32 | * Note that this instance (and the widget) must stay alive for at least as |
33 | * long as the popupmenu; it has the slots for the actions created by addActionsTo. |
34 | * |
35 | * \a parentWidget parent widget for the file dialog and message boxes. |
36 | * The parentWidget also serves as a parent for this object. |
37 | */ |
38 | explicit (QWidget *parentWidget); |
39 | |
40 | () override; |
41 | |
42 | /*! |
43 | * Sets the URLs which the actions apply to. |
44 | */ |
45 | void (const QList<QUrl> &urls); |
46 | |
47 | /*! |
48 | * If setReadOnly(true) is called, the "Move To" submenu will not appear. |
49 | */ |
50 | void (bool ro); |
51 | |
52 | /*! |
53 | * Generate the actions and submenus, and adds them to the \a menu. |
54 | * All actions are created as children of the menu. |
55 | */ |
56 | void (QMenu *) const; |
57 | |
58 | /*! |
59 | * Enables or disables automatic error handling with message boxes. |
60 | * When called with true, a messagebox is shown in case of an error during a copy or move. |
61 | * When called with false, the application should connect to the error signal instead. |
62 | * Auto error handling is disabled by default. |
63 | */ |
64 | void setAutoErrorHandlingEnabled(bool b); |
65 | |
66 | Q_SIGNALS: |
67 | /*! |
68 | * Emitted when the copy or move job fails. |
69 | * |
70 | * \a errorCode the KIO job error code |
71 | * |
72 | * \a message the error message to show the user |
73 | */ |
74 | void (int errorCode, const QString &message); |
75 | |
76 | private: |
77 | std::unique_ptr<KFileCopyToMenuPrivate> const ; |
78 | }; |
79 | |
80 | #endif |
81 | |