From d60ef0d0ffdad15bb20d5444b4b5f4a2ffb44a17 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Mar 2012 09:01:59 +0200 Subject: New static proxy choice leeds now to raplacment of all our previous entries --- client/Dialog.cpp | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'client/Dialog.cpp') 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 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) -- cgit v1.2.3