aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-26 11:33:18 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-26 11:33:18 +0000
commite586eaef2eadcf3eccbb6f81d33bf005081451f2 (patch)
tree91db75a6b0975cb7053b8449716be648416d19ff /Source
parent0898dd7e4da0becb043f3ae3d37ccc4c0c13c44e (diff)
downloadsequelpro-e586eaef2eadcf3eccbb6f81d33bf005081451f2.tar.gz
sequelpro-e586eaef2eadcf3eccbb6f81d33bf005081451f2.tar.bz2
sequelpro-e586eaef2eadcf3eccbb6f81d33bf005081451f2.zip
• Bundle Command support
- added shell var SP_ICON_FILE - a bundle command which outputs its result as HTML window will write the data in the same window, ie it won't be create each time a new window; the window will be identified by the bundle's uuid - fixed issue while saving a short-cut in keybinding.dict format, now it ignores possible diacritics - maybe bug in ShortcutRecorder for method [aRecorder keyCharsIgnoringModifiers] since in the objectValue it's set correctly
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m17
-rw-r--r--Source/SPBundleEditorController.m11
-rw-r--r--Source/SPBundleHTMLOutputController.h2
-rw-r--r--Source/SPBundleHTMLOutputController.m1
-rw-r--r--Source/SPCopyTable.m17
-rw-r--r--Source/SPStringAdditions.m2
-rw-r--r--Source/SPTextViewAdditions.m17
7 files changed, 58 insertions, 9 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index b34cb0d5..ae42d254 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -723,8 +723,21 @@
}
else if([action isEqualToString:SPBundleOutputActionShowAsHTML]) {
- SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init];
- [c displayHTMLContent:output withOptions:nil];
+ BOOL correspondingWindowFound = NO;
+ for(id win in [NSApp windows]) {
+ if([[win delegate] isKindOfClass:[SPBundleHTMLOutputController class]]) {
+ if([[[win delegate] windowUUID] isEqualToString:[cmdData objectForKey:SPBundleFileUUIDKey]]) {
+ correspondingWindowFound = YES;
+ [[win delegate] displayHTMLContent:output withOptions:nil];
+ break;
+ }
+ }
+ }
+ if(!correspondingWindowFound) {
+ SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init];
+ [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]];
+ [c displayHTMLContent:output withOptions:nil];
+ }
}
}
} else {
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 0a34e61b..bddc7a22 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -899,7 +899,13 @@
// Transform KeyCombo struct to KeyBinding.dict format for NSMenuItems
NSMutableString *keyEq = [NSMutableString string];
- NSString *theChar = [[aRecorder keyCharsIgnoringModifiers] lowercaseString];
+
+ NSString *theChar = @"";
+
+ if([aRecorder objectValue])
+ theChar =[[[aRecorder objectValue] objectForKey:@"characters"] lowercaseString];
+ else
+ theChar =[[aRecorder keyCharsIgnoringModifiers] lowercaseString];
[keyEq setString:@""];
if(newKeyCombo.code > -1) {
if(newKeyCombo.flags & NSControlKeyMask)
@@ -1120,9 +1126,8 @@
isValid = NO;
}
-
// If not valid reset name to the old one
- if(!isValid) {
+ if(!isValid && oldBundleName) {
[[self _currentSelectedObject] setObject:oldBundleName forKey:kBundleNameKey];
}
diff --git a/Source/SPBundleHTMLOutputController.h b/Source/SPBundleHTMLOutputController.h
index 1ac550a7..9ad79a1e 100644
--- a/Source/SPBundleHTMLOutputController.h
+++ b/Source/SPBundleHTMLOutputController.h
@@ -31,12 +31,14 @@
NSString *docTitle;
NSString *initHTMLSourceString;
+ NSString *windowUUID;
WebPreferences *webPreferences;
}
@property(readwrite,retain) NSString *docTitle;
@property(readwrite,retain) NSString *initHTMLSourceString;
+@property(readwrite,retain) NSString *windowUUID;
- (IBAction)printDocument:(id)sender;
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index 56fdb63e..3f6d4046 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -31,6 +31,7 @@
@synthesize docTitle;
@synthesize initHTMLSourceString;
+@synthesize windowUUID;
/**
* Initialisation
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index 4de00d00..6b746099 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -943,8 +943,21 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003;
}
else if([action isEqualToString:SPBundleOutputActionShowAsHTML]) {
- SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init];
- [c displayHTMLContent:output withOptions:nil];
+ BOOL correspondingWindowFound = NO;
+ for(id win in [NSApp windows]) {
+ if([[win delegate] isKindOfClass:[SPBundleHTMLOutputController class]]) {
+ if([[[win delegate] windowUUID] isEqualToString:[cmdData objectForKey:SPBundleFileUUIDKey]]) {
+ correspondingWindowFound = YES;
+ [[win delegate] displayHTMLContent:output withOptions:nil];
+ break;
+ }
+ }
+ }
+ if(!correspondingWindowFound) {
+ SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init];
+ [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]];
+ [c displayHTMLContent:output withOptions:nil];
+ }
}
}
} else {
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index 1185756b..907ebc05 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -507,6 +507,8 @@
NSMutableDictionary *theEnv = [NSMutableDictionary dictionary];
[theEnv setDictionary:shellEnvironment];
+ [theEnv setObject:[[NSBundle mainBundle] pathForResource:@"appicon" ofType:@"icns"] forKey:@"SP_ICON_FILE"];
+
// Create and set an unique process ID for each SPDatabaseDocument which has to passed
// for each sequelpro:// scheme command as user to be able to identify the url scheme command.
// Furthermore this id is used to communicate with the called command as file name.
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 4afea05f..0c9fe630 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -621,8 +621,21 @@
}
else if([action isEqualToString:SPBundleOutputActionShowAsHTML]) {
- SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init];
- [c displayHTMLContent:output withOptions:nil];
+ BOOL correspondingWindowFound = NO;
+ for(id win in [NSApp windows]) {
+ if([[win delegate] isKindOfClass:[SPBundleHTMLOutputController class]]) {
+ if([[[win delegate] windowUUID] isEqualToString:[cmdData objectForKey:SPBundleFileUUIDKey]]) {
+ correspondingWindowFound = YES;
+ [[win delegate] displayHTMLContent:output withOptions:nil];
+ break;
+ }
+ }
+ }
+ if(!correspondingWindowFound) {
+ SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init];
+ [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]];
+ [c displayHTMLContent:output withOptions:nil];
+ }
}
if([self isEditable]) {