[browser loadColumnZero];
[containersNodeChildren removeAllObjects];
[outlineView reloadData];
-
// Expand the folder outline view
[outlineView expandItem:nil expandChildren:YES];
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
// Refresh account
[accountNode refresh];
+ [mySharedNode refresh];
+ [othersSharedNode refresh];
}
- (void)windowDidLoad {
// Expand the folder outline view
[outlineView expandItem:nil expandChildren:YES];
- if ((rootNode == containersNode) || (rootNode == sharedNode)) {
+ if ((rootNode == nil) || (rootNode == containersNode) || (rootNode == sharedNode)) {
rootNode = [containersNodeChildren objectAtIndex:0];
[browser loadColumnZero];
}
#pragma mark Actions
- (IBAction)refresh:(id)sender {
- if (sender)
- [accountNode refresh];
- for (NSInteger column = [browser lastColumn]; column >= 0; column--) {
- [(PithosNode *)[browser parentForItemsInColumn:column] invalidateChildren];
+ if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) {
+ if (sender)
+ [accountNode forceRefresh];
+ for (NSInteger column = [browser lastColumn]; column >= 0; column--) {
+ PithosNode *node = (PithosNode *)[browser parentForItemsInColumn:column];
+ node.forcedRefresh = YES;
+ [(PithosNode *)[browser parentForItemsInColumn:column] invalidateChildren];
+ //[(PithosNode *)[browser parentForItemsInColumn:column] forceRefresh];
+ }
+ } else {
+ if (sender)
+ [accountNode refresh];
+ for (NSInteger column = [browser lastColumn]; column >= 0; column--) {
+ [(PithosNode *)[browser parentForItemsInColumn:column] invalidateChildren];
+ }
}
[browser validateVisibleColumns];
}
if ([PithosFileUtilities objectExistsAtContainerName:node.pithosContainer.name
objectName:destinationObjectName
error:&error
- isDirectory:&isDirectory]) {
+ isDirectory:&isDirectory
+ sharingAccount:nil]) {
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert setMessageText:@"Name Taken"];
[alert setInformativeText:[NSString stringWithFormat:@"The name '%@' is already taken. Please choose a different name", newName]];
if ([PithosFileUtilities objectExistsAtContainerName:node.pithosContainer.name
objectName:destinationObjectName
error:&error
- isDirectory:&isDirectory]) {
+ isDirectory:&isDirectory
+ sharingAccount:nil]) {
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert setMessageText:@"Name Taken"];
[alert setInformativeText:[NSString stringWithFormat:@"The name '%@' is already taken. Please choose a different name", newName]];
if (*row != -1) {
// Check if the node is not a folder and if so redirect to the parent item
dropNode = [browser itemAtRow:*row inColumn:*column];
- if ([dropNode class] != [PithosSubdirNode class])
+ if ([dropNode class] == [PithosObjectNode class])
*row = -1;
}
if (*row == -1)
dropNode = [browser parentForItemsInColumn:*column];
- if (!dropNode.shared && !dropNode.sharingAccount) {
+ if (!dropNode.shared &&
+ (!dropNode.sharingAccount ||
+ ([dropNode class] == [PithosSubdirNode class]) ||
+ ([dropNode class] == [PithosContainerNode class]))) {
*dropOperation = NSBrowserDropOn;
result = NSDragOperationCopy;
}
if (*row != -1) {
// Check if the node is not a folder and if so redirect to the parent item
dropNode = [browser itemAtRow:*row inColumn:*column];
- if ([dropNode class] != [PithosSubdirNode class])
+ if ([dropNode class] == [PithosObjectNode class])
*row = -1;
}
if (*row == -1)
blockHash:blockHash
forFile:filePath
checkIfExists:YES
- hashes:&hashes];
+ hashes:&hashes
+ sharingAccount:node.sharingAccount];
if (objectRequest) {
objectRequest.delegate = self;
objectRequest.didFinishSelector = @selector(uploadObjectUsingHashMapFinished:);
objectRequest.didFailSelector = @selector(uploadObjectUsingHashMapFailed:);
- objectRequest.userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- containerName, @"containerName",
- objectName, @"objectName",
- contentType, @"contentType",
- [NSNumber numberWithUnsignedInteger:blockSize], @"blockSize",
- blockHash, @"blockHash",
- filePath, @"filePath",
- hashes, @"hashes",
- node, @"node",
- [NSNumber numberWithUnsignedInteger:10], @"iteration",
- nil];
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ containerName, @"containerName",
+ objectName, @"objectName",
+ contentType, @"contentType",
+ [NSNumber numberWithUnsignedInteger:blockSize], @"blockSize",
+ blockHash, @"blockHash",
+ filePath, @"filePath",
+ hashes, @"hashes",
+ node, @"node",
+ [NSNumber numberWithUnsignedInteger:10], @"iteration",
+ nil];
+ if (node.sharingAccount)
+ [userInfo setObject:node.sharingAccount forKey:@"sharingAccount"];
+ objectRequest.userInfo = userInfo;
[objectRequest startAsynchronous];
}
});
contentTypes:&contentTypes
filePaths:&filePaths
hashesArrays:&hashesArrays
- directoryObjectRequests:&directoryObjectRequests];
+ directoryObjectRequests:&directoryObjectRequests
+ sharingAccount:node.sharingAccount];
for (ASIPithosObjectRequest *objectRequest in directoryObjectRequests) {
objectRequest.delegate = self;
objectRequest.didFinishSelector = @selector(uploadDirectoryObjectFinished:);
objectRequest.delegate = self;
objectRequest.didFinishSelector = @selector(uploadObjectUsingHashMapFinished:);
objectRequest.didFailSelector = @selector(uploadObjectUsingHashMapFailed:);
- objectRequest.userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- containerName, @"containerName",
- [objectNames objectAtIndex:i], @"objectName",
- [contentTypes objectAtIndex:i], @"contentType",
- [NSNumber numberWithUnsignedInteger:blockSize], @"blockSize",
- blockHash, @"blockHash",
- [filePaths objectAtIndex:i], @"filePath",
- [hashesArrays objectAtIndex:i], @"hashes",
- [NSNumber numberWithUnsignedInteger:10], @"iteration",
- nil];
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ containerName, @"containerName",
+ [objectNames objectAtIndex:i], @"objectName",
+ [contentTypes objectAtIndex:i], @"contentType",
+ [NSNumber numberWithUnsignedInteger:blockSize], @"blockSize",
+ blockHash, @"blockHash",
+ [filePaths objectAtIndex:i], @"filePath",
+ [hashesArrays objectAtIndex:i], @"hashes",
+ [NSNumber numberWithUnsignedInteger:10], @"iteration",
+ nil];
+ if (node.sharingAccount)
+ [userInfo setObject:node.sharingAccount forKey:@"sharingAccount"];
+ objectRequest.userInfo = userInfo;
[objectRequest startAsynchronous];
}
}
objectName:@".upload"
blockSize:[[objectRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue]
forFile:[objectRequest.userInfo objectForKey:@"filePath"]
- missingBlockIndex:missingBlockIndex];
+ missingBlockIndex:missingBlockIndex
+ sharingAccount:[objectRequest.userInfo objectForKey:@"sharingAccount"]];
newObjectRequest.delegate = self;
newObjectRequest.didFinishSelector = @selector(uploadMissingBlockFinished:);
newObjectRequest.didFailSelector = @selector(uploadMissingBlockFailed:);
blockHash:[objectRequest.userInfo objectForKey:@"blockHash"]
forFile:[objectRequest.userInfo objectForKey:@"filePath"]
checkIfExists:NO
- hashes:&hashes];
+ hashes:&hashes
+ sharingAccount:[objectRequest.userInfo objectForKey:@"sharingAccount"]];
newObjectRequest.delegate = self;
newObjectRequest.didFinishSelector = @selector(uploadObjectUsingHashMapFinished:);
newObjectRequest.didFailSelector = @selector(uploadObjectUsingHashMapFailed:);
objectName:@".upload"
blockSize:[[objectRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue]
forFile:[objectRequest.userInfo objectForKey:@"filePath"]
- missingBlockIndex:missingBlockIndex];
+ missingBlockIndex:missingBlockIndex
+ sharingAccount:[objectRequest.userInfo objectForKey:@"sharingAccount"]];
newObjectRequest.delegate = self;
newObjectRequest.didFinishSelector = @selector(uploadMissingBlockFinished:);
newObjectRequest.didFailSelector = @selector(uploadMissingBlockFailed:);