Skip to content

Commit 13dfede

Browse files
committed
fix: Remove redundant signal emission in proxy settings
Remove unnecessary ProxyMethodChanged signal emission when setting proxy method. The signal was redundant as the proxy mode change is already handled by other mechanisms. Log: Removed redundant proxy method change signal PMS: BUG-271003 fix: 移除代理设置中的冗余信号发射 在设置代理方法时移除不必要的ProxyMethodChanged信号发射。该信号是冗余的,因为代理模式变更已通过其他机制处理。 Log: 移除冗余的代理方法变更信号 PMS: BUG-271003
1 parent 95539e9 commit 13dfede

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

network-service-plugin/src/session/networkproxy.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ void NetworkProxy::SetProxyMethod(const QString &proxyMode)
109109
return;
110110
}
111111
m_proxySettings->set(GkeyProxyMode, proxyMode);
112-
Q_EMIT ProxyMethodChanged(proxyMode);
113112
if (proxyMode == ProxyModeNone) {
114113
m_networkStateHandler->notify(notifyIconProxyDisabled, tr("Network"), tr("System proxy has been cancelled."));
115114
} else {
@@ -228,7 +227,19 @@ void NetworkProxy::onConfigChanged(const QString &key)
228227
if (!settings)
229228
return;
230229

231-
if (key == "host" || key == "autoconfigUrl") {
230+
bool isHost = false;
231+
if (settings == m_proxySettings) {
232+
if (key == "autoconfigUrl") {
233+
isHost = true;
234+
} else if (key == "mode") {
235+
// 模式发生变化,此时需要告诉外面
236+
Q_EMIT ProxyMethodChanged(settings->get(key).toString());
237+
}
238+
} else {
239+
isHost = (key == "host");
240+
}
241+
242+
if (isHost) {
232243
emit proxyChanged(settings->property("type").toString(), settings->get(key).toString());
233244
}
234245
}

0 commit comments

Comments
 (0)