From 8bff332be03cb57f508e8ff20ec0c69be0a38724 Mon Sep 17 00:00:00 2001 From: Florian Geyer Date: Mon, 23 Jul 2012 21:43:46 +0200 Subject: [PATCH] Add shortcuts for entry creation, editing, cloning and deletion. Closes #40 --- src/gui/DatabaseWidget.cpp | 12 ++++++++---- src/gui/MainWindow.cpp | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index fd4e8da8c..36fb53cfe 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -130,15 +130,19 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) addWidget(m_databaseOpenWidget); addWidget(m_keepass1OpenWidget); - m_actionEntryNew = m_menuEntry->addAction(tr("Add new entry"), this, SLOT(createEntry())); + m_actionEntryNew = m_menuEntry->addAction(tr("Add new entry"), this, + SLOT(createEntry()), Qt::CTRL + Qt::Key_N); m_actionEntryNew->setIcon(filePath()->icon("actions", "entry-new", false)); - m_actionEntryClone = m_menuEntry->addAction(tr("Clone entry"), this, SLOT(cloneEntry())); + m_actionEntryClone = m_menuEntry->addAction(tr("Clone entry"), this, + SLOT(cloneEntry()), Qt::CTRL + Qt::Key_K); m_actionEntryClone->setIcon(filePath()->icon("actions", "entry-clone", false)); m_actionEntryClone->setEnabled(false); - m_actionEntryEditView = m_menuEntry->addAction(tr("View/Edit entry"), this, SLOT(switchToEntryEdit())); + m_actionEntryEditView = m_menuEntry->addAction(tr("View/Edit entry"), this, + SLOT(switchToEntryEdit()), Qt::CTRL + Qt::Key_E); m_actionEntryEditView->setIcon(filePath()->icon("actions", "entry-edit", false)); m_actionEntryEditView->setEnabled(false); - m_actionEntryDelete = m_menuEntry->addAction(tr("Delete entry"), this, SLOT(deleteEntry())); + m_actionEntryDelete = m_menuEntry->addAction(tr("Delete entry"), this, + SLOT(deleteEntry()), Qt::CTRL + Qt::Key_D); m_actionEntryDelete->setIcon(filePath()->icon("actions", "entry-delete", false)); m_actionEntryDelete->setEnabled(false); m_actionEntryCopyUsername = m_menuEntry->addAction(tr("Copy username to clipboard"), this, diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 23192dc5b..aff2b1493 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -58,6 +58,10 @@ MainWindow::MainWindow() setShortcut(m_ui->actionDatabaseClose, QKeySequence::Close, Qt::CTRL + Qt::Key_W); setShortcut(m_ui->actionQuit, QKeySequence::Quit, Qt::CTRL + Qt::Key_Q); setShortcut(m_ui->actionSearch, QKeySequence::Find, Qt::CTRL + Qt::Key_F); + m_ui->actionEntryNew->setShortcut(Qt::CTRL + Qt::Key_N); + m_ui->actionEntryEdit->setShortcut(Qt::CTRL + Qt::Key_E); + m_ui->actionEntryDelete->setShortcut(Qt::CTRL + Qt::Key_D); + m_ui->actionEntryClone->setShortcut(Qt::CTRL + Qt::Key_K); m_ui->actionEntryCopyUsername->setShortcut(Qt::CTRL + Qt::Key_B); m_ui->actionEntryCopyPassword->setShortcut(Qt::CTRL + Qt::Key_C); setShortcut(m_ui->actionEntryAutoType, QKeySequence::Paste, Qt::CTRL + Qt::Key_V);