From bed1212dcb8de39657b43e31addd5b55ad41cc8a Mon Sep 17 00:00:00 2001 From: nils Date: Sat, 7 Jan 2012 23:12:49 +0000 Subject: fixed bug in file cryption git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@728 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- fileencryptiondialog.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'fileencryptiondialog.cpp') diff --git a/fileencryptiondialog.cpp b/fileencryptiondialog.cpp index 82ce6a2..69ea7c9 100755 --- a/fileencryptiondialog.cpp +++ b/fileencryptiondialog.cpp @@ -25,10 +25,11 @@ FileEncryptionDialog::FileEncryptionDialog(GpgME::GpgContext *ctx, QString iconP : QDialog(parent) { + mAction = action; mCtx = ctx; - if(action == Decrypt) { + if(mAction == Decrypt) { setWindowTitle(tr("Decrypt File")); - } else if (action == Encrypt) { + } else if (mAction == Encrypt) { setWindowTitle(tr("Encrypt File")); resize(500, 300); } else { @@ -118,7 +119,7 @@ void FileEncryptionDialog::selectInputFile() // try to find a matching output-filename, if not yet done if (infileName > 0 && outputFileEdit->text().size() == 0) { - if (radioEnc->isChecked()) { + if (mAction == Encrypt || (mAction == Both && radioEnc->isChecked())) { outputFileEdit->setText(infileName + ".asc"); } else { if (infileName.endsWith(".asc", Qt::CaseInsensitive)) { @@ -156,11 +157,12 @@ void FileEncryptionDialog::executeAction() QByteArray inBuffer = infile.readAll(); QByteArray *outBuffer = new QByteArray(); - if (radioEnc->isChecked()) { + + if ( mAction == Encrypt || (mAction == Both && radioEnc->isChecked())) { if (! mCtx->encrypt(mKeyList->getChecked(), inBuffer, outBuffer)) return; } - if (radioDec->isChecked()) { + if (mAction == Decrypt || (mAction == Both && radioDec->isChecked())) { if (! mCtx->decrypt(inBuffer, outBuffer)) return; } -- cgit v1.2.3