Revision: 11629 http://bibdesk.svn.sourceforge.net/bibdesk/?rev=11629&view=rev Author: hofman Date: 2007-11-17 11:15:07 -0800 (Sat, 17 Nov 2007)
Log Message: ----------- Declare a variable. Modified Paths: -------------- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument+Menus.m branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument+Menus.m =================================================================== --- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument+Menus.m 2007-11-17 19:07:51 UTC (rev 11628) +++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument+Menus.m 2007-11-17 19:15:07 UTC (rev 11629) @@ -154,7 +154,7 @@ return NO; } -- (BOOL) validateOpenLinkedFileMenuItem:(NSMenuItem*) menuItem { +- (BOOL) validateOpenLocalURLMenuItem:(NSMenuItem*) menuItem { NSString *field = [menuItem representedObject]; if (field == nil) field = BDSKLocalUrlString; @@ -170,7 +170,7 @@ return NO; } -- (BOOL) validateRevealLinkedFileMenuItem:(NSMenuItem*) menuItem { +- (BOOL) validateRevealLocalURLMenuItem:(NSMenuItem*) menuItem { NSString *field = [menuItem representedObject]; if (field == nil) field = BDSKLocalUrlString; @@ -189,20 +189,20 @@ - (BOOL) validateOpenRemoteURLMenuItem:(NSMenuItem*) menuItem { NSString *field = [menuItem representedObject]; if (field == nil) - field = BDSKLocalUrlString; + field = BDSKUrlString; NSEnumerator *e = [[self selectedPublications] objectEnumerator]; BibItem *pub = nil; while(pub = [e nextObject]){ - NSString *path = [pub localFilePathForField:field]; - if (path && [[NSFileManager defaultManager] fileExistsAtPath:path]) + NSURL *url = [pub remoteURLForField:field]; + if (url) return YES; } return NO; } -- (BOOL) validateShowNotesForLinkedFileMenuItem:(NSMenuItem*) menuItem { +- (BOOL) validateShowNotesForLocalURLMenuItem:(NSMenuItem*) menuItem { NSString *field = [menuItem representedObject]; if (field == nil) field = BDSKLocalUrlString; @@ -218,7 +218,7 @@ return NO; } -- (BOOL) validateCopyNotesForLinkedFileMenuItem:(NSMenuItem*) menuItem { +- (BOOL) validateCopyNotesForLocalURLMenuItem:(NSMenuItem*) menuItem { NSString *field = [menuItem representedObject]; if (field == nil) field = BDSKLocalUrlString; @@ -234,6 +234,26 @@ return NO; } +- (BOOL) validateOpenLinkedFileMenuItem:(NSMenuItem*) menuItem { + return [menuItem representedObject] != nil || [[[self selectedPublications] valueForKeyPath:@"@unionOfArrays.localFiles"] count] > 0; +} + +- (BOOL) validateRevealLinkedFileMenuItem:(NSMenuItem*) menuItem { + return [menuItem representedObject] != nil || [[[self selectedPublications] valueForKeyPath:@"@unionOfArrays.localFiles"] count] > 0; +} + +- (BOOL) validateOpenLinkedURLMenuItem:(NSMenuItem*) menuItem { + return [menuItem representedObject] != nil || [[[self selectedPublications] valueForKeyPath:@"@unionOfArrays.remoteURLs"] count] > 0; +} + +- (BOOL) validateShowNotesForLinkedFileMenuItem:(NSMenuItem*) menuItem { + return [menuItem representedObject] != nil || [[[self selectedPublications] valueForKeyPath:@"@unionOfArrays.localFiles"] count] > 0; +} + +- (BOOL) validateCopyNotesForLinkedFileMenuItem:(NSMenuItem*) menuItem { + return [menuItem representedObject] != nil || [[[self selectedPublications] valueForKeyPath:@"@unionOfArrays.localFiles"] count] > 0; +} + - (BOOL) validateDuplicateTitleToBooktitleMenuItem:(NSMenuItem*) menuItem { return ([self numberOfSelectedPubs] > 0 && [self hasExternalGroupsSelected] == NO); } @@ -639,14 +659,29 @@ else if(act == @selector(sendToLyX:)) { return [self validateSendToLyXMenuItem:menuItem]; } + else if(act == @selector(openLocalURL:)) { + return [self validateOpenLocalURLMenuItem:menuItem]; + } + else if(act == @selector(revealLocalURL:)) { + return [self validateRevealLocalURLMenuItem:menuItem]; + } + else if(act == @selector(openRemoteURL:)) { + return [self validateOpenRemoteURLMenuItem:menuItem]; + } + else if(act == @selector(showNotesForLocalURL:)) { + return [self validateShowNotesForLocalURLMenuItem:menuItem]; + } + else if(act == @selector(copyNotesForLocalURL:)) { + return [self validateCopyNotesForLocalURLMenuItem:menuItem]; + } else if(act == @selector(openLinkedFile:)) { return [self validateOpenLinkedFileMenuItem:menuItem]; } else if(act == @selector(revealLinkedFile:)) { return [self validateRevealLinkedFileMenuItem:menuItem]; } - else if(act == @selector(openRemoteURL:)) { - return [self validateOpenRemoteURLMenuItem:menuItem]; + else if(act == @selector(openLinkedURL:)) { + return [self validateOpenLinkedURLMenuItem:menuItem]; } else if(act == @selector(showNotesForLinkedFile:)) { return [self validateShowNotesForLinkedFileMenuItem:menuItem]; Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m =================================================================== --- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m 2007-11-17 19:07:51 UTC (rev 11628) +++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m 2007-11-17 19:15:07 UTC (rev 11629) @@ -2849,6 +2849,7 @@ - (void)fileView:(FileView *)aFileView willPopUpMenu:(NSMenu *)menu onIconAtIndex:(NSUInteger)anIndex { NSURL *theURL = anIndex == NSNotFound ? nil : [self objectInFileViewURLsAtIndex:anIndex]; int i; + NSMenuItem *item; if (theURL && i != -1) { i = [menu indexOfItemWithTag:FVOpenMenuItemTag]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit