From 21b99de773a367f2e306f5ab0a96dfc225753b33 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Mon, 25 Sep 2017 15:13:35 +0200 Subject: [PATCH] [auth] Allow stored auth configurations to be used for proxy settings --- src/app/qgsoptions.cpp | 14 ++++ src/app/qgsoptions.h | 2 + src/ui/qgsoptionsbase.ui | 140 +++++++++++++++++++++------------------ 3 files changed, 92 insertions(+), 64 deletions(-) diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index d272263ff47d..b09782ab54fa 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -28,6 +28,7 @@ #include "qgstolerance.h" #include "qgsscaleutils.h" #include "qgsnetworkaccessmanager.h" +#include "qgsauthconfigselect.h" #include "qgsproject.h" #include "qgsdualview.h" #include "qgsrasterlayer.h" @@ -307,6 +308,16 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QListsetValue( mSettings->value( QStringLiteral( "/qgis/defaultTileMaxRetry" ), "3" ).toInt() ); + // Proxy stored authentication configurations + mProxyAuthConfigSelect = new QgsAuthConfigSelect( this ); + tabAuth->insertTab( 1, mProxyAuthConfigSelect, tr( "Configurations" ) ); + QString authcfg = mSettings->value( QStringLiteral( "proxy/authcfg" ) ).toString(); + mProxyAuthConfigSelect->setConfigId( authcfg ); + if ( !authcfg.isEmpty() ) + { + tabAuth->setCurrentIndex( tabAuth->indexOf( mProxyAuthConfigSelect ) ); + } + //Web proxy settings grpProxy->setChecked( mSettings->value( QStringLiteral( "proxy/proxyEnabled" ), "0" ).toBool() ); leProxyHost->setText( mSettings->value( QStringLiteral( "proxy/proxyHost" ), "" ).toString() ); @@ -1162,6 +1173,9 @@ void QgsOptions::saveOptions() // WMS/WMS-C default max retry in case of tile request errors mSettings->setValue( QStringLiteral( "/qgis/defaultTileMaxRetry" ), mDefaultTileMaxRetrySpinBox->value() ); + // Proxy stored authentication configurations + mSettings->setValue( QStringLiteral( "proxy/authcfg" ), mProxyAuthConfigSelect->configId( ) ); + //Web proxy settings mSettings->setValue( QStringLiteral( "proxy/proxyEnabled" ), grpProxy->isChecked() ); mSettings->setValue( QStringLiteral( "proxy/proxyHost" ), leProxyHost->text() ); diff --git a/src/app/qgsoptions.h b/src/app/qgsoptions.h index 3001b74ccfa8..8d1ceaa6f2ed 100644 --- a/src/app/qgsoptions.h +++ b/src/app/qgsoptions.h @@ -32,6 +32,7 @@ class QgsExpressionContext; class QgsOptionsPageWidget; class QgsLocatorOptionsWidget; +class QgsAuthConfigSelect; /** * \class QgsOptions @@ -255,6 +256,7 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption QList< QgsOptionsPageWidget * > mAdditionalOptionWidgets; QgsLocatorOptionsWidget *mLocatorOptionsWidget = nullptr; + QgsAuthConfigSelect *mProxyAuthConfigSelect = nullptr; }; diff --git a/src/ui/qgsoptionsbase.ui b/src/ui/qgsoptionsbase.ui index 509cfa50f0bb..e38c2b281ce1 100755 --- a/src/ui/qgsoptionsbase.ui +++ b/src/ui/qgsoptionsbase.ui @@ -320,7 +320,7 @@ - 0 + 13 @@ -349,8 +349,8 @@ 0 0 - 857 - 678 + 846 + 672 @@ -998,8 +998,8 @@ 0 0 - 561 - 1079 + 537 + 1128 @@ -1528,8 +1528,8 @@ 0 0 - 511 - 719 + 499 + 754 @@ -1896,8 +1896,8 @@ 0 0 - 692 - 994 + 672 + 1043 @@ -2647,8 +2647,8 @@ 0 0 - 146 - 241 + 130 + 322 @@ -2798,8 +2798,8 @@ 0 0 - 514 - 334 + 500 + 340 @@ -3141,8 +3141,8 @@ 0 0 - 625 - 612 + 623 + 734 @@ -3585,8 +3585,8 @@ The bigger the number, the faster zooming with the mouse wheel will be. 0 0 - 487 - 588 + 491 + 610 @@ -3854,8 +3854,8 @@ The bigger the number, the faster zooming with the mouse wheel will be. 0 0 - 556 - 740 + 548 + 785 @@ -4432,8 +4432,8 @@ The bigger the number, the faster zooming with the mouse wheel will be. 0 0 - 427 - 380 + 431 + 376 @@ -4571,8 +4571,8 @@ The bigger the number, the faster zooming with the mouse wheel will be. 0 0 - 429 - 549 + 418 + 544 @@ -4784,8 +4784,8 @@ The bigger the number, the faster zooming with the mouse wheel will be. 0 0 - 282 - 234 + 268 + 232 @@ -4892,9 +4892,9 @@ The bigger the number, the faster zooming with the mouse wheel will be. 0 - 0 - 509 - 723 + -44 + 846 + 830 @@ -5125,40 +5125,12 @@ The bigger the number, the faster zooming with the mouse wheel will be. 0 - - - - Leave this blank if no proxy username / password are required - - - - - - - Leave this blank if no proxy username / password are required - - - QLineEdit::Password - - - - - - - User - - - - - - - Password - - - + + + @@ -5166,9 +5138,6 @@ The bigger the number, the faster zooming with the mouse wheel will be. - - - @@ -5192,6 +5161,51 @@ The bigger the number, the faster zooming with the mouse wheel will be. + + + + 0 + + + + Authentication + + + + + + User name + + + + + + + Password + + + + + + + Leave this blank if no proxy username / password are required + + + + + + + Leave this blank if no proxy username / password are required + + + QLineEdit::Password + + + + + + + @@ -5709,8 +5723,6 @@ The bigger the number, the faster zooming with the mouse wheel will be. mProxyTypeComboBox leProxyHost leProxyPort - leProxyUser - leProxyPassword mAddUrlPushButton mRemoveUrlPushButton mExcludeUrlListWidget