diff options
author | saturneric <[email protected]> | 2024-10-26 13:51:55 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-10-26 13:51:55 +0000 |
commit | 5bc8c1cd21c18af82a9bf6ffd96457afda46a7bd (patch) | |
tree | cfaa815bd4492ec98a8709be0e4628be6911161b /src/ui/main_window/MainWindowFileSlotFunction.cpp | |
parent | fix: add a resource item (diff) | |
download | GpgFrontend-5bc8c1cd21c18af82a9bf6ffd96457afda46a7bd.tar.gz GpgFrontend-5bc8c1cd21c18af82a9bf6ffd96457afda46a7bd.zip |
fix: should check key status immediately after get it
Diffstat (limited to 'src/ui/main_window/MainWindowFileSlotFunction.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index bad59303..4b1eec9f 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -121,6 +121,9 @@ void MainWindow::SlotFileEncrypt(const QString& path) { auto p_keys = GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel()) .GetKeys(key_ids); + for (const auto& key : *p_keys) { + assert(key.IsGood()); + } // check key abilities for (const auto& key : *p_keys) { @@ -244,6 +247,9 @@ void MainWindow::SlotDirectoryEncrypt(const QString& path) { auto p_keys = GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel()) .GetKeys(key_ids); + for (const auto& key : *p_keys) { + assert(key.IsGood()); + } // check key abilities for (const auto& key : *p_keys) { @@ -408,6 +414,9 @@ void MainWindow::SlotFileSign(const QString& path) { auto keys = GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel()) .GetKeys(key_ids); + for (const auto& key : *keys) { + assert(key.IsGood()); + } if (keys->empty()) { QMessageBox::critical( @@ -572,6 +581,9 @@ void MainWindow::SlotFileEncryptSign(const QString& path) { auto p_keys = GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel()) .GetKeys(key_ids); + for (const auto& key : *p_keys) { + assert(key.IsGood()); + } if (p_keys->empty()) { QMessageBox::critical( @@ -631,6 +643,9 @@ void MainWindow::SlotFileEncryptSign(const QString& path) { auto p_signer_keys = GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel()) .GetKeys(signer_key_ids); + for (const auto& key : *p_signer_keys) { + assert(key.IsGood()); + } CommonUtils::WaitForOpera( this, tr("Encrypting and Signing"), [=](const OperaWaitingHd& op_hd) { @@ -686,6 +701,9 @@ void MainWindow::SlotDirectoryEncryptSign(const QString& path) { auto p_keys = GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel()) .GetKeys(key_ids); + for (const auto& key : *p_keys) { + assert(key.IsGood()); + } if (p_keys->empty()) { QMessageBox::critical( @@ -745,6 +763,9 @@ void MainWindow::SlotDirectoryEncryptSign(const QString& path) { auto p_signer_keys = GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel()) .GetKeys(signer_key_ids); + for (const auto& key : *p_signer_keys) { + assert(key.IsGood()); + } CommonUtils::WaitForOpera( this, tr("Archiving & Encrypting & Signing"), |