diff --git a/containments/homescreens/halcyon/package/contents/ui/DrawerListDelegate.qml b/containments/homescreens/halcyon/package/contents/ui/DrawerListDelegate.qml index 357a55ff..9635aade 100644 --- a/containments/homescreens/halcyon/package/contents/ui/DrawerListDelegate.qml +++ b/containments/homescreens/halcyon/package/contents/ui/DrawerListDelegate.qml @@ -17,7 +17,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon import org.kde.kirigami 2.19 as Kirigami -MobileShell.ExtendedAbstractButton { +MouseArea { id: delegate property alias iconItem: icon @@ -51,14 +51,18 @@ MobileShell.ExtendedAbstractButton { hoverEnabled: true onPressAndHold: openContextMenu() - onRightClickPressed: openContextMenu() - + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { - // launch app - if (application.running) { - delegate.launch(0, 0, "", applicationName, applicationStorageId); + if (mouse.button === Qt.RightButton) { + openContextMenu(); } else { - delegate.launch(delegate.x + (PlasmaCore.Units.smallSpacing * 2), delegate.y + (PlasmaCore.Units.smallSpacing * 2), icon.source, applicationName, applicationStorageId); + // launch app + if (application.running) { + delegate.launch(0, 0, "", applicationName, applicationStorageId); + } else { + delegate.launch(delegate.x + (PlasmaCore.Units.smallSpacing * 2), delegate.y + (PlasmaCore.Units.smallSpacing * 2), icon.source, applicationName, applicationStorageId); + } } } @@ -81,83 +85,79 @@ MobileShell.ExtendedAbstractButton { } } - background: Rectangle { + Rectangle { + anchors.fill: parent radius: height / 2 - color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (delegate.hovered ? Qt.rgba(255, 255, 255, 0.1) : "transparent") + color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (delegate.containsMouse ? Qt.rgba(255, 255, 255, 0.1) : "transparent") } - contentItem: Item { - implicitHeight: rowLayout.height + rowLayout.anchors.topMargin + rowLayout.anchors.bottomMargin - implicitWidth: rowLayout.width + rowLayout.anchors.rightMargin + rowLayout.anchors.leftMargin - - RowLayout { - id: rowLayout - anchors { - fill: parent - leftMargin: PlasmaCore.Units.smallSpacing * 2 - topMargin: PlasmaCore.Units.smallSpacing - rightMargin: PlasmaCore.Units.smallSpacing * 2 - bottomMargin: PlasmaCore.Units.smallSpacing + RowLayout { + id: rowLayout + anchors { + fill: parent + leftMargin: PlasmaCore.Units.smallSpacing * 2 + topMargin: PlasmaCore.Units.smallSpacing + rightMargin: PlasmaCore.Units.smallSpacing * 2 + bottomMargin: PlasmaCore.Units.smallSpacing + } + spacing: 0 + + PlasmaCore.IconItem { + id: icon + + Layout.alignment: Qt.AlignLeft + Layout.minimumWidth: Layout.minimumHeight + Layout.preferredWidth: Layout.minimumHeight + Layout.minimumHeight: parent.height + Layout.preferredHeight: Layout.minimumHeight + + usesPlasmaTheme: false + source: applicationIcon + + Rectangle { + anchors { + horizontalCenter: parent.horizontalCenter + bottom: parent.bottom + } + visible: application ? application.running : false + radius: width + width: PlasmaCore.Units.smallSpacing + height: width + color: PlasmaCore.Theme.highlightColor } - spacing: 0 - - PlasmaCore.IconItem { - id: icon - - Layout.alignment: Qt.AlignLeft - Layout.minimumWidth: Layout.minimumHeight - Layout.preferredWidth: Layout.minimumHeight - Layout.minimumHeight: parent.height - Layout.preferredHeight: Layout.minimumHeight - - usesPlasmaTheme: false - source: applicationIcon - - Rectangle { - anchors { - horizontalCenter: parent.horizontalCenter - bottom: parent.bottom - } - visible: application ? application.running : false - radius: width - width: PlasmaCore.Units.smallSpacing - height: width - color: PlasmaCore.Theme.highlightColor - } - - layer.enabled: true - layer.effect: DropShadow { - verticalOffset: 1 - radius: 4 - samples: 6 - color: Qt.rgba(0, 0, 0, 0.5) - } + + layer.enabled: true + layer.effect: DropShadow { + verticalOffset: 1 + radius: 4 + samples: 6 + color: Qt.rgba(0, 0, 0, 0.5) } + } - PlasmaComponents.Label { - id: label - visible: text.length > 0 + PlasmaComponents.Label { + id: label + visible: text.length > 0 - Layout.fillWidth: true - Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2 - Layout.rightMargin: PlasmaCore.Units.largeSpacing - wrapMode: Text.WordWrap - maximumLineCount: 1 - elide: Text.ElideRight + Layout.fillWidth: true + Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2 + Layout.rightMargin: PlasmaCore.Units.largeSpacing + wrapMode: Text.WordWrap + maximumLineCount: 1 + elide: Text.ElideRight - text: applicationName + text: applicationName - font.pointSize: PlasmaCore.Theme.defaultFont.pointSize - font.weight: Font.Bold - color: "white" - - layer.enabled: true - layer.effect: DropShadow { - verticalOffset: 1 - radius: 4 - samples: 6 - color: Qt.rgba(0, 0, 0, 0.5) - } + font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + font.weight: Font.Bold + color: "white" + + layer.enabled: true + layer.effect: DropShadow { + verticalOffset: 1 + radius: 4 + samples: 6 + color: Qt.rgba(0, 0, 0, 0.5) } } } diff --git a/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml b/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml index e1a55809..066e53b5 100644 --- a/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml +++ b/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml @@ -58,15 +58,13 @@ Item { id: favouritesList clip: true interactive: root.interactive - boundsMovement: Flickable.StopAtBounds - boundsBehavior: Flickable.DragOverBounds - - property real delegateHeight: PlasmaCore.Units.gridUnit * 3 - anchors.fill: parent - anchors.leftMargin: Math.round(parent.width * 0.1) - anchors.rightMargin: Math.round(parent.width * 0.1) + // don't set anchors.margins since we want everywhere to be draggable + readonly property real leftMargin: Math.round(parent.width * 0.1) + readonly property real rightMargin: Math.round(parent.width * 0.1) + readonly property real delegateHeight: PlasmaCore.Units.gridUnit * 3 + // search widget open gesture property bool openingSearchWidget: false property real oldVerticalOvershoot: verticalOvershoot @@ -95,6 +93,8 @@ Item { header: MobileShell.BaseItem { topPadding: Math.round(swipeView.height * 0.2) bottomPadding: PlasmaCore.Units.largeSpacing + leftPadding: favouritesList.leftMargin + rightPadding: favouritesList.rightMargin implicitWidth: favouritesList.width background: Rectangle { @@ -104,10 +104,14 @@ Item { contentItem: Clock {} } - delegate: DrawerListDelegate { - id: delegate - width: favouritesList.width - height: visible ? favouritesList.delegateHeight : 0 + delegate: MobileShell.BaseItem { + leftPadding: favouritesList.leftMargin + rightPadding: favouritesList.rightMargin + + contentItem: DrawerListDelegate { + implicitWidth: favouritesList.width - favouritesList.leftMargin - favouritesList.rightMargin + implicitHeight: visible ? favouritesList.delegateHeight : 0 + } } // open wallpaper menu when held on click @@ -121,8 +125,10 @@ Item { visible: favouritesList.count == 0 opacity: 0.9 - anchors.topMargin: Math.round(swipeView.height * 0.2) - (favouritesList.contentY - favouritesList.originY) anchors.fill: parent + anchors.topMargin: Math.round(swipeView.height * 0.2) - (favouritesList.contentY - favouritesList.originY) + anchors.leftMargin: favouritesList.leftMargin + anchors.rightMargin: favouritesList.rightMargin Kirigami.Icon { id: icon