mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
croll up homescreen when there are no tasks
This commit is contained in:
parent
daebf5ae60
commit
ece092bf98
4 changed files with 29 additions and 9 deletions
|
|
@ -25,6 +25,9 @@ QtObject {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
||||||
signal resetHomeScreenPosition()
|
signal resetHomeScreenPosition()
|
||||||
|
signal snapHomeScreenPosition()
|
||||||
|
signal requestHomeScreenPosition(real y)
|
||||||
|
property real homeScreenPosition: 0
|
||||||
property Item homeScreen
|
property Item homeScreen
|
||||||
property QtObject homeScreenWindow
|
property QtObject homeScreenWindow
|
||||||
property bool homeScreenVisible: true
|
property bool homeScreenVisible: true
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,12 @@ Item {
|
||||||
scrollAnim.to = 0;
|
scrollAnim.to = 0;
|
||||||
scrollAnim.restart();
|
scrollAnim.restart();
|
||||||
}
|
}
|
||||||
|
function onSnapHomeScreenPosition() {
|
||||||
|
mainFlickable.flick(0, 1);
|
||||||
|
}
|
||||||
|
function onRequestHomeScreenPosition(y) {
|
||||||
|
mainFlickable.contentY = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
|
@ -158,6 +164,8 @@ Item {
|
||||||
onFlickStarted: cancelEditModeForItemsRequested()
|
onFlickStarted: cancelEditModeForItemsRequested()
|
||||||
onFlickEnded: cancelEditModeForItemsRequested()
|
onFlickEnded: cancelEditModeForItemsRequested()
|
||||||
|
|
||||||
|
onContentYChanged: MobileShell.HomeScreenControls.homeScreenPosition = contentY
|
||||||
|
|
||||||
PlasmaComponents.ScrollBar.vertical: PlasmaComponents.ScrollBar {
|
PlasmaComponents.ScrollBar.vertical: PlasmaComponents.ScrollBar {
|
||||||
id: scrollabr
|
id: scrollabr
|
||||||
opacity: mainFlickable.moving
|
opacity: mainFlickable.moving
|
||||||
|
|
@ -355,7 +363,7 @@ Item {
|
||||||
oldMouseY = mouse.y;
|
oldMouseY = mouse.y;
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
mainFlickable.flick(0, 1)
|
mainFlickable.flick(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Launcher.FavoriteStrip {
|
Launcher.FavoriteStrip {
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,11 @@ MouseArea {
|
||||||
property alias iconSource: icon.source
|
property alias iconSource: icon.source
|
||||||
property bool checked
|
property bool checked
|
||||||
property bool checkable
|
property bool checkable
|
||||||
|
property bool clickable
|
||||||
Rectangle {
|
Rectangle {
|
||||||
radius: height/2
|
radius: height/2
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: button.pressed ? 0.1 : 0
|
opacity: button.pressed && button.containsMouse && button.clickable ? 0.1 : 0
|
||||||
color: PlasmaCore.ColorScope.textColor
|
color: PlasmaCore.ColorScope.textColor
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
|
|
@ -48,7 +49,7 @@ MouseArea {
|
||||||
id: icon
|
id: icon
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
colorGroup: PlasmaCore.ColorScope.colorGroup
|
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||||
enabled: button.enabled
|
enabled: button.enabled && button.clickable
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (checkable) {
|
if (checkable) {
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,14 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
taskSwitcher.offset = taskSwitcher.offset - (mouse.y - oldMouseY);
|
taskSwitcher.offset = taskSwitcher.offset - (mouse.y - oldMouseY);
|
||||||
opening = oldMouseY > mouse.y;
|
opening = oldMouseY > mouse.y;
|
||||||
oldMouseY = mouse.y;
|
|
||||||
if (taskSwitcher.visibility == Window.Hidden && taskSwitcher.offset > -taskSwitcher.height + units.gridUnit && taskSwitcher.tasksCount) {
|
if (taskSwitcher.visibility == Window.Hidden && taskSwitcher.offset > -taskSwitcher.height + units.gridUnit && taskSwitcher.tasksCount) {
|
||||||
taskSwitcher.showFullScreen();
|
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: {
|
onReleased: {
|
||||||
if (!isDragging) {
|
if (!isDragging) {
|
||||||
|
|
@ -135,6 +139,9 @@ PlasmaCore.ColorScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskSwitcher.visibility == Window.Hidden) {
|
if (taskSwitcher.visibility == Window.Hidden) {
|
||||||
|
if (taskSwitcher.tasksCount === 0) {
|
||||||
|
MobileShell.HomeScreenControls.snapHomeScreenPosition();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (opening) {
|
if (opening) {
|
||||||
|
|
@ -195,9 +202,10 @@ PlasmaCore.ColorScope {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width/3
|
width: parent.width/3
|
||||||
enabled: root.hasTasks
|
enabled: root.hasTasks
|
||||||
|
clickable: root.hasTasks && !taskSwitcher.visible
|
||||||
iconSource: "box"
|
iconSource: "box"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (taskSwitcher.visible) {
|
if (!clickable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plasmoid.nativeInterface.showDesktop = false;
|
plasmoid.nativeInterface.showDesktop = false;
|
||||||
|
|
@ -214,10 +222,10 @@ PlasmaCore.ColorScope {
|
||||||
width: parent.width/3
|
width: parent.width/3
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
iconSource: "start-here-kde"
|
iconSource: "start-here-kde"
|
||||||
enabled: taskSwitcher && taskSwitcher.tasksCount > 0
|
clickable: !taskSwitcher.visible && (root.showingApp || MobileShell.HomeScreenControls.homeScreenPosition != 0)
|
||||||
//checkable: true
|
//checkable: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (taskSwitcher.visible) {
|
if (!clickable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
root.minimizeAll();
|
root.minimizeAll();
|
||||||
|
|
@ -244,9 +252,9 @@ PlasmaCore.ColorScope {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
iconSource: "paint-none"
|
iconSource: "paint-none"
|
||||||
//FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML
|
//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: {
|
onClicked: {
|
||||||
if (taskSwitcher.visible) {
|
if (!clickable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plasmoid.nativeInterface.hasCloseableActiveWindow) {
|
if (!plasmoid.nativeInterface.hasCloseableActiveWindow) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue