@@ -339,8 +339,9 @@ void QgsCustomProjectionDialog::insertProjection( const QString &projectionAcro
339
339
}
340
340
}
341
341
342
- bool QgsCustomProjectionDialog::saveCrs ( QgsCoordinateReferenceSystem parameters, const QString &name, QString id , bool newEntry )
342
+ bool QgsCustomProjectionDialog::saveCrs ( QgsCoordinateReferenceSystem parameters, const QString &name, const QString &existingId , bool newEntry )
343
343
{
344
+ QString id = existingId;
344
345
QString sql;
345
346
int returnId;
346
347
QString projectionAcronym = parameters.projectionAcronym ();
@@ -504,37 +505,37 @@ void QgsCustomProjectionDialog::buttonBox_accepted()
504
505
}
505
506
}
506
507
// Modify the CRS changed:
507
- bool save_success = true ;
508
+ bool saveSuccess = true ;
508
509
for ( int i = 0 ; i < mCustomCRSids .size (); ++i )
509
510
{
510
511
CRS.createFromProj4 ( mCustomCRSparameters [i] );
511
512
// Test if we just added this CRS (if it has no existing ID)
512
- if ( ! mCustomCRSids [i].isEmpty () )
513
+ if ( mCustomCRSids [i].isEmpty () )
513
514
{
514
- save_success &= saveCrs ( CRS, mCustomCRSnames [i], QLatin1String ( " " ), true );
515
+ saveSuccess &= saveCrs ( CRS, mCustomCRSnames [i], QString ( ), true );
515
516
}
516
517
else
517
518
{
518
519
if ( mExistingCRSnames [mCustomCRSids [i]] != mCustomCRSnames [i] || mExistingCRSparameters [mCustomCRSids [i]] != mCustomCRSparameters [i] )
519
520
{
520
- save_success &= saveCrs ( CRS, mCustomCRSnames [i], mCustomCRSids [i], false );
521
+ saveSuccess &= saveCrs ( CRS, mCustomCRSnames [i], mCustomCRSids [i], false );
521
522
}
522
523
}
523
- if ( ! save_success )
524
+ if ( ! saveSuccess )
524
525
{
525
526
QgsDebugMsg ( QString ( " Error when saving CRS '%1'" ).arg ( mCustomCRSnames [i] ) );
526
527
}
527
528
}
528
529
QgsDebugMsg ( " We remove the deleted CRS." );
529
530
for ( int i = 0 ; i < mDeletedCRSs .size (); ++i )
530
531
{
531
- save_success &= deleteCrs ( mDeletedCRSs [i] );
532
- if ( ! save_success )
532
+ saveSuccess &= deleteCrs ( mDeletedCRSs [i] );
533
+ if ( ! saveSuccess )
533
534
{
534
535
QgsDebugMsg ( QString ( " Problem for layer '%1'" ).arg ( mCustomCRSparameters [i] ) );
535
536
}
536
537
}
537
- if ( save_success )
538
+ if ( saveSuccess )
538
539
{
539
540
accept ();
540
541
}
0 commit comments