Merge lp:~nick-dedekind/qmenumodel/desktop_menus into lp:qmenumodel

Proposed by Nick Dedekind
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 124
Merged at revision: 127
Proposed branch: lp:~nick-dedekind/qmenumodel/desktop_menus
Merge into: lp:qmenumodel
Diff against target: 140 lines (+37/-5)
5 files modified
debian/changelog (+8/-0)
libqmenumodel/src/qdbusactiongroup.cpp (+13/-0)
libqmenumodel/src/qdbusactiongroup.h (+3/-0)
libqmenumodel/src/unitymenuaction.cpp (+0/-2)
libqmenumodel/src/unitymenumodel.cpp (+13/-3)
To merge this branch: bzr merge lp:~nick-dedekind/qmenumodel/desktop_menus
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Indicator Applet Developers Pending
Review via email: mp+282731@code.launchpad.net

Commit message

Added roles for submenu & shortcut. Added actions property to Group

Description of the change

Added roles for submenu & shortcut. Added actions property to Group

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Just one minor inline nit, otherwise the code looks good

review: Needs Information
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

INline comment as well...

120. By Nick Dedekind

better boolean check

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> INline comment as well...

Done.

121. By Nick Dedekind

version bump

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Text conflict in debian/changelog

review: Needs Fixing
122. By Nick Dedekind

merged with trunk

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> Text conflict in debian/changelog

Merged.

123. By Nick Dedekind

fixed version file

124. By Nick Dedekind

added to changelog

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

LGTM, works fine with the app menus silo

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-11-16 10:42:18 +0000
3+++ debian/changelog 2016-12-09 17:11:53 +0000
4@@ -1,3 +1,11 @@
5+qmenumodel (0.2.11) UNRELEASED; urgency=medium
6+
7+ [ Nick Dedekind ]
8+ * Added shortcut hasSubmenu and roles to UnityMenuModel
9+ * Added actions property to Group
10+
11+ -- Nick Dedekind <nick.dedekind@canonical.com> Fri, 09 Dec 2016 17:11:01 +0000
12+
13 qmenumodel (0.2.10+17.04.20161116-0ubuntu1) zesty; urgency=medium
14
15 [ Florian Boucault ]
16
17=== modified file 'libqmenumodel/src/qdbusactiongroup.cpp'
18--- libqmenumodel/src/qdbusactiongroup.cpp 2014-11-11 14:49:40 +0000
19+++ libqmenumodel/src/qdbusactiongroup.cpp 2016-12-09 17:11:53 +0000
20@@ -70,6 +70,18 @@
21 clear();
22 }
23
24+QStringList QDBusActionGroup::actions() const
25+{
26+ if (!m_actionGroup) return QStringList();
27+ QStringList list;
28+ gchar** actions = g_action_group_list_actions(m_actionGroup);
29+ for (uint i = 0; actions[i]; i++) {
30+ list << QString(actions[i]);
31+ }
32+ g_strfreev(actions);
33+ return list;
34+}
35+
36 /*!
37 \qmlmethod QDBusActionGroup::action(QString name)
38
39@@ -258,6 +270,7 @@
40 } else {
41 Q_EMIT actionVanish(dave->name);
42 }
43+ Q_EMIT actionsChanged();
44 } else if (e->type() == DBusActionStateEvent::eventType) {
45 DBusActionStateEvent *dase = static_cast<DBusActionStateEvent*>(e);
46
47
48=== modified file 'libqmenumodel/src/qdbusactiongroup.h'
49--- libqmenumodel/src/qdbusactiongroup.h 2014-12-10 16:23:27 +0000
50+++ libqmenumodel/src/qdbusactiongroup.h 2016-12-09 17:11:53 +0000
51@@ -42,11 +42,13 @@
52 Q_PROPERTY(QString objectPath READ objectPath WRITE setObjectPath NOTIFY objectPathChanged)
53 Q_PROPERTY(int status READ status NOTIFY statusChanged)
54 Q_PROPERTY(ActionStateParser* actionStateParser READ actionStateParser WRITE setActionStateParser NOTIFY actionStateParserChanged)
55+ Q_PROPERTY(QStringList actions READ actions NOTIFY actionsChanged)
56
57 public:
58 QDBusActionGroup(QObject *parent=0);
59 ~QDBusActionGroup();
60
61+ QStringList actions() const;
62 void updateActionState(const QString &name, const QVariant &state);
63 void activateAction(const QString &name, const QVariant &parameter);
64 bool hasAction(const QString &name);
65@@ -67,6 +69,7 @@
66 void actionVanish(const QString &name);
67 void actionStateChanged(const QString &name, QVariant state);
68 void actionStateParserChanged(ActionStateParser* parser);
69+ void actionsChanged();
70
71 public Q_SLOTS:
72 void start();
73
74=== modified file 'libqmenumodel/src/unitymenuaction.cpp'
75--- libqmenumodel/src/unitymenuaction.cpp 2014-07-04 07:38:02 +0000
76+++ libqmenumodel/src/unitymenuaction.cpp 2016-12-09 17:11:53 +0000
77@@ -20,8 +20,6 @@
78 #include "unitymenumodel.h"
79 #include "unitymenuactionevents.h"
80
81-#include <QDebug>
82-
83 UnityMenuAction::UnityMenuAction(QObject* parent)
84 : QObject(parent),
85 m_valid(false),
86
87=== modified file 'libqmenumodel/src/unitymenumodel.cpp'
88--- libqmenumodel/src/unitymenumodel.cpp 2016-10-25 18:01:23 +0000
89+++ libqmenumodel/src/unitymenumodel.cpp 2016-12-09 17:11:53 +0000
90@@ -27,6 +27,7 @@
91 #include <QIcon>
92 #include <QQmlComponent>
93 #include <QCoreApplication>
94+#include <QKeySequence>
95
96 extern "C" {
97 #include "gtk/gtkactionmuxer.h"
98@@ -53,7 +54,9 @@
99 ActionStateRole,
100 IsCheckRole,
101 IsRadioRole,
102- IsToggledRole
103+ IsToggledRole,
104+ ShortcutRole,
105+ HasSubmenuRole
106 };
107
108 class UnityMenuModelPrivate
109@@ -483,7 +486,13 @@
110 return gtk_menu_tracker_item_get_role (item) == GTK_MENU_TRACKER_ITEM_ROLE_RADIO;
111
112 case IsToggledRole:
113- return gtk_menu_tracker_item_get_toggled (item) == TRUE ? true : false;
114+ return gtk_menu_tracker_item_get_toggled (item) != FALSE;
115+
116+ case ShortcutRole:
117+ return QKeySequence(gtk_menu_tracker_item_get_accel (item), QKeySequence::NativeText);
118+
119+ case HasSubmenuRole:
120+ return gtk_menu_tracker_item_get_has_submenu (item) != FALSE;
121
122 default:
123 return QVariant();
124@@ -500,7 +509,6 @@
125 return QModelIndex();
126 }
127
128-#include <QtDebug>
129 QHash<int, QByteArray> UnityMenuModel::roleNames() const
130 {
131 QHash<int, QByteArray> names;
132@@ -516,6 +524,8 @@
133 names[IsCheckRole] = "isCheck";
134 names[IsRadioRole] = "isRadio";
135 names[IsToggledRole] = "isToggled";
136+ names[ShortcutRole] = "shortcut";
137+ names[HasSubmenuRole] = "hasSubmenu";
138
139 return names;
140 }

Subscribers

People subscribed via source and target branches