Revision 9990166e pithos-macos/PithosBrowserController.m
b/pithos-macos/PithosBrowserController.m | ||
---|---|---|
427 | 427 |
PithosNode *node = (PithosNode *)[notification object]; |
428 | 428 |
if ((node == accountNode) || ![node.pithos isEqualTo:pithos]) |
429 | 429 |
return; |
430 |
NSLog(@"pithosNodeChildrenUpdated:%@", node.url);
|
|
430 |
DLog(@"pithosNodeChildrenUpdated:%@", node.url);
|
|
431 | 431 |
NSInteger lastColumn = [browser lastColumn]; |
432 | 432 |
for (NSInteger column = lastColumn; column >= 0; column--) { |
433 | 433 |
if ([[browser parentForItemsInColumn:column] isEqualTo:node]) { |
... | ... | |
910 | 910 |
dropOperation:(NSBrowserDropOperation)dropOperation { |
911 | 911 |
if ([[[info draggingPasteboard] types] containsObject:NSFilenamesPboardType]) { |
912 | 912 |
NSArray *filenames = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType]; |
913 |
NSLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
|
|
913 |
DLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
|
|
914 | 914 |
if ((column != -1) && (filenames != nil)) { |
915 | 915 |
PithosNode *node; |
916 | 916 |
if (row != -1) |
917 | 917 |
node = [browser itemAtRow:row inColumn:column]; |
918 | 918 |
else |
919 | 919 |
node = [browser parentForItemsInColumn:column]; |
920 |
NSLog(@"drag in node: %@", node.url);
|
|
920 |
DLog(@"drag in node: %@", node.url);
|
|
921 | 921 |
return [self uploadFiles:filenames toNode:node]; |
922 | 922 |
} |
923 | 923 |
} else if ([[[info draggingPasteboard] types] containsObject:NSFilesPromisePboardType]) { |
924 |
NSLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
|
|
924 |
DLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
|
|
925 | 925 |
if ((column != -1) && (draggedNodes != nil)) { |
926 | 926 |
PithosNode *node; |
927 | 927 |
if (row != -1) |
928 | 928 |
node = [browser itemAtRow:row inColumn:column]; |
929 | 929 |
else |
930 | 930 |
node = [browser parentForItemsInColumn:column]; |
931 |
NSLog(@"drag local node: %@", node.url);
|
|
931 |
DLog(@"drag local node: %@", node.url);
|
|
932 | 932 |
if ([info draggingSourceOperationMask] & NSDragOperationMove) |
933 | 933 |
return [self moveNodes:draggedNodes toNode:node]; |
934 | 934 |
else if ([info draggingSourceOperationMask] & NSDragOperationCopy) |
... | ... | |
1130 | 1130 |
NSString *contentType = [PithosUtilities contentTypeOfFile:filePath error:&error]; |
1131 | 1131 |
if (contentType == nil) |
1132 | 1132 |
contentType = @"application/octet-stream"; |
1133 |
#if DEBUG_PITHOS |
|
1133 | 1134 |
if (error) |
1134 |
NSLog(@"contentType detection error: %@", error); |
|
1135 |
DLog(@"contentType detection error: %@", error); |
|
1136 |
#endif |
|
1135 | 1137 |
NSArray *hashes = nil; |
1136 | 1138 |
if (operation.isCancelled) { |
1137 | 1139 |
[pool drain]; |
... | ... | |
1673 | 1675 |
- (void)requestFailed:(ASIPithosRequest *)request { |
1674 | 1676 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1675 | 1677 |
NSOperation *operation = [request.userInfo objectForKey:@"operation"]; |
1676 |
NSLog(@"Request failed: %@", request.url);
|
|
1678 |
DLog(@"Request failed: %@", request.url);
|
|
1677 | 1679 |
if (operation.isCancelled) { |
1678 | 1680 |
[pool drain]; |
1679 | 1681 |
return; |
... | ... | |
1708 | 1710 |
- (void)downloadObjectFinished:(ASIPithosObjectRequest *)objectRequest { |
1709 | 1711 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1710 | 1712 |
NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"]; |
1711 |
NSLog(@"Download finished: %@", objectRequest.url);
|
|
1713 |
DLog(@"Download finished: %@", objectRequest.url);
|
|
1712 | 1714 |
if (operation.isCancelled) { |
1713 | 1715 |
[self requestFailed:objectRequest]; |
1714 | 1716 |
} else if (objectRequest.responseStatusCode == 200) { |
... | ... | |
1724 | 1726 |
// but this callback method is not called in the case of a directory download. |
1725 | 1727 |
// It maybe the case though, when downloading an old version of an object, is of a directory content type. |
1726 | 1728 |
// In this case, a file should be created. This is actually a feature that allows you to hide data in a directory object. |
1727 |
NSLog(@"Downloaded 0 bytes");
|
|
1729 |
DLog(@"Downloaded 0 bytes");
|
|
1728 | 1730 |
NSFileManager *fileManager = [NSFileManager defaultManager]; |
1729 | 1731 |
if (![fileManager fileExistsAtPath:filePath]) { |
1730 | 1732 |
if (![fileManager createFileAtPath:filePath contents:nil attributes:nil]) { |
... | ... | |
1758 | 1760 |
- (void)uploadDirectoryObjectFinished:(ASIPithosObjectRequest *)objectRequest { |
1759 | 1761 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1760 | 1762 |
NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"]; |
1761 |
NSLog(@"Upload directory object finished: %@", objectRequest.url);
|
|
1763 |
DLog(@"Upload directory object finished: %@", objectRequest.url);
|
|
1762 | 1764 |
if (operation.isCancelled) { |
1763 | 1765 |
[self requestFailed:objectRequest]; |
1764 | 1766 |
} else if (objectRequest.responseStatusCode == 201) { |
1765 |
NSLog(@"Directory object created: %@", objectRequest.url);
|
|
1767 |
DLog(@"Directory object created: %@", objectRequest.url);
|
|
1766 | 1768 |
dispatch_async(dispatch_get_main_queue(), ^{ |
1767 | 1769 |
[activityFacility endActivity:[objectRequest.userInfo objectForKey:@"activity"] |
1768 | 1770 |
withMessage:[objectRequest.userInfo objectForKey:@"finishedActivityMessage"]]; |
... | ... | |
1787 | 1789 |
- (void)uploadObjectUsingHashMapFinished:(ASIPithosObjectRequest *)objectRequest { |
1788 | 1790 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1789 | 1791 |
NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"]; |
1790 |
NSLog(@"Upload using hashmap finished: %@", objectRequest.url);
|
|
1792 |
DLog(@"Upload using hashmap finished: %@", objectRequest.url);
|
|
1791 | 1793 |
NSString *fileName = [objectRequest.userInfo objectForKey:@"fileName"]; |
1792 | 1794 |
PithosActivity *activity = [objectRequest.userInfo objectForKey:@"activity"]; |
1793 | 1795 |
NSUInteger totalBytes = activity.totalBytes; |
... | ... | |
1795 | 1797 |
if (operation.isCancelled) { |
1796 | 1798 |
[self requestFailed:objectRequest]; |
1797 | 1799 |
} else if (objectRequest.responseStatusCode == 201) { |
1798 |
NSLog(@"Object created: %@", objectRequest.url);
|
|
1800 |
DLog(@"Object created: %@", objectRequest.url);
|
|
1799 | 1801 |
dispatch_async(dispatch_get_main_queue(), ^{ |
1800 | 1802 |
[activityFacility endActivity:activity |
1801 | 1803 |
withMessage:[objectRequest.userInfo objectForKey:@"finishedActivityMessage"] |
... | ... | |
1815 | 1817 |
} else if (objectRequest.responseStatusCode == 409) { |
1816 | 1818 |
NSUInteger iteration = [[objectRequest.userInfo objectForKey:@"iteration"] unsignedIntegerValue]; |
1817 | 1819 |
if (iteration == 0) { |
1818 |
NSLog(@"Upload iteration limit reached: %@", objectRequest.url);
|
|
1820 |
DLog(@"Upload iteration limit reached: %@", objectRequest.url);
|
|
1819 | 1821 |
dispatch_async(dispatch_get_main_queue(), ^{ |
1820 | 1822 |
[activityFacility endActivity:activity |
1821 | 1823 |
withMessage:[objectRequest.userInfo objectForKey:@"failedActivityMessage"]]; |
... | ... | |
1829 | 1831 |
[pool drain]; |
1830 | 1832 |
return; |
1831 | 1833 |
} |
1832 |
NSLog(@"object is missing hashes: %@", objectRequest.url);
|
|
1834 |
DLog(@"object is missing hashes: %@", objectRequest.url);
|
|
1833 | 1835 |
NSIndexSet *missingBlocks = [PithosUtilities missingBlocksForHashes:[objectRequest.userInfo objectForKey:@"hashes"] |
1834 | 1836 |
withMissingHashes:[objectRequest hashes]]; |
1835 | 1837 |
NSUInteger blockSize = [[objectRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue]; |
... | ... | |
1874 | 1876 |
- (void)uploadMissingBlockFinished:(ASIPithosContainerRequest *)containerRequest { |
1875 | 1877 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1876 | 1878 |
NSOperation *operation = [containerRequest.userInfo objectForKey:@"operation"]; |
1877 |
NSLog(@"Upload of missing block finished: %@", containerRequest.url);
|
|
1879 |
DLog(@"Upload of missing block finished: %@", containerRequest.url);
|
|
1878 | 1880 |
NSUInteger blockSize = [[containerRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue]; |
1879 | 1881 |
NSString *fileName = [containerRequest.userInfo objectForKey:@"fileName"]; |
1880 | 1882 |
PithosActivity *activity = [containerRequest.userInfo objectForKey:@"activity"]; |
... | ... | |
1936 | 1938 |
- (void)moveFinished:(ASIPithosObjectRequest *)objectRequest { |
1937 | 1939 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1938 | 1940 |
NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"]; |
1939 |
NSLog(@"Move object finished: %@", objectRequest.url);
|
|
1941 |
DLog(@"Move object finished: %@", objectRequest.url);
|
|
1940 | 1942 |
if (operation.isCancelled) { |
1941 | 1943 |
[self requestFailed:objectRequest]; |
1942 | 1944 |
} else if (objectRequest.responseStatusCode == 201) { |
... | ... | |
1964 | 1966 |
- (void)copyFinished:(ASIPithosObjectRequest *)objectRequest { |
1965 | 1967 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1966 | 1968 |
NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"]; |
1967 |
NSLog(@"Copy object finished: %@", objectRequest.url);
|
|
1969 |
DLog(@"Copy object finished: %@", objectRequest.url);
|
|
1968 | 1970 |
if (operation.isCancelled) { |
1969 | 1971 |
[self requestFailed:objectRequest]; |
1970 | 1972 |
} else if (objectRequest.responseStatusCode == 201) { |
... | ... | |
1992 | 1994 |
- (void)deleteObjectFinished:(ASIPithosObjectRequest *)objectRequest { |
1993 | 1995 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
1994 | 1996 |
NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"]; |
1995 |
NSLog(@"Delete object finished: %@", objectRequest.url);
|
|
1997 |
DLog(@"Delete object finished: %@", objectRequest.url);
|
|
1996 | 1998 |
if (operation.isCancelled) { |
1997 | 1999 |
[self requestFailed:objectRequest]; |
1998 | 2000 |
} else if (objectRequest.responseStatusCode == 204) { |
... | ... | |
2114 | 2116 |
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id<NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index { |
2115 | 2117 |
if ([[[info draggingPasteboard] types] containsObject:NSFilenamesPboardType]) { |
2116 | 2118 |
NSArray *filenames = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType]; |
2117 |
NSLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
|
|
2119 |
DLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
|
|
2118 | 2120 |
if (item && (index == NSOutlineViewDropOnItemIndex) && (filenames != nil)) { |
2119 | 2121 |
PithosNode *node = (PithosNode *)item; |
2120 |
NSLog(@"drag in node: %@", node.url);
|
|
2122 |
DLog(@"drag in node: %@", node.url);
|
|
2121 | 2123 |
return [self uploadFiles:filenames toNode:node]; |
2122 | 2124 |
} |
2123 | 2125 |
} else if ([[[info draggingPasteboard] types] containsObject:NSFilesPromisePboardType]) { |
2124 |
NSLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
|
|
2126 |
DLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
|
|
2125 | 2127 |
if (item && (index == NSOutlineViewDropOnItemIndex) && (draggedNodes != nil)) { |
2126 | 2128 |
PithosNode *node = (PithosNode *)item; |
2127 |
NSLog(@"drag local node: %@", node.url);
|
|
2129 |
DLog(@"drag local node: %@", node.url);
|
|
2128 | 2130 |
if (![[draggedNodes objectAtIndex:0] shared] && ![[draggedNodes objectAtIndex:0] sharingAccount] && |
2129 | 2131 |
([info draggingSourceOperationMask] & NSDragOperationMove)) |
2130 | 2132 |
return [self moveNodes:draggedNodes toNode:node]; |
Also available in: Unified diff