From 6dd965df7ec9c33d508b24b08b4181a5ebfb46ae Mon Sep 17 00:00:00 2001 From: nils Date: Tue, 23 Aug 2011 18:50:24 +0000 Subject: show appropriate filename in key export to file git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@519 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- TODO | 2 +- gpgwin.cpp | 4 ---- keydetailsdialog.cpp | 8 +++----- keymgmt.cpp | 5 ++++- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 41d3f5e..a8acf12 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,7 @@ TODO: ----- Release 0.3.1 -- export key: default filename to .asc +- export key: default filename to .asc [DONE] - make email adress from keylist copyable [DONE] - show keydetails-dialog in keylist on mainwindow [DONE] - key should blink short in keylist after import diff --git a/gpgwin.cpp b/gpgwin.cpp index ab8efd1..3b0642b 100644 --- a/gpgwin.cpp +++ b/gpgwin.cpp @@ -851,20 +851,16 @@ void GpgWin::importKeyDialog() void GpgWin::appendSelectedKeys() { QByteArray *keyArray = new QByteArray(); - mCtx->exportKeys(mKeyList->getSelected(), keyArray); edit->curTextPage()->appendPlainText(*keyArray); } void GpgWin::copyMailAddressToClipboard() { - gpgme_key_t key = mCtx->getKeyDetails(mKeyList->getSelected()->first()); QClipboard *cb = QApplication::clipboard(); - mCtx->importKey(cb->text(QClipboard::Clipboard).toAscii()); QString mail = key->uids->email; cb->setText(mail); - //edit->curTextPage()->appendPlainText(*keyArray); } void GpgWin::showKeyDetails() diff --git a/keydetailsdialog.cpp b/keydetailsdialog.cpp index 51c472d..4d5bcdc 100644 --- a/keydetailsdialog.cpp +++ b/keydetailsdialog.cpp @@ -134,7 +134,6 @@ KeyDetailsDialog::KeyDetailsDialog(GpgME::Context* ctx, gpgme_key_t key) void KeyDetailsDialog::exportPrivateKey() { - int ret = QMessageBox::information(this, tr("Exporting private Key"), tr("You are about to export your private key.\n" "This is NOT your public key, so don't give it away.\n" @@ -142,11 +141,11 @@ void KeyDetailsDialog::exportPrivateKey() QMessageBox::Cancel | QMessageBox::Ok); if (ret == QMessageBox::Ok) { - QByteArray *keyArray = new QByteArray(); mCtx->exportSecretKey(*keyid, keyArray); - - QString fileName = QFileDialog::getSaveFileName(this, tr("Export Key To File"), "", tr("Key Files ") + " (*.asc *.txt);;All Files (*)"); + gpgme_key_t key = mCtx->getKeyDetails(*keyid); + QString fileString = QString(key->uids->name) + " " + QString(key->uids->email) + "(" + QString(key->subkeys->keyid)+ ")_pub_sec.asc"; + QString fileName = QFileDialog::getSaveFileName(this, tr("Export Key To File"), fileString, tr("Key Files") + " (*.asc *.txt);;All Files (*)"); QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return; @@ -155,7 +154,6 @@ void KeyDetailsDialog::exportPrivateKey() file.close(); delete keyArray; } - } QString KeyDetailsDialog::beautifyFingerprint(QString fingerprint) diff --git a/keymgmt.cpp b/keymgmt.cpp index 73f2282..4814c5a 100755 --- a/keymgmt.cpp +++ b/keymgmt.cpp @@ -226,7 +226,10 @@ void KeyMgmt::exportKeyToFile() if (!mCtx->exportKeys(mKeyList->getChecked(), keyArray)) { return; } - QString fileName = QFileDialog::getSaveFileName(this, tr("Export Key To File"), "", tr("Key Files") + " (*.asc *.txt);;All Files (*)"); + gpgme_key_t key = mCtx->getKeyDetails(mKeyList->getChecked()->first()); + QString fileString = QString(key->uids->name) + " " + QString(key->uids->email) + "(" + QString(key->subkeys->keyid)+ ")_pub.asc"; + + QString fileName = QFileDialog::getSaveFileName(this, tr("Export Key To File"), fileString, tr("Key Files") + " (*.asc *.txt);;All Files (*)"); QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return; -- cgit v1.2.3