Permalink
Browse files

#2978: Fix direct private ivar access and add warnings to more occurr…

…ences.
  • Loading branch information...
stuconnolly committed Oct 13, 2018
1 parent 0e6d004 commit 4b2fcc0f732d69123fa1479edacc1be277d7835e
View
@@ -394,10 +394,10 @@ - (void)openSQLFileAtPath:(NSString *)filePath
[alert release];
if(returnCode == NSAlertSecondButtonReturn) return; // Cancel
else if(returnCode == NSAlertThirdButtonReturn) { // Import
if (returnCode == NSAlertSecondButtonReturn) return; // Cancel
else if (returnCode == NSAlertThirdButtonReturn) { // Import
// begin import process
[[frontDocument valueForKeyPath:@"tableDumpInstance"] startSQLImportProcessWithFile:filePath];
[[frontDocument tableDumpInstance] startSQLImportProcessWithFile:filePath];
return;
}
}
@@ -3168,6 +3168,7 @@ - (id)initWithDocument:(SPDatabaseDocument *)document
#ifndef SP_CODA
databaseConnectionSuperview = [dbDocument databaseView];
#warning Private ivar accessed from outside (#2978)
databaseConnectionView = [dbDocument valueForKey:@"contentViewSplitter"];
#endif
@@ -217,8 +217,7 @@ - (NSMutableArray *)contentFilterForFileURL:(NSURL *)fileURL
*/
- (id)customQueryInstance
{
#warning private ivar accessed from outside
return [tableDocumentInstance valueForKey:@"customQueryInstance"];
return [tableDocumentInstance customQueryInstance];
}
#pragma mark -
@@ -29,22 +29,12 @@
//
// More info at <https://github.com/sequelpro/sequelpro>
#ifndef SP_CODA /* headers */
#import <WebKit/WebKit.h>
#endif
@class SPConnectionController;
#ifdef SP_CODA
@class BottomBarSegmentedControl;
#else
@class SPProcessListController;
@class SPServerVariablesController;
@class SPUserManager;
@class SPWindowController;
@class SPSplitView;
#endif
@class SPDatabaseData;
@class SPTablesList;
@class SPTableStructure;
@@ -61,34 +51,31 @@
@class SPTableTriggers;
@class SPTableRelations;
@class SPHelpViewerClient;
@class SPDataImport;
#import "SPDatabaseContentViewDelegate.h"
#import "SPConnectionControllerDelegateProtocol.h"
#import "SPThreadAdditions.h"
#import <WebKit/WebKit.h>
#import <SPMySQL/SPMySQLConnectionDelegate.h>
/**
* The SPDatabaseDocument class controls the primary database view window.
*/
@interface SPDatabaseDocument : NSObject <SPConnectionControllerDelegateProtocol, SPMySQLConnectionDelegate, NSTextFieldDelegate, NSToolbarDelegate, SPCountedObject, WebFrameLoadDelegate>
{
#ifdef SP_CODA /* patch */
id delegate;
BottomBarSegmentedControl* structureContentSwitcher;
#endif
// IBOutlets
IBOutlet SPTablesList *tablesListInstance;
IBOutlet SPTableStructure *tableSourceInstance;
IBOutlet SPTableContent <SPDatabaseContentViewDelegate> *tableContentInstance;
IBOutlet SPTableContent<SPDatabaseContentViewDelegate> *tableContentInstance;
IBOutlet SPTableRelations *tableRelationsInstance;
IBOutlet SPTableTriggers *tableTriggersInstance;
IBOutlet id customQueryInstance;
IBOutlet id tableDumpInstance;
IBOutlet SPCustomQuery *customQueryInstance;
IBOutlet SPDataImport *tableDumpInstance;
IBOutlet SPTableData *tableDataInstance;
IBOutlet SPExtendedTableInfo *extendedTableInfoInstance;
IBOutlet id databaseDataInstance;
IBOutlet SPDatabaseData *databaseDataInstance;
#ifndef SP_CODA
IBOutlet id spHistoryControllerInstance;
IBOutlet id exportControllerInstance;
@@ -291,40 +278,20 @@
}
@property (nonatomic, assign) NSTableView *dbTablesTableView;
#ifdef SP_CODA /* ivars */
@property (assign) SPDatabaseData* databaseDataInstance;
@property (assign) SPTableData* tableDataInstance;
@property (assign) SPCustomQuery* customQueryInstance;
@property (assign) BottomBarSegmentedControl* structureContentSwitcher;
@property (assign) id databaseNameField;
@property (assign) id databaseEncodingButton;
@property (assign) id addDatabaseButton;
@property (assign) id chooseDatabaseButton;
@property (assign) id databaseRenameNameField;
@property (assign) id renameDatabaseButton;
@property (assign) id databaseRenameSheet;
@property (assign) id delegate;
@property (readonly) NSMutableArray* allDatabases;
@property (assign) NSProgressIndicator* queryProgressBar;
@property (assign) NSWindow* databaseSheet;
#endif
#ifndef SP_CODA /* ivars */
@property (readwrite, retain) NSURL *sqlFileURL;
@property (readwrite, assign) NSStringEncoding sqlFileEncoding;
@property (readwrite, assign) SPWindowController *parentWindowController;
@property (readwrite, assign) NSTabViewItem *parentTabViewItem;
#endif
@property (readwrite, assign) BOOL isProcessing;
#ifndef SP_CODA /* ivars */
@property (readwrite, retain) NSString *processID;
#endif
@property (readonly) SPServerSupport *serverSupport;
@property (readonly) SPDatabaseStructure *databaseStructureRetrieval;
@property (readonly) SPDataImport *tableDumpInstance;
@property (readonly) SPTablesList *tablesListInstance;
@property (readonly) SPCustomQuery *customQueryInstance;
@property (readonly) SPTableContent<SPDatabaseContentViewDelegate> *tableContentInstance;
@property (readonly) int64_t instanceId;
- (SPHelpViewerClient *)helpViewerClient;
@@ -458,7 +425,6 @@
- (NSUndoManager *)undoManager;
#endif
- (NSArray *)allTableNames;
- (SPTablesList *)tablesListInstance;
- (SPCreateDatabaseInfo *)createDatabaseInfo;
- (SPTableViewType) currentlySelectedView;
@@ -139,7 +139,10 @@ @implementation SPDatabaseDocument
@synthesize databaseStructureRetrieval;
@synthesize processID;
@synthesize instanceId;
@synthesize dbTablesTableView = dbTablesTableView;
@synthesize dbTablesTableView;
@synthesize tableDumpInstance;
@synthesize tablesListInstance;
@synthesize tableContentInstance;
#pragma mark -
@@ -2827,11 +2830,6 @@ - (NSArray *)allTableNames
return [tablesListInstance allTableNames];
}
- (SPTablesList *)tablesListInstance
{
return tablesListInstance;
}
- (SPCreateDatabaseInfo *)createDatabaseInfo
{
SPCreateDatabaseInfo *dbInfo = [[SPCreateDatabaseInfo alloc] init];
@@ -5855,7 +5853,9 @@ - (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRec
}
// Otherwise position the sheet beneath the tab bar if it's visible
#warning Private ivar accessed from outside (#2978)
rect.origin.y -= [[parentWindowController valueForKey:@"tabBar"] frame].size.height - 1;
return rect;
}
#endif
@@ -56,23 +56,27 @@ - (id) init
return self;
}
- (void) awakeFromNib
- (void)awakeFromNib
{
#warning private ivar accessed from outside
tableContentInstance = [theDocument valueForKey:@"tableContentInstance"];
tablesListInstance = [theDocument valueForKey:@"tablesListInstance"];
tableContentInstance = [theDocument tableContentInstance];
tablesListInstance = [theDocument tablesListInstance];
toolbarItemVisible = NO;
#warning Private ivar accessed from outside (#2978)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(toolbarWillAddItem:) name:NSToolbarWillAddItemNotification object:[theDocument valueForKey:@"mainToolbar"]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(toolbarDidRemoveItem:) name:NSToolbarDidRemoveItemNotification object:[theDocument valueForKey:@"mainToolbar"]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startDocumentTask:) name:SPDocumentTaskStartNotification object:theDocument];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(endDocumentTask:) name:SPDocumentTaskEndNotification object:theDocument];
}
- (void) dealloc
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
SPClear(tableContentStates);
SPClear(history);
[super dealloc];
}
@@ -174,9 +178,11 @@ - (IBAction) historyControlClicked:(NSSegmentedControl *)theControl
* State tracking is necessary as manipulating items not on the toolbar
* can cause crashes.
*/
- (void) setupInterface
- (void)setupInterface
{
#warning Private ivar accessed from outside (#2978)
NSArray *toolbarItems = [[theDocument valueForKey:@"mainToolbar"] items];
for (NSToolbarItem *toolbarItem in toolbarItems) {
if ([[toolbarItem itemIdentifier] isEqualToString:SPMainToolbarHistoryNavigation]) {
toolbarItemVisible = YES;
View
@@ -46,7 +46,9 @@ - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
if (delegate) {
if ([delegate respondsToSelector:@selector(processUpdatedImageData:)]) {
delegateForUse = delegate;
} else if ( [delegate valueForKey:@"tableContentInstance"]
}
#warning Private ivar accessed from outside (#2978)
else if ( [delegate valueForKey:@"tableContentInstance"]
&& [[delegate valueForKey:@"tableContentInstance"] respondsToSelector:@selector(processUpdatedImageData:)] ) {
delegateForUse = [delegate valueForKey:@"tableContentInstance"];
}
@@ -120,13 +122,16 @@ - (void)paste:(id)sender
if (delegate) {
if ([delegate respondsToSelector:@selector(processUpdatedImageData:)]) {
delegateForUse = delegate;
} else if ( [delegate valueForKey:@"tableContentInstance"]
}
#warning Private ivar accessed from outside (#2978)
else if ( [delegate valueForKey:@"tableContentInstance"]
&& [[delegate valueForKey:@"tableContentInstance"] respondsToSelector:@selector(processUpdatedImageData:)] ) {
delegateForUse = [delegate valueForKey:@"tableContentInstance"];
}
}
if (delegateForUse)
if (delegateForUse) {
[delegateForUse processPasteImageData];
}
}
@end
@@ -180,7 +180,7 @@ - (NSMutableArray *)queryFavoritesForFileURL:(NSURL *)fileURL
*/
- (id)customQueryInstance
{
return [tableDocumentInstance valueForKey:@"customQueryInstance"];
return [tableDocumentInstance customQueryInstance];
}
#pragma mark -
View
@@ -967,7 +967,7 @@ - (void)updateResultStore:(SPMySQLStreamingResultStore *)theResultStore approxim
[theResultStore startDownload];
#ifndef SP_CODA
#warning private ivar accessed from outside
#warning Private ivar accessed from outside (#2978)
NSProgressIndicator *dataLoadingIndicator = [tableDocumentInstance valueForKey:@"queryProgressBar"];
#else
NSProgressIndicator *dataLoadingIndicator = [tableDocumentInstance queryProgressBar];
@@ -3328,7 +3328,7 @@ - (NSRect) viewport
*/
- (CGFloat) tablesListWidth
{
#warning private ivar accessed from outside
#warning Private ivar accessed from outside (#2978)
return [[[[tableDocumentInstance valueForKey:@"contentViewSplitter"] subviews] objectAtIndex:0] frame].size.width;
}
@@ -3528,7 +3528,7 @@ - (void)updateNumberOfRows
[tableDataInstance setStatusValue:@"y" forKey:@"RowsCountAccurate"];
#ifndef SP_CODA
[[tableInfoInstance onMainThread] tableChanged:nil];
#warning private ivar accessed from outside
#warning Private ivar accessed from outside (#2978)
[[[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] onMainThread] loadTable:selectedTable];
#endif
View
@@ -591,6 +591,7 @@ - (NSArray *)suggestionsForSQLCompletionWith:(NSString *)currentWord dictMode:(B
for (id obj in [tablesListInstance allViewNames])
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:obj, @"display", @"table-view-small-square", @"image", @"", @"isRef", nil]];
#warning Private ivar accessed from outside (#2978)
// Add field names to completions list for currently selected table
if ([tableDocumentInstance table] != nil)
for (id obj in [[tableDocumentInstance valueForKeyPath:@"tableDataInstance"] valueForKey:@"columnNames"])
@@ -1521,8 +1522,11 @@ - (void)showCompletionListFor:(NSString*)kind atRange:(NSRange)aRange fuzzySearc
}
}
}
} else {
}
else {
#warning Private ivar accessed from outside (#2978)
arr = [NSArray arrayWithArray:[[tableDocumentInstance valueForKeyPath:@"tableDataInstance"] valueForKey:@"columnNames"]];
if(arr == nil) {
arr = @[];
}
@@ -86,6 +86,7 @@ - (void)swipeWithEvent:(NSEvent *)event
if (frontDoc && [frontDoc isKindOfClass:[SPDatabaseDocument class]] && [frontDoc valueForKeyPath:@"spHistoryControllerInstance"] && ![frontDoc isWorking])
{
#warning Private ivar accessed from outside (#2978)
if ([event deltaX] == -1.0f) {
[[frontDoc valueForKeyPath:@"spHistoryControllerInstance"] valueForKey:@"goForwardInHistory"];
}
@@ -239,6 +239,7 @@ - (IBAction)moveSelectedTabInNewWindow:(id)sender
[newWindow setTitle:[[[[tabView selectedTabViewItem] identifier] parentWindow] title]];
// New window's tabBar control
#warning Private ivar accessed from outside (#2978)
PSMTabBarControl *control = [newWindowController valueForKey:@"tabBar"];
// Add the selected tab to the new window
@@ -849,6 +850,7 @@ - (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewIt
[newWindow setTitle:[[[tabViewItem identifier] parentWindow] title]];
// Return the window's tab bar
#warning Private ivar accessed from outside (#2978)
return [newWindowController valueForKey:@"tabBar"];
}

0 comments on commit 4b2fcc0

Please sign in to comment.