Set the recent item menu text based on the localized name: this will honor the hidden extension key set in Finder.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@83232 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\MaddTheSane_cp 2013-02-28 16:54:50 +00:00
parent 097afff51f
commit 817e7dad39
1 changed files with 9 additions and 2 deletions

View File

@ -73,7 +73,13 @@
- (NSMenuItem*)newMenuItem:(NSURL*)documentURL
{
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[documentURL lastPathComponent] action:@selector(openRecentItem:) keyEquivalent:@""];
NSString *lastName = nil;
[documentURL getResourceValue:&lastName forKey:NSURLLocalizedNameKey error:NULL];
if (!lastName) {
lastName = [documentURL lastPathComponent];
}
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:lastName action:@selector(openRecentItem:) keyEquivalent:@""];
[newItem setRepresentedObject:documentURL];
//[newItem setEnabled:YES];
[newItem setTarget:self];
@ -97,7 +103,7 @@
// Document items are menu items with tag 0
- (void)removeDocumentItems
{
NSMutableArray *removeItemsArray = [NSMutableArray array];
NSMutableArray *removeItemsArray = [[NSMutableArray alloc] initWithCapacity:10];
for (NSMenuItem* item in [self itemArray]) {
if([item tag] == 0) {
[removeItemsArray addObject:item];
@ -106,6 +112,7 @@
for (NSMenuItem *item in removeItemsArray) {
[self removeItem:item];
}
RELEASEOBJ(removeItemsArray);
}
@end