Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Quicksilver/Code-QuickStepCore/QSObject_Pasteboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ - (id) pasteboardPropertyListForType:(NSPasteboardType) type {
}

if ([type isEqualToString:NSPasteboardTypeURL]) {
if ([pbData isKindOfClass:[NSData class]]) {
pbData = [[NSString alloc] initWithData:pbData encoding:NSUTF8StringEncoding];
}
return [pbData hasPrefix:@"mailto:"] ? [pbData substringFromIndex:7] : pbData;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ - (NSDate *)path:(NSString *)path wasModifiedAfter:(NSDate *)date depth:(NSInteg
[url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];
[url getResourceValue:&isPackage forKey:NSURLIsPackageKey error:nil];
if (depth && isDirectory && !isPackage) {
@autoreleasepool {
moddate = [self path:[url path] wasModifiedAfter:date depth:depth--];
}
moddate = [self path:[url path] wasModifiedAfter:date depth:depth--];
if (moddate)
return moddate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
- (void)updateActionsNow;

- (void)updateIndirectObjects;
- (void)updateIndirectObjectsWithCompletion:(void (^)(void))completion;
- (void)updateViewLocations;
- (void)invalidateHide;

Expand Down
30 changes: 26 additions & 4 deletions Quicksilver/Code-QuickStepInterface/QSInterfaceController.m
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,13 @@ - (void)updateActionsNow {
}

- (void)updateIndirectObjects {
[self updateIndirectObjectsWithCompletion:nil];
}

- (void)updateIndirectObjectsWithCompletion:(void (^)(void))completion {
// Don't update the indirect objects if this is a 'silent' update.
if ([aSelector updatesSilently]) {
if (completion) completion();
return;
}
QSAction *aObj = [aSelector objectValue];
Expand Down Expand Up @@ -384,6 +389,7 @@ - (void)updateIndirectObjects {
QSGCDMainAsync(^{
[self updateControl:self->iSelector withArray:finalIndirects];
[self->iSelector setSearchMode:(finalIndirects ? SearchFilter : SearchFilterAll)];
if (completion) completion();
});
});
}
Expand Down Expand Up @@ -466,8 +472,10 @@ - (void)searchObjectChanged:(NSNotification*)notif {
if (argumentCount == 2 || ([[[[self window] contentView] subviews] containsObject:iSelector] && [obj indirectOptional])) {
[self updateIndirectObjects];
}
[self updateViewLocations];
}
// Always update view locations when the action changes, including when
// it becomes nil (so the 3rd pane is hidden when actions are cleared)
[self updateViewLocations];
} else if ([notif object] == iSelector) {
[self updateViewLocations];
}
Expand Down Expand Up @@ -642,6 +650,20 @@ - (void)executeCommand:(id)sender cont:(BOOL)cont encapsulate:(BOOL)encapsulate

QSAction *action = [aSelector objectValue];
NSInteger argumentCount = [action argumentCount];

if (argumentCount == 2) {
// for the case where we require an argument, update the indirects *then* perform the execute
[self updateIndirectObjectsWithCompletion:^{
[self performExecuteAction:action argumentCount:argumentCount cont:cont encapsulate:encapsulate];
}];
} else {
// otherwise, just perform the execute straight away
[self performExecuteAction:action argumentCount:argumentCount cont:cont encapsulate:encapsulate];
}
return;
}

- (void)performExecuteAction:(QSAction *)action argumentCount:(NSInteger)argumentCount cont:(BOOL)cont encapsulate:(BOOL)encapsulate {
if (argumentCount == 2) {
BOOL indirectIsRequired = ![action indirectOptional];
BOOL indirectIsInvalid = ![iSelector objectValue];
Expand All @@ -653,7 +675,7 @@ - (void)executeCommand:(id)sender cont:(BOOL)cont encapsulate:(BOOL)encapsulate
}
[QSExec noteIndirect:[iSelector objectValue] forAction:action];
}

// add the object being executed to the history
[dSelector updateHistory];
// make sure to save mnemonics before interface is closed. Closing the interface clears the search string so they must be saved before this
Expand All @@ -663,7 +685,7 @@ - (void)executeCommand:(id)sender cont:(BOOL)cont encapsulate:(BOOL)encapsulate
if (argumentCount == 2) {
[iSelector saveMnemonic];
}

