From d146b6830aa208c28e4e8171de254888fd8bf1c9 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Tue, 2 Mar 2021 16:59:26 +0200 Subject: [PATCH] Additional keyboard shortcuts --- keepassxc-browser/background/init.js | 6 ++++-- keepassxc-browser/content/keepassxc-browser.js | 2 +- keepassxc-browser/manifest.json | 9 +++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/keepassxc-browser/background/init.js b/keepassxc-browser/background/init.js index 0e7840e..98a20fc 100644 --- a/keepassxc-browser/background/init.js +++ b/keepassxc-browser/background/init.js @@ -109,7 +109,7 @@ const contextMenuItems = [ { title: tr('contextMenuFillTOTP'), action: 'fill_totp' }, { title: tr('contextMenuFillAttribute'), id: 'fill_attribute', visible: false }, { title: tr('contextMenuShowPasswordGenerator'), action: 'show_password_generator' }, - { title: tr('contextMenuSaveCredentials'), action: 'remember_credentials' } + { title: tr('contextMenuSaveCredentials'), action: 'save_credentials' } ]; const menuContexts = [ 'editable' ]; @@ -137,7 +137,9 @@ for (const item of contextMenuItems) { // Listen for keyboard shortcuts specified by user browser.commands.onCommand.addListener(async (command) => { - if (contextMenuItems.some(e => e.action === command)) { + if (contextMenuItems.some(e => e.action === command) + || command === 'redetect_fields' + || command === 'choose_credential_fields') { const tabs = await browser.tabs.query({ active: true, currentWindow: true }); if (tabs.length) { browser.tabs.sendMessage(tabs[0].id, { action: command }); diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index 356cfe5..64ef84d 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -1899,7 +1899,7 @@ browser.runtime.onMessage.addListener(async function(req, sender) { kpxc.inputs = []; kpxc.combinations = []; kpxc.initCredentialFields(); - } else if (req.action === 'remember_credentials') { + } else if (req.action === 'save_credentials') { kpxc.rememberCredentialsFromContextMenu(); } else if (req.action === 'retrive_credentials_forced') { await kpxc.retrieveCredentials(true); diff --git a/keepassxc-browser/manifest.json b/keepassxc-browser/manifest.json index a482de7..beb3521 100755 --- a/keepassxc-browser/manifest.json +++ b/keepassxc-browser/manifest.json @@ -107,6 +107,15 @@ "default": "Alt+Shift+G", "mac": "MacCtrl+Shift+G" } + }, + "save_credentials": { + "description": "__MSG_contextMenuSaveCredentials__" + }, + "redetect_fields": { + "description": "__MSG_popupRedetectButton__" + }, + "choose_credential_fields": { + "description": "__MSG_popupChooseCredentialsText__" } }, "web_accessible_resources": [