X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fef7eebc6e3c27e6653bfd5d8a1abec191dc9835..a291c5999035bb17fe764c1910c3e78ba041f8ac:/src/dolphintabwidget.cpp diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index 39a734b17..9fd600567 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -25,9 +25,9 @@ #include "dolphinviewcontainer.h" #include -#include #include #include +#include #include #include @@ -206,7 +206,7 @@ void DolphinTabWidget::openDirectories(const QList& dirs, bool splitView) } else { tabPage->secondaryViewContainer()->setActive(true); } - // BUG: 147230 + // BUG: 417230 // Required for updateViewState() call in openFiles() to work as expected // If there is a selection, updateViewState() calls are effectively a no-op tabPage->activeViewContainer()->view()->clearSelection(); @@ -320,6 +320,40 @@ void DolphinTabWidget::restoreClosedTab(const QByteArray& state) currentTabPage()->restoreState(state); } +void DolphinTabWidget::copyToInactiveSplitView() +{ + const DolphinTabPage* tabPage = tabPageAt(currentIndex()); + DolphinViewContainer* activeViewContainer = currentTabPage()->activeViewContainer(); + if (!tabPage->splitViewEnabled() || activeViewContainer->view()->selectedItems().isEmpty()) { + return; + } + + if (tabPage->primaryViewActive()) { + // copy from left panel to right + activeViewContainer->view()->copySelectedItemsToInactiveSplitView(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url()); + } else { + // copy from right panel to left + activeViewContainer->view()->copySelectedItemsToInactiveSplitView(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url()); + } +} + +void DolphinTabWidget::moveToInactiveSplitView() +{ + const DolphinTabPage* tabPage = tabPageAt(currentIndex()); + DolphinViewContainer* activeViewContainer = currentTabPage()->activeViewContainer(); + if (!tabPage->splitViewEnabled() || activeViewContainer->view()->selectedItems().isEmpty()) { + return; + } + + if (tabPage->primaryViewActive()) { + // move from left panel to right + activeViewContainer->view()->moveSelectedItemsToInactiveSplitView(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url()); + } else { + // move from right panel to left + activeViewContainer->view()->moveSelectedItemsToInactiveSplitView(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url()); + } +} + void DolphinTabWidget::detachTab(int index) { Q_ASSERT(index >= 0); @@ -334,8 +368,9 @@ void DolphinTabWidget::detachTab(int index) } args << QStringLiteral("--new-window"); - const QString command = QStringLiteral("dolphin %1").arg(KShell::joinArgs(args)); - KRun::runCommand(command, this); + KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob("dolphin", args, this); + job->setDesktopName(QStringLiteral("org.kde.dolphin")); + job->start(); closeTab(index); }