﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
12459	[patch needs rework] layer color resets to default when renaming layer	kolesar	team	"==== What steps will reproduce the problem?
1. Load some GPX data from OSM server.
2. Right-click layer ""Downloaded GPX Data"" in the layer manager.
3. Customize color of layer. (If you have a custom track trawing option, set track and point coloring option to single color.)
4. Rename the layer (or save to GPX file with a different name).
5. Zoom or pan map.

==== What is the expected result?
Color remains the same.

==== What happens instead?
Color is set to default (or another color saved in a previous session).

==== Please provide any additional information below. Attach a screenshot if possible.
Custom layer colors are stored in preferences with a key that contains the name of layer. When layer is renamed or saved on a different name, map paint does not find the setting.

Applying color when a file is reopened is a good idea. Color information should not be saved a preference entry using the file name without full path. This causes WTF experience in the user. I have found this behaviour a problem when I opened several GPX files and some of them were coloured differently.

Name-based colouring is also bad when layers are not renamed or saved as a new file. If you open more than one GPX layers having the same file name and set color to one of them, new color will be applied to all of them.

Color should be stored at layer properties and saved to the file itself. For backwards compatibility saving color to preferences should be an option but not default.

Attached patch that saves color into GPX files and reads back on opening. One color for tracks, one for marker layer. They are handled together on load and save.

Compatibility switch is called `dialog.layer.use-pref-layer-name`, default is off. If someone needs colors saved to preferences, can switch it on. Original rename bug does not affect compatibiliy mode because color stored in layer has precedence."	defect	new	normal		Core	tested			
