Permalink
Browse files

Formatting changes

  • Loading branch information...
dmoagx committed May 5, 2018
1 parent 30bd18e commit 2252b66ca087504299c72ac49a0551ac8923e08c
Showing with 43 additions and 36 deletions.
  1. +11 −11 Source/SPContentFilterManager.m
  2. +1 −1 Source/SPTableContent.h
  3. +31 −24 Source/SPTableContent.m
@@ -89,10 +89,10 @@ - (void)awakeFromNib
// 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 @@ - (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode co
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];
@@ -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;
@@ -182,14 +182,14 @@ - (id)init
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 @@ - (void)awakeFromNib
// 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 @@ - (void) loadTableValues
// 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 @@ - (void) loadTableValues
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 @@ - (NSString *)tableFilterString
#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 @@ - (BOOL)saveRowToTable
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 @@ - (BOOL)saveRowToTable
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;
}
}

0 comments on commit 2252b66

Please sign in to comment.