1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000-2005 David Faure <faure@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only |
6 | */ |
7 | |
8 | #ifndef KIO_PASTE_H |
9 | #define KIO_PASTE_H |
10 | |
11 | #include "kiowidgets_export.h" |
12 | #include <QString> |
13 | class QWidget; |
14 | class QUrl; |
15 | class QMimeData; |
16 | class KFileItem; |
17 | |
18 | namespace KIO |
19 | { |
20 | class Job; |
21 | class CopyJob; |
22 | |
23 | /** |
24 | * Returns true if pasteMimeData will find any interesting format in @p data. |
25 | * You can use this method to enable/disable the paste action appropriately. |
26 | * @since 5.0 (was called canPasteMimeSource before) |
27 | */ |
28 | KIOWIDGETS_EXPORT bool canPasteMimeData(const QMimeData *data); |
29 | |
30 | /** |
31 | * Returns the text to use for the Paste action, when the application supports |
32 | * pasting files, urls, and clipboard data, using pasteClipboard(). |
33 | * @param mimeData the mime data, usually QApplication::clipboard()->mimeData(). |
34 | * @param enable output parameter, to be passed to QAction::setEnabled. |
35 | * The pointer must be non-null, and in return the function will always set its value. |
36 | * @param destItem item representing the directory into which the clipboard data |
37 | * or items would be pasted. Used to find out about permissions in that directory. |
38 | * @return a string suitable for QAction::setText |
39 | * @since 5.4 |
40 | */ |
41 | KIOWIDGETS_EXPORT QString pasteActionText(const QMimeData *mimeData, bool *enable, const KFileItem &destItem); |
42 | |
43 | /** |
44 | * Add the information whether the files were cut, into the mimedata. |
45 | * @param mimeData pointer to the mimeData object to be populated. Must not be null. |
46 | * @param cut if true, the user selected "cut" (saved as application/x-kde-cutselection in the mimedata). |
47 | * @since 5.2 |
48 | */ |
49 | KIOWIDGETS_EXPORT void setClipboardDataCut(QMimeData *mimeData, bool cut); |
50 | |
51 | /** |
52 | * Returns true if the URLs in @p mimeData were cut by the user. |
53 | * This should be called when pasting, to choose between moving and copying. |
54 | * @since 5.2 |
55 | */ |
56 | KIOWIDGETS_EXPORT bool isClipboardDataCut(const QMimeData *mimeData); |
57 | |
58 | } |
59 | |
60 | #endif |
61 | |