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 | |
| 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')
| -rw-r--r-- | src/views/dolphinview.cpp | 32 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 15 |
2 files changed, 43 insertions, 4 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 diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 766540d99..0b2c0bce4 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -370,6 +370,18 @@ public slots: /** Copies all selected items to the clipboard. */ void copySelectedItemsToClipboard(); + /** + * Copies all selected items to the inactive split view. + * Only used in Split View. + */ + void copySelectedItemsToInactiveSplitView(const KFileItemList &selection, const QUrl &destinationUrl); + + /** + * Moves all selected items to the inactive split view. + * Only used in Split View. + */ + void moveSelectedItemsToInactiveSplitView(const KFileItemList &selection, const QUrl &destinationUrl); + /** Pastes the clipboard data to this view. */ void paste(); @@ -608,6 +620,7 @@ private slots: void slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons); void slotRenameDialogRenamingFinished(const QList<QUrl>& urls); void slotSelectedItemTextPressed(int index); + void slotCopyingDone(KIO::Job *, const QUrl &, const QUrl &to); /* * Is called when new items get pasted or dropped. @@ -616,7 +629,7 @@ private slots: /* * Is called after all pasted or dropped items have been copied to destination. */ - void slotPasteJobResult(KJob *job); + void slotJobResult(KJob *job); /** * Emits the signal \a selectionChanged() with a small delay. This is |
