Skip to content

Commit 191942a

Browse files
committedOct 3, 2017
[auth] Proxy settings use the new auth settings dialog
1 parent c856ba3 commit 191942a

File tree

3 files changed

+41
-83
lines changed

3 files changed

+41
-83
lines changed
 

‎src/app/qgsoptions.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -309,21 +309,18 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
309309
mDefaultTileMaxRetrySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileMaxRetry" ), "3" ).toInt() );
310310

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

321317
//Web proxy settings
322318
grpProxy->setChecked( mSettings->value( QStringLiteral( "proxy/proxyEnabled" ), "0" ).toBool() );
323319
leProxyHost->setText( mSettings->value( QStringLiteral( "proxy/proxyHost" ), "" ).toString() );
324320
leProxyPort->setText( mSettings->value( QStringLiteral( "proxy/proxyPort" ), "" ).toString() );
325-
leProxyUser->setText( mSettings->value( QStringLiteral( "proxy/proxyUser" ), "" ).toString() );
326-
leProxyPassword->setText( mSettings->value( QStringLiteral( "proxy/proxyPassword" ), "" ).toString() );
321+
322+
mAuthSettings->setPassword( mSettings->value( QStringLiteral( "proxy/proxyUser" ), "" ).toString() );
323+
mAuthSettings->setUsername( mSettings->value( QStringLiteral( "proxy/proxyPassword" ), "" ).toString() );
327324

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

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

11791176
//Web proxy settings
11801177
mSettings->setValue( QStringLiteral( "proxy/proxyEnabled" ), grpProxy->isChecked() );
11811178
mSettings->setValue( QStringLiteral( "proxy/proxyHost" ), leProxyHost->text() );
11821179
mSettings->setValue( QStringLiteral( "proxy/proxyPort" ), leProxyPort->text() );
1183-
mSettings->setValue( QStringLiteral( "proxy/proxyUser" ), leProxyUser->text() );
1184-
mSettings->setValue( QStringLiteral( "proxy/proxyPassword" ), leProxyPassword->text() );
1180+
mSettings->setValue( QStringLiteral( "proxy/proxyUser" ), mAuthSettings->username() );
1181+
mSettings->setValue( QStringLiteral( "proxy/proxyPassword" ), mAuthSettings->password() );
11851182
mSettings->setValue( QStringLiteral( "proxy/proxyType" ), mProxyTypeComboBox->currentText() );
11861183

11871184
if ( !mCacheDirectory->text().isEmpty() )

‎src/app/qgsoptions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
256256

257257
QList< QgsOptionsPageWidget * > mAdditionalOptionWidgets;
258258
QgsLocatorOptionsWidget *mLocatorOptionsWidget = nullptr;
259-
QgsAuthConfigSelect *mProxyAuthConfigSelect = nullptr;
260259

261260
};
262261

‎src/ui/qgsoptionsbase.ui

