KIO::PasteJob Class

A KIO job that handles pasting the clipboard contents. More...

Header: #include <KIO/PasteJob>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOWidgets)
Since: 5.4
Inherits: KIO::Job

Signals

(since 6.0) void copyJobStarted(KIO::CopyJob *job)
void itemCreated(const QUrl &url)
(since 5.4) KIO::PasteJob *paste(const QMimeData *mimeData, const QUrl &destDir, KIO::JobFlags flags = DefaultFlags)

Detailed Description

If the clipboard contains URLs, they are copied to the destination URL. If the clipboard contains data, it is saved into a file after asking the user to choose a filename and the preferred data format.

See also KIO::pasteClipboard.

Member Function Documentation

[signal, since 6.0] void PasteJob::copyJobStarted(KIO::CopyJob *job)

Emitted when a copy job was started as subjob as part of pasting. Note that a CopyJob isn't always started by PasteJob. For instance pasting image content will create a file.

You can use job to monitor the progress of the copy/move/link operation.

job the job started for moving, copying or symlinking files

This function was introduced in 6.0.

[signal] void PasteJob::itemCreated(const QUrl &url)

Signals that a file or directory was created.

Related Non-Members

[since 5.4] KIO::PasteJob *paste(const QMimeData *mimeData, const QUrl &destDir, KIO::JobFlags flags = DefaultFlags)

Pastes the clipboard contents.

If the clipboard contains URLs, they are copied (or moved) to the destination URL, using a KIO::CopyJob subjob. Otherwise, the data from the clipboard is saved into a file using KIO::storedPut, after asking the user to choose a filename and the preferred data format.

This takes care of recording the subjob in the FileUndoManager, and emits itemCreated for every file or directory being created, so that the view can select these items.

mimeData the MIME data to paste, usually QApplication::clipboard()->mimeData()

destDir The URL of the target directory

flags passed to the sub job

Returns a pointer to the job handling the operation.

This function was introduced in 5.4.