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 | 303 | default property Component layout | 303 | default property Component layout |
6 | 304 | property string name | 304 | property string name |
7 | 305 | property QQmlBinding when | 305 | property QQmlBinding when |
8 | 306 | <<<<<<< TREE | ||
9 | 306 | Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1 UPMCpuUsage: Item | 307 | Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1 UPMCpuUsage: Item |
10 | 308 | ======= | ||
11 | 309 | Ubuntu.Components.Popups.ContextMenu 1.3: Popover | ||
12 | 310 | Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1: Item | ||
13 | 311 | >>>>>>> MERGE-SOURCE | ||
14 | 307 | readonly property UPMGraphModel graphModel | 312 | readonly property UPMGraphModel graphModel |
15 | 308 | property int period | 313 | property int period |
16 | 309 | property int samplingInterval | 314 | property int samplingInterval |
17 | @@ -614,6 +619,7 @@ | |||
18 | 614 | default property list<QtObject> contentsItem | 619 | default property list<QtObject> contentsItem |
19 | 615 | Ubuntu.Components.MainView 1.3: MainViewBase | 620 | Ubuntu.Components.MainView 1.3: MainViewBase |
20 | 616 | property bool automaticOrientation | 621 | property bool automaticOrientation |
21 | 622 | <<<<<<< TREE | ||
22 | 617 | default property list<QtObject> contentsItem | 623 | default property list<QtObject> contentsItem |
23 | 618 | Ubuntu.Components.MathUtils 1.0 0.1: QtObject singleton | 624 | Ubuntu.Components.MathUtils 1.0 0.1: QtObject singleton |
24 | 619 | function double clamp(double x, double min, double max) | 625 | function double clamp(double x, double min, double max) |
25 | @@ -621,6 +627,16 @@ | |||
26 | 621 | function double projectValue(double x, double xmin, double xmax, double ymin, double ymax) | 627 | function double projectValue(double x, double xmin, double xmax, double ymin, double ymax) |
27 | 622 | function double clampAndProject(double x, double xmin, double xmax, double ymin, double ymax) | 628 | function double clampAndProject(double x, double xmin, double xmax, double ymin, double ymax) |
28 | 623 | Ubuntu.Components.MimeData 1.0 0.1 QQuickMimeData: QtObject | 629 | Ubuntu.Components.MimeData 1.0 0.1 QQuickMimeData: QtObject |
29 | 630 | ======= | ||
30 | 631 | default readonly property QtObject contentsItem | ||
31 | 632 | Ubuntu.Components.MathUtils 0.1 1.0 1.3 | ||
32 | 633 | Ubuntu.Components.Popups.MenuGroup 1.3: Column | ||
33 | 634 | readonly property QtObject actions | ||
34 | 635 | property Component delegate | ||
35 | 636 | property ContextMenu menu | ||
36 | 637 | property string text | ||
37 | 638 | Ubuntu.Components.MimeData 1.0 0.1: QtObject | ||
38 | 639 | >>>>>>> MERGE-SOURCE | ||
39 | 624 | property color color | 640 | property color color |
40 | 625 | property var data | 641 | property var data |
41 | 626 | readonly property QStringList formats | 642 | readonly property QStringList formats |
42 | @@ -935,6 +951,7 @@ | |||
43 | 935 | function var show() | 951 | function var show() |
44 | 936 | function var hide() | 952 | function var hide() |
45 | 937 | property Item pointerTarget | 953 | property Item pointerTarget |
46 | 954 | property string styleName | ||
47 | 938 | Ubuntu.Components.Popups.PopupBase 1.0 0.1: OrientationHelper | 955 | Ubuntu.Components.Popups.PopupBase 1.0 0.1: OrientationHelper |
48 | 939 | property Item dismissArea | 956 | property Item dismissArea |
49 | 940 | property PropertyAnimation fadingAnimation | 957 | property PropertyAnimation fadingAnimation |
50 | 941 | 958 | ||
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 | 1 | /* | ||
56 | 2 | * Copyright 2015 Canonical Ltd. | ||
57 | 3 | * | ||
58 | 4 | * This program is free software; you can redistribute it and/or modify | ||
59 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
60 | 6 | * the Free Software Foundation; version 3. | ||
61 | 7 | * | ||
62 | 8 | * This program is distributed in the hope that it will be useful, | ||
63 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
64 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
65 | 11 | * GNU Lesser General Public License for more details. | ||
66 | 12 | * | ||
67 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
68 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
69 | 15 | */ | ||
70 | 16 | |||
71 | 17 | import QtQuick 2.4 | ||
72 | 18 | import Ubuntu.Components 1.3 | ||
73 | 19 | import Ubuntu.Components.Popups 1.3 | ||
74 | 20 | |||
75 | 21 | ContextMenu { | ||
76 | 22 | MenuGroup { | ||
77 | 23 | Action { | ||
78 | 24 | 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 | 25 | shortcut: 'Alt+P' | ||
80 | 26 | } | ||
81 | 27 | Action { | ||
82 | 28 | iconName: 'compose' | ||
83 | 29 | text: i18n.tr("Once upon a time there was a story nobody told.") | ||
84 | 30 | enabled: false | ||
85 | 31 | shortcut: 'Ctrl+Shift+T' | ||
86 | 32 | } | ||
87 | 33 | } | ||
88 | 34 | MenuGroup { | ||
89 | 35 | Action { | ||
90 | 36 | iconName: 'delete' | ||
91 | 37 | text: i18n.tr("Delete") | ||
92 | 38 | shortcut: 'Del' | ||
93 | 39 | } | ||
94 | 40 | MenuGroup { | ||
95 | 41 | text: i18n.tr("But wait, there's more") | ||
96 | 42 | Action { | ||
97 | 43 | text: i18n.tr("Send an email") | ||
98 | 44 | shortcut: 'Ctrl+C' | ||
99 | 45 | enabled: false | ||
100 | 46 | } | ||
101 | 47 | Action { | ||
102 | 48 | iconName: 'save-to' | ||
103 | 49 | text: i18n.tr("Save to file") | ||
104 | 50 | shortcut: 'Shift+S' | ||
105 | 51 | } | ||
106 | 52 | } | ||
107 | 53 | MenuGroup { | ||
108 | 54 | text: i18n.tr("Forever moar quoth the raven") | ||
109 | 55 | enabled: false | ||
110 | 56 | } | ||
111 | 57 | } | ||
112 | 58 | } | ||
113 | 59 | |||
114 | 0 | 60 | ||
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 | 49 | actions: [ | 49 | actions: [ |
120 | 50 | Action { | 50 | Action { |
121 | 51 | iconName: "tick" | 51 | iconName: "tick" |
122 | 52 | text: i18n.tr('Check') | ||
123 | 53 | enabled: false | ||
124 | 52 | }, | 54 | }, |
125 | 53 | Action { | 55 | Action { |
126 | 54 | iconName: "delete" | 56 | iconName: "delete" |
127 | 57 | text: i18n.tr('Delete') | ||
128 | 55 | } | 58 | } |
129 | 56 | ] | 59 | ] |
130 | 57 | } | 60 | } |
131 | @@ -60,9 +63,12 @@ | |||
132 | 60 | actions: [ | 63 | actions: [ |
133 | 61 | Action { | 64 | Action { |
134 | 62 | iconName: "edit" | 65 | iconName: "edit" |
135 | 66 | text: i18n.tr('Edit') | ||
136 | 63 | }, | 67 | }, |
137 | 64 | Action { | 68 | Action { |
138 | 65 | iconName: "save-to" | 69 | iconName: "save-to" |
139 | 70 | text: i18n.tr('Save As') | ||
140 | 71 | enabled: false | ||
141 | 66 | } | 72 | } |
142 | 67 | ] | 73 | ] |
143 | 68 | } | 74 | } |
144 | 69 | 75 | ||
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 | 27 | iconSource: "call_icon.png" | 27 | iconSource: "call_icon.png" |
150 | 28 | onTriggered: PopupUtils.open(actionSelectionPopover) | 28 | onTriggered: PopupUtils.open(actionSelectionPopover) |
151 | 29 | visible: true | 29 | visible: true |
152 | 30 | }, | ||
153 | 31 | Action { | ||
154 | 32 | text: "Context menu" | ||
155 | 33 | iconName: "like" | ||
156 | 34 | onTriggered: PopupUtils.open(Qt.resolvedUrl('ExampleContextMenu.qml'), popoverWithFlickableButton) | ||
157 | 30 | } | 35 | } |
158 | 31 | ] | 36 | ] |
159 | 32 | 37 | ||
160 | 33 | 38 | ||
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 | 126 | 1.3/UbuntuColors.qml \ | 126 | 1.3/UbuntuColors.qml \ |
166 | 127 | 1.3/UbuntuListView.qml \ | 127 | 1.3/UbuntuListView.qml \ |
167 | 128 | 1.3/UbuntuNumberAnimation.qml \ | 128 | 1.3/UbuntuNumberAnimation.qml \ |
168 | 129 | <<<<<<< TREE | ||
169 | 129 | 1.3/ListItemPopover.qml \ | 130 | 1.3/ListItemPopover.qml \ |
170 | 130 | 1.3/PageColumn.qml \ | 131 | 1.3/PageColumn.qml \ |
171 | 131 | 1.3/PageColumnsLayout.qml \ | 132 | 1.3/PageColumnsLayout.qml \ |
172 | 132 | 1.3/ProgressionSlot.qml \ | 133 | 1.3/ProgressionSlot.qml \ |
173 | 133 | 1.3/ScrollView.qml \ | 134 | 1.3/ScrollView.qml \ |
174 | 134 | 1.3/PageHeader.qml | 135 | 1.3/PageHeader.qml |
175 | 136 | ======= | ||
176 | 137 | 1.3/BottomEdgeHint.qml | ||
177 | 138 | >>>>>>> MERGE-SOURCE | ||
178 | 135 | 139 | ||
179 | 136 | OTHER_FILES+= qmldir \ | 140 | OTHER_FILES+= qmldir \ |
180 | 137 | 1.3/CrossFadeImage.qdoc \ | 141 | 1.3/CrossFadeImage.qdoc \ |
181 | 138 | 142 | ||
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 | 1 | /* | ||
187 | 2 | * Copyright 2015 Canonical Ltd. | ||
188 | 3 | * | ||
189 | 4 | * This program is free software; you can redistribute it and/or modify | ||
190 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
191 | 6 | * the Free Software Foundation; version 3. | ||
192 | 7 | * | ||
193 | 8 | * This program is distributed in the hope that it will be useful, | ||
194 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
195 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
196 | 11 | * GNU Lesser General Public License for more details. | ||
197 | 12 | * | ||
198 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
199 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
200 | 15 | */ | ||
201 | 16 | |||
202 | 17 | import QtQuick 2.4 | ||
203 | 18 | import Ubuntu.Components 1.3 | ||
204 | 19 | |||
205 | 20 | Popover { | ||
206 | 21 | id: contextmenu | ||
207 | 22 | objectName: 'ContextMenu' | ||
208 | 23 | contentHeight: Math.max(column.childrenRect.height, units.gu(4)) | ||
209 | 24 | contentWidth: Math.max(column.childrenRect.width, units.gu(4)) | ||
210 | 25 | |||
211 | 26 | default property alias children: column.children | ||
212 | 27 | |||
213 | 28 | // FIXME: styleName: "ContextMenuForegroundStyle" | ||
214 | 29 | Column { | ||
215 | 30 | id: column | ||
216 | 31 | anchors { | ||
217 | 32 | left: parent.left | ||
218 | 33 | top: parent.top | ||
219 | 34 | right: parent.right | ||
220 | 35 | } | ||
221 | 36 | } | ||
222 | 37 | |||
223 | 38 | // Hide the arrow | ||
224 | 39 | Binding { | ||
225 | 40 | target: __foreground | ||
226 | 41 | property: "direction" | ||
227 | 42 | value: "none" | ||
228 | 43 | } | ||
229 | 44 | } | ||
230 | 0 | 45 | ||
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 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
236 | 19 | import Ubuntu.Components.Popups 1.3 | 19 | import Ubuntu.Components.Popups 1.3 |
237 | 20 | 20 | ||
240 | 21 | ActionSelectionPopover { | 21 | ContextMenu { |
239 | 22 | id: popover | ||
241 | 23 | objectName: 'listItemContextMenu' | 22 | objectName: 'listItemContextMenu' |
287 | 24 | contentWidth: units.gu(25) | 23 | caller: ListItem { |
288 | 25 | 24 | } | |
289 | 26 | delegate: ListItem { | 25 | |
290 | 27 | contentItem.anchors { | 26 | MenuGroup { |
291 | 28 | leftMargin: units.gu(2) | 27 | objectName: 'leadingActions' |
292 | 29 | rightMargin: units.gu(2) | 28 | actions: caller.leadingActions ? caller.leadingActions.actions : [] |
293 | 30 | topMargin: units.gu(0.5) | 29 | } |
294 | 31 | bottomMargin: units.gu(0.5) | 30 | MenuGroup { |
295 | 32 | } | 31 | objectName: 'trailingActions' |
296 | 33 | divider.visible: action != actions[actions.length - 1] | 32 | actions: caller.trailingActions ? caller.trailingActions.actions : [] |
252 | 34 | |||
253 | 35 | Label { | ||
254 | 36 | anchors.verticalCenter: parent.verticalCenter | ||
255 | 37 | text: action.text | ||
256 | 38 | color: '#5D5D5D' | ||
257 | 39 | } | ||
258 | 40 | |||
259 | 41 | onClicked: popover.hide() | ||
260 | 42 | } | ||
261 | 43 | |||
262 | 44 | function mergeActions(to, from) { | ||
263 | 45 | if (from == null) | ||
264 | 46 | return; | ||
265 | 47 | |||
266 | 48 | var actions = from.actions; | ||
267 | 49 | for (var i in actions) { | ||
268 | 50 | var action = actions[i]; | ||
269 | 51 | if (!action.text) | ||
270 | 52 | action.text = action.iconName; | ||
271 | 53 | to.push(actions[i]); | ||
272 | 54 | } | ||
273 | 55 | } | ||
274 | 56 | |||
275 | 57 | onCallerChanged: { | ||
276 | 58 | var all = []; | ||
277 | 59 | mergeActions(all, caller.leadingActions); | ||
278 | 60 | mergeActions(all, caller.trailingActions); | ||
279 | 61 | actions = all; | ||
280 | 62 | } | ||
281 | 63 | |||
282 | 64 | // Hide the arrow | ||
283 | 65 | Binding { | ||
284 | 66 | target: __foreground | ||
285 | 67 | property: "direction" | ||
286 | 68 | value: "none" | ||
297 | 69 | } | 33 | } |
298 | 70 | } | 34 | } |
299 | 71 | 35 | ||
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 | 1 | /* | ||
305 | 2 | * Copyright 2015 Canonical Ltd. | ||
306 | 3 | * | ||
307 | 4 | * This program is free software; you can redistribute it and/or modify | ||
308 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
309 | 6 | * the Free Software Foundation; version 3. | ||
310 | 7 | * | ||
311 | 8 | * This program is distributed in the hope that it will be useful, | ||
312 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
313 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
314 | 11 | * GNU Lesser General Public License for more details. | ||
315 | 12 | * | ||
316 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
317 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
318 | 15 | */ | ||
319 | 16 | |||
320 | 17 | import QtQuick 2.4 | ||
321 | 18 | import Ubuntu.Components 1.3 | ||
322 | 19 | |||
323 | 20 | Column { | ||
324 | 21 | id: group | ||
325 | 22 | property ContextMenu menu | ||
326 | 23 | property list<QtObject> actions | ||
327 | 24 | default property alias children: group.actions | ||
328 | 25 | property Component delegate: MenuItem { | ||
329 | 26 | action: modelData.hasOwnProperty('shortcut') ? modelData : null | ||
330 | 27 | text: modelData.text | ||
331 | 28 | enabled: modelData.enabled | ||
332 | 29 | onClicked: contextmenu.hide() // FIXME | ||
333 | 30 | divider.visible: action == actions[group.actions.length - 1] | ||
334 | 31 | } | ||
335 | 32 | property string text | ||
336 | 33 | |||
337 | 34 | Loader { | ||
338 | 35 | property var modelData: Action { | ||
339 | 36 | text: group.text | ||
340 | 37 | } | ||
341 | 38 | active: group.text !== '' | ||
342 | 39 | sourceComponent: group.delegate | ||
343 | 40 | } | ||
344 | 41 | |||
345 | 42 | Repeater { | ||
346 | 43 | model: actions | ||
347 | 44 | delegate: group.delegate | ||
348 | 45 | } | ||
349 | 46 | } | ||
350 | 0 | 47 | ||
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 | 1 | /* | ||
356 | 2 | * Copyright 2015 Canonical Ltd. | ||
357 | 3 | * | ||
358 | 4 | * This program is free software; you can redistribute it and/or modify | ||
359 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
360 | 6 | * the Free Software Foundation; version 3. | ||
361 | 7 | * | ||
362 | 8 | * This program is distributed in the hope that it will be useful, | ||
363 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
364 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
365 | 11 | * GNU Lesser General Public License for more details. | ||
366 | 12 | * | ||
367 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
368 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
369 | 15 | */ | ||
370 | 16 | |||
371 | 17 | import QtQuick 2.4 | ||
372 | 18 | import Ubuntu.Components 1.3 | ||
373 | 19 | |||
374 | 20 | ListItem { | ||
375 | 21 | id: menuitem | ||
376 | 22 | contentItem.anchors { | ||
377 | 23 | leftMargin: units.gu(2) | ||
378 | 24 | rightMargin: units.gu(2) | ||
379 | 25 | } | ||
380 | 26 | width: row.spacing + units.gu(25) + hotkey.width + units.gu(4) | ||
381 | 27 | height: units.gu(4) | ||
382 | 28 | |||
383 | 29 | color: '#ffffff' | ||
384 | 30 | opacity: selected || hovered ? 0.08 : 1.0 | ||
385 | 31 | Mouse.onEntered: hovered = true | ||
386 | 32 | Mouse.onExited: hovered = false | ||
387 | 33 | property bool hovered | ||
388 | 34 | property string text | ||
389 | 35 | enabled: action ? action.enabled : true | ||
390 | 36 | |||
391 | 37 | Row { | ||
392 | 38 | id: row | ||
393 | 39 | anchors.left: parent.left | ||
394 | 40 | anchors.verticalCenter: parent.verticalCenter | ||
395 | 41 | anchors.right: shortcut.left | ||
396 | 42 | spacing: units.gu(1) | ||
397 | 43 | |||
398 | 44 | Icon { | ||
399 | 45 | id: icon | ||
400 | 46 | name: action ? action.iconName : '' | ||
401 | 47 | width: visible ? units.gu(2) : 0 | ||
402 | 48 | height: width | ||
403 | 49 | opacity: label.opacity | ||
404 | 50 | visible: name != '' | ||
405 | 51 | } | ||
406 | 52 | |||
407 | 53 | Label { | ||
408 | 54 | id: label | ||
409 | 55 | text: action ? action.text : menuitem.text | ||
410 | 56 | color: '#333333' | ||
411 | 57 | opacity: menuitem.enabled ? 1.0 : 0.3 | ||
412 | 58 | elide: Text.ElideRight | ||
413 | 59 | width: units.gu(25) - icon.width | ||
414 | 60 | } | ||
415 | 61 | } | ||
416 | 62 | |||
417 | 63 | Row { | ||
418 | 64 | id: shortcut | ||
419 | 65 | anchors.right: parent.right | ||
420 | 66 | anchors.verticalCenter: parent.verticalCenter | ||
421 | 67 | opacity: label.opacity | ||
422 | 68 | |||
423 | 69 | Label { | ||
424 | 70 | id: hotkey | ||
425 | 71 | property string shortcut: action && action.shortcut ? action.shortcut : '' | ||
426 | 72 | text: hotkey.shortcut.replace('Ctrl+', '^').replace('Shift+', '⇧') | ||
427 | 73 | color: label.color | ||
428 | 74 | visible: shortcut != '' | ||
429 | 75 | width: units.gu(5) | ||
430 | 76 | } | ||
431 | 77 | |||
432 | 78 | Icon { | ||
433 | 79 | id: chevron | ||
434 | 80 | name: 'chevron' | ||
435 | 81 | width: units.gu(2) | ||
436 | 82 | height: width | ||
437 | 83 | visible: !action | ||
438 | 84 | } | ||
439 | 85 | } | ||
440 | 86 | } | ||
441 | 0 | 87 | ||
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 | 244 | 244 | ||
447 | 245 | styleName: "PopoverForegroundStyle" | 245 | styleName: "PopoverForegroundStyle" |
448 | 246 | } | 246 | } |
449 | 247 | property alias styleName: foreground.styleName | ||
450 | 247 | 248 | ||
451 | 248 | QtObject { | 249 | QtObject { |
452 | 249 | id: pointer | 250 | id: pointer |
453 | 250 | 251 | ||
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 | 11 | 1.2/SheetBase.qml \ | 11 | 1.2/SheetBase.qml \ |
459 | 12 | 1.3/ActionSelectionPopover.qml \ | 12 | 1.3/ActionSelectionPopover.qml \ |
460 | 13 | 1.3/ComposerSheet.qml \ | 13 | 1.3/ComposerSheet.qml \ |
461 | 14 | 1.3/ContextMenu.qml \ | ||
462 | 15 | 1.3/MenuGroup.qml \ | ||
463 | 16 | 1.3/MenuItem.qml \ | ||
464 | 14 | 1.3/DefaultSheet.qml \ | 17 | 1.3/DefaultSheet.qml \ |
465 | 15 | 1.3/Dialog.qml \ | 18 | 1.3/Dialog.qml \ |
466 | 16 | 1.3/internalPopupUtils.js \ | 19 | 1.3/internalPopupUtils.js \ |
467 | 20 | 1.3/ListItemContextMenu.qml \ | ||
468 | 17 | 1.3/Popover.qml \ | 21 | 1.3/Popover.qml \ |
469 | 18 | 1.3/PopupBase.qml \ | 22 | 1.3/PopupBase.qml \ |
470 | 19 | 1.3/popupUtils.js \ | 23 | 1.3/popupUtils.js \ |
471 | 20 | 24 | ||
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 | 23 | 23 | ||
477 | 24 | ################################################# | 24 | ################################################# |
478 | 25 | #version 1.3 | 25 | #version 1.3 |
479 | 26 | ContextMenu 1.3 1.3/ContextMenu.qml | ||
480 | 27 | MenuGroup 1.3 1.3/MenuGroup.qml | ||
481 | 28 | internal MenuItem 1.3/MenuItem.qml | ||
482 | 26 | Dialog 1.3 1.3/Dialog.qml | 29 | Dialog 1.3 1.3/Dialog.qml |
483 | 27 | PopupBase 1.3 1.3/PopupBase.qml | 30 | PopupBase 1.3 1.3/PopupBase.qml |
484 | 28 | Popover 1.3 1.3/Popover.qml | 31 | Popover 1.3 1.3/Popover.qml |
485 | 29 | 32 | ||
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 | 1 | /* | ||
491 | 2 | * Copyright 2015 Canonical Ltd. | ||
492 | 3 | * | ||
493 | 4 | * This program is free software; you can redistribute it and/or modify | ||
494 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
495 | 6 | * the Free Software Foundation; version 3. | ||
496 | 7 | * | ||
497 | 8 | * This program is distributed in the hope that it will be useful, | ||
498 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
499 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
500 | 11 | * GNU Lesser General Public License for more details. | ||
501 | 12 | * | ||
502 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
503 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
504 | 15 | */ | ||
505 | 16 | |||
506 | 17 | import QtQuick 2.4 | ||
507 | 18 | import Ubuntu.Components 1.3 | ||
508 | 19 | |||
509 | 20 | Item { | ||
510 | 21 | id: contextMenuForegroundStyle | ||
511 | 22 | |||
512 | 23 | Image { | ||
513 | 24 | id: background | ||
514 | 25 | anchors.fill: parent | ||
515 | 26 | source: Qt.resolvedUrl("../artwork/contextual_menu_bg@27.png") | ||
516 | 27 | } | ||
517 | 28 | |||
518 | 29 | function show() { } | ||
519 | 30 | function hide() { } | ||
520 | 31 | signal showCompleted() | ||
521 | 32 | signal hideCompleted() | ||
522 | 33 | onShowCompleted: styledItem.showCompleted() | ||
523 | 34 | onHideCompleted: styledItem.hideCompleted() | ||
524 | 35 | property Item contentItem: Item { | ||
525 | 36 | anchors.fill: parent | ||
526 | 37 | Connections { | ||
527 | 38 | target: styledItem | ||
528 | 39 | onShow: show() | ||
529 | 40 | onHide: hide() | ||
530 | 41 | } | ||
531 | 42 | } | ||
532 | 43 | } | ||
533 | 0 | 44 | ||
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 | 13 | artwork/caret_noshadow@27.png \ | 13 | artwork/caret_noshadow@27.png \ |
539 | 14 | artwork/chevron@27.png \ | 14 | artwork/chevron@27.png \ |
540 | 15 | artwork/chevron_down@30.png \ | 15 | artwork/chevron_down@30.png \ |
541 | 16 | artwork/contextual_menu_bg@27.png \ | ||
542 | 16 | artwork/cross@30.png \ | 17 | artwork/cross@30.png \ |
543 | 17 | artwork/header_overflow_dropshadow@27.png \ | 18 | artwork/header_overflow_dropshadow@27.png \ |
544 | 18 | artwork/header_overflow_dropshadow@27.sci \ | 19 | artwork/header_overflow_dropshadow@27.sci \ |
545 | @@ -80,6 +81,7 @@ | |||
546 | 80 | 1.3/ButtonStyle.qml \ | 81 | 1.3/ButtonStyle.qml \ |
547 | 81 | 1.3/CheckBoxStyle.qml \ | 82 | 1.3/CheckBoxStyle.qml \ |
548 | 82 | 1.3/ComboButtonStyle.qml \ | 83 | 1.3/ComboButtonStyle.qml \ |
549 | 84 | 1.3/ContextMenuForegroundStyle.qml \ | ||
550 | 83 | 1.3/DatePickerStyle.qml \ | 85 | 1.3/DatePickerStyle.qml \ |
551 | 84 | 1.3/DialerHandStyle.qml \ | 86 | 1.3/DialerHandStyle.qml \ |
552 | 85 | 1.3/DialerStyle.qml \ | 87 | 1.3/DialerStyle.qml \ |
553 | 86 | 88 | ||
554 | === added file 'src/Ubuntu/Components/Themes/Ambiance/artwork/contextual_menu_bg@27.png' | |||
555 | 87 | 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 | 89 | 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 | 1162 | { | 1162 | { |
561 | 1163 | if (event->button() != Qt::RightButton) | 1163 | if (event->button() != Qt::RightButton) |
562 | 1164 | return false; | 1164 | return false; |
563 | 1165 | <<<<<<< TREE | ||
564 | 1165 | return leadingActions || trailingActions; | 1166 | return leadingActions || trailingActions; |
565 | 1166 | } | 1167 | } |
566 | 1167 | 1168 | ||
567 | @@ -1203,6 +1204,48 @@ | |||
568 | 1203 | SLOT(_q_popoverClosed()), Qt::DirectConnection); | 1204 | SLOT(_q_popoverClosed()), Qt::DirectConnection); |
569 | 1204 | } | 1205 | } |
570 | 1205 | delete component; | 1206 | delete component; |
571 | 1207 | ======= | ||
572 | 1208 | return leadingActions() || trailingActions(); | ||
573 | 1209 | } | ||
574 | 1210 | |||
575 | 1211 | void UCListItem13::mousePressEvent(QMouseEvent *event) | ||
576 | 1212 | { | ||
577 | 1213 | UCListItem::mousePressEvent(event); | ||
578 | 1214 | if (shouldShowContextMenu(event)) { | ||
579 | 1215 | Q_D(UCListItem); | ||
580 | 1216 | |||
581 | 1217 | // Highlight the Item while the menu is showing | ||
582 | 1218 | d->setHighlighted(true); | ||
583 | 1219 | // Reset the timer which otherwise is started with highlighting | ||
584 | 1220 | d->pressAndHoldTimer.stop(); | ||
585 | 1221 | |||
586 | 1222 | quint16 version(d->getTheme()->version()); | ||
587 | 1223 | QString versionString(QStringLiteral("%1.%2").arg(MAJOR_VERSION(version)).arg(MINOR_VERSION(version))); | ||
588 | 1224 | QUrl url(UbuntuComponentsPlugin::pluginUrl().resolved("Popups/" + versionString + "/ListItemContextMenu.qml")); | ||
589 | 1225 | |||
590 | 1226 | // Open Popover | ||
591 | 1227 | QQmlEngine* engine = qmlEngine(this); | ||
592 | 1228 | QQmlComponent* component = new QQmlComponent(engine, url, QQmlComponent::PreferSynchronous, this); | ||
593 | 1229 | if (component->isError()) { | ||
594 | 1230 | qmlInfo(this) << component->errorString(); | ||
595 | 1231 | } else { | ||
596 | 1232 | QQmlEngine::setContextForObject(component, qmlContext(this)); | ||
597 | 1233 | QQuickItem* item = static_cast<QQuickItem*>(component->create(qmlContext(this))); | ||
598 | 1234 | item->setProperty("caller", QVariant::fromValue(this)); | ||
599 | 1235 | item->setParentItem(QuickUtils::instance().rootItem(this)); | ||
600 | 1236 | QMetaObject::invokeMethod(item, "show"); | ||
601 | 1237 | connect(item, &QQuickItem::visibleChanged, this, | ||
602 | 1238 | &UCListItem13::popoverClosed, Qt::DirectConnection); | ||
603 | 1239 | } | ||
604 | 1240 | delete component; | ||
605 | 1241 | } | ||
606 | 1242 | } | ||
607 | 1243 | |||
608 | 1244 | void UCListItem13::popoverClosed() | ||
609 | 1245 | { | ||
610 | 1246 | Q_D(UCListItem); | ||
611 | 1247 | d->setHighlighted(false); | ||
612 | 1248 | >>>>>>> MERGE-SOURCE | ||
613 | 1206 | } | 1249 | } |
614 | 1207 | 1250 | ||
615 | 1208 | // ungrabs any previously grabbed left mouse button event | 1251 | // ungrabs any previously grabbed left mouse button event |