D11048: Convert hard coded shortcuts to standard keys

Elvis Angelaccio noreply at phabricator.kde.org
Sat Mar 10 16:24:15 GMT 2018


elvisangelaccio added a comment.


  What I said in D11012 <https://phabricator.kde.org/D11012> applies also here: commit message should be more descriptive.

INLINE COMMENTS

> dolphincontextmenu.cpp:220
>              // insert 'Open in new window' and 'Open in new tab' entries
> -            addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window")));
> +            addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::New)));
>              addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tab")));

This is a different action, please revert.

> dolphincontextmenu.cpp:253
>              // insert 'Open in new window' and 'Open in new tab' entries
> -            addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window")));
> +            addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::New)));
>              addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tab")));

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

> dolphinmainwindow.cpp:837
>                   addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Find)), menu) |
> -                 addActionToMenu(ac->action(QStringLiteral("select_all")), menu) |
> +                 addActionToMenu(ac->action(KStandardAction::name(KStandardAction::SelectAll)), menu) |
>                   addActionToMenu(ac->action(QStringLiteral("invert_selection")), menu);

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.

> dolphinmainwindow.cpp:970
>      const bool enableTabActions = (count > 1);
> -    actionCollection()->action(QStringLiteral("close_tab"))->setEnabled(enableTabActions);
> +    actionCollection()->action(KStandardAction::name(KStandardAction::Close))->setEnabled(enableTabActions);
>      actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions);

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

> dolphinmainwindow.cpp:1048
>  
> -    QAction* newWindow = actionCollection()->addAction(QStringLiteral("new_window"));
> -    newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
> +    QAction* newWindow = KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow, actionCollection());
>      newWindow->setText(i18nc("@action:inmenu File", "New &Window"));

Please replace `new_window` with `file_new` in `dolphinui.rc`.

> dolphinmainwindow.cpp:1103-1107
>      QAction* reload = actionCollection()->addAction(QStringLiteral("reload"));
>      reload->setText(i18nc("@action:inmenu View", "Reload"));
> -    actionCollection()->setDefaultShortcut(reload, Qt::Key_F5);
> +    actionCollection()->setDefaultShortcuts(reload, KStandardShortcut::reload());
>      reload->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
>      connect(reload, &QAction::triggered, this, &DolphinMainWindow::reloadView);

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

> dolphinpart.cpp:183
>  
>      actionCollection()->addAction(KStandardAction::SelectAll, QStringLiteral("select_all"), m_view, SLOT(selectAll()));
>  

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

REPOSITORY
  R318 Dolphin

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

To: rominf, #dolphin, rizzitello, elvisangelaccio
Cc: ngraham, elvisangelaccio, rizzitello, #dolphin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180310/5dd0db82/attachment.htm>


More information about the kfm-devel mailing list