Close All Documents

  • Since this is no longer handled by the OS (probably in lieu of the silly new "quit when last doc is closed" behavior), is there a better way to handle it than what I have below?

    -(void) documentController:(NSDocumentController*)documentController didReviewAll:(BOOL)didReviewAll contextInfo:(void*)contextInfo
    {
    UNUSED_VAR(contextInfo);

    if(didReviewAll)
      for(MusicDocument* doc in [documentController documents])
      [doc close];
    }

    -(IBAction)closeAllDocuments:(id)sender
    {
    UNUSED_VAR(sender);

    [self reviewUnsavedDocumentsWithAlertTitle:nil cancellable:YES delegate:self didReviewAllSelector:@selector(documentController:didReviewAll:contextInfo:) contextInfo:nil];
    }

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
  • On May 1, 2013, at 12:03 PM, Steve Mills wrote:

    > Since this is no longer handled by the OS (probably in lieu of the silly new "quit when last doc is closed" behavior), is there a better way to handle it than what I have below?

    To be clear, are you suggesting that when quitting your app with unsaved documents open it's not asking you to review unsaved docs and you want it to that and are therefore having to somewhat implement that yourself?

    Quitting with unsaved documents open (according to Apple HIG) should now quit immediately and when the app reopens restore those same unsaved documents to their prior state so there's no need for review. It's separate from the (I completely agree) silly and maddening "quit when last doc is closed" behavior.

    However, unless your windows are marked as restorable I believe it should still be showing that review alert. So perhaps you might double check that.

    As far as your implementation goes it looks right to me.

    --
    Seth Willits
  • On May 1, 2013, at 14:58:47, Seth Willits <slists...> wrote:

    > To be clear, are you suggesting that when quitting your app with unsaved documents open it's not asking you to review unsaved docs and you want it to that and are therefore having to somewhat implement that yourself?

    No.

    > Quitting with unsaved documents open (according to Apple HIG) should now quit immediately and when the app reopens restore those same unsaved documents to their prior state so there's no need for review. It's separate from the (I completely agree) silly and maddening "quit when last doc is closed" behavior.

    That's only valid if the app is using the new autosave mechanism that saves changes in place. I am not.

    > However, unless your windows are marked as restorable I believe it should still be showing that review alert. So perhaps you might double check that.
    >
    > As far as your implementation goes it looks right to me.

    I'm not asking about closing docs when quitting, but handling the Close All Documents menu item, hence the possibly somewhat unclear subject line. We've offered this menu item in the past and will continue to offer it into the future. I just needed to implement it in a way that would live peacefully with Cocoa and make use of the "review changes" dealy-bob. Thanks for your input!

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today