Quick GUI: Show buttons to copy when editing field

This commit is contained in:
Martchus 2019-02-05 00:27:18 +01:00
parent dcb2253903
commit 9002602895
2 changed files with 43 additions and 12 deletions

View File

@ -138,6 +138,7 @@ set(REQUIRED_ICONS
insert-text insert-text
list-add list-add
list-remove list-remove
password-copy
password-generate password-generate
password-show-off password-show-off
password-show-on password-show-on
@ -149,6 +150,7 @@ set(REQUIRED_ICONS
system-file-manager system-file-manager
system-run system-run
system-search system-search
username-copy
window-close window-close
) )

View File

@ -23,6 +23,7 @@ Kirigami.ScrollablePage {
property alias isPassword: fieldIsPasswordCheckBox.checked property alias isPassword: fieldIsPasswordCheckBox.checked
title: qsTr("Edit field of %1").arg(nativeInterface.currentAccountName) title: qsTr("Edit field of %1").arg(nativeInterface.currentAccountName)
standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel
onAccepted: { onAccepted: {
var column0 = fieldsListView.model.index(entryIndex, 0) var column0 = fieldsListView.model.index(entryIndex, 0)
var column1 = fieldsListView.model.index(entryIndex, 1) var column1 = fieldsListView.model.index(entryIndex, 1)
@ -33,19 +34,47 @@ Kirigami.ScrollablePage {
} }
ColumnLayout { ColumnLayout {
Controls.TextField { GridLayout {
id: fieldNameEdit
Layout.preferredWidth: fieldDialog.availableWidth Layout.preferredWidth: fieldDialog.availableWidth
text: fieldDialog.fieldName columns: 2
Keys.onPressed: fieldDialog.acceptOnReturn(event) columnSpacing: 0
}
Controls.TextField { Controls.TextField {
id: fieldValueEdit id: fieldNameEdit
Layout.preferredWidth: fieldDialog.availableWidth Layout.fillWidth: true
text: fieldDialog.fieldValue text: fieldDialog.fieldName
echoMode: fieldDialog.isPassword Keys.onPressed: fieldDialog.acceptOnReturn(event)
&& !showCharactersCheckBox.checked ? TextInput.PasswordEchoOnEdit : TextInput.Normal }
Keys.onPressed: fieldDialog.acceptOnReturn(event) Controls.RoundButton {
flat: true
icon.name: "username-copy"
Layout.preferredWidth: height
onClicked: {
nativeInterface.copyToClipboard(fieldNameEdit.text)
showPassiveNotification(qsTr("Copied field name"))
}
}
Controls.TextField {
id: fieldValueEdit
property bool hideCharacters: fieldDialog.isPassword
&& !showCharactersCheckBox.checked
Layout.fillWidth: true
text: fieldDialog.fieldValue
echoMode: hideCharacters ? TextInput.PasswordEchoOnEdit : TextInput.Normal
Keys.onPressed: fieldDialog.acceptOnReturn(event)
}
Controls.RoundButton {
flat: true
icon.name: "password-copy"
Layout.preferredWidth: height
onClicked: {
nativeInterface.copyToClipboard(fieldValueEdit.text)
showPassiveNotification(
fieldDialog.isPassword ? qsTr("Copied password") : qsTr(
"Copied value"))
}
}
} }
RowLayout { RowLayout {
Layout.preferredWidth: fieldDialog.availableWidth Layout.preferredWidth: fieldDialog.availableWidth