xca/widgets/X509SuperTreeView.cpp
Christian Hohnstaedt ff7704ff0b Add context sensitive documentation
All dialogs get the "Qt::WindowModal" modality to
operate the Help window in parallel
while also blocking the dialog parent windows.

The manageRevocations() moved from model to view

The Details dialogs become more self-sufficient.
There is a statc start method that shows the dialog and
updates name and comment after accept().
This allows recursive starts of certificate details and
independence of mainwin.
It is necessary to set the current toplevel widget as parent
for the next dialog to not block the application.
2021-04-23 15:50:13 +02:00

65 lines
1.4 KiB
C++

/* vi: set sw=4 ts=4:
*
* Copyright (C) 2015 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include "lib/db_x509super.h"
#include "lib/database_model.h"
#include "X509SuperTreeView.h"
#include "CertDetail.h"
#include "MainWindow.h"
#include <QAbstractItemModel>
#include <QAbstractItemView>
#include <QMenu>
void X509SuperTreeView::fillContextMenu(QMenu *menu, QMenu *subExport,
const QModelIndex &index, QModelIndexList indexes)
{
pki_x509super *x = dynamic_cast<pki_x509super*>(
db_base::fromIndex(index));
transform = NULL;
if (indexes.size() != 1 || !x)
return;
subExport->addAction(tr("OpenSSL config"), this, SLOT(toOpenssl()));
transform = menu->addMenu(tr("Transform"));
transform->addAction(tr("Template"), this, SLOT(toTemplate()));
transform->addAction(tr("Public key"), this,
SLOT(extractPubkey()))->setEnabled(!x->getRefKey());
}
void X509SuperTreeView::extractPubkey()
{
QModelIndex idx = currentIndex();
if (idx.isValid() && basemodel)
x509super()->extractPubkey(idx);
}
void X509SuperTreeView::toTemplate()
{
QModelIndex idx = currentIndex();
if (idx.isValid() && basemodel)
x509super()->toTemplate(idx);
}
void X509SuperTreeView::toOpenssl()
{
QModelIndex idx = currentIndex();
if (idx.isValid() && basemodel)
x509super()->toOpenssl(idx);
}
void X509SuperTreeView::showPki(pki_base *pki)
{
pki_x509super *x = dynamic_cast<pki_x509super *>(pki);
CertDetail::showCert(this, x);
}