Make the SpaceDrawer navigable with the keyboard.

(cherry picked from commit 624b1b06c5)
This commit is contained in:
James Graham
2024-04-22 18:18:15 +02:00
committed by Tobias Fella
parent 714ea8413c
commit 3967b27352
3 changed files with 258 additions and 245 deletions

View File

@@ -91,7 +91,6 @@ RowLayout {
Layout.preferredWidth: root.desiredWidth ? root.desiredWidth - menuButton.width - root.spacing : -1 Layout.preferredWidth: root.desiredWidth ? root.desiredWidth - menuButton.width - root.spacing : -1
visible: !root.collapsed visible: !root.collapsed
onTextChanged: root.textChanged(text) onTextChanged: root.textChanged(text)
KeyNavigation.tab: treeView
} }
QQC2.ToolButton { QQC2.ToolButton {

View File

@@ -21,11 +21,11 @@ QQC2.Control {
topPadding: 0 topPadding: 0
bottomPadding: 0 bottomPadding: 0
contentItem: Loader { onActiveFocusChanged: if (activeFocus) {
id: sidebarColumn notificationsButton.forceActiveFocus();
z: 0 }
sourceComponent: ColumnLayout { contentItem: ColumnLayout {
spacing: 0 spacing: 0
QQC2.ScrollView { QQC2.ScrollView {
@@ -60,6 +60,8 @@ QQC2.Control {
source: "notifications" source: "notifications"
} }
activeFocusOnTab: true
onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'NotificationsView'), { onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'NotificationsView'), {
connection: root.connection connection: root.connection
}, { }, {
@@ -86,6 +88,8 @@ QQC2.Control {
source: "user-home-symbolic" source: "user-home-symbolic"
} }
activeFocusOnTab: true
checked: RoomManager.currentSpace.length === 0 checked: RoomManager.currentSpace.length === 0
onClicked: { onClicked: {
RoomManager.currentSpace = ""; RoomManager.currentSpace = "";
@@ -132,6 +136,8 @@ QQC2.Control {
source: "system-users" source: "system-users"
} }
activeFocusOnTab: true
checked: RoomManager.currentSpace === "DM" checked: RoomManager.currentSpace === "DM"
onClicked: { onClicked: {
RoomManager.currentSpace = "DM"; RoomManager.currentSpace = "DM";
@@ -184,6 +190,8 @@ QQC2.Control {
text: displayName text: displayName
source: avatar ? ("image://mxc/" + avatar) : "" source: avatar ? ("image://mxc/" + avatar) : ""
activeFocusOnTab: true
onSelected: { onSelected: {
RoomManager.resolveResource(spaceDelegate.roomId); RoomManager.resolveResource(spaceDelegate.roomId);
RoomManager.currentSpace = spaceDelegate.roomId; RoomManager.currentSpace = spaceDelegate.roomId;
@@ -227,6 +235,8 @@ QQC2.Control {
Layout.preferredHeight: width - Kirigami.Units.smallSpacing Layout.preferredHeight: width - Kirigami.Units.smallSpacing
Layout.maximumHeight: width - Kirigami.Units.smallSpacing Layout.maximumHeight: width - Kirigami.Units.smallSpacing
activeFocusOnTab: true
visible: SpaceHierarchyCache.recommendedSpaceId.length > 0 && !root.connection.room(SpaceHierarchyCache.recommendedSpaceId) && !SpaceHierarchyCache.recommendedSpaceHidden visible: SpaceHierarchyCache.recommendedSpaceId.length > 0 && !root.connection.room(SpaceHierarchyCache.recommendedSpaceId) && !SpaceHierarchyCache.recommendedSpaceHidden
text: i18nc("Join <name of a space>", "Join %1", SpaceHierarchyCache.recommendedSpaceDisplayName) text: i18nc("Join <name of a space>", "Join %1", SpaceHierarchyCache.recommendedSpaceDisplayName)
@@ -275,6 +285,9 @@ QQC2.Control {
contentItem: Kirigami.Icon { contentItem: Kirigami.Icon {
source: "list-add" source: "list-add"
} }
activeFocusOnTab: true
onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog'), { onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog'), {
connection: root.connection, connection: root.connection,
isSpace: true, isSpace: true,
@@ -286,7 +299,6 @@ QQC2.Control {
} }
} }
} }
}
function createContextMenu(room) { function createContextMenu(room) {
let context = spaceListContextMenu.createObject(root, { let context = spaceListContextMenu.createObject(root, {

View File

@@ -46,6 +46,8 @@ RowLayout {
text: i18n("Edit this account") text: i18n("Edit this account")
source: mediaId ? ("image://mxc/" + mediaId) : "" source: mediaId ? ("image://mxc/" + mediaId) : ""
activeFocusOnTab: true
onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), { onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
connection: root.connection connection: root.connection
}, { }, {