feat: add option to disable auto fetch key publish status function

This commit is contained in:
saturneric 2024-11-22 13:06:49 +01:00
parent c9832d43a0
commit 3e8278bf4b
5 changed files with 26 additions and 18 deletions

View File

@ -102,6 +102,7 @@
<file alias="add.png">resource/lfs/icons/add.png</file>
<file alias="minus.png">resource/lfs/icons/minus.png</file>
<file alias="database.png">resource/lfs/icons/database.png</file>
<file alias="publish.png">resource/lfs/icons/publish.png</file>
</qresource>
<qresource prefix="/test/key">
<file alias="pv1.key">resource/lfs/test/data/pv1.key</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -310,7 +310,14 @@ void KeyPairDetailTab::slot_query_key_publish_state() {
.GetSettings()
.value("network/forbid_all_gnupg_connection")
.toBool();
if (forbid_all_gnupg_connection) return;
bool auto_fetch_key_publish_status =
GlobalSettingStation::GetInstance()
.GetSettings()
.value("network/auto_fetch_key_publish_status")
.toBool();
if (forbid_all_gnupg_connection || !auto_fetch_key_publish_status) return;
if (!Module::IsModuleActivate(
"com.bktus.gpgfrontend.module.key_server_sync")) {
@ -344,7 +351,7 @@ void KeyPairDetailTab::slot_query_key_publish_state() {
if (!key_data.isEmpty()) {
slot_refresh_notice(
":/icons/sent.png",
":/icons/publish.png",
tr("Notice: The key has been published on "
"keys.openpgp.org."));
}

View File

@ -46,7 +46,7 @@ GpgFrontend::UI::NetworkTab::NetworkTab(QWidget *parent)
});
connect(
ui_->autoImportMissingKeyCheckBox, &QCheckBox::stateChanged, this,
ui_->autoFetchKeyPublishStatusCheckBox, &QCheckBox::stateChanged, this,
[=](int state) {
ui_->forbidALLGnuPGNetworkConnectionCheckBox->setCheckState(
state == Qt::Checked
@ -56,10 +56,10 @@ GpgFrontend::UI::NetworkTab::NetworkTab(QWidget *parent)
connect(ui_->forbidALLGnuPGNetworkConnectionCheckBox,
&QCheckBox::stateChanged, this, [=](int state) {
ui_->autoImportMissingKeyCheckBox->setCheckState(
ui_->autoFetchKeyPublishStatusCheckBox->setCheckState(
state == Qt::Checked
? Qt::Unchecked
: ui_->autoImportMissingKeyCheckBox->checkState());
: ui_->autoFetchKeyPublishStatusCheckBox->checkState());
});
connect(
@ -92,8 +92,8 @@ GpgFrontend::UI::NetworkTab::NetworkTab(QWidget *parent)
ui_->prohibitUpdateCheck->setText(
tr("Prohibit checking for version updates when the program starts."));
}
ui_->autoImportMissingKeyCheckBox->setText(
tr("Automatically import a missing key for signature verification."));
ui_->autoFetchKeyPublishStatusCheckBox->setText(
tr("Automatically fetch key publish status from key server."));
ui_->networkAbilityTipsLabel->setText(
tr("Tips: These Option Changes take effect only after the "
"application restart."));
@ -136,10 +136,10 @@ void GpgFrontend::UI::NetworkTab::SetSettings() {
ui_->prohibitUpdateCheck->setCheckState(
prohibit_update_checking ? Qt::Checked : Qt::Unchecked);
auto auto_import_missing_key =
settings.value("network/auto_import_missing_key", true).toBool();
ui_->autoImportMissingKeyCheckBox->setCheckState(
auto_import_missing_key ? Qt::Checked : Qt::Unchecked);
auto auto_fetch_key_publish_status =
settings.value("network/auto_fetch_key_publish_status", false).toBool();
ui_->autoFetchKeyPublishStatusCheckBox->setCheckState(
auto_fetch_key_publish_status ? Qt::Checked : Qt::Unchecked);
switch_ui_proxy_type(ui_->proxyTypeComboBox->currentText());
switch_ui_enabled(ui_->enableProxyCheckBox->isChecked());
@ -160,8 +160,8 @@ void GpgFrontend::UI::NetworkTab::ApplySettings() {
ui_->forbidALLGnuPGNetworkConnectionCheckBox->isChecked());
settings.setValue("network/prohibit_update_checking",
ui_->prohibitUpdateCheck->isChecked());
settings.setValue("network/auto_import_missing_key",
ui_->autoImportMissingKeyCheckBox->isChecked());
settings.setValue("network/auto_fetch_key_publish_status",
ui_->autoFetchKeyPublishStatusCheckBox->isChecked());
apply_proxy_settings();
}

View File

@ -254,7 +254,7 @@
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -313,9 +313,9 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoImportMissingKeyCheckBox">
<widget class="QCheckBox" name="autoFetchKeyPublishStatusCheckBox">
<property name="text">
<string>Automatically import a missing key for signature verification.</string>
<string>Automatically fetch key publish status from key server.</string>
</property>
</widget>
</item>
@ -324,7 +324,7 @@
<item row="3" column="0">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -334,7 +334,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>