mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05:00
Assign some keyboard shortcuts.
This commit is contained in:
parent
b90807c4d3
commit
56ac80f475
@ -35,6 +35,12 @@ MainWindow::MainWindow()
|
||||
setWindowIcon(dataPath()->applicationIcon());
|
||||
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)),
|
||||
SLOT(setMenuActionState()));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)),
|
||||
@ -196,3 +202,13 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
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();
|
||||
|
||||
private:
|
||||
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
||||
|
||||
static const QString BaseWindowTitle;
|
||||
|
||||
const QScopedPointer<Ui::MainWindow> m_ui;
|
||||
|
Loading…
Reference in New Issue
Block a user