diff --git a/applets/kickoff/package/contents/ui/KickoffListView.qml b/applets/kickoff/package/contents/ui/KickoffListView.qml --- a/applets/kickoff/package/contents/ui/KickoffListView.qml +++ b/applets/kickoff/package/contents/ui/KickoffListView.qml @@ -96,87 +96,109 @@ criteria: ViewSection.FullString delegate: SectionDelegate {} } - } - } - MouseArea { - anchors.left: parent.left + MouseArea { + anchors.left: parent.left - width: scrollArea.viewport.width - height: parent.height + width: scrollArea.viewport.width + height: parent.height - id: mouseArea + id: mouseArea - property Item pressed: null - property int pressX: -1 - property int pressY: -1 + property Item pressed: null + property int pressX: -1 + property int pressY: -1 + property bool tapandhold: false - hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.RightButton + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: { - var mapped = listView.mapToItem(listView.contentItem, mouse.x, mouse.y); - var item = listView.itemAt(mapped.x, mapped.y); + onPressed: { + var mapped = listView.mapToItem(listView.contentItem, mouse.x, mouse.y); + var item = listView.itemAt(mapped.x, mapped.y); - if (!item) { - return; - } + if (!item) { + return; + } - if (mouse.buttons & Qt.RightButton) { - if (item.hasActionList) { - mapped = listView.contentItem.mapToItem(item, mapped.x, mapped.y); - listView.currentItem.openActionMenu(mapped.x, mapped.y); + if (mouse.buttons & Qt.RightButton) { + if (item.hasActionList) { + mapped = listView.contentItem.mapToItem(item, mapped.x, mapped.y); + listView.currentItem.openActionMenu(mapped.x, mapped.y); + } + } else { + pressed = item; + pressX = mouse.x; + pressY = mouse.y; + } } - } else { - pressed = item; - pressX = mouse.x; - pressY = mouse.y; - } - } - - onReleased: { - var mapped = listView.mapToItem(listView.contentItem, mouse.x, mouse.y); - var item = listView.itemAt(mapped.x, mapped.y); - if (item && pressed === item) { - if (item.appView) { - view.state = "OutgoingLeft"; - } else { - item.activate(); + onReleased: { + var mapped = listView.mapToItem(listView.contentItem, mouse.x, mouse.y); + var item = listView.itemAt(mapped.x, mapped.y); + + if (item && pressed === item && !tapandhold) { + if (item.appView) { + if (mouse.source == Qt.MouseEventSynthesizedByQt) { + positionChanged(mouse); + } + view.state = "OutgoingLeft"; + } else { + item.activate(); + } + + listView.currentIndex = -1; + } + + if (tapandhold && mouse.source == Qt.MouseEventSynthesizedByQt) { + if (item.hasActionList) { + mapped = listView.contentItem.mapToItem(item, mapped.x, mapped.y); + listView.currentItem.openActionMenu(mapped.x, mapped.y); + } + } + pressed = null; + pressX = -1; + pressY = -1; + tapandhold = false; } - listView.currentIndex = -1; - } - - pressed = null; - pressX = -1; - pressY = -1; - } - - onPositionChanged: { - var mapped = listView.mapToItem(listView.contentItem, mouse.x, mouse.y); - var item = listView.itemAt(mapped.x, mapped.y); - - if (item) { - listView.currentIndex = item.itemIndex; - } else { - listView.currentIndex = -1; - } + onPositionChanged: { + var mapped = listView.mapToItem(listView.contentItem, mouse.x, mouse.y); + var item = listView.itemAt(mapped.x, mapped.y); + + if (item) { + listView.currentIndex = item.itemIndex; + } else { + listView.currentIndex = -1; + } + + if (mouse.source != Qt.MouseEventSynthesizedByQt || tapandhold) { + if (pressed && pressX != -1 && pressed.url && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) { + kickoff.dragSource = item; + dragHelper.startDrag(root, pressed.url, pressed.decoration); + pressed = null; + pressX = -1; + pressY = -1; + tapandhold = false + } + } + } - if (pressed && pressX != -1 && pressed.url && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) { - kickoff.dragSource = item; - dragHelper.startDrag(root, pressed.url, pressed.decoration); - pressed = null; - pressX = -1; - pressY = -1; - } - } + onContainsMouseChanged: { + if (!containsMouse) { + pressed = null; + pressX = -1; + pressY = -1; + tapandhold = false + } + } - onContainsMouseChanged: { - if (!containsMouse) { - pressed = null; - pressX = -1; - pressY = -1; + onPressAndHold: { + if (mouse.source == Qt.MouseEventSynthesizedByQt) { + tapandhold = true; + positionChanged(mouse); + } + } } } }