aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPCustomQuery.h8
-rw-r--r--Source/SPDatabaseDocument.h14
-rw-r--r--Source/SPDatabaseDocument.m52
-rw-r--r--Source/SPKeychain.m2
-rw-r--r--Source/SPTableData.m2
5 files changed, 50 insertions, 28 deletions
diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h
index f001d364..8d289f70 100644
--- a/Source/SPCustomQuery.h
+++ b/Source/SPCustomQuery.h
@@ -186,6 +186,14 @@
NSString *kCellEditorErrorTooManyMatches;
}
+#ifdef SP_REFACTOR
+@property (assign) SPDatabaseDocument* tableDocumentInstance;
+@property (assign) SPTablesList* tablesListInstance;
+@property (assign) SPTextView *textView;
+@property (assign) SPCopyTable *customQueryView;
+@property (assign) NSButton* runAllButton;
+#endif
+
@property(assign) BOOL textViewWasChanged;
// IBAction methods
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index ebdac213..8f67ccc4 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -34,7 +34,7 @@
#ifndef SP_REFACTOR /* class forward decls */
SPProcessListController, SPServerVariablesController, SPUserManager, SPWindowController,
#endif
-SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport;
+SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SPCustomQuery;
#import "SPConnectionControllerDelegateProtocol.h"
@@ -85,7 +85,7 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport;
IBOutlet id databaseCopySheet;
IBOutlet id databaseRenameSheet;
- IBOutlet id queryProgressBar;
+ IBOutlet NSProgressIndicator* queryProgressBar;
IBOutlet NSBox *taskProgressLayer;
IBOutlet id taskProgressIndicator;
IBOutlet id taskDescriptionText;
@@ -234,8 +234,9 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport;
}
#ifdef SP_REFACTOR /* ivars */
-@property (readwrite, assign) id delegate;
+@property (assign) id delegate;
@property (readonly) NSMutableArray* allDatabases;
+@property (assign) NSProgressIndicator* queryProgressBar;
#endif
#ifndef SP_REFACTOR /* ivars */
@@ -397,7 +398,9 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport;
// Tab methods
- (void)makeKeyDocument;
- (BOOL)parentTabShouldClose;
+#endif
- (void)parentTabDidClose;
+#ifndef SP_REFACTOR
- (void)willResignActiveTabInWindow;
- (void)didBecomeActiveTabInWindow;
- (void)tabDidBecomeKey;
@@ -430,10 +433,11 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport;
- (void)connect;
- (NSArray*)allTableNames;
- (SPTablesList*)tablesListInstance;
-- (SPTableData*)tableDataInstance;
- (void)setTableSourceInstance:(SPTableStructure*)source;
- (void)setTableContentInstance:(SPTableContent*)content;
-- (void)setTableDataInstance:(SPTableData*)data;
+
+@property (assign) SPTableData* tableDataInstance;
+@property (assign) SPCustomQuery* customQueryInstance;
#endif
@end
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 5a2bff92..7fb04a32 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -39,7 +39,9 @@
#import "ImageAndTextCell.h"
#import "SPGrowlController.h"
#import "SPExportController.h"
+#endif
#import "SPQueryController.h"
+#ifndef SP_REFACTOR /* headers */
#import "SPWindowController.h"
#endif
#import "SPNavigatorController.h"
@@ -76,10 +78,13 @@
#ifdef SP_REFACTOR /* headers */
#import "SPAlertSheets.h"
#import "NSNotificationAdditions.h"
+#import "SPCustomQuery.h"
#endif
// Constants
+#ifndef SP_REFACTOR
static NSString *SPCreateSyntx = @"SPCreateSyntax";
+#endif
@interface SPDatabaseDocument ()
@@ -108,6 +113,9 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
#ifdef SP_REFACTOR /* ivars */
@synthesize allDatabases;
@synthesize delegate;
+@synthesize tableDataInstance;
+@synthesize customQueryInstance;
+@synthesize queryProgressBar;
#endif
- (id)init
@@ -212,22 +220,12 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
tableContentInstance = content;
}
-- (void)setTableDataInstance:(SPTableData*)data
-{
- tableDataInstance = data;
-}
-
-- (SPTableData*)tableDataInstance
-{
- return tableDataInstance;
-}
-
#endif
-#ifndef SP_REFACTOR /* awakeFromNib */
- (void)awakeFromNib
{
+#ifndef SP_REFACTOR
if (_mainNibLoaded) return;
_mainNibLoaded = YES;
@@ -259,7 +257,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
// 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];
@@ -268,6 +266,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:)
name:@"NSApplicationWillTerminateNotification" object:nil];
+#ifndef SP_REFACTOR
// Find the Database -> Database Encoding menu (it's not in our nib, so we can't use interface builder)
selectEncodingMenu = [[[[[NSApp mainMenu] itemWithTag:SPMainMenuDatabase] submenu] itemWithTag:1] submenu];
@@ -326,8 +325,8 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[taskProgressWindow setContentView:taskProgressLayer];
[contentViewSplitter setDelegate:self];
-}
#endif
+}
#ifndef SP_REFACTOR /* password sheet and history navigation */
/**
@@ -444,10 +443,10 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[tableDataInstance setConnection:mySQLConnection];
[extendedTableInfoInstance setConnection:mySQLConnection];
-#ifndef SP_REFACTOR /* update custom query editor */
// Set the custom query editor's MySQL version
[customQueryInstance setMySQLversion:mySQLVersion];
+#ifndef SP_REFACTOR
[self updateWindowTitle:self];
// Connected Growl notification
@@ -2554,12 +2553,12 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[queryProgressBar stopAnimation:self];
}
-#ifndef SP_REFACTOR /* applicationWillTerminate: */
/**
* Invoked when the application will terminate
*/
- (void)applicationWillTerminate:(NSNotification *)notification
{
+#ifndef SP_REFACTOR /* applicationWillTerminate: */
// Auto-save preferences to spf file based connection
if([self fileURL] && [[[self fileURL] path] length] && ![self isUntitled])
@@ -2573,11 +2572,13 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
// Note that this call does not need to be removed in release builds as leaks analysis output is only
// dumped if [[SPLogger logger] setDumpLeaksOnTermination]; has been called first.
[[SPLogger logger] dumpLeaks];
+#endif
}
#pragma mark -
#pragma mark Menu methods
+#ifndef SP_REFACTOR
/**
* Saves SP session or if Custom Query tab is active the editor's content as SQL file
* If sender == nil then the call came from [self writeSafelyToURL:ofType:forSaveOperation:error]
@@ -3863,18 +3864,26 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
// Return YES by default
return YES;
}
+#endif
/**
* Invoked when the parent tab is about to close
*/
- (void)parentTabDidClose
{
+<<<<<<< .working
+=======
+#ifndef SP_REFACTOR
+>>>>>>> .merge-right.r3375
// Cancel autocompletion trigger
if([prefs boolForKey:SPCustomQueryAutoComplete])
+#endif
[NSObject cancelPreviousPerformRequestsWithTarget:[customQueryInstance valueForKeyPath:@"textView"]
selector:@selector(doAutoCompletion)
object:nil];
+#ifndef SP_REFACTOR
if([prefs boolForKey:SPCustomQueryUpdateAutoHelp])
+#endif
[NSObject cancelPreviousPerformRequestsWithTarget:[customQueryInstance valueForKeyPath:@"textView"]
selector:@selector(autoHelp)
object:nil];
@@ -3883,12 +3892,15 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[mySQLConnection setDelegate:nil];
if (_isConnected) [self closeConnection];
else [connectionController cancelConnection];
+#ifndef SP_REFACTOR
if ([[[SPQueryController sharedQueryController] window] isVisible]) [self toggleConsole:self];
+#endif
[createTableSyntaxWindow orderOut:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self setParentWindow:nil];
}
+#ifndef SP_REFACTOR
/**
* Invoked when the parent tab is currently the active tab in the
* window, but is being switched away from, to allow cleaning up
@@ -4114,7 +4126,8 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[connection setObject:[connectionController sshHost] forKey:@"ssh_host"];
[connection setObject:[connectionController sshUser] forKey:@"ssh_user"];
[connection setObject:[NSNumber numberWithInt:[connectionController sshKeyLocationEnabled]] forKey:@"ssh_keyLocationEnabled"];
- [connection setObject:[connectionController sshKeyLocation] forKey:@"ssh_keyLocation"];
+ if ([connectionController sshKeyLocation])
+ [connection setObject:[connectionController sshKeyLocation] forKey:@"ssh_keyLocation"];
if ([connectionController sshPort] && [[connectionController sshPort] length])
[connection setObject:[NSNumber numberWithInteger:[[connectionController sshPort] integerValue]] forKey:@"ssh_port"];
break;
@@ -4134,11 +4147,8 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
if (includePasswords) {
NSString *pw = [self keychainPasswordForConnection:nil];
- if (![pw length]) pw = [connectionController password];
- if (pw)
- [connection setObject:pw forKey:@"password"];
- else
- [connection setObject:@"" forKey:@"password"];
+ if (!pw) pw = [connectionController password];
+ if (pw) [connection setObject:pw forKey:@"password"];
if ([connectionController type] == SPSSHTunnelConnection) {
NSString *sshpw = [self keychainPasswordForSSHConnection:nil];
diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m
index bb010d3b..931f14d7 100644
--- a/Source/SPKeychain.m
+++ b/Source/SPKeychain.m
@@ -120,7 +120,7 @@
void *passwordData;
UInt32 passwordLength;
SecKeychainItemRef itemRef;
- NSString *password = @"";
+ NSString *password = nil;
// Check supplied variables and replaces nils with empty strings
if (!name) name = @"";
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index de253e57..1936d0b1 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -928,7 +928,7 @@
BOOL changeEncoding = ![[mySQLConnection encoding] isEqualToString:@"utf8"];
// Catch unselected tables and return false
- if ([[tableListInstance tableName] isEqualToString:@""] || ![tableListInstance tableName]) {
+ if (![tableListInstance tableName]) {
pthread_mutex_unlock(&dataProcessingLock);
return FALSE;
}