Ticket #22056: 22056.patch

File 22056.patch, 2.4 KB (added by taylor.smock, 5 years ago)

Allow Automatically obtain source from current layers to work when the dataset has a source changeset tag applied

  • src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

    diff --git a/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java b/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
    index 0558cfec56..1e0d9b6af0 100644
    a b public class BasicUploadSettingsPanel extends JPanel implements ActionListener,  
    232232     * Add the "source" tag
    233233     * @return The source from the layer info.
    234234     */
    235     private String getSourceFromLayer() {
     235    String getSourceFromLayer() {
    236236        String source = MainApplication.getMap().mapView.getLayerInformationForSourceTag();
    237237        return Utils.shortenString(source, Changeset.MAX_CHANGESET_TAG_LENGTH);
    238238    }
  • src/org/openstreetmap/josm/gui/io/UploadDialog.java

    diff --git a/src/org/openstreetmap/josm/gui/io/UploadDialog.java b/src/org/openstreetmap/josm/gui/io/UploadDialog.java
    index 94b852d758..08f8c92f23 100644
    a b public class UploadDialog extends AbstractUploadDialog implements PreferenceChan  
    238238        model.clear();
    239239        model.putAll(map);          // init with tags from history
    240240        model.putAll(this.dataSet); // overwrite with tags from the dataset
     241        if (Config.getPref().getBoolean("upload.source.obtainautomatically", false)
     242        && this.dataSet.getChangeSetTags().containsKey(UploadDialogModel.SOURCE)) {
     243            model.put(UploadDialogModel.SOURCE, pnlBasicUploadSettings.getSourceFromLayer());
     244        }
    241245
    242246        tpConfigPanels.setSelectedIndex(0);
    243247        pnlTagEditor.initAutoCompletion(MainApplication.getLayerManager().getEditLayer());
  • src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java b/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
    index e804bb9d5d..d862582f82 100644
    a b public class OsmDataLayer extends AbstractOsmDataLayer implements Listener, Data  
    12771277                dialog.getChangeset());
    12781278    }
    12791279
     1280    @Override
     1281    public String getChangesetSourceTag() {
     1282        return this.data.getChangeSetTags().getOrDefault("source", null);
     1283    }
     1284
    12801285    @Override
    12811286    public AbstractUploadDialog getUploadDialog() {
    12821287        UploadDialog dialog = UploadDialog.getUploadDialog();