aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowSlotFunction.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-08-12 12:51:12 +0000
committerSaturneric <[email protected]>2021-08-12 12:51:12 +0000
commit0c6c1f9bddbbafa7786f438b073112e22c1fdc19 (patch)
tree82d94b6a4cfd6601b5c7bf68b5814fb1f957a2ed /src/ui/main_window/MainWindowSlotFunction.cpp
parentBeautify UI (diff)
downloadGpgFrontend-0c6c1f9bddbbafa7786f438b073112e22c1fdc19.tar.gz
GpgFrontend-0c6c1f9bddbbafa7786f438b073112e22c1fdc19.zip
Beautify UI; Improve Functions;
Diffstat (limited to '')
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 7c35725f..ac998f3d 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -179,6 +179,11 @@ void MainWindow::slotDecrypt() {
QByteArray text = edit->curTextPage()->toPlainText().toUtf8();
GpgME::GpgContext::preventNoDataErr(&text);
+ if (text.trimmed().startsWith(GpgConstants::GPG_FRONTEND_SHORT_CRYPTO_HEAD)) {
+ QMessageBox::critical(this, tr("Notice"), tr("Short Crypto Text only supports Decrypt & Verify."));
+ return;
+ }
+
gpgme_decrypt_result_t result = nullptr;
gpgme_error_t error;
@@ -328,8 +333,6 @@ void MainWindow::slotEncryptSign() {
gpgme_encrypt_result_t encr_result = nullptr;
gpgme_sign_result_t sign_result = nullptr;
- gpgme_decrypt_result_t result = nullptr;
-
gpgme_error_t error;
auto thread = QThread::create([&]() {
error = mCtx->encryptSign(keys, edit->curTextPage()->toPlainText().toUtf8(), tmp, &encr_result,
@@ -403,7 +406,7 @@ void MainWindow::slotDecryptVerify() {
QString plainText = edit->curTextPage()->toPlainText();
- if (plainText.trimmed().startsWith("[GpgFrontend_ShortCrypto]://")) {
+ if (plainText.trimmed().startsWith(GpgConstants::GPG_FRONTEND_SHORT_CRYPTO_HEAD)) {
auto cryptoText = getCryptText(plainText);
if (!cryptoText.isEmpty()) {
plainText = cryptoText;