aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-17 12:33:21 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-17 12:33:21 +0000
commit521c78fc8e87734c8bdf7a30024ba51c3ec1a306 (patch)
tree81a7a3b4a9a3b7bbdb36f540855f32e811301f10
parentd5168baf1cec01f5d45f27c47a1b9746d8838afc (diff)
downloadsequelpro-521c78fc8e87734c8bdf7a30024ba51c3ec1a306.tar.gz
sequelpro-521c78fc8e87734c8bdf7a30024ba51c3ec1a306.tar.bz2
sequelpro-521c78fc8e87734c8bdf7a30024ba51c3ec1a306.zip
• improved timing behaviour for a SPDatabaseDocument if it receives a sequence of URL scheme commands
-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"]) {