mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/halcyon: implement keyboard arrow navigation
This commit is contained in:
parent
8c31f51ee6
commit
a414563c02
4 changed files with 58 additions and 8 deletions
|
|
@ -75,6 +75,7 @@ MobileShell.GridView {
|
||||||
contentItem: Clock {}
|
contentItem: Clock {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onReturnPressed: currentItem.appDelegate.launch()
|
||||||
model: DelegateModel {
|
model: DelegateModel {
|
||||||
id: visualModel
|
id: visualModel
|
||||||
model: Halcyon.PinnedModel
|
model: Halcyon.PinnedModel
|
||||||
|
|
@ -82,6 +83,7 @@ MobileShell.GridView {
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
id: delegateRoot
|
id: delegateRoot
|
||||||
property int visualIndex: DelegateModel.itemsIndex
|
property int visualIndex: DelegateModel.itemsIndex
|
||||||
|
property alias appDelegate: appDelegate
|
||||||
|
|
||||||
width: root.cellWidth
|
width: root.cellWidth
|
||||||
height: root.cellHeight
|
height: root.cellHeight
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
|
|
||||||
|
onFocusChanged: {
|
||||||
|
if (focus) {
|
||||||
|
favoritesGrid.forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
required property bool interactive
|
required property bool interactive
|
||||||
required property var searchWidget
|
required property var searchWidget
|
||||||
|
|
||||||
|
|
@ -49,6 +55,10 @@ Item {
|
||||||
openFolderAnim.restart()
|
openFolderAnim.restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetHighlight() {
|
||||||
|
favoritesGrid.currentIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
FavoritesGrid {
|
FavoritesGrid {
|
||||||
id: favoritesGrid
|
id: favoritesGrid
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,16 @@ MobileShell.GridView {
|
||||||
cacheBuffer: cellHeight * 20 // 10 rows above and below
|
cacheBuffer: cellHeight * 20 // 10 rows above and below
|
||||||
reuseItems: true
|
reuseItems: true
|
||||||
|
|
||||||
|
Controls.ScrollBar.vertical: Controls.ScrollBar {
|
||||||
|
policy: Controls.ScrollBar.AlwaysOn
|
||||||
|
}
|
||||||
|
|
||||||
|
onFocusChanged: {
|
||||||
|
if (focus) {
|
||||||
|
forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ensure items aren't visible out of bounds
|
// ensure items aren't visible out of bounds
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
|
|
||||||
|
|
@ -69,6 +79,7 @@ MobileShell.GridView {
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onReturnPressed: currentItem.launchApp()
|
||||||
delegate: GridAppDelegate {
|
delegate: GridAppDelegate {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ Item {
|
||||||
|
|
||||||
function triggerHomescreen() {
|
function triggerHomescreen() {
|
||||||
swipeView.setCurrentIndex(0);
|
swipeView.setCurrentIndex(0);
|
||||||
|
swipeView.focusChild();
|
||||||
favoritesView.closeFolder();
|
favoritesView.closeFolder();
|
||||||
favoritesView.goToBeginning();
|
favoritesView.goToBeginning();
|
||||||
gridAppList.goToBeginning();
|
gridAppList.goToBeginning();
|
||||||
|
|
@ -42,6 +43,16 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: MobileShellState.HomeScreenControls
|
||||||
|
|
||||||
|
function onHomeScreenVisibleChanged(){
|
||||||
|
if (MobileShellState.HomeScreenControls.homeScreenVisible) {
|
||||||
|
swipeView.focusChild();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QQC2.SwipeView {
|
QQC2.SwipeView {
|
||||||
id: swipeView
|
id: swipeView
|
||||||
opacity: 1 - searchWidget.openFactor
|
opacity: 1 - searchWidget.openFactor
|
||||||
|
|
@ -53,12 +64,27 @@ Item {
|
||||||
anchors.leftMargin: root.leftMargin
|
anchors.leftMargin: root.leftMargin
|
||||||
anchors.rightMargin: root.rightMargin
|
anchors.rightMargin: root.rightMargin
|
||||||
|
|
||||||
|
function focusChild() {
|
||||||
|
currentItem.childFocus = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
onCurrentIndexChanged: focusChild()
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
height: swipeView.height
|
height: swipeView.height
|
||||||
width: swipeView.width
|
width: swipeView.width
|
||||||
|
|
||||||
|
|
||||||
|
property alias childFocus: favoritesView.focus
|
||||||
|
|
||||||
// open wallpaper menu when held on click
|
// open wallpaper menu when held on click
|
||||||
TapHandler {
|
TapHandler {
|
||||||
|
onPressedChanged: {
|
||||||
|
if (pressed) {
|
||||||
|
favoritesView.resetHighlight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onLongPressed: root.openConfigure()
|
onLongPressed: root.openConfigure()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,16 +97,17 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.ScrollView {
|
Item {
|
||||||
width: swipeView.width
|
width: swipeView.width
|
||||||
height: swipeView.height
|
height: swipeView.height
|
||||||
|
|
||||||
// disable horizontal scrollbar
|
property alias childFocus: gridAppList.focus
|
||||||
QQC2.ScrollBar.horizontal: QQC2.ScrollBar { policy: QQC2.ScrollBar.AlwaysOff }
|
|
||||||
|
|
||||||
GridAppList {
|
GridAppList {
|
||||||
id: gridAppList
|
id: gridAppList
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
property int horizontalMargin: Math.round(swipeView.width * 0.05)
|
property int horizontalMargin: Math.round(swipeView.width * 0.05)
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
leftMargin: horizontalMargin
|
leftMargin: horizontalMargin
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue