diff options
-rw-r--r-- | Source/SPAppController.m | 77 | ||||
-rw-r--r-- | Source/SPUserMO.h | 6 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 9 |
3 files changed, 48 insertions, 44 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 23d410e3..317935f9 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -75,6 +75,9 @@ isNewFavorite = NO; } +/** + * Menu item validation. + */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { if ([menuItem action] == @selector(openConnectionSheet:) && [menuItem tag] == 0) @@ -88,8 +91,10 @@ if ([menuItem action] == @selector(openCurrentConnectionInNewWindow:)) { [menuItem setTitle:NSLocalizedString(@"Open in New Window", @"menu item open in new window")]; + return NO; } + return YES; } @@ -101,8 +106,7 @@ */ - (void)panelSelectionDidChange:(id)sender { - - if([sender isKindOfClass:[NSOpenPanel class]]) { + if ([sender isKindOfClass:[NSOpenPanel class]]) { if([[[[sender filename] pathExtension] lowercaseString] isEqualToString:@"sql"]) { [encodingPopUp setEnabled:YES]; [sender setAllowsMultipleSelection:NO]; @@ -111,9 +115,9 @@ [sender setAllowsMultipleSelection:YES]; } } - } -/* + +/** * NSOpenPanel for selecting sql or spf file */ - (IBAction)openConnectionSheet:(id)sender @@ -146,26 +150,28 @@ // Check if at least one document exists, if so show a sheet if ([[[NSDocumentController sharedDocumentController] documents] count]) { [panel beginSheetForDirectory:nil - file:@"" - types:[NSArray arrayWithObjects:@"spf", @"sql", nil] - modalForWindow:[[[NSDocumentController sharedDocumentController] currentDocument] valueForKey:@"tableWindow"] - modalDelegate:self - didEndSelector:@selector(openConnectionPanelDidEnd:returnCode:contextInfo:) - contextInfo:NULL]; - } else { + file:@"" + types:[NSArray arrayWithObjects:@"spf", @"sql", nil] + modalForWindow:[[[NSDocumentController sharedDocumentController] currentDocument] valueForKey:@"tableWindow"] + modalDelegate:self + didEndSelector:@selector(openConnectionPanelDidEnd:returnCode:contextInfo:) + contextInfo:NULL]; + } + else { int returnCode = [panel runModalForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"spf", @"sql", nil]]; - if( returnCode ) - [self application:nil openFiles:[panel filenames]]; - + if (returnCode) [self application:nil openFiles:[panel filenames]]; encodingPopUp = nil; - } } -- (void)openConnectionPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo + +/** + * Invoked when the open connection panel is dismissed. + */ +- (void)openConnectionPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo { - if ( returnCode ) { + if (returnCode) { [panel orderOut:self]; [self application:nil openFiles:[panel filenames]]; } @@ -179,9 +185,8 @@ */ - (void)application:(NSApplication *)app openFiles:(NSArray *)filenames { - - for( NSString* filename in filenames ) { - + for (NSString *filename in filenames) + { // Opens a sql file and insert its content into the Custom Query editor if([[[filename pathExtension] lowercaseString] isEqualToString:@"sql"]) { @@ -284,7 +289,6 @@ NSLog(@"Only files with the extensions ‘spf’ or ‘sql’ are allowed."); } } - } #pragma mark - @@ -299,7 +303,7 @@ } #pragma mark - -#pragma mark Getters +#pragma mark Accessors /** * Provide a method to retrieve the prefs controller @@ -309,7 +313,6 @@ return prefsController; } - #pragma mark - #pragma mark Services menu methods @@ -409,13 +412,12 @@ return NO; } -/* +/** * Insert content of a plain text file for a given path. * In addition it tries to figure out the file's text encoding heuristically. */ - (NSString *)contentOfFile:(NSString *)aPath { - NSError *err = nil; NSStringEncoding enc; NSString *content = nil; @@ -482,6 +484,7 @@ return @""; } + /** * Sparkle updater delegate method. Called just before the updater relaunches Sequel Pro and we need to make * sure that no sheets are currently open, which will prevent the app from being quit. @@ -533,16 +536,17 @@ // } // -/* +/** * Is needed to interact with AppleScript for set/get internal SP variables */ - (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key { NSLog(@"Not yet implemented."); + return NO; } -/* +/** * AppleScript calls that method to get the available documents */ - (NSArray *)orderedDocuments @@ -550,27 +554,30 @@ return [[NSDocumentController sharedDocumentController] documents]; } -/* Support for "make new document" -*/ -- (void)insertInOrderedDocuments:(TableDocument *)doc { +/** + * Support for 'make new document'. + */ +- (void)insertInOrderedDocuments:(TableDocument *)doc +{ if ([[NSUserDefaults standardUserDefaults] boolForKey:SPAutoConnectToDefault]) [doc setShouldAutomaticallyConnect:YES]; + [[NSDocumentController sharedDocumentController] addDocument:doc]; [doc makeWindowControllers]; [doc showWindows]; } -/* - * AppleScript calls that method to get the available windows +/** + * AppleScript calls that method to get the available windows. */ - (NSArray *)orderedWindows { return [NSApp orderedWindows]; } -/* + +/** * AppleScript handler to quit Sequel Pro - * This handler is needed to allow to quit SP via the Dock or AppleScript after - * activating it by using AppleScript + * This handler is needed to allow to quit SP via the Dock or AppleScript after activating it by using AppleScript */ - (id)handleQuitScriptCommand:(NSScriptCommand *)command { diff --git a/Source/SPUserMO.h b/Source/SPUserMO.h index 13837921..b77dfd04 100644 --- a/Source/SPUserMO.h +++ b/Source/SPUserMO.h @@ -26,9 +26,9 @@ @interface NSManagedObject (CoreDataGeneratedAccessors) -@property(nonatomic, retain) NSString *user; -@property(nonatomic, retain) NSString *host; -@property(nonatomic, retain) NSManagedObject *parent; +@property (nonatomic, retain) NSString *user; +@property (nonatomic, retain) NSString *host; +@property (nonatomic, retain) NSManagedObject *parent; @property (nonatomic, retain) NSSet *children; - (NSString *)displayName; diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 0596a607..04ac2980 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -87,7 +87,6 @@ 17E641640EF01F15001BC333 /* SPTableInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E6415F0EF01F15001BC333 /* SPTableInfo.m */; }; 17E641650EF01F15001BC333 /* TablesList.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E641610EF01F15001BC333 /* TablesList.m */; }; 17E6416C0EF01F37001BC333 /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E641690EF01F37001BC333 /* ImageAndTextCell.m */; }; - 17E6416D0EF01F37001BC333 /* TableDocumentSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E6416B0EF01F37001BC333 /* TableDocumentSplitView.m */; }; 17E641750EF01F80001BC333 /* SPKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E641740EF01F80001BC333 /* SPKeychain.m */; }; 17E641820EF01FA8001BC333 /* CMCopyTable.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E6417D0EF01FA8001BC333 /* CMCopyTable.m */; }; 17E641830EF01FA8001BC333 /* CMImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E6417F0EF01FA8001BC333 /* CMImageView.m */; }; @@ -454,8 +453,6 @@ 17E641610EF01F15001BC333 /* TablesList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TablesList.m; sourceTree = "<group>"; }; 17E641680EF01F37001BC333 /* ImageAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageAndTextCell.h; sourceTree = "<group>"; }; 17E641690EF01F37001BC333 /* ImageAndTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageAndTextCell.m; sourceTree = "<group>"; }; - 17E6416A0EF01F37001BC333 /* TableDocumentSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableDocumentSplitView.h; sourceTree = "<group>"; }; - 17E6416B0EF01F37001BC333 /* TableDocumentSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableDocumentSplitView.m; sourceTree = "<group>"; }; 17E641730EF01F80001BC333 /* SPKeychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPKeychain.h; sourceTree = "<group>"; }; 17E641740EF01F80001BC333 /* SPKeychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPKeychain.m; sourceTree = "<group>"; }; 17E6417C0EF01FA8001BC333 /* CMCopyTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMCopyTable.h; sourceTree = "<group>"; }; @@ -1101,8 +1098,6 @@ 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */, BC8C8530100E0A8000D7A129 /* SPTableView.h */, BC8C8531100E0A8000D7A129 /* SPTableView.m */, - 17E6416A0EF01F37001BC333 /* TableDocumentSplitView.h */, - 17E6416B0EF01F37001BC333 /* TableDocumentSplitView.m */, ); name = Views; sourceTree = "<group>"; @@ -1772,7 +1767,6 @@ 17E641640EF01F15001BC333 /* SPTableInfo.m in Sources */, 17E641650EF01F15001BC333 /* TablesList.m in Sources */, 17E6416C0EF01F37001BC333 /* ImageAndTextCell.m in Sources */, - 17E6416D0EF01F37001BC333 /* TableDocumentSplitView.m in Sources */, 17E641750EF01F80001BC333 /* SPKeychain.m in Sources */, 17E641820EF01FA8001BC333 /* CMCopyTable.m in Sources */, 17E641830EF01FA8001BC333 /* CMImageView.m in Sources */, @@ -2260,6 +2254,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IBC_WARNINGS = YES; PREBINDING = NO; SDKROOT = macosx10.5; }; @@ -2409,6 +2404,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IBC_FLATTEN_NIBS = NO; + IBC_WARNINGS = YES; LEXFLAGS = ""; LEX_INSERT_LINE_DIRECTIVES = YES; LEX_SUPPRESS_DEFAULT_RULE = NO; @@ -2427,6 +2423,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IBC_WARNINGS = YES; OTHER_LDFLAGS = "-lcrypto"; PREBINDING = NO; SDKROOT = macosx10.5; |