[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug in NSDocumentController
From: |
Germán Arias |
Subject: |
Re: Possible bug in NSDocumentController |
Date: |
Thu, 26 Dec 2013 17:11:07 -0600 |
El jue, 26-12-2013 a las 22:52 +0100, Wolfgang Lux escribió:
> Am 24.12.2013 um 19:41 schrieb Germán Arias <address@hidden>:
>
> > El mar, 24-12-2013 a las 11:23 +0100, Wolfgang Lux escribió:
> >> Hi Germán,
> >>
> >>> Is this correct? (line 1218 NSDocumentController.m)
> >>>
> >>> name = [[NSBundle mainBundle] localizedStringForKey: type
> >>> value: type
> >>> table: @"InfoPlist"];
> >>>
> >>>
> >>> Don't should be NSHumanReadableNameKey the first "type".
> >>
> >> looking at Apple's documentation for the -displayNameForType: method
> >> (which contains your code excerpt) [1], I'd say the implementation is
> >> correct. The documentation contains an example showing how to provide a
> >> name for a file type called '
> >> BinaryFile' and it states that
> >> you could provide a descriptive name by adding an entry in the
> >> InfoPlist.strings file:
> >> BinaryFile = "Binary file format";
> >> so the lookup should indeed use type for the key argument.
> >>
> >> Wolfgang
> >>
> >> [1]
> >> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSDocumentController_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDocumentController/displayNameForType:
> >
> > Well, I'm having a problem in Windows with WinUXTheme when the type is
> > an array. For example:
> >
> > NSHumanReadableName = "Text Document";
> > NSUnixExtensions = ( txt, TXT );
> > NSDOSExtensions = ( txt, TXT );
> >
> > In this case:
> >
> > [dc displayNameForType: type];
> >
> > where type is "txt, TXT", return the same string not "Text Document", as
> > expected. But no idea where is the problem.
>
> It looks like you are confusing the document type and its file type
> extensions. The type name that is expected as argument for the
> displayNameForType: method is the one you'll find under the CFBundleTypeName
> key or, for backward compatibility, the NSName key. Passing that string to
> -displayNameForType: should return "Text Document".
>
> Wolfgang
>
Yes, I noticed this some hours ago. Anyway, the problem now is that I
don't want an entry for each file extension. So I will work in a
solution this tonight.
Thanks.
Germán.