mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
homescreens/halcyon: Allow full screen to be draggable
This commit is contained in:
parent
108daf50db
commit
946e9dfc62
2 changed files with 93 additions and 87 deletions
|
|
@ -17,7 +17,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
|
||||||
|
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
|
|
||||||
MobileShell.ExtendedAbstractButton {
|
MouseArea {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
||||||
property alias iconItem: icon
|
property alias iconItem: icon
|
||||||
|
|
@ -51,9 +51,12 @@ MobileShell.ExtendedAbstractButton {
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onPressAndHold: openContextMenu()
|
onPressAndHold: openContextMenu()
|
||||||
onRightClickPressed: openContextMenu()
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (mouse.button === Qt.RightButton) {
|
||||||
|
openContextMenu();
|
||||||
|
} else {
|
||||||
// launch app
|
// launch app
|
||||||
if (application.running) {
|
if (application.running) {
|
||||||
delegate.launch(0, 0, "", applicationName, applicationStorageId);
|
delegate.launch(0, 0, "", applicationName, applicationStorageId);
|
||||||
|
|
@ -61,6 +64,7 @@ MobileShell.ExtendedAbstractButton {
|
||||||
delegate.launch(delegate.x + (PlasmaCore.Units.smallSpacing * 2), delegate.y + (PlasmaCore.Units.smallSpacing * 2), icon.source, applicationName, applicationStorageId);
|
delegate.launch(delegate.x + (PlasmaCore.Units.smallSpacing * 2), delegate.y + (PlasmaCore.Units.smallSpacing * 2), icon.source, applicationName, applicationStorageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: dialogLoader
|
id: dialogLoader
|
||||||
|
|
@ -81,15 +85,12 @@ MobileShell.ExtendedAbstractButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
radius: height / 2
|
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 {
|
RowLayout {
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -160,7 +161,6 @@ MobileShell.ExtendedAbstractButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,12 @@ Item {
|
||||||
id: favouritesList
|
id: favouritesList
|
||||||
clip: true
|
clip: true
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
boundsMovement: Flickable.StopAtBounds
|
|
||||||
boundsBehavior: Flickable.DragOverBounds
|
|
||||||
|
|
||||||
property real delegateHeight: PlasmaCore.Units.gridUnit * 3
|
|
||||||
|
|
||||||
anchors.fill: parent
|
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
|
// search widget open gesture
|
||||||
property bool openingSearchWidget: false
|
property bool openingSearchWidget: false
|
||||||
|
|
@ -95,6 +93,8 @@ Item {
|
||||||
header: MobileShell.BaseItem {
|
header: MobileShell.BaseItem {
|
||||||
topPadding: Math.round(swipeView.height * 0.2)
|
topPadding: Math.round(swipeView.height * 0.2)
|
||||||
bottomPadding: PlasmaCore.Units.largeSpacing
|
bottomPadding: PlasmaCore.Units.largeSpacing
|
||||||
|
leftPadding: favouritesList.leftMargin
|
||||||
|
rightPadding: favouritesList.rightMargin
|
||||||
implicitWidth: favouritesList.width
|
implicitWidth: favouritesList.width
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
@ -104,10 +104,14 @@ Item {
|
||||||
contentItem: Clock {}
|
contentItem: Clock {}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: DrawerListDelegate {
|
delegate: MobileShell.BaseItem {
|
||||||
id: delegate
|
leftPadding: favouritesList.leftMargin
|
||||||
width: favouritesList.width
|
rightPadding: favouritesList.rightMargin
|
||||||
height: visible ? favouritesList.delegateHeight : 0
|
|
||||||
|
contentItem: DrawerListDelegate {
|
||||||
|
implicitWidth: favouritesList.width - favouritesList.leftMargin - favouritesList.rightMargin
|
||||||
|
implicitHeight: visible ? favouritesList.delegateHeight : 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// open wallpaper menu when held on click
|
// open wallpaper menu when held on click
|
||||||
|
|
@ -121,8 +125,10 @@ Item {
|
||||||
visible: favouritesList.count == 0
|
visible: favouritesList.count == 0
|
||||||
opacity: 0.9
|
opacity: 0.9
|
||||||
|
|
||||||
anchors.topMargin: Math.round(swipeView.height * 0.2) - (favouritesList.contentY - favouritesList.originY)
|
|
||||||
anchors.fill: parent
|
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 {
|
Kirigami.Icon {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue