diff options
Diffstat (limited to 'src/menuconfiguration.cpp')
-rw-r--r-- | src/menuconfiguration.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/menuconfiguration.cpp b/src/menuconfiguration.cpp index 7ba7957..94d95a9 100644 --- a/src/menuconfiguration.cpp +++ b/src/menuconfiguration.cpp @@ -29,6 +29,7 @@ #include "submenunode.h" #include "pluginmenunode.h" #include "commandmenunode.h" +#include "linemenunode.h" using namespace xmlpp; using namespace std; @@ -114,7 +115,7 @@ void MenuConfiguration::CreateMenuTree(const Element* menuRoot, MenuNode* menuNo const Attribute* nameAttribute = childElement->get_attribute("name"); string type = childElement->get_name(); - string name = UnicodeToLocaleOrIso8859(nameAttribute->get_value()); + string name = nameAttribute ? (string) UnicodeToLocaleOrIso8859(nameAttribute->get_value()) : ""; if ( type == "menu") { @@ -140,6 +141,12 @@ void MenuConfiguration::CreateMenuTree(const Element* menuRoot, MenuNode* menuNo bool confirm = confirmAttribute ? (confirmAttribute->get_value() == "yes") : false; AddCommandMenuNode(name, execute, confirm, menuNode); } + else if (type == "line") + { + const Attribute* titleAttribute = childElement->get_attribute("title"); + string title = titleAttribute ? (string) UnicodeToLocaleOrIso8859(titleAttribute->get_value()) : "-----------------------------------"; + AddLineMenuNode(title, menuNode); + } } } } @@ -233,6 +240,11 @@ void MenuConfiguration::AddCommandMenuNode(string name, string command, bool con menu->AddChild(new CommandMenuNode(name, command, confirm)); } +void MenuConfiguration::AddLineMenuNode(string text, MenuNode* menu) +{ + menu->AddChild(new LineMenuNode(text)); +} + string MenuConfiguration::UnicodeToLocaleOrIso8859(Glib::ustring unicodeString) { try |