# HG changeset patch # User thomas_-_s # Date 1303573376 0 # Node ID 7982f8a04f73f8938e4313729921fd211aac8c34 # Parent 01f01ab124a19f94025bc26b4cdbbaafb811e02e [fix] Bug ID 2916163: The proxy settings a properly used and applied now. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1048 59b1889a-e5ac-428c-b0c7-476e01d41282 diff -r 01f01ab124a1 -r 7982f8a04f73 src/UpdateCheckDialog.cpp --- a/src/UpdateCheckDialog.cpp Sat Apr 23 10:43:42 2011 +0000 +++ b/src/UpdateCheckDialog.cpp Sat Apr 23 15:42:56 2011 +0000 @@ -32,6 +32,7 @@ #include #include #include +#include /*! \class UpdateCheckDialog @@ -64,14 +65,16 @@ // Connect the dialogs buttonbox with a button click handler. connect( _updateCheckDialogForm->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(handleUpdateCheckDialogButtonClicked(QAbstractButton*)) ); - settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyEnabled"); - settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyHostName"); - settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyPort"); - settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyUserName"); - settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyPassword"); + settings->registerObjectSlot(this, "initProxySettings()", "ProxyEnabled"); + settings->registerObjectSlot(this, "initProxySettings()", "ProxyHostName"); + settings->registerObjectSlot(this, "initProxySettings()", "ProxyPort"); + settings->registerObjectSlot(this, "initProxySettings()", "ProxyUserName"); + settings->registerObjectSlot(this, "initProxySettings()", "ProxyPassword"); _settings = settings; + initProxySettings(); + // This dialog is always modal. setModal(true); } @@ -175,6 +178,7 @@ // If there was some error while trying to retrieve the update info from server and not cancel was pressed. else if ( _roleOfClickedButton != QDialogButtonBox::RejectRole ) { QMessageBox::warning(this, tr("Update check error"), tr("There was an error while trying to check for an update! Error was : %1").arg(networkReply->errorString()) ); + hide(); } _manualUpdateRequested = false; networkReply->deleteLater(); @@ -303,12 +307,16 @@ return versionInteger; } -void UpdateCheckDialog::onProxySettingsChanged() +void UpdateCheckDialog::initProxySettings() { if ( _settings->getValueByName("ProxyEnabled") == true ) { - + QString proxyHostName = _settings->getValueByName("ProxyHostName").toString(); + int proxyPort = _settings->getValueByName("ProxyPort").toInt(); + QString proxyUserName = _settings->getValueByName("ProxyUserName").toString(); + QString proxyPassword = _settings->getValueByName("ProxyPassword").toString(); + _networkAccessManager->setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyHostName, proxyPort, proxyUserName, proxyPassword)); } else { - + _networkAccessManager->setProxy(QNetworkProxy()); } } diff -r 01f01ab124a1 -r 7982f8a04f73 src/UpdateCheckDialog.h --- a/src/UpdateCheckDialog.h Sat Apr 23 10:43:42 2011 +0000 +++ b/src/UpdateCheckDialog.h Sat Apr 23 15:42:56 2011 +0000 @@ -50,7 +50,7 @@ void checkResultsOfFetchedPadXMLFile(QNetworkReply *networkReply); void handleUpdateCheckDialogButtonClicked(QAbstractButton *clickedButton); void updateUpdateCheckProgressBar(); - void onProxySettingsChanged(); + void initProxySettings(); private: Ui::UpdateCheckDialog *_updateCheckDialogForm;