Skip to content

Commit

Permalink
drop zone no longer accepts drags when an upload is in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
moshee committed Mar 30, 2014
1 parent d0cca8d commit 2591d40
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Airlift/ALDropZoneView.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ - (void)cancelUpload:(id)sender {
return;
}
NSLog(@"Cancelling current upload");
// when the upload object is cancelled, it will trigger its own request
// completion delegate method, and that will remove the "uploading" status
// over here, which will set the upload to nil. So we don't have to nil it
// out here.
[_currentUpload cancel];
}

Expand All @@ -255,6 +259,9 @@ - (void)oops:(id)sender {
#pragma mark - Drag and drop

- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
if (_currentUpload != nil) {
return NSDragOperationNone;
}
[self addStatus:ALDropZoneStatusDrag];
return NSDragOperationCopy;
}
Expand All @@ -268,6 +275,9 @@ - (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)sender {
}

- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
if (_currentUpload != nil) {
return NO;
}
NSPasteboard* pboard = [sender draggingPasteboard];

if (![[pboard types] containsObject:NSFilenamesPboardType]) {
Expand Down

0 comments on commit 2591d40

Please sign in to comment.