Ignore:
Timestamp:
2009-09-03T14:13:22+02:00 (16 years ago)
Author:
Gubaer
Message:

Improved cancellation of upload tasks
Refactored upload dialog
fixed #2597: Size of upload dialog - now restores dialog size from preferences
fixed #2913: Upload dialog enters scrolling-mode when JOSM isn't maximized - no scroling anymore in ExtendeDialog for UploadDialog
fixed #2518: focus & select comment editing field

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r2035 r2037  
    160160        if (initialized)
    161161            return;
     162        cancel = false;
    162163        initAuthentication();
    163164        try {
  • trunk/src/org/openstreetmap/josm/io/OsmConnection.java

    r2015 r2037  
    2323import org.openstreetmap.josm.Main;
    2424import org.openstreetmap.josm.gui.ExtendedDialog;
     25import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2526import org.openstreetmap.josm.tools.Base64;
    2627import org.openstreetmap.josm.tools.GBC;
     
    9495
    9596    public void cancel() {
    96         //TODO
    97         //Main.pleaseWaitDlg.currentAction.setText(tr("Aborting..."));
    9897        cancel = true;
    9998        if (activeConnection != null) {
     
    112111        try {
    113112            synchronized (credentialsManager) {
    114                 auth = credentialsManager.lookup(CredentialsManager.Key.USERNAME) + ":" + 
    115                     credentialsManager.lookup(CredentialsManager.Key.PASSWORD);
     113                auth = credentialsManager.lookup(CredentialsManager.Key.USERNAME) + ":" +
     114                credentialsManager.lookup(CredentialsManager.Key.PASSWORD);
    116115            }
    117116        } catch (CredentialsManager.CMException e) {
     
    139138            String secret = Main.pref.get("osm-server." + key.toString(), null);
    140139            if (secret == null) throw new CredentialsManager.NoContentException();
    141             return secret;           
     140            return secret;
    142141        }
    143142        public void store(CredentialsManager.Key key, String secret) {
     
    171170                p.add(warning, GBC.eop());
    172171
    173                 JCheckBox savePassword = new JCheckBox(tr("Save user and password (unencrypted)"), 
    174                                                        !username.equals("") && !password.equals(""));
     172                JCheckBox savePassword = new JCheckBox(tr("Save user and password (unencrypted)"),
     173                        !username.equals("") && !password.equals(""));
    175174                p.add(savePassword, GBC.eop());
    176175
    177                 int choice = new ExtendedDialog(
    178                     Main.parent,
    179                     tr("Enter Password"),
    180                     p,
    181                     new String[] {tr("Login"), tr("Cancel")},
    182                     new String[] {"ok.png", "cancel.png"}).getValue();
    183 
    184                 if (choice != 1) {
     176                ExtendedDialog dialog = new ExtendedDialog(
     177                        Main.parent,
     178                        tr("Enter Password"),
     179                        new String[] {tr("Login"), tr("Cancel")}
     180                );
     181                dialog.setContent(p);
     182                dialog.setButtonIcons( new String[] {"ok.png", "cancel.png"});
     183                dialog.showDialog();
     184
     185                if (dialog.getValue() != 1) {
    185186                    caller.authCancelled = true;
    186187                    return null;
     
    223224                        oldServerURL = "";
    224225                    }
    225                     if (oldServerURL.equals("")) oldServerURL = "http://api.openstreetmap.org/api";
     226                    if (oldServerURL.equals("")) {
     227                        oldServerURL = "http://api.openstreetmap.org/api";
     228                    }
    226229                    try {
    227230                        oldUsername = lookup(Key.USERNAME);
     
    258261                    String newPassword = String.valueOf(osmDataPassword.getPassword());
    259262                    if (!oldServerURL.equals(newServerURL)) {
    260                         store(Key.OSM_SERVER_URL, newServerURL); 
     263                        store(Key.OSM_SERVER_URL, newServerURL);
    261264                    }
    262265                    if (!oldUsername.equals(newUsername)) {
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r2035 r2037  
    1212import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.actions.UploadAction;
    14 import org.openstreetmap.josm.data.osm.Changeset;
    1514import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1615import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    203202    }
    204203
    205     public void disconnectActiveConnection() {
    206         if (api != null && api.activeConnection != null) {
    207             api.activeConnection.disconnect();
     204    public void cancel() {
     205        if (api != null) {
     206            api.cancel();
    208207        }
    209208    }
Note: See TracChangeset for help on using the changeset viewer.