| 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 | // TODO qdoc header |
| 24 | |
| 25 | /*! |
| 26 | * Returns true if pasteMimeData will find any interesting format in \a data. |
| 27 | * You can use this method to enable/disable the paste action appropriately. |
| 28 | * \since 5.0 (was called canPasteMimeSource before) |
| 29 | */ |
| 30 | KIOWIDGETS_EXPORT bool canPasteMimeData(const QMimeData *data); |
| 31 | |
| 32 | /*! |
| 33 | * Returns the text to use for the Paste action, when the application supports |
| 34 | * pasting files, urls, and clipboard data, using pasteClipboard(). |
| 35 | * |
| 36 | * \a mimeData the mime data, usually QApplication::clipboard()->mimeData(). |
| 37 | * |
| 38 | * \a enable output parameter, to be passed to QAction::setEnabled. |
| 39 | * The pointer must be non-null, and in return the function will always set its value. |
| 40 | * |
| 41 | * \a destItem item representing the directory into which the clipboard data |
| 42 | * or items would be pasted. Used to find out about permissions in that directory. |
| 43 | * |
| 44 | * Returns a string suitable for QAction::setText |
| 45 | * \since 5.4 |
| 46 | */ |
| 47 | KIOWIDGETS_EXPORT QString pasteActionText(const QMimeData *mimeData, bool *enable, const KFileItem &destItem); |
| 48 | |
| 49 | /*! |
| 50 | * Add the information whether the files were cut, into the mimedata. |
| 51 | * |
| 52 | * \a mimeData pointer to the mimeData object to be populated. Must not be null. |
| 53 | * |
| 54 | * \a cut if true, the user selected "cut" (saved as application/x-kde-cutselection in the mimedata). |
| 55 | * \since 5.2 |
| 56 | */ |
| 57 | KIOWIDGETS_EXPORT void setClipboardDataCut(QMimeData *mimeData, bool cut); |
| 58 | |
| 59 | /*! |
| 60 | * Returns true if the URLs in \a mimeData were cut by the user. |
| 61 | * This should be called when pasting, to choose between moving and copying. |
| 62 | * \since 5.2 |
| 63 | */ |
| 64 | KIOWIDGETS_EXPORT bool isClipboardDataCut(const QMimeData *mimeData); |
| 65 | |
| 66 | } |
| 67 | |
| 68 | #endif |
| 69 | |