Convert hard coded shortcuts to standard keys
ClosedPublic

Authored by rominf on Mar 5 2018, 10:11 AM.

Details

Test Plan

Check all changed shortcuts on all platforms.

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.
rominf requested review of this revision.Mar 5 2018, 10:11 AM
rominf created this revision.
rizzitello requested changes to this revision.Mar 5 2018, 12:47 PM
rizzitello added a subscriber: rizzitello.
rizzitello added inline comments.
src/dolphinmainwindow.cpp
1077

QKeySequence::AddTab == Ctrl + T .
Do we want to always force Crtl+T for new tab or only the set KeySequence?

1108

This is the default for QKeySequence::Deselect. If this is used in other Kapplications this could create an inconsistency in a common action. Maybe we can come up with a different shortcut for this? Crtl+I is common or Ctrl + Shift + I . Personally I am not fond of using another letter maybe ctrl+alt+ A ?

This revision now requires changes to proceed.Mar 5 2018, 12:47 PM
rominf added inline comments.Mar 5 2018, 5:39 PM
src/dolphinmainwindow.cpp
1077

As written in https://doc.qt.io/qt-5/qkeysequence.html#details QKeySequence::AddTab = Ctrl+T for all DE, except KDE (Ctrl++N; Ctrl+T). But in practice, only the first sequence (Ctrl++N) works. In my opinion Ctrl+T should work for KDE too, hence the code.

rizzitello added inline comments.Mar 5 2018, 6:12 PM
src/dolphinmainwindow.cpp
1077

I agree that Ctrl+T should be our main shortcut. This looks like a work around for a Qt bug now so I get why we are sending both. Maybe we should talk with Qt about resolving this bug?

rominf added inline comments.Mar 5 2018, 7:51 PM
src/dolphinmainwindow.cpp
1077

I'm not sure that it's Qt bug. It can be the bug of kxmlgui (actionCollection()->setDefaultShortcut()). I wanted to verify this, but couldn't build it on my openSUSE, because it has extra-cmake-modules version 5.43, while kxmlgui requires 5.44.

If you have a chance, please, try it.

elvisangelaccio requested changes to this revision.Mar 5 2018, 9:20 PM
elvisangelaccio added a subscriber: elvisangelaccio.
elvisangelaccio added inline comments.
src/dolphinmainwindow.cpp
1072–1073

Please use KStandardAction::New for consistency with other KDE apps.

1102–1103

Please use KStandardAction::SelectAll.

1126–1127

Please use KStandardAction::Redisplay.

src/dolphinpart.cpp
220–221

Please use KStandardAction::Find.

rizzitello added inline comments.Mar 5 2018, 9:24 PM
src/dolphinmainwindow.cpp
1077

I was not able to build with kxmlgui 5.44 . I did test a non kxmlgui application using QKeySequence::AddTab and it seams for KDE crtl+t does not trigger the action.

rizzitello added inline comments.Mar 5 2018, 9:57 PM
src/dolphinmainwindow.cpp
1077

I have created a Bug Report for the QKeysequence problem

rominf marked 6 inline comments as done.Mar 6 2018, 7:03 AM
rominf added inline comments.
src/dolphinmainwindow.cpp
1072–1073

It stopped to work after I made this change.

rominf updated this revision to Diff 28840.Mar 6 2018, 3:51 PM
  • Replace standard QKeySequence with KStandardShortcut
rizzitello added inline comments.Mar 7 2018, 12:42 PM
src/dolphinpart.cpp
188

should a shortcut be set for this action?

rominf added inline comments.Mar 7 2018, 2:15 PM
src/dolphinpart.cpp
188

I don't know. I just unhardcoded (softcoded?) shortcuts

ngraham added a subscriber: ngraham.Mar 7 2018, 2:37 PM
ngraham added inline comments.
src/dolphinpart.cpp
188

Whether or not this action should get a shortcut (I think it should!) Is unrelated to this patch and should be handled separately. But in fact I don't even see it exposed in the UI at all...

src/dolphinmainwindow.cpp
1072–1073

How did you do it? Did you use KStandardAction::openNew()? Have a look at dolphinviewactionhandler.cpp where we create some KStandardActions.

rominf updated this revision to Diff 28992.Mar 8 2018, 8:57 AM

Converted to KStandardAction

rominf marked 8 inline comments as done.Mar 8 2018, 8:58 AM
rominf added inline comments.
src/dolphinmainwindow.cpp
1072–1073

OK. Done. Please review.

rominf marked 2 inline comments as done.Mar 8 2018, 8:58 AM
rizzitello accepted this revision.Mar 9 2018, 2:48 AM

All actions worked as before but now using standard keys.

What I said in D11012 applies also here: commit message should be more descriptive.

src/dolphincontextmenu.cpp
220 ↗(On Diff #28992)

This is a different action, please revert.

253 ↗(On Diff #28992)

Same. This is a different action, please revert the change.

src/dolphinmainwindow.cpp
861

We also need to replace select_all with edit_select_all (which is the name from kstandardaction) in dolphinui.rc, otherwise the action won't show up in the Edit menu.

994

Same: please replace close_tab with file_close in dolphinui.rc.

1071

Please replace new_window with file_new in dolphinui.rc.

1126–1127

This should be ported to KStandardAction::redisplay().

src/dolphinpart.cpp
183

Please port to KStandardAction::selectAll() also here.

rominf updated this revision to Diff 29189.Mar 10 2018, 8:25 PM
rominf marked 8 inline comments as done.
  • Fixes from comments
rominf planned changes to this revision.Mar 10 2018, 8:25 PM
anthonyfieroni added inline comments.
src/dolphinui.rc
2

You should increase version to 18

rominf updated this revision to Diff 29190.Mar 10 2018, 8:38 PM
  • dolphinui.rc version bump
rominf planned changes to this revision.Mar 10 2018, 8:38 PM
rominf marked an inline comment as done.Mar 11 2018, 10:01 AM
rominf updated this revision to Diff 29480.Mar 14 2018, 10:09 AM
  • Close action: "Close" -> "Close Tab"
elvisangelaccio accepted this revision.Apr 8 2018, 3:05 PM
This revision is now accepted and ready to land.Apr 8 2018, 3:05 PM
This revision was automatically updated to reflect the committed changes.