aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiff <spiff@xbmc.org>2011-10-28 14:28:05 +0200
committerspiff <spiff@xbmc.org>2011-10-28 14:29:55 +0200
commit4c32cdeb142fe8d0cb26729769fc71647174a8c3 (patch)
treedce0b5c87f4015f78ce0b4c21c5c85613938a6c6
parent62573256432d5efeefaf724c018e902b4072c1c6 (diff)
fixed: unable to reset a single add-on settings back to default. use delete
-rw-r--r--system/keymaps/keyboard.xml5
-rw-r--r--system/keymaps/remote.xml5
-rw-r--r--xbmc/addons/GUIDialogAddonSettings.cpp28
-rw-r--r--xbmc/addons/GUIDialogAddonSettings.h1
4 files changed, 39 insertions, 0 deletions
diff --git a/system/keymaps/keyboard.xml b/system/keymaps/keyboard.xml
index 3c4a65d286..7c1d034d14 100644
--- a/system/keymaps/keyboard.xml
+++ b/system/keymaps/keyboard.xml
@@ -467,4 +467,9 @@
<i>Back</i>
</keyboard>
</AddonInformation>
+ <AddonSettings>
+ <keyboard>
+ <delete>Delete</delete>
+ </keyboard>
+ </AddonSettings>
</keymap>
diff --git a/system/keymaps/remote.xml b/system/keymaps/remote.xml
index a846383541..2a9ab3cf45 100644
--- a/system/keymaps/remote.xml
+++ b/system/keymaps/remote.xml
@@ -388,4 +388,9 @@
<teletext>Back</teletext>
</remote>
</Teletext>
+ <AddonSettings>
+ <remote>
+ <clear>Delete</clear>
+ </remote>
+ </AddonSettings>
</keymap>
diff --git a/xbmc/addons/GUIDialogAddonSettings.cpp b/xbmc/addons/GUIDialogAddonSettings.cpp
index e0a878f599..2b5043ce70 100644
--- a/xbmc/addons/GUIDialogAddonSettings.cpp
+++ b/xbmc/addons/GUIDialogAddonSettings.cpp
@@ -130,6 +130,34 @@ bool CGUIDialogAddonSettings::OnMessage(CGUIMessage& message)
return CGUIDialogBoxBase::OnMessage(message);
}
+bool CGUIDialogAddonSettings::OnAction(const CAction& action)
+{
+ if (action.GetID() == ACTION_DELETE_ITEM)
+ {
+ int iControl = GetFocusedControl()->GetID();
+ int controlId = CONTROL_START_SETTING;
+ const TiXmlElement* setting = GetFirstSetting();
+ UpdateFromControls();
+ while (setting)
+ {
+ if (controlId == iControl)
+ {
+ const char* id = setting->Attribute("id");
+ const char* value = setting->Attribute("default");
+ m_settings[id] = value;
+ CreateControls();
+ CGUIMessage msg(GUI_MSG_SETFOCUS,GetID(),iControl);
+ OnMessage(msg);
+ return true;
+ }
+ setting = setting->NextSiblingElement("setting");
+ controlId++;
+ }
+ }
+
+ return CGUIDialogBoxBase::OnAction(action);
+}
+
void CGUIDialogAddonSettings::OnInitWindow()
{
m_currentSection = 0;
diff --git a/xbmc/addons/GUIDialogAddonSettings.h b/xbmc/addons/GUIDialogAddonSettings.h
index 12bea9f9c0..cb9a368300 100644
--- a/xbmc/addons/GUIDialogAddonSettings.h
+++ b/xbmc/addons/GUIDialogAddonSettings.h
@@ -29,6 +29,7 @@ public:
CGUIDialogAddonSettings(void);
virtual ~CGUIDialogAddonSettings(void);
virtual bool OnMessage(CGUIMessage& message);
+ virtual bool OnAction(const CAction& action);
/*! \brief Show the addon settings dialog, allowing the user to configure an addon
\param addon the addon to configure
\param saveToDisk whether the changes should be saved to disk or just made local to the addon. Defaults to true