Changeset 3399 in josm
- Timestamp:
- 2010-07-31T21:22:49+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r3133 r3399 35 35 public class BasicUploadSettingsPanel extends JPanel { 36 36 public static final String HISTORY_KEY = "upload.comment.history"; 37 public static final String HISTORY_LAST_USED_KEY = "upload.comment.last-used"; 37 38 38 39 /** the history combo box for the upload comment */ … … 48 49 pnl.add(new JLabel(tr("Provide a brief comment for the changes you are uploading:")), GBC.eol().insets(0, 5, 10, 3)); 49 50 hcbUploadComment = new HistoryComboBox(); 50 hcbUploadComment.setToolTipText(tr("Enter an upload comment (min. 3 characters)"));51 hcbUploadComment.setToolTipText(tr("Enter an upload comment")); 51 52 List<String> cmtHistory = new LinkedList<String>(Main.pref.getCollection(HISTORY_KEY, new LinkedList<String>())); 52 53 // we have to reverse the history, because ComboBoxHistory will reverse it again … … 117 118 hcbUploadComment.addCurrentItemToHistory(); 118 119 Main.pref.putCollection(HISTORY_KEY, hcbUploadComment.getHistory()); 120 Main.pref.putInteger(HISTORY_LAST_USED_KEY, (int) (System.currentTimeMillis() / 1000)); 119 121 } 120 122 … … 124 126 public void startUserInput() { 125 127 List<String> history = hcbUploadComment.getHistory(); 126 if (history != null && !history.isEmpty()) { 128 int age = (int) (System.currentTimeMillis()/1000 - Main.pref.getInteger(HISTORY_LAST_USED_KEY, 0)); 129 // only pre-select latest entry if used less than 4 hours ago. 130 if (age < 4 * 3600 * 1000 && history != null && !history.isEmpty()) { 127 131 hcbUploadComment.setText(history.get(0)); 128 132 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r3133 r3399 38 38 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 39 39 import org.openstreetmap.josm.gui.help.HelpUtil; 40 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 40 41 import org.openstreetmap.josm.io.OsmApi; 41 42 import org.openstreetmap.josm.tools.ImageProvider; … … 304 305 305 306 /** 306 * Re plies the current value for the upload comment307 * Returns the current value for the upload comment 307 308 * 308 309 * @return the current value for the upload comment … … 313 314 314 315 /** 315 * Re plies true,if the dialog was canceled316 * 317 * @return true ,if the dialog was canceled316 * Returns true if the dialog was canceled 317 * 318 * @return true if the dialog was canceled 318 319 */ 319 320 public boolean isCanceled() { … … 324 325 * Sets whether the dialog was canceled 325 326 * 326 * @param canceled true ,if the dialog is canceled327 * @param canceled true if the dialog is canceled 327 328 */ 328 329 protected void setCanceled(boolean canceled) { … … 358 359 } 359 360 360 protected void warnIllegalUploadComment() { 361 HelpAwareOptionPane.showOptionDialog( 361 /** 362 * returns true if the user wants to revisit, false if they 363 * want to continue 364 */ 365 protected boolean warnUploadComment() { 366 367 ButtonSpec[] options = new ButtonSpec[] { 368 new ButtonSpec( 369 tr("Yes, revise"), 370 ImageProvider.get("ok"), 371 tr("Go back to the changeset comment and enter a better description"), 372 null 373 ), 374 new ButtonSpec( 375 tr("No, continue as is"), 376 ImageProvider.get("cancel"), 377 tr("Continue without improving the changeset comment"), 378 null 379 ) 380 }; 381 382 return 0 == HelpAwareOptionPane.showOptionDialog( 362 383 UploadDialog.this, 363 tr("Please enter a comment for this upload changeset (min. 3 characters)"), 364 tr("Illegal upload comment"), 365 JOptionPane.ERROR_MESSAGE, 366 ht("/Dialog/UploadDialog#IllegalUploadComment") 384 "<html>" + 385 tr("Your upload comment is empty, or very short.<br /><br />" + 386 "This is technically allowed, but please consider that many users who are<br />" + 387 "watching changes in their area depend on meaningful changeset comments<br />" + 388 "to understand what is going on!<br /><br />" + 389 "If you spend a minute now to explain your change, you will make life<br />" + 390 "easier for many other mappers.") + 391 "</html>", 392 tr("Please revise upload comment"), 393 JOptionPane.WARNING_MESSAGE, 394 null, 395 options, 396 options[0], 397 ht("/Dialog/UploadDialog#ReviseUploadComment") 367 398 ); 368 399 } … … 379 410 380 411 public void actionPerformed(ActionEvent e) { 381 if (getUploadComment().trim().length() < 3) { 382 warnIllegalUploadComment(); 383 tpConfigPanels.setSelectedIndex(0); 384 pnlBasicUploadSettings.initEditingOfUploadComment(); 385 return; 412 if (getUploadComment().trim().length() < 10) { 413 if (warnUploadComment()) 414 { 415 tpConfigPanels.setSelectedIndex(0); 416 pnlBasicUploadSettings.initEditingOfUploadComment(); 417 return; 418 } 386 419 } 387 420 UploadStrategySpecification strategy = getUploadStrategySpecification();
Note:
See TracChangeset
for help on using the changeset viewer.