aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/qmenumodel.cpp13
-rw-r--r--src/common/qmenumodel.h1
2 files changed, 13 insertions, 1 deletions
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
@@ -179,6 +179,16 @@ QVariant QMenuModel::getLink(const QModelIndex &index,
}
/*! \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
{
GMenuAttributeIter *iter = g_menu_model_iterate_item_attributes(m_menuModel, index.row());
@@ -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));
}
}
diff --git a/src/common/qmenumodel.h b/src/common/qmenumodel.h
index e102f72..ba5696d 100644
--- a/src/common/qmenumodel.h
+++ b/src/common/qmenumodel.h
@@ -56,6 +56,7 @@ private:
QVariant getStringAttribute(const QModelIndex &index, const QString &attribute) const;
QVariant getLink(const QModelIndex &index, const QString &linkName) const;
QVariant getExtraProperties(const QModelIndex &index) const;
+ QString parseExtraPropertyName(const QString &name) const;
static void onItemsChanged(GMenuModel *model, gint position, gint removed, gint added, gpointer data);
};