Improve accessibility (#3409)

* Add application settings reset button
 - Corrects accessibility findings GP.2

* Use icons in addition to color to indicate password mismatch
 - Corrects accessibility finding CN.2

* Announce begin/end of list navigation
 - Corrects accessibility finding KF.4

* Fixes for keyboard navigation
 - Add Ctrl+F10 keyboard shortcut to show group/entry context menus. Fixes #3140
 - Improve movement between form fields

* Fix loading system-defined language in translator
 - Fixes #3202
 - Bypass built-in Qt loading of QLocale for translations. The order of loading languages doesn't consider all file names prior to moving to the next language in the list. This resulted in English being chosen no matter what language is the top priority.

* Improve message box defaults and fix documentation links

* Better support for screen readers

* Add accessible names on form fields

* Prevent changing values during settings widget scrolling
 - Add an event filter to combo boxes and spin boxes on the settings page to prevent the mouse wheel from changing the values without having focus
 - Add horizontal stretch to the security settings to make the spin boxes more manageable.
This commit is contained in:
Jonathan White 2019-08-30 20:18:41 -04:00 committed by GitHub
parent 58d357e9ce
commit 3b330ee2d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 1073 additions and 202 deletions

View file

@ -18,9 +18,11 @@
#include "EntryView.h"
#include <QAccessible>
#include <QHeaderView>
#include <QKeyEvent>
#include <QMenu>
#include <QShortcut>
#include "core/FilePath.h"
#include "gui/SortFilterHideProxyModel.h"
@ -56,6 +58,8 @@ EntryView::EntryView(QWidget* parent)
connect(m_model, SIGNAL(passwordsHiddenChanged()), SIGNAL(viewStateChanged()));
// clang-format on
new QShortcut(Qt::CTRL + Qt::Key_F10, this, SLOT(contextMenuShortcutPressed()), nullptr, Qt::WidgetShortcut);
m_headerMenu = new QMenu(this);
m_headerMenu->setTitle(tr("Customize View"));
m_headerMenu->addSection(tr("Customize View"));
@ -128,6 +132,14 @@ EntryView::EntryView(QWidget* parent)
m_model->setPaperClipPixmap(filePath()->icon("actions", "paperclip").pixmap(16));
}
void EntryView::contextMenuShortcutPressed()
{
auto index = currentIndex();
if (hasFocus() && index.isValid()) {
emit customContextMenuRequested(visualRect(index).bottomLeft());
}
}
void EntryView::keyPressEvent(QKeyEvent* event)
{
if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) && currentIndex().isValid()) {
@ -140,15 +152,18 @@ void EntryView::keyPressEvent(QKeyEvent* event)
int last = m_model->rowCount() - 1;
if (last > 0) {
QAccessibleEvent accessibleEvent(this, QAccessible::PageChanged);
if (event->key() == Qt::Key_Up && currentIndex().row() == 0) {
QModelIndex index = m_sortModel->mapToSource(m_sortModel->index(last, 0));
setCurrentEntry(m_model->entryFromIndex(index));
QAccessible::updateAccessibility(&accessibleEvent);
return;
}
if (event->key() == Qt::Key_Down && currentIndex().row() == last) {
QModelIndex index = m_sortModel->mapToSource(m_sortModel->index(0, 0));
setCurrentEntry(m_model->entryFromIndex(index));
QAccessible::updateAccessibility(&accessibleEvent);
return;
}
}