From b02932c07c4fdbf5b8c051c5a7218c4c37cf4bf2 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sun, 23 Aug 2009 23:14:00 +0000 Subject: =?UTF-8?q?=E2=80=A2=20add=20accessory=20view=20for=20Save=20Conne?= =?UTF-8?q?ction=20-=20options:=20--=20Include=20session=20data=20(selecte?= =?UTF-8?q?d=20table,=20queries,=20status,=20etc.)=20--=20Save=20passwords?= =?UTF-8?q?=20+=20Encrypt=20SPF=20file=20with=20password=20for=20safety=20?= =?UTF-8?q?reasons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: SP gives this warning in the Console: NSSecureTextFieldCell detected a field editor (_NSSavePanelTextView) that is not a NSTextView subclass designed to work with the cell. Ignoring... Why? --- Interfaces/English.lproj/DBView.xib | 491 +++++++++++++++++++++++++++++++++++- Source/TableDocument.h | 8 +- Source/TableDocument.m | 37 +++ 3 files changed, 534 insertions(+), 2 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index cea60e1f..c0ea5d22 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -185,6 +185,7 @@ {212, 26} + 6 @@ -220,6 +221,7 @@ {212, 26} + 0 @@ -334,6 +336,7 @@ {212, 354} + 6 @@ -365,6 +368,7 @@ {212, 354} + 528 @@ -489,6 +493,7 @@ {212, 145} + 6 @@ -515,6 +520,7 @@ {212, 145} + 512 @@ -2121,6 +2127,7 @@ {{1, 17}, {688, 455}} + 2 @@ -2154,6 +2161,7 @@ {{1, 0}, {688, 17}} + 4 @@ -2162,6 +2170,7 @@ {{6, 32}, {690, 473}} + 562 @@ -11343,6 +11352,102 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {110, 20} NSView + + + 268 + + YES + + + 268 + {{18, 57}, {151, 18}} + + YES + + -2080244224 + 0 + Include session data + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{18, 32}, {121, 18}} + + YES + + 67239424 + 0 + Save passwords + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{47, 7}, {166, 18}} + + YES + + -1543373312 + 131072 + Encrypt file with password: + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{215, 7}, {117, 19}} + + YES + + 879885888 + 272761856 + + + + YES + + + + YES + NSAllRomanInputSourcesLocaleIdentifier + + + + + {352, 84} + NSView + YES @@ -15034,6 +15139,94 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6374 + + + saveConnectionAccessory + + + + 6387 + + + + saveConnectionIncludeData + + + + 6388 + + + + saveConnectionSavePassword + + + + 6389 + + + + saveConnectionEncrypt + + + + 6390 + + + + saveConnectionEncryptString + + + + 6391 + + + + nextKeyView + + + + 6392 + + + + nextKeyView + + + + 6393 + + + + nextKeyView + + + + 6394 + + + + saveConnectionAccessoryPasswordButton: + + + + 6401 + + + + saveConnectionAccessoryPasswordButton: + + + + 6402 + + + + delegate + + + + 6404 + @@ -21187,6 +21380,75 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 6375 + + + YES + + + + + + + Save SPF Accessory + + + 6376 + + + YES + + + + + + 6377 + + + + + 6378 + + + YES + + + + + + 6379 + + + + + 6380 + + + YES + + + + + + 6381 + + + + + 6384 + + + YES + + + + + + 6385 + + + @@ -22447,6 +22709,18 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6370.IBPluginDependency 6371.IBPluginDependency 6372.IBPluginDependency + 6375.IBEditorWindowLastContentRect + 6375.IBPluginDependency + 6376.IBAttributePlaceholdersKey + 6376.IBPluginDependency + 6377.IBPluginDependency + 6378.IBAttributePlaceholdersKey + 6378.IBPluginDependency + 6379.IBPluginDependency + 6380.IBPluginDependency + 6381.IBPluginDependency + 6384.IBPluginDependency + 6385.IBPluginDependency 654.IBPluginDependency 654.ImportedFromIB2 655.IBPluginDependency @@ -24261,6 +24535,32 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{275, 661}, {352, 84}} + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Save current selected table, view status, and queries + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + ATTENTION: All passwords will be saved in the file! For safety reasons it is recommended to encrypt the file. + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -24481,7 +24781,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 6374 + 6404 @@ -25782,6 +26082,195 @@ Y2hhbmdlIHRoZSBvcmRlcg + + YES + + TableDocument + NSDocument + + YES + + YES + addConnectionToFavorites: + addDatabase: + analyzeTable: + checkTable: + checksumTable: + chooseDatabase: + chooseEncoding: + closeDatabaseSheet: + closeErrorConnectionSheet: + 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 + + + + YES + + YES + addDatabaseButton + chooseDatabaseButton + connectionErrorDialog + contentViewSplitter + createTableSyntaxWindow + customQueryInstance + customQueryTextView + databaseDataInstance + databaseEncodingButton + databaseNameField + databaseSheet + dbTablesTableView + encodingPopUp + extendedTableInfoInstance + favoritesButton + historyControl + listFilterField + queryProgressBar + saveConnectionAccessory + saveConnectionEncrypt + saveConnectionEncryptString + saveConnectionIncludeData + saveConnectionSavePassword + 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 + NSSearchField + id + id + 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 ../../sequel-pro.xcodeproj diff --git a/Source/TableDocument.h b/Source/TableDocument.h index 130e061e..17de1f03 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -92,6 +92,12 @@ IBOutlet NSWindow *createTableSyntaxWindow; IBOutlet NSWindow *connectionErrorDialog; + IBOutlet id saveConnectionAccessory; + IBOutlet id saveConnectionIncludeData; + IBOutlet id saveConnectionSavePassword; + IBOutlet id saveConnectionEncrypt; + IBOutlet NSSecureTextField *saveConnectionEncryptString; + SPConnectionController *connectionController; SPUserManager *userManagerInstance; @@ -176,7 +182,7 @@ - (NSWindow *)getCreateTableSyntaxWindow; - (void) refreshCurrentDatabase; - (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo; - +- (IBAction)saveConnectionAccessoryPasswordButton:(id)sender; // Getter methods - (NSString *)name; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 86e61f30..a6b4caae 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1746,6 +1746,13 @@ // Save current session (open connection windows as SPF file) // [panel setMessage:NSLocalizedString(@"Save Sequel Pro session", @"Save Sequel Pro session")]; [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"spf", nil]]; + [saveConnectionEncryptString setDelegate:self]; + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString setStringValue:@""]; + [saveConnectionEncryptString setEnabled:NO]; + [saveConnectionSavePassword setState:NSOffState]; + [self saveConnectionAccessoryPasswordButton:nil]; + [panel setAccessoryView:saveConnectionAccessory]; filename = [NSString stringWithFormat:@"%@", [self name]]; contextInfo = @"saveSPFfile"; @@ -1760,6 +1767,36 @@ didEndSelector:@selector(saveConnectionPanelDidEnd:returnCode:contextInfo:) contextInfo:contextInfo]; } +/** + * Control the save connection panel's encrypt checkbox and text field + • if user changed the status of "Save passwords" and "Encrypt" resp. + */ +- (IBAction)saveConnectionAccessoryPasswordButton:(id)sender +{ + + if([saveConnectionSavePassword state] == NSOnState) { + [saveConnectionEncrypt setEnabled:YES]; + if([saveConnectionEncrypt state] == NSOnState) { + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString selectText:nil]; + } else { + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString setStringValue:@""]; + [saveConnectionEncryptString setHidden:YES]; + [saveConnectionEncryptString setHidden:NO]; + [saveConnectionEncryptString setEnabled:NO]; + } + } else { + [saveConnectionEncrypt setEnabled:NO]; + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString setStringValue:@""]; + [saveConnectionEncryptString setHidden:YES]; + [saveConnectionEncryptString setHidden:NO]; + [saveConnectionEncryptString setEnabled:NO]; + } + +} + - (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo { -- cgit v1.2.3