Skip to content
Permalink
Browse files

Add settings key to anonymize new projects

Defaults to false, but if set will not automatically set
metadata for newly created projects such as author
and creation date.
  • Loading branch information
nyalldawson committed Mar 20, 2018
1 parent 2eacc4c commit 37c5dd9301ab0f53b398235fa4513821d8c1c545
Showing with 14 additions and 3 deletions.
  1. +7 −0 resources/qgis_global_settings.ini
  2. +7 −3 src/core/qgsproject.cpp
@@ -29,6 +29,13 @@ connections-xyz\OpenStreetMap\username=
connections-xyz\OpenStreetMap\zmax=19
connections-xyz\OpenStreetMap\zmin=0

[core]
# Whether or not to anonymize newly created projects
# If set to 1, then project metadata items like AUTHOR and CREATION DATE
# will not be automatically populated when a new project is created.
projects\anonymize_new_projects=false


[colors]
# These colors are used in logs.
default=
@@ -501,6 +501,8 @@ void QgsProject::setTransformContext( const QgsCoordinateTransformContext &conte

void QgsProject::clear()
{
QgsSettings s;

mFile.setFileName( QString() );
mProperties.clearKeys();
mHomePath.clear();
@@ -510,8 +512,11 @@ void QgsProject::clear()
mTrustLayerMetadata = false;
mCustomVariables.clear();
mMetadata = QgsProjectMetadata();
mMetadata.setCreationDateTime( QDateTime::currentDateTime() );
mMetadata.setAuthor( QgsApplication::userFullName() );
if ( !s.value( QStringLiteral( "projects/anonymize_new_projects" ), false, QgsSettings::Core ).toBool() )
{
mMetadata.setCreationDateTime( QDateTime::currentDateTime() );
mMetadata.setAuthor( QgsApplication::userFullName() );
}
emit metadataChanged();

QgsCoordinateTransformContext context;
@@ -542,7 +547,6 @@ void QgsProject::clear()
writeEntry( QStringLiteral( "Paths" ), QStringLiteral( "/Absolute" ), false );

//copy default units to project
QgsSettings s;
writeEntry( QStringLiteral( "Measurement" ), QStringLiteral( "/DistanceUnits" ), s.value( QStringLiteral( "/qgis/measure/displayunits" ) ).toString() );
writeEntry( QStringLiteral( "Measurement" ), QStringLiteral( "/AreaUnits" ), s.value( QStringLiteral( "/qgis/measure/areaunits" ) ).toString() );

0 comments on commit 37c5dd9

Please sign in to comment.
You can’t perform that action at this time.