Exemplo n.º 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;
}
Exemplo n.º 2
0
void ReqTreeView::fillContextMenu(QMenu *menu, QMenu *subExport,
		const QModelIndex &index, QModelIndexList indexes)
{
	X509SuperTreeView::fillContextMenu(menu, subExport, index, indexes);

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

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

	menu->addAction(tr("Sign"), this, SLOT(signReq()));
	if (req->getDone())
		menu->addAction(tr("Unmark signed"),
				this, SLOT(unmarkSigned()));
	else
		menu->addAction(tr("Mark signed"),
				this, SLOT(markSigned()));
	if (transform) {
		transform->addAction(tr("Similar Request"), this,
				SLOT(toRequest()));
	}
}