Changeset 5865 in josm


Ignore:
Timestamp:
2013-04-14T23:32:18+02:00 (12 years ago)
Author:
stoecker
Message:

fix user agent handling a bit (applet code now sets user agent

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r5761 r5865  
    315315            cacheDirFile = new File(path).getAbsoluteFile();
    316316        } else {
    317             path = Main.pref.get("cache.folder", null);
     317            path = get("cache.folder", null);
    318318            if (path != null) {
    319319                cacheDirFile = new File(path);
     
    339339    public Collection<String> getAllPossiblePreferenceDirs() {
    340340        LinkedList<String> locations = new LinkedList<String>();
    341         locations.add(Main.pref.getPreferencesDir());
     341        locations.add(getPreferencesDir());
    342342        String s;
    343343        if ((s = System.getenv("JOSM_RESOURCES")) != null) {
     
    13191319    public void updateSystemProperties() {
    13201320        updateSystemProperty("http.agent", Version.getInstance().getAgentString());
    1321         updateSystemProperty("user.language", Main.pref.get("language"));
     1321        updateSystemProperty("user.language", get("language"));
    13221322        // Workaround to fix a Java bug.
    13231323        // Force AWT toolkit to update its internal preferences (fix #3645).
  • trunk/src/org/openstreetmap/josm/gui/MainApplet.java

    r5829 r5865  
    102102        String lang = getParameter("language");
    103103        I18n.set(lang != null ? lang : Main.pref.get("language", null));
     104        Main.pref.updateSystemProperties();
    104105
    105106        try
     
    132133
    133134        Main.preConstructorInit(Option.fromStringMap(args));
     135        Main.pref.updateSystemProperties();
    134136        Main.parent = frame;
    135137
  • trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java

    r3746 r5865  
    1313
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.data.Version;
    1516import org.openstreetmap.josm.data.osm.Changeset;
    1617import org.openstreetmap.josm.gui.tagging.TagEditorPanel;
     
    4445        build();
    4546        pnlTagEditor.getModel().addTableModelListener(this);
    46     }
    47 
    48     /**
    49      * Replies the default value for "created_by"
    50      *
    51      * @return the default value for "created_by"
    52      */
    53     public static String getDefaultCreatedBy() {
    54         Object ua = System.getProperties().get("http.agent");
    55         return(ua == null) ? "JOSM" : ua.toString();
    5647    }
    5748
     
    9384            tags.put("comment", currentComment);
    9485        }
     86        String agent = Version.getInstance().getAgentString();
    9587        String created_by = tags.get("created_by");
    96         if (created_by == null || "".equals(created_by)) {
    97             tags.put("created_by", getDefaultCreatedBy());
    98         } else if (!created_by.contains(getDefaultCreatedBy())) {
    99             tags.put("created_by", created_by + ";" + getDefaultCreatedBy());
     88        if (created_by == null || created_by.isEmpty()) {
     89            tags.put("created_by", agent);
     90        } else if (!created_by.contains(agent)) {
     91            tags.put("created_by", created_by + ";" + agent);
    10092        }
    10193        pnlTagEditor.getModel().initFromTags(tags);
Note: See TracChangeset for help on using the changeset viewer.