diff options
-rw-r--r-- | context.cpp | 8 | ||||
-rw-r--r-- | keydetailsdialog.cpp | 18 | ||||
-rwxr-xr-x | keymgmt.cpp | 1 |
3 files changed, 23 insertions, 4 deletions
diff --git a/context.cpp b/context.cpp index b6a781e..cf1f64e 100644 --- a/context.cpp +++ b/context.cpp @@ -153,7 +153,13 @@ gpgme_key_t Context::getKeyDetails(QString uid) { gpgme_key_t key; - gpgme_get_key (mCtx, uid.toAscii().constData(), &key, 0); + // try secret + gpgme_get_key (mCtx, uid.toAscii().constData(), &key, 1); + // ok, its a public key + if(!key) { + gpgme_get_key (mCtx, uid.toAscii().constData(), &key, 0); + } + return key; } diff --git a/keydetailsdialog.cpp b/keydetailsdialog.cpp index 0cd90a7..6fbcc98 100644 --- a/keydetailsdialog.cpp +++ b/keydetailsdialog.cpp @@ -20,6 +20,7 @@ */ #include "keydetailsdialog.h" +#include "QPushButton" #include "QDebug" KeyDetailsDialog::KeyDetailsDialog(gpgme_key_t key) { @@ -111,13 +112,24 @@ KeyDetailsDialog::KeyDetailsDialog(gpgme_key_t key) { fingerprintBox->setLayout(vboxFP); mvbox->addWidget(fingerprintBox); + if(key->secret) { + QGroupBox *privKeyBox = new QGroupBox(tr("Private Key")); + QVBoxLayout *vboxPK = new QVBoxLayout(); + + QPushButton *exportButton = new QPushButton(tr("Export Private Key")); + vboxPK->addWidget(exportButton); + + privKeyBox->setLayout(vboxPK); + mvbox->addWidget(privKeyBox); + } + mvbox->addWidget(buttonBox); this->setLayout(mvbox); this->setWindowTitle(tr("Keydatails")); this->show(); - -/* qDebug() << "is secret: " << key ->secret; +/* + qDebug() << "is secret: " << key ->secret; qDebug() << "can encrypt: " <<key ->can_encrypt; qDebug() << "can sign: " <<key ->can_sign; qDebug() << "can encrypt: " <<key ->can_encrypt; @@ -133,7 +145,7 @@ KeyDetailsDialog::KeyDetailsDialog(gpgme_key_t key) { } else { qDebug() << "no second key"; } -*/ +*/ exec(); } diff --git a/keymgmt.cpp b/keymgmt.cpp index ad12df9..3130a4a 100755 --- a/keymgmt.cpp +++ b/keymgmt.cpp @@ -175,6 +175,7 @@ void KeyMgmt::showKeyDetails() { // TODO: first...? gpgme_key_t key = mCtx->getKeyDetails(mKeyList->getSelected()->first()); + new KeyDetailsDialog(key); } |