Ticket #10746: notes_checkbox.patch
File notes_checkbox.patch, 4.8 KB (added by , 11 years ago) |
---|
-
src/org/openstreetmap/josm/actions/DownloadAction.java
54 54 Future<?> future = task.download(dialog.isNewLayerRequired(),area, null); 55 55 Main.worker.submit(new PostDownloadHandler(task, future)); 56 56 } 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()) { 61 58 DownloadNotesTask task = new DownloadNotesTask(); 62 59 Future<?> future = task.download(false, area, null); 63 60 Main.worker.submit(new PostDownloadHandler(task, future)); -
src/org/openstreetmap/josm/gui/download/DownloadDialog.java
77 77 78 78 protected JCheckBox cbDownloadOsmData; 79 79 protected JCheckBox cbDownloadGpxData; 80 protected JCheckBox cbDownloadNotes; 80 81 /** the download action and button */ 81 82 private DownloadAction actDownload; 82 83 protected SideButton btnDownload; … … 97 98 pnl.add(cbDownloadOsmData, GBC.std().insets(1,5,1,5)); 98 99 cbDownloadGpxData = new JCheckBox(tr("Raw GPS data")); 99 100 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 } 101 111 102 112 // hook for subclasses 103 113 buildMainPanelAboveDownloadSelections(pnl); … … 173 183 174 184 makeCheckBoxRespondToEnter(cbDownloadGpxData); 175 185 makeCheckBoxRespondToEnter(cbDownloadOsmData); 186 makeCheckBoxRespondToEnter(cbDownloadNotes); 176 187 makeCheckBoxRespondToEnter(cbNewLayer); 177 188 178 189 // -- cancel button … … 278 289 } 279 290 280 291 /** 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 /** 281 301 * Replies true if the user requires to download into a new layer 282 302 * 283 303 * @return true if the user requires to download into a new layer … … 313 333 Main.pref.put("download.tab", Integer.toString(tpDownloadAreaSelectors.getSelectedIndex())); 314 334 Main.pref.put("download.osm", cbDownloadOsmData.isSelected()); 315 335 Main.pref.put("download.gps", cbDownloadGpxData.isSelected()); 336 Main.pref.put("download.notes", cbDownloadNotes.isSelected()); 316 337 Main.pref.put("download.newlayer", cbNewLayer.isSelected()); 317 338 if (currentBounds != null) { 318 339 Main.pref.put("osm-download.bounds", currentBounds.encodeAsString(";")); … … 325 346 public void restoreSettings() { 326 347 cbDownloadOsmData.setSelected(Main.pref.getBoolean("download.osm", true)); 327 348 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); 328 354 cbNewLayer.setSelected(Main.pref.getBoolean("download.newlayer", false)); 329 355 cbStartup.setSelected( isAutorunEnabled() ); 330 356 int idx = Main.pref.getInteger("download.tab", 0); … … 457 483 ); 458 484 return; 459 485 } 486 //TODO: add notes into this logic once they are fully enabled in core 460 487 if (!isDownloadOsmData() && !isDownloadGpxData()) { 461 488 JOptionPane.showMessageDialog( 462 489 DownloadDialog.this,