D29006: Allow to copy or move selection to the other split view

Antonio Prcela noreply at phabricator.kde.org
Sun May 3 13:58:29 BST 2020


aprcela added a comment.


  In D29006#662058 <https://phabricator.kde.org/D29006#662058>, @meven wrote:
  
  > Just a check to add.
  
  
  @meven See inline comment
  
  In D29006#662094 <https://phabricator.kde.org/D29006#662094>, @dfaure wrote:
  
  > Actually, wait, I vote against Ctrl+F5 <https://phabricator.kde.org/F5>/Ctrl+F6 because these shortcuts, by default, in Plasma, are bound to "Switch to Desktop 5" and "Switch to Desktop 6".
  >
  > Shift+F5 <https://phabricator.kde.org/F5>/F6 would be much better, if it's available.
  >
  > Meven: drag-n-drop is 'easy' but it requires using the mouse. For accessibility, or for people stuck on a plane with a bad touchpad and no room for a real mouse, or simply for maximum performance in optimized workflows, I can see the benefit of keyboard shortcuts.
  >
  > Just not if they switch desktops inadvertently, once you configure 6+ virtual desktops :-)
  
  
  `Shift+F5/F6` seems to bee free. So we could go with that.

INLINE COMMENTS

> meven wrote in dolphinmainwindow.cpp:1993
> This is not sufficient, you can copy or move to `recentlyused:/files/` for instance, which fails.
> So test the other view url to see if it is writable as well.

I'm trying to add a check and it only doesn't work only on this kind of folders. Works fine with local and samba share. See diff:

  diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
  index 428c61952..5e7c56385 100644
  --- a/src/dolphinmainwindow.cpp
  +++ b/src/dolphinmainwindow.cpp
  @@ -1959,7 +1959,7 @@ void DolphinMainWindow::updateFileAndEditActions()
   {
       const KFileItemList list = m_activeViewContainer->view()->selectedItems();
       const KActionCollection* col = actionCollection();
  -    KFileItemListProperties capabilities(list);
  +    KFileItemListProperties capabilitiesSource(list);
   
       QAction* addToPlacesAction = col->action(QStringLiteral("add_to_places"));
       QAction* copyToOtherViewAction   = col->action(QStringLiteral("copy_to_other_split_view"));
  @@ -1989,22 +1989,31 @@ void DolphinMainWindow::updateFileAndEditActions()
           }
   
           if (m_tabWidget->currentTabPage()->splitViewEnabled()) {
  -            copyToOtherViewAction->setEnabled(true);
  -            moveToOtherViewAction->setEnabled(capabilities.supportsMoving());
  +            DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
  +            KFileItem capabilitiesDestination;
  +
  +            if (tabPage->primaryViewActive()) {
  +                capabilitiesDestination = tabPage->secondaryViewContainer()->url();
  +            } else {
  +                capabilitiesDestination = tabPage->primaryViewContainer()->url();
  +            }
  +
  +            copyToOtherViewAction->setEnabled(capabilitiesDestination.isWritable());
  +            moveToOtherViewAction->setEnabled(capabilitiesSource.supportsMoving() && capabilitiesDestination.isWritable());
           } else {
               copyToOtherViewAction->setEnabled(false);
               moveToOtherViewAction->setEnabled(false);
           }
   
  -        const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
  +        const bool enableMoveToTrash = capabilitiesSource.isLocal() && capabilitiesSource.supportsMoving();
   
  -        renameAction->setEnabled(capabilities.supportsMoving());
  +        renameAction->setEnabled(capabilitiesSource.supportsMoving());
           moveToTrashAction->setEnabled(enableMoveToTrash);
  -        deleteAction->setEnabled(capabilities.supportsDeleting());
  -        deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash);
  -        cutAction->setEnabled(capabilities.supportsMoving());
  +        deleteAction->setEnabled(capabilitiesSource.supportsDeleting());
  +        deleteWithTrashShortcut->setEnabled(capabilitiesSource.supportsDeleting() && !enableMoveToTrash);
  +        cutAction->setEnabled(capabilitiesSource.supportsMoving());
           showTarget->setEnabled(list.length() == 1 && list.at(0).isLink());
  -        duplicateAction->setEnabled(capabilities.supportsWriting());
  +        duplicateAction->setEnabled(capabilitiesSource.supportsWriting());
       }
   }

REPOSITORY
  R318 Dolphin

REVISION DETAIL
  https://phabricator.kde.org/D29006

To: aprcela, #dolphin, elvisangelaccio, ngraham, meven, dfaure
Cc: yurchor, kde-doc-english, dfaure, meven, kfm-devel, azyx, nikolaik, pberestov, iasensio, aprcela, fprice, gennad, fbampaloukas, alexde, Codezela, feverfew, spoorun, navarromorales, firef, ngraham, andrebarros, skadinna, emmanuelp, rdieter, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20200503/6cad58ef/attachment.htm>


More information about the kfm-devel mailing list