Changes between Initial Version and Version 2 of Ticket #22817


Ignore:
Timestamp:
2023-03-26T15:29:27+02:00 (3 years ago)
Author:
gaben
Comment:
  • src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

     
    112112    public static boolean saveUnsavedModifications(Iterable<? extends Layer> selectedLayers, Reason reason) {
    113113        if (!GraphicsEnvironment.isHeadless()) {
    114114            SaveLayersDialog dialog = new SaveLayersDialog(MainApplication.getMainFrame());
    115             List<AbstractModifiableLayer> layersWithUnmodifiedChanges = new ArrayList<>();
     115            List<AbstractModifiableLayer> layersWithUnsavedChanges = new ArrayList<>();
    116116            for (Layer l: selectedLayers) {
    117117                if (!(l instanceof AbstractModifiableLayer)) {
    118118                    continue;
     
    121121                if (odl.isModified() &&
    122122                        ((!odl.isSavable() && !odl.isUploadable()) ||
    123123                                odl.requiresSaveToFile() ||
    124                                 (odl.requiresUploadToServer() && !odl.isUploadDiscouraged()))) {
    125                     layersWithUnmodifiedChanges.add(odl);
     124                                odl.requiresUploadToServer())) {
     125                    layersWithUnsavedChanges.add(odl);
    126126                }
    127127            }
    128128            dialog.prepareForSavingAndUpdatingLayers(reason);
    129             if (!layersWithUnmodifiedChanges.isEmpty()) {
    130                 dialog.getModel().populate(layersWithUnmodifiedChanges);
     129            if (!layersWithUnsavedChanges.isEmpty()) {
     130                dialog.getModel().populate(layersWithUnsavedChanges);
    131131                dialog.setVisible(true);
    132132                switch(dialog.getUserAction()) {
    133133                    case PROCEED: return true;

The upload=never option is not affected as in that case the isUploadable() returns false anyway.

I renamed the layersWithUnmodifiedChanges local variable to something more meaningful because the current naming contradicts.

Also whoever commits, the !odl.isSavable() && !odl.isUploadable() seems suspicious. When does it happen?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22817

    • Property Priority normalmajor
    • Property Milestone23.03
    • Property Summary No warning deleting a data layer with changes and discouraged upload set[patch] No warning deleting a data layer with changes and discouraged upload set
  • Ticket #22817 – Description

    initial v2  
    11==== What steps will reproduce the problem?
    2 1. Have a data layer with unsaved changes
    3 1. Set "discourage upload"
     21. Download new data
     31. Make some changes
     41. Set "discourage upload" on the layer
    451. Delete layer
    56