┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphintabwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphintabwidget.cpp')
-rw-r--r--src/dolphintabwidget.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index bb3680f58..9ee80160a 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -325,36 +325,44 @@ 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;
}
+ const KFileItemList selectedItems = tabPage->activeViewContainer()->view()->selectedItems();
+ if (selectedItems.isEmpty()) {
+ return;
+ }
+
+ DolphinView *inactiveView;
if (tabPage->primaryViewActive()) {
- // copy from left panel to right
- activeViewContainer->view()->copySelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url());
+ inactiveView = tabPage->secondaryViewContainer()->view();
} else {
- // copy from right panel to left
- activeViewContainer->view()->copySelectedItems(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url());
+ inactiveView = tabPage->primaryViewContainer()->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;
+ }
+
+ const KFileItemList selectedItems = tabPage->activeViewContainer()->view()->selectedItems();
+ if (selectedItems.isEmpty()) {
return;
}
+ DolphinView *inactiveView;
if (tabPage->primaryViewActive()) {
- // move from left panel to right
- activeViewContainer->view()->moveSelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url());
+ inactiveView = tabPage->secondaryViewContainer()->view();
} else {
- // move from right panel to left
- activeViewContainer->view()->moveSelectedItems(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url());
+ inactiveView = tabPage->primaryViewContainer()->view();
}
+ inactiveView->moveSelectedItems(selectedItems, inactiveView->url());
}
void DolphinTabWidget::detachTab(int index)