Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using Move to.../Copy to... set the 3rd pane object to the parent directory of the file to be moved/copied #665

Merged
merged 6 commits into from Jan 31, 2012
4 changes: 4 additions & 0 deletions Quicksilver/Code-QuickStepCore/QSLibrarian.m
Expand Up @@ -80,12 +80,16 @@ - (id)init {
[NSMutableArray array] , kItemChildren, [NSMutableArray array] , kItemChildren,
[NSNumber numberWithBool:YES] , kItemEnabled, nil]; [NSNumber numberWithBool:YES] , kItemEnabled, nil];


#ifdef DEBUG
if ((int) getenv("QSDisableCatalog") || GetCurrentKeyModifiers() & shiftKey) { if ((int) getenv("QSDisableCatalog") || GetCurrentKeyModifiers() & shiftKey) {
NSLog(@"Disabling Catalog"); NSLog(@"Disabling Catalog");
} else { } else {
#endif
[self setCatalog:[QSCatalogEntry entryWithDictionary: [self setCatalog:[QSCatalogEntry entryWithDictionary:
[NSMutableDictionary dictionaryWithObjectsAndKeys:@"QSCATALOGROOT", kItemName, @"QSGroupObjectSource", kItemSource, [NSMutableArray arrayWithObjects:modulesEntry, nil] , kItemChildren, [NSNumber numberWithBool:YES] , kItemEnabled, nil]]]; [NSMutableDictionary dictionaryWithObjectsAndKeys:@"QSCATALOGROOT", kItemName, @"QSGroupObjectSource", kItemSource, [NSMutableArray arrayWithObjects:modulesEntry, nil] , kItemChildren, [NSNumber numberWithBool:YES] , kItemEnabled, nil]]];
#ifdef DEBUG
} }
#endif


// Register for Notifications // Register for Notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(writeCatalog:) name:QSCatalogEntryChanged object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(writeCatalog:) name:QSCatalogEntryChanged object:nil];
Expand Down
4 changes: 2 additions & 2 deletions Quicksilver/Code-QuickStepInterface/QSSearchObjectView.h
Expand Up @@ -83,8 +83,8 @@ typedef enum QSSearchMode {


- (NSMutableArray *)sourceArray; - (NSMutableArray *)sourceArray;
- (void)setSourceArray:(NSMutableArray *)newSourceArray; - (void)setSourceArray:(NSMutableArray *)newSourceArray;
- (NSArray *)searchArray; - (NSMutableArray *)searchArray;
- (void)setSearchArray:(NSArray *)newSearchArray; - (void)setSearchArray:(NSMutableArray *)newSearchArray;
- (NSMutableArray *)resultArray; - (NSMutableArray *)resultArray;
- (void)setResultArray:(NSMutableArray *)newResultArray; - (void)setResultArray:(NSMutableArray *)newResultArray;


Expand Down
15 changes: 12 additions & 3 deletions Quicksilver/Code-QuickStepInterface/QSSearchObjectView.m
Expand Up @@ -293,8 +293,8 @@ - (void)setResultArray:(NSMutableArray *)newResultArray {
[(id)[self controller] searchView:self changedResults:newResultArray]; [(id)[self controller] searchView:self changedResults:newResultArray];
} }


- (NSArray *)searchArray { return searchArray; } - (NSMutableArray *)searchArray { return searchArray; }
- (void)setSearchArray:(NSArray *)newSearchArray { - (void)setSearchArray:(NSMutableArray *)newSearchArray {
if (searchArray != newSearchArray) { if (searchArray != newSearchArray) {
[searchArray release]; [searchArray release];
searchArray = [newSearchArray retain]; searchArray = [newSearchArray retain];
Expand Down Expand Up @@ -580,7 +580,16 @@ - (IBAction)updateResultView:(id)sender {
#pragma mark - #pragma mark -
#pragma mark Object Value #pragma mark Object Value
- (void)selectObjectValue:(QSObject *)newObject { - (void)selectObjectValue:(QSObject *)newObject {
if (newObject != [self objectValue]) { QSObject *currentObject = [self objectValue];
QSObject *tempNewObject;
QSObject *tempCurrentObject;
if ([newObject isKindOfClass:[QSRankedObject class]]) {
tempNewObject = [(QSRankedObject *)newObject object];
}
if ([currentObject isKindOfClass:[QSRankedObject class]]) {
tempCurrentObject = [(QSRankedObject *)currentObject object];
}
if ((tempNewObject ? tempNewObject : newObject) != (tempCurrentObject ? tempCurrentObject : currentObject)) {
[self updateHistory]; [self updateHistory];
[super setObjectValue:newObject]; [super setObjectValue:newObject];
[[NSNotificationCenter defaultCenter] postNotificationName:@"SearchObjectChanged" object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:@"SearchObjectChanged" object:self];
Expand Down
Expand Up @@ -343,15 +343,25 @@ - (NSArray *)validIndirectObjectsForAction:(NSString *)action directObject:(QSOb
return [NSArray arrayWithObject:[QSObject textProxyObjectWithDefaultValue:@"untitled folder"]]; return [NSArray arrayWithObject:[QSObject textProxyObjectWithDefaultValue:@"untitled folder"]];
} else if ([action isEqualToString:kFileMoveToAction] || [action isEqualToString:kFileCopyToAction]) { } else if ([action isEqualToString:kFileMoveToAction] || [action isEqualToString:kFileCopyToAction]) {
// We only want folders for the move to / copy to actions (can't move to anything else) // We only want folders for the move to / copy to actions (can't move to anything else)
NSArray *fileObjects = [[QSLibrarian sharedInstance] arrayForType:QSFilePathType]; NSMutableArray *fileObjects = [[[QSLibrarian sharedInstance] arrayForType:QSFilePathType] mutableCopy];
BOOL isDirectory; BOOL isDirectory;
NSString *currentFolderPath = [[[[dObject splitObjects] lastObject] singleFilePath] stringByDeletingLastPathComponent];
// if it wasn't in the catalog, create it from scratch
QSObject *currentFolderObject = [QSObject fileObjectWithPath:currentFolderPath];
[fileObjects removeObject:currentFolderObject];
[fileObjects insertObject:currentFolderObject atIndex:0];
NSWorkspace *ws = [[NSWorkspace sharedWorkspace] retain];
NSFileManager *fm = [[NSFileManager alloc] init];
for(QSObject *thisObject in fileObjects) { for(QSObject *thisObject in fileObjects) {
NSString *path = [thisObject singleFilePath]; NSString *path = [thisObject singleFilePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]) { if ([fm fileExistsAtPath:path isDirectory:&isDirectory]) {
if (isDirectory && ![[path pathExtension] length]) if (isDirectory && ![ws isFilePackageAtPath:path])
[validIndirects addObject:thisObject]; [validIndirects addObject:thisObject];
} }
} }
[fileObjects release];
[ws release];
[fm release];
return validIndirects; return validIndirects;
} }
return nil; return nil;
Expand Down