aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.h2
-rw-r--r--Source/SPDatabaseDocument.m23
2 files changed, 20 insertions, 5 deletions
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index fd716668..bcd92d59 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -163,6 +163,8 @@
NSInteger _queryMode;
BOOL _isSavedInBundle;
+ BOOL _workingTimeout;
+
NSWindow *taskProgressWindow;
BOOL taskDisplayIsIndeterminate;
CGFloat taskProgressValue;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index a66d0f42..0c2b7de7 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -4633,6 +4633,11 @@ YY_BUFFER_STATE yy_scan_string (const char *);
}
+- (void)setTimeout
+{
+ _workingTimeout = YES;
+}
+
- (void)handleSchemeCommand:(NSDictionary*)commandDict
{
@@ -4643,11 +4648,19 @@ YY_BUFFER_STATE yy_scan_string (const char *);
NSString *docProcessID = [self processID];
if(!docProcessID) docProcessID = @"";
- // Bail if document is busy
- if (_isWorkingLevel) {
- [SPTooltip showWithObject:NSLocalizedString(@"Connection window is busy. URL scheme command bailed", @"Connection window is busy. URL scheme command bailed") atLocation:[NSApp mouseLocation]];
- NSBeep();
- return;
+ // Wait for self
+ _workingTimeout = NO;
+ // the following while loop waits maximal 5secs
+ [self performSelector:@selector(setTimeout) withObject:nil afterDelay:5.0];
+ while (_isWorkingLevel || !_isConnected) {
+ if(_workingTimeout) break;
+ // Do not block self
+ NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
+ untilDate:[NSDate distantPast]
+ inMode:NSDefaultRunLoopMode
+ dequeue:YES];
+ if(event) [NSApp sendEvent:event];
+
}
if([command isEqualToString:@"SelectDocumentView"]) {