summaryrefslogtreecommitdiff
path: root/src/CommandItemSetup.cpp
diff options
context:
space:
mode:
authorsvntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-09-30 20:52:26 +0000
committersvntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-09-30 20:52:26 +0000
commitb0b81edb026ecce4e65c3a18263a7b5f79089204 (patch)
tree54b7f332231548af3b4a155bfe2ff80d3c029414 /src/CommandItemSetup.cpp
parent103c8fcf6249e180676c923d4e0ea6714709f829 (diff)
downloadvdr-plugin-menuorg-b0b81edb026ecce4e65c3a18263a7b5f79089204.tar.gz
vdr-plugin-menuorg-b0b81edb026ecce4e65c3a18263a7b5f79089204.tar.bz2
fixed all string handlings
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/menuorg/trunk@6178 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
Diffstat (limited to 'src/CommandItemSetup.cpp')
-rw-r--r--src/CommandItemSetup.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/CommandItemSetup.cpp b/src/CommandItemSetup.cpp
index 125e7b2..7262795 100644
--- a/src/CommandItemSetup.cpp
+++ b/src/CommandItemSetup.cpp
@@ -22,13 +22,13 @@
#include "CommandItemSetup.h"
+const char AllowedChars[] = "$ abcdefghijklmnopqrstuvwxyz0123456789-.#~\\^$[]|()*+?{}/:%";
+
cCommandItemSetup::cCommandItemSetup(CommandMenuNode* node)
-:cOsdMenu(tr("Edit Command Menu Item"))
+:cOsdMenu(tr("Edit Command Menu Item"), 10)
{
- asprintf(&_newName, "%s", node->Text().c_str());
- asprintf(&_newCommand, "%s", node->Command().c_str());
-// _newName = node->Text();
-// _newCommand = node->Command();
+ strn0cpy(_newName, node->Text().c_str(), sizeof(_newName));
+ strn0cpy(_newCommand, node->Command().c_str(), sizeof(_newCommand));
_newConfirm = (int) node->ShouldConfirm();
CreateMenuItems();
}
@@ -36,17 +36,15 @@ cCommandItemSetup::cCommandItemSetup(CommandMenuNode* node)
cCommandItemSetup::~cCommandItemSetup()
{
// TODO: write back the changes
- free(_newName);
- free(_newCommand);
}
void cCommandItemSetup::CreateMenuItems()
{
// Add textItem for name attribute
- Add(new cMenuEditStrItem(tr("name"), _newName, 64, NULL));
+ Add(new cMenuEditStrItem(tr("name"), _newName, sizeof(_newName), tr(AllowedChars)));
// Add textItem for command attribute
- Add(new cMenuEditStrItem(tr("command"), _newCommand, 200, NULL));
+ Add(new cMenuEditStrItem(tr("command"), _newCommand, sizeof(_newCommand), tr(AllowedChars)));
// Add boolItem for confirm attribute
Add(new cMenuEditBoolItem(tr("confirm"), &_newConfirm));