id summary reporter owner description type status priority milestone component version resolution keywords cc 12462 [patch] Extend Save Layers dialog for more layer types holgermappt bastiK "This patch adds functionality that allows all layers to indicate that they contain modified data. That is done by inheriting from `AbstractModifiableLayer`. So far only `OsmDataLayer` and `NoteLayer` have that capability. A layer with modified data is added to the ''Unsaved Changes'' dialog. Layers indicate how they can save data by implementing one or all of the interfaces `UploadToServer` and `SaveToFile`. Layers that cannot save or upload their data are added to the dialog, but the only way to save their data is to save a session file. The dialog reflects the layer capabilities accordingly. == Changes == * Added interfaces `UploadToServer` and `SaveToFile`. They are intended to be used by layers that are able to upload data to a server or to save changes to a file. I added them to document what a layer intends to do, not to enforce the implementation of the interfaces. It is a little bit redundant since `AbstractModifiableLayer` implements the interfaces and the layers that implement one of the interfaces inherit from `AbstractModifiableLayer`. * `AbstractModifiableLayer`: * Added method `isUploadable()`. The related `isSavable()` is defined in `Layer`. Not sure if it is better to define both in `Layer` because of similarities. But `isUploadable()` is not needed in `Layer`, so I defined it here. * Implement interfaces `UploadToServer` and `SaveToFile`. * `NoteLayer`, `OsmDataLayer`: Implement interfaces `UploadToServer` and `SaveToFile`. Declare that the layer can upload. * `GeoImageLayer`: Inherit from `AbstractModifiableLayer`, added method `isModified()`. None of the interfaces is implemented. * `Main`: Add layer to dialog if it requires save or upload or if it has no save or upload capability. * `ActionFlagsTableCell`: Update the panel according to layer save/upload capabilities. * `LayerNameAndFilePathTableCell`: Add file chooser only if the layer can save to a file. * `SaveLayerInfo`: Added methods `isSavable()` and `isUploadable()`. * `SaveLayersModel`: Set doSaveToFile only if the layer can be saved to a file. * `SaveLayersTableColumnModel`: Make addition of empty line that aligns the ''Recommended Actions'' cell content with the ''Actions To Take'' cell dependent on actions. == Open Issues == * If a layer with geotagged images is part of the dialog, then some table cells turn white if they receive the focus: * Edit the GPS data of a photo (either correlate with a GPX track or move it with the photoadjust plugin), then delete the layer. In the ''Unsaved Changes'' dialog click in the ''Actions To Take'' cell of the ''Geotagged Images'' layer, then click in the ''Layer Name and File Path'' cell. The ''Layer Name and File Path'' cell becomes white. What could cause this? == References == * #12075 - Warn user before closing JOSM with unsaved adjusted pictures * [[https://lists.openstreetmap.org/pipermail/josm-dev/2015-December/007581.html|[josm-dev] How to ask for confirmation at layer deletion or exit?]] " enhancement closed normal 16.02 Core fixed Klumbumbus