Skip to content

Commit c3690eb

Browse files
author
jef
committed
[FEATURE] default to last selection when prompting for CRS
git-svn-id: http://svn.osgeo.org/qgis/trunk@15498 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 97dd304 commit c3690eb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/app/qgisapp.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static QgsMessageOutput *messageOutputViewer_()
319319
*/
320320
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
321321
{
322-
QString authid;
322+
static QString authid = QString::null;
323323
QSettings mySettings;
324324
QString myDefaultProjectionOption = mySettings.value( "/Projections/defaultBehaviour" ).toString();
325325
if ( myDefaultProjectionOption == "prompt" )
@@ -329,7 +329,8 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
329329

330330
QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
331331
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
332-
authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID );
332+
if ( authid.isNull() )
333+
authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID );
333334
QgsCoordinateReferenceSystem defaultCrs;
334335
if ( defaultCrs.createFromOgcWmsCrs( authid ) )
335336
{
@@ -341,6 +342,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
341342
if ( mySelector->exec() )
342343
{
343344
QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
345+
authid = mySelector->selectedAuthId();
344346
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
345347
}
346348

@@ -358,8 +360,9 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
358360
}
359361
else ///Projections/defaultBehaviour==useGlobal
360362
{
361-
srs->createFromOgcWmsCrs( mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString() );
362-
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS" ) );
363+
authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
364+
srs->createFromOgcWmsCrs( authid );
365+
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
363366
}
364367
}
365368

0 commit comments

Comments
 (0)