From c6c669073c9b92f037d59b5d3ee7aa2b17f520fa Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 25 Aug 2009 13:02:58 +0000 Subject: =?UTF-8?q?=E2=80=A2=20outsourced=20Save=20SPF=20accessory=20xib?= =?UTF-8?q?=20=E2=80=A2=20updated=20save=20SPF=20accessory=20xib=20due=20t?= =?UTF-8?q?o=20SPF=20structure=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NOTES: - The view in DBView.xib will be deleted after stuart02's commit. - Still after clicking at the encrypt text field a warning will be shown in the Console: NSSecureTextFieldCell detected a field editor that is not a NSTextView subclass... WHY? --- Interfaces/English.lproj/SaveSPFAccessory.xib | 875 ++++++++++++++++++++++++++ Source/TableDocument.h | 2 + Source/TableDocument.m | 62 +- sequel-pro.xcodeproj/project.pbxproj | 12 + 4 files changed, 919 insertions(+), 32 deletions(-) create mode 100644 Interfaces/English.lproj/SaveSPFAccessory.xib diff --git a/Interfaces/English.lproj/SaveSPFAccessory.xib b/Interfaces/English.lproj/SaveSPFAccessory.xib new file mode 100644 index 00000000..91704d63 --- /dev/null +++ b/Interfaces/English.lproj/SaveSPFAccessory.xib @@ -0,0 +1,875 @@ + + + + 1050 + 9L30 + 677 + 949.54 + 353.00 + + YES + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + TableDocument + + + FirstResponder + + + NSApplication + + + + 268 + + YES + + + 268 + {{18, 33}, {177, 18}} + + + YES + + -2080244224 + 0 + Remember window state + + LucidaGrande + 1.300000e+01 + 1044 + + + 1211912703 + 130 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + + + + 268 + {{18, 8}, {225, 18}} + + + YES + + 67239424 + 0 + Remember Query Editor content + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{18, 113}, {139, 18}} + + + YES + + 67239424 + 0 + Include passwords + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{18, 60}, {176, 18}} + + + YES + + 67239424 + 0 + Encrypt with password: + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{193, 59}, {138, 19}} + + + YES + + 343014976 + 272761856 + + + LucidaGrande + 1.100000e+01 + 3100 + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + YES + NSAllRomanInputSourcesLocaleIdentifier + + + + + + 268 + {{40, 86}, {199, 18}} + + + YES + + -1543373312 + 0 + Auto connect when opening + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{181, 102}, {163, 33}} + + + YES + + 67239424 + 138543104 + It is highly recommended to encrypt the entire data! + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + + + + + {350, 139} + + + NSView + + + + YES + _dummy + + YES + + + + + YES + + + saveConnectionIncludeQuery + + + + 26 + + + + saveConnectionIncludeData + + + + 27 + + + + saveConnectionEncrypt + + + + 28 + + + + saveConnectionEncryptString + + + + 29 + + + + saveConnectionAutoConnect + + + + 30 + + + + saveConnectionSavePassword + + + + 31 + + + + saveConnectionAccessory + + + + 32 + + + + fontBold: values._dummy + + + + + + fontBold: values._dummy + fontBold + values._dummy + + YES + + YES + NSMultipleValuesPlaceholder + NSNoSelectionPlaceholder + NSNotApplicablePlaceholder + NSNullPlaceholder + + + YES + + + + + + + 2 + + + 42 + + + + saveConnectionAccessoryPasswordButton: + + + + 43 + + + + saveConnectionSavePasswordAlert + + + + 44 + + + + saveConnectionAccessoryPasswordButton: + + + + 45 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + + + + + Save SPF Accessory + + + 2 + + + YES + + + + + + 3 + + + YES + + + + + + 4 + + + YES + + + + + + 5 + + + YES + + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 13 + + + YES + + + + + + 14 + + + + + 15 + + + YES + + + + + + 16 + + + + + 35 + + + YES + + + + + + 36 + + + + + 37 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBAttributePlaceholdersKey + 15.IBPluginDependency + 16.IBPluginDependency + 2.IBPluginDependency + 3.IBAttributePlaceholdersKey + 3.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency + 4.IBAttributePlaceholdersKey + 4.IBPluginDependency + 5.IBAttributePlaceholdersKey + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{307, 617}, {350, 139}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + YES + + YES + + + YES + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Encrypt all connection and window state data with a password. + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Remember selected table, view status, filter settings, etc. + + + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + ATTENTION: If enabled all passwords will be saved in the file! It is highly recommended to encrypt the entire data! + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 45 + + + + YES + + NSObject + + YES + + YES + saveConnectionAccessory + saveConnectionAutoConnect + saveConnectionEncrypt + saveConnectionEncryptString + saveConnectionIncludeData + saveConnectionIncludeQuery + saveConnectionSavePassword + + + YES + id + id + id + id + id + id + id + + + + IBUserSource + + + + + NSView + + IBUserSource + + + + + + YES + + TableDocument + NSDocument + + YES + + YES + addConnectionToFavorites: + addDatabase: + analyzeTable: + checkTable: + checksumTable: + chooseDatabase: + chooseEncoding: + closeDatabaseSheet: + closeErrorConnectionSheet: + closePasswordSheet: + closeSheet: + copyCreateTableSyntax: + export: + exportMultipleTables: + exportTable: + flushPrivileges: + flushTable: + import: + optimizeTable: + removeDatabase: + repairTable: + saveConnectionAccessoryPasswordButton: + saveConnectionSheet: + saveServerVariables: + setDatabases: + showCreateTableSyntax: + showMySQLHelp: + showUserManager: + showVariables: + viewContent: + viewQuery: + viewRelations: + viewStatus: + viewStructure: + + + YES + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + + + + YES + + YES + addDatabaseButton + chooseDatabaseButton + connectionErrorDialog + contentViewSplitter + createTableSyntaxWindow + customQueryInstance + customQueryTextView + databaseDataInstance + databaseEncodingButton + databaseNameField + databaseSheet + dbTablesTableView + encodingPopUp + extendedTableInfoInstance + favoritesButton + historyControl + inputTextWindow + inputTextWindowHeader + inputTextWindowMessage + inputTextWindowSecureTextField + listFilterField + queryProgressBar + saveConnectionAccessory + saveConnectionAutoConnect + saveConnectionEncrypt + saveConnectionEncryptString + saveConnectionIncludeData + saveConnectionIncludeQuery + saveConnectionSavePassword + saveConnectionSavePasswordAlert + saveVariablesButton + sidebarGrabber + spExportControllerInstance + spHistoryControllerInstance + syntaxView + syntaxViewContent + tableContentInstance + tableDataInstance + tableDumpInstance + tableInfoCollapseButton + tableInfoTable + tableListSplitter + tableRelationsInstance + tableSourceInstance + tableTabView + tableWindow + tablesListInstance + titleAccessoryView + titleImageView + titleStringView + variablesCountTextField + variablesSearchField + variablesSheet + variablesTableView + + + YES + id + id + NSWindow + NSSplitView + NSWindow + id + NSTextView + id + id + id + id + NSTableView + NSPopUpButton + id + id + id + id + id + id + id + NSSearchField + id + id + id + id + NSSecureTextField + id + id + id + id + NSButton + id + id + id + id + id + id + id + id + NSButton + NSTableView + NSSplitView + id + id + NSTabView + id + id + id + id + id + NSTextField + NSSearchField + id + id + + + + IBDocumentRelativeSource + ../../Source/TableDocument.h + + + + + 0 + + 3 + + diff --git a/Source/TableDocument.h b/Source/TableDocument.h index 04dfe8f8..3c890a40 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -94,7 +94,9 @@ IBOutlet id saveConnectionAccessory; IBOutlet id saveConnectionIncludeData; + IBOutlet id saveConnectionIncludeQuery; IBOutlet id saveConnectionSavePassword; + IBOutlet id saveConnectionSavePasswordAlert; IBOutlet id saveConnectionEncrypt; IBOutlet id saveConnectionAutoConnect; IBOutlet NSSecureTextField *saveConnectionEncryptString; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index b89d6fe3..7f64fcc0 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -55,6 +55,7 @@ #import "MGTemplateEngine.h" #import "ICUTemplateMatcher.h" + @interface TableDocument (PrivateAPI) - (void)_updateServerVariablesFilterForFilterString:(NSString *)filterString; @@ -1900,12 +1901,17 @@ // [panel setMessage:NSLocalizedString(@"Save Sequel Pro session", @"Save Sequel Pro session")]; [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"spf", nil]]; // [saveConnectionEncryptString setDelegate:self]; - [saveConnectionEncryptString setEnabled:YES]; - [saveConnectionEncryptString selectText:self]; + + // Load the accessory view everytime + if (![NSBundle loadNibNamed:@"SaveSPFAccessory" owner:self]) { + NSLog(@"Failed to load SaveSPFAccessory.nib"); + return; + } [saveConnectionEncryptString setStringValue:@""]; - [saveConnectionEncryptString setEnabled:NO]; - [saveConnectionSavePassword setState:NSOffState]; + [saveConnectionIncludeQuery setEnabled:([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length])]; + [self saveConnectionAccessoryPasswordButton:nil]; + [panel setAccessoryView:saveConnectionAccessory]; filename = [NSString stringWithFormat:@"%@", [self name]]; contextInfo = @"saveSPFfile"; @@ -1922,35 +1928,21 @@ contextInfo:contextInfo]; } /** - * Control the save connection panel's encrypt checkbox and text field - • if user changed the status of "Save passwords" and "Encrypt" resp. + * Control the save connection panel's accessory view */ - (IBAction)saveConnectionAccessoryPasswordButton:(id)sender { - if([saveConnectionSavePassword state] == NSOnState) { - [saveConnectionEncrypt setEnabled:YES]; - if([saveConnectionEncrypt state] == NSOnState) { - [saveConnectionEncryptString setEnabled:YES]; - [saveConnectionEncryptString selectText:self]; - } else { - [saveConnectionEncryptString setEnabled:YES]; - [saveConnectionEncryptString selectText:self]; - [saveConnectionEncryptString setStringValue:@""]; - [saveConnectionEncryptString setHidden:YES]; - [saveConnectionEncryptString setHidden:NO]; - [saveConnectionEncryptString setEnabled:NO]; - } - } else { - [saveConnectionEncrypt setEnabled:NO]; - [saveConnectionEncryptString setEnabled:YES]; - [saveConnectionEncryptString selectText:self]; - [saveConnectionEncryptString setStringValue:@""]; + [saveConnectionAutoConnect setEnabled:([saveConnectionSavePassword state] == NSOnState)]; + [saveConnectionSavePasswordAlert setHidden:([saveConnectionSavePassword state] == NSOffState)]; + if(sender == saveConnectionEncrypt && [saveConnectionEncrypt state] == NSOnState) + [saveConnectionEncryptString selectText:sender]; + if(sender == saveConnectionEncrypt && [saveConnectionEncrypt state] == NSOffState) { [saveConnectionEncryptString setHidden:YES]; [saveConnectionEncryptString setHidden:NO]; - [saveConnectionEncryptString setEnabled:NO]; } - + + } - (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo @@ -2087,11 +2079,6 @@ if([tableContentInstance filterSettings]) [session setObject:[tableContentInstance filterSettings] forKey:@"contentFilter"]; - if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length]) - if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length] > 50000) - [session setObject:[[[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] dataUsingEncoding:NSUTF8StringEncoding] compress] forKey:@"queries"]; - else - [session setObject:[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] forKey:@"queries"]; if (contentSelectedIndexSet && [contentSelectedIndexSet count]) { NSMutableArray *indices = [NSMutableArray array]; unsigned indexBuffer[[contentSelectedIndexSet count]]; @@ -2103,7 +2090,18 @@ [session setObject:indices forKey:@"contentSelectedIndexSet"]; } } - + + if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length] + && [saveConnectionIncludeQuery state] == NSOnState) { + + if(session == nil) + session = [NSMutableDictionary dictionary]; + + if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length] > 50000) + [session setObject:[[[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] dataUsingEncoding:NSUTF8StringEncoding] compress] forKey:@"queries"]; + else + [session setObject:[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] forKey:@"queries"]; + } [data setObject:connection forKey:@"connection"]; if(session != nil) diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 9cd9a4c3..c2f95f7d 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -227,6 +227,7 @@ BCA6271C1031B9D40047E5D5 /* SPTooltip.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA6271B1031B9D40047E5D5 /* SPTooltip.m */; }; BCA6F631100FA7D700E80253 /* FieldEditorSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCA6F62F100FA7D700E80253 /* FieldEditorSheet.xib */; }; BCC5CC3C103EEE49007CE557 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 17B7B593101602D200F057DE /* libz.dylib */; }; + BCCBD7FC104408B000D4C50A /* SaveSPFAccessory.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCCBD7FA104408B000D4C50A /* SaveSPFAccessory.xib */; }; BCD0AD490FBBFC340066EA5C /* SPSQLTokenizer.l in Sources */ = {isa = PBXBuildFile; fileRef = BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */; }; /* End PBXBuildFile section */ @@ -605,6 +606,7 @@ BCA6271A1031B9D40047E5D5 /* SPTooltip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTooltip.h; sourceTree = ""; }; BCA6271B1031B9D40047E5D5 /* SPTooltip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTooltip.m; sourceTree = ""; }; BCA6F630100FA7D700E80253 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/FieldEditorSheet.xib; sourceTree = ""; }; + BCCBD7FB104408B000D4C50A /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/SaveSPFAccessory.xib; sourceTree = ""; }; BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; path = SPSQLTokenizer.l; sourceTree = ""; }; BCD0AD4A0FBBFC480066EA5C /* SPSQLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPSQLTokenizer.h; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1112,6 +1114,7 @@ 17E642050EF020A3001BC333 /* Interfaces */ = { isa = PBXGroup; children = ( + BCCBD7FA104408B000D4C50A /* SaveSPFAccessory.xib */, BC8B0DAD104004F900FC02EC /* EncodingPopupView.xib */, 4D90B7A0101E0D1500D116A1 /* UserManagerView.xib */, B52460D90F8EF93B00171639 /* Console.xib */, @@ -1512,6 +1515,7 @@ 581069B410167EC10068C6E2 /* SequelProTunnelAssistant in Resources */, 4D90B7A2101E0D1500D116A1 /* UserManagerView.xib in Resources */, BC8B0DAF104004F900FC02EC /* EncodingPopupView.xib in Resources */, + BCCBD7FC104408B000D4C50A /* SaveSPFAccessory.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1808,6 +1812,14 @@ name = FieldEditorSheet.xib; sourceTree = ""; }; + BCCBD7FA104408B000D4C50A /* SaveSPFAccessory.xib */ = { + isa = PBXVariantGroup; + children = ( + BCCBD7FB104408B000D4C50A /* English */, + ); + name = SaveSPFAccessory.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ -- cgit v1.2.3