aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src/unitymenumodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libqmenumodel/src/unitymenumodel.cpp')
-rw-r--r--libqmenumodel/src/unitymenumodel.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp
index aac1d92..192ee46 100644
--- a/libqmenumodel/src/unitymenumodel.cpp
+++ b/libqmenumodel/src/unitymenumodel.cpp
@@ -27,6 +27,7 @@
#include <QIcon>
#include <QQmlComponent>
#include <QCoreApplication>
+#include <QKeySequence>
extern "C" {
#include "gtk/gtkactionmuxer.h"
@@ -53,7 +54,9 @@ enum MenuRoles {
ActionStateRole,
IsCheckRole,
IsRadioRole,
- IsToggledRole
+ IsToggledRole,
+ ShortcutRole,
+ HasSubmenuRole
};
class UnityMenuModelPrivate
@@ -483,7 +486,13 @@ QVariant UnityMenuModel::data(const QModelIndex &index, int role) const
return gtk_menu_tracker_item_get_role (item) == GTK_MENU_TRACKER_ITEM_ROLE_RADIO;
case IsToggledRole:
- return gtk_menu_tracker_item_get_toggled (item) == TRUE ? true : false;
+ return gtk_menu_tracker_item_get_toggled (item) != FALSE;
+
+ case ShortcutRole:
+ return QKeySequence(gtk_menu_tracker_item_get_accel (item), QKeySequence::NativeText);
+
+ case HasSubmenuRole:
+ return gtk_menu_tracker_item_get_has_submenu (item) != FALSE;
default:
return QVariant();
@@ -500,7 +509,6 @@ QModelIndex UnityMenuModel::parent(const QModelIndex &index) const
return QModelIndex();
}
-#include <QtDebug>
QHash<int, QByteArray> UnityMenuModel::roleNames() const
{
QHash<int, QByteArray> names;
@@ -516,6 +524,8 @@ QHash<int, QByteArray> UnityMenuModel::roleNames() const
names[IsCheckRole] = "isCheck";
names[IsRadioRole] = "isRadio";
names[IsToggledRole] = "isToggled";
+ names[ShortcutRole] = "shortcut";
+ names[HasSubmenuRole] = "hasSubmenu";
return names;
}