mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-19 19:48:36 -04:00
Enable browser-like DbTab experience (Alt + Nums)
* Pressing ALT+1-9 goes to 1-9 tab * Pressing ALT+0 goes to the last tab
This commit is contained in:
parent
4939179b9f
commit
06e5f19fab
2 changed files with 40 additions and 0 deletions
|
@ -302,6 +302,27 @@ MainWindow::MainWindow()
|
||||||
new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(selectNextDatabaseTab()));
|
new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(selectNextDatabaseTab()));
|
||||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(selectPreviousDatabaseTab()));
|
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(selectPreviousDatabaseTab()));
|
||||||
new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(selectPreviousDatabaseTab()));
|
new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(selectPreviousDatabaseTab()));
|
||||||
|
new QShortcut(Qt::ALT + Qt::Key_0, this, SLOT(selectLastDatabaseTab()));
|
||||||
|
|
||||||
|
auto shortcut = new QShortcut(Qt::ALT + Qt::Key_1, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(1); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_2, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(2); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_3, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(3); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_4, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(4); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_5, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(5); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_6, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(6); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_7, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(7); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_8, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(8); });
|
||||||
|
shortcut = new QShortcut(Qt::ALT + Qt::Key_9, this);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this]() { selectDatabaseTab(9); });
|
||||||
|
|
||||||
// Toggle password and username visibility in entry view
|
// 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_C, this, SLOT(togglePasswordsHidden()));
|
||||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B, this, SLOT(toggleUsernamesHidden()));
|
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B, this, SLOT(toggleUsernamesHidden()));
|
||||||
|
@ -974,6 +995,23 @@ void MainWindow::selectPreviousDatabaseTab()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::selectDatabaseTab(int tabIndex)
|
||||||
|
{
|
||||||
|
if (m_ui->stackedWidget->currentIndex() == DatabaseTabScreen) {
|
||||||
|
if (tabIndex <= m_ui->tabWidget->count()) {
|
||||||
|
m_ui->tabWidget->setCurrentIndex(--tabIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::selectLastDatabaseTab()
|
||||||
|
{
|
||||||
|
if (m_ui->stackedWidget->currentIndex() == DatabaseTabScreen) {
|
||||||
|
int index = m_ui->tabWidget->count() - 1;
|
||||||
|
m_ui->tabWidget->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::databaseTabChanged(int tabIndex)
|
void MainWindow::databaseTabChanged(int tabIndex)
|
||||||
{
|
{
|
||||||
if (tabIndex != -1 && m_ui->stackedWidget->currentIndex() == WelcomeScreen) {
|
if (tabIndex != -1 && m_ui->stackedWidget->currentIndex() == WelcomeScreen) {
|
||||||
|
|
|
@ -122,6 +122,8 @@ private slots:
|
||||||
void showErrorMessage(const QString& message);
|
void showErrorMessage(const QString& message);
|
||||||
void selectNextDatabaseTab();
|
void selectNextDatabaseTab();
|
||||||
void selectPreviousDatabaseTab();
|
void selectPreviousDatabaseTab();
|
||||||
|
void selectDatabaseTab(int tabIndex);
|
||||||
|
void selectLastDatabaseTab();
|
||||||
void togglePasswordsHidden();
|
void togglePasswordsHidden();
|
||||||
void toggleUsernamesHidden();
|
void toggleUsernamesHidden();
|
||||||
void obtainContextFocusLock();
|
void obtainContextFocusLock();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue