Merge lp:~unity-api-team/hud/lp-1288025 into lp:hud/14.04
- lp-1288025
- Merge into trunk.14.04
Status: | Merged |
---|---|
Approved by: | Antti Kaijanmäki |
Approved revision: | 398 |
Merged at revision: | 380 |
Proposed branch: | lp:~unity-api-team/hud/lp-1288025 |
Merge into: | lp:hud/14.04 |
Prerequisite: | lp:~pete-woods/hud/use-new-libdbusmenu |
Diff against target: |
983 lines (+182/-161) 26 files modified
libqtgmenu/QtGMenuImporter.cpp (+11/-7) libqtgmenu/QtGMenuImporter.h (+6/-4) libqtgmenu/internal/QtGActionGroup.cpp (+15/-7) libqtgmenu/internal/QtGActionGroup.h (+2/-1) libqtgmenu/internal/QtGMenuImporterPrivate.cpp (+55/-51) libqtgmenu/internal/QtGMenuImporterPrivate.h (+7/-7) libqtgmenu/internal/QtGMenuModel.cpp (+1/-9) libqtgmenu/internal/QtGMenuModel.h (+1/-4) service/Collector.h (+1/-1) service/DBusMenuCollector.cpp (+4/-4) service/DBusMenuCollector.h (+1/-1) service/Factory.cpp (+3/-2) service/Factory.h (+2/-1) service/GMenuCollector.cpp (+6/-7) service/GMenuCollector.h (+4/-3) service/GMenuWindowCollector.cpp (+28/-10) service/GMenuWindowCollector.h (+2/-16) service/WindowContextImpl.cpp (+4/-1) service/WindowImpl.cpp (+1/-4) tests/integration/TestHud.cpp (+2/-2) tests/testapps/qtgmenu/MainWindow.cpp (+2/-2) tests/testapps/qtgmenu/MainWindow.h (+1/-1) tests/testapps/qtgmenu/main.cpp (+1/-1) tests/unit/qtgmenu/TestQtGMenu.cpp (+1/-1) tests/unit/service/Mocks.h (+3/-2) tests/unit/service/TestWindow.cpp (+18/-12) |
To merge this branch: | bzr merge lp:~unity-api-team/hud/lp-1288025 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Antti Kaijanmäki (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Review via email: mp+209449@code.launchpad.net |
Commit message
Support multiple GMenuCollectors for each window, and multiple QtGActionGroups for each QtGMenuModel.
Description of the change
* Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
* Yes
* Did you build your software in a clean sbuild/pbuilder chroot or ppa?
* Yes
* Did you build your software in a clean sbuild/pbuilder armhf chroot or ppa?
* Yes
* Has your component "TestPlan” been executed successfully on emulator, N4?
* Yes
* Has a 5 minute exploratory testing run been executed on N4?
* Yes
* If you changed the packaging (debian), did you subscribe a core-dev to this MP?
* N/A
* If you changed the UI, did you subscribe the design-reviewers to this MP?
* No change
* What components might get impacted by your changes?
* Unity7
* Unity8
* Have you requested review by the teams of these owning components?
* Yes
Check List:
https:/
Test Plan:
https:/
Silo:
https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:388
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:390
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:391
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:393
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:394
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Marcus Tomlinson (marcustomlinson) wrote : | # |
Things are looking good now.
The gmenu importer now accepts multiple action paths each pointing to a different action group.
Each action group is aware of it's own prefix, so upon triggering an action, this prefix is used to determine which action group to target.
When actions are enabled and parameterised the action group prepends it's prefix to the action name before informing the menu model.
Pete Woods (pete-woods) wrote : | # |
Looking good. I can confirm that Nautlus and LibreOffice both work now. :)
Pete Woods (pete-woods) wrote : | # |
Also, just so you know, you can convert a QString to a C string using the following:
string.
Michi Henning (michihenning) wrote : | # |
> Also, just so you know, you can convert a QString to a C string using the
> following:
>
> string.
Awesome! How bloody obvious. Silly me for not seeing that immediately ;-)
Pete Woods (pete-woods) wrote : | # |
> > Also, just so you know, you can convert a QString to a C string using the
> > following:
> >
> > string.
>
> Awesome! How bloody obvious. Silly me for not seeing that immediately ;-)
I think it all comes from them trying supporting UTF across platforms. You need a temporary object representing just some bytes.
IIRC:
* Windows uses UTF-16 by default => use std::wstring
* Linux and OSX use UTF-8 by default => use std::string.
This means you have a difficult choice if you're making an app you want to work on both platforms. So I would think this is why Trolltech made QString. Maybe things have changed since I gathered this information? I'd be happy to be wrong on this!
Michi Henning (michihenning) wrote : | # |
> > > Also, just so you know, you can convert a QString to a C string using the
> > > following:
> > >
> > > string.
> >
> > Awesome! How bloody obvious. Silly me for not seeing that immediately ;-)
>
> I think it all comes from them trying supporting UTF across platforms. You
> need a temporary object representing just some bytes.
Yeah. I was commenting on the really awkward and counter-intuitive API. Would be nice have something like string.c_str() or similar.
Marcus Tomlinson (marcustomlinson) wrote : | # |
> Also, just so you know, you can convert a QString to a C string using the
> following:
>
> string.
Ok cool, I've cleanup up that class now to use the QDBusObjectPaths provided instead of std::strings.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:395
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:397
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
was there anything missing there? it would be nice to see that fix landing in trusty...
Marcus Tomlinson (marcustomlinson) wrote : | # |
> was there anything missing there? it would be nice to see that fix landing in
> trusty...
"Silo:
<no silo>"
Looks like we're still waiting for a landing slot for this.
Pete Woods (pete-woods) wrote : | # |
Yes, we're basically stuck waiting for qt5.2 to land, as HUD already has a landing in that silo.
- 388. By Marcus Tomlinson
-
Narrowed down QtGMenuImporter to one choice of constructor.
- 389. By Marcus Tomlinson
-
QtGMenuImporter now accepts a map of action paths.
- 390. By Marcus Tomlinson
-
Removed unused "unused" function
- 391. By Marcus Tomlinson
-
QtGMenuImporter now maintains multiple action paths and groups
- 392. By Marcus Tomlinson
-
Check action prefix on QtGActionGroup:
:TriggerAction( ) - 393. By Marcus Tomlinson
-
Removed now unnecessary "explicit" specifier
- 394. By Marcus Tomlinson
-
Prepend action prefix to action name when emitting ActionEnabled and ActionParameterized from QtGActionGroup
- 395. By Marcus Tomlinson
-
Some cleaning up
- 396. By Marcus Tomlinson
-
QtGMenuImporter
Private stores QDBusObjectPath members for menu and action paths rather than std::strings. - 397. By Pete Woods
-
Use a smaller import
- 398. By Pete Woods
-
Fix formatting
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:398
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Antti Kaijanmäki (kaijanmaki) wrote : | # |
LGTM. Waiting for silo.
Antti Kaijanmäki (kaijanmaki) wrote : | # |
* Are any changes against your component pending/needed to land the MP under review in a functional state and are those called out explicitly by the submitter?
Yes.
* Did you do exploratory testing related to the component you own with the MP changeset included?
Yes.
* Has the submitter requested review by all the relevant teams/reviewres?
Yes.
* If you are the reviewer owning the component the MP is against, have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes.
Preview Diff
1 | === modified file 'libqtgmenu/QtGMenuImporter.cpp' |
2 | --- libqtgmenu/QtGMenuImporter.cpp 2013-12-23 10:54:14 +0000 |
3 | +++ libqtgmenu/QtGMenuImporter.cpp 2014-03-14 14:09:41 +0000 |
4 | @@ -23,15 +23,19 @@ |
5 | |
6 | using namespace qtgmenu; |
7 | |
8 | -QtGMenuImporter::QtGMenuImporter( const QString &service, const QString& path, QObject* parent ) |
9 | - : QtGMenuImporter( service, path, path, parent ) |
10 | +QtGMenuImporter::QtGMenuImporter( const QString& service, const QDBusObjectPath& menu_path, |
11 | + const QString& action_prefix, const QDBusObjectPath& action_path, QObject* parent ) |
12 | + : QObject( parent ) |
13 | { |
14 | + QMap<QString, QDBusObjectPath> action_paths; |
15 | + action_paths[action_prefix] = action_path; |
16 | + d.reset( new QtGMenuImporterPrivate( service, menu_path, action_paths, *this ) ); |
17 | } |
18 | |
19 | -QtGMenuImporter::QtGMenuImporter( const QString &service, const QString& menu_path, |
20 | - const QString& actions_path, QObject* parent ) |
21 | +QtGMenuImporter::QtGMenuImporter( const QString& service, const QDBusObjectPath& menu_path, |
22 | + const QMap<QString, QDBusObjectPath>& action_paths, QObject* parent ) |
23 | : QObject( parent ), |
24 | - d( new QtGMenuImporterPrivate( service, menu_path, actions_path, *this ) ) |
25 | + d( new QtGMenuImporterPrivate( service, menu_path, action_paths, *this ) ) |
26 | { |
27 | } |
28 | |
29 | @@ -44,9 +48,9 @@ |
30 | return d->GetGMenuModel(); |
31 | } |
32 | |
33 | -GActionGroup* QtGMenuImporter::GetGActionGroup() const |
34 | +GActionGroup* QtGMenuImporter::GetGActionGroup( int index ) const |
35 | { |
36 | - return d->GetGActionGroup(); |
37 | + return d->GetGActionGroup( index ); |
38 | } |
39 | |
40 | std::shared_ptr< QMenu > QtGMenuImporter::GetQMenu() const |
41 | |
42 | === modified file 'libqtgmenu/QtGMenuImporter.h' |
43 | --- libqtgmenu/QtGMenuImporter.h 2013-12-24 10:02:26 +0000 |
44 | +++ libqtgmenu/QtGMenuImporter.h 2014-03-14 14:09:41 +0000 |
45 | @@ -20,6 +20,7 @@ |
46 | #define QTGMENUIMPORTER_H |
47 | |
48 | #include <QObject> |
49 | +#include <QDBusObjectPath> |
50 | #include <memory> |
51 | |
52 | class QMenu; |
53 | @@ -40,13 +41,14 @@ |
54 | Q_OBJECT |
55 | |
56 | public: |
57 | - QtGMenuImporter( const QString& service, const QString& path, QObject* parent = 0 ); |
58 | - QtGMenuImporter( const QString& service, const QString& menu_path, const QString& actions_path, |
59 | - QObject* parent = 0 ); |
60 | + QtGMenuImporter( const QString& service, const QDBusObjectPath& menu_path, |
61 | + const QString& action_prefix, const QDBusObjectPath& action_path, QObject* parent = 0 ); |
62 | + QtGMenuImporter( const QString& service, const QDBusObjectPath& menu_path, |
63 | + const QMap<QString, QDBusObjectPath>& action_paths, QObject* parent = 0 ); |
64 | virtual ~QtGMenuImporter(); |
65 | |
66 | GMenuModel* GetGMenuModel() const; |
67 | - GActionGroup* GetGActionGroup() const; |
68 | + GActionGroup* GetGActionGroup( int index = 0 ) const; |
69 | |
70 | std::shared_ptr< QMenu > GetQMenu() const; |
71 | |
72 | |
73 | === modified file 'libqtgmenu/internal/QtGActionGroup.cpp' |
74 | --- libqtgmenu/internal/QtGActionGroup.cpp 2014-02-05 14:02:28 +0000 |
75 | +++ libqtgmenu/internal/QtGActionGroup.cpp 2014-03-14 14:09:41 +0000 |
76 | @@ -21,8 +21,9 @@ |
77 | |
78 | using namespace qtgmenu; |
79 | |
80 | -QtGActionGroup::QtGActionGroup( GActionGroup* action_group ) |
81 | - : m_action_group( action_group ) |
82 | +QtGActionGroup::QtGActionGroup( const QString& action_prefix, GActionGroup* action_group ) |
83 | + : m_action_prefix( action_prefix ), |
84 | + m_action_group( action_group ) |
85 | { |
86 | ConnectCallbacks(); |
87 | |
88 | @@ -93,6 +94,13 @@ |
89 | |
90 | void QtGActionGroup::TriggerAction( QString action_name, bool checked ) |
91 | { |
92 | + QString prefix = action_name.left( action_name.indexOf( '.' ) ); |
93 | + if( prefix != m_action_prefix ) |
94 | + { |
95 | + return; |
96 | + } |
97 | + |
98 | + action_name = action_name.right( action_name.size() - action_name.indexOf( '.' ) - 1 ); |
99 | std::string action = action_name.toStdString(); |
100 | |
101 | const GVariantType* type = g_action_group_get_action_parameter_type( m_action_group, |
102 | @@ -124,12 +132,12 @@ |
103 | bool enabled = G_ACTION_GROUP_GET_IFACE( m_action_group ) ->get_action_enabled( m_action_group, |
104 | action_name ); |
105 | if( !enabled ) |
106 | - emit ActionEnabled( action_name, enabled ); |
107 | + emit ActionEnabled( m_action_prefix + "." + action_name, enabled ); |
108 | |
109 | const GVariantType* type = g_action_group_get_action_parameter_type( m_action_group, |
110 | action_name ); |
111 | if( type != nullptr ) |
112 | - emit ActionParameterized( action_name, type != nullptr ); |
113 | + emit ActionParameterized( m_action_prefix + "." + action_name, type != nullptr ); |
114 | } |
115 | |
116 | g_strfreev( actions_list ); |
117 | @@ -144,12 +152,12 @@ |
118 | bool enabled = G_ACTION_GROUP_GET_IFACE( self->m_action_group ) ->get_action_enabled( |
119 | self->m_action_group, action_name ); |
120 | if( !enabled ) |
121 | - emit self->ActionEnabled( action_name, enabled ); |
122 | + emit self->ActionEnabled( self->m_action_prefix + "." + action_name, enabled ); |
123 | |
124 | const GVariantType* type = g_action_group_get_action_parameter_type( self->m_action_group, |
125 | action_name ); |
126 | if( type != nullptr ) |
127 | - emit self->ActionParameterized( action_name, type != nullptr ); |
128 | + emit self->ActionParameterized( self->m_action_prefix + "." + action_name, type != nullptr ); |
129 | |
130 | ++self->m_size; |
131 | } |
132 | @@ -167,7 +175,7 @@ |
133 | gboolean enabled, gpointer user_data ) |
134 | { |
135 | QtGActionGroup* self = reinterpret_cast< QtGActionGroup* >( user_data ); |
136 | - emit self->ActionEnabled( action_name, enabled ); |
137 | + emit self->ActionEnabled( self->m_action_prefix + "." + action_name, enabled ); |
138 | } |
139 | |
140 | void QtGActionGroup::ActionStateChangedCallback( GActionGroup* action_group, gchar* action_name, |
141 | |
142 | === modified file 'libqtgmenu/internal/QtGActionGroup.h' |
143 | --- libqtgmenu/internal/QtGActionGroup.h 2014-02-05 14:02:28 +0000 |
144 | +++ libqtgmenu/internal/QtGActionGroup.h 2014-03-14 14:09:41 +0000 |
145 | @@ -33,7 +33,7 @@ |
146 | Q_OBJECT |
147 | |
148 | public: |
149 | - explicit QtGActionGroup( GActionGroup* action_group ); |
150 | + QtGActionGroup( const QString& action_prefix, GActionGroup* action_group ); |
151 | virtual ~QtGActionGroup(); |
152 | |
153 | GActionGroup* ActionGroup() const; |
154 | @@ -68,6 +68,7 @@ |
155 | private: |
156 | int m_size = 0; |
157 | |
158 | + QString m_action_prefix; |
159 | GActionGroup* m_action_group = nullptr; |
160 | |
161 | gulong m_action_added_handler = 0; |
162 | |
163 | === modified file 'libqtgmenu/internal/QtGMenuImporterPrivate.cpp' |
164 | --- libqtgmenu/internal/QtGMenuImporterPrivate.cpp 2013-12-24 10:02:26 +0000 |
165 | +++ libqtgmenu/internal/QtGMenuImporterPrivate.cpp 2014-03-14 14:09:41 +0000 |
166 | @@ -24,21 +24,16 @@ |
167 | |
168 | using namespace qtgmenu; |
169 | |
170 | -// this is used to suppress compiler warnings about unused parameters |
171 | -template< typename ... T > void unused( T&& ... ) |
172 | -{ |
173 | -} |
174 | - |
175 | -QtGMenuImporterPrivate::QtGMenuImporterPrivate( const QString& service, const QString& menu_path, |
176 | - const QString& actions_path, QtGMenuImporter& parent ) |
177 | +QtGMenuImporterPrivate::QtGMenuImporterPrivate( const QString& service, const QDBusObjectPath& menu_path, |
178 | + const QMap<QString, QDBusObjectPath>& action_paths, QtGMenuImporter& parent ) |
179 | : QObject( 0 ), |
180 | m_service_watcher( service, QDBusConnection::sessionBus(), |
181 | QDBusServiceWatcher::WatchForOwnerChange ), |
182 | m_parent( parent ), |
183 | m_connection( g_bus_get_sync( G_BUS_TYPE_SESSION, NULL, NULL ) ), |
184 | m_service( service.toStdString() ), |
185 | - m_menu_path( menu_path.toStdString() ), |
186 | - m_actions_path( actions_path.toStdString() ) |
187 | + m_menu_path( menu_path ), |
188 | + m_action_paths( action_paths ) |
189 | { |
190 | connect( &m_service_watcher, SIGNAL( serviceRegistered( const QString& ) ), this, |
191 | SLOT( ServiceRegistered() ) ); |
192 | @@ -52,7 +47,7 @@ |
193 | QtGMenuImporterPrivate::~QtGMenuImporterPrivate() |
194 | { |
195 | ClearMenuModel(); |
196 | - ClearActionGroup(); |
197 | + ClearActionGroups(); |
198 | |
199 | g_object_unref( m_connection ); |
200 | } |
201 | @@ -67,14 +62,15 @@ |
202 | return m_menu_model->Model(); |
203 | } |
204 | |
205 | -GActionGroup* QtGMenuImporterPrivate::GetGActionGroup() |
206 | +GActionGroup* QtGMenuImporterPrivate::GetGActionGroup( int index ) |
207 | { |
208 | - if( m_action_group == nullptr ) |
209 | + if( index >= m_action_groups.size() || |
210 | + m_action_groups[index] == nullptr ) |
211 | { |
212 | return nullptr; |
213 | } |
214 | |
215 | - return m_action_group->ActionGroup(); |
216 | + return m_action_groups[index]->ActionGroup(); |
217 | } |
218 | |
219 | std::shared_ptr< QMenu > QtGMenuImporterPrivate::GetQMenu() |
220 | @@ -89,12 +85,12 @@ |
221 | |
222 | void QtGMenuImporterPrivate::Refresh() |
223 | { |
224 | - if( !m_menu_path.empty() ) |
225 | + if( !m_menu_path.path().isEmpty() ) |
226 | { |
227 | RefreshGMenuModel(); |
228 | } |
229 | |
230 | - if( !m_actions_path.empty() ) |
231 | + if( !m_action_paths.empty() ) |
232 | { |
233 | RefreshGActionGroup(); |
234 | } |
235 | @@ -113,34 +109,35 @@ |
236 | m_menu_model = nullptr; |
237 | } |
238 | |
239 | -void QtGMenuImporterPrivate::ClearActionGroup() |
240 | +void QtGMenuImporterPrivate::ClearActionGroups() |
241 | { |
242 | - if( m_action_group == nullptr ) |
243 | + for( auto& action_group : m_action_groups ) |
244 | { |
245 | - return; |
246 | + action_group->disconnect(); |
247 | } |
248 | |
249 | - m_action_group->disconnect(); |
250 | m_menu_actions_linked = false; |
251 | - |
252 | - m_action_group = nullptr; |
253 | + m_action_groups.clear(); |
254 | } |
255 | |
256 | void QtGMenuImporterPrivate::LinkMenuActions() |
257 | { |
258 | - if( m_menu_model && m_action_group && !m_menu_actions_linked ) |
259 | + if( m_menu_model && !m_action_groups.empty() && !m_menu_actions_linked ) |
260 | { |
261 | - connect( m_menu_model.get(), SIGNAL( ActionTriggered( QString, bool ) ), m_action_group.get(), |
262 | - SLOT( TriggerAction( QString, bool ) ) ); |
263 | - |
264 | - connect( m_menu_model.get(), SIGNAL( MenuItemsChanged( QtGMenuModel*, int, int, int ) ), |
265 | - m_action_group.get(), SLOT( EmitStates() ) ); |
266 | - |
267 | - connect( m_action_group.get(), SIGNAL( ActionEnabled( QString, bool ) ), m_menu_model.get(), |
268 | - SLOT( ActionEnabled( QString, bool ) ) ); |
269 | - |
270 | - connect( m_action_group.get(), SIGNAL( ActionParameterized( QString, bool ) ), |
271 | - m_menu_model.get(), SLOT( ActionParameterized( QString, bool ) ) ); |
272 | + for( auto& action_group : m_action_groups ) |
273 | + { |
274 | + connect( m_menu_model.get(), SIGNAL( ActionTriggered( QString, bool ) ), action_group.get(), |
275 | + SLOT( TriggerAction( QString, bool ) ) ); |
276 | + |
277 | + connect( m_menu_model.get(), SIGNAL( MenuItemsChanged( QtGMenuModel*, int, int, int ) ), |
278 | + action_group.get(), SLOT( EmitStates() ) ); |
279 | + |
280 | + connect( action_group.get(), SIGNAL( ActionEnabled( QString, bool ) ), m_menu_model.get(), |
281 | + SLOT( ActionEnabled( QString, bool ) ) ); |
282 | + |
283 | + connect( action_group.get(), SIGNAL( ActionParameterized( QString, bool ) ), |
284 | + m_menu_model.get(), SLOT( ActionParameterized( QString, bool ) ) ); |
285 | + } |
286 | |
287 | m_menu_actions_linked = true; |
288 | } |
289 | @@ -154,7 +151,7 @@ |
290 | void QtGMenuImporterPrivate::ServiceUnregistered() |
291 | { |
292 | ClearMenuModel(); |
293 | - ClearActionGroup(); |
294 | + ClearActionGroups(); |
295 | } |
296 | |
297 | void QtGMenuImporterPrivate::RefreshGMenuModel() |
298 | @@ -162,10 +159,11 @@ |
299 | // clear the menu model for the refresh |
300 | ClearMenuModel(); |
301 | |
302 | + QString menu_path = m_menu_path.path(); |
303 | m_menu_model = |
304 | std::make_shared< QtGMenuModel > ( |
305 | - G_MENU_MODEL( g_dbus_menu_model_get( m_connection, m_service.c_str(), m_menu_path.c_str() ) ), |
306 | - m_service.c_str(), m_menu_path.c_str(), m_actions_path.c_str() ); |
307 | + G_MENU_MODEL( g_dbus_menu_model_get( m_connection, m_service.c_str(), menu_path.toUtf8().constData() ) ), |
308 | + m_service.c_str(), menu_path.toUtf8().constData() ); |
309 | |
310 | connect( m_menu_model.get(), SIGNAL( MenuItemsChanged( QtGMenuModel*, int, int, |
311 | int ) ), &m_parent, SIGNAL( MenuItemsChanged()) ); |
312 | @@ -173,21 +171,27 @@ |
313 | |
314 | void QtGMenuImporterPrivate::RefreshGActionGroup() |
315 | { |
316 | - // clear the action group for the refresh |
317 | - ClearActionGroup(); |
318 | - |
319 | - m_action_group = |
320 | - std::make_shared< QtGActionGroup > ( |
321 | - G_ACTION_GROUP( g_dbus_action_group_get( m_connection, m_service.c_str(), m_actions_path.c_str() ) ) ); |
322 | - |
323 | - connect( m_action_group.get(), SIGNAL( ActionAdded( QString ) ), &m_parent, |
324 | - SIGNAL( ActionAdded( QString ) ) ); |
325 | - connect( m_action_group.get(), SIGNAL( ActionRemoved( QString ) ), &m_parent, |
326 | - SIGNAL( ActionRemoved( QString ) ) ); |
327 | - connect( m_action_group.get(), SIGNAL( ActionEnabled( QString, bool ) ), &m_parent, |
328 | - SIGNAL( ActionEnabled( QString, bool ) ) ); |
329 | - connect( m_action_group.get(), SIGNAL( ActionStateChanged( QString, |
330 | - QVariant ) ), &m_parent, SIGNAL( ActionStateChanged( QString, QVariant) ) ); |
331 | + // clear the action groups for the refresh |
332 | + ClearActionGroups(); |
333 | + |
334 | + for( auto const& action_path_it : m_action_paths.toStdMap() ) |
335 | + { |
336 | + QString action_path = action_path_it.second.path(); |
337 | + m_action_groups.push_back( |
338 | + std::make_shared< QtGActionGroup > ( action_path_it.first, |
339 | + G_ACTION_GROUP( g_dbus_action_group_get( m_connection, m_service.c_str(), action_path.toUtf8().constData() ) ) ) ); |
340 | + |
341 | + auto action_group = m_action_groups.back(); |
342 | + |
343 | + connect( action_group.get(), SIGNAL( ActionAdded( QString ) ), &m_parent, |
344 | + SIGNAL( ActionAdded( QString ) ) ); |
345 | + connect( action_group.get(), SIGNAL( ActionRemoved( QString ) ), &m_parent, |
346 | + SIGNAL( ActionRemoved( QString ) ) ); |
347 | + connect( action_group.get(), SIGNAL( ActionEnabled( QString, bool ) ), &m_parent, |
348 | + SIGNAL( ActionEnabled( QString, bool ) ) ); |
349 | + connect( action_group.get(), SIGNAL( ActionStateChanged( QString, |
350 | + QVariant ) ), &m_parent, SIGNAL( ActionStateChanged( QString, QVariant) ) ); |
351 | + } |
352 | |
353 | LinkMenuActions(); |
354 | } |
355 | |
356 | === modified file 'libqtgmenu/internal/QtGMenuImporterPrivate.h' |
357 | --- libqtgmenu/internal/QtGMenuImporterPrivate.h 2013-12-24 10:02:26 +0000 |
358 | +++ libqtgmenu/internal/QtGMenuImporterPrivate.h 2014-03-14 14:09:41 +0000 |
359 | @@ -39,12 +39,12 @@ |
360 | Q_OBJECT |
361 | |
362 | public: |
363 | - QtGMenuImporterPrivate( const QString& service, const QString& menu_path, |
364 | - const QString& actions_path, QtGMenuImporter& parent ); |
365 | + QtGMenuImporterPrivate( const QString& service, const QDBusObjectPath& menu_path, |
366 | + const QMap<QString, QDBusObjectPath>& action_paths, QtGMenuImporter& parent ); |
367 | virtual ~QtGMenuImporterPrivate(); |
368 | |
369 | GMenuModel* GetGMenuModel(); |
370 | - GActionGroup* GetGActionGroup(); |
371 | + GActionGroup* GetGActionGroup( int index = 0); |
372 | |
373 | std::shared_ptr< QMenu > GetQMenu(); |
374 | |
375 | @@ -52,7 +52,7 @@ |
376 | |
377 | private: |
378 | void ClearMenuModel(); |
379 | - void ClearActionGroup(); |
380 | + void ClearActionGroups(); |
381 | |
382 | void LinkMenuActions(); |
383 | |
384 | @@ -70,11 +70,11 @@ |
385 | |
386 | GDBusConnection* m_connection; |
387 | std::string m_service; |
388 | - std::string m_menu_path; |
389 | - std::string m_actions_path; |
390 | + QDBusObjectPath m_menu_path; |
391 | + QMap<QString, QDBusObjectPath> m_action_paths; |
392 | |
393 | std::shared_ptr< QtGMenuModel > m_menu_model = nullptr; |
394 | - std::shared_ptr< QtGActionGroup > m_action_group = nullptr; |
395 | + std::vector< std::shared_ptr< QtGActionGroup > > m_action_groups; |
396 | |
397 | bool m_menu_actions_linked = false; |
398 | }; |
399 | |
400 | === modified file 'libqtgmenu/internal/QtGMenuModel.cpp' |
401 | --- libqtgmenu/internal/QtGMenuModel.cpp 2014-02-18 12:23:33 +0000 |
402 | +++ libqtgmenu/internal/QtGMenuModel.cpp 2014-03-14 14:09:41 +0000 |
403 | @@ -26,13 +26,11 @@ |
404 | { |
405 | } |
406 | |
407 | -QtGMenuModel::QtGMenuModel( GMenuModel* model, const QString& bus_name, const QString& menu_path, |
408 | - const QString& actions_path ) |
409 | +QtGMenuModel::QtGMenuModel( GMenuModel* model, const QString& bus_name, const QString& menu_path ) |
410 | : QtGMenuModel( model, LinkType::Root, nullptr, 0 ) |
411 | { |
412 | m_bus_name = bus_name; |
413 | m_menu_path = menu_path; |
414 | - m_actions_path = actions_path; |
415 | } |
416 | |
417 | QtGMenuModel::QtGMenuModel( GMenuModel* model, LinkType link_type, QtGMenuModel* parent, int index ) |
418 | @@ -48,7 +46,6 @@ |
419 | |
420 | m_bus_name = m_parent->m_bus_name; |
421 | m_menu_path = m_parent->m_menu_path; |
422 | - m_actions_path = m_parent->m_actions_path; |
423 | |
424 | gchar* label = NULL; |
425 | if( g_menu_model_get_item_attribute( m_parent->m_model, index, |
426 | @@ -87,7 +84,6 @@ |
427 | // dbus paths |
428 | m_ext_menu->menuAction()->setProperty( c_property_busName, m_bus_name ); |
429 | m_ext_menu->menuAction()->setProperty( c_property_menuPath, m_menu_path ); |
430 | - m_ext_menu->menuAction()->setProperty( c_property_actionsPath, m_actions_path ); |
431 | } |
432 | } |
433 | |
434 | @@ -360,9 +356,6 @@ |
435 | QString qaction_name = QString::fromUtf8( action_name ); |
436 | g_free( action_name ); |
437 | |
438 | - int name_length = qaction_name.size() - qaction_name.indexOf( '.' ) - 1; |
439 | - qaction_name = qaction_name.right( name_length ); |
440 | - |
441 | action->setProperty( c_property_actionName, qaction_name ); |
442 | } |
443 | |
444 | @@ -372,7 +365,6 @@ |
445 | // dbus paths |
446 | action->setProperty( c_property_busName, m_bus_name ); |
447 | action->setProperty( c_property_menuPath, m_menu_path ); |
448 | - action->setProperty( c_property_actionsPath, m_actions_path ); |
449 | |
450 | // action icon |
451 | GVariant* icon = g_menu_model_get_item_attribute_value( m_model, index, G_MENU_ATTRIBUTE_ICON, |
452 | |
453 | === modified file 'libqtgmenu/internal/QtGMenuModel.h' |
454 | --- libqtgmenu/internal/QtGMenuModel.h 2014-02-18 11:13:27 +0000 |
455 | +++ libqtgmenu/internal/QtGMenuModel.h 2014-03-14 14:09:41 +0000 |
456 | @@ -43,8 +43,7 @@ |
457 | }; |
458 | |
459 | explicit QtGMenuModel( GMenuModel* model ); |
460 | - QtGMenuModel( GMenuModel* model, const QString& bus_name, const QString& menu_path, |
461 | - const QString& actions_path ); |
462 | + QtGMenuModel( GMenuModel* model, const QString& bus_name, const QString& menu_path ); |
463 | virtual ~QtGMenuModel(); |
464 | |
465 | GMenuModel* Model() const; |
466 | @@ -61,7 +60,6 @@ |
467 | constexpr static const char* c_property_isParameterized = "isParameterized"; |
468 | constexpr static const char* c_property_busName = "busName"; |
469 | constexpr static const char* c_property_menuPath = "menuPath"; |
470 | - constexpr static const char* c_property_actionsPath = "actionsPath"; |
471 | constexpr static const char* c_property_keywords = "keywords"; |
472 | constexpr static const char* c_property_hud_toolbar_item = "hud-toolbar-item"; |
473 | |
474 | @@ -115,7 +113,6 @@ |
475 | |
476 | QString m_bus_name; |
477 | QString m_menu_path; |
478 | - QString m_actions_path; |
479 | |
480 | std::map< QString, QAction* > m_actions; |
481 | }; |
482 | |
483 | === modified file 'service/Collector.h' |
484 | --- service/Collector.h 2013-12-17 16:37:55 +0000 |
485 | +++ service/Collector.h 2014-03-14 14:09:41 +0000 |
486 | @@ -69,7 +69,7 @@ |
487 | |
488 | virtual bool isValid() const = 0; |
489 | |
490 | - virtual CollectorToken::Ptr activate() = 0; |
491 | + virtual QList<CollectorToken::Ptr> activate() = 0; |
492 | |
493 | protected: |
494 | virtual void deactivate() = 0; |
495 | |
496 | === modified file 'service/DBusMenuCollector.cpp' |
497 | --- service/DBusMenuCollector.cpp 2014-03-14 14:09:41 +0000 |
498 | +++ service/DBusMenuCollector.cpp 2014-03-14 14:09:41 +0000 |
499 | @@ -128,18 +128,18 @@ |
500 | } |
501 | } |
502 | |
503 | -CollectorToken::Ptr DBusMenuCollector::activate() { |
504 | +QList<CollectorToken::Ptr> DBusMenuCollector::activate() { |
505 | CollectorToken::Ptr collectorToken(m_collectorToken); |
506 | |
507 | if(m_menuImporter.isNull()) { |
508 | - return CollectorToken::Ptr(); |
509 | + return QList<CollectorToken::Ptr>(); |
510 | } |
511 | |
512 | if (collectorToken.isNull()) { |
513 | openMenu(m_menuImporter->menu()); |
514 | |
515 | if(m_menuImporter.isNull()) { |
516 | - return CollectorToken::Ptr(); |
517 | + return QList<CollectorToken::Ptr>(); |
518 | } |
519 | |
520 | collectorToken.reset( |
521 | @@ -147,7 +147,7 @@ |
522 | m_collectorToken = collectorToken; |
523 | } |
524 | |
525 | - return collectorToken; |
526 | + return QList<CollectorToken::Ptr>() << collectorToken; |
527 | } |
528 | |
529 | void DBusMenuCollector::deactivate() { |
530 | |
531 | === modified file 'service/DBusMenuCollector.h' |
532 | --- service/DBusMenuCollector.h 2014-02-17 16:27:22 +0000 |
533 | +++ service/DBusMenuCollector.h 2014-03-14 14:09:41 +0000 |
534 | @@ -47,7 +47,7 @@ |
535 | |
536 | virtual bool isValid() const override; |
537 | |
538 | - virtual CollectorToken::Ptr activate() override; |
539 | + virtual QList<CollectorToken::Ptr> activate() override; |
540 | |
541 | protected Q_SLOTS: |
542 | void WindowRegistered(uint windowId, const QString &service, |
543 | |
544 | === modified file 'service/Factory.cpp' |
545 | --- service/Factory.cpp 2014-03-14 14:09:41 +0000 |
546 | +++ service/Factory.cpp 2014-03-14 14:09:41 +0000 |
547 | @@ -167,8 +167,9 @@ |
548 | } |
549 | |
550 | Collector::Ptr Factory::newGMenuCollector(const QString &name, |
551 | - const QDBusObjectPath &actionPath, const QDBusObjectPath &menuPath) { |
552 | - return Collector::Ptr(new GMenuCollector(name, actionPath, menuPath)); |
553 | + const QMap<QString, QDBusObjectPath> &actions, |
554 | + const QDBusObjectPath &menuPath) { |
555 | + return Collector::Ptr(new GMenuCollector(name, actions, menuPath)); |
556 | } |
557 | |
558 | Collector::Ptr Factory::newGMenuWindowCollector(unsigned int windowId, |
559 | |
560 | === modified file 'service/Factory.h' |
561 | --- service/Factory.h 2014-03-14 14:09:41 +0000 |
562 | +++ service/Factory.h 2014-03-14 14:09:41 +0000 |
563 | @@ -87,7 +87,8 @@ |
564 | const QString &applicationId); |
565 | |
566 | virtual Collector::Ptr newGMenuCollector(const QString &name, |
567 | - const QDBusObjectPath &actionPath, const QDBusObjectPath &menuPath); |
568 | + const QMap<QString, QDBusObjectPath> &actions, |
569 | + const QDBusObjectPath &menuPath); |
570 | |
571 | virtual Collector::Ptr newGMenuWindowCollector(unsigned int windowId, |
572 | const QString &applicationId); |
573 | |
574 | === modified file 'service/GMenuCollector.cpp' |
575 | --- service/GMenuCollector.cpp 2013-12-24 10:02:26 +0000 |
576 | +++ service/GMenuCollector.cpp 2014-03-14 14:09:41 +0000 |
577 | @@ -28,12 +28,11 @@ |
578 | using namespace qtgmenu; |
579 | |
580 | GMenuCollector::GMenuCollector(const QString &name, |
581 | - const QDBusObjectPath &actionPath, const QDBusObjectPath &menuPath) : |
582 | - m_name(name), m_actionPath(actionPath), m_menuPath(menuPath) { |
583 | + const QMap<QString, QDBusObjectPath> &actions, |
584 | + const QDBusObjectPath &menuPath) : |
585 | + m_name(name), m_actions(actions), m_menuPath(menuPath) { |
586 | |
587 | - m_importer.reset( |
588 | - new QtGMenuImporter(m_name, m_menuPath.path(), |
589 | - m_actionPath.path())); |
590 | + m_importer.reset(new QtGMenuImporter(m_name, m_menuPath, actions)); |
591 | |
592 | connect(m_importer.data(), SIGNAL(MenuItemsChanged()), this, |
593 | SLOT(menuItemsChanged())); |
594 | @@ -46,7 +45,7 @@ |
595 | return !m_menuPath.path().isEmpty(); |
596 | } |
597 | |
598 | -CollectorToken::Ptr GMenuCollector::activate() { |
599 | +QList<CollectorToken::Ptr> GMenuCollector::activate() { |
600 | CollectorToken::Ptr collectorToken(m_collectorToken); |
601 | |
602 | std::shared_ptr<QMenu> menu(m_importer->GetQMenu()); |
603 | @@ -58,7 +57,7 @@ |
604 | m_collectorToken = collectorToken; |
605 | } |
606 | |
607 | - return collectorToken; |
608 | + return QList<CollectorToken::Ptr>() << collectorToken; |
609 | } |
610 | |
611 | void GMenuCollector::deactivate() { |
612 | |
613 | === modified file 'service/GMenuCollector.h' |
614 | --- service/GMenuCollector.h 2013-12-24 10:02:26 +0000 |
615 | +++ service/GMenuCollector.h 2014-03-14 14:09:41 +0000 |
616 | @@ -39,14 +39,15 @@ |
617 | public: |
618 | typedef std::shared_ptr<GMenuCollector> Ptr; |
619 | |
620 | - GMenuCollector(const QString &name, const QDBusObjectPath &actionPath, |
621 | + GMenuCollector(const QString &name, |
622 | + const QMap<QString, QDBusObjectPath> &actions, |
623 | const QDBusObjectPath &menuPath); |
624 | |
625 | virtual ~GMenuCollector(); |
626 | |
627 | virtual bool isValid() const override; |
628 | |
629 | - virtual CollectorToken::Ptr activate() override; |
630 | + virtual QList<CollectorToken::Ptr> activate() override; |
631 | |
632 | protected Q_SLOTS: |
633 | void menuItemsChanged(); |
634 | @@ -58,7 +59,7 @@ |
635 | |
636 | QString m_name; |
637 | |
638 | - QDBusObjectPath m_actionPath; |
639 | + QMap<QString, QDBusObjectPath> m_actions; |
640 | |
641 | QDBusObjectPath m_menuPath; |
642 | |
643 | |
644 | === modified file 'service/GMenuWindowCollector.cpp' |
645 | --- service/GMenuWindowCollector.cpp 2013-11-27 15:04:13 +0000 |
646 | +++ service/GMenuWindowCollector.cpp 2014-03-14 14:09:41 +0000 |
647 | @@ -62,35 +62,53 @@ |
648 | return; |
649 | } |
650 | |
651 | + QSet<QDBusObjectPath> menus; |
652 | + QMap<QString, QDBusObjectPath> actions; |
653 | + |
654 | if (!windowProperties.at(1).isEmpty()) { |
655 | - m_appmenuPath = QDBusObjectPath(windowProperties.at(1)); |
656 | + // _GTK_APP_MENU_OBJECT_PATH -> menu |
657 | + menus << QDBusObjectPath(windowProperties.at(1)); |
658 | } |
659 | if (!windowProperties.at(2).isEmpty()) { |
660 | - m_menubarPath = QDBusObjectPath(windowProperties.at(2)); |
661 | + // _GTK_MENUBAR_OBJECT_PATH -> menu |
662 | + menus << QDBusObjectPath(windowProperties.at(2)); |
663 | } |
664 | if (!windowProperties.at(3).isEmpty()) { |
665 | - m_applicationPath = QDBusObjectPath(windowProperties.at(3)); |
666 | + // _GTK_APPLICATION_OBJECT_PATH -> actions with prefix "app" |
667 | + actions["app"] = QDBusObjectPath(windowProperties.at(3)); |
668 | } |
669 | if (!windowProperties.at(4).isEmpty()) { |
670 | - m_windowPath = QDBusObjectPath(windowProperties.at(4)); |
671 | + // _GTK_WINDOW_OBJECT_PATH -> actions with prefix "win" |
672 | + actions["win"] = QDBusObjectPath(windowProperties.at(4)); |
673 | } |
674 | if (!windowProperties.at(5).isEmpty()) { |
675 | - m_unityPath = QDBusObjectPath(windowProperties.at(5)); |
676 | + // _UNITY_OBJECT_PATH -> menu + action with prefix "unity" |
677 | + menus << QDBusObjectPath(windowProperties.at(5)); |
678 | + actions["unity"] = QDBusObjectPath(windowProperties.at(5)); |
679 | } |
680 | |
681 | - m_menubarCollector = factory.newGMenuCollector(m_busName, m_menubarPath, |
682 | - m_menubarPath); |
683 | + if (!actions.isEmpty()) { |
684 | + for (const QDBusObjectPath &menu : menus) { |
685 | + m_collectors << factory.newGMenuCollector(m_busName, actions, menu); |
686 | + } |
687 | + } |
688 | } |
689 | |
690 | GMenuWindowCollector::~GMenuWindowCollector() { |
691 | } |
692 | |
693 | bool GMenuWindowCollector::isValid() const { |
694 | - return !m_menubarPath.path().isEmpty(); |
695 | + return !m_collectors.isEmpty(); |
696 | } |
697 | |
698 | -CollectorToken::Ptr GMenuWindowCollector::activate() { |
699 | - return m_menubarCollector->activate(); |
700 | +QList<CollectorToken::Ptr> GMenuWindowCollector::activate() { |
701 | + QList<CollectorToken::Ptr> tokens; |
702 | + |
703 | + for (Collector::Ptr collector : m_collectors) { |
704 | + tokens.append(collector->activate()); |
705 | + } |
706 | + |
707 | + return tokens; |
708 | } |
709 | |
710 | void GMenuWindowCollector::deactivate() { |
711 | |
712 | === modified file 'service/GMenuWindowCollector.h' |
713 | --- service/GMenuWindowCollector.h 2013-12-17 16:37:55 +0000 |
714 | +++ service/GMenuWindowCollector.h 2014-03-14 14:09:41 +0000 |
715 | @@ -47,30 +47,16 @@ |
716 | |
717 | virtual bool isValid() const override; |
718 | |
719 | - virtual CollectorToken::Ptr activate() override; |
720 | + virtual QList<CollectorToken::Ptr> activate() override; |
721 | |
722 | protected: |
723 | virtual void deactivate(); |
724 | |
725 | QSharedPointer<ComCanonicalUnityWindowStackInterface> m_windowStack; |
726 | |
727 | - QWeakPointer<CollectorToken> m_collectorToken; |
728 | - |
729 | QString m_busName; |
730 | |
731 | - QDBusObjectPath m_appmenuPath; |
732 | - |
733 | - QDBusObjectPath m_menubarPath; |
734 | - |
735 | - QDBusObjectPath m_applicationPath; |
736 | - |
737 | - QDBusObjectPath m_windowPath; |
738 | - |
739 | - QDBusObjectPath m_unityPath; |
740 | - |
741 | - Collector::Ptr m_menubarCollector; |
742 | - |
743 | - std::shared_ptr<QMenu> m_menubar; |
744 | + QList<Collector::Ptr> m_collectors; |
745 | }; |
746 | |
747 | } |
748 | |
749 | === modified file 'service/WindowContextImpl.cpp' |
750 | --- service/WindowContextImpl.cpp 2013-11-27 22:45:10 +0000 |
751 | +++ service/WindowContextImpl.cpp 2014-03-14 14:09:41 +0000 |
752 | @@ -46,8 +46,11 @@ |
753 | void WindowContextImpl::addMenu(const QString &context, |
754 | const MenuDefinition &menuDefinition) { |
755 | |
756 | + QMap<QString, QDBusObjectPath> actions; |
757 | + actions[menuDefinition.actionPrefix] = menuDefinition.actionPath; |
758 | + |
759 | m_collectors[context] = m_factory.newGMenuCollector(menuDefinition.name, |
760 | - menuDefinition.actionPath, menuDefinition.menuPath); |
761 | + actions, menuDefinition.menuPath); |
762 | } |
763 | |
764 | Collector::Ptr WindowContextImpl::activeCollector() { |
765 | |
766 | === modified file 'service/WindowImpl.cpp' |
767 | --- service/WindowImpl.cpp 2014-03-14 14:09:41 +0000 |
768 | +++ service/WindowImpl.cpp 2014-03-14 14:09:41 +0000 |
769 | @@ -95,10 +95,7 @@ |
770 | QList<CollectorToken::Ptr> tokens; |
771 | for (Collector::Ptr collector : collectors) { |
772 | if (collector && collector->isValid()) { |
773 | - CollectorToken::Ptr token(collector->activate()); |
774 | - if (token) { |
775 | - tokens << token; |
776 | - } |
777 | + tokens.append(collector->activate()); |
778 | } |
779 | } |
780 | |
781 | |
782 | === modified file 'tests/integration/TestHud.cpp' |
783 | --- tests/integration/TestHud.cpp 2014-03-14 14:09:41 +0000 |
784 | +++ tests/integration/TestHud.cpp 2014-03-14 14:09:41 +0000 |
785 | @@ -239,7 +239,7 @@ |
786 | " ret.append('/menu')\n" |
787 | " ret.append('')\n" |
788 | " ret.append('')\n" |
789 | - " ret.append('')\n" |
790 | + " ret.append('/menu')\n" |
791 | "else:\n" |
792 | " for arg in args[2]:\n" |
793 | " ret.append('')").waitForFinished(); |
794 | @@ -339,7 +339,7 @@ |
795 | " ret.append('/menu')\n" |
796 | " ret.append('')\n" |
797 | " ret.append('')\n" |
798 | - " ret.append('')\n" |
799 | + " ret.append('/menu')\n" |
800 | "else:\n" |
801 | " for arg in args[2]:\n" |
802 | " ret.append('')").waitForFinished(); |
803 | |
804 | === modified file 'tests/testapps/qtgmenu/MainWindow.cpp' |
805 | --- tests/testapps/qtgmenu/MainWindow.cpp 2013-11-23 11:42:04 +0000 |
806 | +++ tests/testapps/qtgmenu/MainWindow.cpp 2014-03-14 14:09:41 +0000 |
807 | @@ -2,8 +2,8 @@ |
808 | |
809 | #include <QtWidgets> |
810 | |
811 | -MainWindow::MainWindow(const QString &name, const QString &actionPath, const QString &menuPath) |
812 | - : m_menu_importer( name, menuPath, actionPath ) |
813 | +MainWindow::MainWindow(const QString &name, const QDBusObjectPath &actionPath, const QDBusObjectPath &menuPath) |
814 | + : m_menu_importer( name, menuPath, "", actionPath ) |
815 | { |
816 | m_refresh_connection = connect( &m_menu_importer, SIGNAL( MenuItemsChanged() ), this, |
817 | SLOT( RefreshMenus() ) ); |
818 | |
819 | === modified file 'tests/testapps/qtgmenu/MainWindow.h' |
820 | --- tests/testapps/qtgmenu/MainWindow.h 2013-11-23 11:42:04 +0000 |
821 | +++ tests/testapps/qtgmenu/MainWindow.h 2014-03-14 14:09:41 +0000 |
822 | @@ -10,7 +10,7 @@ |
823 | Q_OBJECT |
824 | |
825 | public: |
826 | - MainWindow(const QString &name, const QString &actionPath, const QString &menuPath); |
827 | + MainWindow(const QString &name, const QDBusObjectPath &actionPath, const QDBusObjectPath &menuPath); |
828 | |
829 | ~MainWindow(); |
830 | |
831 | |
832 | === modified file 'tests/testapps/qtgmenu/main.cpp' |
833 | --- tests/testapps/qtgmenu/main.cpp 2013-11-23 11:42:04 +0000 |
834 | +++ tests/testapps/qtgmenu/main.cpp 2014-03-14 14:09:41 +0000 |
835 | @@ -29,7 +29,7 @@ |
836 | return 1; |
837 | } |
838 | |
839 | - MainWindow mainWindow(argv[1], argv[2], argv[3]); |
840 | + MainWindow mainWindow(argv[1], QDBusObjectPath( argv[2] ), QDBusObjectPath( argv[3] ) ); |
841 | mainWindow.show(); |
842 | |
843 | return application.exec(); |
844 | |
845 | === modified file 'tests/unit/qtgmenu/TestQtGMenu.cpp' |
846 | --- tests/unit/qtgmenu/TestQtGMenu.cpp 2013-12-24 10:02:26 +0000 |
847 | +++ tests/unit/qtgmenu/TestQtGMenu.cpp 2014-03-14 14:09:41 +0000 |
848 | @@ -40,7 +40,7 @@ |
849 | |
850 | protected: |
851 | TestQtGMenu() |
852 | - : m_importer( c_service, c_path ), |
853 | + : m_importer( c_service, QDBusObjectPath( c_path ), "", QDBusObjectPath( c_path ) ), |
854 | |
855 | m_items_changed_spy( &m_importer, SIGNAL( MenuItemsChanged() ) ), |
856 | |
857 | |
858 | === modified file 'tests/unit/service/Mocks.h' |
859 | --- tests/unit/service/Mocks.h 2014-03-14 14:09:41 +0000 |
860 | +++ tests/unit/service/Mocks.h 2014-03-14 14:09:41 +0000 |
861 | @@ -49,7 +49,8 @@ |
862 | MOCK_METHOD2(newGMenuWindowCollector, Collector::Ptr(unsigned int, const QString &)); |
863 | |
864 | MOCK_METHOD3(newGMenuCollector, Collector::Ptr(const QString &, |
865 | - const QDBusObjectPath &, const QDBusObjectPath &)); |
866 | + const QMap<QString, QDBusObjectPath> &, |
867 | + const QDBusObjectPath &)); |
868 | }; |
869 | |
870 | class MockHudService: public HudService { |
871 | @@ -163,7 +164,7 @@ |
872 | public: |
873 | MOCK_CONST_METHOD0(isValid, bool()); |
874 | |
875 | - MOCK_METHOD0(activate, CollectorToken::Ptr()); |
876 | + MOCK_METHOD0(activate, QList<CollectorToken::Ptr>()); |
877 | |
878 | MOCK_METHOD2(search, void(const QString &, QList<Result> &)); |
879 | |
880 | |
881 | === modified file 'tests/unit/service/TestWindow.cpp' |
882 | --- tests/unit/service/TestWindow.cpp 2013-12-19 16:10:20 +0000 |
883 | +++ tests/unit/service/TestWindow.cpp 2014-03-14 14:09:41 +0000 |
884 | @@ -110,7 +110,7 @@ |
885 | CollectorToken::Ptr dbusMenuCollectorToken( |
886 | new CollectorToken(dbusMenuCollector, &dbusMenuCollectorMenu)); |
887 | EXPECT_CALL(*dbusMenuCollector, activate()).Times(1).WillOnce( |
888 | - Return(dbusMenuCollectorToken)); |
889 | + Return(QList<CollectorToken::Ptr>() << dbusMenuCollectorToken)); |
890 | |
891 | WindowToken::Ptr token(window->activate()); |
892 | EXPECT_EQ(QList<CollectorToken::Ptr>() << dbusMenuCollectorToken, |
893 | @@ -129,7 +129,7 @@ |
894 | new CollectorToken(gmenuWindowCollector, |
895 | &gmenuWindowCollectorMenu)); |
896 | EXPECT_CALL(*gmenuWindowCollector, activate()).Times(1).WillOnce( |
897 | - Return(gmenuWindowCollectorToken)); |
898 | + Return(QList<CollectorToken::Ptr>() << gmenuWindowCollectorToken)); |
899 | |
900 | WindowToken::Ptr token(window->activate()); |
901 | EXPECT_EQ(QList<CollectorToken::Ptr>() << gmenuWindowCollectorToken, |
902 | @@ -147,7 +147,7 @@ |
903 | CollectorToken::Ptr allWindowsCollectorToken( |
904 | new CollectorToken(allWindowsCollector, &allWindowsCollectorMenu)); |
905 | EXPECT_CALL(*allWindowsCollector, activate()).Times(1).WillOnce( |
906 | - Return(allWindowsCollectorToken)); |
907 | + Return(QList<CollectorToken::Ptr>() << allWindowsCollectorToken)); |
908 | |
909 | ON_CALL(*allWindowsContext, activeCollector()).WillByDefault( |
910 | Return(allWindowsCollector)); |
911 | @@ -169,7 +169,10 @@ |
912 | definition.actionPrefix = "hud"; |
913 | definition.menuPath = QDBusObjectPath("/menu/path"); |
914 | |
915 | - EXPECT_CALL(factory, newGMenuCollector(definition.name, definition.actionPath, definition.menuPath)).Times( |
916 | + QMap<QString, QDBusObjectPath> actions; |
917 | + actions[definition.actionPrefix] = definition.actionPath; |
918 | + |
919 | + EXPECT_CALL(factory, newGMenuCollector(definition.name, actions, definition.menuPath)).Times( |
920 | 1).WillOnce(Return(windowCollector)); |
921 | |
922 | window->addMenu("context_1", definition); |
923 | @@ -179,7 +182,7 @@ |
924 | CollectorToken::Ptr windowCollectorToken( |
925 | new CollectorToken(windowCollector, &windowCollectorMenu)); |
926 | EXPECT_CALL(*windowCollector, activate()).Times(1).WillOnce( |
927 | - Return(windowCollectorToken)); |
928 | + Return(QList<CollectorToken::Ptr>() << windowCollectorToken)); |
929 | |
930 | WindowToken::Ptr token(window->activate()); |
931 | EXPECT_EQ(QList<CollectorToken::Ptr>() << windowCollectorToken, |
932 | @@ -196,19 +199,19 @@ |
933 | new CollectorToken(gmenuWindowCollector, |
934 | &gmenuWindowCollectorMenu)); |
935 | EXPECT_CALL(*gmenuWindowCollector, activate()).Times(1).WillOnce( |
936 | - Return(gmenuWindowCollectorToken)); |
937 | + Return(QList<CollectorToken::Ptr>() << gmenuWindowCollectorToken)); |
938 | |
939 | QMenu dbusMenuCollectorMenu; |
940 | CollectorToken::Ptr dbusMenuCollectorToken( |
941 | new CollectorToken(dbusMenuCollector, &dbusMenuCollectorMenu)); |
942 | EXPECT_CALL(*dbusMenuCollector, activate()).Times(1).WillOnce( |
943 | - Return(dbusMenuCollectorToken)); |
944 | + Return(QList<CollectorToken::Ptr>() << dbusMenuCollectorToken)); |
945 | |
946 | QMenu allWindowsCollectorMenu; |
947 | CollectorToken::Ptr allWindowsCollectorToken( |
948 | new CollectorToken(allWindowsCollector, &allWindowsCollectorMenu)); |
949 | EXPECT_CALL(*allWindowsCollector, activate()).Times(1).WillOnce( |
950 | - Return(allWindowsCollectorToken)); |
951 | + Return(QList<CollectorToken::Ptr>() << allWindowsCollectorToken)); |
952 | ON_CALL(*allWindowsContext, activeCollector()).WillByDefault( |
953 | Return(allWindowsCollector)); |
954 | |
955 | @@ -224,13 +227,13 @@ |
956 | new CollectorToken(gmenuWindowCollector, |
957 | &gmenuWindowCollectorMenuChanged)); |
958 | EXPECT_CALL(*gmenuWindowCollector, activate()).Times(1).WillOnce( |
959 | - Return(gmenuWindowCollectorTokenChanged)); |
960 | + Return(QList<CollectorToken::Ptr>() << gmenuWindowCollectorTokenChanged)); |
961 | |
962 | // Re-prime the other collectors |
963 | EXPECT_CALL(*dbusMenuCollector, activate()).Times(1).WillOnce( |
964 | - Return(dbusMenuCollectorToken)); |
965 | + Return(QList<CollectorToken::Ptr>() << dbusMenuCollectorToken)); |
966 | EXPECT_CALL(*allWindowsCollector, activate()).Times(1).WillOnce( |
967 | - Return(allWindowsCollectorToken)); |
968 | + Return(QList<CollectorToken::Ptr>() << allWindowsCollectorToken)); |
969 | |
970 | WindowToken::Ptr tokenChanged(window->activate()); |
971 | EXPECT_NE(token, tokenChanged); |
972 | @@ -249,7 +252,10 @@ |
973 | definition.actionPrefix = "hud"; |
974 | definition.menuPath = QDBusObjectPath("/menu/path"); |
975 | |
976 | - EXPECT_CALL(factory, newGMenuCollector(definition.name, definition.actionPath, definition.menuPath)).Times( |
977 | + QMap<QString, QDBusObjectPath> actions; |
978 | + actions[definition.actionPrefix] = definition.actionPath; |
979 | + |
980 | + EXPECT_CALL(factory, newGMenuCollector(definition.name, actions, definition.menuPath)).Times( |
981 | 1).WillOnce(Return(windowCollector)); |
982 | |
983 | context.addMenu("context_1", definition); |
FAILED: Continuous integration, rev:386 jenkins. qa.ubuntu. com/job/ hud-ci/ 246/ jenkins. qa.ubuntu. com/job/ hud-trusty- amd64-ci/ 97/console jenkins. qa.ubuntu. com/job/ hud-trusty- armhf-ci/ 96/console jenkins. qa.ubuntu. com/job/ hud-trusty- i386-ci/ 96/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/hud- ci/246/ rebuild
http://