Skip to content
Snippets Groups Projects
Commit 77b8f285 authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

keyEvent: replace the unclear StandardKey comparisons

StandardKey.MoveToNextLine, StandardKey.MoveToPreviousLine
and StandardKey.InsertParagraphSeparator maybe confusing and
better to be replaced by direct key comparisons

Change-Id: I13361a43437214b9368d01a97b2e542f57835964
parent 6ceba6a7
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,8 @@ PushButton {
toolTipText: JamiStrings.back
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
clicked()
keyEvent.accepted = true
}
......
......@@ -54,7 +54,8 @@ Switch {
}
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
checked = !checked
keyEvent.accepted = true
}
......
......@@ -191,7 +191,8 @@ Button {
}
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
clicked()
keyEvent.accepted = true
}
......
......@@ -198,10 +198,11 @@ Item {
JamiResources.baseline_camera_alt_24dp_svg
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
clicked()
keyEvent.accepted = true
} else if (keyEvent.matches(StandardKey.MoveToPreviousLine)) {
} else if (keyEvent.key === Qt.Key_Up) {
root.focusOnPreviousItem()
keyEvent.accepted = true
}
......@@ -245,11 +246,12 @@ Item {
KeyNavigation.up: takePhotoButton
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
clicked()
takePhotoButton.forceActiveFocus()
keyEvent.accepted = true
} else if (keyEvent.matches(StandardKey.MoveToNextLine) ||
} else if (keyEvent.key === Qt.Key_Down ||
keyEvent.key === Qt.Key_Tab) {
if (isPreviewing) {
root.focusOnNextItem()
......@@ -283,11 +285,12 @@ Item {
imageColor: JamiTheme.textColor
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
focusAfterFileDialogClosed = true
clicked()
keyEvent.accepted = true
} else if (keyEvent.matches(StandardKey.MoveToNextLine) ||
} else if (keyEvent.key === Qt.Key_Down ||
keyEvent.key === Qt.Key_Tab) {
root.focusOnNextItem()
keyEvent.accepted = true
......
......@@ -134,7 +134,8 @@ Rectangle {
}
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
if (contactSearchBar.text !== "") {
returnPressedWhileSearching()
keyEvent.accepted = true
......
......@@ -138,7 +138,8 @@ Flickable {
if (keyEvent.matches(StandardKey.Paste)) {
MessagesAdapter.pasteKeyDetected()
keyEvent.accepted = true
} else if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) {
} else if (keyEvent.key === Qt.Key_Enter ||
keyEvent.key === Qt.Key_Return) {
if (!(keyEvent.modifiers & Qt.ShiftModifier)) {
root.sendMessagesRequired()
keyEvent.accepted = true
......
......@@ -154,7 +154,7 @@ Rectangle {
KeyNavigation.down: KeyNavigation.tab
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.MoveToPreviousLine)) {
if (keyEvent.key === Qt.Key_Up) {
setAvatarWidget.focusOnPreviousPhotoBoothItem()
keyEvent.accepted = true
}
......@@ -221,7 +221,7 @@ Rectangle {
KeyNavigation.up: saveProfileBtn
Keys.onPressed: function (keyEvent) {
if (keyEvent.matches(StandardKey.MoveToNextLine) ||
if (keyEvent.key === Qt.Key_Down ||
keyEvent.key === Qt.Key_Tab) {
setAvatarWidget.focusOnNextPhotoBoothItem()
keyEvent.accepted = true
......
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