feature(@desktop/onboarding): Right click doesnt paste into password field

Added a right click context menu to let the user paste from the clipboard to TextField of the password modal.

fixes #2702
This commit is contained in:
Khushboo Mehta 2021-08-25 10:52:39 +02:00 committed by Iuri Matias
parent 0531d71e6c
commit b69ef24e0e
1 changed files with 32 additions and 0 deletions

View File

@ -1,5 +1,8 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import StatusQ.Popups 0.1
import "../imports"
import "../shared/status"
import "."
@ -102,6 +105,19 @@ Item {
}
onEditingFinished: inputBox.editingFinished(inputBox.text)
onTextEdited: inputBox.textEdited(inputBox.text)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton | Qt.LeftButton
onClicked: {
if((mouse.button === Qt.RightButton) && inputValue.canPaste) {
rightClickContextMenu.popup()
}
else {
inputValue.forceActiveFocus(Qt.MouseFocusReason)
}
}
}
}
SVGImage {
@ -186,6 +202,22 @@ Item {
color: validationErrorColor
wrapMode: TextEdit.Wrap
}
StatusPopupMenu {
id: rightClickContextMenu
StatusMenuItem {
enabled: inputValue.canPaste
text: qsTrId("Paste")
onTriggered: {
inputValue.paste()
}
}
onClosed: {
inputValue.forceActiveFocus(Qt.MouseFocusReason)
}
}
}
/*##^##