Mercurial > hg > forks > UniversalIndentGUI
comparison src/UpdateCheckDialog.cpp @ 771:7982f8a04f73
[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
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Sat, 23 Apr 2011 15:42:56 +0000 |
parents | 01f01ab124a1 |
children | fa7aa6f543f1 |
comparison
equal
deleted
inserted
replaced
770:01f01ab124a1 | 771:7982f8a04f73 |
---|---|
30 #include <QDate> | 30 #include <QDate> |
31 #include <QUrl> | 31 #include <QUrl> |
32 #include <QRegExpValidator> | 32 #include <QRegExpValidator> |
33 #include <QNetworkRequest> | 33 #include <QNetworkRequest> |
34 #include <QNetworkReply> | 34 #include <QNetworkReply> |
35 #include <QNetworkProxy> | |
35 | 36 |
36 /*! | 37 /*! |
37 \class UpdateCheckDialog | 38 \class UpdateCheckDialog |
38 \ingroup grp_MainWindow | 39 \ingroup grp_MainWindow |
39 \brief UpdateCheckDialog is a dialog widget that contains functions | 40 \brief UpdateCheckDialog is a dialog widget that contains functions |
62 _updateCheckProgressCounter = 0; | 63 _updateCheckProgressCounter = 0; |
63 | 64 |
64 // Connect the dialogs buttonbox with a button click handler. | 65 // Connect the dialogs buttonbox with a button click handler. |
65 connect( _updateCheckDialogForm->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(handleUpdateCheckDialogButtonClicked(QAbstractButton*)) ); | 66 connect( _updateCheckDialogForm->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(handleUpdateCheckDialogButtonClicked(QAbstractButton*)) ); |
66 | 67 |
67 settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyEnabled"); | 68 settings->registerObjectSlot(this, "initProxySettings()", "ProxyEnabled"); |
68 settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyHostName"); | 69 settings->registerObjectSlot(this, "initProxySettings()", "ProxyHostName"); |
69 settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyPort"); | 70 settings->registerObjectSlot(this, "initProxySettings()", "ProxyPort"); |
70 settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyUserName"); | 71 settings->registerObjectSlot(this, "initProxySettings()", "ProxyUserName"); |
71 settings->registerObjectSlot(this, "onProxySettingsChanged()", "ProxyPassword"); | 72 settings->registerObjectSlot(this, "initProxySettings()", "ProxyPassword"); |
72 | 73 |
73 _settings = settings; | 74 _settings = settings; |
75 | |
76 initProxySettings(); | |
74 | 77 |
75 // This dialog is always modal. | 78 // This dialog is always modal. |
76 setModal(true); | 79 setModal(true); |
77 } | 80 } |
78 | 81 |
173 } | 176 } |
174 } | 177 } |
175 // If there was some error while trying to retrieve the update info from server and not cancel was pressed. | 178 // If there was some error while trying to retrieve the update info from server and not cancel was pressed. |
176 else if ( _roleOfClickedButton != QDialogButtonBox::RejectRole ) { | 179 else if ( _roleOfClickedButton != QDialogButtonBox::RejectRole ) { |
177 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()) ); | 180 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()) ); |
181 hide(); | |
178 } | 182 } |
179 _manualUpdateRequested = false; | 183 _manualUpdateRequested = false; |
180 networkReply->deleteLater(); | 184 networkReply->deleteLater(); |
181 _currentNetworkReply = NULL; | 185 _currentNetworkReply = NULL; |
182 } | 186 } |
301 } | 305 } |
302 | 306 |
303 return versionInteger; | 307 return versionInteger; |
304 } | 308 } |
305 | 309 |
306 void UpdateCheckDialog::onProxySettingsChanged() | 310 void UpdateCheckDialog::initProxySettings() |
307 { | 311 { |
308 if ( _settings->getValueByName("ProxyEnabled") == true ) { | 312 if ( _settings->getValueByName("ProxyEnabled") == true ) { |
309 | 313 QString proxyHostName = _settings->getValueByName("ProxyHostName").toString(); |
314 int proxyPort = _settings->getValueByName("ProxyPort").toInt(); | |
315 QString proxyUserName = _settings->getValueByName("ProxyUserName").toString(); | |
316 QString proxyPassword = _settings->getValueByName("ProxyPassword").toString(); | |
317 _networkAccessManager->setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyHostName, proxyPort, proxyUserName, proxyPassword)); | |
310 } | 318 } |
311 else { | 319 else { |
312 | 320 _networkAccessManager->setProxy(QNetworkProxy()); |
313 } | 321 } |
314 } | 322 } |