From d2e99cfb78dfcdad000faf9c1c7d4e5a40d53f95 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 12 Sep 2012 16:28:34 -0300 Subject: Parse extra properties name to remove 'x-' and replace '-' to '_'. --- src/common/qmenumodel.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/common/qmenumodel.cpp') diff --git a/src/common/qmenumodel.cpp b/src/common/qmenumodel.cpp index ffb3fb6..af29ded 100644 --- a/src/common/qmenumodel.cpp +++ b/src/common/qmenumodel.cpp @@ -178,6 +178,16 @@ QVariant QMenuModel::getLink(const QModelIndex &index, return QVariant(); } +/*! \internal */ +QString QMenuModel::parseExtraPropertyName(const QString &name) const +{ + QString newName(name); + if (name.startsWith("x-")) { + newName = name.right(name.length() - 2); + } + return newName.replace("-", "_"); +} + /*! \internal */ QVariant QMenuModel::getExtraProperties(const QModelIndex &index) const { @@ -191,7 +201,8 @@ QVariant QMenuModel::getExtraProperties(const QModelIndex &index) const GVariant *value = NULL; while (g_menu_attribute_iter_get_next (iter, &attrName, &value)) { if (strncmp("x-", attrName, 2) == 0) { - extra->setProperty(attrName, Converter::parseGVariant(value)); + + extra->setProperty(parseExtraPropertyName(attrName).toLatin1(), Converter::parseGVariant(value)); } } -- cgit v1.2.3