Index: mythcontrols/keygrabber.h
===================================================================
--- mythcontrols/keygrabber.h	(revision 11558)
+++ mythcontrols/keygrabber.h	(working copy)
@@ -25,7 +25,6 @@
 // MythTV headers
 #include <mythtv/mythdialogs.h>
 
-
 /** \class KeyGrabPopupBox
  *  \brief Captures a key.
  *
@@ -94,7 +93,7 @@
     Q_OBJECT
 
   public:
-    enum actions { kSave, kCancel, };
+    enum actions { kSave, kChangeView, kCancel, };
 
     /// \brief Create a new action window. Does not pop-up menu.
     OptionsMenu(MythMainWindow *window);
@@ -103,8 +102,9 @@
     int GetOption(void) { return ExecPopup(this,SLOT(Cancel())); }
 
   public slots:
-    void Save(void)     { done(OptionsMenu::kSave);   }
-    void Cancel(void)   { done(OptionsMenu::kCancel); }
+    void Save(void)			{ done(OptionsMenu::kSave);   }
+    void ChangeView(void)	{ done(OptionsMenu::kChangeView); }
+    void Cancel(void)		{ done(OptionsMenu::kCancel); }
 };
 
 
Index: mythcontrols/mythcontrols.cpp
===================================================================
--- mythcontrols/mythcontrols.cpp	(revision 11558)
+++ mythcontrols/mythcontrols.cpp	(working copy)
@@ -37,8 +37,8 @@
 #include <mythtv/mythdialogs.h>
 
 // MythControls headers
+#include "keygrabber.h"
 #include "mythcontrols.h"
-#include "keygrabber.h"
 
 static QString key_to_display(const QString &key);
 static QString display_to_key(const QString &key);
@@ -53,11 +53,11 @@
  */
 MythControls::MythControls(MythMainWindow *parent, bool &ok)
     : MythThemedDialog(parent, "controls", "controls-", "controls"),
-      m_focusedUIElement(NULL),
+      m_currentView(kActionsByContext), m_focusedUIElement(NULL),
       m_leftList(NULL),        m_rightList(NULL),
       m_description(NULL),
       m_leftDescription(NULL), m_rightDescription(NULL),
-      m_bindings(NULL),     m_container(NULL)
+      m_bindings(NULL),     m_container(NULL)      
 {
     bzero(m_actionButtons, sizeof(void*) * Action::kMaximumNumberOfBindings);
     m_contexts.setAutoDelete(true);
@@ -221,6 +221,75 @@
     RefreshKeyInformation();
 }
 
+/// \brief Chagne the view.
+void MythControls::ChangeView(void)
+{
+    ViewMenu popup(gContext->GetMainWindow(), m_currentView);
+
+    switch(popup.GetOption())
+    {
+    case ViewMenu::kContextAction:
+        m_currentView = kActionsByContext;
+
+        if ((m_leftListType  != kContextList) ||
+            (m_rightListType != kActionList))
+        {
+            m_leftListType  = kContextList;
+            m_rightListType = kActionList;
+            UpdateLists();
+            
+            if (m_focusedUIElement != m_leftList)
+            {
+                ChangeListFocus(m_leftList,
+                                (m_focusedUIElement == m_rightList) ?
+                                m_rightList : NULL);
+            }
+        }
+        break;
+    case ViewMenu::kContextKey:
+
+        m_currentView = kKeysByContext;
+
+        if ((m_leftListType  != kContextList) ||
+            (m_rightListType != kKeyList))
+        {
+            m_leftListType  = kContextList;
+            m_rightListType = kKeyList;
+            UpdateLists();
+
+            if (m_focusedUIElement != m_leftList)
+            {
+                ChangeListFocus(m_leftList,
+                                (m_focusedUIElement == m_rightList) ?
+                                m_rightList : NULL);
+            }
+        }
+        break;
+    case ViewMenu::kKeyContext:
+
+        m_currentView = kContextsByKey;
+
+        if ((m_leftListType  != kKeyList) ||
+            (m_rightListType != kContextList))
+        {
+            m_leftListType  = kKeyList;
+            m_rightListType = kContextList;
+            UpdateLists();
+
+            if (m_focusedUIElement != m_leftList)
+            {
+                ChangeListFocus(m_leftList,
+                                (m_focusedUIElement == m_rightList) ?
+                                m_rightList : NULL);
+            }
+        }
+        break;
+    default:
+        break;
+    }
+}
+
+
 void MythControls::keyPressEvent(QKeyEvent *e)
 {
     bool handled = false;
@@ -238,9 +307,18 @@
             m_focusedUIElement->looseFocus();
 
             OptionsMenu popup(gContext->GetMainWindow());
-            if (OptionsMenu::kSave == popup.GetOption())
-                Save();
 
+            switch (popup.GetOption())
+            {
+            case OptionsMenu::kSave: Save();
+                break;
+            case OptionsMenu::kChangeView:
+                ChangeView();
+                break;
+            default:
+                break;
+            }
+
             m_focusedUIElement->takeFocus();
         }
         else if (action == "SELECT")
