diff options
author | Nils Achtergarde <[email protected]> | 2017-12-30 22:37:03 +0000 |
---|---|---|
committer | Nils Achtergarde <[email protected]> | 2017-12-30 22:37:03 +0000 |
commit | ad684b035257e175295e1e93f0fa4e8d3edf87b1 (patch) | |
tree | f3992d59f75a8fa4713b2593f5525ae3888c64a6 /fileencryptiondialog.cpp | |
parent | recommit of a3cba1ba9996400acc43d133f8941fef84dd323f (add gui elements for si... (diff) | |
download | gpg4usb-ad684b035257e175295e1e93f0fa4e8d3edf87b1.tar.gz gpg4usb-ad684b035257e175295e1e93f0fa4e8d3edf87b1.zip |
recommit of a772d1426463d5f4913b5252530b81d1d2cca7dd (remove obsolete EncryptAndDecrypt logic from filemenu)
Diffstat (limited to 'fileencryptiondialog.cpp')
-rwxr-xr-x | fileencryptiondialog.cpp | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/fileencryptiondialog.cpp b/fileencryptiondialog.cpp index b5f5899..787217d 100755 --- a/fileencryptiondialog.cpp +++ b/fileencryptiondialog.cpp @@ -21,8 +21,8 @@ #include "fileencryptiondialog.h" -FileEncryptionDialog::FileEncryptionDialog(GpgME::GpgContext *ctx, QStringList keyList, QWidget *parent, DialogAction action) - : QDialog(parent) +FileEncryptionDialog::FileEncryptionDialog(GpgME::GpgContext *ctx, QStringList keyList, DialogAction action, QWidget *parent) + : QDialog(parent) { mAction = action; @@ -37,9 +37,6 @@ FileEncryptionDialog::FileEncryptionDialog(GpgME::GpgContext *ctx, QStringList k resize(500, 300); } else if (mAction == Verify) { setWindowTitle(tr("Verify File")); - } else { - setWindowTitle(tr("Encrypt / Decrypt File")); - resize(500, 200); } setModal(true); @@ -49,7 +46,6 @@ FileEncryptionDialog::FileEncryptionDialog(GpgME::GpgContext *ctx, QStringList k connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); QGroupBox *groupBox1 = new QGroupBox(tr("File")); - QGroupBox *actionGroupBox = new QGroupBox(tr("Action")); /* Setup input & Outputfileselection*/ inputFileEdit = new QLineEdit(); @@ -71,6 +67,7 @@ FileEncryptionDialog::FileEncryptionDialog(GpgME::GpgContext *ctx, QStringList k gLayout->addWidget(fl2, 1, 0); gLayout->addWidget(outputFileEdit, 1, 1); gLayout->addWidget(fb2, 1, 2); + groupBox1->setLayout(gLayout); /*Setup KeyList*/ mKeyList = new KeyList(mCtx); @@ -79,24 +76,7 @@ FileEncryptionDialog::FileEncryptionDialog(GpgME::GpgContext *ctx, QStringList k mKeyList->setColumnWidth(3, 150); mKeyList->setChecked(&keyList); - /* Setup Action */ - radioEnc = new QRadioButton(tr("&Encrypt")); - connect(radioEnc, SIGNAL(clicked()), this, SLOT(slotShowKeyList())); - radioDec = new QRadioButton(tr("&Decrypt")); - connect(radioDec, SIGNAL(clicked()), this, SLOT(slotHideKeyList())); - radioDec->setChecked(true); - - QHBoxLayout *hbox1 = new QHBoxLayout(); - hbox1->addWidget(radioDec); - hbox1->addWidget(radioEnc); - - groupBox1->setLayout(gLayout); - actionGroupBox->setLayout(hbox1); - QVBoxLayout *vbox2 = new QVBoxLayout(); - if(action == EncryptAndDecrypt) { - vbox2->addWidget(actionGroupBox); - } vbox2->addWidget(groupBox1); vbox2->addWidget(mKeyList); vbox2->addWidget(buttonBox); @@ -123,7 +103,7 @@ void FileEncryptionDialog::slotSelectInputFile() // try to find a matching output-filename, if not yet done if (infileName > 0 && outputFileEdit->text().size() == 0) { - if (mAction == Encrypt || (mAction == EncryptAndDecrypt && radioEnc->isChecked())) { + if (mAction == Encrypt) { outputFileEdit->setText(infileName + ".asc"); } else { if (infileName.endsWith(".asc", Qt::CaseInsensitive)) { @@ -161,11 +141,11 @@ void FileEncryptionDialog::slotExecuteAction() QByteArray inBuffer = infile.readAll(); QByteArray *outBuffer = new QByteArray(); infile.close(); - if ( mAction == Encrypt || (mAction == EncryptAndDecrypt && radioEnc->isChecked())) { + if ( mAction == Encrypt ) { if (! mCtx->encrypt(mKeyList->getChecked(), inBuffer, outBuffer)) return; } - if (mAction == Decrypt || (mAction == EncryptAndDecrypt && radioDec->isChecked())) { + if ( mAction == Decrypt ) { if (! mCtx->decrypt(inBuffer, outBuffer)) return; } |