diff options
author | Saturneric <[email protected]> | 2022-02-13 06:54:44 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-02-13 06:54:44 +0000 |
commit | b991fea4912c63170c79ccdc586e3d3bc4297715 (patch) | |
tree | 8d1e1c2acc55442a52caf7f8814a689d9f7ba37b /src/ui/main_window/MainWindowSlotUI.cpp | |
parent | <fix>(ci): Set Git's file line endings to LF (diff) | |
download | GpgFrontend-b991fea4912c63170c79ccdc586e3d3bc4297715.tar.gz GpgFrontend-b991fea4912c63170c79ccdc586e3d3bc4297715.zip |
<feat, refactor>(src): Enable top encryption action menu in file mode
1. Adjust the names of some functions
2. Enable top encryption action menu in file mode
Diffstat (limited to 'src/ui/main_window/MainWindowSlotUI.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowSlotUI.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp index 42dd3be7..9d81b11c 100644 --- a/src/ui/main_window/MainWindowSlotUI.cpp +++ b/src/ui/main_window/MainWindowSlotUI.cpp @@ -188,4 +188,37 @@ void MainWindow::SlotSetRestartNeeded(bool needed) { bool MainWindow::get_restart_needed() const { return this->restart_needed_; } +void MainWindow::SetCryptoMenuStatus( + MainWindow::CryptoMenu::OperationType type) { + LOG(INFO) << "SetCryptoMenuStatus" << type; + + // refresh status to disable all + verify_act_->setDisabled(true); + sign_act_->setDisabled(true); + encrypt_act_->setDisabled(true); + encrypt_sign_act_->setDisabled(true); + decrypt_act_->setDisabled(true); + decrypt_verify_act_->setDisabled(true); + + // enable according to type + if (type & MainWindow::CryptoMenu::Verify) { + verify_act_->setDisabled(false); + } + if (type & MainWindow::CryptoMenu::Sign) { + sign_act_->setDisabled(false); + } + if (type & MainWindow::CryptoMenu::Encrypt) { + encrypt_act_->setDisabled(false); + } + if (type & MainWindow::CryptoMenu::EncryptAndSign) { + encrypt_sign_act_->setDisabled(false); + } + if (type & MainWindow::CryptoMenu::Decrypt) { + decrypt_act_->setDisabled(false); + } + if (type & MainWindow::CryptoMenu::DecryptAndVerify) { + decrypt_verify_act_->setDisabled(false); + } +} + } // namespace GpgFrontend::UI |