aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorStuart Connolly <stuart02@gmail.com>2014-01-20 00:24:38 +0000
committerStuart Connolly <stuart02@gmail.com>2014-01-20 00:24:38 +0000
commit0d1e5180d575e6191362ae4ba411d240da93c14d (patch)
tree9014cf9425cc74d8fe66868da8948753dd612c75 /Source/SPDatabaseDocument.m
parent2d299f2c13e6e0c7593592b22b4597d940fc90bf (diff)
downloadsequelpro-0d1e5180d575e6191362ae4ba411d240da93c14d.tar.gz
sequelpro-0d1e5180d575e6191362ae4ba411d240da93c14d.tar.bz2
sequelpro-0d1e5180d575e6191362ae4ba411d240da93c14d.zip
Force a table reload (just the view not the actual data retrieval) whenever the view binary data as hex option is toggled. Fixes #1875.
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m76
1 files changed, 46 insertions, 30 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index a57a5bba..5d36d864 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -119,14 +119,18 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
@interface SPDatabaseDocument ()
+
- (void)_addDatabase;
- (void)_alterDatabase;
+
#ifndef SP_CODA /* method decls */
- (void)_copyDatabase;
#endif
+
- (void)_renameDatabase;
- (void)_removeDatabase;
- (void)_selectDatabaseAndItem:(NSDictionary *)selectionDetails;
+
#ifndef SP_CODA /* method decls */
- (void)_processDatabaseChangedBundleTriggerActions;
#endif
@@ -166,9 +170,12 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
@synthesize structureContentSwitcher;
#endif
+#pragma mark -
+
- (id)init
{
if ((self = [super init])) {
+
#ifndef SP_CODA /* init ivars */
_mainNibLoaded = NO;
@@ -179,6 +186,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
_supportsEncoding = NO;
databaseListIsSelectable = YES;
_queryMode = SPInterfaceQueryMode;
+
chooseDatabaseButton = nil;
#ifndef SP_CODA /* init ivars */
chooseDatabaseToolbarItem = nil;
@@ -200,6 +208,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
mySQLVersion = nil;
allDatabases = nil;
allSystemDatabases = nil;
+
#ifndef SP_CODA /* init ivars */
mainToolbar = nil;
parentWindow = nil;
@@ -225,6 +234,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
#endif
titleAccessoryView = nil;
+
#ifndef SP_CODA /* init ivars */
taskProgressWindow = nil;
taskDisplayIsIndeterminate = YES;
@@ -241,6 +251,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
addDatabaseCharsetHelper = nil;
keyChainID = nil;
+
#ifndef SP_CODA /* init ivars */
statusValues = nil;
printThread = nil;
@@ -262,34 +273,11 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
return self;
}
-#ifdef SP_CODA /* glue */
-- (SPConnectionController*)createConnectionController
-{
- // Set up the connection controller
- connectionController = [[SPConnectionController alloc] initWithDocument:self];
-
- // Set the connection controller's delegate
- [connectionController setDelegate:self];
-
- return connectionController;
-}
-
-- (void)setTableSourceInstance:(SPTableStructure*)source
-{
- tableSourceInstance = source;
-}
-
-- (void)setTableContentInstance:(SPTableContent*)content
-{
- tableContentInstance = content;
-}
-
-#endif
-
- (void)awakeFromNib
{
#ifndef SP_CODA
if (_mainNibLoaded) return;
+
_mainNibLoaded = YES;
// Set up the toolbar
@@ -300,7 +288,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
// Set up the connection controller
connectionController = [[SPConnectionController alloc] initWithDocument:self];
-
+
// Set the connection controller's delegate
[connectionController setDelegate:self];
@@ -317,6 +305,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
[prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:tableContentInstance forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL];
+ [prefs addObserver:tableContentInstance forKeyPath:SPDisplayBinaryDataAsHex options:NSKeyValueObservingOptionNew context:NULL];
// Register observers for when the logging preference changes
[prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL];
@@ -324,6 +313,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
// Register a second observer for when the logging preference changes so we can tell the current connection about it
[prefs addObserver:self forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL];
#endif
+
// Register for notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willPerformQuery:)
name:@"SMySQLQueryWillBePerformed" object:self];
@@ -341,7 +331,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
// Hide the activity list
[self setActivityPaneHidden:[NSNumber numberWithInteger:1]];
-
+
// Load additional nibs, keeping track of the top-level objects to allow correct release
NSArray *connectionDialogTopLevelObjects = nil;
NSNib *nibLoader = [[NSNib alloc] initWithNibNamed:@"ConnectionErrorDialog" bundle:[NSBundle mainBundle]];
@@ -353,7 +343,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
[nibLoader release];
// SP_CODA can't use progress indicator because of BWToolkit dependency
-
+
NSArray *progressIndicatorLayerTopLevelObjects = nil;
nibLoader = [[NSNib alloc] initWithNibNamed:@"ProgressIndicatorLayer" bundle:[NSBundle mainBundle]];
if (![nibLoader instantiateNibWithOwner:self topLevelObjects:&progressIndicatorLayerTopLevelObjects]) {
@@ -366,7 +356,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
// Retain the icon accessory view to allow it to be added and removed from windows
[titleAccessoryView retain];
#endif
-
+
#ifndef SP_CODA
// Set up the progress indicator child window and layer - change indicator color and size
[taskProgressIndicator setForeColor:[NSColor whiteColor]];
@@ -385,11 +375,37 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
[self updateTitlebarStatusVisibilityForcingHide:NO];
#endif
-
+
alterDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseAlterEncodingButton CollationButton:databaseAlterCollationButton];
- addDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseEncodingButton CollationButton:databaseCollationButton];
+ addDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseEncodingButton CollationButton:databaseCollationButton];
+}
+
+#pragma mark -
+
+#ifdef SP_CODA /* glue */
+- (SPConnectionController*)createConnectionController
+{
+ // Set up the connection controller
+ connectionController = [[SPConnectionController alloc] initWithDocument:self];
+
+ // Set the connection controller's delegate
+ [connectionController setDelegate:self];
+
+ return connectionController;
+}
+
+- (void)setTableSourceInstance:(SPTableStructure*)source
+{
+ tableSourceInstance = source;
}
+- (void)setTableContentInstance:(SPTableContent*)content
+{
+ tableContentInstance = content;
+}
+
+#endif
+
#ifndef SP_CODA /* password sheet and history navigation */
/**
* Set the return code for entering the encryption passowrd sheet