Пример #1
0
void db_x509req::showContextMenu(QContextMenuEvent *e, const QModelIndex &index)
{
	QMenu *menu = new QMenu(mainwin);
	QMenu *subExport;
	currentIdx = index;

	pki_x509req *req = static_cast<pki_x509req*>(index.internalPointer());

	menu->addAction(tr("New Request"), this, SLOT(newItem()));
	menu->addAction(tr("Import"), this, SLOT(load()));
	if (index != QModelIndex()) {
		if (!req->getRefKey())
			menu->addAction(tr("Extract public Key"),
				this, SLOT(extractPubkey()));
		menu->addAction(tr("Rename"), this, SLOT(edit()));
		menu->addAction(tr("Show Details"), this, SLOT(showItem()));
		menu->addAction(tr("Sign"), this, SLOT(signReq()));
		subExport = menu->addMenu(tr("Export"));
		subExport->addAction(tr("Clipboard"), this,
					SLOT(pem2clipboard()));
		subExport->addAction(tr("File"), this, SLOT(store()));
		subExport->addAction(tr("Template"), this, SLOT(toTemplate()));
		subExport->addAction(tr("OpenSSL config"), this,
					SLOT(toOpenssl()));
		menu->addAction(tr("Delete"), this, SLOT(delete_ask()));

		subExport->setEnabled(!req->isSpki());
	}
	contextMenu(e, menu);
	currentIdx = QModelIndex();
	return;
}
Пример #2
0
void X509SuperTreeView::fillContextMenu(QMenu *menu, QMenu *subExport,
		const QModelIndex &index, QModelIndexList indexes)
{
	pki_x509super *x = static_cast<pki_x509super *>
				(index.internalPointer());
	transform = NULL;

	if (indexes.size() != 1)
		return;

	subExport->addAction(tr("OpenSSL config"), this, SLOT(toOpenssl()));
	subExport->setEnabled(!x->isSpki());
	transform = menu->addMenu(tr("Transform"));
	transform->addAction(tr("Template"), this,
		SLOT(toTemplate()))->setEnabled(!x->isSpki());
	transform->addAction(tr("Public Key"), this,
		SLOT(extractPubkey()))->setEnabled(!x->getRefKey());
}