             hiddenHandle: yes
           mainView.inboxMessagesContainer.addPane paneView
           detail = new InboxMessageDetail cssClass : "message-detail", data
-          
+
           detail.registerListener
             KDEventTypes: 'viewAppended'
             listener: @
             callback: =>
               data.restComments 0, (err, comments)-> # log arguments, data
-          
+
           paneView.addSubView detail
           paneView.detail = detail
           item.paneView = paneView
 
         @selectMessage data, item, paneView
-      
+
     {newMessageBar} = mainView
 
     newMessageBar.registerListener
       KDEventTypes  : "AutoCompleteNeedsMemberData"
       listener      : @
-      callback      : (pubInst,event)=> 
+      callback      : (pubInst,event)=>
         {callback,inputValue,blacklist} = event
         @fetchAutoCompleteForToField inputValue,blacklist,callback
 
     newMessageBar.registerListener
       KDEventTypes  : 'MessageShouldBeSent'
       listener      : @
-      callback      : (pubInst,{formOutput,callback})-> 
+      callback      : (pubInst,{formOutput,callback})->
         @prepareMessage formOutput,callback
 
     newMessageBar.registerListener
       KDEventTypes: 'MessageShouldBeDisowned'
       listener    : @
       callback    : do=>
+        if not @selection
+          newMessageBar.disableMessageActionButtons()
+          modal.destroy()
+          return
         disownAll = (items, callback)->
           disownItem = race (i, item, fin)->
             item.data.disown (err)->

          , callback
          disownItem item for own id, item of items
        (pubInst, modal) =>
          log modal
          disownAll @selection, =>
            log "2", modal
            for own id, {item, paneView} of @selection
              item.destroy()
              paneView.destroy()
              @deselectMessages()
            modal.destroy()
  
    newMessageBar.registerListener
      KDEventTypes: 'MessageShouldBeMarkedAsUnread'
      listener    : @
      callback    : =>
        for own id, {item, data} of @selection
          log 'marking unread'
          data.unmark 'read', (err)->
            log err if err
            item.setClass 'unread' unless err
  
  goToNotifications:(notification)->
    @getView().showTab "notifications"
    @mainView.propagateEvent KDEventType : 'NotificationIsSelected', {item: notification, event} if notification?
    
  goToMessages:(message)->
    @getView().showTab "messages"
    @mainView.propagateEvent KDEventType : "MessageIsSelected", {item: message, event} if message?

  {race} = bongo

  constructor:(options, data)->
    view = new (KD.getPageClass 'Inbox') cssClass : "inbox-application"
    options = $.extend {view},options
    super options,data
    @selection = {}
