Ticket #2078: fix_remove.diff

File fix_remove.diff, 1.5 KB (added by mfgalizi, 15 years ago)

Uses the correct context when removing keys from an action.

  • mythcontrols/mythcontrols.cpp

     
    846846        return;
    847847    }
    848848
    849     BindingList *list = m_keyToBindingsMap[key];
    850     Binding *binding = NULL;
     849    ConfirmMenu popup(gContext->GetMainWindow(), tr("Delete this binding?"));
    851850
    852     for (BindingList::iterator it = list->begin(); it != list->end(); ++it)
    853     {
    854         Binding *b = *it;
    855         if (b->context == context)
    856             binding = b;
    857     }
    858 
    859     if (!binding)
    860     {
    861         InvalidBindingPopup popup(gContext->GetMainWindow());
    862         popup.GetOption();
     851    if (popup.GetOption() != ConfirmMenu::kConfirm)
    863852        return;
    864     }
    865853
    866     if (binding->contextFrom != context)
     854    if (!m_bindings->RemoveActionKey(context, action, key))
    867855    {
    868         ConfirmMenu popup(gContext->GetMainWindow(),
    869                           tr("Delete this key binding from context %1?")
    870                           .arg(binding->contextFrom));
    871 
    872         if (popup.GetOption() != ConfirmMenu::kConfirm)
    873             return;
    874     }
    875     else
    876     {
    877         ConfirmMenu popup(gContext->GetMainWindow(),
    878                           tr("Delete this binding?"));
    879 
    880         if (popup.GetOption() != ConfirmMenu::kConfirm)
    881             return;
    882     }
    883 
    884     if (!m_bindings->RemoveActionKey(binding->contextFrom, action, key))
    885     {
    886856        InvalidBindingPopup popup(gContext->GetMainWindow());
    887857        popup.GetOption();
    888858        return;