@@ -21,6 +21,7 @@ import Unity 0.1
2121import Unity.Launcher 0.1
2222import Ubuntu.Components.Popups 0.1
2323import "../Components/ListItems"
24+import "../Components/"
2425
2526Item {
2627 id: root
@@ -31,7 +32,7 @@ Item {
3132 property bool inverted: true
3233 property bool dragging: false
3334 property bool moving: launcherListView.moving || launcherListView.flicking
34− property bool preventHiding: moving || dndArea.draggedIndex >= 0 || dndArea.quickListPopover !== null || dndArea.pressed
35+ property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
3536 property int highlightIndex: -1
3637
3738 signal applicationSelected(string appId)
@@ -278,7 +279,6 @@ Item {
278279 property bool postDragging: false
279280 property int startX
280281 property int startY
281− property var quickListPopover: null
282282
283283 onPressed: {
284284 selectedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
@@ -357,11 +357,10 @@ Item {
357357 draggedIndex = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
358358
359359 // Opening QuickList
360− var quickListModel = launcherListView.model.get(draggedIndex).quickList
361− var quickListAppId = launcherListView.model.get(draggedIndex).appId
362−
363− quickListPopover = PopupUtils.open(popoverComponent, selectedItem,
364− {model: quickListModel, appId: quickListAppId})
360+ quickList.item = selectedItem;
361+ quickList.model = launcherListView.model.get(draggedIndex).quickList;
362+ quickList.appId = launcherListView.model.get(draggedIndex).appId;
363+ quickList.state = "open";
365364
366365 launcherListView.interactive = false
367366
@@ -387,7 +386,7 @@ Item {
387386 var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY))
388387 if (!preDragging && distance > units.gu(1.5)) {
389388 preDragging = true;
390− PopupUtils.close(quickListPopover)
389+ quickList.state = "";
391390 }
392391 if (distance > launcherListView.itemHeight) {
393392 selectedItem.dragging = true
@@ -482,53 +481,95 @@ Item {
482481 }
483482 }
484483
485− Component {
486− id: popoverComponent
484+ UbuntuShapeForItem {
485+ id: quickListShape
486+ objectName: "quickListShape"
487+ anchors.fill: quickList
488+ opacity: quickList.state === "open" ? 0.8 : 0
489+ visible: opacity > 0
490+ rotation: root.rotation
491+
492+ Behavior on opacity {
493+ UbuntuNumberAnimation {}
494+ }
495+
496+ image: quickList
497+
498+ Image {
499+ anchors {
500+ right: parent.left
501+ rightMargin: -units.dp(4)
502+ verticalCenter: parent.verticalCenter
503+ verticalCenterOffset: -quickList.offset
504+ }
505+ height: units.gu(1)
506+ width: units.gu(2)
507+ source: "graphics/quicklist_tooltip.png"
508+ rotation: 90
509+ }
510+
511+ InverseMouseArea {
512+ anchors.fill: parent
513+ enabled: quickList.state == "open"
514+ onClicked: {
515+ quickList.state = ""
516+ }
517+ }
518+
519+ }
520+
521+ Rectangle {
522+ id: quickList
523+ objectName: "quickList"
524+ color: "#221e1c"
525+ width: units.gu(30)
526+ height: quickListColumn.height
527+ anchors {
528+ left: root.inverted ? undefined : parent.right
529+ right: root.inverted ? parent.left : undefined
530+ margins: units.gu(1)
487531
488− Popover {
489− id: popover
490− property var model
491− property string appId
492− contentWidth: quickListColumn.width
493− foregroundStyle: QuicklistForegroundStyle {}
532+ }
533+ y: itemCenter - (height / 2) + offset
534+ rotation: root.rotation
494535
495− // FIXME: There's a bug in the Popover positioning that it covers the item in case it is rotated.
496− // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1204470
497− // For now, let's move the Popover around with callerMargin.
498− // Remove popupMargin once the bug is fixed.
499− property int popupMargin: root.inverted ? launcherListView.itemHeight : 0;
536+ property var model
537+ property string appId
538+ property var item
500539
501− callerMargin: units.gu(1) + popupMargin
540+ // internal
541+ property int itemCenter: item ? root.mapFromItem(quickList.item).y + (item.height / 2) : units.gu(1)
542+ property int offset: itemCenter + (height/2) + units.gu(1) > parent.height ? -itemCenter - (height/2) - units.gu(1) + parent.height :
543+ itemCenter - (height/2) < units.gu(1) ? (height/2) - itemCenter + units.gu(1) : 0
502544
503− Column {
504− id: quickListColumn
505− width: units.gu(30)
506− height: childrenRect.height
545+ Column {
546+ id: quickListColumn
547+ width: parent.width
548+ height: childrenRect.height
507549
508− Repeater {
509− id: popoverRepeater
510− model: popover.model
550+ Repeater {
551+ id: popoverRepeater
552+ model: quickList.model
511553
512− ListItems.Standard {
513− objectName: "quickListEntry" + index
514− text: (model.clickable ? "" : "<b>") + model.label + (model.clickable ? "" : "</b>")
515− highlightWhenPressed: model.clickable
554+ ListItems.Standard {
555+ objectName: "quickListEntry" + index
556+ text: (model.clickable ? "" : "<b>") + model.label + (model.clickable ? "" : "</b>")
557+ highlightWhenPressed: model.clickable
516558
517− // FIXME: This is a workaround for the theme not being context sensitive. I.e. the
518− // ListItems don't know that they are sitting in a themed Popover where the color
519− // needs to be inverted.
520− __foregroundColor: Theme.palette.selected.backgroundText
559+ // FIXME: This is a workaround for the theme not being context sensitive. I.e. the
560+ // ListItems don't know that they are sitting in a themed Popover where the color
561+ // needs to be inverted.
562+ __foregroundColor: Theme.palette.selected.backgroundText
521563
522− onClicked: {
523− if (!model.clickable) {
524− return;
525− }
526− PopupUtils.close(popover);
527− // Unsetting model to prevent showing changing entries during fading out
528− // that may happen because of triggering an action.
529− LauncherModel.quickListActionInvoked(appId, index);
530− popoverRepeater.model = undefined;
564+ onClicked: {
565+ if (!model.clickable) {
566+ return;
531567 }
568+ quickList.state = "";
569+ // Unsetting model to prevent showing changing entries during fading out
570+ // that may happen because of triggering an action.
571+ LauncherModel.quickListActionInvoked(quickList.appId, index);
572+ quickList.model = undefined;
532573 }
533574 }
534575 }