Currently, copying the selected items between panels is performed by the active panel, which is wrong, because the inactive panel cannot select the copied items after the operation is completed (as it happens when drag'n'dropping or copying using keyboard shortcuts).
void DolphinTabWidget::copyToInactiveSplitView()
{
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()) {
+ const KFileItemList selectedItems = tabPage->activeViewContainer()->view()->selectedItems();
+ if (selectedItems.isEmpty()) {
+ return;
+ }
+
+ DolphinView *inactiveView;
if (tabPage->primaryViewActive()) {
if (tabPage->primaryViewActive()) {
- // copy from left panel to right
- activeViewContainer->view()->copySelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url());
+ inactiveView = tabPage->secondaryViewContainer()->view();
- // 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()
{
}
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()) {
+ DolphinView *inactiveView;
if (tabPage->primaryViewActive()) {
if (tabPage->primaryViewActive()) {
- // move from left panel to right
- activeViewContainer->view()->moveSelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url());
+ inactiveView = tabPage->secondaryViewContainer()->view();
- // 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)
}
void DolphinTabWidget::detachTab(int index)
void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
{
void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
{
+ if (selection.isEmpty() || !destinationUrl.isValid()) {
+ return;
+ }
+
+ m_clearSelectionBeforeSelectingNewItems = true;
+ m_markFirstNewlySelectedItemAsCurrent = true;
+ m_selectJobCreatedItems = true;
+
KIO::CopyJob *job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags);
KJobWidgets::setWindow(job, this);
KIO::CopyJob *job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags);
KJobWidgets::setWindow(job, this);
void DolphinView::moveSelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
{
void DolphinView::moveSelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
{
+ if (selection.isEmpty() || !destinationUrl.isValid()) {
+ return;
+ }
+
+ m_clearSelectionBeforeSelectingNewItems = true;
+ m_markFirstNewlySelectedItemAsCurrent = true;
+ m_selectJobCreatedItems = true;
+
KIO::CopyJob *job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags);
KJobWidgets::setWindow(job, this);
KIO::CopyJob *job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags);
KJobWidgets::setWindow(job, this);