Skip to content

Commit 8643177

Browse files
committedOct 23, 2017
[auth] Add connection cache clear options
This fixes a bug that required to restart QGIS after a connection failed due to SSL errors (the connection auth was cached). Also: - added a tab for content and connection auth cache configuration - user feedback on (both) caches cleared - changed icon for content cache clear to a trash bin (after users enquiries about what was that "back/undo" icon for)
1 parent 67b9341 commit 8643177

File tree

3 files changed

+126
-71
lines changed

3 files changed

+126
-71
lines changed
 

‎src/app/qgsoptions.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,15 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
377377
connect( mBrowseCacheDirectory, &QAbstractButton::clicked, this, &QgsOptions::browseCacheDirectory );
378378
connect( mClearCache, &QAbstractButton::clicked, this, &QgsOptions::clearCache );
379379

380+
// Access (auth) cache settings
381+
mAutoClearAccessCache->setChecked( mSettings->value( QStringLiteral( "clear_auth_cache_on_errors" ), true, QgsSettings::Section::Auth ).toBool( ) );
382+
connect( mClearAccessCache, &QAbstractButton::clicked, this, &QgsOptions::clearAccessCache );
383+
384+
connect( mAutoClearAccessCache, &QCheckBox::clicked, this, [ = ]( bool checked )
385+
{
386+
mSettings->setValue( QStringLiteral( "clear_auth_cache_on_errors" ), checked, QgsSettings::Section::Auth );
387+
} );
388+
380389
//wms search server
381390
leWmsSearch->setText( mSettings->value( QStringLiteral( "/qgis/WMSSearchUrl" ), "http://geopole.org/wms/search?search=%1&type=rss" ).toString() );
382391

@@ -1978,6 +1987,13 @@ void QgsOptions::browseCacheDirectory()
19781987
void QgsOptions::clearCache()
19791988
{
19801989
QgsNetworkAccessManager::instance()->cache()->clear();
1990+
QMessageBox::information( this, tr( "Cache cleared" ), tr( "Content cache has been cleared" ) );
1991+
}
1992+
1993+
void QgsOptions::clearAccessCache()
1994+
{
1995+
QgsNetworkAccessManager::instance()->clearAccessCache();
1996+
QMessageBox::information( this, tr( "Cache cleared" ), tr( "Connection authentication cache has been cleared" ) );
19811997
}
19821998

19831999
void QgsOptions::mOptionsStackedWidget_currentChanged( int indx )

‎src/app/qgsoptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
186186
void browseCacheDirectory();
187187
void clearCache();
188188

189+
/**
190+
* \brief clearAuthenticationConnectionCache clears the QNetworkAccessManager
191+
* authentication connection cache
192+
*/
193+
void clearAccessCache();
194+
189195
/**
190196
* Let the user add a scale to the list of scales
191197
* used in scale combobox

‎src/ui/qgsoptionsbase.ui

Lines changed: 104 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
<item>
309309
<widget class="QStackedWidget" name="mOptionsStackedWidget">
310310
<property name="currentIndex">
311-
<number>0</number>
311+
<number>12</number>
312312
</property>
313313
<widget class="QWidget" name="mOptionsPageGeneral">
314314
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -337,15 +337,15 @@
337337
<rect>
338338
<x>0</x>
339339
<y>0</y>
340-
<width>580</width>
341-
<height>672</height>
340+
<width>866</width>
341+
<height>822</height>
342342
</rect>
343343
</property>
344344
<layout class="QVBoxLayout" name="verticalLayout_28">
345345
<item>
346346
<widget class="QgsCollapsibleGroupBox" name="grpLocale">
347347
<property name="title">
348-
<string>O&amp;verride system locale</string>
348+
<string>Override system &amp;locale</string>
349349
</property>
350350
<property name="checkable">
351351
<bool>true</bool>
@@ -1032,7 +1032,7 @@
10321032
<rect>
10331033
<x>0</x>
10341034
<y>0</y>
1035-
<width>537</width>
1035+
<width>846</width>
10361036
<height>1128</height>
10371037
</rect>
10381038
</property>
@@ -1562,8 +1562,8 @@
15621562
<rect>
15631563
<x>0</x>
15641564
<y>0</y>
1565-
<width>499</width>
1566-
<height>754</height>
1565+
<width>866</width>
1566+
<height>822</height>
15671567
</rect>
15681568
</property>
15691569
<layout class="QVBoxLayout" name="verticalLayout_27">
@@ -1930,7 +1930,7 @@
19301930
<rect>
19311931
<x>0</x>
19321932
<y>0</y>
1933-
<width>672</width>
1933+
<width>846</width>
19341934
<height>1043</height>
19351935
</rect>
19361936
</property>
@@ -2681,8 +2681,8 @@
26812681
<rect>
26822682
<x>0</x>
26832683
<y>0</y>
2684-
<width>130</width>
2685-
<height>322</height>
2684+
<width>866</width>
2685+
<height>822</height>
26862686
</rect>
26872687
</property>
26882688
<layout class="QHBoxLayout" name="horizontalLayout_46">
@@ -2832,8 +2832,8 @@
28322832
<rect>
28332833
<x>0</x>
28342834
<y>0</y>
2835-
<width>500</width>
2836-
<height>340</height>
2835+
<width>866</width>
2836+
<height>822</height>
28372837
</rect>
28382838
</property>
28392839
<layout class="QVBoxLayout" name="verticalLayout_25">
@@ -3175,8 +3175,8 @@
31753175
<rect>
31763176
<x>0</x>
31773177
<y>0</y>
3178-
<width>623</width>
3179-
<height>734</height>
3178+
<width>866</width>
3179+
<height>822</height>
31803180
</rect>
31813181
</property>
31823182
<layout class="QVBoxLayout" name="verticalLayout_30">
@@ -3619,8 +3619,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
36193619
<rect>
36203620
<x>0</x>
36213621
<y>0</y>
3622-
<width>491</width>
3623-
<height>610</height>
3622+
<width>866</width>
3623+
<height>822</height>
36243624
</rect>
36253625
</property>
36263626
<layout class="QVBoxLayout" name="verticalLayout_39">
@@ -3888,8 +3888,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
38883888
<rect>
38893889
<x>0</x>
38903890
<y>0</y>
3891-
<width>548</width>
3892-
<height>785</height>
3891+
<width>866</width>
3892+
<height>822</height>
38933893
</rect>
38943894
</property>
38953895
<layout class="QVBoxLayout" name="verticalLayout_31">
@@ -4466,8 +4466,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
44664466
<rect>
44674467
<x>0</x>
44684468
<y>0</y>
4469-
<width>431</width>
4470-
<height>376</height>
4469+
<width>866</width>
4470+
<height>822</height>
44714471
</rect>
44724472
</property>
44734473
<layout class="QVBoxLayout" name="verticalLayout_6">
@@ -4605,8 +4605,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
46054605
<rect>
46064606
<x>0</x>
46074607
<y>0</y>
4608-
<width>418</width>
4609-
<height>544</height>
4608+
<width>866</width>
4609+
<height>822</height>
46104610
</rect>
46114611
</property>
46124612
<layout class="QGridLayout" name="gridLayout_15">
@@ -4755,7 +4755,7 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
47554755
<item row="3" column="0">
47564756
<widget class="QRadioButton" name="radUseGlobalProjection">
47574757
<property name="text">
4758-
<string>Use a default CRS</string>
4758+
<string>&amp;Use a default CRS</string>
47594759
</property>
47604760
</widget>
47614761
</item>
@@ -4947,53 +4947,88 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
49474947
<property name="title">
49484948
<string>Cache settings</string>
49494949
</property>
4950-
<layout class="QGridLayout" name="gridLayout_2">
4951-
<item row="0" column="0">
4952-
<widget class="QLabel" name="label_10">
4953-
<property name="text">
4954-
<string>Directory</string>
4955-
</property>
4956-
</widget>
4957-
</item>
4958-
<item row="0" column="1">
4959-
<widget class="QLineEdit" name="mCacheDirectory"/>
4960-
</item>
4961-
<item row="0" column="2">
4962-
<widget class="QToolButton" name="mBrowseCacheDirectory">
4963-
<property name="toolTip">
4964-
<string>Select folder</string>
4965-
</property>
4966-
<property name="text">
4967-
<string/>
4968-
</property>
4969-
<property name="icon">
4970-
<iconset resource="../../images/images.qrc">
4971-
<normaloff>:/images/themes/default/mActionFileOpen.svg</normaloff>:/images/themes/default/mActionFileOpen.svg</iconset>
4972-
</property>
4973-
</widget>
4974-
</item>
4975-
<item row="2" column="0">
4976-
<widget class="QLabel" name="label_11">
4977-
<property name="text">
4978-
<string>Size [KiB]</string>
4979-
</property>
4980-
</widget>
4981-
</item>
4982-
<item row="2" column="1">
4983-
<widget class="QSpinBox" name="mCacheSize"/>
4984-
</item>
4985-
<item row="2" column="2">
4986-
<widget class="QToolButton" name="mClearCache">
4987-
<property name="toolTip">
4988-
<string>Clear</string>
4989-
</property>
4990-
<property name="text">
4991-
<string/>
4992-
</property>
4993-
<property name="icon">
4994-
<iconset resource="../../images/images.qrc">
4995-
<normaloff>:/images/themes/default/mActionUndo.svg</normaloff>:/images/themes/default/mActionUndo.svg</iconset>
4950+
<layout class="QVBoxLayout" name="verticalLayout_19">
4951+
<item>
4952+
<widget class="QTabWidget" name="tabContentCache">
4953+
<property name="currentIndex">
4954+
<number>0</number>
49964955
</property>
4956+
<widget class="QWidget" name="tab">
4957+
<attribute name="title">
4958+
<string>Content</string>
4959+
</attribute>
4960+
<layout class="QGridLayout" name="gridLayout_2">
4961+
<item row="4" column="0">
4962+
<widget class="QLabel" name="label_11">
4963+
<property name="text">
4964+
<string>Size [KiB]</string>
4965+
</property>
4966+
</widget>
4967+
</item>
4968+
<item row="0" column="0">
4969+
<widget class="QLabel" name="label_10">
4970+
<property name="text">
4971+
<string>Directory</string>
4972+
</property>
4973+
</widget>
4974+
</item>
4975+
<item row="0" column="1">
4976+
<widget class="QLineEdit" name="mCacheDirectory"/>
4977+
</item>
4978+
<item row="4" column="1">
4979+
<widget class="QSpinBox" name="mCacheSize"/>
4980+
</item>
4981+
<item row="0" column="2">
4982+
<widget class="QToolButton" name="mBrowseCacheDirectory">
4983+
<property name="toolTip">
4984+
<string>Select folder</string>
4985+
</property>
4986+
<property name="text">
4987+
<string/>
4988+
</property>
4989+
<property name="icon">
4990+
<iconset resource="../../images/images.qrc">
4991+
<normaloff>:/images/themes/default/mActionFileOpen.svg</normaloff>:/images/themes/default/mActionFileOpen.svg</iconset>
4992+
</property>
4993+
</widget>
4994+
</item>
4995+
<item row="4" column="2">
4996+
<widget class="QToolButton" name="mClearCache">
4997+
<property name="toolTip">
4998+
<string>Clear cache</string>
4999+
</property>
5000+
<property name="text">
5001+
<string/>
5002+
</property>
5003+
<property name="icon">
5004+
<iconset resource="../../images/images.qrc">
5005+
<normaloff>:/images/themes/default/mActionDeleteSelected.svg</normaloff>:/images/themes/default/mActionDeleteSelected.svg</iconset>
5006+
</property>
5007+
</widget>
5008+
</item>
5009+
</layout>
5010+
</widget>
5011+
<widget class="QWidget" name="tab_2">
5012+
<attribute name="title">
5013+
<string>Authentication</string>
5014+
</attribute>
5015+
<layout class="QGridLayout" name="gridLayout_5">
5016+
<item row="0" column="0">
5017+
<widget class="QCheckBox" name="mAutoClearAccessCache">
5018+
<property name="text">
5019+
<string>Automatically clear the connection authentication cache on SSL errors</string>
5020+
</property>
5021+
</widget>
5022+
</item>
5023+
<item row="1" column="0">
5024+
<widget class="QPushButton" name="mClearAccessCache">
5025+
<property name="text">
5026+
<string>Clear authentication connection cache</string>
5027+
</property>
5028+
</widget>
5029+
</item>
5030+
</layout>
5031+
</widget>
49975032
</widget>
49985033
</item>
49995034
</layout>
@@ -5610,9 +5645,7 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
56105645
<tabstop>mDefaultTileMaxRetrySpinBox</tabstop>
56115646
<tabstop>leUserAgent</tabstop>
56125647
<tabstop>mCacheDirectory</tabstop>
5613-
<tabstop>mBrowseCacheDirectory</tabstop>
56145648
<tabstop>mCacheSize</tabstop>
5615-
<tabstop>mClearCache</tabstop>
56165649
<tabstop>grpProxy</tabstop>
56175650
<tabstop>mProxyTypeComboBox</tabstop>
56185651
<tabstop>leProxyHost</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.