diff --git a/components/HomeScreenControls.qml b/components/HomeScreenControls.qml index 01765824..271301d7 100644 --- a/components/HomeScreenControls.qml +++ b/components/HomeScreenControls.qml @@ -25,6 +25,9 @@ QtObject { id: delegate signal resetHomeScreenPosition() + signal snapHomeScreenPosition() + signal requestHomeScreenPosition(real y) + property real homeScreenPosition: 0 property Item homeScreen property QtObject homeScreenWindow property bool homeScreenVisible: true diff --git a/containments/homescreen/package/contents/ui/main.qml b/containments/homescreen/package/contents/ui/main.qml index 40d7f566..6c97824a 100644 --- a/containments/homescreen/package/contents/ui/main.qml +++ b/containments/homescreen/package/contents/ui/main.qml @@ -103,6 +103,12 @@ Item { scrollAnim.to = 0; scrollAnim.restart(); } + function onSnapHomeScreenPosition() { + mainFlickable.flick(0, 1); + } + function onRequestHomeScreenPosition(y) { + mainFlickable.contentY = y; + } } Timer { @@ -158,6 +164,8 @@ Item { onFlickStarted: cancelEditModeForItemsRequested() onFlickEnded: cancelEditModeForItemsRequested() + onContentYChanged: MobileShell.HomeScreenControls.homeScreenPosition = contentY + PlasmaComponents.ScrollBar.vertical: PlasmaComponents.ScrollBar { id: scrollabr opacity: mainFlickable.moving @@ -355,7 +363,7 @@ Item { oldMouseY = mouse.y; } onReleased: { - mainFlickable.flick(0, 1) + mainFlickable.flick(0, 1); } } Launcher.FavoriteStrip { diff --git a/containments/taskpanel/package/contents/ui/Button.qml b/containments/taskpanel/package/contents/ui/Button.qml index e0381a22..21cfae23 100644 --- a/containments/taskpanel/package/contents/ui/Button.qml +++ b/containments/taskpanel/package/contents/ui/Button.qml @@ -32,10 +32,11 @@ MouseArea { property alias iconSource: icon.source property bool checked property bool checkable + property bool clickable Rectangle { radius: height/2 anchors.fill: parent - opacity: button.pressed ? 0.1 : 0 + opacity: button.pressed && button.containsMouse && button.clickable ? 0.1 : 0 color: PlasmaCore.ColorScope.textColor Behavior on opacity { OpacityAnimator { @@ -48,7 +49,7 @@ MouseArea { id: icon anchors.fill: parent colorGroup: PlasmaCore.ColorScope.colorGroup - enabled: button.enabled + enabled: button.enabled && button.clickable } onClicked: { if (checkable) { diff --git a/containments/taskpanel/package/contents/ui/main.qml b/containments/taskpanel/package/contents/ui/main.qml index 5d3f023a..1e7fa05a 100644 --- a/containments/taskpanel/package/contents/ui/main.qml +++ b/containments/taskpanel/package/contents/ui/main.qml @@ -124,10 +124,14 @@ PlasmaCore.ColorScope { taskSwitcher.offset = taskSwitcher.offset - (mouse.y - oldMouseY); opening = oldMouseY > mouse.y; - oldMouseY = mouse.y; + if (taskSwitcher.visibility == Window.Hidden && taskSwitcher.offset > -taskSwitcher.height + units.gridUnit && taskSwitcher.tasksCount) { taskSwitcher.showFullScreen(); + //no tasks, let's scroll up the homescreen instead + } else if (taskSwitcher.tasksCount === 0) { + MobileShell.HomeScreenControls.requestHomeScreenPosition(MobileShell.HomeScreenControls.homeScreenPosition - (mouse.y - oldMouseY)); } + oldMouseY = mouse.y; } onReleased: { if (!isDragging) { @@ -135,6 +139,9 @@ PlasmaCore.ColorScope { } if (taskSwitcher.visibility == Window.Hidden) { + if (taskSwitcher.tasksCount === 0) { + MobileShell.HomeScreenControls.snapHomeScreenPosition(); + } return; } if (opening) { @@ -195,9 +202,10 @@ PlasmaCore.ColorScope { height: parent.height width: parent.width/3 enabled: root.hasTasks + clickable: root.hasTasks && !taskSwitcher.visible iconSource: "box" onClicked: { - if (taskSwitcher.visible) { + if (!clickable) { return; } plasmoid.nativeInterface.showDesktop = false; @@ -214,10 +222,10 @@ PlasmaCore.ColorScope { width: parent.width/3 anchors.horizontalCenter: parent.horizontalCenter iconSource: "start-here-kde" - enabled: taskSwitcher && taskSwitcher.tasksCount > 0 + clickable: !taskSwitcher.visible && (root.showingApp || MobileShell.HomeScreenControls.homeScreenPosition != 0) //checkable: true onClicked: { - if (taskSwitcher.visible) { + if (!clickable) { return; } root.minimizeAll(); @@ -244,9 +252,9 @@ PlasmaCore.ColorScope { anchors.right: parent.right iconSource: "paint-none" //FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML - opacity: plasmoid.nativeInterface.hasCloseableActiveWindow ? 1 : 0.4 + clickable: plasmoid.nativeInterface.hasCloseableActiveWindow && !taskSwitcher.visible onClicked: { - if (taskSwitcher.visible) { + if (!clickable) { return; } if (!plasmoid.nativeInterface.hasCloseableActiveWindow) {