mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-28 00:39:43 -05:00
Assign some keyboard shortcuts.
This commit is contained in:
parent
b90807c4d3
commit
56ac80f475
@ -35,6 +35,12 @@ MainWindow::MainWindow()
|
|||||||
setWindowIcon(dataPath()->applicationIcon());
|
setWindowIcon(dataPath()->applicationIcon());
|
||||||
m_ui->toolBar->toggleViewAction()->setText(tr("Show toolbar"));
|
m_ui->toolBar->toggleViewAction()->setText(tr("Show toolbar"));
|
||||||
|
|
||||||
|
setShortcut(m_ui->actionDatabaseOpen, QKeySequence::Open, Qt::CTRL + Qt::Key_O);
|
||||||
|
setShortcut(m_ui->actionDatabaseSave, QKeySequence::Save, Qt::CTRL + Qt::Key_S);
|
||||||
|
setShortcut(m_ui->actionDatabaseSaveAs, QKeySequence::SaveAs);
|
||||||
|
setShortcut(m_ui->actionDatabaseClose, QKeySequence::Close, Qt::CTRL + Qt::Key_W);
|
||||||
|
setShortcut(m_ui->actionQuit, QKeySequence::Quit, Qt::CTRL + Qt::Key_Q);
|
||||||
|
|
||||||
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)),
|
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)),
|
||||||
SLOT(setMenuActionState()));
|
SLOT(setMenuActionState()));
|
||||||
connect(m_ui->tabWidget, SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)),
|
connect(m_ui->tabWidget, SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)),
|
||||||
@ -196,3 +202,13 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
|||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback)
|
||||||
|
{
|
||||||
|
if (!QKeySequence::keyBindings(standard).isEmpty()) {
|
||||||
|
action->setShortcuts(standard);
|
||||||
|
}
|
||||||
|
else if (fallback != 0) {
|
||||||
|
action->setShortcut(QKeySequence(fallback));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -44,6 +44,8 @@ private Q_SLOTS:
|
|||||||
void showAboutDialog();
|
void showAboutDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
||||||
|
|
||||||
static const QString BaseWindowTitle;
|
static const QString BaseWindowTitle;
|
||||||
|
|
||||||
const QScopedPointer<Ui::MainWindow> m_ui;
|
const QScopedPointer<Ui::MainWindow> m_ui;
|
||||||
|
Loading…
Reference in New Issue
Block a user