mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
Close #391: hide expired and revoked certificates
This commit is contained in:
parent
43f4a814e2
commit
b03076c474
@ -453,7 +453,7 @@ QVariant db_base::data(const QModelIndex &index, int role) const
|
||||
case Qt::BackgroundRole:
|
||||
return item->bg_color(hd);
|
||||
case Qt::UserRole:
|
||||
return item->isVisible();
|
||||
return item->isVisible() != 0 && (!Settings["hide_unusable"] || !item->unusable());
|
||||
case Qt::ToolTipRole:
|
||||
if (hd->id==HD_internal_name || item->isVisible()==1)
|
||||
return item->column_tooltip(hd);
|
||||
|
||||
@ -190,6 +190,10 @@ class pki_base : public QObject
|
||||
virtual QVariant column_tooltip(const dbheader *hd) const;
|
||||
virtual a1time column_a1time(const dbheader *hd) const;
|
||||
virtual bool visible() const;
|
||||
virtual bool unusable() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int isVisible();
|
||||
bool childVisible() const;
|
||||
|
||||
|
||||
@ -1091,6 +1091,11 @@ QVariant pki_x509::getIcon(const dbheader *hd) const
|
||||
return QVariant(QPixmap(icon_names[pixnum]));
|
||||
}
|
||||
|
||||
bool pki_x509::unusable() const
|
||||
{
|
||||
return getNotAfter() < a1time::now() || isRevoked();
|
||||
}
|
||||
|
||||
bool pki_x509::visible() const
|
||||
{
|
||||
if (pki_x509super::visible())
|
||||
|
||||
@ -136,6 +136,7 @@ class pki_x509 : public pki_x509super
|
||||
bool hasExtension(int nid) const;
|
||||
bool cmpIssuerAndSerial(pki_x509 *refcert);
|
||||
bool visible() const;
|
||||
bool unusable() const;
|
||||
void updateView();
|
||||
void print(BioByteArray &b, enum print_opt opt) const;
|
||||
x509v3ext getExtByNid(int nid) const;
|
||||
|
||||
@ -47,6 +47,7 @@ settings::settings()
|
||||
defaul["serial_len"] = "64";
|
||||
defaul["fp_separator"] = ":";
|
||||
defaul["fp_digits"] = "2";
|
||||
defaul["hide_unusable"] = "no";
|
||||
defaul["KeyFormat"] = QString::number(DEFAULT_KEY_CLIPBOARD_TYPE);
|
||||
defaul["CertFormat"] = QString::number(DEFAULT_CERT_CLIPBOARD_TYPE);
|
||||
|
||||
|
||||
@ -31,6 +31,13 @@ void CertTreeView::fillContextMenu(QMenu *menu, QMenu *subExport,
|
||||
|
||||
X509SuperTreeView::fillContextMenu(menu, subExport, index, indexes);
|
||||
|
||||
QAction *a = menu->addAction(tr("Hide unusable certificates"));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(Settings["hide_unusable"]);
|
||||
|
||||
connect(a, SIGNAL(triggered(bool)),
|
||||
this, SLOT(toggleHideExpired(bool)));
|
||||
|
||||
menu->addAction(tr("Import PKCS#12"), this, SLOT(loadPKCS12()));
|
||||
menu->addAction(tr("Import from PKCS#7"), this, SLOT(loadPKCS7()));
|
||||
|
||||
@ -264,3 +271,10 @@ ExportDialog *CertTreeView::exportDialog(const QModelIndexList &indexes)
|
||||
pki_export::select(x509, basemodel->exportFlags(indexes)),
|
||||
"certexport");
|
||||
}
|
||||
|
||||
void CertTreeView::toggleHideExpired(bool hide)
|
||||
{
|
||||
qDebug() << "Hide expired certificates" << hide;
|
||||
Settings["hide_unusable"] = hide;
|
||||
columnsChanged();
|
||||
}
|
||||
@ -47,5 +47,6 @@ class CertTreeView: public X509SuperTreeView
|
||||
void unRevoke();
|
||||
void load();
|
||||
void loadTaKey();
|
||||
void toggleHideExpired(bool);
|
||||
};
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user