Changeset 7722 in josm


Ignore:
Timestamp:
2014-11-12T02:42:30+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #10746 - Add Notes checkbox in DownloadDialog (patch by ToeBee)

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

Legend:

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

    r7531 r7722  
    5555                Main.worker.submit(new PostDownloadHandler(task, future));
    5656            }
    57 
    58             //TODO: This eventually needs to be a checkbox in the UI
    59             //For now I'm adding it as a hidden feature since this is still a work in progress
    60             if (Main.pref.getBoolean("osm.notes.enableDownload", false)) {
     57            if (dialog.isDownloadNotes()) {
    6158                DownloadNotesTask task = new DownloadNotesTask();
    6259                Future<?> future = task.download(false, area, null);
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r7434 r7722  
    7878    protected JCheckBox cbDownloadOsmData;
    7979    protected JCheckBox cbDownloadGpxData;
     80    protected JCheckBox cbDownloadNotes;
    8081    /** the download action and button */
    8182    private DownloadAction actDownload;
     
    9899        cbDownloadGpxData = new JCheckBox(tr("Raw GPS data"));
    99100        cbDownloadGpxData.setToolTipText(tr("Select to download GPS traces in the selected download area."));
    100         pnl.add(cbDownloadGpxData,  GBC.eol().insets(5,5,1,5));
     101        //TODO: uncomment this and remove logic below once notes are enabled
     102        //pnl.add(cbDownloadGpxData,  GBC.std().insets(5,5,1,5));
     103        cbDownloadNotes = new JCheckBox(tr("Notes"));
     104        cbDownloadNotes.setToolTipText(tr("Select to download notes in the selected download area."));
     105        if (Main.pref.getBoolean("osm.notes.enableDownload", false)) {
     106            pnl.add(cbDownloadGpxData,  GBC.std().insets(5,5,1,5));
     107            pnl.add(cbDownloadNotes, GBC.eol().insets(50, 5, 1, 5));
     108        } else {
     109            pnl.add(cbDownloadGpxData,  GBC.eol().insets(5,5,1,5));
     110        }
    101111
    102112        // hook for subclasses
     
    174184        makeCheckBoxRespondToEnter(cbDownloadGpxData);
    175185        makeCheckBoxRespondToEnter(cbDownloadOsmData);
     186        makeCheckBoxRespondToEnter(cbDownloadNotes);
    176187        makeCheckBoxRespondToEnter(cbNewLayer);
    177188
     
    279290
    280291    /**
     292     * Replies true if user selected to download notes
     293     *
     294     * @return true if user selected to download notes
     295     */
     296    public boolean isDownloadNotes() {
     297        return cbDownloadNotes.isSelected();
     298    }
     299
     300    /**
    281301     * Replies true if the user requires to download into a new layer
    282302     *
     
    314334        Main.pref.put("download.osm", cbDownloadOsmData.isSelected());
    315335        Main.pref.put("download.gps", cbDownloadGpxData.isSelected());
     336        Main.pref.put("download.notes", cbDownloadNotes.isSelected());
    316337        Main.pref.put("download.newlayer", cbNewLayer.isSelected());
    317338        if (currentBounds != null) {
     
    326347        cbDownloadOsmData.setSelected(Main.pref.getBoolean("download.osm", true));
    327348        cbDownloadGpxData.setSelected(Main.pref.getBoolean("download.gps", false));
     349        //TODO: This is to make sure notes are not downloaded if the Notes checkbox isn't being displayed.
     350        //      Make it look like the ones above when notes are enabled
     351        boolean downloadNotes = Main.pref.getBoolean("download.notes", false)
     352                && Main.pref.getBoolean("osm.notes.enableDownload", false);
     353        cbDownloadNotes.setSelected(downloadNotes);
    328354        cbNewLayer.setSelected(Main.pref.getBoolean("download.newlayer", false));
    329355        cbStartup.setSelected( isAutorunEnabled() );
     
    458484                return;
    459485            }
     486            //TODO: add notes into this logic once they are fully enabled in core
    460487            if (!isDownloadOsmData() && !isDownloadGpxData()) {
    461488                JOptionPane.showMessageDialog(
Note: See TracChangeset for help on using the changeset viewer.