if (encapsulate) {
[self encapsulateCommand];
return;
Expand All @@ -677,7 +699,7 @@ - (void)executeCommand:(id)sender cont:(BOOL)cont encapsulate:(BOOL)encapsulate
[self executeCommandThreaded];
});
} else {
// action can only be run on main thread
// action can only be run on main thread
QSGCDMainSync(^{
[self executeCommandThreaded];
});
Expand Down
35 changes: 19 additions & 16 deletions Quicksilver/PlugIns-Main/QSCorePlugIn/Code/QSDirectoryParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ - (NSArray *)objectsFromPath:(NSString *)path depth:(NSInteger)depth types:(NSAr

NSArray *properties = @[NSURLIsSymbolicLinkKey, NSURLIsAliasFileKey, NSURLIsDirectoryKey, NSURLTypeIdentifierKey, NSURLIsPackageKey];

NSMutableArray *array = [NSMutableArray array];

NSDirectoryEnumerator *enumerator = [manager enumeratorAtURL:[NSURL fileURLWithPath:path]
includingPropertiesForKeys:properties
options:NSDirectoryEnumerationSkipsHiddenFiles | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsSubdirectoryDescendants
errorHandler:nil];
if (!enumerator) return nil;

NSMutableArray *array = [NSMutableArray array];

for (NSURL *theURL in enumerator) {
NSString *file = [theURL path];

Expand All @@ -74,39 +74,40 @@ - (NSArray *)objectsFromPath:(NSString *)path depth:(NSInteger)depth types:(NSAr

NSURL *targetURL = nil;


if ([resources[NSURLIsAliasFileKey] boolValue]) {
NSDictionary *newResources = [resources copy];
targetURL = [theURL copy];
targetURL = theURL;

while ([newResources[NSURLIsAliasFileKey] boolValue]) {
// NB: `NSURLIsAliasFileKey` AND `NSURLIsSymbolicLinkKey`
// are BOTH true for symlinks (only the former for aliases,
// or even aliases to symlinks)

if ([newResources[NSURLIsSymbolicLinkKey] boolValue]) {
NSURL *oldTarget = [targetURL copy];
targetURL = [targetURL URLByReallyResolvingSymlinksInPath];
if ([targetURL isEqual:oldTarget])
NSURL *newTarget = [targetURL URLByReallyResolvingSymlinksInPath];
if ([newTarget isEqual:targetURL])
break;
targetURL = newTarget;
} else {
BOOL stale = NO;
targetURL = [NSURL URLByResolvingBookmarkAtURL:targetURL
options:NSURLBookmarkResolutionWithoutUI | NSURLBookmarkResolutionWithoutMounting
bookmarkDataIsStale:&stale
error:&err];
NSURL *resolvedURL = [NSURL URLByResolvingBookmarkAtURL:targetURL
options:NSURLBookmarkResolutionWithoutUI | NSURLBookmarkResolutionWithoutMounting
bookmarkDataIsStale:&stale
error:&err];

if (!targetURL) {
if (!resolvedURL) {
NSLog(@"Error resolving %@alias at %@: %@", (stale ? @"stale " : @""), theURL, err);
break;
}
targetURL = resolvedURL;
}
newResources = [targetURL resourceValuesForKeys:properties error:&err];
}
} else {
isDirectory = [resources[NSURLIsDirectoryKey] boolValue];
}

if (targetURL) {
if (targetURL && targetURL != theURL) {
/* This was a symlink or an alias, grab the correct information */
aliasSource = [NDAlias aliasWithContentsOfFile:file];
aliasFile = file;
Expand Down Expand Up @@ -148,11 +149,13 @@ - (NSArray *)objectsFromPath:(NSString *)path depth:(NSInteger)depth types:(NSAr
shouldDescend = NO;

if (depth && isDirectory && shouldDescend) {
@autoreleasepool {
[array addObjectsFromArray:[self objectsFromPath:[theURL path] depth:depth types:types excludeTypes:excludedTypes descend:descendIntoBundles]];
}
[array addObjectsFromArray:[self objectsFromPath:[theURL path] depth:depth types:types excludeTypes:excludedTypes descend:descendIntoBundles]];
}
}

// Ensure enumerator is released, freeing file descriptors
enumerator = nil;

#ifdef DEBUG
if (VERBOSE) {
NSLog(@"Scanning %@ took %ld µs",path,(long)(-[startDate timeIntervalSinceNow]*1000000));
Expand Down
Loading
Loading