Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31284)
@@ -1,4 +1,10 @@
 package org.openstreetmap.josm.plugins.mapillary;
 
+import java.sql.Date;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
 
@@ -11,4 +17,6 @@
  */
 public abstract class MapillaryAbstractImage {
+
+    private long capturedAt;
 
     /** Postion of the picture */
@@ -31,4 +39,5 @@
      */
     protected double movingCa;
+    private boolean visible;
 
     public MapillaryAbstractImage(double lat, double lon, double ca) {
@@ -39,4 +48,5 @@
         this.tempCa = ca;
         this.movingCa = ca;
+        this.visible = true;
     }
 
@@ -58,4 +68,12 @@
     public LatLon getLatLon() {
         return movingLatLon;
+    }
+
+    public boolean isVisible() {
+        return visible;
+    }
+
+    public void setVisible(boolean visible) {
+        this.visible = visible;
     }
 
@@ -116,3 +134,50 @@
         return tempCa;
     }
+
+    /**
+     * Returns the date the picture was taken in DMY format.
+     * 
+     * @return
+     */
+    public String getDate() {
+        return getDate("dd/MM/yyyy - hh:mm:ss");
+    }
+
+    public void setCapturedAt(long capturedAt) {
+        this.capturedAt = capturedAt;
+    }
+
+    public long getCapturedAt() {
+        return capturedAt;
+    }
+
+    /**
+     * Returns the date the picture was taken in the given format.
+     * 
+     * @param format
+     * @return
+     */
+    public String getDate(String format) {
+        Date date = new Date(getCapturedAt());
+
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        return formatter.format(date);
+    }
+    
+    public long getEpoch(String date, String format) {
+        
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        try {
+            Date dateTime = (Date) formatter.parse(date);
+            return dateTime.getTime();        
+        } catch (ParseException e) {
+            Main.error(e);
+        }
+        return currentTime();
+    }
+    
+    private long currentTime() {
+        Calendar cal = Calendar.getInstance();
+        return cal.getTimeInMillis();
+    }
 }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31284)
@@ -65,4 +65,5 @@
         }
         dataUpdated();
+        fireImagesAdded();
     }
 
@@ -118,4 +119,5 @@
             this.images.add(image);
         }
+        fireImagesAdded();
     }
 
@@ -143,4 +145,11 @@
     public MapillaryAbstractImage getSelectedImage() {
         return selectedImage;
+    }
+
+    private void fireImagesAdded() {
+        if (listeners.isEmpty())
+            return;
+        for (MapillaryDataListener lis : listeners)
+            lis.imagesAdded();
     }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java	(revision 31284)
@@ -2,4 +2,7 @@
 
 public interface MapillaryDataListener {
+    
+    public void imagesAdded();
+    
     /**
      * Fired when the selected image is changed by something different from
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java	(revision 31284)
@@ -1,6 +1,4 @@
 package org.openstreetmap.josm.plugins.mapillary;
 
-import java.sql.Date;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
@@ -20,5 +18,4 @@
 
     /** Epoch time when the image was taken. */
-    private long capturedAt;
     /** The user that made the image */
     private String user;
@@ -73,12 +70,4 @@
     public List<String> getSigns() {
         return signs;
-    }
-
-    public void setCapturedAt(long capturedAt) {
-        this.capturedAt = capturedAt;
-    }
-
-    public long getCapturedAt() {
-        return capturedAt;
     }
 
@@ -139,24 +128,4 @@
     }
 
