1
0

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="add.png">resource/lfs/icons/add.png</file>
<file alias="minus.png">resource/lfs/icons/minus.png</file> <file alias="minus.png">resource/lfs/icons/minus.png</file>
<file alias="database.png">resource/lfs/icons/database.png</file> <file alias="database.png">resource/lfs/icons/database.png</file>
<file alias="publish.png">resource/lfs/icons/publish.png</file>
</qresource> </qresource>
<qresource prefix="/test/key"> <qresource prefix="/test/key">
<file alias="pv1.key">resource/lfs/test/data/pv1.key</file> <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() .GetSettings()
.value("network/forbid_all_gnupg_connection") .value("network/forbid_all_gnupg_connection")
.toBool(); .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( if (!Module::IsModuleActivate(
"com.bktus.gpgfrontend.module.key_server_sync")) { "com.bktus.gpgfrontend.module.key_server_sync")) {
@ -344,7 +351,7 @@ void KeyPairDetailTab::slot_query_key_publish_state() {
if (!key_data.isEmpty()) { if (!key_data.isEmpty()) {
slot_refresh_notice( slot_refresh_notice(
":/icons/sent.png", ":/icons/publish.png",
tr("Notice: The key has been published on " tr("Notice: The key has been published on "
"keys.openpgp.org.")); "keys.openpgp.org."));
} }

View File

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

View File

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