MCPcopy Create free account
hub / github.com/chris2511/xca / fillContextMenu

Method fillContextMenu

widgets/KeyTreeView.cpp:19–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include <QMenu>
18
19void KeyTreeView::fillContextMenu(QMenu *menu, QMenu *subExport,
20 const QModelIndex &index, QModelIndexList indexes)
21{
22 bool multi = indexes.size() > 1;
23
24 pki_key *key = db_base::fromIndex<pki_key>(index);
25 if (indexes.size() == 0 || !key)
26 return;
27
28 if (!multi && key && key->isPrivKey() && !key->isToken()) {
29 switch (key->getOwnPass()) {
30 case pki_key::ptCommon:
31 menu->addAction(tr("Change password"), this,
32 SLOT(setOwnPass()));
33 break;
34 case pki_key::ptPrivate:
35 menu->addAction(tr("Reset password"), this,
36 SLOT(resetOwnPass()));
37 break;
38 default:
39 break;
40 }
41 }
42
43 if (!pkcs11::libraries.loaded() || multi)
44 return;
45
46 if (key->isToken()) {
47 menu->addAction(tr("Change PIN"), this,
48 SLOT(changePin()));
49 menu->addAction(tr("Init PIN with SO PIN (PUK)"), this,
50 SLOT(initPin()));
51 menu->addAction(tr("Change SO PIN (PUK)"), this,
52 SLOT(changeSoPin()));
53 } else if (subExport) {
54 subExport->addAction(tr("Security token"),
55 this, SLOT(toToken()));
56 }
57}
58
59void KeyTreeView::setOwnPass()
60{

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.80
isPrivKeyMethod · 0.80
getOwnPassMethod · 0.80
loadedMethod · 0.80
isTokenMethod · 0.45

Tested by

no test coverage detected