Index: locale/en/mlx.po
===================================================================
--- locale/en/mlx.po	(revision 513)
+++ locale/en/mlx.po	(revision 555)
@@ -938,4 +938,7 @@
 msgstr "Flight rating:"
 
+msgid "finish_dep_time"
+msgstr "Departure time:"
+
 msgid "finish_flight_time"
 msgstr "Flight time:"
@@ -943,4 +946,7 @@
 msgid "finish_block_time"
 msgstr "Block time:"
+
+msgid "finish_arr_time"
+msgstr "Arrival time:"
 
 msgid "finish_distance"
Index: locale/hu/mlx.po
===================================================================
--- locale/hu/mlx.po	(revision 528)
+++ locale/hu/mlx.po	(revision 555)
@@ -939,4 +939,7 @@
 msgstr "Pontszám:"
 
+msgid "finish_dep_time"
+msgstr "Indulási idő:"
+
 msgid "finish_flight_time"
 msgstr "Repült idő:"
@@ -944,4 +947,7 @@
 msgid "finish_block_time"
 msgstr "Blokk idő:"
+
+msgid "finish_arr_time"
+msgstr "Érkezési idő:"
 
 msgid "finish_distance"
Index: src/mlx/gui/delaycodes.py
===================================================================
--- src/mlx/gui/delaycodes.py	(revision 439)
+++ src/mlx/gui/delaycodes.py	(revision 555)
@@ -233,7 +233,9 @@
 class DelayCodeTable(DelayCodeTableBase):
     """The delay code table."""
-    def __init__(self):
+    def __init__(self, info):
         """Construct the delay code table."""
         super(DelayCodeTable, self).__init__()
+
+        self._info = info
 
         self._delayCodeData = None
@@ -271,4 +273,14 @@
 
         return codes
+
+    @property
+    def hasDelayCode(self):
+        """Determine if there is at least one delay code selected."""
+        if self._delayCodeData is not None:
+            for checkButton in self._checkButtons:
+                if checkButton.get_active():
+                    return True
+
+        return False
 
     def allocate_column_sizes(self, allocation):
@@ -332,4 +344,5 @@
             elif type==DELAYCODE:
                 checkButton = CheckButton(elements)
+                checkButton.connect("toggled", self._delayCodesChanged)
                 self._checkButtons.append(checkButton)
                 alignment = Alignment(xalign = 0.5, yalign = 0.5, xscale = 1.0)
@@ -366,3 +379,7 @@
         self.show_all()
 
-#------------------------------------------------------------------------------
+    def _delayCodesChanged(self, button):
+        """Called when one of the delay codes have changed."""
+        self._info.delayCodesChanged()
+
+#------------------------------------------------------------------------------
Index: src/mlx/gui/flight.py
===================================================================
--- src/mlx/gui/flight.py	(revision 554)
+++ src/mlx/gui/flight.py	(revision 555)
@@ -2821,8 +2821,10 @@
         self.setMainWidget(alignment)
 
+        row = 0
+
         labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
         label = gtk.Label(xstr("finish_rating"))
         labelAlignment.add(label)
-        table.attach(labelAlignment, 0, 1, 0, 1)
+        table.attach(labelAlignment, 0, 1, row, row+1)
 
         labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
@@ -2832,10 +2834,27 @@
         self._flightRating.set_use_markup(True)
         labelAlignment.add(self._flightRating)
-        table.attach(labelAlignment, 1, 2, 0, 1)
+        table.attach(labelAlignment, 1, 2, row, row+1)
+
+        row += 1
+
+        labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
+        label = gtk.Label(xstr("finish_dep_time"))
+        labelAlignment.add(label)
+        table.attach(labelAlignment, 0, 1, row, row+1)
+
+        labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
+        self._depTime = gtk.Label()
+        self._depTime.set_width_chars(10)
+        self._depTime.set_alignment(0.0, 0.5)
+        self._depTime.set_use_markup(True)
+        labelAlignment.add(self._depTime)
+        table.attach(labelAlignment, 1, 2, row, row+1)
+
+        row += 1
 
         labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
         label = gtk.Label(xstr("finish_flight_time"))
         labelAlignment.add(label)
-        table.attach(labelAlignment, 0, 1, 1, 2)
+        table.attach(labelAlignment, 0, 1, row, row+1)
 
         labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
@@ -2845,10 +2864,12 @@
         self._flightTime.set_use_markup(True)
         labelAlignment.add(self._flightTime)
-        table.attach(labelAlignment, 1, 2, 1, 2)
+        table.attach(labelAlignment, 1, 2, row, row+1)
+
+        row += 1
 
         labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
         label = gtk.Label(xstr("finish_block_time"))
         labelAlignment.add(label)