@@ -327,69 +405,6 @@
             else if (m_focusedUIElement == m_rightList)
                 m_rightList->MoveDown(UIListBtnType::MovePage);
         }
-        else if (action == "1")
-        {
-            if ((m_leftListType  != kContextList) ||
-                (m_rightListType != kActionList))
-            {
-                m_leftListType  = kContextList;
-                m_rightListType = kActionList;
-                UpdateLists();
-
-                if (m_focusedUIElement != m_leftList)
-                {
-                    ChangeListFocus(m_leftList,
-                                    (m_focusedUIElement == m_rightList) ?
-                                    m_rightList : NULL);
-                }
-            }
-            else
-            {
-                handled = false;
-            }
-        }
-        else if (action == "2")
-        {
-            if ((m_leftListType  != kContextList) ||
-                (m_rightListType != kKeyList))
-            {
-                m_leftListType  = kContextList;
-                m_rightListType = kKeyList;
-                UpdateLists();
-
-                if (m_focusedUIElement != m_leftList)
-                {
-                    ChangeListFocus(m_leftList,
-                                    (m_focusedUIElement == m_rightList) ?
-                                    m_rightList : NULL);
-                }
-            }
-            else
-            {
-                handled = false;
-            }
-        }
-        else if (action == "3")
-        {
-            if ((m_leftListType  != kKeyList) ||
-                (m_rightListType != kContextList))
-            {
-                m_leftListType  = kKeyList;
-                m_rightListType = kContextList;
-                UpdateLists();
-
-                if (m_focusedUIElement != m_leftList)
-                {
-                    ChangeListFocus(m_leftList,
-                                    (m_focusedUIElement == m_rightList) ?
-                                    m_rightList : NULL);
-                }
-            }
-            else
-            {
-                handled = false;
-            }
-        }
         else
         {
             handled = false;
@@ -846,43 +861,13 @@
         return;
     }
 
-    BindingList *list = m_keyToBindingsMap[key];
-    Binding *binding = NULL;
+    ConfirmMenu popup(gContext->GetMainWindow(), tr("Delete this binding?"));
 
-    for (BindingList::iterator it = list->begin(); it != list->end(); ++it)
-    {
-        Binding *b = *it;
-        if (b->context == context)
-            binding = b;
-    }
-
-    if (!binding)
-    {
-        InvalidBindingPopup popup(gContext->GetMainWindow());
-        popup.GetOption();
+    if (popup.GetOption() != ConfirmMenu::kConfirm)
         return;
-    }
 
-    if (binding->contextFrom != context)
+    if (!m_bindings->RemoveActionKey(context, action, key))
     {
-        ConfirmMenu popup(gContext->GetMainWindow(),
-                          tr("Delete this key binding from context %1?")
-                          .arg(binding->contextFrom));
-
-        if (popup.GetOption() != ConfirmMenu::kConfirm)
-            return;
-    }
-    else
-    {
-        ConfirmMenu popup(gContext->GetMainWindow(),
-                          tr("Delete this binding?"));
-
-        if (popup.GetOption() != ConfirmMenu::kConfirm)
-            return;
-    }
-
-    if (!m_bindings->RemoveActionKey(binding->contextFrom, action, key))
-    {
         InvalidBindingPopup popup(gContext->GetMainWindow());
         popup.GetOption();
         return;
@@ -1204,4 +1189,32 @@
     return key;
 }
 
+/** \brief Create the view menu.
+ *  \param window The main window.
+ *  \param current The current view type.
+ */
+ViewMenu::ViewMenu(MythMainWindow *window, ViewType current)
+    : MythPopupBox(window, "mcviewmenu")
+{
+    addLabel(tr("Change View"), Large, false);
+
+    switch(current)
+    {
+    case kKeysByContext:
+        addButton(tr("Actions By Context"),	this,	SLOT(ActionsByContext()));
+        addButton(tr("Contexts By Key"),	this,	SLOT(ContextsByKey()));
+        break;
+    case kContextsByKey:
+        addButton(tr("Actions By Context"),	this,	SLOT(ActionsByContext()));
+        addButton(tr("Keys By Context"),	this,	SLOT(KeysByContext()));
+        break;
+    default:
+        addButton(tr("Keys By Context"),	this,	SLOT(KeysByContext()));
+        addButton(tr("Contexts By Key"),	this,	SLOT(ContextsByKey()));
+        break;  
+    }
+
+    addButton(tr("Cancel"), this, SLOT(Cancel()))->setFocus();
+}
+
 /* vim: set expandtab tabstop=4 shiftwidth=4: */
