diff options
author | unknown <b0ris@b0ris-satellite.(none)> | 2012-03-12 09:01:59 +0200 |
---|---|---|
committer | unknown <b0ris@b0ris-satellite.(none)> | 2012-03-12 09:01:59 +0200 |
commit | d60ef0d0ffdad15bb20d5444b4b5f4a2ffb44a17 (patch) | |
tree | 34977509201ae96159a4195f57d8c41e0aeddbc0 /client | |
parent | 0b04a9542db946e9fb94780aee24869e463ceaa2 (diff) |
New static proxy choice leeds now to raplacment of all our previous entries
Diffstat (limited to 'client')
-rw-r--r-- | client/Dialog.cpp | 40 |
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) |