KIO::DropJob Class
A KIO job that handles dropping into a file-manager-like view. More...
Header: | #include <KIO/DropJob> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KIO) target_link_libraries(mytarget PRIVATE KF6::KIOWidgets) |
Since: | 5.6 |
Inherits: | KIO::Job |
Public Functions
void | setApplicationActions(const QList<QAction *> &actions) |
(since 5.67) void | showMenu(const QPoint &p, QAction *atAction = nullptr) |
Signals
(since 5.30) void | copyJobStarted(KIO::CopyJob *job) |
void | itemCreated(const QUrl &url) |
void | popupMenuAboutToShow(const KFileItemListProperties &itemProps) |
Related Non-Members
(since 5.4) KIO::DropJob * | drop(const QDropEvent *dropEvent, const QUrl &destUrl, KIO::JobFlags flags = DefaultFlags) |
(since 5.67) KIO::DropJob * | drop(const QDropEvent *dropEvent, const QUrl &destUrl, KIO::DropJobFlags dropjobFlags, KIO::JobFlags flags = DefaultFlags) |
Detailed Description
The popupmenu that can appear on drop, can be customized with plugins, see KIO::DndPopupMenuPlugin.
See also KIO::drop.
Member Function Documentation
[signal, since 5.30]
void DropJob::copyJobStarted(KIO::CopyJob *job)
Emitted when a copy job was started as subjob after user selection.
You can use job to monitor the progress of the copy/move/link operation. Note that a CopyJob isn't always started by DropJob. For instance dropping files onto an executable will simply launch the executable.
job the job started for moving, copying or symlinking files
This function was introduced in 5.30.
[signal]
void DropJob::itemCreated(const QUrl &url)
Signals that a file or directory was created.
[signal]
void DropJob::popupMenuAboutToShow(const KFileItemListProperties &itemProps)
Signals that the popup menu is about to be shown. Applications can use the information provided about the dropped URLs (e.g. the MIME type) to decide whether to call setApplicationActions.
itemProps properties of the dropped items
void DropJob::setApplicationActions(const QList<QAction *> &actions)
Allows the application to set additional actions in the drop popup menu. For instance, the application handling the desktop might want to add "set as wallpaper" if the dropped url is an image file. This can be called upfront, or for convenience, when popupMenuAboutToShow is emitted.
[since 5.67]
void DropJob::showMenu(const QPoint &p, QAction *atAction = nullptr)
Allows the application to show the menu manually. DropJob instance has to be created with the KIO::ShowMenuManually flag
This function was introduced in 5.67.
Related Non-Members
[since 5.4]
KIO::DropJob *drop(const QDropEvent *dropEvent, const QUrl &destUrl, KIO::JobFlags flags = DefaultFlags)
Drops the clipboard contents.
If the mime data contains URLs, a popup appears to choose between Move, Copy, Link and Cancel which is then implemented by the job, using KIO::move, KIO::copy or KIO::link Additional actions provided by the application or by plugins can be shown in the popup.
If the mime data contains data other than URLs, it is saved into a file after asking the user to choose a filename and the preferred data format.
This job 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.
dropEvent the drop event, from which the job will extract mimeData, dropAction, etc. The application should take care of calling dropEvent->acceptProposedAction().
destUrl The URL of the target file or directory
flags passed to the sub job
Returns A pointer to the job handling the operation.
Warning: Don't forget to call KJobWidgets::setWindow() on this job, otherwise the popup menu won't be properly positioned with Wayland compositors.
This function was introduced in 5.4.
[since 5.67]
KIO::DropJob *drop(const QDropEvent *dropEvent, const QUrl &destUrl, KIO::DropJobFlags dropjobFlags, KIO::JobFlags flags = DefaultFlags)
Similar to KIO::drop
dropEvent the drop event, from which the job will extract mimeData, dropAction, etc. The application should take care of calling dropEvent->acceptProposedAction().
destUrl The URL of the target file or directory
dropjobFlags Show the menu immediately or manually.
flags passed to the sub job
Returns A pointer to the job handling the operation.
Warning: Don't forget to call DropJob::showMenu on this job, otherwise the popup will never be shown
This function was introduced in 5.67.