From cbf2bedf17aef4c91f121082c856b3a583cc7711 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Wed, 3 Oct 2018 02:49:14 -0700 Subject: [PATCH] Improve shortcut descriptions and add button to open shortcut settings --- keepassxc-browser/_locales/en/messages.json | 20 +++++++--------- keepassxc-browser/options/options.html | 10 ++++---- keepassxc-browser/options/options.js | 26 ++++++++++----------- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json index 130831a..37dec3c 100644 --- a/keepassxc-browser/_locales/en/messages.json +++ b/keepassxc-browser/_locales/en/messages.json @@ -12,7 +12,7 @@ "description": "Context menu item for filling password." }, "contextMenuFillTOTP": { - "message": "Insert TOTP", + "message": "Fill TOTP", "description": "Context menu item for filling Time-based One Time Password." }, "contextMenuShowPasswordGeneratorIcons": { @@ -395,6 +395,10 @@ "message": "About", "description": "About page header." }, + "optionsButtonConfigureShortcuts": { + "message": " Configure shortcuts", + "description": "Keyboard shortcut button text." + }, "optionsButtonSave": { "message": " Save", "description": "Save button text." @@ -487,17 +491,9 @@ "message": " never", "description": "Radio button text." }, - "optionsGeneralHelpText": { - "message": "If you just want to insert username and password into the fields where your focus is, press $1", - "description": "Context menu help text." - }, - "optionsGeneralHelpTextSecond": { - "message": "If you only want to insert the password, just press $1", - "description": "Context menu help text." - }, - "optionsCustomizeCommandsHelpText": { - "message": "You can customize these shortcuts on page $1", - "descriptions": "Shortcut customize help text." + "optionsKeyboardShortcutsHeader": { + "message": "Keyboard shortcuts", + "description": "Keyboard shortcut header text." }, "optionsBlinkTimeHelpText": { "message": "Maximum time (ms) the icon should blink after detecting new credentials", diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 40216de..646a8da 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -29,13 +29,13 @@


+

- . -
- . -
- + : error
+ : error
+ : error

+

diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 26b168e..bccce52 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -118,6 +118,18 @@ options.initGeneralSettings = function() { $('#blinkMinTimeout').val(options.settings['blinkMinTimeout']); $('#allowedRedirect').val(options.settings['allowedRedirect']); + browser.commands.getAll().then(function(commands) { + commands.forEach(function(command) { + var shortcut = document.getElementById(`${command.name}-shortcut`); + if (!shortcut) return; + shortcut.textContent = command.shortcut || 'not configured'; + }); + }); + + $('#configureCommands').click(function(){ + browser.tabs.create({ url: 'chrome://extensions/configureCommands' }); + }); + $('#blinkTimeoutButton').click(function(){ const blinkTimeout = $.trim($('#blinkTimeout').val()); const blinkTimeoutval = blinkTimeout !== '' ? Number(blinkTimeout) : defaultSettings.blinkTimeout; @@ -370,7 +382,7 @@ options.initSitePreferences = function() { $('#tab-site-preferences table tbody:first').append(tr); } } - + if ($('#tab-site-preferences table tbody:first tr').length > 2) { $('#tab-site-preferences table tbody:first tr.empty:first').hide(); } else { @@ -383,16 +395,4 @@ options.initAbout = function() { if (isFirefox()) { $('#chrome-only').remove(); } - - if (navigator.platform === 'MacIntel') { - $('#default-user-shortcut').hide(); - $('#default-pass-shortcut').hide(); - $('#mac-user-shortcut').show(); - $('#mac-pass-shortcut').show(); - } else { - $('#mac-user-shortcut').hide(); - $('#mac-pass-shortcut').hide(); - $('#default-user-shortcut').show(); - $('#default-pass-shortcut').show(); - } };