Make sure we always have Shift+Del as shortcut
ClosedPublic

Authored by elvisangelaccio on Sep 2 2017, 2:35 PM.

Details

Summary

After commit 68bb0ec22a the shortcut for the Delete action is not
necessarily Shift+Del, but whatever the user set in System Setting.
However DolphinRemoveAction assumes/hardcodes Shift+Del, so we should
always make sure we have this shortcut around, for consistency.

We just need to append it (if necessary) to the list of shortcuts of the
action. (Note that we *don't* prepend it, otherwise it would override a
custom primary shortcut in the 'Configure Shortcuts' dialog).

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
elvisangelaccio created this revision.Sep 2 2017, 2:35 PM
Restricted Application added a subscriber: Konqueror. · View Herald TranscriptSep 2 2017, 2:35 PM
elvisangelaccio planned changes to this revision.Sep 5 2017, 8:36 AM

Not enough, I think we should also explicitly show "Shift+Del" in the context menu action.

markg added a subscriber: markg.Sep 5 2017, 3:43 PM

Imho, it should just use the one set in system settings. Not hardcode anything besides perhaps a default one if nothing has been set.

In D7655#143234, @markg wrote:

Imho, it should just use the one set in system settings. Not hardcode anything besides perhaps a default one if nothing has been set.

This would be very hard to implement, unfortunately. What if the custom shortcut is not a "Modifier+Key" type of shortcut?
We can leave it as TODO for the future, but in the meantime I'd just fix the regression.

  • Always show Shift+Del when pressing Shift in the context menu
emmanuelp edited edge metadata.Sep 6 2017, 9:14 PM

Hmm I don't think that we should add additional shortcuts to user-defined shortcuts. What if the user assigned {Shift, Del} to something different?

Maybe:

  1. If shortcuts of move_to_trash (A) is a proper subset of the shortcuts of delete (B) -> use the keys of B\A to select the actual behavior of the remove action (in the default configuration B\A is equal to {Shift})
  2. Else show both the move_to_trashand the delete action instead of the remove action

But I think this is too complicated and error-prone ...

Would it be possible to add constraints to the shortcut settings dialog? Maybe that delete is always a user selectable modifier key + shortcuts of move to trash?

elvisangelaccio planned changes to this revision.Sep 7 2017, 8:26 PM

Hmm I don't think that we should add additional shortcuts to user-defined shortcuts. What if the user assigned {Shift, Del} to something different?

Maybe:

  1. If shortcuts of move_to_trash (A) is a proper subset of the shortcuts of delete (B) -> use the keys of B\A to select the actual behavior of the remove action (in the default configuration B\A is equal to {Shift})
  2. Else show both the move_to_trashand the delete action instead of the remove action

    But I think this is too complicated and error-prone ...

    Would it be possible to add constraints to the shortcut settings dialog? Maybe that delete is always a user selectable modifier key + shortcuts of move to trash?

This could be done in KShortcutsEditor, yes. It would be a good solution, I'll give it a shot...

Hmm I don't think that we should add additional shortcuts to user-defined shortcuts. What if the user assigned {Shift, Del} to something different?

Maybe:

  1. If shortcuts of move_to_trash (A) is a proper subset of the shortcuts of delete (B) -> use the keys of B\A to select the actual behavior of the remove action (in the default configuration B\A is equal to {Shift})
  2. Else show both the move_to_trashand the delete action instead of the remove action

    But I think this is too complicated and error-prone ...

    Would it be possible to add constraints to the shortcut settings dialog? Maybe that delete is always a user selectable modifier key + shortcuts of move to trash?

This could be done in KShortcutsEditor, yes. It would be a good solution, I'll give it a shot...

Meh, that's a very complex codebase. I don't really feel like touching it for something that would be useful only for Dolphin.

So here's what we can do:

  1. Revert to the old behavior of hardcoding Shift+Del and Del, ignoring the user-defined shortucts.
  2. Drop DolphinRemoveAction and just show both actions in the context menu.
  3. This patch.

I'd avoid 2) because we would lose a nice feature and increase clutter in the context menu.

emmanuelp accepted this revision.Sep 11 2017, 1:58 PM
  1. This patch.

+1. Thanks for taking a look at the shortcuts editor.

This revision was automatically updated to reflect the committed changes.