mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2025-01-07 11:20:47 +03:00
feature: double click to copy/generate
Double-click on a credential now copies the code to the clipboard. If it is a touch or HOTP credential a code is generated as well. The generate code action also copies the code to the clipboard. Should resolve #146
This commit is contained in:
parent
a1e2c449e0
commit
397defaeed
@ -269,6 +269,10 @@ Python {
|
|||||||
// after update, since the code now
|
// after update, since the code now
|
||||||
// might be available.
|
// might be available.
|
||||||
selected = cred
|
selected = cred
|
||||||
|
// When a single credential is updated,
|
||||||
|
// it is manually triggered and therefore
|
||||||
|
// should be copied to the clipboard.
|
||||||
|
copy()
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCredential(name, key, oathType, digits, algorithm, touch, cb) {
|
function addCredential(name, key, oathType, digits, algorithm, touch, cb) {
|
||||||
|
17
qml/main.qml
17
qml/main.qml
@ -268,6 +268,8 @@ ApplicationWindow {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: handleMouseClick(mouse, index,
|
onClicked: handleMouseClick(mouse, index,
|
||||||
modelData)
|
modelData)
|
||||||
|
onDoubleClicked: handleCredentialDoubleClick(mouse, index,
|
||||||
|
modelData)
|
||||||
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,6 +604,21 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleCredentialDoubleClick(mouse, index, modelData) {
|
||||||
|
|
||||||
|
arrowKeys.forceActiveFocus()
|
||||||
|
|
||||||
|
// A double-click should select the credential,
|
||||||
|
// then generate if needed and copy the code.
|
||||||
|
selected = modelData
|
||||||
|
selectedIndex = index
|
||||||
|
if (selected.code == null || isExpired(selected)) {
|
||||||
|
generate()
|
||||||
|
} else {
|
||||||
|
copy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateTrayVisability() {
|
function updateTrayVisability() {
|
||||||
SysTrayIcon.visible = settings.closeToTray
|
SysTrayIcon.visible = settings.closeToTray
|
||||||
// When the tray option is enabled, closing the last window
|
// When the tray option is enabled, closing the last window
|
||||||
|
Loading…
Reference in New Issue
Block a user