From 77dae63cb9cdafeed97e4019a29b020242768fa5 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Wed, 1 Oct 2008 23:57:47 -0700 Subject: [PATCH] Updated -displayName to return the lastpathcomponent of fileURL when available. Reviewed by tom. --- AppKit/CPDocument.j | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/AppKit/CPDocument.j b/AppKit/CPDocument.j index cff5335eb..f80439066 100644 --- a/AppKit/CPDocument.j +++ b/AppKit/CPDocument.j @@ -267,13 +267,15 @@ var CPDocumentUntitledCount = 0; */ - (CPString)displayName { - // FIXME: By default, return last path component of fileURL + if (_fileURL) + return [_fileURL lastPathComponent]; + if (!_untitledDocumentIndex) _untitledDocumentIndex = ++CPDocumentUntitledCount; if (_untitledDocumentIndex == 1) return @"Untitled"; - + return @"Untitled " + _untitledDocumentIndex; } @@ -336,7 +338,7 @@ var CPDocumentUntitledCount = 0; { if (_fileURL == aFileURL) return; - + _fileURL = aFileURL; [_windowControllers makeObjectsPerformSelector:@selector(synchronizeWindowTitleWithDocumentName)];