-    /**
-     * Returns the date the picture was taken in DMY format.
-     * @return
-     */
-    public String getDate() {
-        return getDate("dd/MM/yyyy - hh:mm:ss");
-    }
-
-    /**
-     * Returns the date the picture was taken in the given format.
-     * @param format
-     * @return
-     */
-    public String getDate(String format) {
-        Date date = new Date(getCapturedAt());
-
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        return formatter.format(date);
-    }
-
     @Override
     public boolean equals(Object object) {
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java	(revision 31284)
@@ -13,5 +13,5 @@
      */
     protected File file;
-    public final String datetimeOriginal;
+    public final long datetimeOriginal;
 
     public MapillaryImportedImage(double lat, double lon, double ca, File file,
@@ -20,5 +20,5 @@
         this.file = file;
         System.out.println(datetimeOriginal);
-        this.datetimeOriginal = datetimeOriginal;
+        this.datetimeOriginal = getEpoch(datetimeOriginal, "yyyy/MM/dd hh:mm:ss");
     }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31284)
@@ -207,4 +207,6 @@
             MapillaryToggleDialog.getInstance().blueButton.setEnabled(false);
             MapillaryToggleDialog.getInstance().redButton.setEnabled(false);
+            
+            // Sets blue and red lines and enables/disables the buttons
             if (mapillaryData.getSelectedImage() != null) {
                 MapillaryImage[] closestImages = getClosestImagesFromDifferentSequences();
@@ -232,14 +234,18 @@
             g.setColor(Color.WHITE);
             for (MapillaryAbstractImage imageAbs : mapillaryData.getImages()) {
+                if (!imageAbs.isVisible())
+                    continue;
                 Point p = mv.getPoint(imageAbs.getLatLon());
                 if (imageAbs instanceof MapillaryImage) {
                     MapillaryImage image = (MapillaryImage) imageAbs;
                     Point nextp;
+                    // Draw sequence line
                     if (image.getSequence() != null
-                            && image.getSequence().next(image) != null) {
+                            && image.next() != null && image.next().isVisible()) {
                         nextp = mv.getPoint(image.getSequence().next(image)
                                 .getLatLon());
                         g.drawLine(p.x, p.y, nextp.x, nextp.y);
                     }
+                    
                     ImageIcon icon;
                     if (!mapillaryData.getMultiSelectedImages().contains(image))
@@ -363,4 +369,6 @@
             if (!(imagePrev instanceof MapillaryImage))
                 continue;
+            if (!imagePrev.isVisible())
+                continue;
             MapillaryImage image = (MapillaryImage) imagePrev;
             if (image.getLatLon().greatCircleDistance(selectedCoords) < SEQUENCE_MAX_JUMP_DISTANCE
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryMouseAdapter.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryMouseAdapter.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryMouseAdapter.java	(revision 31284)
@@ -209,5 +209,6 @@
             nothingHighlighted = false;
         } else if (Main.map.mapModeSelect.getValue("active") == Boolean.FALSE
-                && !nothingHighlighted) {
+                && !nothingHighlighted && Main.map.mapView != null
+                && Main.map.mapView.getEditLayer().data != null) {
             for (OsmPrimitive primivitive : Main.map.mapView.getEditLayer().data
                     .allPrimitives()) {
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31284)
@@ -18,4 +18,5 @@
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
+import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryFilterDialog;
 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryHistoryDialog;
 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryPreferenceSetting;
@@ -107,7 +108,10 @@
             Main.map.addToggleDialog(MapillaryToggleDialog.getInstance(), false);
             Main.map.addToggleDialog(MapillaryHistoryDialog.getInstance(), false);
+            Main.map.addToggleDialog(MapillaryFilterDialog.getInstance(), false);
         }
         if (oldFrame != null && newFrame == null) { // map frame destroyed
             MapillaryToggleDialog.destroyInstance();
+            MapillaryHistoryDialog.destroyInstance();
+            MapillaryFilterDialog.destroyInstance();
         }
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java	(revision 31284)
@@ -51,3 +51,7 @@
             MapillaryPlugin.setMenuEnabled(MapillaryPlugin.ZOOM_MENU, false);
     }
+
+    @Override
+    public void imagesAdded() {        
+    }
 }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java	(revision 31284)
@@ -87,5 +87,5 @@
                     exifDirectory.add(
                             ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL,
-                            ((MapillaryImportedImage) mimg).datetimeOriginal);
+                            ((MapillaryImportedImage) mimg).getDate("yyyy/MM/dd hh:mm:ss"));
                 } else if (mimg instanceof MapillaryImage)
                     exifDirectory.add(
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java	(revision 31284)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java	(revision 31284)
@@ -0,0 +1,238 @@
+package org.openstreetmap.josm.plugins.mapillary.gui;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.util.Arrays;
+import java.util.Calendar;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.openstreetmap.josm.gui.SideButton;
+import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryData;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryDataListener;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage;
+import org.openstreetmap.josm.tools.Shortcut;
+
+/**
+ * ToggleDialog that lets you filter the images that are being shown.
+ * 
+ * @author nokutu
+ *
+ */
+public class MapillaryFilterDialog extends ToggleDialog implements
+        MapillaryDataListener {
+
+    public static MapillaryFilterDialog INSTANCE;
+
+    private final static String[] TIME_LIST = { tr("All time"),
+            tr("This year"), tr("This month"), tr("This week") };
+
+    private final static int ROWS = 0;
+    private final static int COLUMNS = 3;
+
+    private final JPanel panel;
+
+    private final JCheckBox imported;
+    private final JCheckBox downloaded;
+    private final JCheckBox onlySigns;
+    private final JComboBox<String> time;
+    private final JTextField user;
+
+    private final SideButton updateButton;
+    private final SideButton resetButton;
+    private final JButton signChooser;
+
+    public MapillaryFilterDialog() {
+        super(tr("Mapillary filter"), "mapillaryfilter.png",
+                tr("Open Mapillary filter dialog"), Shortcut.registerShortcut(
+                        tr("Mapillary filter"),
+                        tr("Open Mapillary filter dialog"), KeyEvent.VK_M,
+                        Shortcut.NONE), 200);
+        panel = new JPanel(new GridLayout(ROWS, COLUMNS));
+
+        imported = new JCheckBox("Imported images");
+        downloaded = new JCheckBox(new downloadCheckBoxAction());
+        onlySigns = new JCheckBox("Only images with signs");
+
+        signChooser = new JButton(new SignChooserAction());
+        JPanel signChooserPanel = new JPanel();
+        signChooserPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
+        signChooserPanel.add(signChooser);
+
+        JPanel comboPanel = new JPanel();
+        comboPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
+        comboPanel.add(new JLabel("From"));
+        time = new JComboBox<>(TIME_LIST);
+        comboPanel.add(time);
+
+        JPanel userSearchPanel = new JPanel();
+        userSearchPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
+        user = new JTextField(15);
+        user.addActionListener(new UpdateAction());
+        userSearchPanel.add(new JLabel("User"));
+        userSearchPanel.add(user);
+
+        imported.setSelected(true);
+        downloaded.setSelected(true);
+
+        updateButton = new SideButton(new UpdateAction());
+        resetButton = new SideButton(new ResetAction());
+
+        panel.add(downloaded);
+        panel.add(imported);
+        panel.add(onlySigns);
+        panel.add(comboPanel);
+        panel.add(userSearchPanel);
+        panel.add(signChooserPanel);
+
+        createLayout(panel, true,
+                Arrays.asList(new SideButton[] { updateButton, resetButton }));
+    }
+
+    public static MapillaryFilterDialog getInstance() {
+        if (INSTANCE == null)
+            INSTANCE = new MapillaryFilterDialog();
+        return INSTANCE;
+    }
+
+    @Override
+    public void imagesAdded() {
+        refresh();
+    }
+
+    @Override
+    public void selectedImageChanged(MapillaryAbstractImage oldImage,
+            MapillaryAbstractImage newImage) {
+    }
+
+    public void reset() {
+        imported.setSelected(true);
+        downloaded.setSelected(true);
+        onlySigns.setEnabled(true);
+        onlySigns.setSelected(false);
+        user.setText("");
+        time.setSelectedItem(TIME_LIST[0]);
+        refresh();
+    }
+
+    public void refresh() {
+        boolean imported = this.imported.isSelected();
+        boolean downloaded = this.downloaded.isSelected();
+        boolean onlySigns = this.onlySigns.isSelected();
+
+        for (MapillaryAbstractImage img : MapillaryData.getInstance()
+                .getImages()) {
+            img.setVisible(true);
+            if (img instanceof MapillaryImportedImage) {
+                if (!imported)
+                    img.setVisible(false);
+                continue;
+            } else if (img instanceof MapillaryImage) {
+                if (!downloaded) {
+                    img.setVisible(false);
+                    continue;
+                }
+                if (onlySigns) {
+                    if (((MapillaryImage) img).getSigns().isEmpty()) {
+                        img.setVisible(false);
+                        continue;
+                    }
+                }
+                if (!user.getText().equals("")
+                        && !user.getText().equals(
+                                ((MapillaryImage) img).getUser())) {
+                    img.setVisible(false);
+                    continue;
+                }
+            }
+            // Calculates the amount of days since the image was taken
+            Long currentTime = currentTime();
+            if (time.getSelectedItem() == TIME_LIST[1]) {
+                if ((currentTime - img.getCapturedAt()) / (24 * 60 * 60 * 1000) > 365) {
+                    img.setVisible(false);
+                    continue;
+                }
+            }
+            if (time.getSelectedItem() == TIME_LIST[2]) {
+                if ((currentTime - img.getCapturedAt()) / (24 * 60 * 60 * 1000) > 30) {
+                    img.setVisible(false);
+                    continue;
+                }
+            }
+            if (time.getSelectedItem() == TIME_LIST[3]) {
+                if ((currentTime - img.getCapturedAt()) / (24 * 60 * 60 * 1000) > 7) {
+                    img.setVisible(false);
+                    continue;
+                }
+            }
+        }
+        MapillaryData.getInstance().dataUpdated();
+    }
+
+    private long currentTime() {
+        Calendar cal = Calendar.getInstance();
+        return cal.getTimeInMillis();
+    }
+
+    private class downloadCheckBoxAction extends AbstractAction {
+
+        public downloadCheckBoxAction() {
+            putValue(NAME, tr("Downloaded images"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent arg0) {
+            onlySigns.setEnabled(downloaded.isSelected());
+        }
+    }
+
+    private class UpdateAction extends AbstractAction {
+        public UpdateAction() {
+            putValue(NAME, tr("Update"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent arg0) {
+            MapillaryFilterDialog.getInstance().refresh();
+        }
+    }
+
+    private class ResetAction extends AbstractAction {
+        public ResetAction() {
+            putValue(NAME, tr("Reset"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent arg0) {
+            MapillaryFilterDialog.getInstance().reset();
+        }
+    }
+
+    private class SignChooserAction extends AbstractAction {
+        public SignChooserAction() {
+            putValue(NAME, tr("Choose signs"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent arg0) {
+            MapillaryFilterDialog.getInstance().refresh();
+        }
+    }
+
+    public static void destroyInstance() {
+        MapillaryFilterDialog.INSTANCE = null;        
+    }
+}
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31284)
@@ -170,3 +170,7 @@
         }
     }
+
+    public static void destroyInstance() {
+        MapillaryHistoryDialog.INSTANCE = null;
+    }
 }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java	(revision 31282)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java	(revision 31284)
@@ -164,7 +164,7 @@
                     this.nextButton.setEnabled(true);
                     this.previousButton.setEnabled(true);
-                    if (mapillaryImage.next() == null)
+                    if (mapillaryImage.next() == null || !mapillaryImage.next().isVisible())
                         this.nextButton.setEnabled(false);
-                    if (mapillaryImage.previous() == null)
+                    if (mapillaryImage.previous() == null || !mapillaryImage.previous().isVisible())
                         this.previousButton.setEnabled(false);
                 } else if (mode == SIGN_MODE) {
@@ -481,3 +481,7 @@
         }
     }
+
+    @Override
+    public void imagesAdded() {
+    }
 }
