Changeset 6631 in josm for trunk/src/org


Ignore:
Timestamp:
2014-01-05T13:22:24+01:00 (11 years ago)
Author:
simon04
Message:

Fix strange effect of UploadDialog where the changeset comment obtained from history was overwritten with an empty value

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r6590 r6631  
    236236                    tags.put("source", Main.map.mapView.getLayerInformationForSourceTag());
    237237                }
     238                if (!tags.containsKey("comment")) {
     239                    tags.put("comment", dialog.getLastChangesetCommentFromHistory());
     240                }
    238241                dialog.setDefaultChangesetTags(tags);
    239242            }
  • trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

    r6587 r6631  
    142142     */
    143143    public void startUserInput() {
    144         List<String> history = hcbUploadComment.getHistory();
    145         int age = (int) (System.currentTimeMillis()/1000 - Main.pref.getInteger(HISTORY_LAST_USED_KEY, 0));
    146         // only pre-select latest entry if used less than 4 hours ago.
    147         if (age < Main.pref.getInteger(HISTORY_MAX_AGE_KEY, 4 * 3600 * 1000) && history != null && !history.isEmpty()) {
    148             hcbUploadComment.setText(history.get(0));
    149         }
    150144        hcbUploadComment.requestFocusInWindow();
    151145        hcbUploadComment.getEditor().getEditorComponent().requestFocusInWindow();
  • trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java

    r6594 r6631  
    589589        setTitle(tr("Upload to ''{0}''", url));
    590590    }
     591
     592    public String getLastChangesetCommentFromHistory() {
     593        Collection<String> history = Main.pref.getCollection(BasicUploadSettingsPanel.HISTORY_KEY, new ArrayList<String>());
     594        int age = (int) (System.currentTimeMillis() / 1000 - Main.pref.getInteger(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0));
     595        if (age < Main.pref.getInteger(BasicUploadSettingsPanel.HISTORY_MAX_AGE_KEY, 4 * 3600 * 1000) && history != null && !history.isEmpty()) {
     596            return history.iterator().next();
     597        } else {
     598            return null;
     599        }
     600    }
    591601}
Note: See TracChangeset for help on using the changeset viewer.