aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPUserManager.h1
-rw-r--r--Source/SPUserManager.m97
-rw-r--r--Source/TableDocument.m8
3 files changed, 66 insertions, 40 deletions
diff --git a/Source/SPUserManager.h b/Source/SPUserManager.h
index cd397e3d..7d70891e 100644
--- a/Source/SPUserManager.h
+++ b/Source/SPUserManager.h
@@ -49,7 +49,6 @@
- (NSManagedObjectContext *)managedObjectContext;
- (id)initWithConnection:(MCPConnection *)connection;
-- (void)show;
- (void)initializeChild:(NSManagedObject *)child withItem:(NSDictionary *)item;
// Add/Remove Users
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index 4b7863e1..870f35a8 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -47,35 +47,27 @@
@synthesize mySqlConnection;
-- (id)init
-{
- [self dealloc];
- @throw [NSException exceptionWithName:@"BadInitCall" reason:@"Can't call init here" userInfo:nil];
- return nil;
-}
-
- (id)initWithConnection:(MCPConnection*) connection
{
- if (![super init]) {
- return nil;
- }
+ if ((self = [super initWithWindowNibName:@"UserManagerView"])) {
- 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
- // is derived automatically. While most keys can be automatically converted without
- // any difficulty, some keys differ slightly in mysql column storage to GRANT syntax;
- // this dictionary provides mappings for those values to ensure consistency.
- privColumnToGrantMap = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"Grant_option_priv", @"Grant_priv",
- @"Show_databases_priv", @"Show_db_priv",
- @"Create_temporary_tables_priv", @"Create_tmp_table_priv",
- @"Replication_slave_priv", @"Repl_slave_priv",
- @"Replication_client_priv", @"Repl_client_priv",
- nil];
-
- privsSupportedByServer = [[NSMutableDictionary alloc] init];
+ 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
+ // is derived automatically. While most keys can be automatically converted without
+ // any difficulty, some keys differ slightly in mysql column storage to GRANT syntax;
+ // this dictionary provides mappings for those values to ensure consistency.
+ privColumnToGrantMap = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"Grant_option_priv", @"Grant_priv",
+ @"Show_databases_priv", @"Show_db_priv",
+ @"Create_temporary_tables_priv", @"Create_tmp_table_priv",
+ @"Replication_slave_priv", @"Repl_slave_priv",
+ @"Replication_client_priv", @"Repl_client_priv",
+ nil];
+
+ privsSupportedByServer = [[NSMutableDictionary alloc] init];
+ }
return self;
}
@@ -109,7 +101,6 @@
[tableColumn setDataCell:imageAndTextCell];
[self _initializeUsers];
- [[self window] makeKeyAndOrderFront:nil];
}
- (void)_initializeUsers
@@ -316,14 +307,14 @@
return mySqlConnection;
}
-- (void)show
+/*- (void)show
{
// [NSThread detachNewThreadSelector:@selector(_initializeUsers) toTarget:self withObject:nil];
if (!outlineView) {
[NSBundle loadNibNamed:@"UserManagerView" owner:self];
}
[[self window] makeKeyAndOrderFront:nil];
-}
+}*/
#pragma mark -
#pragma mark OutlineView Delegate Methods
@@ -383,26 +374,37 @@
}
}
-// General Action Methods
+#pragma mark -
+#pragma mark General IBAction methods
+
+/**
+ * Closes the user manager and reverts any changes made.
+ */
- (IBAction)doCancel:(id)sender
{
[[self managedObjectContext] rollback];
- [[self window] close];
+
+ // Close sheet
+ [NSApp endSheet:[self window] returnCode:0];
+ [[self window] orderOut:self];
}
+/**
+ * Closes the user manager and applies any changes made.
+ */
- (IBAction)doApply:(id)sender
{
NSError *error = nil;
[[self managedObjectContext] save:&error];
- if (error != nil)
- {
+
+ if (error != nil) {
[[NSApplication sharedApplication] presentError:error];
}
- else
- {
- [[self window] close];
+ else {
+ // Close sheet
+ [NSApp endSheet:[self window] returnCode:0];
+ [[self window] orderOut:self];
}
-// [self _clearData];
}
- (IBAction)checkAllPrivileges:(id)sender
@@ -713,6 +715,7 @@
#pragma mark -
#pragma mark Tab View Delegate methods
+
- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem
{
if ([[treeController selectedObjects] count] == 0)
@@ -727,4 +730,24 @@
return TRUE;
}
+
+#pragma mark -
+#pragma mark SplitView delegate methods
+
+/**
+ * Return the maximum possible size of the splitview.
+ */
+- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+{
+ return (proposedMax - 220);
+}
+
+/**
+ * Return the minimum possible size of the splitview.
+ */
+- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+{
+ return (proposedMin + 120);
+}
+
@end
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 6f839fe7..1d95c695 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -2002,8 +2002,12 @@
* Displays the user account manager.
*/
- (IBAction)showUserManager:(id)sender
-{
- [userManagerInstance show];
+{
+ [NSApp beginSheet:[userManagerInstance window]
+ modalForWindow:tableWindow
+ modalDelegate:userManagerInstance
+ didEndSelector:nil
+ contextInfo:nil];
}
/**