Ticket #10746: notes_checkbox.patch

File notes_checkbox.patch, 4.8 KB (added by ToeBee, 11 years ago)
  • src/org/openstreetmap/josm/actions/DownloadAction.java

     
    5454                Future<?> future = task.download(dialog.isNewLayerRequired(),area, null);
    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);
    6360                Main.worker.submit(new PostDownloadHandler(task, future));
  • src/org/openstreetmap/josm/gui/download/DownloadDialog.java

     
    7777
    7878    protected JCheckBox cbDownloadOsmData;
    7979    protected JCheckBox cbDownloadGpxData;
     80    protected JCheckBox cbDownloadNotes;
    8081    /** the download action and button */
    8182    private DownloadAction actDownload;
    8283    protected SideButton btnDownload;
     
    9798        pnl.add(cbDownloadOsmData,  GBC.std().insets(1,5,1,5));
    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
    103113        buildMainPanelAboveDownloadSelections(pnl);
     
    173183
    174184        makeCheckBoxRespondToEnter(cbDownloadGpxData);
    175185        makeCheckBoxRespondToEnter(cbDownloadOsmData);
     186        makeCheckBoxRespondToEnter(cbDownloadNotes);
    176187        makeCheckBoxRespondToEnter(cbNewLayer);
    177188
    178189        // -- cancel button
     
    278289    }
    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     *
    283303     * @return true if the user requires to download into a new layer
     
    313333        Main.pref.put("download.tab", Integer.toString(tpDownloadAreaSelectors.getSelectedIndex()));
    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) {
    318339            Main.pref.put("osm-download.bounds", currentBounds.encodeAsString(";"));
     
    325346    public void restoreSettings() {
    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() );
    330356        int idx = Main.pref.getInteger("download.tab", 0);
     
    457483                );
    458484                return;
    459485            }
     486            //TODO: add notes into this logic once they are fully enabled in core
    460487            if (!isDownloadOsmData() && !isDownloadGpxData()) {
    461488                JOptionPane.showMessageDialog(
    462489                        DownloadDialog.this,