aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/FileEncryptionDialog.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-07-06 18:39:27 +0000
committerSaturneric <[email protected]>2021-07-06 18:39:27 +0000
commitf74d788604f1a5d4579cb154d93dcb96e33a6c78 (patch)
tree3b441177b5f7d68295f4b9d7bbef09103397b0c7 /src/ui/FileEncryptionDialog.cpp
parentMerge branch 'develop' into main (diff)
parentFix issues. (diff)
downloadGpgFrontend-f74d788604f1a5d4579cb154d93dcb96e33a6c78.tar.gz
GpgFrontend-f74d788604f1a5d4579cb154d93dcb96e33a6c78.zip
Merge branch 'develop' into main
# Conflicts: # README_CN.md
Diffstat (limited to 'src/ui/FileEncryptionDialog.cpp')
-rwxr-xr-xsrc/ui/FileEncryptionDialog.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/ui/FileEncryptionDialog.cpp b/src/ui/FileEncryptionDialog.cpp
index 9cb7b00a..e92dfc90 100755
--- a/src/ui/FileEncryptionDialog.cpp
+++ b/src/ui/FileEncryptionDialog.cpp
@@ -203,27 +203,50 @@ void FileEncryptionDialog::slotExecuteAction() {
QVector<GpgKey> keys;
mKeyList->getCheckedKeys(keys);
+ qDebug() << "slotExecuteAction" << mAction;
+
if (mAction == Encrypt) {
- if (!mCtx->encrypt(keys, inBuffer, outBuffer, nullptr)) return;
+ qDebug() << "Action Encrypt";
+ gpgme_error_t err = mCtx->encrypt(keys, inBuffer, outBuffer, nullptr);
+ if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) {
+ qDebug() << "Error" << gpgme_strerror(err);
+ QMessageBox::warning(this, tr("Error"),
+ tr("Error Occurred During Encryption"));
+ return;
+ }
}
if (mAction == Decrypt) {
- if (!mCtx->decrypt(inBuffer, outBuffer, nullptr)) return;
+ qDebug() << "Action Decrypt";
+ gpgme_error_t err = mCtx->decrypt(inBuffer, outBuffer, nullptr);
+ if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) {
+ qDebug() << "Error" << gpgme_strerror(err);
+ QMessageBox::warning(this, tr("Error"),
+ tr("Error Occurred During Decryption"));
+ return;
+ }
}
if (mAction == Sign) {
- if (gpgme_err_code(mCtx->sign(keys, inBuffer, outBuffer, true)) != GPG_ERR_NO_ERROR) return;
+ qDebug() << "Action Sign";
+ gpgme_error_t err = mCtx->sign(keys, inBuffer, outBuffer, true);
+ if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) {
+ qDebug() << "Error" << gpgme_strerror(err);
+ QMessageBox::warning(this, tr("Error"),
+ tr("Error Occurred During Signature"));
+ return;
+ }
}
if (mAction == Verify) {
- QFile signfile;
- signfile.setFileName(signFileEdit->text());
- if (!signfile.open(QIODevice::ReadOnly)) {
+ QFile sign_file;
+ sign_file.setFileName(signFileEdit->text());
+ if (!sign_file.open(QIODevice::ReadOnly)) {
statusLabel->setText(tr("Couldn't open file"));
signFileEdit->setStyleSheet("QLineEdit { background: yellow }");
return;
}
- auto signBuffer = signfile.readAll();
+ auto signBuffer = sign_file.readAll();
gpgme_verify_result_t result;
auto error = mCtx->verify(&inBuffer, &signBuffer, &result);
new VerifyDetailsDialog(this, mCtx, mKeyList, error, result);