From cdaee767e93430a3495a2140ad6f81698d3458ba Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 6 Jul 2021 10:56:19 +0800 Subject: Fix issues. Improve UI. --- src/ui/main_window/MainWindowSlotFunction.cpp | 265 +++++++++++++++----------- 1 file changed, 152 insertions(+), 113 deletions(-) (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp') diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 36d8f363..21d0af0d 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -61,9 +61,9 @@ void MainWindow::slotEncrypt() { thread->start(); - WaitingDialog *dialog = new WaitingDialog(this); + auto *dialog = new WaitingDialog(tr("Encrypting"), this); - while(thread->isRunning()) { + while (thread->isRunning()) { QApplication::processEvents(); } @@ -118,7 +118,18 @@ void MainWindow::slotSign() { gpgme_sign_result_t result = nullptr; - auto error = mCtx->sign(keys, edit->curTextPage()->toPlainText().toUtf8(), tmp, false, &result); + gpgme_error_t error; + auto thread = QThread::create([&]() { + error = mCtx->sign(keys, edit->curTextPage()->toPlainText().toUtf8(), tmp, false, &result); + }); + thread->start(); + + auto *dialog = new WaitingDialog(tr("Signing"), this); + while (thread->isRunning()) { + QApplication::processEvents(); + } + dialog->close(); + infoBoard->associateTextEdit(edit->curTextPage()); edit->slotFillTextEditWithText(QString::fromUtf8(*tmp)); @@ -156,8 +167,8 @@ void MainWindow::slotDecrypt() { }); thread->start(); - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { + auto *dialog = new WaitingDialog(tr("Decrypting"), this); + while (thread->isRunning()) { QApplication::processEvents(); } @@ -215,11 +226,10 @@ void MainWindow::slotVerify() { }); thread->start(); - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { + auto *dialog = new WaitingDialog(tr("Verifying"), this); + while (thread->isRunning()) { QApplication::processEvents(); } - dialog->close(); auto resultAnalyse = new VerifyResultAnalyse(mCtx, error, result); @@ -268,27 +278,27 @@ void MainWindow::slotEncryptSign() { if (!key_can_sign && !key_can_encr) { QMessageBox::critical(nullptr, - tr("Invalid KeyPair"), - tr("The selected keypair cannot be used for signing and encryption at the same time.
") - + tr("
For example the Following Key:
") + key.uids.first().uid); + tr("Invalid KeyPair"), + tr("The selected keypair cannot be used for signing and encryption at the same time.
") + + tr("
For example the Following Key:
") + key.uids.first().uid); return; } - if(key_can_sign) can_sign = true; - if(key_can_encr) can_encr = true; + if (key_can_sign) can_sign = true; + if (key_can_encr) can_encr = true; } - if(!can_encr) { - QMessageBox::critical(nullptr, - tr("Incomplete Operation"), - tr("None of the selected key pairs can provide the encryption function.")); - return; + if (!can_encr) { + QMessageBox::critical(nullptr, + tr("Incomplete Operation"), + tr("None of the selected key pairs can provide the encryption function.")); + return; } - if(!can_sign) { - QMessageBox::warning(nullptr, - tr("Incomplete Operation"), - tr("None of the selected key pairs can provide the signature function.")); + if (!can_sign) { + QMessageBox::warning(nullptr, + tr("Incomplete Operation"), + tr("None of the selected key pairs can provide the signature function.")); } auto *tmp = new QByteArray(); @@ -300,18 +310,18 @@ void MainWindow::slotEncryptSign() { gpgme_error_t error; auto thread = QThread::create([&]() { error = mCtx->encryptSign(keys, edit->curTextPage()->toPlainText().toUtf8(), tmp, &encr_result, - &sign_result); + &sign_result); }); thread->start(); - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { + auto *dialog = new WaitingDialog(tr("Encrypting and Signing"), this); + while (thread->isRunning()) { QApplication::processEvents(); } dialog->close(); - if(gpgme_err_code(error) == GPG_ERR_NO_ERROR) { + if (gpgme_err_code(error) == GPG_ERR_NO_ERROR) { auto *tmp2 = new QString(*tmp); edit->slotFillTextEditWithText(*tmp2); } @@ -356,8 +366,8 @@ void MainWindow::slotDecryptVerify() { }); thread->start(); - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { + WaitingDialog *dialog = new WaitingDialog(tr("Decrypting and Verifying"), this); + while (thread->isRunning()) { QApplication::processEvents(); } @@ -495,22 +505,26 @@ void MainWindow::slotFileEncrypt() { } } - try { - gpgme_encrypt_result_t result; + gpgme_encrypt_result_t result; - gpgme_error_t error; - auto thread = QThread::create([&]() { + gpgme_error_t error; + bool if_error = false; + auto thread = QThread::create([&]() { + try { error = GpgFileOpera::encryptFile(mCtx, keys, path, &result); - }); - thread->start(); - - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { - QApplication::processEvents(); + } catch (const std::runtime_error &e) { + if_error = true; } + }); + thread->start(); - dialog->close(); + auto *dialog = new WaitingDialog(tr("Encrypting"), this); + while (thread->isRunning()) { + QApplication::processEvents(); + } + dialog->close(); + if(!if_error) { auto resultAnalyse = new EncryptResultAnalyse(error, result); auto &reportText = resultAnalyse->getResultReport(); infoBoard->associateTabWidget(edit->tabWidget); @@ -526,11 +540,10 @@ void MainWindow::slotFileEncrypt() { delete resultAnalyse; fileTreeView->update(); - - } catch (const std::runtime_error &e) { + } else { QMessageBox::critical(this, tr("Error"), tr("An error occurred during operation.")); + return; } - } void MainWindow::slotFileDecrypt() { @@ -572,21 +585,27 @@ void MainWindow::slotFileDecrypt() { return; } - try { - gpgme_decrypt_result_t result; - gpgme_error_t error; - auto thread = QThread::create([&]() { - error = GpgFileOpera::decryptFile(mCtx, path, &result); - }); - thread->start(); + gpgme_decrypt_result_t result; + gpgme_error_t error; + bool if_error = false; - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { - QApplication::processEvents(); + auto thread = QThread::create([&]() { + try { + error = GpgFileOpera::decryptFile(mCtx, path, &result); + } catch (const std::runtime_error &e) { + if_error = true; } + }); + thread->start(); - dialog->close(); + auto *dialog = new WaitingDialog("Decrypting", this); + while (thread->isRunning()) { + QApplication::processEvents(); + } + dialog->close(); + + if(!if_error) { auto resultAnalyse = new DecryptResultAnalyse(mCtx, error, result); auto &reportText = resultAnalyse->getResultReport(); infoBoard->associateTabWidget(edit->tabWidget); @@ -602,7 +621,7 @@ void MainWindow::slotFileDecrypt() { delete resultAnalyse; fileTreeView->update(); - } catch (const std::runtime_error &e) { + } else { QMessageBox::critical(this, tr("Error"), tr("An error occurred during operation.")); return; } @@ -661,20 +680,27 @@ void MainWindow::slotFileSign() { } } - try { - gpgme_sign_result_t result; - gpgme_error_t error; - auto thread = QThread::create([&]() { - error = GpgFileOpera::signFile(mCtx, keys, path, &result); - }); - thread->start(); + gpgme_sign_result_t result; + gpgme_error_t error; + bool if_error = false; - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { - QApplication::processEvents(); + auto thread = QThread::create([&]() { + try { + error = GpgFileOpera::signFile(mCtx, keys, path, &result); + } catch (const std::runtime_error &e) { + if_error = true; } + }); + thread->start(); - dialog->close(); + auto *dialog = new WaitingDialog(tr("Signing"), this); + while (thread->isRunning()) { + QApplication::processEvents(); + } + + dialog->close(); + + if(!if_error) { auto resultAnalyse = new SignResultAnalyse(error, result); auto &reportText = resultAnalyse->getResultReport(); @@ -692,8 +718,9 @@ void MainWindow::slotFileSign() { fileTreeView->update(); - } catch (const std::runtime_error &e) { + } else { QMessageBox::critical(this, tr("Error"), tr("An error occurred during operation.")); + return; } fileTreeView->update(); @@ -709,11 +736,10 @@ void MainWindow::slotFileVerify() { QString signFilePath, dataFilePath; - if(fileInfo.suffix() == "gpg") { + if (fileInfo.suffix() == "gpg") { dataFilePath = path; signFilePath = path; - } - else if (fileInfo.suffix() == "sig") { + } else if (fileInfo.suffix() == "sig") { int pos = path.lastIndexOf(QChar('.')); dataFilePath = path.left(pos); signFilePath = path; @@ -743,7 +769,7 @@ void MainWindow::slotFileVerify() { gpgme_error_t error; bool if_error = false; auto thread = QThread::create([&]() { - try{ + try { error = GpgFileOpera::verifyFile(mCtx, dataFilePath, &result); } catch (const std::runtime_error &e) { if_error = true; @@ -751,13 +777,13 @@ void MainWindow::slotFileVerify() { }); thread->start(); - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { + auto *dialog = new WaitingDialog(tr("Verifying"), this); + while (thread->isRunning()) { QApplication::processEvents(); } dialog->close(); - if(!if_error) { + if (!if_error) { auto resultAnalyse = new VerifyResultAnalyse(mCtx, error, result); auto &reportText = resultAnalyse->getResultReport(); infoBoard->associateTabWidget(edit->tabWidget); @@ -832,45 +858,51 @@ void MainWindow::slotFileEncryptSign() { if (!key_can_sign && !key_can_encr) { QMessageBox::critical(nullptr, - tr("Invalid KeyPair"), - tr("The selected keypair cannot be used for signing and encryption at the same time.
") - + tr("
For example the Following Key:
") + key.uids.first().uid); + tr("Invalid KeyPair"), + tr("The selected keypair cannot be used for signing and encryption at the same time.
") + + tr("
For example the Following Key:
") + key.uids.first().uid); return; } - if(key_can_sign) can_sign = true; - if(key_can_encr) can_encr = true; + if (key_can_sign) can_sign = true; + if (key_can_encr) can_encr = true; } - if(!can_encr) { - QMessageBox::critical(nullptr, - tr("Incomplete Operation"), - tr("None of the selected key pairs can provide the encryption function.")); - return; + if (!can_encr) { + QMessageBox::critical(nullptr, + tr("Incomplete Operation"), + tr("None of the selected key pairs can provide the encryption function.")); + return; } - if(!can_sign) { - QMessageBox::warning(nullptr, - tr("Incomplete Operation"), - tr("None of the selected key pairs can provide the signature function.")); + if (!can_sign) { + QMessageBox::warning(nullptr, + tr("Incomplete Operation"), + tr("None of the selected key pairs can provide the signature function.")); } - try { + gpgme_encrypt_result_t encr_result = nullptr; + gpgme_sign_result_t sign_result = nullptr; - gpgme_encrypt_result_t encr_result = nullptr; - gpgme_sign_result_t sign_result = nullptr; + gpgme_error_t error; + bool if_error = false; - gpgme_error_t error; - auto thread = QThread::create([&]() { + auto thread = QThread::create([&]() { + try { error = GpgFileOpera::encryptSignFile(mCtx, keys, path, &encr_result, &sign_result); - }); - thread->start(); - - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { - QApplication::processEvents(); + } catch (const std::runtime_error &e) { + if_error = true; } - dialog->close(); + }); + thread->start(); + + WaitingDialog *dialog = new WaitingDialog(tr("Encrypting and Signing"), this); + while (thread->isRunning()) { + QApplication::processEvents(); + } + dialog->close(); + + if(!if_error) { auto resultAnalyseEncr = new EncryptResultAnalyse(error, encr_result); auto resultAnalyseSign = new SignResultAnalyse(error, sign_result); @@ -891,8 +923,9 @@ void MainWindow::slotFileEncryptSign() { fileTreeView->update(); - } catch (std::runtime_error &e) { + } else { QMessageBox::critical(this, tr("Error"), tr("An error occurred during operation.")); + return; } } @@ -924,22 +957,28 @@ void MainWindow::slotFileDecryptVerify() { outFileName = path + ".out"; } - try { + gpgme_decrypt_result_t d_result = nullptr; + gpgme_verify_result_t v_result = nullptr; - gpgme_decrypt_result_t d_result = nullptr; - gpgme_verify_result_t v_result = nullptr; + gpgme_error_t error; + bool if_error = false; - gpgme_error_t error; - auto thread = QThread::create([&]() { + auto thread = QThread::create([&]() { + try { error = GpgFileOpera::decryptVerifyFile(mCtx, path, &d_result, &v_result); - }); - thread->start(); - - WaitingDialog *dialog = new WaitingDialog(this); - while(thread->isRunning()) { - QApplication::processEvents(); + } catch (const std::runtime_error &e) { + if_error = true; } - dialog->close(); + }); + thread->start(); + + auto *dialog = new WaitingDialog(tr("Decrypting and Verifying"), this); + while (thread->isRunning()) { + QApplication::processEvents(); + } + dialog->close(); + + if(!if_error) { infoBoard->associateFileTreeView(edit->curFilePage()); auto resultAnalyseDecrypt = new DecryptResultAnalyse(mCtx, error, d_result); @@ -964,7 +1003,7 @@ void MainWindow::slotFileDecryptVerify() { delete resultAnalyseVerify; fileTreeView->update(); - } catch (std::runtime_error &e) { + } else { QMessageBox::critical(this, tr("Error"), tr("An error occurred during operation.")); return; } -- cgit v1.2.3 From 4ada913c515cf090c65d9d155aa9880a50501591 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Mon, 12 Jul 2021 17:03:12 +0800 Subject: Project structure adjustment; Project configuration adjustment; Add version detection; UI interface improvements; Introduce JSON processing library; Update Documents; --- src/ui/main_window/MainWindowSlotFunction.cpp | 42 +++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp') diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 21d0af0d..0bddb9b2 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -58,7 +58,7 @@ void MainWindow::slotEncrypt() { auto thread = QThread::create([&]() { error = mCtx->encrypt(keys, edit->curTextPage()->toPlainText().toUtf8(), tmp, &result); }); - + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Encrypting"), this); @@ -122,6 +122,7 @@ void MainWindow::slotSign() { auto thread = QThread::create([&]() { error = mCtx->sign(keys, edit->curTextPage()->toPlainText().toUtf8(), tmp, false, &result); }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Signing"), this); @@ -165,6 +166,7 @@ void MainWindow::slotDecrypt() { // try decrypt, if fail do nothing, especially don't replace text error = mCtx->decrypt(text, decrypted, &result); }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Decrypting"), this); @@ -224,6 +226,7 @@ void MainWindow::slotVerify() { auto thread = QThread::create([&]() { error = mCtx->verify(&text, nullptr, &result); }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Verifying"), this); @@ -312,6 +315,7 @@ void MainWindow::slotEncryptSign() { error = mCtx->encryptSign(keys, edit->curTextPage()->toPlainText().toUtf8(), tmp, &encr_result, &sign_result); }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Encrypting and Signing"), this); @@ -364,6 +368,7 @@ void MainWindow::slotDecryptVerify() { auto thread = QThread::create([&]() { error = mCtx->decryptVerify(text, decrypted, &d_result, &v_result); }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); WaitingDialog *dialog = new WaitingDialog(tr("Decrypting and Verifying"), this); @@ -516,6 +521,7 @@ void MainWindow::slotFileEncrypt() { if_error = true; } }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Encrypting"), this); @@ -524,7 +530,7 @@ void MainWindow::slotFileEncrypt() { } dialog->close(); - if(!if_error) { + if (!if_error) { auto resultAnalyse = new EncryptResultAnalyse(error, result); auto &reportText = resultAnalyse->getResultReport(); infoBoard->associateTabWidget(edit->tabWidget); @@ -596,6 +602,7 @@ void MainWindow::slotFileDecrypt() { if_error = true; } }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog("Decrypting", this); @@ -605,7 +612,7 @@ void MainWindow::slotFileDecrypt() { dialog->close(); - if(!if_error) { + if (!if_error) { auto resultAnalyse = new DecryptResultAnalyse(mCtx, error, result); auto &reportText = resultAnalyse->getResultReport(); infoBoard->associateTabWidget(edit->tabWidget); @@ -691,6 +698,7 @@ void MainWindow::slotFileSign() { if_error = true; } }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Signing"), this); @@ -700,7 +708,7 @@ void MainWindow::slotFileSign() { dialog->close(); - if(!if_error) { + if (!if_error) { auto resultAnalyse = new SignResultAnalyse(error, result); auto &reportText = resultAnalyse->getResultReport(); @@ -775,6 +783,7 @@ void MainWindow::slotFileVerify() { if_error = true; } }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); auto *dialog = new WaitingDialog(tr("Verifying"), this); @@ -894,6 +903,7 @@ void MainWindow::slotFileEncryptSign() { if_error = true; } }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); WaitingDialog *dialog = new WaitingDialog(tr("Encrypting and Signing"), this); @@ -902,7 +912,7 @@ void MainWindow::slotFileEncryptSign() { } dialog->close(); - if(!if_error) { + if (!if_error) { auto resultAnalyseEncr = new EncryptResultAnalyse(error, encr_result); auto resultAnalyseSign = new SignResultAnalyse(error, sign_result); @@ -970,15 +980,17 @@ void MainWindow::slotFileDecryptVerify() { if_error = true; } }); + connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); + auto *dialog = new WaitingDialog(tr("Decrypting and Verifying"), this); while (thread->isRunning()) { QApplication::processEvents(); } dialog->close(); - if(!if_error) { + if (!if_error) { infoBoard->associateFileTreeView(edit->curFilePage()); auto resultAnalyseDecrypt = new DecryptResultAnalyse(mCtx, error, d_result); @@ -1036,3 +1048,21 @@ void MainWindow::slotFileVerifyCustom() { void MainWindow::slotOpenFile(QString &path) { edit->slotOpenFile(path); } + +void MainWindow::slotVersionUpgrade(const QString ¤tVersion, const QString &latestVersion) { + if(currentVersion < latestVersion) { + QMessageBox::warning(this, + tr("Outdated Version"), + tr("This version(%1) is out of date, please update the latest version in time. ").arg( + currentVersion) + + tr("You can download the latest version(%1) on Github Releases Page.
").arg( + latestVersion)); + } else if(currentVersion > latestVersion) { + QMessageBox::warning(this, + tr("Unreleased Version"), + tr("This version(%1) has not been officially released and is not recommended for use in a production environment.
").arg( + currentVersion) + + tr("You can download the latest version(%1) on Github Releases Page.
").arg( + latestVersion)); + } +} -- cgit v1.2.3 From f232098a23c00e6f92570a97777e2f0457c0e48e Mon Sep 17 00:00:00 2001 From: Saturneric Date: Fri, 16 Jul 2021 01:42:56 +0800 Subject: Add send mail function and its settings. --- src/ui/main_window/MainWindowSlotFunction.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp') diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 0bddb9b2..4bb3a02b 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -23,6 +23,7 @@ */ #include "MainWindow.h" +#include "ui/SendMailDialog.h" void MainWindow::slotEncrypt() { @@ -83,6 +84,13 @@ void MainWindow::slotEncrypt() { else infoBoard->slotRefresh(reportText, INFO_ERROR_WARN); + if (resultAnalyse->getStatus() >= 0) { + infoBoard->resetOptionActionsMenu(); + infoBoard->addOptionalAction("Send Mail", [this]() { + new SendMailDialog(this); + }); + } + delete resultAnalyse; } else if (edit->slotCurPageFileTreeView() != nullptr) { this->slotFileEncrypt(); -- cgit v1.2.3 From b951a010548cf052d4de5480abb30163460c5020 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Fri, 16 Jul 2021 18:02:06 +0800 Subject: Improve the function of sending mail; update the version number; --- src/ui/main_window/MainWindowSlotFunction.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp') diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 4bb3a02b..cc8adb6f 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -87,7 +87,13 @@ void MainWindow::slotEncrypt() { if (resultAnalyse->getStatus() >= 0) { infoBoard->resetOptionActionsMenu(); infoBoard->addOptionalAction("Send Mail", [this]() { - new SendMailDialog(this); + if(settings.value("sendMail/enable", false).toBool()) + new SendMailDialog(edit->curTextPage()->toPlainText(), this); + else { + QMessageBox::warning(nullptr, + tr("Function Disabled"), + tr("Please go to the settings interface to enable and configure this function.")); + } }); } -- cgit v1.2.3 From 6169797b283a68a5d9df6c2f420d8dc8eea06781 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Fri, 16 Jul 2021 18:22:45 +0800 Subject: Improve the function of sending mail; --- src/ui/main_window/MainWindowSlotFunction.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp') diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index cc8adb6f..8a4b786e 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -358,6 +358,19 @@ void MainWindow::slotEncryptSign() { else infoBoard->slotRefresh(reportText, INFO_ERROR_WARN); + if (status >= 0) { + infoBoard->resetOptionActionsMenu(); + infoBoard->addOptionalAction("Send Mail", [this]() { + if(settings.value("sendMail/enable", false).toBool()) + new SendMailDialog(edit->curTextPage()->toPlainText(), this); + else { + QMessageBox::warning(nullptr, + tr("Function Disabled"), + tr("Please go to the settings interface to enable and configure this function.")); + } + }); + } + delete resultAnalyseEncr; delete resultAnalyseSign; } else if (edit->slotCurPageFileTreeView() != nullptr) { -- cgit v1.2.3 From 3d8c8f3c4550d88d1bb16bda003c88fc69e6acc5 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Mon, 19 Jul 2021 18:03:21 +0800 Subject: Improved and Modified. --- src/ui/main_window/MainWindowSlotFunction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp') diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 8a4b786e..4bcee080 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -398,7 +398,7 @@ void MainWindow::slotDecryptVerify() { connect(thread, SIGNAL(finished(QPrivateSignal)), thread, SLOT(deleteLater())); thread->start(); - WaitingDialog *dialog = new WaitingDialog(tr("Decrypting and Verifying"), this); + auto *dialog = new WaitingDialog(tr("Decrypting and Verifying"), this); while (thread->isRunning()) { QApplication::processEvents(); } -- cgit v1.2.3