Skip to content

Commit

Permalink
[auth] Proxy settings use the new auth settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Oct 3, 2017
1 parent c856ba3 commit 191942a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 83 deletions.
21 changes: 9 additions & 12 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,18 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mDefaultTileMaxRetrySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileMaxRetry" ), "3" ).toInt() );

// Proxy stored authentication configurations
mProxyAuthConfigSelect = new QgsAuthConfigSelect( this, QStringLiteral( "proxy" ) );
tabAuth->insertTab( 1, mProxyAuthConfigSelect, tr( "Configurations" ) );
mAuthSettings->setDataprovider( QStringLiteral( "proxy" ) );
QString authcfg = mSettings->value( QStringLiteral( "proxy/authcfg" ) ).toString();
mProxyAuthConfigSelect->setConfigId( authcfg );
if ( !authcfg.isEmpty() )
{
tabAuth->setCurrentIndex( tabAuth->indexOf( mProxyAuthConfigSelect ) );
}
mAuthSettings->setConfigId( authcfg );
mAuthSettings->setWarningText( tr( "<b style=\"color:red\">Warning: credentials are stored unencrypted (in clear text) in the system settings!</b>" ) );

//Web proxy settings
grpProxy->setChecked( mSettings->value( QStringLiteral( "proxy/proxyEnabled" ), "0" ).toBool() );
leProxyHost->setText( mSettings->value( QStringLiteral( "proxy/proxyHost" ), "" ).toString() );
leProxyPort->setText( mSettings->value( QStringLiteral( "proxy/proxyPort" ), "" ).toString() );
leProxyUser->setText( mSettings->value( QStringLiteral( "proxy/proxyUser" ), "" ).toString() );
leProxyPassword->setText( mSettings->value( QStringLiteral( "proxy/proxyPassword" ), "" ).toString() );

mAuthSettings->setPassword( mSettings->value( QStringLiteral( "proxy/proxyUser" ), "" ).toString() );
mAuthSettings->setUsername( mSettings->value( QStringLiteral( "proxy/proxyPassword" ), "" ).toString() );

//available proxy types
mProxyTypeComboBox->insertItem( 0, QStringLiteral( "DefaultProxy" ) );
Expand Down Expand Up @@ -1174,14 +1171,14 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/qgis/defaultTileMaxRetry" ), mDefaultTileMaxRetrySpinBox->value() );

// Proxy stored authentication configurations
mSettings->setValue( QStringLiteral( "proxy/authcfg" ), mProxyAuthConfigSelect->configId( ) );
mSettings->setValue( QStringLiteral( "proxy/authcfg" ), mAuthSettings->configId( ) );

//Web proxy settings
mSettings->setValue( QStringLiteral( "proxy/proxyEnabled" ), grpProxy->isChecked() );
mSettings->setValue( QStringLiteral( "proxy/proxyHost" ), leProxyHost->text() );
mSettings->setValue( QStringLiteral( "proxy/proxyPort" ), leProxyPort->text() );
mSettings->setValue( QStringLiteral( "proxy/proxyUser" ), leProxyUser->text() );
mSettings->setValue( QStringLiteral( "proxy/proxyPassword" ), leProxyPassword->text() );
mSettings->setValue( QStringLiteral( "proxy/proxyUser" ), mAuthSettings->username() );
mSettings->setValue( QStringLiteral( "proxy/proxyPassword" ), mAuthSettings->password() );
mSettings->setValue( QStringLiteral( "proxy/proxyType" ), mProxyTypeComboBox->currentText() );

if ( !mCacheDirectory->text().isEmpty() )
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsoptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption

QList< QgsOptionsPageWidget * > mAdditionalOptionWidgets;
QgsLocatorOptionsWidget *mLocatorOptionsWidget = nullptr;
QgsAuthConfigSelect *mProxyAuthConfigSelect = nullptr;

};

Expand Down
102 changes: 32 additions & 70 deletions src/ui/qgsoptionsbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1029</width>
<height>726</height>
<height>878</height>
</rect>
</property>
<property name="minimumSize">
Expand Down Expand Up @@ -349,7 +349,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>846</width>
<width>580</width>
<height>672</height>
</rect>
</property>
Expand Down Expand Up @@ -4892,9 +4892,9 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<property name="geometry">
<rect>
<x>0</x>
<y>-44</y>
<width>846</width>
<height>830</height>
<y>0</y>
<width>866</width>
<height>822</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
Expand Down Expand Up @@ -5119,33 +5119,27 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_18">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QLineEdit" name="leProxyHost"/>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="leProxyPort"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lblProxyPort">
<widget class="QLabel" name="lblProxyHost">
<property name="text">
<string>Port</string>
<string>Host</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblProxyHost">
<item row="1" column="3">
<widget class="QLineEdit" name="leProxyHost"/>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lblProxyPort">
<property name="text">
<string>Host</string>
<string>Port</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="3">
<widget class="QLineEdit" name="leProxyPort"/>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer_27">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -5161,49 +5155,16 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
</property>
</spacer>
</item>
<item row="4" column="1" colspan="2">
<widget class="QTabWidget" name="tabAuth">
<property name="currentIndex">
<number>0</number>
<item row="3" column="2" colspan="2">
<widget class="QGroupBox" name="mAuthGroupBox">
<property name="title">
<string>Authentication</string>
</property>
<widget class="QWidget" name="authLegacy">
<attribute name="title">
<string>Authentication</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_25">
<item row="0" column="0">
<widget class="QLabel" name="lblUser">
<property name="text">
<string>User name</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblPassword">
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leProxyUser">
<property name="toolTip">
<string>Leave this blank if no proxy username / password are required</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsPasswordLineEdit" name="leProxyPassword">
<property name="toolTip">
<string>Leave this blank if no proxy username / password are required</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_23">
<item>
<widget class="QgsAuthSettingsWidget" name="mAuthSettings" native="true"/>
</item>
</layout>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -5477,11 +5438,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<extends>QSpinBox</extends>
<header>qgsspinbox.h</header>
</customwidget>
<customwidget>
<class>QgsPasswordLineEdit</class>
<extends>QLineEdit</extends>
<header>qgspasswordlineedit.h</header>
</customwidget>
<customwidget>
<class>QgsColorSchemeList</class>
<extends>QWidget</extends>
Expand All @@ -5500,6 +5456,12 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<header>qgsautheditorwidgets.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsAuthSettingsWidget</class>
<extends>QWidget</extends>
<header>auth/qgsauthsettingswidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mOptionsListWidget</tabstop>
Expand Down

0 comments on commit 191942a

Please sign in to comment.