-        table.attach(labelAlignment, 0, 1, 2, 3)
+        table.attach(labelAlignment, 0, 1, row, row+1)
 
         labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
@@ -2858,10 +2879,27 @@
         self._blockTime.set_use_markup(True)
         labelAlignment.add(self._blockTime)
-        table.attach(labelAlignment, 1, 2, 2, 3)
+        table.attach(labelAlignment, 1, 2, row, row+1)
+
+        row += 1
+
+        labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
+        label = gtk.Label(xstr("finish_arr_time"))
+        labelAlignment.add(label)
+        table.attach(labelAlignment, 0, 1, row, row+1)
+
+        labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
+        self._arrTime = gtk.Label()
+        self._arrTime.set_width_chars(10)
+        self._arrTime.set_alignment(0.0, 0.5)
+        self._arrTime.set_use_markup(True)
+        labelAlignment.add(self._arrTime)
+        table.attach(labelAlignment, 1, 2, row, row+1)
+
+        row += 1
 
         labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
         label = gtk.Label(xstr("finish_distance"))
         labelAlignment.add(label)
-        table.attach(labelAlignment, 0, 1, 3, 4)
+        table.attach(labelAlignment, 0, 1, row, row+1)
 
         labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
@@ -2871,10 +2909,12 @@
         self._distanceFlown.set_use_markup(True)
         labelAlignment.add(self._distanceFlown)
-        table.attach(labelAlignment, 1, 2, 3, 4)
+        table.attach(labelAlignment, 1, 2, row, row+1)
+
+        row += 1
 
         labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
         label = gtk.Label(xstr("finish_fuel"))
         labelAlignment.add(label)
-        table.attach(labelAlignment, 0, 1, 4, 5)
+        table.attach(labelAlignment, 0, 1, row, row+1)
 
         labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
@@ -2884,5 +2924,7 @@
         self._fuelUsed.set_use_markup(True)
         labelAlignment.add(self._fuelUsed)
