X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/38c34eeca315c7be58e65d4d3fb72aaf7b866719..23b7d64d9c284ddc81b2101034bee01b1207fc52:/src/dolphintabwidget.cpp diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index bb3680f58..ff2f246ae 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) @@ -394,7 +392,7 @@ void DolphinTabWidget::tabDropEvent(int index, QDropEvent *event) const auto urls = event->mimeData()->urls(); for (const QUrl &url : urls) { - auto *job = KIO::statDetails(url, KIO::StatJob::SourceSide, KIO::StatDetail::StatBasic, KIO::JobFlag::HideProgressInfo); + auto *job = KIO::stat(url, KIO::StatJob::SourceSide, KIO::StatDetail::StatBasic, KIO::JobFlag::HideProgressInfo); connect(job, &KJob::result, this, [this, job]() { if (!job->error() && job->statResult().isDir()) { openNewTab(job->url(), QUrl(), NewTabPosition::AtEnd); @@ -597,3 +595,5 @@ const std::optional DolphinTabWidget::viewSho return std::nullopt; } + +#include "moc_dolphintabwidget.cpp"