aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/UserManagerView.xib28
-rw-r--r--Source/SPUserManager.h3
-rw-r--r--Source/SPUserManager.m29
-rw-r--r--Source/TableDocument.m2
4 files changed, 29 insertions, 33 deletions
diff --git a/Interfaces/English.lproj/UserManagerView.xib b/Interfaces/English.lproj/UserManagerView.xib
index 0cacc850..dbc0e9f3 100644
--- a/Interfaces/English.lproj/UserManagerView.xib
+++ b/Interfaces/English.lproj/UserManagerView.xib
@@ -16,12 +16,12 @@
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>732</string>
- <string>1.2.1</string>
+ <string>1.2.2</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="592"/>
+ <integer value="41"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -411,13 +411,13 @@
<object class="NSTabViewItem" id="820796939">
<string key="NSIdentifier">General</string>
<object class="NSView" key="NSView" id="143215913">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="716372522"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSBox" id="813339681">
<reference key="NSNextResponder" ref="143215913"/>
- <int key="NSvFlags">13</int>
+ <int key="NSvFlags">8</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSView" id="338485078">
@@ -518,7 +518,7 @@
<reference key="NSSuperview" ref="813339681"/>
</object>
</object>
- <string key="NSFrame">{{147, 312}, {256, 88}}</string>
+ <string key="NSFrame">{{147, 161}, {256, 88}}</string>
<reference key="NSSuperview" ref="143215913"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -540,6 +540,7 @@
</object>
</object>
<string key="NSFrame">{{10, 33}, {511, 414}}</string>
+ <reference key="NSSuperview" ref="716372522"/>
</object>
<string key="NSLabel">General</string>
<reference key="NSColor" ref="409859189"/>
@@ -548,8 +549,8 @@
<object class="NSTabViewItem" id="1024639412">
<string key="NSIdentifier">Global Privileges</string>
<object class="NSView" key="NSView" id="202198269">
- <reference key="NSNextResponder" ref="716372522"/>
- <int key="NSvFlags">274</int>
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">288</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomView" id="386290455">
@@ -1365,7 +1366,6 @@
</object>
</object>
<string key="NSFrame">{{10, 33}, {511, 414}}</string>
- <reference key="NSSuperview" ref="716372522"/>
</object>
<string key="NSLabel">Global Privileges</string>
<reference key="NSColor" ref="409859189"/>
@@ -1380,7 +1380,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSBox" id="991025453">
<reference key="NSNextResponder" ref="169019919"/>
- <int key="NSvFlags">269</int>
+ <int key="NSvFlags">264</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSView" id="289920921">
@@ -1614,7 +1614,7 @@
<reference key="NSSuperview" ref="991025453"/>
</object>
</object>
- <string key="NSFrame">{{127, 244}, {256, 122}}</string>
+ <string key="NSFrame">{{127, 144}, {256, 122}}</string>
<reference key="NSSuperview" ref="169019919"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -1642,13 +1642,13 @@
<reference key="NSTabView" ref="716372522"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="1024639412"/>
+ <reference key="NSSelectedTabViewItem" ref="820796939"/>
<reference key="NSFont" ref="746597359"/>
<int key="NSTvFlags">0</int>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="202198269"/>
+ <reference ref="143215913"/>
</object>
</object>
<object class="NSButton" id="445730006">
@@ -4285,11 +4285,11 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{73, 350}, {752, 506}}</string>
+ <string>{{37, 350}, {752, 506}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/>
<boolean value="NO"/>
- <string>{{73, 350}, {752, 506}}</string>
+ <string>{{37, 350}, {752, 506}}</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>SPOutlineView</string>
diff --git a/Source/SPUserManager.h b/Source/SPUserManager.h
index d673226a..cd397e3d 100644
--- a/Source/SPUserManager.h
+++ b/Source/SPUserManager.h
@@ -42,14 +42,13 @@
IBOutlet NSTreeController *treeController;
IBOutlet NSMutableDictionary *privsSupportedByServer;
}
+@property (nonatomic, retain) MCPConnection *mySqlConnection;
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator;
- (NSManagedObjectModel *)managedObjectModel;
- (NSManagedObjectContext *)managedObjectContext;
- (id)initWithConnection:(MCPConnection *)connection;
-- (void)setConnection:(MCPConnection *)connection;
-- (MCPConnection *)connection;
- (void)show;
- (void)initializeChild:(NSManagedObject *)child withItem:(NSDictionary *)item;
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index aaa56b1a..4b7863e1 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -29,6 +29,7 @@
#import "ImageAndTextCell.h"
#import "SPArrayAdditions.h"
#import "SPStringAdditions.h"
+#import "SPGrowlController.h"
#define COLUMNIDNAME @"NameColumn"
@@ -44,6 +45,8 @@
@implementation SPUserManager
+@synthesize mySqlConnection;
+
- (id)init
{
[self dealloc];
@@ -57,7 +60,7 @@
return nil;
}
- [self setConnection:connection];
+ self.mySqlConnection = connection;
// When reading privileges from the database, they are converted automatically to a
// lowercase key used in the user privileges stores, from which a GRANT syntax
@@ -97,10 +100,6 @@
selector:@selector(contextDidSave:)
name:NSManagedObjectContextDidSaveNotification
object:nil];
- //[[NSNotificationCenter defaultCenter] addObserver:self
-// selector:@selector(contextDidChange:)
-// name:NSManagedObjectContextObjectsDidChangeNotification
-// object:nil];
[tabView selectTabViewItemAtIndex:0];
NSTableColumn *tableColumn = [outlineView tableColumnWithIdentifier:COLUMNIDNAME];
@@ -110,7 +109,6 @@
[tableColumn setDataCell:imageAndTextCell];
[self _initializeUsers];
-// [NSThread detachNewThreadSelector:@selector(_initializeUsers) toTarget:self withObject:nil];
[[self window] makeKeyAndOrderFront:nil];
}
@@ -124,7 +122,7 @@
NSMutableArray *resultAsArray = [NSMutableArray array];
NSMutableArray *usersResultArray = [NSMutableArray array];
- MCPResult *result = [[[self connection] queryString:@"SELECT * FROM `mysql`.`user` ORDER BY `user`"] retain];
+ MCPResult *result = [[self.mySqlConnection queryString:@"SELECT * FROM `mysql`.`user` ORDER BY `user`"] retain];
int rows = [result numOfRows];
if (rows > 0)
{
@@ -146,7 +144,7 @@
[privsSupportedByServer removeAllObjects];
// Attempt to use SHOW PRIVILEGES syntax - supported since 4.1.0
- result = [[self connection] queryString:@"SHOW PRIVILEGES"];
+ result = [self.mySqlConnection queryString:@"SHOW PRIVILEGES"];
if ([result numOfRows]) {
while (privRow = [result fetchRowAsArray]) {
privKey = [NSMutableString stringWithString:[[privRow objectAtIndex:0] lowercaseString]];
@@ -157,7 +155,7 @@
// If that fails, base privilege support on the mysql.users columns
} else {
- result = [[self connection] queryString:@"SHOW COLUMNS FROM `mysql`.`user`"];
+ result = [self.mySqlConnection queryString:@"SHOW COLUMNS FROM `mysql`.`user`"];
while (privRow = [result fetchRowAsArray]) {
privKey = [NSMutableString stringWithString:[privRow objectAtIndex:0]];
if (![privKey hasSuffix:@"_priv"]) continue;
@@ -592,7 +590,7 @@
}
droppedUsers = [[droppedUsers substringToIndex:[droppedUsers length]-2] mutableCopy];
- [[self connection] queryString:[NSString stringWithFormat:@"DROP USER %@", droppedUsers]];
+ [self.mySqlConnection queryString:[NSString stringWithFormat:@"DROP USER %@", droppedUsers]];
return TRUE;
}
@@ -607,7 +605,7 @@
[[user valueForKey:@"host"] tickQuotedString],
[[[user parent] valueForKey:@"password"] tickQuotedString]];
// Create user in database
- [[self connection] queryString:[NSString stringWithFormat:createStatement]];
+ [self.mySqlConnection queryString:[NSString stringWithFormat:createStatement]];
if ([self checkAndDisplayMySqlError])
{
@@ -615,7 +613,6 @@
}
}
}
-
return TRUE;
}
@@ -654,7 +651,7 @@
[[[user parent] valueForKey:@"user"] tickQuotedString],
[[user valueForKey:@"host"] tickQuotedString]];
DLog(@"%@", grantStatement);
- [[self connection] queryString:[NSString stringWithFormat:grantStatement]];
+ [self.mySqlConnection queryString:[NSString stringWithFormat:grantStatement]];
[self checkAndDisplayMySqlError];
}
@@ -666,7 +663,7 @@
[[[user parent] valueForKey:@"user"] tickQuotedString],
[[user valueForKey:@"host"] tickQuotedString]];
DLog(@"%@", revokeStatement);
- [[self connection] queryString:[NSString stringWithFormat:revokeStatement]];
+ [self.mySqlConnection queryString:[NSString stringWithFormat:revokeStatement]];
[self checkAndDisplayMySqlError];
}
}
@@ -703,9 +700,9 @@
- (BOOL)checkAndDisplayMySqlError
{
- if (![[[self connection] getLastErrorMessage] isEqualToString:@""])
+ if (![[self.mySqlConnection getLastErrorMessage] isEqualToString:@""])
{
- NSAlert *alert = [NSAlert alertWithMessageText:@"MySQL Error" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:[[self connection] getLastErrorMessage]];
+ NSAlert *alert = [NSAlert alertWithMessageText:@"MySQL Error" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:[self.mySqlConnection getLastErrorMessage]];
[alert runModal];
return FALSE;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 82092668..6b9e5eb4 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -625,7 +625,7 @@
userManagerInstance = [[SPUserManager alloc] initWithConnection:mySQLConnection];
}
- [userManagerInstance setConnection:mySQLConnection];
+ userManagerInstance.mySqlConnection = mySQLConnection;
// Set the cutom query editor's MySQL version
[customQueryInstance setMySQLversion:mySQLVersion];