mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
Fix broken reset homescreen position signal, and minor refactor
Closes #122
This commit is contained in:
parent
0cd4f91ec4
commit
0100d26024
1 changed files with 26 additions and 22 deletions
|
|
@ -39,18 +39,42 @@ FocusScope {
|
||||||
|
|
||||||
//END functions
|
//END functions
|
||||||
|
|
||||||
|
// implement API signals
|
||||||
|
Connections {
|
||||||
|
target: MobileShell.HomeScreenControls
|
||||||
|
|
||||||
|
property real lastRequestedPosition: 0
|
||||||
|
function onResetHomeScreenPosition() {
|
||||||
|
mainFlickable.scrollToPage(0);
|
||||||
|
root.appDrawer.close();
|
||||||
|
}
|
||||||
|
function onSnapHomeScreenPosition() {
|
||||||
|
if (lastRequestedPosition < 0) {
|
||||||
|
root.appDrawer.open();
|
||||||
|
} else {
|
||||||
|
root.appDrawer.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onRequestRelativeScroll(pos) {
|
||||||
|
root.appDrawer.offset -= pos.y;
|
||||||
|
lastRequestedPosition = pos.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
property bool componentComplete: false
|
property bool componentComplete: false
|
||||||
onWidthChanged: recalculateMaxFavoriteCount()
|
onWidthChanged: recalculateMaxFavoriteCount()
|
||||||
onHeightChanged:recalculateMaxFavoriteCount()
|
onHeightChanged:recalculateMaxFavoriteCount()
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// ApplicationListModel doesn't have a plasmoid as is not the one that should be doing writing
|
// ApplicationListModel doesn't have a plasmoid as is not the one that should be doing writing
|
||||||
HomeScreenComponents.ApplicationListModel.loadApplications();
|
HomeScreenComponents.ApplicationListModel.loadApplications();
|
||||||
HomeScreenComponents.FavoritesModel.applet = plasmoid;
|
HomeScreenComponents.FavoritesModel.applet = plasmoid;
|
||||||
HomeScreenComponents.FavoritesModel.loadApplications();
|
HomeScreenComponents.FavoritesModel.loadApplications();
|
||||||
|
|
||||||
|
// set API variables
|
||||||
if (plasmoid.screen == 0) {
|
if (plasmoid.screen == 0) {
|
||||||
MobileShell.HomeScreenControls.homeScreen = root
|
MobileShell.HomeScreenControls.homeScreen = root;
|
||||||
MobileShell.HomeScreenControls.homeScreenWindow = root.Window.window
|
MobileShell.HomeScreenControls.homeScreenWindow = root.Window.window;
|
||||||
}
|
}
|
||||||
componentComplete = true;
|
componentComplete = true;
|
||||||
recalculateMaxFavoriteCount()
|
recalculateMaxFavoriteCount()
|
||||||
|
|
@ -71,26 +95,6 @@ FocusScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
property real lastRequestedPosition: 0
|
|
||||||
target: MobileShell.HomeScreenControls
|
|
||||||
function onResetHomeScreenPosition() {
|
|
||||||
mainFlickable.scrollToPage(0);
|
|
||||||
appDrawer.close();
|
|
||||||
}
|
|
||||||
function onSnapHomeScreenPosition() {
|
|
||||||
if (lastRequestedPosition < 0) {
|
|
||||||
root.appDrawer.open();
|
|
||||||
} else {
|
|
||||||
root.appDrawer.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function onRequestRelativeScroll(pos) {
|
|
||||||
root.appDrawer.offset -= pos.y;
|
|
||||||
lastRequestedPosition = pos.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HomeScreenComponents.FlickablePages {
|
HomeScreenComponents.FlickablePages {
|
||||||
id: mainFlickable
|
id: mainFlickable
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue