Index: src/org/openstreetmap/josm/actions/OpenOsmServerAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/OpenOsmServerAction.java	(revision 19)
+++ src/org/openstreetmap/josm/actions/OpenOsmServerAction.java	(revision 20)
@@ -2,15 +2,24 @@
 
 import java.awt.GridBagLayout;
+import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 
 import javax.swing.AbstractAction;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
+import javax.swing.JScrollPane;
 import javax.swing.JTextField;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
 
 import org.openstreetmap.josm.data.GeoPoint;
 import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.BookmarkList;
 import org.openstreetmap.josm.gui.GBC;
 import org.openstreetmap.josm.gui.ImageProvider;
@@ -18,4 +27,5 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.BookmarkList.Bookmark;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.LayerFactory;
@@ -34,4 +44,11 @@
 public class OpenOsmServerAction extends AbstractAction {
 
+	private JTextField[] latlon = new JTextField[]{
+			new JTextField(9),
+			new JTextField(9),
+			new JTextField(9),
+			new JTextField(9)};
+	private JCheckBox rawGps = new JCheckBox("Open as raw gps data", false);
+
 	public OpenOsmServerAction() {
 		super("Connect to OSM", ImageProvider.get("connectosm"));
@@ -44,17 +61,12 @@
 		dlg.add(new JLabel("Bounding box"), GBC.eol());
 
-		JTextField minLat = new JTextField(9);
-		JTextField minLon = new JTextField(9);
-		JTextField maxLat = new JTextField(9);
-		JTextField maxLon = new JTextField(9);
-
 		dlg.add(new JLabel("min lat"), GBC.std().insets(10,0,5,0));
-		dlg.add(minLat, GBC.std());
+		dlg.add(latlon[0], GBC.std());
 		dlg.add(new JLabel("max lat"), GBC.std().insets(10,0,5,0));
-		dlg.add(maxLat, GBC.eol());
+		dlg.add(latlon[1], GBC.eol());
 		dlg.add(new JLabel("min lon"), GBC.std().insets(10,0,5,0));
-		dlg.add(minLon, GBC.std());
+		dlg.add(latlon[2], GBC.std());
 		dlg.add(new JLabel("max lon"), GBC.std().insets(10,0,5,0));
-		dlg.add(maxLon, GBC.eol());
+		dlg.add(latlon[3], GBC.eop());
 
 		if (Main.main.getMapFrame() != null) {
@@ -64,15 +76,62 @@
 			GeoPoint bottomLeft = mv.getPoint(0, h, true);
 			GeoPoint topRight = mv.getPoint(w, 0, true);
-			minLat.setText(""+bottomLeft.lat);
-			minLon.setText(""+bottomLeft.lon);
-			maxLat.setText(""+topRight.lat);
-			maxLon.setText(""+topRight.lon);
-			
-			minLat.setCaretPosition(0);
-			minLon.setCaretPosition(0);
-			maxLat.setCaretPosition(0);
-			maxLon.setCaretPosition(0);
+			latlon[0].setText(""+bottomLeft.lat);
+			latlon[1].setText(""+bottomLeft.lon);
+			latlon[2].setText(""+topRight.lat);
+			latlon[3].setText(""+topRight.lon);
+			for (JTextField f : latlon)
+				f.setCaretPosition(0);
+			rawGps.setSelected(!mv.getActiveLayer().isEditable());
 		}
 
+		dlg.add(rawGps, GBC.eop());
+		
+		// load bookmarks
+		dlg.add(new JLabel("Bookmarks"), GBC.eol());
+		final BookmarkList bookmarks = new BookmarkList();
+		bookmarks.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
+			public void valueChanged(ListSelectionEvent e) {
+				Bookmark b = (Bookmark)bookmarks.getSelectedValue();
+				for (int i = 0; i < 4; ++i) {
+					latlon[i].setText(b == null ? "" : ""+b.latlon[i]);
+					latlon[i].setCaretPosition(0);
+				}
+				rawGps.setSelected(b == null ? false : b.rawgps);
+			}
+		});
+		dlg.add(new JScrollPane(bookmarks), GBC.eol().fill());
+
+		JPanel buttons = new JPanel(new GridLayout(1,2));
+		JButton add = new JButton("Add");
+		add.addActionListener(new ActionListener(){
+			public void actionPerformed(ActionEvent e) {
+				Bookmark b = readBookmark();
+				if (b == null) {
+					JOptionPane.showMessageDialog(Main.main, "Please enter the desired coordinates first.");
+					return;
+				}
+				b.name = JOptionPane.showInputDialog(Main.main, "Please enter a name for the location.");
+				if (!b.name.equals("")) {
+					((DefaultListModel)bookmarks.getModel()).addElement(b);
+					bookmarks.save();
+				}
+			}
+		});
+		buttons.add(add);
+		JButton remove = new JButton("Remove");
+		remove.addActionListener(new ActionListener(){
+			public void actionPerformed(ActionEvent e) {
+				Object sel = bookmarks.getSelectedValue();
+				if (sel == null) {
+					JOptionPane.showMessageDialog(Main.main, "Select a bookmark first.");
+					return;
+				}
+				((DefaultListModel)bookmarks.getModel()).removeElement(sel);
+				bookmarks.save();
+			}
+		});
+		buttons.add(remove);
+		dlg.add(buttons, GBC.eop().fill(GBC.HORIZONTAL));
+		
 		int r = JOptionPane.showConfirmDialog(Main.main, dlg, "Choose an area", 
 				JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
@@ -80,17 +139,22 @@
 			return;
 
+		Bookmark b = readBookmark();
+		if (b == null) {
+			JOptionPane.showMessageDialog(Main.main, "Please enter the desired coordinates or click on a bookmark.");
+			return;
+		}
 		OsmReader osmReader = new OsmReader(Main.pref.osmDataServer,
-				Main.pref.osmDataUsername, Main.pref.osmDataPassword,
-				Double.parseDouble(minLat.getText()),
-				Double.parseDouble(minLon.getText()),
-				Double.parseDouble(maxLat.getText()),
-				Double.parseDouble(maxLon.getText()));
+				rawGps.isSelected(), b.latlon[0], b.latlon[1], b.latlon[2], b.latlon[3]);
 		try {
 			DataSet dataSet = osmReader.parse();
+			if (dataSet == null)
+				return; // user cancelled download
+			if (dataSet.nodes.isEmpty())
+				JOptionPane.showMessageDialog(Main.main, "No data imported.");
 
-			String name = minLat.getText()+" "+minLon.getText()+" x "+
-					maxLat.getText()+" "+maxLon.getText();
+			String name = latlon[0].getText()+" "+latlon[1].getText()+" x "+
+					latlon[2].getText()+" "+latlon[3].getText();
 			
-			Layer layer = LayerFactory.create(dataSet, name, false);
+			Layer layer = LayerFactory.create(dataSet, name, rawGps.isSelected());
 
 			if (Main.main.getMapFrame() == null)
@@ -106,3 +170,25 @@
 		}
 	}
+	
+	/**
+	 * Read a bookmark from the current set edit fields. If one of the fields is
+	 * empty or contain illegal chars, <code>null</code> is returned.
+	 * The name of the bookmark is <code>null</code>.
+	 * @return A bookmark containing information from the edit fields and rawgps
+	 * 		checkbox.
+	 */
+	private Bookmark readBookmark() {
+		try {
+			Bookmark b = new Bookmark();
+			for (int i = 0; i < 4; ++i) {
+				if (latlon[i].getText().equals(""))
+					return null;
+				b.latlon[i] = Double.parseDouble(latlon[i].getText());
+			}
+			b.rawgps = rawGps.isSelected();
+			return b;
+		} catch (NumberFormatException x) {
+			return null;
+		}
+	}
 }
Index: src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- src/org/openstreetmap/josm/data/Preferences.java	(revision 19)
+++ src/org/openstreetmap/josm/data/Preferences.java	(revision 20)
@@ -6,4 +6,5 @@
 import java.io.FileReader;
 import java.io.FileWriter;
+import java.io.IOException;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -79,6 +80,6 @@
 	 * Return the location of the preferences file
 	 */
-	public static String getPreferencesFile() {
-		return System.getProperty("user.home")+"/.josm-preferences";
+	public static String getPreferencesDir() {
+		return System.getProperty("user.home")+"/.josm/";
 	}
 	
@@ -91,4 +92,7 @@
 			super(message, cause);
 		}
+		public PreferencesException(String message) {
+			super(message);
+		}
 	}
 	/**
@@ -97,5 +101,5 @@
 	 */
 	public void load() throws PreferencesException {
-		File file = new File(System.getProperty("user.home")+"/.josm-preferences");
+		File file = new File(getPreferencesDir()+"/preferences");
 		Element root;
 		try {
@@ -159,8 +163,14 @@
 
 		try {
-			final FileWriter file = new FileWriter(getPreferencesFile());
+			File prefDir = new File(getPreferencesDir());
+			if (prefDir.exists() && !prefDir.isDirectory())
+				throw new PreferencesException("Preferences directory "+getPreferencesDir()+" is not a directory.");
+			if (!prefDir.exists())
+				prefDir.mkdirs();
+
+			FileWriter file = new FileWriter(getPreferencesDir()+"/preferences");
 			new XMLOutputter(Format.getPrettyFormat()).output(root, file);
 			file.close();
-		} catch (Exception e) {
+		} catch (IOException e) {
 			throw new PreferencesException("Could not write preferences", e);
 		}
Index: src/org/openstreetmap/josm/gui/BookmarkList.java
===================================================================
--- src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 20)
+++ src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 20)
@@ -0,0 +1,115 @@
+package org.openstreetmap.josm.gui;
+
+import java.awt.Component;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.StringTokenizer;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+
+import org.openstreetmap.josm.data.Preferences;
+
+/**
+ * List class that read and save its content from the bookmark file.
+ * @author imi
+ */
+public class BookmarkList extends JList {
+
+	/**
+	 * Class holding one bookmarkentry.
+	 * @author imi
+	 */
+	public static class Bookmark {
+		public String name;
+		public double[] latlon = new double[4];
+		public boolean rawgps;
+		@Override public String toString() {
+			return name;
+		}
+	}
+	
+	/**
+	 * Create a bookmark list as well as the Buttons add and remove.
+	 */
+	public BookmarkList() {
+		setModel(new DefaultListModel());
+		load();
+		setVisibleRowCount(10);
+		setCellRenderer(new DefaultListCellRenderer(){
+			@Override
+			public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+				Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+				if (c instanceof JLabel) {
+					Bookmark b = (Bookmark)value;
+					((JLabel)c).setIcon(ImageProvider.get("layer/"+(b.rawgps?"rawgps_small":"osmdata_small")));
+				}
+				return c;
+			}
+		});
+	}
+
+	/**
+	 * Loads the bookmarks from file.
+	 */
+	public void load() {
+		DefaultListModel model = (DefaultListModel)getModel();
+		model.removeAllElements();
+		File bookmarkFile = new File(Preferences.getPreferencesDir()+"bookmarks");
+		try {
+			if (!bookmarkFile.exists())
+				bookmarkFile.createNewFile();
+			BufferedReader in = new BufferedReader(new FileReader(bookmarkFile));
+			
+			for (String line = in.readLine(); line != null; line = in.readLine()) {
+				StringTokenizer st = new StringTokenizer(line, ",");
+				if (st.countTokens() != 6)
+					continue;
+				Bookmark b = new Bookmark();
+				b.name = st.nextToken();
+				try {
+					for (int i = 0; i < b.latlon.length; ++i)
+						b.latlon[i] = Double.parseDouble(st.nextToken());
+					b.rawgps = Boolean.parseBoolean(st.nextToken());
+					model.addElement(b);
+				} catch (NumberFormatException x) {
+					// line not parsed
+				}
+			}
+			in.close();
+		} catch (IOException e) {
+			JOptionPane.showMessageDialog(Main.main, "Could not read bookmarks.\n"+e.getMessage());
+		}
+	}
+
+	/**
+	 * Save all bookmarks to the preferences file
+	 */
+	public void save() {
+		File bookmarkFile = new File(Preferences.getPreferencesDir()+"bookmarks");
+		try {
+			if (!bookmarkFile.exists())
+				bookmarkFile.createNewFile();
+			PrintWriter out = new PrintWriter(new FileWriter(bookmarkFile));
+			DefaultListModel m = (DefaultListModel)getModel();
+			for (Object o : m.toArray()) {
+				Bookmark b = (Bookmark)o;
+				b.name.replace(',', '_');
+				out.print(b.name+",");
+				for (int i = 0; i < b.latlon.length; ++i)
+					out.print(b.latlon[i]+",");
+				out.println(b.rawgps);
+			}
+			out.close();
+		} catch (IOException e) {
+			JOptionPane.showMessageDialog(Main.main, "Could not write bookmark.\n"+e.getMessage());
+		}
+	}
+}
Index: src/org/openstreetmap/josm/gui/Main.java
===================================================================
--- src/org/openstreetmap/josm/gui/Main.java	(revision 19)
+++ src/org/openstreetmap/josm/gui/Main.java	(revision 20)
@@ -126,5 +126,5 @@
 		} catch (PreferencesException e1) {
 			e1.printStackTrace();
-			errMsg = "Preferences could not be loaded. Write default preference file to '"+Preferences.getPreferencesFile()+"'.";
+			errMsg = "Preferences could not be loaded. Write default preference file to '"+Preferences.getPreferencesDir()+"preferences'.";
 			try {
 				pref.save();
Index: src/org/openstreetmap/josm/gui/PreferenceDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/PreferenceDialog.java	(revision 19)
+++ src/org/openstreetmap/josm/gui/PreferenceDialog.java	(revision 20)
@@ -189,5 +189,4 @@
 
 		
-		// tooltips
 		osmDataServer.setToolTipText("The base URL to the OSM server (REST API)");
 		osmDataUsername.setToolTipText("Login name (email) to the OSM account.");
@@ -197,4 +196,5 @@
 		forceRawGpsLines.setToolTipText("Force drawing of lines if the imported data contain no line information.");
 		forceRawGpsLines.setSelected(Main.pref.isForceRawGpsLines());
+		forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected());
 		mergeNodes.setToolTipText("When importing GPX data, all nodes with exact the same lat/lon are merged.");
 		mergeNodes.setSelected(Main.pref.mergeNodes);
Index: src/org/openstreetmap/josm/io/OsmReader.java
===================================================================
--- src/org/openstreetmap/josm/io/OsmReader.java	(revision 19)
+++ src/org/openstreetmap/josm/io/OsmReader.java	(revision 20)
@@ -1,4 +1,6 @@
 package org.openstreetmap.josm.io;
 
+import java.awt.Font;
+import java.awt.GridBagLayout;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -9,5 +11,13 @@
 import java.net.URL;
 
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+
 import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.GBC;
+import org.openstreetmap.josm.gui.Main;
 
 /**
@@ -22,12 +32,28 @@
 	 */
 	private String urlStr;
+	/**
+	 * Whether importing the raw trackpoints or the regular osm map information
+	 */
+	private boolean rawGps;
+	/**
+	 * Whether the user cancelled the password dialog
+	 */
+	private boolean cancelled = false;
+	/**
+	 * Set to true, when the autenticator tried the password once.
+	 */
+	private boolean passwordtried = false;
 
 	/**
 	 * Construct the reader and store the information for attaching
 	 */
-	public OsmReader(String server, final String username, final String password, 
+	public OsmReader(String server, boolean rawGps, 
 			double lat1, double lon1, double lat2, double lon2) {
+		this.rawGps = rawGps;
 		urlStr = server.endsWith("/") ? server : server+"/";
-		urlStr += "map?bbox="+lon1+","+lat1+","+lon2+","+lat2;
+		urlStr += rawGps?"trackpoints" : "map";
+		urlStr += "?bbox="+lon1+","+lat1+","+lon2+","+lat2;
+		if (rawGps)
+			urlStr += "&page=";
 		
 		HttpURLConnection.setFollowRedirects(true);
@@ -35,4 +61,28 @@
 			@Override
 			protected PasswordAuthentication getPasswordAuthentication() {
+				String username = Main.pref.osmDataUsername;
+				String password = Main.pref.osmDataPassword;
+				if (passwordtried || "".equals(username) || password == null || "".equals(password)) {
+					JPanel p = new JPanel(new GridBagLayout());
+					p.add(new JLabel("Username"), GBC.std().insets(0,0,10,0));
+					JTextField usernameField = new JTextField("".equals(username) ? "" : username, 20);
+					p.add(usernameField, GBC.eol());
+					p.add(new JLabel("Password"), GBC.std().insets(0,0,10,0));
+					JPasswordField passwordField = new JPasswordField(password == null ? "" : password, 20);
+					p.add(passwordField, GBC.eol());
+					JLabel warning = new JLabel("Warning: The password is transferred unencrypted.");
+					warning.setFont(warning.getFont().deriveFont(Font.ITALIC));
+					p.add(warning, GBC.eol());
+					int choice = JOptionPane.showConfirmDialog(Main.main, p, "Enter Password", JOptionPane.OK_CANCEL_OPTION);
+					if (choice == JOptionPane.CANCEL_OPTION) {
+						cancelled = true;
+						return null;
+					}
+					username = usernameField.getText();
+					password = String.valueOf(passwordField.getPassword());
+					if ("".equals(username))
+						return null;
+				}
+				passwordtried = true;
 				return new PasswordAuthentication(username, password.toCharArray());
 			}
@@ -44,16 +94,29 @@
 		Reader in;
 		try {
+			if (rawGps) {
+				DataSet ds = new DataSet();
+				for (int i = 0;;++i) {
+					URL url = new URL(urlStr+i);
+					HttpURLConnection con = (HttpURLConnection)url.openConnection();
+					con.setConnectTimeout(20000);
+					if (con.getResponseCode() == 401 && cancelled)
+						return null;
+					in = new InputStreamReader(con.getInputStream());
+					DataSet currentData = new GpxReader(in, true).parse();
+					if (currentData.nodes.isEmpty())
+						return ds;
+					ds.mergeFrom(currentData, true);
+				}
+			}
 			URL url = new URL(urlStr);
 			HttpURLConnection con = (HttpURLConnection)url.openConnection();
-			con.setDoInput(true);
 			con.setConnectTimeout(20000);
-			con.setRequestMethod("GET");
-			con.connect();
+			if (con.getResponseCode() == 401 && cancelled)
+				return null;
 			in = new InputStreamReader(con.getInputStream());
+			return new GpxReader(in, false).parse();
 		} catch (IOException e) {
 			throw new ConnectionException("Failed to open server connection\n"+e.getMessage(), e);
 		}
-		GpxReader reader = new GpxReader(in, false);
-		return reader.parse();
 	}
 }
