Commit dd0b3d85 authored by David Faure's avatar David Faure
Browse files

Optimize KShortcutsEditorItem::keySequence using two lambdas

No point in calling KGlobalAccel API if we're not going to use it.
parent 3e22519f
......@@ -164,21 +164,22 @@ bool KShortcutsEditorItem::operator<(const QTreeWidgetItem &other) const
QKeySequence KShortcutsEditorItem::keySequence(uint column) const
{
QList<QKeySequence> shortcuts = m_action->shortcuts();
auto shortcuts = [this]() { return m_action->shortcuts(); };
#if HAVE_GLOBALACCEL
QList<QKeySequence> globalShortcuts = KGlobalAccel::self()->shortcut(m_action);
auto globalShortcuts = [this]() { return KGlobalAccel::self()->shortcut(m_action); };
#endif
switch (column) {
case LocalPrimary:
return primarySequence(shortcuts);
return primarySequence(shortcuts());
case LocalAlternate:
return alternateSequence(shortcuts);
return alternateSequence(shortcuts());
#if HAVE_GLOBALACCEL
case GlobalPrimary:
return primarySequence(globalShortcuts);
return primarySequence(globalShortcuts());
case GlobalAlternate:
return alternateSequence(globalShortcuts);
return alternateSequence(globalShortcuts());
#endif
default:
return QKeySequence();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment