mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2025-01-06 02:37:21 +03:00
Add Edit menu for the credential actions
This commit is contained in:
parent
92c97003b7
commit
f873e52adb
@ -7,13 +7,8 @@ Menu {
|
||||
property bool showGenerate
|
||||
property bool enableGenerate
|
||||
|
||||
signal copy
|
||||
signal generate
|
||||
signal deleteCredential
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("\&Copy")
|
||||
shortcut: StandardKey.Copy
|
||||
enabled: (credential != null) && (credential.code != null)
|
||||
onTriggered: copy()
|
||||
}
|
||||
@ -21,14 +16,12 @@ Menu {
|
||||
MenuItem {
|
||||
visible: showGenerate
|
||||
enabled: enableGenerate
|
||||
text: qsTr("\&Generate code")
|
||||
shortcut: "Space"
|
||||
text: qsTr("Generate code")
|
||||
onTriggered: generate()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("\&Delete")
|
||||
shortcut: StandardKey.Delete
|
||||
text: qsTr("Delete")
|
||||
onTriggered: deleteCredential()
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,9 @@ MenuBar {
|
||||
property bool slotMode
|
||||
property bool hasDevice
|
||||
|
||||
property var credential
|
||||
property bool enableGenerate
|
||||
|
||||
signal openAddCredential
|
||||
signal openAbout
|
||||
signal openReset
|
||||
@ -41,6 +44,32 @@ MenuBar {
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: qsTr("\&Edit")
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("\&Copy")
|
||||
shortcut: StandardKey.Copy
|
||||
enabled: (credential != null) && (credential.code != null)
|
||||
onTriggered: copy()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
enabled: enableGenerate
|
||||
text: qsTr("\&Generate code")
|
||||
shortcut: "Space"
|
||||
onTriggered: generate()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("\&Delete")
|
||||
shortcut: StandardKey.Delete
|
||||
enabled: (credential != null)
|
||||
onTriggered: deleteCredential()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Menu {
|
||||
title: qsTr("\&Help")
|
||||
MenuItem {
|
||||
@ -48,4 +77,8 @@ MenuBar {
|
||||
onTriggered: openAbout()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
15
qml/main.qml
15
qml/main.qml
@ -27,6 +27,14 @@ ApplicationWindow {
|
||||
// See http://doc.qt.io/qt-5/qwindow.html#Visibility-enum
|
||||
property bool shouldRefresh: visibility != 3 && visibility != 0
|
||||
|
||||
signal copy
|
||||
signal generate
|
||||
signal deleteCredential
|
||||
|
||||
onDeleteCredential: confirmDeleteCredential.open()
|
||||
onGenerate: handleGenerate(repeater.selected)
|
||||
onCopy: clipboard.setClipboard(repeater.selected.code)
|
||||
|
||||
onHasDeviceChanged: handleNewDevice()
|
||||
|
||||
onCredentialsChanged: {
|
||||
@ -37,6 +45,8 @@ ApplicationWindow {
|
||||
menuBar: MainMenuBar {
|
||||
slotMode: settings.slotMode
|
||||
hasDevice: device.hasDevice
|
||||
credential: repeater.selected
|
||||
enableGenerate: enableManualGenerate(repeater.selected)
|
||||
onOpenAddCredential: openClearAddCredential()
|
||||
onOpenSetPassword: setPassword.open()
|
||||
onOpenReset: reset.open()
|
||||
@ -44,13 +54,11 @@ ApplicationWindow {
|
||||
onOpenAbout: aboutPage.open()
|
||||
}
|
||||
|
||||
|
||||
Shortcut {
|
||||
sequence: StandardKey.Close
|
||||
onActivated: close()
|
||||
}
|
||||
|
||||
|
||||
SystemPalette {
|
||||
id: palette
|
||||
}
|
||||
@ -159,9 +167,6 @@ ApplicationWindow {
|
||||
credential: repeater.selected
|
||||
showGenerate: allowManualGenerate(repeater.selected)
|
||||
enableGenerate: enableManualGenerate(repeater.selected)
|
||||
onGenerate: handleGenerate(repeater.selected)
|
||||
onDeleteCredential: confirmDeleteCredential.open()
|
||||
onCopy: clipboard.setClipboard(repeater.selected.code)
|
||||
}
|
||||
|
||||
DeleteCredentialConfirmation {
|
||||
|
Loading…
Reference in New Issue
Block a user