Improve the Keyboard tab and the KeyBindings editor
ClosedPublic

Authored by ahmadsamir on May 19 2018, 12:45 PM.

Details

Summary
  • Change updateKeyBindingsList() to select the last edited keybindings scheme after closing the editor dialog
  • Add a tooltip showing the path of each keybinding scheme, this should lessen the confusion when the scheme description and the file name of the .keytab file are different
  • Add a button to the Keyboard tab to reset a scheme to its default values, this is only applicable for schemes that exist in both system-wide and user specific locations
  • Move a lot of the construction of the keybinding editor widgets from EditProfileDialog to KeyBindingEditor
  • Change the wording from "key bindings list" to "key bindings scheme" to differentiate between a keyboard translator "scheme" and the key bindings "list" on the Keyboard tab

KeyBindingEditor:

  • Make the KeyBindingEditor a QDialog and set Qt::WA_DeleteOnClose
  • Disallow saving a scheme with an empty description
  • Add a QLineEdit to show only the rows that have strings matching the text entered in the line edit box
  • Reimplement sizeHint() to make the dialog slightly smaller than the Edit Profile dialog, for better visibility of the entries

KeyboardTranslatorManager:

  • Make findTranslatorPath() const and public
  • Make allTranslators() return type const
Test Plan
  • Editing a key bindings scheme works and closing the dialog selects the edited scheme
  • Creating a new scheme works as before
  • "Defaults" button works for system-wide schemes if they were previously edited and saved under the user's home dir
  • Remove button is only enabled for schemes saved in a dir writable for the user

Diff Detail

Repository
R319 Konsole
Branch
keybindings-editor (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
ahmadsamir created this revision.May 19 2018, 12:45 PM
Restricted Application added a project: Konsole. · View Herald TranscriptMay 19 2018, 12:45 PM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
ahmadsamir requested review of this revision.May 19 2018, 12:45 PM

Thanks for working on this.

  1. You can remove the description which shouldn't be allowed - just like profile name can't be empty - I would not use a special kmessagewidget - just use something like setPlaceholderText(i18n("A name must be entered!")); and do the normal popup about missing description when Apply/OK
  2. The 'remove' button is for any file that the user has permissions to delete (for example on one of my system I install konsole into /usr/local)

[..]

  1. You can remove the description which shouldn't be allowed - just like profile name can't be empty - I would not use a special kmessagewidget - just use something like setPlaceholderText(i18n("A name must be entered!")); and do the normal popup about missing description when Apply/OK

Done, I'll update the diff shortly.

  1. The 'remove' button is for any file that the user has permissions to delete (for example on one of my system I install konsole into /usr/local)

The wording in the test plan isn't clear TBH; I meant the remove button is only enabled for schemes whose parent dir is writeable for the user.

ahmadsamir edited the summary of this revision. (Show Details)
ahmadsamir edited the test plan for this revision. (Show Details)
ahmadsamir removed a subscriber: hindenburg.

Disallow saving a scheme with an empty description

Make it clearer in the Test Plan that the remove button is only enabled for schemes saved in a dir where the user has write permission

doesn't build here

KeyBindingEditor.cpp:307:9: error: use of undeclared identifier 'KMessageBox'

KMessageBox::sorry(this, i18n("A key bindings scheme cannot be saved with an empty description."));
ahmadsamir updated this revision to Diff 34643.May 22 2018, 1:12 PM
ahmadsamir removed a subscriber: hindenburg.

Add proper include

doesn't build here

KeyBindingEditor.cpp:307:9: error: use of undeclared identifier 'KMessageBox'

KMessageBox::sorry(this, i18n("A key bindings scheme cannot be saved with an empty description."));

Sorry about that, I didn't properly sync the changes between my local build and my konsole git clone.

I notice you can overwrite files w/o any notice - create multiple new key bindings files and apply/ok. You don't need to work on that just bringing it up.

src/KeyBindingEditor.cpp
66

I used this for the profile name entry - think it is OK here as well?

setPlaceholderText(i18nc("@label:textbox", "Enter descriptive label"));

ahmadsamir updated this revision to Diff 34648.May 22 2018, 2:14 PM
ahmadsamir removed a subscriber: hindenburg.

Use the same placeholderText from the Edit Profile dialog General tab, more consistent wording across the application and saves the translators a bit of time

ahmadsamir marked an inline comment as done.May 22 2018, 2:29 PM
ahmadsamir added a subscriber: hindenburg.

I notice you can overwrite files w/o any notice - create multiple new key bindings files and apply/ok. You don't need to work on that just bringing it up.

TBH, I did have code to check the name of a scheme is valid before saving (that was the main reason for reimplementing accept()), but there were multiple issues:

  • A scheme can have a different file name and description
  • When saving a new scheme I checked that the file name and description didn't match any existing ones, respectively
  • I added quirks to accommodate the read-only schemes in /usr/share/konsole

Long story short, after I had to add more than 5-6 conditions just to achieve that (and still some stuff would make it barf), I just dropped that part of the patch. It seems to have worked as-is for so many years, probably because most users don't dabble with the keyboard translators much, and the ones that do are savvy enough not to muck it up. :)

KeyBindingEditor.cpp:66:97: error: expected ';' after expression

_ui->descriptionEdit->setPlaceholderText(i18nc("@label:textbox", "Enter descriptive label"))
hindenburg edited the test plan for this revision. (Show Details)May 22 2018, 3:14 PM

KeyBindingEditor.cpp:66:97: error: expected ';' after expression

_ui->descriptionEdit->setPlaceholderText(i18nc("@label:textbox", "Enter descriptive label"))

Shameful, will fix.

ahmadsamir updated this revision to Diff 34657.May 22 2018, 4:34 PM
ahmadsamir edited the test plan for this revision. (Show Details)
ahmadsamir removed a subscriber: hindenburg.

Add missing semicolon

hindenburg accepted this revision.May 22 2018, 10:47 PM
This revision is now accepted and ready to land.May 22 2018, 10:47 PM
This revision was automatically updated to reflect the committed changes.