diff options
| author | Antonio Prcela <[email protected]> | 2020-05-14 16:17:31 -0600 |
|---|---|---|
| committer | Nate Graham <[email protected]> | 2020-05-14 16:20:14 -0600 |
| commit | a291c5999035bb17fe764c1910c3e78ba041f8ac (patch) | |
| tree | e3942ce0cd99492b3d1e100e4dc1552e90854384 /src/views/dolphinview.cpp | |
| parent | 8cb3521cb7b2debfeff5d983bc3eb6ada1b66537 (diff) | |
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 2500902af..aef0e85d6 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -692,6 +692,27 @@ void DolphinView::copySelectedItemsToClipboard() QApplication::clipboard()->setMimeData(mimeData); } +void DolphinView::copySelectedItemsToInactiveSplitView(const KFileItemList &selection, const QUrl &destinationUrl) +{ + KIO::CopyJob* job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags); + KJobWidgets::setWindow(job, this); + + connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult); + connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotCopyingDone); + KIO::FileUndoManager::self()->recordCopyJob(job); +} + +void DolphinView::moveSelectedItemsToInactiveSplitView(const KFileItemList &selection, const QUrl &destinationUrl) +{ + KIO::CopyJob* job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags); + KJobWidgets::setWindow(job, this); + + connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult); + connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotCopyingDone); + KIO::FileUndoManager::self()->recordCopyJob(job); + +} + void DolphinView::paste() { pasteToUrl(url()); @@ -1132,7 +1153,7 @@ void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget * KIO::DropJob* job = DragAndDropHelper::dropUrls(destUrl, dropEvent, dropWidget); if (job) { - connect(job, &KIO::DropJob::result, this, &DolphinView::slotPasteJobResult); + connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult); if (destUrl == url()) { // Mark the dropped urls as selected. @@ -1185,6 +1206,11 @@ void DolphinView::slotSelectedItemTextPressed(int index) } } +void DolphinView::slotCopyingDone(KIO::Job *, const QUrl &, const QUrl &to) +{ + slotItemCreated(to); +} + void DolphinView::slotItemCreated(const QUrl& url) { if (m_markFirstNewlySelectedItemAsCurrent) { @@ -1194,7 +1220,7 @@ void DolphinView::slotItemCreated(const QUrl& url) m_selectedUrls << url; } -void DolphinView::slotPasteJobResult(KJob *job) +void DolphinView::slotJobResult(KJob *job) { if (job->error()) { emit errorMessage(job->errorString()); @@ -1845,7 +1871,7 @@ void DolphinView::pasteToUrl(const QUrl& url) m_clearSelectionBeforeSelectingNewItems = true; m_markFirstNewlySelectedItemAsCurrent = true; connect(job, &KIO::PasteJob::itemCreated, this, &DolphinView::slotItemCreated); - connect(job, &KIO::PasteJob::result, this, &DolphinView::slotPasteJobResult); + connect(job, &KIO::PasteJob::result, this, &DolphinView::slotJobResult); } QList<QUrl> DolphinView::simplifiedSelectedUrls() const |
