File indexing completed on 2024-09-15 03:39:04
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2000-2005 David Faure <faure@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KIO_PASTE_H 0009 #define KIO_PASTE_H 0010 0011 #include "kiowidgets_export.h" 0012 #include <QString> 0013 class QWidget; 0014 class QUrl; 0015 class QMimeData; 0016 class KFileItem; 0017 0018 namespace KIO 0019 { 0020 class Job; 0021 class CopyJob; 0022 0023 /** 0024 * Returns true if pasteMimeData will find any interesting format in @p data. 0025 * You can use this method to enable/disable the paste action appropriately. 0026 * @since 5.0 (was called canPasteMimeSource before) 0027 */ 0028 KIOWIDGETS_EXPORT bool canPasteMimeData(const QMimeData *data); 0029 0030 /** 0031 * Returns the text to use for the Paste action, when the application supports 0032 * pasting files, urls, and clipboard data, using pasteClipboard(). 0033 * @param mimeData the mime data, usually QApplication::clipboard()->mimeData(). 0034 * @param enable output parameter, to be passed to QAction::setEnabled. 0035 * The pointer must be non-null, and in return the function will always set its value. 0036 * @param destItem item representing the directory into which the clipboard data 0037 * or items would be pasted. Used to find out about permissions in that directory. 0038 * @return a string suitable for QAction::setText 0039 * @since 5.4 0040 */ 0041 KIOWIDGETS_EXPORT QString pasteActionText(const QMimeData *mimeData, bool *enable, const KFileItem &destItem); 0042 0043 /** 0044 * Add the information whether the files were cut, into the mimedata. 0045 * @param mimeData pointer to the mimeData object to be populated. Must not be null. 0046 * @param cut if true, the user selected "cut" (saved as application/x-kde-cutselection in the mimedata). 0047 * @since 5.2 0048 */ 0049 KIOWIDGETS_EXPORT void setClipboardDataCut(QMimeData *mimeData, bool cut); 0050 0051 /** 0052 * Returns true if the URLs in @p mimeData were cut by the user. 0053 * This should be called when pasting, to choose between moving and copying. 0054 * @since 5.2 0055 */ 0056 KIOWIDGETS_EXPORT bool isClipboardDataCut(const QMimeData *mimeData); 0057 0058 } 0059 0060 #endif