summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/Dialog.cpp40
1 files changed, 13 insertions, 27 deletions
diff --git a/client/Dialog.cpp b/client/Dialog.cpp
index 87d61bd..e109391 100644
--- a/client/Dialog.cpp
+++ b/client/Dialog.cpp
@@ -202,13 +202,18 @@ void ProxyDialog::ProxyToggled(bool on)
}
void ProxyDialog::StaticProxyToggled(bool on)
-{
+{
QPushButton* btn = (QPushButton*) sender();
QVariant propVal = btn->property("proxyName");
QString proxyName = propVal.toString();
Logger::Debug("Static Proxy button toggled\n");
Logger::Debug("State '%s', associated proxy name: %s\n", on ? "down" : "up", proxyName.toStdString().c_str());
-
+
+ if (!on)
+ {
+ return;
+ }
+
UpdatedConfig *cfg = UpdatedConfig::CurrentConfig();
string name = proxyName.toStdString();
ProxyEntryStatic* proxy = cfg->GetStaticProxy(name);
@@ -226,33 +231,14 @@ void ProxyDialog::StaticProxyToggled(bool on)
// check if we are going to add another http proxy
vector<Proxy> active = proxifier->GetActiveProxies();
- if (on && (active.size() != 0))
- {
- bool isHttp = (stricmp(proxy->type.c_str(), "http") == 0);
- for (unsigned i = 0; i < active.size(); i++)
- {
- if (isHttp && (stricmp(active[i].type.c_str(), "http") == 0))
- {
- //QString msg = QString::fromLocal8Bit(cfg->ConfigLoadedMsg.c_str());
- QMessageBox otherHttpProxy;
- otherHttpProxy.setText("Two HTTP proxy in one chain are not allowed");
- otherHttpProxy.setWindowTitle("Information");
- otherHttpProxy.setStandardButtons(QMessageBox::Ok);
- otherHttpProxy.setIcon(QMessageBox::Information);
- otherHttpProxy.exec();
- return;
- }
- }
- }
-
- if (on)
- {
- proxifier->TurnProxyOn(*proxy);
- }
- else
+ if (active.size() != 0)
{
- proxifier->TurnProxyOff(*proxy);
+ for (unsigned i = 0; i < active.size(); i++)
+ {
+ proxifier->TurnProxyOff(active[i]);
+ }
}
+ proxifier->TurnProxyOn(*proxy);
}
void ProxyDialog::CountryActivated(int index)