aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowSlotFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp')
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp51
1 files changed, 32 insertions, 19 deletions
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 57fb5bae..593fe6fe 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -61,7 +61,7 @@ void MainWindow::slotEncrypt() {
// Symmetric Encrypt
auto ret = QMessageBox::information(
this, _("Symmetric Encryption"),
- _("No Key Selected. Do you want to encrypt with a "
+ _("No Key Checked. Do you want to encrypt with a "
"symmetric cipher using a passphrase?"),
QMessageBox::Ok | QMessageBox::Cancel);
@@ -69,7 +69,8 @@ void MainWindow::slotEncrypt() {
process_operation(this, _("Symmetrically Encrypting"), [&]() {
try {
- auto buffer = edit->curTextPage()->toPlainText().toUtf8().toStdString();
+ auto buffer =
+ edit->curTextPage()->getTextPage()->toPlainText().toStdString();
error = GpgFrontend::BasicOperator::GetInstance().EncryptSymmetric(
buffer, tmp, result);
} catch (const std::runtime_error& e) {
@@ -82,7 +83,7 @@ void MainWindow::slotEncrypt() {
for (const auto& key : *keys) {
if (!key.CanEncrActual()) {
QMessageBox::information(
- nullptr, _("Invalid Operation"),
+ this, _("Invalid Operation"),
QString(_(
"The selected key contains a key that does not actually have a "
"encrypt usage.")) +
@@ -94,7 +95,8 @@ void MainWindow::slotEncrypt() {
process_operation(this, _("Encrypting"), [&]() {
try {
- auto buffer = edit->curTextPage()->toPlainText().toUtf8().toStdString();
+ auto buffer =
+ edit->curTextPage()->getTextPage()->toPlainText().toStdString();
error = GpgFrontend::BasicOperator::GetInstance().Encrypt(
std::move(keys), buffer, tmp, result);
} catch (const std::runtime_error& e) {
@@ -114,7 +116,8 @@ void MainWindow::slotEncrypt() {
infoBoard->resetOptionActionsMenu();
#ifdef SMTP_SUPPORT
if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR)
- send_an_email(this, infoBoard, edit->curTextPage()->toPlainText());
+ send_an_email(this, infoBoard,
+ edit->curTextPage()->getTextPage()->toPlainText());
#endif
} else {
QMessageBox::critical(this, _("Error"),
@@ -130,8 +133,8 @@ void MainWindow::slotSign() {
if (key_ids->empty()) {
QMessageBox::critical(
- this, _("No Key Selected"),
- _("Please select the key in the key toolbox on the right."));
+ this, _("No Key Checked"),
+ _("Please check the key in the key toolbox on the right."));
return;
}
@@ -157,7 +160,11 @@ void MainWindow::slotSign() {
process_operation(this, _("Signing"), [&]() {
try {
- auto buffer = edit->curTextPage()->toPlainText().toUtf8().toStdString();
+ auto buffer = edit->curTextPage()
+ ->getTextPage()
+ ->toPlainText()
+ .toUtf8()
+ .toStdString();
error = GpgFrontend::BasicOperator::GetInstance().Sign(
std::move(keys), buffer, tmp, GPGME_SIG_MODE_CLEAR, result);
} catch (const std::runtime_error& e) {
@@ -183,7 +190,7 @@ void MainWindow::slotDecrypt() {
if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return;
auto decrypted = std::make_unique<ByteArray>();
- QByteArray text = edit->curTextPage()->toPlainText().toUtf8();
+ QByteArray text = edit->curTextPage()->getTextPage()->toPlainText().toUtf8();
if (text.trimmed().startsWith(GpgConstants::GPG_FRONTEND_SHORT_CRYPTO_HEAD)) {
QMessageBox::critical(
@@ -234,7 +241,7 @@ void MainWindow::slotFind() {
void MainWindow::slotVerify() {
if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return;
- auto text = edit->curTextPage()->toPlainText().toUtf8();
+ auto text = edit->curTextPage()->getTextPage()->toPlainText().toUtf8();
// TODO(Saturneric) PreventNoDataErr
auto sig_buffer = std::make_unique<ByteArray>();
@@ -273,8 +280,8 @@ void MainWindow::slotEncryptSign() {
if (key_ids->empty()) {
QMessageBox::critical(
- nullptr, _("No Key Selected"),
- _("Please select the key in the key toolbox on the right."));
+ this, _("No Key Checked"),
+ _("Please check some key in the key toolbox on the right."));
return;
}
@@ -285,7 +292,7 @@ void MainWindow::slotEncryptSign() {
if (!key_can_encrypt) {
QMessageBox::critical(
- nullptr, _("Invalid KeyPair"),
+ this, _("Invalid KeyPair"),
QString(_("The selected keypair cannot be used for encryption.")) +
"<br/><br/>" + _("For example the Following Key:") + " <br/>" +
QString::fromStdString(key.uids()->front().uid()));
@@ -317,7 +324,11 @@ void MainWindow::slotEncryptSign() {
auto tmp = std::make_unique<ByteArray>();
process_operation(this, _("Encrypting and Signing"), [&]() {
try {
- auto buffer = edit->curTextPage()->toPlainText().toUtf8().toStdString();
+ auto buffer = edit->curTextPage()
+ ->getTextPage()
+ ->toPlainText()
+ .toUtf8()
+ .toStdString();
error = GpgFrontend::BasicOperator::GetInstance().EncryptSign(
std::move(keys), std::move(signer_keys), buffer, tmp, encr_result,
sign_result);
@@ -352,7 +363,8 @@ void MainWindow::slotEncryptSign() {
infoBoard->resetOptionActionsMenu();
#ifdef SMTP_SUPPORT
if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR)
- send_an_email(this, infoBoard, edit->curTextPage()->toPlainText(), false);
+ send_an_email(this, infoBoard,
+ edit->curTextPage()->getTextPage()->toPlainText(), false);
#endif
#ifdef ADVANCE_SUPPORT
@@ -376,7 +388,7 @@ void MainWindow::slotEncryptSign() {
void MainWindow::slotDecryptVerify() {
if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return;
- QString plainText = edit->curTextPage()->toPlainText();
+ QString plainText = edit->curTextPage()->getTextPage()->toPlainText();
#ifdef ADVANCE_SUPPORT
if (plainText.trimmed().startsWith(
@@ -453,7 +465,8 @@ void MainWindow::slotAppendSelectedKeys() {
auto key_ids = mKeyList->getSelected();
GpgKeyImportExporter::GetInstance().ExportKeys(key_ids, exported);
- edit->curTextPage()->append(QString::fromStdString(*exported));
+ edit->curTextPage()->getTextPage()->appendPlainText(
+ QString::fromStdString(*exported));
}
void MainWindow::slotCopyMailAddressToClipboard() {
@@ -462,7 +475,7 @@ void MainWindow::slotCopyMailAddressToClipboard() {
auto key = GpgKeyGetter::GetInstance().GetKey(key_ids->front());
if (!key.good()) {
- QMessageBox::critical(nullptr, _("Error"), _("Key Not Found."));
+ QMessageBox::critical(this, _("Error"), _("Key Not Found."));
return;
}
QClipboard* cb = QApplication::clipboard();
@@ -477,7 +490,7 @@ void MainWindow::slotShowKeyDetails() {
if (key.good()) {
new KeyDetailsDialog(key, this);
} else {
- QMessageBox::critical(nullptr, _("Error"), _("Key Not Found."));
+ QMessageBox::critical(this, _("Error"), _("Key Not Found."));
}
}