Fix removing original accelerators that are before a new accelerator (fix #1104)

This commit is contained in:
David Capello 2016-05-02 13:03:04 -03:00
parent 918acb6bc8
commit 00c7cb7e54

View File

@ -86,14 +86,19 @@ private:
this->window()->layout();
}
void onDeleteAccel(int index)
{
if (Alert::show("Warning"
"<<Do you really want to delete this keyboard shortcut?"
"||&Yes||&No") != 1)
void onDeleteAccel(int index) {
// We need to create a copy of the accelerator because
// Key::disableAccel() will modify the accels() collection itself.
ui::Accelerator accel = m_key->accels()[index];
if (Alert::show(
"Warning"
"<<Do you really want to delete '%s' keyboard shortcut?"
"||&Yes||&No",
accel.toString().c_str()) != 1)
return;
m_key->disableAccel(m_key->accels()[index]);
m_key->disableAccel(accel);
window()->layout();
}