Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/contextMenu into lp:ubuntu-ui-toolkit/staging
- contextMenu
- Merge into staging
Proposed by
Cris Dywan
Status: | Work in progress |
---|---|
Proposed branch: | lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/contextMenu |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
615 lines (+374/-47) (has conflicts) 15 files modified
components.api (+17/-0) examples/ubuntu-ui-toolkit-gallery/ExampleContextMenu.qml (+59/-0) examples/ubuntu-ui-toolkit-gallery/NewListItems.qml (+6/-0) examples/ubuntu-ui-toolkit-gallery/Popover.qml (+5/-0) src/Ubuntu/Components/ComponentModule.pro (+4/-0) src/Ubuntu/Components/Popups/1.3/ContextMenu.qml (+44/-0) src/Ubuntu/Components/Popups/1.3/ListItemContextMenu.qml (+11/-47) src/Ubuntu/Components/Popups/1.3/MenuGroup.qml (+46/-0) src/Ubuntu/Components/Popups/1.3/MenuItem.qml (+86/-0) src/Ubuntu/Components/Popups/1.3/Popover.qml (+1/-0) src/Ubuntu/Components/Popups/Popups.pro (+4/-0) src/Ubuntu/Components/Popups/qmldir (+3/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/ContextMenuForegroundStyle.qml (+43/-0) src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro (+2/-0) src/Ubuntu/Components/plugin/uclistitem.cpp (+43/-0) Text conflict in components.api Text conflict in src/Ubuntu/Components/ComponentModule.pro Text conflict in src/Ubuntu/Components/plugin/uclistitem.cpp |
To merge this branch: | bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/contextMenu |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu SDK team | Pending | ||
Review via email: mp+281835@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Unmerged revisions
- 1607. By Cris Dywan
-
Proper looks
- 1606. By Cris Dywan
-
Example context menu
- 1605. By Cris Dywan
-
Implement ContextMenu/ MenuGroup/ (internal) MenuItem
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'components.api' |
2 | --- components.api 2015-12-19 10:06:24 +0000 |
3 | +++ components.api 2016-01-07 10:05:16 +0000 |
4 | @@ -303,7 +303,12 @@ |
5 | default property Component layout |
6 | property string name |
7 | property QQmlBinding when |
8 | +<<<<<<< TREE |
9 | Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1 UPMCpuUsage: Item |
10 | +======= |
11 | +Ubuntu.Components.Popups.ContextMenu 1.3: Popover |
12 | +Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1: Item |
13 | +>>>>>>> MERGE-SOURCE |
14 | readonly property UPMGraphModel graphModel |
15 | property int period |
16 | property int samplingInterval |
17 | @@ -614,6 +619,7 @@ |
18 | default property list<QtObject> contentsItem |
19 | Ubuntu.Components.MainView 1.3: MainViewBase |
20 | property bool automaticOrientation |
21 | +<<<<<<< TREE |
22 | default property list<QtObject> contentsItem |
23 | Ubuntu.Components.MathUtils 1.0 0.1: QtObject singleton |
24 | function double clamp(double x, double min, double max) |
25 | @@ -621,6 +627,16 @@ |
26 | function double projectValue(double x, double xmin, double xmax, double ymin, double ymax) |
27 | function double clampAndProject(double x, double xmin, double xmax, double ymin, double ymax) |
28 | Ubuntu.Components.MimeData 1.0 0.1 QQuickMimeData: QtObject |
29 | +======= |
30 | + default readonly property QtObject contentsItem |
31 | +Ubuntu.Components.MathUtils 0.1 1.0 1.3 |
32 | +Ubuntu.Components.Popups.MenuGroup 1.3: Column |
33 | + readonly property QtObject actions |
34 | + property Component delegate |
35 | + property ContextMenu menu |
36 | + property string text |
37 | +Ubuntu.Components.MimeData 1.0 0.1: QtObject |
38 | +>>>>>>> MERGE-SOURCE |
39 | property color color |
40 | property var data |
41 | readonly property QStringList formats |
42 | @@ -935,6 +951,7 @@ |
43 | function var show() |
44 | function var hide() |
45 | property Item pointerTarget |
46 | + property string styleName |
47 | Ubuntu.Components.Popups.PopupBase 1.0 0.1: OrientationHelper |
48 | property Item dismissArea |
49 | property PropertyAnimation fadingAnimation |
50 | |
51 | === added file 'examples/ubuntu-ui-toolkit-gallery/ExampleContextMenu.qml' |
52 | --- examples/ubuntu-ui-toolkit-gallery/ExampleContextMenu.qml 1970-01-01 00:00:00 +0000 |
53 | +++ examples/ubuntu-ui-toolkit-gallery/ExampleContextMenu.qml 2016-01-07 10:05:16 +0000 |
54 | @@ -0,0 +1,59 @@ |
55 | +/* |
56 | + * Copyright 2015 Canonical Ltd. |
57 | + * |
58 | + * This program is free software; you can redistribute it and/or modify |
59 | + * it under the terms of the GNU Lesser General Public License as published by |
60 | + * the Free Software Foundation; version 3. |
61 | + * |
62 | + * This program is distributed in the hope that it will be useful, |
63 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
64 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
65 | + * GNU Lesser General Public License for more details. |
66 | + * |
67 | + * You should have received a copy of the GNU Lesser General Public License |
68 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
69 | + */ |
70 | + |
71 | +import QtQuick 2.4 |
72 | +import Ubuntu.Components 1.3 |
73 | +import Ubuntu.Components.Popups 1.3 |
74 | + |
75 | +ContextMenu { |
76 | + MenuGroup { |
77 | + Action { |
78 | + text: i18n.tr("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.") |
79 | + shortcut: 'Alt+P' |
80 | + } |
81 | + Action { |
82 | + iconName: 'compose' |
83 | + text: i18n.tr("Once upon a time there was a story nobody told.") |
84 | + enabled: false |
85 | + shortcut: 'Ctrl+Shift+T' |
86 | + } |
87 | + } |
88 | + MenuGroup { |
89 | + Action { |
90 | + iconName: 'delete' |
91 | + text: i18n.tr("Delete") |
92 | + shortcut: 'Del' |
93 | + } |
94 | + MenuGroup { |
95 | + text: i18n.tr("But wait, there's more") |
96 | + Action { |
97 | + text: i18n.tr("Send an email") |
98 | + shortcut: 'Ctrl+C' |
99 | + enabled: false |
100 | + } |
101 | + Action { |
102 | + iconName: 'save-to' |
103 | + text: i18n.tr("Save to file") |
104 | + shortcut: 'Shift+S' |
105 | + } |
106 | + } |
107 | + MenuGroup { |
108 | + text: i18n.tr("Forever moar quoth the raven") |
109 | + enabled: false |
110 | + } |
111 | + } |
112 | +} |
113 | + |
114 | |
115 | === modified file 'examples/ubuntu-ui-toolkit-gallery/NewListItems.qml' |
116 | --- examples/ubuntu-ui-toolkit-gallery/NewListItems.qml 2015-09-28 12:26:13 +0000 |
117 | +++ examples/ubuntu-ui-toolkit-gallery/NewListItems.qml 2016-01-07 10:05:16 +0000 |
118 | @@ -49,9 +49,12 @@ |
119 | actions: [ |
120 | Action { |
121 | iconName: "tick" |
122 | + text: i18n.tr('Check') |
123 | + enabled: false |
124 | }, |
125 | Action { |
126 | iconName: "delete" |
127 | + text: i18n.tr('Delete') |
128 | } |
129 | ] |
130 | } |
131 | @@ -60,9 +63,12 @@ |
132 | actions: [ |
133 | Action { |
134 | iconName: "edit" |
135 | + text: i18n.tr('Edit') |
136 | }, |
137 | Action { |
138 | iconName: "save-to" |
139 | + text: i18n.tr('Save As') |
140 | + enabled: false |
141 | } |
142 | ] |
143 | } |
144 | |
145 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Popover.qml' |
146 | --- examples/ubuntu-ui-toolkit-gallery/Popover.qml 2015-06-24 16:16:51 +0000 |
147 | +++ examples/ubuntu-ui-toolkit-gallery/Popover.qml 2016-01-07 10:05:16 +0000 |
148 | @@ -27,6 +27,11 @@ |
149 | iconSource: "call_icon.png" |
150 | onTriggered: PopupUtils.open(actionSelectionPopover) |
151 | visible: true |
152 | + }, |
153 | + Action { |
154 | + text: "Context menu" |
155 | + iconName: "like" |
156 | + onTriggered: PopupUtils.open(Qt.resolvedUrl('ExampleContextMenu.qml'), popoverWithFlickableButton) |
157 | } |
158 | ] |
159 | |
160 | |
161 | === modified file 'src/Ubuntu/Components/ComponentModule.pro' |
162 | --- src/Ubuntu/Components/ComponentModule.pro 2015-12-17 13:48:23 +0000 |
163 | +++ src/Ubuntu/Components/ComponentModule.pro 2016-01-07 10:05:16 +0000 |
164 | @@ -126,12 +126,16 @@ |
165 | 1.3/UbuntuColors.qml \ |
166 | 1.3/UbuntuListView.qml \ |
167 | 1.3/UbuntuNumberAnimation.qml \ |
168 | +<<<<<<< TREE |
169 | 1.3/ListItemPopover.qml \ |
170 | 1.3/PageColumn.qml \ |
171 | 1.3/PageColumnsLayout.qml \ |
172 | 1.3/ProgressionSlot.qml \ |
173 | 1.3/ScrollView.qml \ |
174 | 1.3/PageHeader.qml |
175 | +======= |
176 | + 1.3/BottomEdgeHint.qml |
177 | +>>>>>>> MERGE-SOURCE |
178 | |
179 | OTHER_FILES+= qmldir \ |
180 | 1.3/CrossFadeImage.qdoc \ |
181 | |
182 | === added file 'src/Ubuntu/Components/Popups/1.3/ContextMenu.qml' |
183 | --- src/Ubuntu/Components/Popups/1.3/ContextMenu.qml 1970-01-01 00:00:00 +0000 |
184 | +++ src/Ubuntu/Components/Popups/1.3/ContextMenu.qml 2016-01-07 10:05:16 +0000 |
185 | @@ -0,0 +1,44 @@ |
186 | +/* |
187 | + * Copyright 2015 Canonical Ltd. |
188 | + * |
189 | + * This program is free software; you can redistribute it and/or modify |
190 | + * it under the terms of the GNU Lesser General Public License as published by |
191 | + * the Free Software Foundation; version 3. |
192 | + * |
193 | + * This program is distributed in the hope that it will be useful, |
194 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
195 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
196 | + * GNU Lesser General Public License for more details. |
197 | + * |
198 | + * You should have received a copy of the GNU Lesser General Public License |
199 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
200 | + */ |
201 | + |
202 | +import QtQuick 2.4 |
203 | +import Ubuntu.Components 1.3 |
204 | + |
205 | +Popover { |
206 | + id: contextmenu |
207 | + objectName: 'ContextMenu' |
208 | + contentHeight: Math.max(column.childrenRect.height, units.gu(4)) |
209 | + contentWidth: Math.max(column.childrenRect.width, units.gu(4)) |
210 | + |
211 | + default property alias children: column.children |
212 | + |
213 | + // FIXME: styleName: "ContextMenuForegroundStyle" |
214 | + Column { |
215 | + id: column |
216 | + anchors { |
217 | + left: parent.left |
218 | + top: parent.top |
219 | + right: parent.right |
220 | + } |
221 | + } |
222 | + |
223 | + // Hide the arrow |
224 | + Binding { |
225 | + target: __foreground |
226 | + property: "direction" |
227 | + value: "none" |
228 | + } |
229 | +} |
230 | |
231 | === renamed file 'src/Ubuntu/Components/1.3/ListItemPopover.qml' => 'src/Ubuntu/Components/Popups/1.3/ListItemContextMenu.qml' |
232 | --- src/Ubuntu/Components/1.3/ListItemPopover.qml 2015-07-01 12:06:34 +0000 |
233 | +++ src/Ubuntu/Components/Popups/1.3/ListItemContextMenu.qml 2016-01-07 10:05:16 +0000 |
234 | @@ -18,53 +18,17 @@ |
235 | import Ubuntu.Components 1.3 |
236 | import Ubuntu.Components.Popups 1.3 |
237 | |
238 | -ActionSelectionPopover { |
239 | - id: popover |
240 | +ContextMenu { |
241 | objectName: 'listItemContextMenu' |
242 | - contentWidth: units.gu(25) |
243 | - |
244 | - delegate: ListItem { |
245 | - contentItem.anchors { |
246 | - leftMargin: units.gu(2) |
247 | - rightMargin: units.gu(2) |
248 | - topMargin: units.gu(0.5) |
249 | - bottomMargin: units.gu(0.5) |
250 | - } |
251 | - divider.visible: action != actions[actions.length - 1] |
252 | - |
253 | - Label { |
254 | - anchors.verticalCenter: parent.verticalCenter |
255 | - text: action.text |
256 | - color: '#5D5D5D' |
257 | - } |
258 | - |
259 | - onClicked: popover.hide() |
260 | - } |
261 | - |
262 | - function mergeActions(to, from) { |
263 | - if (from == null) |
264 | - return; |
265 | - |
266 | - var actions = from.actions; |
267 | - for (var i in actions) { |
268 | - var action = actions[i]; |
269 | - if (!action.text) |
270 | - action.text = action.iconName; |
271 | - to.push(actions[i]); |
272 | - } |
273 | - } |
274 | - |
275 | - onCallerChanged: { |
276 | - var all = []; |
277 | - mergeActions(all, caller.leadingActions); |
278 | - mergeActions(all, caller.trailingActions); |
279 | - actions = all; |
280 | - } |
281 | - |
282 | - // Hide the arrow |
283 | - Binding { |
284 | - target: __foreground |
285 | - property: "direction" |
286 | - value: "none" |
287 | + caller: ListItem { |
288 | + } |
289 | + |
290 | + MenuGroup { |
291 | + objectName: 'leadingActions' |
292 | + actions: caller.leadingActions ? caller.leadingActions.actions : [] |
293 | + } |
294 | + MenuGroup { |
295 | + objectName: 'trailingActions' |
296 | + actions: caller.trailingActions ? caller.trailingActions.actions : [] |
297 | } |
298 | } |
299 | |
300 | === added file 'src/Ubuntu/Components/Popups/1.3/MenuGroup.qml' |
301 | --- src/Ubuntu/Components/Popups/1.3/MenuGroup.qml 1970-01-01 00:00:00 +0000 |
302 | +++ src/Ubuntu/Components/Popups/1.3/MenuGroup.qml 2016-01-07 10:05:16 +0000 |
303 | @@ -0,0 +1,46 @@ |
304 | +/* |
305 | + * Copyright 2015 Canonical Ltd. |
306 | + * |
307 | + * This program is free software; you can redistribute it and/or modify |
308 | + * it under the terms of the GNU Lesser General Public License as published by |
309 | + * the Free Software Foundation; version 3. |
310 | + * |
311 | + * This program is distributed in the hope that it will be useful, |
312 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
313 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
314 | + * GNU Lesser General Public License for more details. |
315 | + * |
316 | + * You should have received a copy of the GNU Lesser General Public License |
317 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
318 | + */ |
319 | + |
320 | +import QtQuick 2.4 |
321 | +import Ubuntu.Components 1.3 |
322 | + |
323 | +Column { |
324 | + id: group |
325 | + property ContextMenu menu |
326 | + property list<QtObject> actions |
327 | + default property alias children: group.actions |
328 | + property Component delegate: MenuItem { |
329 | + action: modelData.hasOwnProperty('shortcut') ? modelData : null |
330 | + text: modelData.text |
331 | + enabled: modelData.enabled |
332 | + onClicked: contextmenu.hide() // FIXME |
333 | + divider.visible: action == actions[group.actions.length - 1] |
334 | + } |
335 | + property string text |
336 | + |
337 | + Loader { |
338 | + property var modelData: Action { |
339 | + text: group.text |
340 | + } |
341 | + active: group.text !== '' |
342 | + sourceComponent: group.delegate |
343 | + } |
344 | + |
345 | + Repeater { |
346 | + model: actions |
347 | + delegate: group.delegate |
348 | + } |
349 | +} |
350 | |
351 | === added file 'src/Ubuntu/Components/Popups/1.3/MenuItem.qml' |
352 | --- src/Ubuntu/Components/Popups/1.3/MenuItem.qml 1970-01-01 00:00:00 +0000 |
353 | +++ src/Ubuntu/Components/Popups/1.3/MenuItem.qml 2016-01-07 10:05:16 +0000 |
354 | @@ -0,0 +1,86 @@ |
355 | +/* |
356 | + * Copyright 2015 Canonical Ltd. |
357 | + * |
358 | + * This program is free software; you can redistribute it and/or modify |
359 | + * it under the terms of the GNU Lesser General Public License as published by |
360 | + * the Free Software Foundation; version 3. |
361 | + * |
362 | + * This program is distributed in the hope that it will be useful, |
363 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
364 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
365 | + * GNU Lesser General Public License for more details. |
366 | + * |
367 | + * You should have received a copy of the GNU Lesser General Public License |
368 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
369 | + */ |
370 | + |
371 | +import QtQuick 2.4 |
372 | +import Ubuntu.Components 1.3 |
373 | + |
374 | +ListItem { |
375 | + id: menuitem |
376 | + contentItem.anchors { |
377 | + leftMargin: units.gu(2) |
378 | + rightMargin: units.gu(2) |
379 | + } |
380 | + width: row.spacing + units.gu(25) + hotkey.width + units.gu(4) |
381 | + height: units.gu(4) |
382 | + |
383 | + color: '#ffffff' |
384 | + opacity: selected || hovered ? 0.08 : 1.0 |
385 | + Mouse.onEntered: hovered = true |
386 | + Mouse.onExited: hovered = false |
387 | + property bool hovered |
388 | + property string text |
389 | + enabled: action ? action.enabled : true |
390 | + |
391 | + Row { |
392 | + id: row |
393 | + anchors.left: parent.left |
394 | + anchors.verticalCenter: parent.verticalCenter |
395 | + anchors.right: shortcut.left |
396 | + spacing: units.gu(1) |
397 | + |
398 | + Icon { |
399 | + id: icon |
400 | + name: action ? action.iconName : '' |
401 | + width: visible ? units.gu(2) : 0 |
402 | + height: width |
403 | + opacity: label.opacity |
404 | + visible: name != '' |
405 | + } |
406 | + |
407 | + Label { |
408 | + id: label |
409 | + text: action ? action.text : menuitem.text |
410 | + color: '#333333' |
411 | + opacity: menuitem.enabled ? 1.0 : 0.3 |
412 | + elide: Text.ElideRight |
413 | + width: units.gu(25) - icon.width |
414 | + } |
415 | + } |
416 | + |
417 | + Row { |
418 | + id: shortcut |
419 | + anchors.right: parent.right |
420 | + anchors.verticalCenter: parent.verticalCenter |
421 | + opacity: label.opacity |
422 | + |
423 | + Label { |
424 | + id: hotkey |
425 | + property string shortcut: action && action.shortcut ? action.shortcut : '' |
426 | + text: hotkey.shortcut.replace('Ctrl+', '^').replace('Shift+', '⇧') |
427 | + color: label.color |
428 | + visible: shortcut != '' |
429 | + width: units.gu(5) |
430 | + } |
431 | + |
432 | + Icon { |
433 | + id: chevron |
434 | + name: 'chevron' |
435 | + width: units.gu(2) |
436 | + height: width |
437 | + visible: !action |
438 | + } |
439 | + } |
440 | +} |
441 | |
442 | === modified file 'src/Ubuntu/Components/Popups/1.3/Popover.qml' |
443 | --- src/Ubuntu/Components/Popups/1.3/Popover.qml 2015-12-09 12:34:18 +0000 |
444 | +++ src/Ubuntu/Components/Popups/1.3/Popover.qml 2016-01-07 10:05:16 +0000 |
445 | @@ -244,6 +244,7 @@ |
446 | |
447 | styleName: "PopoverForegroundStyle" |
448 | } |
449 | + property alias styleName: foreground.styleName |
450 | |
451 | QtObject { |
452 | id: pointer |
453 | |
454 | === modified file 'src/Ubuntu/Components/Popups/Popups.pro' |
455 | --- src/Ubuntu/Components/Popups/Popups.pro 2015-07-24 15:46:33 +0000 |
456 | +++ src/Ubuntu/Components/Popups/Popups.pro 2016-01-07 10:05:16 +0000 |
457 | @@ -11,9 +11,13 @@ |
458 | 1.2/SheetBase.qml \ |
459 | 1.3/ActionSelectionPopover.qml \ |
460 | 1.3/ComposerSheet.qml \ |
461 | + 1.3/ContextMenu.qml \ |
462 | + 1.3/MenuGroup.qml \ |
463 | + 1.3/MenuItem.qml \ |
464 | 1.3/DefaultSheet.qml \ |
465 | 1.3/Dialog.qml \ |
466 | 1.3/internalPopupUtils.js \ |
467 | + 1.3/ListItemContextMenu.qml \ |
468 | 1.3/Popover.qml \ |
469 | 1.3/PopupBase.qml \ |
470 | 1.3/popupUtils.js \ |
471 | |
472 | === modified file 'src/Ubuntu/Components/Popups/qmldir' |
473 | --- src/Ubuntu/Components/Popups/qmldir 2015-07-17 14:42:26 +0000 |
474 | +++ src/Ubuntu/Components/Popups/qmldir 2016-01-07 10:05:16 +0000 |
475 | @@ -23,6 +23,9 @@ |
476 | |
477 | ################################################# |
478 | #version 1.3 |
479 | +ContextMenu 1.3 1.3/ContextMenu.qml |
480 | +MenuGroup 1.3 1.3/MenuGroup.qml |
481 | +internal MenuItem 1.3/MenuItem.qml |
482 | Dialog 1.3 1.3/Dialog.qml |
483 | PopupBase 1.3 1.3/PopupBase.qml |
484 | Popover 1.3 1.3/Popover.qml |
485 | |
486 | === added file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ContextMenuForegroundStyle.qml' |
487 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ContextMenuForegroundStyle.qml 1970-01-01 00:00:00 +0000 |
488 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ContextMenuForegroundStyle.qml 2016-01-07 10:05:16 +0000 |
489 | @@ -0,0 +1,43 @@ |
490 | +/* |
491 | + * Copyright 2015 Canonical Ltd. |
492 | + * |
493 | + * This program is free software; you can redistribute it and/or modify |
494 | + * it under the terms of the GNU Lesser General Public License as published by |
495 | + * the Free Software Foundation; version 3. |
496 | + * |
497 | + * This program is distributed in the hope that it will be useful, |
498 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
499 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
500 | + * GNU Lesser General Public License for more details. |
501 | + * |
502 | + * You should have received a copy of the GNU Lesser General Public License |
503 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
504 | + */ |
505 | + |
506 | +import QtQuick 2.4 |
507 | +import Ubuntu.Components 1.3 |
508 | + |
509 | +Item { |
510 | + id: contextMenuForegroundStyle |
511 | + |
512 | + Image { |
513 | + id: background |
514 | + anchors.fill: parent |
515 | + source: Qt.resolvedUrl("../artwork/contextual_menu_bg@27.png") |
516 | + } |
517 | + |
518 | + function show() { } |
519 | + function hide() { } |
520 | + signal showCompleted() |
521 | + signal hideCompleted() |
522 | + onShowCompleted: styledItem.showCompleted() |
523 | + onHideCompleted: styledItem.hideCompleted() |
524 | + property Item contentItem: Item { |
525 | + anchors.fill: parent |
526 | + Connections { |
527 | + target: styledItem |
528 | + onShow: show() |
529 | + onHide: hide() |
530 | + } |
531 | + } |
532 | +} |
533 | |
534 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro' |
535 | --- src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2015-12-16 10:01:07 +0000 |
536 | +++ src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2016-01-07 10:05:16 +0000 |
537 | @@ -13,6 +13,7 @@ |
538 | artwork/caret_noshadow@27.png \ |
539 | artwork/chevron@27.png \ |
540 | artwork/chevron_down@30.png \ |
541 | + artwork/contextual_menu_bg@27.png \ |
542 | artwork/cross@30.png \ |
543 | artwork/header_overflow_dropshadow@27.png \ |
544 | artwork/header_overflow_dropshadow@27.sci \ |
545 | @@ -80,6 +81,7 @@ |
546 | 1.3/ButtonStyle.qml \ |
547 | 1.3/CheckBoxStyle.qml \ |
548 | 1.3/ComboButtonStyle.qml \ |
549 | + 1.3/ContextMenuForegroundStyle.qml \ |
550 | 1.3/DatePickerStyle.qml \ |
551 | 1.3/DialerHandStyle.qml \ |
552 | 1.3/DialerStyle.qml \ |
553 | |
554 | === added file 'src/Ubuntu/Components/Themes/Ambiance/artwork/contextual_menu_bg@27.png' |
555 | Binary files src/Ubuntu/Components/Themes/Ambiance/artwork/contextual_menu_bg@27.png 1970-01-01 00:00:00 +0000 and src/Ubuntu/Components/Themes/Ambiance/artwork/contextual_menu_bg@27.png 2016-01-07 10:05:16 +0000 differ |
556 | === modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp' |
557 | --- src/Ubuntu/Components/plugin/uclistitem.cpp 2015-12-15 15:58:54 +0000 |
558 | +++ src/Ubuntu/Components/plugin/uclistitem.cpp 2016-01-07 10:05:16 +0000 |
559 | @@ -1162,6 +1162,7 @@ |
560 | { |
561 | if (event->button() != Qt::RightButton) |
562 | return false; |
563 | +<<<<<<< TREE |
564 | return leadingActions || trailingActions; |
565 | } |
566 | |
567 | @@ -1203,6 +1204,48 @@ |
568 | SLOT(_q_popoverClosed()), Qt::DirectConnection); |
569 | } |
570 | delete component; |
571 | +======= |
572 | + return leadingActions() || trailingActions(); |
573 | +} |
574 | + |
575 | +void UCListItem13::mousePressEvent(QMouseEvent *event) |
576 | +{ |
577 | + UCListItem::mousePressEvent(event); |
578 | + if (shouldShowContextMenu(event)) { |
579 | + Q_D(UCListItem); |
580 | + |
581 | + // Highlight the Item while the menu is showing |
582 | + d->setHighlighted(true); |
583 | + // Reset the timer which otherwise is started with highlighting |
584 | + d->pressAndHoldTimer.stop(); |
585 | + |
586 | + quint16 version(d->getTheme()->version()); |
587 | + QString versionString(QStringLiteral("%1.%2").arg(MAJOR_VERSION(version)).arg(MINOR_VERSION(version))); |
588 | + QUrl url(UbuntuComponentsPlugin::pluginUrl().resolved("Popups/" + versionString + "/ListItemContextMenu.qml")); |
589 | + |
590 | + // Open Popover |
591 | + QQmlEngine* engine = qmlEngine(this); |
592 | + QQmlComponent* component = new QQmlComponent(engine, url, QQmlComponent::PreferSynchronous, this); |
593 | + if (component->isError()) { |
594 | + qmlInfo(this) << component->errorString(); |
595 | + } else { |
596 | + QQmlEngine::setContextForObject(component, qmlContext(this)); |
597 | + QQuickItem* item = static_cast<QQuickItem*>(component->create(qmlContext(this))); |
598 | + item->setProperty("caller", QVariant::fromValue(this)); |
599 | + item->setParentItem(QuickUtils::instance().rootItem(this)); |
600 | + QMetaObject::invokeMethod(item, "show"); |
601 | + connect(item, &QQuickItem::visibleChanged, this, |
602 | + &UCListItem13::popoverClosed, Qt::DirectConnection); |
603 | + } |
604 | + delete component; |
605 | + } |
606 | +} |
607 | + |
608 | +void UCListItem13::popoverClosed() |
609 | +{ |
610 | + Q_D(UCListItem); |
611 | + d->setHighlighted(false); |
612 | +>>>>>>> MERGE-SOURCE |
613 | } |
614 | |
615 | // ungrabs any previously grabbed left mouse button event |