Lines changed: 32 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>1029</width>
10-
<height>726</height>
10+
<height>878</height>
1111
</rect>
1212
</property>
1313
<property name="minimumSize">
@@ -349,7 +349,7 @@
349349
<rect>
350350
<x>0</x>
351351
<y>0</y>
352-
<width>846</width>
352+
<width>580</width>
353353
<height>672</height>
354354
</rect>
355355
</property>
@@ -4892,9 +4892,9 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
48924892
<property name="geometry">
48934893
<rect>
48944894
<x>0</x>
4895-
<y>-44</y>
4896-
<width>846</width>
4897-
<height>830</height>
4895+
<y>0</y>
4896+
<width>866</width>
4897+
<height>822</height>
48984898
</rect>
48994899
</property>
49004900
<layout class="QVBoxLayout" name="verticalLayout_33">
@@ -5119,33 +5119,27 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
51195119
<enum>QFrame::Raised</enum>
51205120
</property>
51215121
<layout class="QGridLayout" name="gridLayout_18">
5122-
<property name="leftMargin">
5123-
<number>0</number>
5124-
</property>
5125-
<property name="rightMargin">
5126-
<number>0</number>
5127-
</property>
5128-
<item row="0" column="2">
5129-
<widget class="QLineEdit" name="leProxyHost"/>
5130-
</item>
51315122
<item row="1" column="2">
5132-
<widget class="QLineEdit" name="leProxyPort"/>
5133-
</item>
5134-
<item row="1" column="1">
5135-
<widget class="QLabel" name="lblProxyPort">
5123+
<widget class="QLabel" name="lblProxyHost">
51365124
<property name="text">
5137-
<string>Port</string>
5125+
<string>Host</string>
51385126
</property>
51395127
</widget>
51405128
</item>
5141-
<item row="0" column="1">
5142-
<widget class="QLabel" name="lblProxyHost">
5129+
<item row="1" column="3">
5130+
<widget class="QLineEdit" name="leProxyHost"/>
5131+
</item>
5132+
<item row="2" column="2">
5133+
<widget class="QLabel" name="lblProxyPort">
51435134
<property name="text">
5144-
<string>Host</string>
5135+
<string>Port</string>
51455136
</property>
51465137
</widget>
51475138
</item>
5148-
<item row="1" column="0">
5139+
<item row="2" column="3">
5140+
<widget class="QLineEdit" name="leProxyPort"/>
5141+
</item>
5142+
<item row="2" column="1">
51495143
<spacer name="horizontalSpacer_27">
51505144
<property name="orientation">
51515145
<enum>Qt::Horizontal</enum>
@@ -5161,49 +5155,16 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
51615155
</property>
51625156
</spacer>
51635157
</item>
5164-
<item row="4" column="1" colspan="2">
5165-
<widget class="QTabWidget" name="tabAuth">
5166-
<property name="currentIndex">
5167-
<number>0</number>
5158+
<item row="3" column="2" colspan="2">
5159+
<widget class="QGroupBox" name="mAuthGroupBox">
5160+
<property name="title">
5161+
<string>Authentication</string>
51685162
</property>
5169-
<widget class="QWidget" name="authLegacy">
5170-
<attribute name="title">
5171-
<string>Authentication</string>
5172-
</attribute>
5173-
<layout class="QGridLayout" name="gridLayout_25">
5174-
<item row="0" column="0">
5175-
<widget class="QLabel" name="lblUser">
5176-
<property name="text">
5177-
<string>User name</string>
5178-
</property>
5179-
</widget>
5180-
</item>
5181-
<item row="2" column="0">
5182-
<widget class="QLabel" name="lblPassword">
5183-
<property name="text">
5184-
<string>Password</string>
5185-
</property>
5186-
</widget>
5187-
</item>
5188-
<item row="0" column="1">
5189-
<widget class="QLineEdit" name="leProxyUser">
5190-
<property name="toolTip">
5191-
<string>Leave this blank if no proxy username / password are required</string>
5192-
</property>
5193-
</widget>
5194-
</item>
5195-
<item row="2" column="1">
5196-
<widget class="QgsPasswordLineEdit" name="leProxyPassword">
5197-
<property name="toolTip">
5198-
<string>Leave this blank if no proxy username / password are required</string>
5199-
</property>
5200-
<property name="echoMode">
5201-
<enum>QLineEdit::Password</enum>
5202-
</property>
5203-
</widget>
5204-
</item>
5205-
</layout>
5206-
</widget>
5163+
<layout class="QVBoxLayout" name="verticalLayout_23">
5164+
<item>
5165+
<widget class="QgsAuthSettingsWidget" name="mAuthSettings" native="true"/>
5166+
</item>
5167+
</layout>
52075168
</widget>
52085169
</item>
52095170
</layout>
@@ -5477,11 +5438,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
54775438
<extends>QSpinBox</extends>
54785439
<header>qgsspinbox.h</header>
54795440
</customwidget>
5480-
<customwidget>
5481-
<class>QgsPasswordLineEdit</class>
5482-
<extends>QLineEdit</extends>
5483-
<header>qgspasswordlineedit.h</header>
5484-
</customwidget>
54855441
<customwidget>
54865442
<class>QgsColorSchemeList</class>
54875443
<extends>QWidget</extends>
@@ -5500,6 +5456,12 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
55005456
<header>qgsautheditorwidgets.h</header>
55015457
<container>1</container>
55025458
</customwidget>
5459+
<customwidget>
5460+
<class>QgsAuthSettingsWidget</class>
5461+
<extends>QWidget</extends>
5462+
<header>auth/qgsauthsettingswidget.h</header>
5463+
<container>1</container>
5464+
</customwidget>
55035465
</customwidgets>
55045466
<tabstops>
55055467
<tabstop>mOptionsListWidget</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.