diff options
author | Max <dmoagx@users.noreply.github.com> | 2018-05-05 23:10:59 +0200 |
---|---|---|
committer | Max <dmoagx@users.noreply.github.com> | 2018-05-05 23:10:59 +0200 |
commit | 2252b66ca087504299c72ac49a0551ac8923e08c (patch) | |
tree | 4b78d095e7220061df9b4048261c86500538bfe1 | |
parent | 30bd18e1886d12adb8fb36c02a93ad20b7b092ac (diff) | |
download | sequelpro-2252b66ca087504299c72ac49a0551ac8923e08c.tar.gz sequelpro-2252b66ca087504299c72ac49a0551ac8923e08c.tar.bz2 sequelpro-2252b66ca087504299c72ac49a0551ac8923e08c.zip |
Formatting changes
-rw-r--r-- | Source/SPContentFilterManager.m | 22 | ||||
-rw-r--r-- | Source/SPTableContent.h | 2 | ||||
-rw-r--r-- | Source/SPTableContent.m | 55 |
3 files changed, 43 insertions, 36 deletions
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index d0906c27..8d8a1bcf 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -89,10 +89,10 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; // Add global group row to contentFilters [contentFilters addObject:@{ - @"MenuLabel" : NSLocalizedString(@"Global", @"Content Filter Manager : Filter Entry List: 'Global' Header"), - @"headerOfFileURL" : @"", - @"Clause" : @"", - @"ConjunctionLabel" : @"" + @"MenuLabel" : NSLocalizedString(@"Global", @"Content Filter Manager : Filter Entry List: 'Global' Header"), + @"headerOfFileURL" : @"", + @"Clause" : @"", + @"ConjunctionLabel" : @"" }]; #ifndef SP_CODA /* prefs access */ @@ -940,16 +940,16 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; NSError *error = nil; NSData *plist = [NSPropertyListSerialization dataWithPropertyList:spfdata - format:NSPropertyListXMLFormat_v1_0 - options:0 - error:&error]; + format:NSPropertyListXMLFormat_v1_0 + options:0 + error:&error]; if(error) { NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Error while converting content filter data", @"Content filters could not be converted to plist upon export - message title (ContentFilterManager)") - defaultButton:NSLocalizedString(@"OK", @"OK button") - alternateButton:nil - otherButton:nil - informativeTextWithFormat:@"%@", [error localizedDescription]]; + defaultButton:NSLocalizedString(@"OK", @"OK button") + alternateButton:nil + otherButton:nil + informativeTextWithFormat:@"%@", [error localizedDescription]]; [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h index 4c6627de..486df122 100644 --- a/Source/SPTableContent.h +++ b/Source/SPTableContent.h @@ -75,7 +75,7 @@ IBOutlet id reloadButton; #ifndef SP_CODA IBOutlet NSButton *multipleLineEditingButton; - IBOutlet id countText; + IBOutlet NSTextField *countText; IBOutlet id limitRowsField; IBOutlet id limitRowsButton; IBOutlet id limitRowsStepper; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index b29ebf7a..507aca80 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -182,14 +182,14 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper NSError *readError = nil; NSString *filePath = [NSBundle pathForResource:@"ContentFilters.plist" ofType:nil inDirectory:[[NSBundle mainBundle] bundlePath]]; NSData *defaultFilterData = [NSData dataWithContentsOfFile:filePath - options:NSMappedRead - error:&readError]; - - if(defaultFilterData && !readError) { + options:NSMappedRead + error:&readError]; + + if (defaultFilterData && !readError) { NSDictionary *defaultFilterDict = [NSPropertyListSerialization propertyListWithData:defaultFilterData - options:NSPropertyListMutableContainersAndLeaves - format:NULL - error:&readError]; + options:NSPropertyListMutableContainersAndLeaves + format:NULL + error:&readError]; if(defaultFilterDict && !readError) { [contentFilters setDictionary:defaultFilterDict]; @@ -289,13 +289,13 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // Add observers for document task activity [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(startDocumentTaskForTab:) - name:SPDocumentTaskStartNotification - object:tableDocumentInstance]; + selector:@selector(startDocumentTaskForTab:) + name:SPDocumentTaskStartNotification + object:tableDocumentInstance]; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(endDocumentTaskForTab:) - name:SPDocumentTaskEndNotification - object:tableDocumentInstance]; + selector:@selector(endDocumentTaskForTab:) + name:SPDocumentTaskEndNotification + object:tableDocumentInstance]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(documentWillClose:) name:SPDocumentWillCloseNotification @@ -830,7 +830,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // Add a filter string if appropriate filterString = [[self onMainThread] tableFilterString]; - if (filterString) { + if ([filterString length]) { [queryString appendFormat:@" WHERE %@", filterString]; isFiltered = YES; } else { @@ -1007,7 +1007,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper if(activeFilter == 0) { #endif NSString *errorDetail; - if(filterString) + if([filterString length]) errorDetail = [NSString stringWithFormat:NSLocalizedString(@"The table data couldn't be loaded presumably due to used filter clause. \n\nMySQL said: %@", @"message of panel when loading of table failed and presumably due to used filter argument"), [mySQLConnection lastErrorMessage]]; else errorDetail = [NSString stringWithFormat:NSLocalizedString(@"The table data couldn't be loaded.\n\nMySQL said: %@", @"message of panel when loading of table failed"), [mySQLConnection lastErrorMessage]]; @@ -1098,9 +1098,8 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper #ifndef SP_CODA // If filter command was passed by sequelpro url scheme - if(activeFilter == 2) { - if(schemeFilter) - return schemeFilter; + if(activeFilter == SPTableContentFilterSourceURLScheme) { + if(schemeFilter) return schemeFilter; } // Call did come from filter table and is filter table window still open? @@ -2851,8 +2850,8 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper fieldValue = [NSString stringWithFormat:@"b'%@'", ((![desc length] || [desc isEqualToString:@"0"]) ? @"0" : desc)]; } else if ([fieldTypeGroup isEqualToString:@"date"] && [desc isEqualToString:@"NOW()"]) { fieldValue = @"NOW()"; - } else if ([fieldTypeGroup isEqualToString:@"string"] && [[rowObject description] isEqualToString:@"UUID()"]) { - fieldValue = @"UUID()"; + } else if ([fieldTypeGroup isEqualToString:@"string"] && [[rowObject description] isEqualToString:@"UUID()"]) { + fieldValue = @"UUID()"; } else { fieldValue = [mySQLConnection escapeAndQuoteString:desc]; } @@ -2986,12 +2985,20 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper currentlyEditingRow = -1; return YES; - + } // Report errors which have occurred - } else { - SPBeginAlertSheet(NSLocalizedString(@"Unable to write row", @"Unable to write row error"), NSLocalizedString(@"Edit row", @"Edit row button"), NSLocalizedString(@"Discard changes", @"discard changes button"), nil, [tableDocumentInstance parentWindow], self, @selector(addRowErrorSheetDidEnd:returnCode:contextInfo:), NULL, - [NSString stringWithFormat:NSLocalizedString(@"MySQL said:\n\n%@", @"message of panel when error while adding row to db"), [mySQLConnection lastErrorMessage]]); + SPBeginAlertSheet( + NSLocalizedString(@"Unable to write row", @"Unable to write row error"), + NSLocalizedString(@"Edit row", @"Edit row button"), + NSLocalizedString(@"Discard changes", @"discard changes button"), + nil, + [tableDocumentInstance parentWindow], + self, + @selector(addRowErrorSheetDidEnd:returnCode:contextInfo:), + NULL, + [NSString stringWithFormat:NSLocalizedString(@"MySQL said:\n\n%@", @"message of panel when error while adding row to db"), [mySQLConnection lastErrorMessage]] + ); return NO; } } |