Re: "untitled" vs "Untitled"
Re: "untitled" vs "Untitled"
- Subject: Re: "untitled" vs "Untitled"
- From: m <email@hidden>
- Date: Sun, 10 Jul 2005 15:10:08 -0700
On Jul 10, 2005, at 12:52 PM, mmalcolm crawford wrote:
Please keep this relevant to Cocoa. Discussion of how to set an
NSDocument's title is relevant, discussion of the relative titling
schemes in general is not.
Here's a HIG (and human) compliant override for NSDocument's
displayName method. I haven't exhaustively tested it, but it seems to
work for the languages I've tried.
- (NSString *)displayName
{
NSString* displayName = [super displayName];
// Determine if this document was never saved.
// We do this by checking if the document has a file path. This is
// complicated (slightly) by the fact that NSDocument's fileURL
method
// is new in Tiger, and NSDocument's filePath is method
// is deprecated in Tiger.
BOOL neverSaved = NO;
if ([self methodForSelector:@selector(fileURL)])
{
neverSaved = [self fileURL] == nil;
}
else
{
neverSaved = [self fileName] == nil;
}
if (neverSaved)
{
// Lowercase the displayName so that, for example,
// "Untitled 4" becomes "untitled 4".
displayName = [displayName lowercaseString];
}
return displayName;
}
_murat
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden