mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-18 09:52:46 -05:00
Change actions for F1-F2-F3 keys
* Fixes #5037 * F1 focuses group view, if already focused it opens the focused group for editing * F2 focuses entry view, if already focused it opens the focused entry for editing * F3 focuses search
This commit is contained in:
parent
0cc2c83525
commit
8a7bdd5b95
7 changed files with 44 additions and 19 deletions
|
|
@ -325,14 +325,6 @@ MainWindow::MainWindow()
|
|||
shortcut = new QShortcut(dbTabModifier + Qt::Key_9, this);
|
||||
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(m_ui->tabWidget->count() - 1); });
|
||||
|
||||
// Allow for direct focus of search, group view, and entry view
|
||||
shortcut = new QShortcut(Qt::Key_F1, this);
|
||||
connect(shortcut, SIGNAL(activated()), m_searchWidget, SLOT(searchFocus()));
|
||||
shortcut = new QShortcut(Qt::Key_F2, this);
|
||||
m_actionMultiplexer.connect(shortcut, SIGNAL(activated()), SLOT(focusOnGroups()));
|
||||
shortcut = new QShortcut(Qt::Key_F3, this);
|
||||
m_actionMultiplexer.connect(shortcut, SIGNAL(activated()), SLOT(focusOnEntries()));
|
||||
|
||||
// Toggle password and username visibility in entry view
|
||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C, this, SLOT(togglePasswordsHidden()));
|
||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B, this, SLOT(toggleUsernamesHidden()));
|
||||
|
|
@ -1189,6 +1181,28 @@ void MainWindow::changeEvent(QEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (!event->modifiers()) {
|
||||
// Allow for direct focus of search, group view, and entry view
|
||||
auto dbWidget = m_ui->tabWidget->currentDatabaseWidget();
|
||||
if (dbWidget && dbWidget->isEntryViewActive()) {
|
||||
if (event->key() == Qt::Key_F1) {
|
||||
dbWidget->focusOnGroups(true);
|
||||
return;
|
||||
} else if (event->key() == Qt::Key_F2) {
|
||||
dbWidget->focusOnEntries(true);
|
||||
return;
|
||||
} else if (event->key() == Qt::Key_F3) {
|
||||
m_searchWidget->searchFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
bool MainWindow::focusNextPrevChild(bool next)
|
||||
{
|
||||
// Only navigate around the main window if the database widget is showing the entry view
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue