From 78a3cd3e4bc75fc299a6b05b266bdd58fe7f8dcf Mon Sep 17 00:00:00 2001 From: Eugene Popov Date: Fri, 21 Apr 2023 15:15:31 +0300 Subject: Improve copying and moving items between panels Currently, copying the selected items between panels is performed by the active panel, which is wrong, because the inactive panel cannot select the copied items after the operation is completed (as it happens when drag'n'dropping or copying using keyboard shortcuts). --- src/views/dolphinview.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/views/dolphinview.cpp') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 66b6c23a8..b33353e3a 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -814,6 +814,14 @@ void DolphinView::copySelectedItemsToClipboard() void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &destinationUrl) { + if (selection.isEmpty() || !destinationUrl.isValid()) { + return; + } + + m_clearSelectionBeforeSelectingNewItems = true; + m_markFirstNewlySelectedItemAsCurrent = true; + m_selectJobCreatedItems = true; + KIO::CopyJob *job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags); KJobWidgets::setWindow(job, this); @@ -825,6 +833,14 @@ void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl & void DolphinView::moveSelectedItems(const KFileItemList &selection, const QUrl &destinationUrl) { + if (selection.isEmpty() || !destinationUrl.isValid()) { + return; + } + + m_clearSelectionBeforeSelectingNewItems = true; + m_markFirstNewlySelectedItemAsCurrent = true; + m_selectJobCreatedItems = true; + KIO::CopyJob *job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags); KJobWidgets::setWindow(job, this); -- cgit v1.3