summaryrefslogtreecommitdiff
path: root/menuitems.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2006-02-12 10:35:10 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2006-02-12 10:35:10 +0100
commitc9b5fd6588b70f8d675fde40864225c18fc459db (patch)
treee3a8d47b62accf25b4f6788bad479fa1b17c2d5d /menuitems.c
parent5820beed0233f95f64ea0665cfafe1847aa90074 (diff)
downloadvdr-c9b5fd6588b70f8d675fde40864225c18fc459db.tar.gz
vdr-c9b5fd6588b70f8d675fde40864225c18fc459db.tar.bz2
The "Back" key now restores the original string when pressed while editing a string item
Diffstat (limited to 'menuitems.c')
-rw-r--r--menuitems.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/menuitems.c b/menuitems.c
index e2380663..fab13ca4 100644
--- a/menuitems.c
+++ b/menuitems.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menuitems.c 1.31 2006/02/04 12:47:08 kls Exp $
+ * $Id: menuitems.c 1.32 2006/02/12 10:31:08 kls Exp $
*/
#include "menuitems.h"
@@ -239,6 +239,7 @@ eOSState cMenuEditChrItem::ProcessKey(eKeys Key)
cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, const char *Allowed)
:cMenuEditItem(Name)
{
+ orgValue = NULL;
value = Value;
length = Length;
allowed = strdup(Allowed);
@@ -253,6 +254,7 @@ cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, co
cMenuEditStrItem::~cMenuEditStrItem()
{
+ free(orgValue);
free(allowed);
}
@@ -409,8 +411,10 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
break;
case kRight|k_Repeat:
case kRight: AdvancePos();
- if (pos == 0)
+ if (pos == 0) {
+ orgValue = strdup(value);
SetHelpKeys();
+ }
break;
case kUp|k_Repeat:
case kUp:
@@ -469,7 +473,13 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
return cMenuEditItem::ProcessKey(Key);
}
break;
+ case kBack:
case kOk: if (InEditMode()) {
+ if (Key == kBack && orgValue) {
+ strcpy(value, orgValue);
+ free(orgValue);
+ orgValue = NULL;
+ }
pos = -1;
newchar = true;
stripspace(value);