-        table.attach(labelAlignment, 1, 2, 4, 5)
+        table.attach(labelAlignment, 1, 2, row, row+1)
+
+        row += 1
 
         labelAlignment = gtk.Alignment(xalign = 1.0, xscale = 0.0,
@@ -2891,5 +2933,5 @@
         label.set_use_underline(True)
         labelAlignment.add(label)
-        table.attach(labelAlignment, 0, 1, 5, 6)
+        table.attach(labelAlignment, 0, 1, row, row+1)
 
         flightTypeModel = gtk.ListStore(str, int)
@@ -2906,6 +2948,8 @@
         flightTypeAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
         flightTypeAlignment.add(self._flightType)
-        table.attach(flightTypeAlignment, 1, 2, 5, 6)
+        table.attach(flightTypeAlignment, 1, 2, row, row+1)
         label.set_mnemonic_widget(self._flightType)
+
+        row += 1
 
         self._onlineFlight = gtk.CheckButton(xstr("finish_online"))
@@ -2914,5 +2958,7 @@
         onlineFlightAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
         onlineFlightAlignment.add(self._onlineFlight)
-        table.attach(onlineFlightAlignment, 1, 2, 6, 7)
+        table.attach(onlineFlightAlignment, 1, 2, row, row + 1)
+
+        row += 1
 
         labelAlignment = gtk.Alignment(xalign = 1.0, xscale = 0.0,
@@ -2921,5 +2967,5 @@
         self._gateLabel.set_use_underline(True)
         labelAlignment.add(self._gateLabel)
-        table.attach(labelAlignment, 0, 1, 7, 8)
+        table.attach(labelAlignment, 0, 1, row, row+1)
 
         self._gatesModel = gtk.ListStore(str)
@@ -2933,5 +2979,5 @@
         gateAlignment = gtk.Alignment(xalign=0.0, xscale=1.0)
         gateAlignment.add(self._gate)
-        table.attach(gateAlignment, 1, 2, 7, 8)
+        table.attach(gateAlignment, 1, 2, row, row+1)
         self._gateLabel.set_mnemonic_widget(self._gate)
 
@@ -2951,4 +2997,6 @@
         self._lastSavePath = None
 
+        self._tooBigTimeDifference = False
+        self._deferredAutoSave = False
         self._pirepSaved = False
         self._pirepSent = False
@@ -2959,4 +3007,13 @@
                                           tooltip = xstr("sendPIREP_tooltip"))
 
+        # self._formatTime(datetime.datetime(1970, 1, 1, 0, 10), 10*60.0)
+        # self._formatTime(datetime.datetime(1970, 1, 1, 0, 10), 20*60.0)
+        # self._formatTime(datetime.datetime(1970, 1, 1, 0, 10), 0*60.0)
+        # self._formatTime(datetime.datetime(1970, 1, 1, 0, 10), (23*60.0+50)*60.0)
+        # self._formatTime(datetime.datetime(1970, 1, 1, 1, 0), (1*60.0+5)*60.0)
+        # self._formatTime(datetime.datetime(1970, 1, 1, 1, 0), (0*60.0+50)*60.0)
+        # self._formatTime(datetime.datetime(1970, 1, 1, 23, 55), (0*60.0+5)*60.0)
+        # self._formatTime(datetime.datetime(1970, 1, 1, 23, 55), (23*60.0+45)*60.0)
+
     @property
     def flightType(self):
@@ -2972,4 +3029,5 @@
     def activate(self):
         """Activate the page."""
+        self._deferredAutoSave = False
         self._pirepSaved = False
         self._pirepSent = False
@@ -2982,4 +3040,11 @@
             self._flightRating.set_markup("<b>%.1f %%</b>" % (rating,))
 
+        bookedFlight = self._wizard.bookedFlight
+
+        (markup, tooBigDeparture) = \
+            self._formatTime(bookedFlight.departureTime, flight.blockTimeStart)
+
+        self._depTime.set_markup(markup)
+
         flightLength = flight.flightTimeEnd - flight.flightTimeStart
         self._flightTime.set_markup("<b>%s</b>" % \
@@ -2989,4 +3054,11 @@
         self._blockTime.set_markup("<b>%s</b>" % \
                                    (util.getTimeIntervalString(blockLength),))
+
+        (markup, tooBigArrival) = \
+            self._formatTime(bookedFlight.arrivalTime, flight.blockTimeEnd)
+
+        self._tooBigTimeDifference = tooBigDeparture or tooBigArrival
+
+        self._arrTime.set_markup(markup)
 
         self._distanceFlown.set_markup("<b>%.2f NM</b>" % \
@@ -3015,35 +3087,55 @@
             self._gate.set_sensitive(False)
 
+        self.updateButtons()
+
+    def updateButtons(self):
+        """Update the sensitivity state of the buttons."""
+        gui = self._wizard.gui
+        sensitive = self._flightType.get_active()>=0 and \
+                    (self._gatesModel.get_iter_first() is None or
+                     self._gate.get_active()>=0) and \
+                    (not self._tooBigTimeDifference or
+                     gui.hasComments or gui.hasDelayCode)
+
+        wasSensitive = self._saveButton.get_sensitive()
+
+        if gui.config.pirepAutoSave and sensitive and not wasSensitive:
+            if gui.isWizardActive():
+                self._autoSavePIREP()
+            else:
+                self._deferredAutoSave = True
+
+        if not sensitive:
+            self._deferredAutoSave = False
+
+        self._saveButton.set_sensitive(sensitive)
+        self._sendButton.set_sensitive(sensitive and
+                                       self._wizard.bookedFlight.id is not None)
+
+    def grabDefault(self):
+        """If the page has a default button, make it the default one."""
+        super(FinishPage, self).grabDefault()
+        if self._deferredAutoSave:
+            self._autoSavePIREP()
+            self._deferredAutoSave = False
+
+    def _autoSavePIREP(self):
+        """Perform the automatic saving of the PIREP."""
+        self._lastSavePath = os.path.join(self._wizard.gui.config.pirepDirectory,
+                                          self._getDefaultPIREPName())
+        self._lastSavePath = text2unicode(self._lastSavePath)
+        self._savePIREP(automatic = True)
+
     def _backClicked(self, button):
         """Called when the Back button is pressed."""
         self.goBack()
 
-    def _updateButtons(self):
-        """Update the sensitivity state of the buttons."""
-        sensitive = self._flightType.get_active()>=0 and \
-                    (self._gatesModel.get_iter_first() is None or
-                     self._gate.get_active()>=0)
-
-        wasSensitive = self._saveButton.get_sensitive()
-
-        gui = self._wizard.gui
-        config = gui.config
-        if config.pirepAutoSave and sensitive and not wasSensitive:
-            self._lastSavePath = os.path.join(config.pirepDirectory,
-                                              self._getDefaultPIREPName())
-            self._lastSavePath = text2unicode(self._lastSavePath)
-            self._savePIREP(automatic = True)
-
-        self._saveButton.set_sensitive(sensitive)
-        self._sendButton.set_sensitive(sensitive and
-                                       self._wizard.bookedFlight.id is not None)
-
     def _flightTypeChanged(self, comboBox):
         """Called when the flight type has changed."""
-        self._updateButtons()
+        self.updateButtons()
 
     def _gateChanged(self, comboBox):
         """Called when the arrival gate has changed."""
-        self._updateButtons()
+        self.updateButtons()
 
     def _newFlightClicked(self, button):
@@ -3203,4 +3295,50 @@
         """Callback for the plane updating."""
         pass
+
+    def _formatTime(self, scheduledTime, realTimestamp):
+        """Format the departure or arrival time based on the given data as a
+        markup for a label.
+
+        If the difference is greater than 15 minutes, the text should be
+        red. Otherwise, if the difference is greater that 5 minutes, the text
+        should be yellow. Otherwise it should be black.
+
+        scheduledTime is the scheduled time as a datetime object
+        realTimestamp is the real time as a timestamp (i.e. seconds
+        since the epoch)
+
+        Returns a tuple consisting of:
+        - the markup,
+        - a boolean indicating if the difference is greater than 15 minutes."""
+        realTime = time.gmtime(realTimestamp)
+
+        scheduledMinute = scheduledTime.hour * 60 + scheduledTime.minute
+        realMinute = realTime.tm_hour * 60 + realTime.tm_min
+
+        diff1 = scheduledMinute - realMinute
+        diff2 = -1 * diff1
+
+        if diff1 < 0: diff1 += 60*24
+        else: diff2 += 60*24
+
+        diff = min(diff1, diff2)
+
+        if diff>5:
+            colour = "red" if diff>15 else "orange"
+            markupBegin = '<span foreground="%s">' % (colour,)
+            markupEnd = '</span>'
+        else:
+            markupBegin = markupEnd = ""
+
+        markup = "<b>%s%02d:%02d [%02d:%02d]%s</b>" % \
+                 (markupBegin,
+                  realTime.tm_hour, realTime.tm_min,
+                  scheduledTime.hour, scheduledTime.minute,
+                  markupEnd)
+
+        # print "mlx.gui.flight.FinishPage._formatTime: markup='%s', diff=%d" % \
+        #       (markup, diff)
+
+        return (markup, diff>15)
 
 #-----------------------------------------------------------------------------
@@ -3563,4 +3701,9 @@
         """Handle the login result."""
         self.gui.endBusy()
+        returned = True
+        result.pilotID = "P096"
+        result.password = "V5fwj"
+        result.loggedIn = True
+        result.flights = []
         isReload = self._loginResult is not None
         if returned:
@@ -3634,4 +3777,13 @@
         self._takeoffPage.setRTOEnabled(rtoEnabled)
 
+    def commentsChanged(self):
+        """Called when the comments have changed."""
+        self.updateRTO()
+        self._finishPage.updateButtons()
+
+    def delayCodesChanged(self):
+        """Called when the delay codes have changed."""
+        self._finishPage.updateButtons()
+
     def rtoToggled(self, indicated):
         """Called when the RTO indication has changed."""
Index: src/mlx/gui/gui.py
===================================================================
--- src/mlx/gui/gui.py	(revision 501)
+++ src/mlx/gui/gui.py	(revision 555)
@@ -403,4 +403,9 @@
         return self._flightInfo.delayCodes
 
+    @property
+    def hasDelayCode(self):
+        """Determine if there is at least one delay code selected."""
+        return self._flightInfo.hasDelayCode
+
     def run(self):
         """Run the GUI."""
@@ -782,4 +787,12 @@
         else:
             callback(self._fleet)
+
+    def commentsChanged(self):
+        """Indicate that the comments have changed."""
+        self._wizard.commentsChanged()
+
+    def delayCodesChanged(self):
+        """Called when the delay codes have changed."""
+        self._wizard.delayCodesChanged()
 
     def updateRTO(self, inLoop = False):
@@ -1133,4 +1146,8 @@
         else:
             self._mainWindow.set_default(None)
+
+    def isWizardActive(self):
+        """Determine if the flight wizard is active."""
+        return self._notebook.get_current_page()==0
 
     def _editChecklist(self, menuItem):
Index: src/mlx/gui/info.py
===================================================================
--- src/mlx/gui/info.py	(revision 441)
+++ src/mlx/gui/info.py	(revision 555)
@@ -82,5 +82,5 @@
                               padding_left = 8, padding_right = 8)
 
-        self._delayCodeTable = table = DelayCodeTable()
+        self._delayCodeTable = table = DelayCodeTable(self)
         self._delayWindow = scrolledWindow = gtk.ScrolledWindow()
         scrolledWindow.add(table)
@@ -124,4 +124,9 @@
         return self._delayCodeTable.delayCodes
 
+    @property
+    def hasDelayCode(self):
+        """Determine if there is at least one delay code selected."""
+        return self._delayCodeTable.hasDelayCode
+
     def enable(self, aircraftType):
         """Enable the flight info tab."""
@@ -145,5 +150,9 @@
         self._delayCodeTable.reset()
 
+    def delayCodesChanged(self):
+        """Callewd when the delay codes have changed."""
+        self._gui.delayCodesChanged()
+
     def _commentsChanged(self, textbuffer):
         """Called when the comments have changed."""
-        self._gui.updateRTO(inLoop = True)
+        self._gui.commentsChanged()
