@@ -19,6 +19,7 @@ import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1 as ListItems
19import Ubuntu.Components.ListItems 0.1 as ListItems
20import Unity 0.1
20import Unity 0.1
21import Unity.Launcher 0.1
21import Unity.Launcher 0.1
22+import Ubuntu.Components.Popups 0.1
22import "../Components/ListItems"
23import "../Components/ListItems"
@@ -29,7 +30,8 @@ Item {
29 property var model
30 property var model
30 property bool inverted: true
31 property bool inverted: true
31 property bool dragging: false
32 property bool dragging: false
32− property bool moving: launcherListView.moving || launcherListView.flicking || dndArea.draggedIndex >= 0
33+ property bool moving: launcherListView.moving || launcherListView.flicking
34+ property bool preventHiding: moving || dndArea.draggedIndex >= 0 || dndArea.quickListPopover !== null || dndArea.pressed
33 property int highlightIndex: -1
35 property int highlightIndex: -1
35 signal applicationSelected(string desktopFile)
37 signal applicationSelected(string desktopFile)
@@ -219,6 +221,7 @@ Item {
220 MouseArea {
222 MouseArea {
221 id: dndArea
223 id: dndArea
224+ objectName: "dndArea"
222 anchors {
225 anchors {
223 fill: parent
226 fill: parent
224 topMargin: launcherListView.topMargin
227 topMargin: launcherListView.topMargin
@@ -234,6 +237,7 @@ Item {
234 property bool postDragging: false
237 property bool postDragging: false
235 property int startX
238 property int startX
236 property int startY
239 property int startY
240+ property var quickListPopover: null
238 onPressed: {
242 onPressed: {
239 selectedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
243 selectedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
@@ -295,6 +299,13 @@ Item {
295 onPressAndHold: {
299 onPressAndHold: {
296 draggedIndex = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
300 draggedIndex = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
302+ // Opening QuickList
303+ var quickListModel = launcherListView.model.get(draggedIndex).quickList
304+ var quickListAppId = launcherListView.model.get(draggedIndex).appId
306+ quickListPopover = PopupUtils.open(popoverComponent, selectedItem,
307+ {model: quickListModel, appId: quickListAppId})
298 launcherListView.interactive = false
309 launcherListView.interactive = false
300 var yOffset = draggedIndex > 0 ? (mouseY + launcherListView.realContentY) % (draggedIndex * launcherListView.realItemHeight) : mouseY + launcherListView.realContentY
311 var yOffset = draggedIndex > 0 ? (mouseY + launcherListView.realContentY) % (draggedIndex * launcherListView.realItemHeight) : mouseY + launcherListView.realContentY
@@ -314,6 +325,7 @@ Item {
314 var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY))
325 var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY))
315 if (!preDragging && distance > units.gu(1.5)) {
326 if (!preDragging && distance > units.gu(1.5)) {
316 preDragging = true;
327 preDragging = true;
328+ PopupUtils.close(quickListPopover)
318 if (distance > launcherListView.itemHeight) {
330 if (distance > launcherListView.itemHeight) {
319 selectedItem.dragging = true
331 selectedItem.dragging = true
@@ -419,4 +431,46 @@ Item {
436+ id: popoverComponent
441+ property string appId
442+ contentWidth: quickListColumn.width
444+ // FIXME: There's a bug in the Popover positioning that it covers the item in case it is rotated.
445+ // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1204470
446+ // For now, let's move the Popover around with callerMargin.
447+ // Remove popupMargin once the bug is fixed.
448+ property int popupMargin: root.inverted ? launcherListView.itemHeight : 0;
450+ callerMargin: units.gu(1) + popupMargin
455+ height: childrenRect.height
458+ model: popover.model
460+ ListItems.Standard {
461+ objectName: "quickListEntry" + index
462+ text: (model.clickable ? "" : "<b>") + model.label + (model.clickable ? "" : "</b>")
463+ highlightWhenPressed: model.clickable
465+ if (!model.clickable) {
468+ LauncherModel.quickListActionInvoked(appId, index);
469+ PopupUtils.close(popover);