]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphintabwidget.cpp
Add explicit moc includes to sources for moc-covered headers
[dolphin.git] / src / dolphintabwidget.cpp
index bb3680f5832b74375f8c1069795e9d2f4a40a955..03f09ca86810378cad5cc52abb395fab54f1eb11 100644 (file)
@@ -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)
@@ -597,3 +595,5 @@ const std::optional<const DolphinTabWidget::ViewIndex> DolphinTabWidget::viewSho
 
     return std::nullopt;
 }
+
+#include "moc_dolphintabwidget.cpp"