aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/key_generate/KeygenDialog.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-18 12:58:37 +0000
committersaturneric <[email protected]>2024-01-18 12:58:37 +0000
commite0d2c4021483e6e1366c1050ccb5a30e53e172bb (patch)
tree5d85739479622e7c672aea45f84d4e2f577f9332 /src/ui/dialog/key_generate/KeygenDialog.cpp
parentfix: correct a fault (diff)
downloadGpgFrontend-e0d2c4021483e6e1366c1050ccb5a30e53e172bb.tar.gz
GpgFrontend-e0d2c4021483e6e1366c1050ccb5a30e53e172bb.zip
fix: add test cases and solve discovered issues
Diffstat (limited to 'src/ui/dialog/key_generate/KeygenDialog.cpp')
-rw-r--r--src/ui/dialog/key_generate/KeygenDialog.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/ui/dialog/key_generate/KeygenDialog.cpp b/src/ui/dialog/key_generate/KeygenDialog.cpp
index 0f6c19d8..08816f98 100644
--- a/src/ui/dialog/key_generate/KeygenDialog.cpp
+++ b/src/ui/dialog/key_generate/KeygenDialog.cpp
@@ -283,49 +283,63 @@ void KeyGenDialog::slot_activated_key_type(int index) {
}
void KeyGenDialog::refresh_widgets_state() {
- if (gen_key_info_->IsAllowEncryption()) {
+ if (gen_key_info_->IsAllowEncryption() ||
+ (gen_subkey_info_ != nullptr && gen_subkey_info_->IsAllowEncryption())) {
key_usage_check_boxes_[0]->setCheckState(Qt::CheckState::Checked);
} else {
key_usage_check_boxes_[0]->setCheckState(Qt::CheckState::Unchecked);
}
- if (gen_key_info_->IsAllowChangeEncryption()) {
+ if (gen_key_info_->IsAllowChangeEncryption() ||
+ (gen_subkey_info_ != nullptr &&
+ gen_subkey_info_->IsAllowChangeEncryption())) {
key_usage_check_boxes_[0]->setDisabled(false);
} else {
key_usage_check_boxes_[0]->setDisabled(true);
}
- if (gen_key_info_->IsAllowSigning()) {
+ if (gen_key_info_->IsAllowSigning() ||
+ (gen_subkey_info_ != nullptr && gen_subkey_info_->IsAllowSigning())) {
key_usage_check_boxes_[1]->setCheckState(Qt::CheckState::Checked);
} else {
key_usage_check_boxes_[1]->setCheckState(Qt::CheckState::Unchecked);
}
- if (gen_key_info_->IsAllowChangeSigning()) {
+ if (gen_key_info_->IsAllowChangeSigning() ||
+ (gen_subkey_info_ != nullptr &&
+ gen_subkey_info_->IsAllowChangeSigning())) {
key_usage_check_boxes_[1]->setDisabled(false);
} else {
key_usage_check_boxes_[1]->setDisabled(true);
}
- if (gen_key_info_->IsAllowCertification()) {
+ if (gen_key_info_->IsAllowCertification() ||
+ (gen_subkey_info_ != nullptr &&
+ gen_subkey_info_->IsAllowCertification())) {
key_usage_check_boxes_[2]->setCheckState(Qt::CheckState::Checked);
} else {
key_usage_check_boxes_[2]->setCheckState(Qt::CheckState::Unchecked);
}
- if (gen_key_info_->IsAllowChangeCertification()) {
+ if (gen_key_info_->IsAllowChangeCertification() ||
+ (gen_subkey_info_ != nullptr &&
+ gen_subkey_info_->IsAllowChangeCertification())) {
key_usage_check_boxes_[2]->setDisabled(false);
} else {
key_usage_check_boxes_[2]->setDisabled(true);
}
- if (gen_key_info_->IsAllowAuthentication()) {
+ if (gen_key_info_->IsAllowAuthentication() ||
+ (gen_subkey_info_ != nullptr &&
+ gen_subkey_info_->IsAllowAuthentication())) {
key_usage_check_boxes_[3]->setCheckState(Qt::CheckState::Checked);
} else {
key_usage_check_boxes_[3]->setCheckState(Qt::CheckState::Unchecked);
}
- if (gen_key_info_->IsAllowChangeAuthentication()) {
+ if (gen_key_info_->IsAllowChangeAuthentication() ||
+ (gen_subkey_info_ != nullptr &&
+ gen_subkey_info_->IsAllowChangeAuthentication())) {
key_usage_check_boxes_[3]->setDisabled(false);
} else {
key_usage_check_boxes_[3]->setDisabled(true);