Improve Shortcuts

This commit is contained in:
Christian Hohnstaedt 2019-12-14 09:25:20 +01:00
parent 95985adc08
commit 4300136235
2 changed files with 21 additions and 9 deletions

View File

@ -90,10 +90,10 @@ void MainWindow::init_menu()
languageMenu->addAction(a);
}
file = menuBar()->addMenu(tr("&File"));
file->addAction(tr("&New DataBase"), this, SLOT(new_database()),
file->addAction(tr("New DataBase"), this, SLOT(new_database()),
QKeySequence::New)
->setEnabled(OpenDb::hasSqLite());
file->addAction(tr("&Open DataBase"), this, SLOT(load_database()),
file->addAction(tr("Open DataBase"), this, SLOT(load_database()),
QKeySequence::Open)
->setEnabled(OpenDb::hasSqLite());
file->addAction(tr("Open Remote DataBase"),
@ -104,8 +104,8 @@ void MainWindow::init_menu()
file->addAction(tr("Set as default DataBase"), this,
SLOT(default_database()));
}
acList += file->addAction(tr("&Close DataBase"), this,
SLOT(close_database()), QKeySequence(QKeySequence::Close));
acList += file->addAction(tr("Close DataBase"), this,
SLOT(close_database()), QKeySequence::Close);
a = new QAction(tr("Options"), this);
connect(a, SIGNAL(triggered()), this, SLOT(setOptions()));
@ -119,6 +119,7 @@ void MainWindow::init_menu()
connect(a, SIGNAL(triggered()),
qApp, SLOT(quit()), Qt::QueuedConnection);
a->setMenuRole(QAction::QuitRole);
a->setShortcut(QKeySequence::Quit);
file->addAction(a);
import = menuBar()->addMenu(tr("I&mport"));
@ -133,7 +134,7 @@ void MainWindow::init_menu()
import->addAction(tr("Paste PEM file"), this, SLOT(pastePem()),
QKeySequence::Paste);
token = menuBar()->addMenu(tr("&Token"));
token = menuBar()->addMenu(tr("Token"));
token->addAction(tr("&Manage Security token"), this,
SLOT(manageToken()));
token->addAction(tr("&Init Security token"), this,
@ -163,11 +164,12 @@ void MainWindow::init_menu()
extra->addAction(tr("OID Resolver"), resolver, SLOT(show()));
help = menuBar()->addMenu(tr("&Help") );
help->addAction(tr("&Content"), this, SLOT(help()),
help->addAction(tr("Content"), this, SLOT(help()),
QKeySequence::HelpContents);
a = new QAction(tr("About"), this);
connect(a, SIGNAL(triggered()), this, SLOT(about()));
a->setMenuRole(QAction::AboutRole);
a->setShortcut(QKeySequence::WhatsThis);
help->addAction(a);
wdMenuList += import;
scardList += token;

View File

@ -404,7 +404,8 @@ void XcaTreeView::showContextMenu(QContextMenuEvent *e,
index = idx.isValid() ? idx : currentIndex();
menu->addAction(tr("New"), this, SLOT(newItem()));
menu->addAction(tr("Import"), this, SLOT(load()));
menu->addAction(tr("Paste PEM data"), mainwin, SLOT(pastePem()));
menu->addAction(tr("Paste PEM data"), mainwin, SLOT(pastePem()),
QKeySequence::Paste);
if (indexes.size() == 1) {
menu->addAction(tr("Rename"), this, SLOT(editIdx()));
@ -415,8 +416,9 @@ void XcaTreeView::showContextMenu(QContextMenuEvent *e,
QKeySequence::Delete);
subExport = menu->addMenu(tr("Export"));
subExport->addAction(tr("Clipboard"), this,
SLOT(pem2clipboard()));
subExport->addAction(tr("File"), this, SLOT(storeItems()));
SLOT(pem2clipboard()), QKeySequence::Copy);
subExport->addAction(tr("File"), this, SLOT(storeItems()),
QKeySequence::Save);
}
fillContextMenu(menu, subExport, index, indexes);
@ -442,5 +444,13 @@ void XcaTreeView::keyPressEvent(QKeyEvent *event)
clearSelection();
return;
}
if (event->matches(QKeySequence::Save)) {
storeItems();
return;
}
if (event->matches(QKeySequence::Copy)) {
pem2clipboard();
return;
}
QTreeView::keyPressEvent(event);
}