diff options
| author | Méven Car <[email protected]> | 2023-05-08 17:46:51 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2023-05-08 17:46:51 +0200 |
| commit | 863ee3a87cee8b1f22a311d6a6a62e56714b5eae (patch) | |
| tree | 728a2f70486e1835053e5c3431e72c62eb69ff82 /src/dolphintabwidget.cpp | |
| parent | 69f6b9b78b71f8369dc0ab9b9f9aecfd928d3eb1 (diff) | |
| parent | 26808a188ccb5e35a05b37709e4fe61263c46032 (diff) | |
Merge branch 'master' into kf6
Diffstat (limited to 'src/dolphintabwidget.cpp')
| -rw-r--r-- | src/dolphintabwidget.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index bb3680f58..d4271847f 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -325,36 +325,34 @@ void DolphinTabWidget::restoreClosedTab(const QByteArray &state) void DolphinTabWidget::copyToInactiveSplitView() { - const DolphinTabPage *tabPage = tabPageAt(currentIndex()); - DolphinViewContainer *activeViewContainer = currentTabPage()->activeViewContainer(); - if (!tabPage->splitViewEnabled() || activeViewContainer->view()->selectedItems().isEmpty()) { + const DolphinTabPage *tabPage = currentTabPage(); + if (!tabPage->splitViewEnabled()) { return; } - if (tabPage->primaryViewActive()) { - // copy from left panel to right - activeViewContainer->view()->copySelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url()); - } else { - // copy from right panel to left - activeViewContainer->view()->copySelectedItems(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url()); + const KFileItemList selectedItems = tabPage->activeViewContainer()->view()->selectedItems(); + if (selectedItems.isEmpty()) { + return; } + + DolphinView *const inactiveView = tabPage->inactiveViewContainer()->view(); + inactiveView->copySelectedItems(selectedItems, inactiveView->url()); } void DolphinTabWidget::moveToInactiveSplitView() { - const DolphinTabPage *tabPage = tabPageAt(currentIndex()); - DolphinViewContainer *activeViewContainer = currentTabPage()->activeViewContainer(); - if (!tabPage->splitViewEnabled() || activeViewContainer->view()->selectedItems().isEmpty()) { + const DolphinTabPage *tabPage = currentTabPage(); + if (!tabPage->splitViewEnabled()) { return; } - if (tabPage->primaryViewActive()) { - // move from left panel to right - activeViewContainer->view()->moveSelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url()); - } else { - // move from right panel to left - activeViewContainer->view()->moveSelectedItems(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url()); + const KFileItemList selectedItems = tabPage->activeViewContainer()->view()->selectedItems(); + if (selectedItems.isEmpty()) { + return; } + + DolphinView *const inactiveView = tabPage->inactiveViewContainer()->view(); + inactiveView->moveSelectedItems(selectedItems, inactiveView->url()); } void DolphinTabWidget::detachTab(int index) |
