void db_key::showContextMenu(QContextMenuEvent *e, const QModelIndex &index) { QMenu *menu = new QMenu(mainwin); currentIdx = index; pki_key *key = static_cast<pki_key*>(currentIdx.internalPointer()); menu->addAction(tr("New Key"), this, SLOT(newItem())); menu->addAction(tr("Import"), this, SLOT(load())); if (index != QModelIndex()) { menu->addAction(tr("Rename"), this, SLOT(edit())); menu->addAction(tr("Show Details"), this, SLOT(showItem())); menu->addAction(tr("Delete"), this, SLOT(delete_ask())); menu->addAction(tr("Export"), this, SLOT(store())); if (key->isPrivKey() && !key->isToken()) { switch (key->getOwnPass()) { case pki_key::ptCommon: menu->addAction(tr("Change password"), this, SLOT(setOwnPass())); break; case pki_key::ptPrivate: menu->addAction(tr("Reset password"), this, SLOT(resetOwnPass())); break; } } if (key->isToken() && pkcs11::loaded()) { menu->addAction(tr("Change PIN"), this, SLOT(changePin())); menu->addAction(tr("Init PIN with SO PIN (PUK)"), this, SLOT(initPin())); menu->addAction(tr("Change SO PIN (PUK)"), this, SLOT(changeSoPin())); } if (!key->isToken() && pkcs11::loaded()) { menu->addAction(tr("Store on Security token"), this, SLOT(toToken())); } } contextMenu(e, menu); currentIdx = QModelIndex(); return; }
import->addAction(tr("PKCS#12"), certView, SLOT(loadPKCS12()) ); import->addAction(tr("PKCS#7"), certView, SLOT(loadPKCS7()) ); import->addAction(tr("Template"), tempView, SLOT(load()) ); import->addAction(tr("Revocation list"), crlView, SLOT(load())); import->addAction(tr("PEM file"), this, SLOT(loadPem()) ); import->addAction(tr("Paste PEM file"), this, SLOT(pastePem())); token = menuBar()->addMenu(tr("&Token")); token->addAction(tr("&Manage Security token"), this, SLOT(manageToken())); token->addAction(tr("&Init Security token"), this, SLOT(initToken())); token->addAction(tr("&Change PIN"), this, SLOT(changePin()) ); token->addAction(tr("Change &SO PIN"), this, SLOT(changeSoPin()) ); token->addAction(tr("Init PIN"), this, SLOT(initPin()) ); extra = menuBar()->addMenu(tr("Extra")); acList += extra->addAction(tr("&Dump DataBase"), this, SLOT(dump_database())); acList += extra->addAction(tr("&Export Certificate Index"), this, SLOT(exportIndex())); acList += extra->addAction(tr("&Export Certificate Index hierarchy"), this, SLOT(exportIndexHierarchy())); acList += extra->addAction(tr("C&hange DataBase password"), this, SLOT(changeDbPass())); #if 0 acList += extra->addAction(tr("&Undelete items"), this, SLOT(undelete()));
void MainWindow::init_menu() { QMenu *file, *help, *import, *token; file = menuBar()->addMenu(tr("&File")); file->addAction(tr("&New DataBase"), this, SLOT(new_database()), QKeySequence::New); file->addAction(tr("&Open DataBase"), this, SLOT(load_database()), QKeySequence::Open); file->addAction(tr("Generate DH parameter"), this, SLOT(generateDHparam())); acList += file->addAction(tr("&Close DataBase"), this, SLOT(close_database()), QKeySequence(QKeySequence::Close)); acList += file->addAction(tr("&Dump DataBase"), this, SLOT(dump_database())); acList += file->addAction(tr("C&hange DataBase password"), this, SLOT(changeDbPass())); acList += file->addAction(tr("&Import old db_dump"), this, SLOT(import_dbdump())); acList += file->addAction(tr("&Undelete items"), this, SLOT(undelete())); file->addSeparator(); acList += file->addAction(tr("Options"), this, SLOT(setOptions())); file->addSeparator(); file->addAction(tr("Exit"), qApp, SLOT(quit()), Qt::ALT+Qt::Key_F4); import = menuBar()->addMenu(tr("I&mport")); import->addAction(tr("Keys"), this, SLOT(on_BNimportKey_clicked()) ); import->addAction(tr("Requests"), this, SLOT(on_BNimportReq_clicked()) ); import->addAction(tr("Certificates"), this, SLOT(on_BNimportCert_clicked()) ); import->addAction(tr("PKCS#12"), this, SLOT(on_BNimportPKCS12_clicked()) ); import->addAction(tr("PKCS#7"), this, SLOT(on_BNimportPKCS7_clicked()) ); import->addAction(tr("Template"), this, SLOT(on_BNimportTemp_clicked()) ); import->addAction(tr("Revocation list"), this, SLOT(on_BNimportCrl_clicked()) ); import->addAction(tr("PEM file"), this, SLOT(loadPem()) ); import->addAction(tr("paste PEM file"), this, SLOT(pastePem()) ); token = menuBar()->addMenu(tr("&Token")); token->addAction(tr("&Manage Security token"), this, SLOT(manageToken())); token->addAction(tr("&Init Security token"), this, SLOT(initToken())); token->addAction(tr("&Change PIN"), this, SLOT(changePin()) ); token->addAction(tr("Change &SO PIN"), this, SLOT(changeSoPin()) ); token->addAction(tr("Init PIN"), this, SLOT(initPin()) ); help = menuBar()->addMenu(tr("&Help") ); help->addAction(tr("&Content"), this, SLOT(help()), QKeySequence::HelpContents); help->addAction(tr("&About"), this, SLOT(about()) ); help->addAction(tr("Donations"), this, SLOT(donations()) ); wdList += import; scardList += token; }