Changeset 4263 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2011-07-25T00:48:51+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/GpxExporter.java
r3083 r4263 34 34 import org.openstreetmap.josm.gui.layer.Layer; 35 35 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 36 import org.openstreetmap.josm.io.auth.CredentialsManager; 36 37 import org.openstreetmap.josm.tools.CheckParameterUtil; 37 38 import org.openstreetmap.josm.tools.GBC; … … 84 85 JLabel emailLabel = new JLabel(tr("E-Mail")); 85 86 p.add(emailLabel, GBC.std().insets(10, 0, 5, 0)); 86 JTextField email = new JTextField(Main.pref.get("osm-server.username")); 87 String user = CredentialsManager.getInstance().getUsername(); 88 JTextField email = new JTextField(user == null ? "" : user); 87 89 p.add(email, GBC.eol().fill(GBC.HORIZONTAL)); 88 90 JLabel copyrightLabel = new JLabel(tr("Copyright (URL)")); … … 232 234 emailLabel.setEnabled(b); 233 235 authorName.setText(b ? Main.pref.get("lastAuthorName") : ""); 234 email.setText(b ? Main.pref.get("osm-server.username") : ""); 236 String user = CredentialsManager.getInstance().getUsername(); 237 email.setText(b ? (user == null ? "" : user) : ""); 235 238 236 239 boolean authorSet = authorName.getText().length() != 0; -
trunk/src/org/openstreetmap/josm/io/auth/CredentialsManager.java
r4249 r4263 7 7 8 8 import org.openstreetmap.josm.data.oauth.OAuthToken; 9 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 10 import org.openstreetmap.josm.tools.Utils; 9 11 10 12 /** … … 63 65 } 64 66 67 public String getUsername() { 68 String username = null; 69 try { 70 PasswordAuthentication auth = lookup(RequestorType.SERVER); 71 if (auth != null) { 72 username = auth.getUserName(); 73 } 74 } catch (CredentialsAgentException ex) { 75 return null; 76 } 77 if (username == null) return null; 78 username = username.trim(); 79 return Utils.equal(username, "") ? null : username; 80 } 81 65 82 @Override 66 83 public PasswordAuthentication lookup(RequestorType requestorType) throws CredentialsAgentException { … … 70 87 @Override 71 88 public void store(RequestorType requestorType, PasswordAuthentication credentials) throws CredentialsAgentException { 89 if (requestorType == RequestorType.SERVER && credentials.getUserName() != null) { 90 JosmUserIdentityManager.getInstance().setPartiallyIdentified(credentials.getUserName()); 91 } 72 92 delegate.store(requestorType, credentials); 73 93 }
Note:
See TracChangeset
for help on using the changeset viewer.