Fixed issue with entry context menu displaying wrong attachments and custom attributes

This commit is contained in:
michael starke
2014-12-08 21:24:22 +01:00
parent 96a20292d8
commit 738d5c55db

View File

@@ -46,9 +46,10 @@ static NSUInteger const kMPAttachmentsMenuItem = 2000;
if([lastItem isSeparatorItem]) {
[menu removeItem:lastItem];
}
MPDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
KPKEntry *entry = document.selectedEntry;
/* since we can get opend on the non-selected entry, we have to resolve the target node */
id<MPTargetNodeResolving> entryResolver = [NSApp targetForAction:@selector(currentTargetEntry)];
KPKEntry *entry = [entryResolver currentTargetEntry];
if([entry.customAttributes count] > 0) {
[menu addItem:[NSMenuItem separatorItem]];
NSMenuItem *attributeItem = [[NSMenuItem alloc] init];