tdf#153587 If one of the multiple shortcuts is deleted,
the next one is not displayed
This patch solve the part 2 of the bug, the problem was
that it did not take into account whether a command was assigned
multiple keys, it simply deleted the whole command
Change-Id: I4e09096d3bc112ed49a4210dd294d1acf7a48159
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147093
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
diff --git a/framework/source/accelerators/acceleratorcache.cxx b/framework/source/accelerators/acceleratorcache.cxx
index 342b970..0163654 100644
--- a/framework/source/accelerators/acceleratorcache.cxx
+++ b/framework/source/accelerators/acceleratorcache.cxx
@@ -90,8 +90,23 @@ void AcceleratorCache::removeKey(const css::awt::KeyEvent& aKey)
// remove key from primary list
m_lKey2Commands.erase(aKey);
// remove key from optimized command list
m_lCommand2Keys.erase(sCommand);
// get keylist for that command
TCommand2Keys::iterator pCommand = m_lCommand2Keys.find(sCommand);
if (pCommand == m_lCommand2Keys.end())
return;
TKeyList& lKeys = pCommand->second;
// one or more keys assign
if (lKeys.size() == 1)
// remove key from optimized command list
m_lCommand2Keys.erase(sCommand);
else // only remove this key from the keylist
{
auto pKeys = ::std::find(lKeys.begin(), lKeys.end(), aKey);
if (pKeys != lKeys.end())
lKeys.erase(pKeys);
}
}
void AcceleratorCache::removeCommand(const OUString& sCommand)