1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 12:03:18 +02:00

searchbar: fix keyboard shortcuts

+ Ctrl+F should focus the sidebar's searchbar
+ Ctrl+Shift+F focus the messages search

This was mostly due to multiple search bar shown, so multiple
shortcut enabled.

Change-Id: Ib910bbdc7c90e3b57846fb316b4b68d4e929b8d8
GitLab: #1028
This commit is contained in:
Sébastien Blin 2023-03-09 13:26:40 -05:00
parent a505bc9eef
commit 88e945a856
5 changed files with 34 additions and 12 deletions

View file

@ -159,6 +159,15 @@ Rectangle {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
spacing: headerButtons.spacing
visible: root.showSearch && CurrentConversation.isSwarm
Shortcut {
sequence: "Ctrl+Shift+F"
context: Qt.ApplicationShortcut
enabled: rowSearchBar.visible
onActivated: {
rowSearchBar.openSearchBar()
}
}
}
PushButton {

View file

@ -35,14 +35,16 @@ Rectangle {
function clearText() {
contactSearchBar.clear()
fakeFocus.forceActiveFocus()
contactSearchBar.forceActiveFocus()
}
radius: JamiTheme.primaryRadius
color: JamiTheme.secondaryBackgroundColor
FocusScope {
id: fakeFocus
onFocusChanged: {
if (focus) {
contactSearchBar.forceActiveFocus()
}
}
LineEditContextMenu {
@ -125,14 +127,6 @@ Rectangle {
}
}
Shortcut {
sequence: "Ctrl+F"
context: Qt.ApplicationShortcut
onActivated: {
contactSearchBar.forceActiveFocus()
}
}
Keys.onPressed: function (keyEvent) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {

View file

@ -108,6 +108,11 @@ Window {
shortcut2: ""
description: qsTr("Clear history")
}
ListElement {
shortcut: "Ctrl + Shift + F"
shortcut2: ""
description: qsTr("Search messages/files")
}
ListElement {
shortcut: "Ctrl + Shift + B"
shortcut2: ""
@ -119,7 +124,7 @@ Window {
description: qsTr("Remove conversation")
}
ListElement {
shortcut: "Shift + Ctrl + A"
shortcut: "Ctrl + Shift + A"
shortcut2: ""
description: qsTr("Accept contact request")
}

View file

@ -37,6 +37,10 @@ RowLayout {
property bool isOpened: false
function openSearchBar() {
if (isOpened) {
textArea.forceActiveFocus()
return
}
searchBarOpened()
rectTextArea.isSearch = true
anim.start()
@ -45,6 +49,8 @@ RowLayout {
}
function closeSearchbar() {
if (!isOpened)
return
searchBarClosed()
rectTextArea.isSearch = false
anim.start()

View file

@ -261,6 +261,14 @@ BaseView {
anchors.right: parent.right
anchors.rightMargin: 15
Shortcut {
sequence: "Ctrl+F"
context: Qt.ApplicationShortcut
onActivated: {
contactSearchBar.forceActiveFocus()
}
}
ContactSearchBar {
id: contactSearchBar