Opened 9 years ago

Last modified 8 years ago

#14864 closed enhancement

[PATCH] Add a new preference to remember changeset tags, and include them by default in all changesets — at Version 1

Reported by: rorym Owned by: team
Priority: normal Milestone:
Component: Core Version: latest
Keywords: tags, changeset, upload Cc:

Description (last modified by Don-vip)

I suggest adding a new preference upload.changeset.tags.additional, a list of Strings, which will be the additional tags that will be added to every changeset by default. This patch enables this feature. It applies clearly on r12285 (current HEAD), and I have tested it when submitting changesets to OSM.org.

There are suggested changeset tags, and this patch makes it easy to "remember" a set of changeset tags by putting them in your preferences. Otherwise you have to enter the changeset tags all the time.

I hope this is merged, but am open to discussion.

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

     
    1616import java.beans.PropertyChangeEvent;
    1717import java.beans.PropertyChangeListener;
    1818import java.lang.Character.UnicodeBlock;
     19import java.util.Arrays;
    1920import java.util.ArrayList;
    2021import java.util.Collection;
    2122import java.util.Collections;
     
    269270    /**
    270271     * Sets the tags for this upload based on (later items overwrite earlier ones):
    271272     * <ul>
     273     * <li>From the upload.changeset.tags.additional prefence</li>
    272274     * <li>previous "source" and "comment" input</li>
    273275     * <li>the tags set in the dataset (see {@link DataSet#getChangeSetTags()})</li>
    274276     * <li>the tags from the selected open changeset</li>
     
    280282    public void setChangesetTags(DataSet dataSet) {
    281283        final Map<String, String> tags = new HashMap<>();
    282284
     285        // From preferences
     286        // TODO is there a better way to read this, as a Map, rather than List/Collection?
     287        Collection<String> tags_from_prefs = Main.pref.getCollection("upload.changeset.tags.additional", Arrays.asList(new String[] {}));
     288        for (Iterator<String> iterator = tags_from_prefs.iterator(); iterator.hasNext();) {
     289            tags.put(iterator.next(), iterator.next());
     290        }
     291
    283292        // obtain from previous input
    284293        tags.put("source", getLastChangesetSourceFromHistory());
    285294        tags.put("comment", getLastChangesetCommentFromHistory());

Change History (1)

comment:1 by Don-vip, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.