From 16b480d00dd5c1fba5252e728cfc71aaa5cc916f Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Fri, 26 Jul 2013 16:29:32 +0200 Subject: unitymenumodel: add get() --- libqmenumodel/src/unitymenumodel.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libqmenumodel/src/unitymenumodel.cpp') diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 114c985..d40c813 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -61,6 +61,7 @@ public: guint nameWatchId; QVariantMap actions; QByteArray menuObjectPath; + QHash roles; static void nameAppeared(GDBusConnection *connection, const gchar *name, const gchar *owner, gpointer user_data); static void nameVanished(GDBusConnection *connection, const gchar *name, gpointer user_data); @@ -542,3 +543,14 @@ bool UnityMenuModel::loadExtendedAttributes(int position, const QVariantMap &sch g_object_set_qdata_full (G_OBJECT (item), unity_menu_item_extended_attributes_quark (), extendedAttrs, freeExtendedAttrs); } + +QVariant UnityMenuModel::get(int row, const QByteArray &role) +{ + if (priv->roles.isEmpty()) { + QHash names = roleNames(); + Q_FOREACH (int role, names.keys()) + priv->roles.insert(names[role], role); + } + + return this->data(this->index(row, 0), priv->roles[role]); +} -- cgit v1.2.3