┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnthony Fieroni <[email protected]>2024-04-30 18:51:01 +0300
committerMéven Car <[email protected]>2024-05-04 07:58:47 +0000
commit67de3b7344fd8a9af89017405b1edda6e1cda9ff (patch)
tree2e9c72df40780d1e68840f0a7ce4ec55eab1b160 /src
parentad81fdfb512efd57ad7a8c76d2b9c5d2f85e9324 (diff)
DolphinView: Update selection on newly created item(s)
Adjust paste to url to new KF6 signals BUG: 476670 Signed-off-by: Anthony Fieroni <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/views/dolphinview.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 613f99405..1bbcd5998 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -1714,6 +1714,7 @@ void DolphinView::updateSelectionState()
if (!m_selectedUrls.isEmpty()) {
KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
+ const bool shouldScrollToCurrentItem = m_clearSelectionBeforeSelectingNewItems;
// if there is a selection already, leave it that way
// unless some drop/paste job are in the process of creating items
if (!selectionManager->hasSelection() || m_selectJobCreatedItems) {
@@ -1738,6 +1739,10 @@ void DolphinView::updateSelectionState()
if (!selectedItems.isEmpty()) {
selectionManager->beginAnchoredSelection(selectionManager->currentItem());
selectionManager->setSelectedItems(selectedItems);
+ selectionManager->endAnchoredSelection();
+ if (shouldScrollToCurrentItem) {
+ m_view->scrollToItem(selectedItems.first());
+ }
}
}
}
@@ -2188,8 +2193,16 @@ void DolphinView::pasteToUrl(const QUrl &url)
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;
m_selectJobCreatedItems = true;
- // TODO KF6 use KIO::PasteJob::copyJobStarted to hook to earlier events copying/moving
connect(job, &KIO::PasteJob::itemCreated, this, &DolphinView::slotItemCreated);
+ connect(job, &KIO::PasteJob::copyJobStarted, this, [this](const KIO::CopyJob *copyJob) {
+ connect(copyJob, &KIO::CopyJob::copying, this, &DolphinView::slotItemCreatedFromJob);
+ connect(copyJob, &KIO::CopyJob::moving, this, &DolphinView::slotItemCreatedFromJob);
+ connect(copyJob, &KIO::CopyJob::linking, this, [this](KIO::Job *job, const QString &src, const QUrl &dest) {
+ Q_UNUSED(job)
+ Q_UNUSED(src)
+ slotItemCreated(dest);
+ });
+ });
connect(job, &KIO::PasteJob::result, this, &DolphinView::slotJobResult);
}