bugGNUstep - Bugs: bug #19031, [NSDocument...

Group
 
 

bug #19031: [NSDocument runModalSavePanel:withAccessoryView:] doesn't check for existing accessoryView

Submitter:  Fabian Borschel <seirei>
Submitted:  Sun 11 Feb 2007 04:37:17 PM UTC
   
 
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  In Progress
Privacy:  Public Assigned to:  FredKiefer
Open/Closed:  In Test
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 20 Feb 2007 08:32:08 PM UTC, comment #5: 

The text there is not as clear to me as it seems to be for you:

"You can control whether the default accessory view (which contains a pop-up menu allowing the user to choose what type to save) appears in the Save panel by overriding shouldRunSavePanelWithAccessoryView. The default accessory view is used if that method returns YES and the document supports writing multiple types.

You can customize the panel more completely by overriding prepareSavePanel: and modifying the panel before calling super. For example, you could replace the accessory view entirely."

The word replace might indicate that you don't have to stop it from getting created, but I am not sure about that. Do you have the means to test this on Apple? I could do, but wont have the time for this before the FOSDEM.

Fred Kiefer <FredKiefer>
Group Member
Tue 20 Feb 2007 05:26:32 PM UTC, comment #4: 

Hm, well I thought if i don't want any accessory view you override the [NSDocument shouldRunSavePanelWithAccessoryView] and return NO.

If you want a customized accessory view you override [NSDocument prepareSavePanel] and do you changes there. At least that's what Apple tells in their FAQ for Document-Based Applications.

http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/index.html#//apple_ref/doc/uid/10000006i

There on the left menu select "Frequently Asked Questions" and look for the question "How can I customize the Save panel?". Apple uses frames, so i can't give you a direct link to this. Sorry.

Fabian Borschel <seirei>
Tue 20 Feb 2007 03:10:06 PM UTC, comment #3: 

Not sure, if you are correct. I would expect that, if you don't want the standard accessory view for your document,  you override the shouldRunSavePanelWithAccessoryView method to return NO. Why would you want any other accessory view to be created that you don't want to use?

With that in place my change makes perfect sense, at least to me :-)

If you still insist on your requested behaviour you will need to prove that Apple does it just the way you want it to be.

Fred Kiefer <FredKiefer>
Group Member
Tue 20 Feb 2007 01:43:14 PM UTC, comment #2: 

Your workaround is wrong in a kind of funny way.
You should test whether savePanel already has an attached accessoryView. So something like

- (int)runModalSavePanel: (NSSavePanel *)savePanel
       withAccessoryView: (NSView *)accessoryView
{
  if ([savePanel accessoryView] == nil)
    {
      [savePanel setAccessoryView: accessoryView];
    }
  return [savePanel runModal];
}

You tested whether accessoryView is nil which always is not because the given variable "accessoryView" always points to the fileType view generated by NSDocument class itself.

About the general case i don't know enough about how things work. But just taking the name "setAccessoryView" i would assume that this method replaces any existing accessory view. Maybe there could be something like "addAccessoryView".

Fabian Borschel <seirei>
Sun 18 Feb 2007 08:03:07 PM UTC, comment #1: 

I added a workaround for this problem, could you please test if it resolves your issue?
What I did is just not to set the accessory view in this method if it is nil. This wont work in the general case, when you want the standard accessory view plus your own, but in many cases it should be sufficient.

Fred Kiefer <FredKiefer>
Group Member
Sun 11 Feb 2007 04:37:17 PM UTC, original submission:  

Hi all,

if a document based application sets an accessory view via [NSDocument prepareSavePanel] to add a customized accessory view it gets overwritten by [NSDocument runModalSavePanel:withAccessoryView:].

Maybe [NSDocument runModalSavePanel:withAccessoryView:] should check whether savePanel already has an accessory view or if it's still nil.

Fabian

Fabian Borschel <seirei>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by seirei (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-02-18 FredKiefer StatusNone In Progress
        Assigned toNone FredKiefer
        Open/ClosedOpen In Test

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code