Skip to content
Snippets Groups Projects
Commit 88e945a8 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

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
parent a505bc9e
No related branches found
No related tags found
No related merge requests found
...@@ -159,6 +159,15 @@ Rectangle { ...@@ -159,6 +159,15 @@ Rectangle {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
spacing: headerButtons.spacing spacing: headerButtons.spacing
visible: root.showSearch && CurrentConversation.isSwarm visible: root.showSearch && CurrentConversation.isSwarm
Shortcut {
sequence: "Ctrl+Shift+F"
context: Qt.ApplicationShortcut
enabled: rowSearchBar.visible
onActivated: {
rowSearchBar.openSearchBar()
}
}
} }
PushButton { PushButton {
......
...@@ -35,14 +35,16 @@ Rectangle { ...@@ -35,14 +35,16 @@ Rectangle {
function clearText() { function clearText() {
contactSearchBar.clear() contactSearchBar.clear()
fakeFocus.forceActiveFocus() contactSearchBar.forceActiveFocus()
} }
radius: JamiTheme.primaryRadius radius: JamiTheme.primaryRadius
color: JamiTheme.secondaryBackgroundColor color: JamiTheme.secondaryBackgroundColor
FocusScope { onFocusChanged: {
id: fakeFocus if (focus) {
contactSearchBar.forceActiveFocus()
}
} }
LineEditContextMenu { LineEditContextMenu {
...@@ -125,14 +127,6 @@ Rectangle { ...@@ -125,14 +127,6 @@ Rectangle {
} }
} }
Shortcut {
sequence: "Ctrl+F"
context: Qt.ApplicationShortcut
onActivated: {
contactSearchBar.forceActiveFocus()
}
}
Keys.onPressed: function (keyEvent) { Keys.onPressed: function (keyEvent) {
if (keyEvent.key === Qt.Key_Enter || if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) { keyEvent.key === Qt.Key_Return) {
......
...@@ -108,6 +108,11 @@ Window { ...@@ -108,6 +108,11 @@ Window {
shortcut2: "" shortcut2: ""
description: qsTr("Clear history") description: qsTr("Clear history")
} }
ListElement {
shortcut: "Ctrl + Shift + F"
shortcut2: ""
description: qsTr("Search messages/files")
}
ListElement { ListElement {
shortcut: "Ctrl + Shift + B" shortcut: "Ctrl + Shift + B"
shortcut2: "" shortcut2: ""
...@@ -119,7 +124,7 @@ Window { ...@@ -119,7 +124,7 @@ Window {
description: qsTr("Remove conversation") description: qsTr("Remove conversation")
} }
ListElement { ListElement {
shortcut: "Shift + Ctrl + A" shortcut: "Ctrl + Shift + A"
shortcut2: "" shortcut2: ""
description: qsTr("Accept contact request") description: qsTr("Accept contact request")
} }
......
...@@ -37,6 +37,10 @@ RowLayout { ...@@ -37,6 +37,10 @@ RowLayout {
property bool isOpened: false property bool isOpened: false
function openSearchBar() { function openSearchBar() {
if (isOpened) {
textArea.forceActiveFocus()
return
}
searchBarOpened() searchBarOpened()
rectTextArea.isSearch = true rectTextArea.isSearch = true
anim.start() anim.start()
...@@ -45,6 +49,8 @@ RowLayout { ...@@ -45,6 +49,8 @@ RowLayout {
} }
function closeSearchbar() { function closeSearchbar() {
if (!isOpened)
return
searchBarClosed() searchBarClosed()
rectTextArea.isSearch = false rectTextArea.isSearch = false
anim.start() anim.start()
......
...@@ -261,6 +261,14 @@ BaseView { ...@@ -261,6 +261,14 @@ BaseView {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 15 anchors.rightMargin: 15
Shortcut {
sequence: "Ctrl+F"
context: Qt.ApplicationShortcut
onActivated: {
contactSearchBar.forceActiveFocus()
}
}
ContactSearchBar { ContactSearchBar {
id: contactSearchBar id: contactSearchBar
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment