diff options
author | Juergen Funk <juergen.funk_ml@cib.de> | 2023-02-15 12:02:31 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-03-20 11:37:04 +0000 |
commit | c6dffdf014127af23b0b20b1015a4b6fdf0e1ac9 (patch) | |
tree | f9e7d09b860561e27763c0000bc89e889d4bee47 /framework | |
parent | 770eea32b68a95e493a86a97eba5003c46ed736b (diff) |
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>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/accelerators/acceleratorcache.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/framework/source/accelerators/acceleratorcache.cxx b/framework/source/accelerators/acceleratorcache.cxx index 342b9701f99d..0163654d4bf7 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) |