Index: mythcontrols/mythcontrols.h
===================================================================
--- mythcontrols/mythcontrols.h	(revision 11558)
+++ mythcontrols/mythcontrols.h	(working copy)
@@ -29,6 +29,40 @@
 
 #include "keybindings.h"
 
+
+typedef enum { kActionsByContext, kKeysByContext, kContextsByKey} ViewType;
+
+/** \class ViewMenu
+ *  \brief Prompts the user to change the view.
+ */
+class ViewMenu : public MythPopupBox
+{
+    Q_OBJECT
+
+public:
+
+    /// \brief The available views
+    enum actions { kContextAction, kContextKey, kKeyContext, kCancel};
+
+    /** \brief Creates a new view dialog box.
+     *  \param window The main MythTV window.
+     *  \param first The first button's caption
+     *  \param second The second button's caption
+     */
+    ViewMenu(MythMainWindow *window, ViewType current);
+
+    /// \brief Execute the option popup.
+    int GetOption(void) { return ExecPopup(this,SLOT(Cancel())); }
+
+public slots:
+
+    void ActionsByContext(void)	{ done(ViewMenu::kContextAction); }
+    void KeysByContext(void)	{ done(ViewMenu::kContextKey); }
+    void ContextsByKey(void)	{ done(ViewMenu::kKeyContext); }
+    void Cancel(void)			{ done(ViewMenu::kCancel); }
+};
+
+
 class Binding
 {
   public:
@@ -83,6 +117,7 @@
     void    LoadData(const QString &hostname);
     void    ChangeButtonFocus(int direction);
     void    ChangeListFocus(UIListBtnType *focus, UIListBtnType *unfocus);
+    void	ChangeView(void);
     void    AddBindings(QDict<Binding> &bindings, const QString &context,
                         const QString &contextParent, int bindlevel);
 
@@ -106,6 +141,7 @@
     void Save(void) { m_bindings->CommitChanges(); }
 
   private:
+    ViewType           m_currentView;
     UIType            *m_focusedUIElement;
     UIListBtnType     *m_leftList;
     UIListBtnType     *m_rightList;
Index: mythcontrols/controls-ui.xml
===================================================================
--- mythcontrols/controls-ui.xml	(revision 11558)
+++ mythcontrols/controls-ui.xml	(working copy)
@@ -46,20 +46,14 @@
   <container name="controls">
    <area>20,20,780,450</area>
 
-   <textarea name="options" draworder="1" align="center">
-    <font>options</font>
-    <area>0,0,780,30</area>
-    <value>(1) Contexts / Actions  (2) Contexts / Keys  (3) Keys / Contexts</value>
-   </textarea>
-
    <textarea name="leftdesc" draworder="1" align="center">
     <font>info</font>
-    <area>0,40,370,20</area>
+    <area>0,0,370,20</area>
     <value>Contexts</value>
    </textarea>
 
    <listbtnarea name="leftlist" draworder="0">
-    <area>0,60,370,380</area>
+    <area>0,30,370,420</area>
     <gradient type="unselected" start="#505050" end="#000000" alpha="100"/>
     <gradient type="selected" start="#52CA38" end="#349838" alpha="255"/>
     <fcnfont name="active" function="active"/>
@@ -69,12 +63,12 @@
 
    <textarea name="rightdesc" draworder="1" align="center">
     <font>info</font>
-    <area>390,40,370,20</area>
+    <area>390,0,370,20</area>
     <value>Actions</value>
    </textarea>
 
    <listbtnarea name="rightlist" draworder="0">
-    <area>390,60,370,380</area>
+    <area>390,30,370,420</area>
     <gradient type="unselected" start="#505050" end="#000000" alpha="100"/>
     <gradient type="selected" start="#52CA38" end="#349838" alpha="255"/>
     <fcnfont name="active" function="active"/>
Index: mythcontrols/keygrabber.cpp
===================================================================
--- mythcontrols/keygrabber.cpp	(revision 11558)
+++ mythcontrols/keygrabber.cpp	(working copy)
@@ -126,6 +126,7 @@
 {
     addLabel(tr("Options"), Large, false);
     addButton(QObject::tr("Save"),   this, SLOT(Save()));
+    addButton(QObject::tr("Change View"), this, SLOT(ChangeView()));
     addButton(QObject::tr("Cancel"), this, SLOT(Cancel()))->setFocus();
 }
     
