aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-12-14 22:12:36 +0000
committerstuconnolly <stuart02@gmail.com>2010-12-14 22:12:36 +0000
commit2f1146de80e658021e6a0fc63a20b039f73cca06 (patch)
treeaf451ac4cd3fbbee8b03f306cfdc95435e5ca1f5 /Source/SPDatabaseDocument.m
parent9859a8f8b20ebf038967a09b40bba9b4eb2f223b (diff)
parent263c981e4905595ebcb3e5d57609ddf75bdf40a2 (diff)
downloadsequelpro-2f1146de80e658021e6a0fc63a20b039f73cca06.tar.gz
sequelpro-2f1146de80e658021e6a0fc63a20b039f73cca06.tar.bz2
sequelpro-2f1146de80e658021e6a0fc63a20b039f73cca06.zip
Bring outline view branch up to date with trunk (r3018:3028).
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m38
1 files changed, 35 insertions, 3 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 44d3965c..86588f88 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -55,6 +55,7 @@
#import "SPTableCopy.h"
#import "SPDatabaseRename.h"
#import "SPServerSupport.h"
+#import "SPTooltip.h"
@interface SPDatabaseDocument (PrivateAPI)
@@ -4553,7 +4554,10 @@
if(!docProcessID) docProcessID = @"";
// Authenticate command
- if(![docProcessID isEqualToString:[commandDict objectForKey:@"id"]]) return;
+ if(![docProcessID isEqualToString:[commandDict objectForKey:@"id"]]) {
+ [SPTooltip showWithObject:NSLocalizedString(@"URL scheme command couldn't authenticated", @"URL scheme command couldn't authenticated") atLocation:[NSApp mouseLocation]];
+ return;
+ }
if([command isEqualToString:@"SelectDocumentView"]) {
if([params count] == 2) {
@@ -4645,7 +4649,8 @@
if([command isEqualToString:@"ExecuteQuery"]) {
// Bail if document is busy
- if (_isWorkingLevel) return;
+ if (_isWorkingLevel)
+ [SPTooltip showWithObject:NSLocalizedString(@"Connection window is busy. URL scheme command bailed", @"Connection window is busy. URL scheme command bailed") atLocation:[NSApp mouseLocation]];
NSString *outputFormat = @"tab";
if([params count] == 2)
@@ -4660,6 +4665,7 @@
NSFileManager *fm = [NSFileManager defaultManager];
NSString *status = @"0";
BOOL isDir;
+ BOOL userTerminated = NO;
if([fm fileExistsAtPath:queryFileName isDirectory:&isDir] && !isDir) {
NSError *inError = nil;
@@ -4717,12 +4723,21 @@
NSInteger i, j;
NSArray *theRow;
NSMutableString *result = [NSMutableString string];
-
if(writeAsCsv) {
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
[result setString:@""];
theRow = [theResult fetchNextRowAsArray];
for( j = 0 ; j < [theRow count] ; j++ ) {
+
+ NSEvent* event = [NSApp currentEvent];
+ if ([event type] == NSKeyDown) {
+ unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
+ if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
+ userTerminated = YES;
+ break;
+ }
+ }
+
if([result length]) [result appendString:@","];
id cell = NSArrayObjectAtIndex(theRow, j);
if([cell isKindOfClass:[NSNull class]])
@@ -4742,6 +4757,7 @@
else
[result appendFormat:@"\"%@\"", [[cell description] stringByReplacingOccurrencesOfString:@"\"" withString:@"\"\""]];
}
+ if(userTerminated) break;
[result appendString:@"\n"];
[fh writeData:[result dataUsingEncoding:NSUTF8StringEncoding]];
}
@@ -4751,6 +4767,16 @@
[result setString:@""];
theRow = [theResult fetchNextRowAsArray];
for( j = 0 ; j < [theRow count] ; j++ ) {
+
+ NSEvent* event = [NSApp currentEvent];
+ if ([event type] == NSKeyDown) {
+ unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
+ if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
+ userTerminated = YES;
+ break;
+ }
+ }
+
if([result length]) [result appendString:@"\t"];
id cell = NSArrayObjectAtIndex(theRow, j);
if([cell isKindOfClass:[NSNull class]])
@@ -4770,6 +4796,7 @@
else
[result appendString:[[[cell description] stringByReplacingOccurrencesOfString:@"\n" withString:@"↵"] stringByReplacingOccurrencesOfString:@"\t" withString:@"⇥"]];
}
+ if(userTerminated) break;
[result appendString:@"\n"];
[fh writeData:[result dataUsingEncoding:NSUTF8StringEncoding]];
}
@@ -4779,6 +4806,11 @@
}
}
+ if(userTerminated) {
+ [SPTooltip showWithObject:NSLocalizedString(@"URL scheme command was terminated by user", @"URL scheme command was terminated by user") atLocation:[NSApp mouseLocation]];
+ status = @"1";
+ }
+
// write status file as notification that query was finished
BOOL succeed = [status writeToFile:statusFileName atomically:YES encoding:NSUTF8StringEncoding error:nil];
if(!succeed) {