diff --git a/qml/BasicDialog.qml b/qml/BasicDialog.qml index 025f29a..bdb1d7b 100644 --- a/qml/BasicDialog.qml +++ b/qml/BasicDialog.qml @@ -9,4 +9,10 @@ Controls.Dialog { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: Math.min(parent.width, Kirigami.Units.gridUnit * 30) + + function acceptOnReturn(event) { + if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { + this.accept() + } + } } diff --git a/qml/EntriesPage.qml b/qml/EntriesPage.qml index 5bf92d9..67ec060 100644 --- a/qml/EntriesPage.qml +++ b/qml/EntriesPage.qml @@ -17,6 +17,7 @@ Kirigami.ScrollablePage { iconName: "list-add" text: qsTr("Add account") onTriggered: insertEntry("Account") + shortcut: "Ctrl+A" } left: Kirigami.Action { iconName: "edit-paste" @@ -32,11 +33,13 @@ Kirigami.ScrollablePage { showPassiveNotification( qsTr("Pasted ") + pastedEntries.join(", ")) } + shortcut: StandardKey.Paste } right: Kirigami.Action { iconName: "folder-add" text: qsTr("Add category") onTriggered: insertEntry("Node") + shortcut: "Ctrl+Shift+A" } } background: Rectangle { @@ -91,6 +94,7 @@ Kirigami.ScrollablePage { id: entryNameTextField Layout.preferredWidth: renameDialog.availableWidth placeholderText: qsTr("enter new name here") + Keys.onPressed: renameDialog.acceptOnReturn(event) } } @@ -194,17 +198,20 @@ Kirigami.ScrollablePage { rootIndex)) showPassiveNotification(text + " " + model.name) } + shortcut: StandardKey.Cut }, Kirigami.Action { iconName: "edit-delete" text: qsTr("Delete") onTriggered: confirmDeletionDialog.confirmDeletion( model.name, index) + shortcut: StandardKey.Delete }, Kirigami.Action { iconName: "edit-rename" text: qsTr("Rename") onTriggered: renameDialog.renameEntry(model.name, index) + shortcut: "F2" } ] } diff --git a/qml/PasswordDialog.qml b/qml/PasswordDialog.qml index 7d85a69..740098e 100644 --- a/qml/PasswordDialog.qml +++ b/qml/PasswordDialog.qml @@ -46,6 +46,7 @@ BasicDialog { background: Rectangle { border.color: "#5d5e6d" } + Keys.onPressed: passwordDialog.acceptOnReturn(event) } Controls.TextField { id: repeatPasswordTextField @@ -57,6 +58,7 @@ BasicDialog { background: Rectangle { border.color: passwordDialog.canAccept ? "#089900" : "#ff0000" } + Keys.onPressed: passwordDialog.acceptOnReturn(event) } Controls.CheckBox { id: showCharactersCheckBox diff --git a/qml/main.qml b/qml/main.qml index de15aaa..1474153 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -93,22 +93,26 @@ Kirigami.ApplicationWindow { text: qsTr("Create new file") iconName: "document-new" onTriggered: fileDialog.createNew() + shortcut: StandardKey.New }, Kirigami.Action { text: qsTr("Open existing file") iconName: "document-open" onTriggered: fileDialog.openExisting() + shortcut: StandardKey.Open }, Kirigami.Action { text: qsTr("Recently opened ...") iconName: "document-open-recent" children: createFileActions(nativeInterface.recentFiles) + shortcut: "Ctrl+R" }, Kirigami.Action { text: qsTr("Save modifications") enabled: nativeInterface.fileOpen iconName: "document-save" onTriggered: nativeInterface.save() + shortcut: StandardKey.Save }, Kirigami.Action { text: nativeInterface.passwordSet ? qsTr("Change password") : qsTr( @@ -117,12 +121,14 @@ Kirigami.ApplicationWindow { iconName: "document-encrypt" onTriggered: enterPasswordDialog.askForNewPassword( "Change password for " + nativeInterface.filePath) + shortcut: "Ctrl+P" }, Kirigami.Action { text: "Close file" enabled: nativeInterface.fileOpen iconName: "document-close" onTriggered: nativeInterface.close() + shortcut: StandardKey.Close } ] Controls.Switch { @@ -239,6 +245,11 @@ Kirigami.ApplicationWindow { } } + Shortcut { + sequence: "Ctrl+M" + onActivated: leftMenu.visible = !leftMenu.visible + } + function clearStack() { pageStack.pop(root.pageStack.initialPage, Controls.StackView.Immediate) }