diff options
author | Max <post@wickenrode.com> | 2015-10-21 00:39:34 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-10-21 00:39:34 +0200 |
commit | ffbf7a4a9d4c617afd47a5428a17e0646b9bce97 (patch) | |
tree | 9fe49434f160567671b1fe844b1fd590db1108af /Source/SPDatabaseDocument.m | |
parent | 5357fd1375d19a6c5de96293b3899f430422a3c0 (diff) | |
download | sequelpro-ffbf7a4a9d4c617afd47a5428a17e0646b9bce97.tar.gz sequelpro-ffbf7a4a9d4c617afd47a5428a17e0646b9bce97.tar.bz2 sequelpro-ffbf7a4a9d4c617afd47a5428a17e0646b9bce97.zip |
Fix bundle commands no longer working in popup field editor (and possibly other cases) (#2299)
Replacing some [NSApp mainWindow] with their actually intended calls [NSApp keyWindow] and [view window]
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index bd258662..fd4a74c5 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -5291,8 +5291,9 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; } if([command isEqualToString:@"SelectTableRows"]) { - if([params count] > 1 && [[[NSApp mainWindow] firstResponder] respondsToSelector:@selector(selectTableRows:)]) { - [(SPCopyTable *)[[NSApp mainWindow] firstResponder] selectTableRows:[params subarrayWithRange:NSMakeRange(1, [params count]-1)]]; + id firstResponder = [[NSApp keyWindow] firstResponder]; + if([params count] > 1 && [firstResponder respondsToSelector:@selector(selectTableRows:)]) { + [(SPCopyTable *)firstResponder selectTableRows:[params subarrayWithRange:NSMakeRange(1, [params count]-1)]]; } return; } @@ -6307,17 +6308,18 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; if(!correspondingWindowFound) stopTrigger = YES; } if(!stopTrigger) { + id firstResponder = [[NSApp keyWindow] firstResponder]; if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { [[SPAppDelegate onMainThread] executeBundleItemForApp:aMenuItem]; } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { - if ([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) { - [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem]; + if ([[[firstResponder class] description] isEqualToString:@"SPCopyTable"]) { + [[firstResponder onMainThread] executeBundleItemForDataTable:aMenuItem]; } } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { - if ([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]]) { - [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem]; + if ([firstResponder isKindOfClass:[NSTextView class]]) { + [[firstResponder onMainThread] executeBundleItemForInputField:aMenuItem]; } } } |