@@ -138,7 +138,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
138138 mRemoveCustomVarBtn ->setEnabled ( false );
139139 mCustomVariablesTable ->setEnabled ( false );
140140 }
141- QStringList customVarsList = mSettings ->value ( QStringLiteral ( " qgis/customEnvVars" ), " " ).toStringList ();
141+ QStringList customVarsList = mSettings ->value ( QStringLiteral ( " qgis/customEnvVars" ) ).toStringList ();
142142 Q_FOREACH ( const QString &varStr, customVarsList )
143143 {
144144 int pos = varStr.indexOf ( QLatin1Char ( ' |' ) );
@@ -221,25 +221,20 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
221221 mCurrentVariablesTable ->resizeColumnToContents ( 0 );
222222
223223 // local directories to search when loading c++ plugins
224- QString myPaths = mSettings ->value ( QStringLiteral ( " plugins/searchPathsForPlugins" ), " " ). toString ();
225- if ( !myPaths. isEmpty () )
224+ QStringList pathList = mSettings ->value ( QStringLiteral ( " plugins/searchPathsForPlugins" ) ). toStringList ();
225+ Q_FOREACH ( const QString& path, pathList )
226226 {
227- QStringList myPathList = myPaths.split ( ' |' );
228- QStringList::const_iterator pathIt = myPathList.constBegin ();
229- for ( ; pathIt != myPathList.constEnd (); ++pathIt )
230- {
231- QListWidgetItem* newItem = new QListWidgetItem ( mListPluginPaths );
232- newItem->setText ( *pathIt );
233- newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
234- mListPluginPaths ->addItem ( newItem );
235- }
227+ QListWidgetItem* newItem = new QListWidgetItem ( mListPluginPaths );
228+ newItem->setText ( path );
229+ newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
230+ mListPluginPaths ->addItem ( newItem );
236231 }
237232
238233 // local directories to search when looking for an SVG with a given basename
239- QStringList svgPaths = QgsApplication::svgPaths ();
240- if ( !svgPaths .isEmpty () )
234+ pathList = QgsApplication::svgPaths ();
235+ if ( !pathList .isEmpty () )
241236 {
242- Q_FOREACH ( const QString& path, svgPaths )
237+ Q_FOREACH ( const QString& path, pathList )
243238 {
244239 QListWidgetItem* newItem = new QListWidgetItem ( mListSVGPaths );
245240 newItem->setText ( path );
@@ -248,10 +243,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
248243 }
249244 }
250245
251- QStringList templatePaths = QgsApplication::composerTemplatePaths ();
252- if ( !templatePaths.isEmpty () )
246+ // local directories to search when looking for a composer templates
247+ pathList = QgsApplication::composerTemplatePaths ();
248+ if ( !pathList.isEmpty () )
253249 {
254- Q_FOREACH ( const QString& path, templatePaths )
250+ Q_FOREACH ( const QString& path, pathList )
255251 {
256252 QListWidgetItem* newItem = new QListWidgetItem ( mListComposerTemplatePaths );
257253 newItem->setText ( path );
@@ -260,13 +256,12 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
260256 }
261257 }
262258
263- QStringList hiddenItems = mSettings ->value ( QStringLiteral ( " /browser/hiddenPaths" ),
264- QStringList () ).toStringList ();
265- QStringList::const_iterator pathIt = hiddenItems.constBegin ();
266- for ( ; pathIt != hiddenItems.constEnd (); ++pathIt )
259+ // paths hidden from browser
260+ pathList = mSettings ->value ( QStringLiteral ( " /browser/hiddenPaths" ) ).toStringList ();
261+ Q_FOREACH ( const QString& path, pathList )
267262 {
268263 QListWidgetItem* newItem = new QListWidgetItem ( mListHiddenBrowserPaths );
269- newItem->setText ( *pathIt );
264+ newItem->setText ( path );
270265 mListHiddenBrowserPaths ->addItem ( newItem );
271266 }
272267
@@ -300,18 +295,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
300295 mProxyTypeComboBox ->setCurrentIndex ( mProxyTypeComboBox ->findText ( settingProxyType ) );
301296
302297 // URLs excluded not going through proxies
303- QString proxyExcludedURLs = mSettings ->value ( QStringLiteral ( " proxy/proxyExcludedUrls" ), " " ). toString ();
304- if ( !proxyExcludedURLs. isEmpty () )
298+ pathList = mSettings ->value ( QStringLiteral ( " proxy/proxyExcludedUrls" ) ). toStringList ();
299+ Q_FOREACH ( const QString& path, pathList )
305300 {
306- QStringList splitUrls = proxyExcludedURLs.split ( ' |' );
307- QStringList::const_iterator urlIt = splitUrls.constBegin ();
308- for ( ; urlIt != splitUrls.constEnd (); ++urlIt )
309- {
310- QListWidgetItem* newItem = new QListWidgetItem ( mExcludeUrlListWidget );
311- newItem->setText ( *urlIt );
312- newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
313- mExcludeUrlListWidget ->addItem ( newItem );
314- }
301+ QListWidgetItem* newItem = new QListWidgetItem ( mExcludeUrlListWidget );
302+ newItem->setText ( path );
303+ newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
304+ mExcludeUrlListWidget ->addItem ( newItem );
315305 }
316306
317307 // cache settings
@@ -731,7 +721,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
731721 spinZoomFactor->setValue ( mSettings ->value ( QStringLiteral ( " /qgis/zoom_factor" ), 2 ).toDouble () );
732722
733723 // predefined scales for scale combobox
734- myPaths = mSettings ->value ( QStringLiteral ( " Map/scales" ), PROJECT_SCALES ).toString ();
724+ QString myPaths = mSettings ->value ( QStringLiteral ( " Map/scales" ), PROJECT_SCALES ).toString ();
735725 if ( !myPaths.isEmpty () )
736726 {
737727 QStringList myScalesList = myPaths.split ( ' ,' );
@@ -933,8 +923,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
933923 mVariableEditor ->reloadContext ();
934924 mVariableEditor ->setEditableScopeIndex ( 0 );
935925
936-
937-
938926 mAdvancedSettingsEditor ->setSettingsObject ( mSettings );
939927
940928 // restore window and widget geometry/state
@@ -1077,46 +1065,34 @@ void QgsOptions::saveOptions()
10771065 mSettings ->setValue ( QStringLiteral ( " qgis/customEnvVars" ), QVariant ( customVars ) );
10781066
10791067 // search directories for user plugins
1080- QString myPaths ;
1068+ QStringList pathsList ;
10811069 for ( int i = 0 ; i < mListPluginPaths ->count (); ++i )
10821070 {
1083- if ( i != 0 )
1084- {
1085- myPaths += ' |' ;
1086- }
1087- myPaths += mListPluginPaths ->item ( i )->text ();
1071+ pathsList << mListPluginPaths ->item ( i )->text ();
10881072 }
1089- mSettings ->setValue ( QStringLiteral ( " plugins/searchPathsForPlugins " ), myPaths );
1073+ mSettings ->setValue ( QStringLiteral ( " help/helpSearchPath " ), pathsList );
10901074
10911075 // search directories for svgs
1092- myPaths .clear ();
1076+ pathsList .clear ();
10931077 for ( int i = 0 ; i < mListSVGPaths ->count (); ++i )
10941078 {
1095- if ( i != 0 )
1096- {
1097- myPaths += ' |' ;
1098- }
1099- myPaths += mListSVGPaths ->item ( i )->text ();
1079+ pathsList << mListSVGPaths ->item ( i )->text ();
11001080 }
1101- mSettings ->setValue ( QStringLiteral ( " svg/searchPathsForSVG" ), myPaths );
1081+ mSettings ->setValue ( QStringLiteral ( " svg/searchPathsForSVG" ), pathsList );
11021082
1103- myPaths .clear ();
1083+ pathsList .clear ();
11041084 for ( int i = 0 ; i < mListComposerTemplatePaths ->count (); ++i )
11051085 {
1106- if ( i != 0 )
1107- {
1108- myPaths += ' |' ;
1109- }
1110- myPaths += mListComposerTemplatePaths ->item ( i )->text ();
1086+ pathsList << mListComposerTemplatePaths ->item ( i )->text ();
11111087 }
1112- mSettings ->setValue ( QStringLiteral ( " composer/searchPathsForTemplates" ), myPaths );
1088+ mSettings ->setValue ( QStringLiteral ( " composer/searchPathsForTemplates" ), pathsList );
11131089
1114- QStringList paths ;
1090+ pathsList. clear () ;
11151091 for ( int i = 0 ; i < mListHiddenBrowserPaths ->count (); ++i )
11161092 {
1117- paths << mListHiddenBrowserPaths ->item ( i )->text ();
1093+ pathsList << mListHiddenBrowserPaths ->item ( i )->text ();
11181094 }
1119- mSettings ->setValue ( QStringLiteral ( " /browser/hiddenPaths" ), paths );
1095+ mSettings ->setValue ( QStringLiteral ( " /browser/hiddenPaths" ), pathsList );
11201096
11211097 // Network timeout
11221098 mSettings ->setValue ( QStringLiteral ( " /qgis/networkAndProxy/networkTimeout" ), mNetworkTimeoutSpinBox ->value () );
@@ -1398,7 +1374,7 @@ void QgsOptions::saveOptions()
13981374 mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/offset_miter_limit" ), mCurveOffsetMiterLimitComboBox ->value () );
13991375
14001376 // default scale list
1401- myPaths. clear () ;
1377+ QString myPaths;
14021378 for ( int i = 0 ; i < mListGlobalScales ->count (); ++i )
14031379 {
14041380 if ( i != 0 )
0 commit comments