             return
       deferred.promise
 
+    ###
+    Creates a new GMail dialog
+
+    @param {String} title The title for the dialog
+    @param {Array} okButton The text elements of the OK button (label, tooltip)
+    @param {Array} cancelButton The text elements of the cancel button (label, tooltip)
+    @return {Array} an array consisting of jQuery elements ([dialog, okButton, cancelButton, container, footer])
+    ###
     createDialog: (title, okButton, cancelButton) ->
       dialog = new GMailUI.ModalDialog title
 

        return
      return

    @isAuthorisationErrorPage: (contents) -> /reauth/i.test contents

    @isAuthorisationErrorResponse: (resp) ->
      (resp?.toLowerCase().indexOf "authorization") isnt -1

    isAuthorised: ->
      log 'checking if the user authorised'
      deferred = new $.Deferred
      @getServiceUrl().then (url) ->
        url += M.SETUP_URL_SUFFIX

        error = ->
          log '...user is not authorised (yet/any more)'
          deferred.reject()
          return

        $.ajax
          url:      url
          dataType: 'json'
          cache:    false
          data:     format: 'json'
          success:  (data, textStatus, jqXHR) ->
            if data.success
              log '...user is still authorised'
              deferred.resolve()
            else
              error textStatus, jqXHR.responseText
            return
          error:    (jqXHR, textStatus, errorThrown) ->
            error textStatus, jqXHR.responseText
            return
      deferred.promise

            url += M.SCHEDULE_SUFFIX
            success = =>
              deferred.resolve()
              Q.all([
                (__msg 'notificationScheduleSuccessTitle')
                (__msg 'notificationScheduleSuccess')
              ]).then ([_title, _body]) ->
                ExtensionFacade.showNotification 'shared/images/tie.svg', _title, _body
                return
              @activateArchiveButton() if data.archiveAfterScheduling
              return

            error = (status, err, responseText) =>
              deferred.reject()
              @onScheduleError status, data, err, responseText
              return

            ($.post url, data, null, 'json')
