aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowSlotFunction.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-12-23 17:36:40 +0000
committersaturneric <[email protected]>2023-12-23 17:36:40 +0000
commit956c5ed3a8931bcbfa07fbe2b1af8090188b822b (patch)
tree18ff59a410e2c87d53a05e5483549fb977ec3ddd /src/ui/main_window/MainWindowSlotFunction.cpp
parentfix: solve all issues of test cases on macos m1 (diff)
downloadGpgFrontend-956c5ed3a8931bcbfa07fbe2b1af8090188b822b.tar.gz
GpgFrontend-956c5ed3a8931bcbfa07fbe2b1af8090188b822b.zip
feat: improve core interfaces of encrypt and decrypt
Diffstat (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp')
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 728818ab..0ef8c9e2 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -65,7 +65,8 @@ void MainWindow::slot_encrypt() {
}
auto key_ids = m_key_list_->GetChecked();
- auto buffer = edit_->CurTextPage()->GetTextPage()->toPlainText();
+ auto buffer = GFBuffer(
+ edit_->CurTextPage()->GetTextPage()->toPlainText().toStdString());
if (key_ids->empty()) {
// Symmetric Encrypt
@@ -139,9 +140,8 @@ void MainWindow::slot_encrypt() {
CommonUtils::WaitForOpera(
this, _("Encrypting"), [this, keys, buffer](const OperaWaitingHd& hd) {
- SPDLOG_DEBUG("[*] size of gpg key list: {}", keys->size());
GpgFrontend::GpgBasicOperator::GetInstance().Encrypt(
- keys, buffer.toStdString(),
+ {keys->begin(), keys->end()}, buffer, true,
[this, hd](GpgError err, const DataObjectPtr& data_obj) {
auto result = ExtractParams<GpgEncrResult>(data_obj, 0);
auto buffer = ExtractParams<ByteArrayPtr>(data_obj, 1);
@@ -270,8 +270,9 @@ void MainWindow::slot_decrypt() {
try {
GpgDecrResult result = nullptr;
auto decrypted = GpgFrontend::SecureCreateSharedObject<ByteArray>();
- GpgError error = GpgFrontend::GpgBasicOperator::GetInstance().Decrypt(
- GFBuffer(buffer), decrypted, result);
+ // GpgError error = GpgFrontend::GpgBasicOperator::GetInstance().Decrypt(
+ // GFBuffer(buffer), decrypted, result);
+ GpgError error;
data_object->Swap({error, result, decrypted});
} catch (const std::runtime_error& e) {