Add shortcuts for entry creation, editing, cloning and deletion.

Closes #40
This commit is contained in:
Florian Geyer 2012-07-23 21:43:46 +02:00
parent 0755702fe3
commit 8bff332be0
2 changed files with 12 additions and 4 deletions

View File

@ -130,15 +130,19 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
addWidget(m_databaseOpenWidget); addWidget(m_databaseOpenWidget);
addWidget(m_keepass1OpenWidget); 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_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->setIcon(filePath()->icon("actions", "entry-clone", false));
m_actionEntryClone->setEnabled(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->setIcon(filePath()->icon("actions", "entry-edit", false));
m_actionEntryEditView->setEnabled(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->setIcon(filePath()->icon("actions", "entry-delete", false));
m_actionEntryDelete->setEnabled(false); m_actionEntryDelete->setEnabled(false);
m_actionEntryCopyUsername = m_menuEntry->addAction(tr("Copy username to clipboard"), this, m_actionEntryCopyUsername = m_menuEntry->addAction(tr("Copy username to clipboard"), this,

View File

@ -58,6 +58,10 @@ MainWindow::MainWindow()
setShortcut(m_ui->actionDatabaseClose, QKeySequence::Close, Qt::CTRL + Qt::Key_W); 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->actionQuit, QKeySequence::Quit, Qt::CTRL + Qt::Key_Q);
setShortcut(m_ui->actionSearch, QKeySequence::Find, Qt::CTRL + Qt::Key_F); 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->actionEntryCopyUsername->setShortcut(Qt::CTRL + Qt::Key_B);
m_ui->actionEntryCopyPassword->setShortcut(Qt::CTRL + Qt::Key_C); m_ui->actionEntryCopyPassword->setShortcut(Qt::CTRL + Qt::Key_C);
setShortcut(m_ui->actionEntryAutoType, QKeySequence::Paste, Qt::CTRL + Qt::Key_V); setShortcut(m_ui->actionEntryAutoType, QKeySequence::Paste, Qt::CTRL + Qt::Key_V);