aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormltownsend <mltownsend@gmail.com>2009-10-29 23:40:09 +0000
committermltownsend <mltownsend@gmail.com>2009-10-29 23:40:09 +0000
commit8287fc2305b38fdb3ecfa8ad5eef09cd745b80c9 (patch)
tree9051075a56709d0a63f96338e790a1907f54639f
parentc965c29b6ccf39a96a192f5c4bfffa2c0620cefc (diff)
downloadsequelpro-8287fc2305b38fdb3ecfa8ad5eef09cd745b80c9.tar.gz
sequelpro-8287fc2305b38fdb3ecfa8ad5eef09cd745b80c9.tar.bz2
sequelpro-8287fc2305b38fdb3ecfa8ad5eef09cd745b80c9.zip
Got rid of a crash when using the User Manager and closing last Table Document. May be leaking now, not sure. Still needs some work.
-rw-r--r--Interfaces/English.lproj/DBView.xib167
-rw-r--r--Interfaces/English.lproj/UserManagerView.xib29
-rw-r--r--Source/SPUserManager.h10
-rw-r--r--Source/SPUserManager.m87
-rw-r--r--Source/TableDocument.h5
-rw-r--r--Source/TableDocument.m13
6 files changed, 213 insertions, 98 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 13bca4da..6dd4ef73 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -18,7 +18,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>732</string>
<string>732</string>
- <string>1.2.1</string>
+ <string>1.2.2</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
@@ -4863,7 +4863,7 @@
<string key="NSWindowContentMaxSize">{292, 112}</string>
<string key="NSWindowContentMinSize">{292, 112}</string>
<object class="NSView" key="NSWindowView" id="70075497">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4872,7 +4872,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{36, 75}, {91, 14}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="45988560">
<int key="NSCellFlags">68288064</int>
@@ -4889,7 +4888,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 50}, {110, 14}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="410467805">
<int key="NSCellFlags">68288064</int>
@@ -4906,7 +4904,6 @@
<int key="NSvFlags">258</int>
<string key="NSFrame">{{135, 74}, {137, 18}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="212969926">
<int key="NSCellFlags">-1804468671</int>
@@ -4924,7 +4921,6 @@
<int key="NSvFlags">259</int>
<string key="NSFrame">{{207, 13}, {70, 28}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="169260261">
@@ -4952,7 +4948,6 @@
<int key="NSvFlags">259</int>
<string key="NSFrame">{{139, 13}, {70, 28}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="994559297">
<int key="NSCellFlags">67239424</int>
@@ -4974,7 +4969,6 @@
<int key="NSvFlags">258</int>
<string key="NSFrame">{{132, 45}, {143, 22}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="1000126742">
<int key="NSCellFlags">-2076049856</int>
@@ -5295,8 +5289,6 @@
</object>
</object>
<string key="NSFrameSize">{292, 112}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{292, 134}</string>
@@ -11159,6 +11151,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSCustomObject" id="796834585">
<string key="NSClassName">SPHistoryController</string>
</object>
+ <object class="NSCustomObject" id="346502212">
+ <string key="NSClassName">SPUserManager</string>
+ </object>
<object class="NSMenu" id="556141845">
<string key="NSTitle"/>
<object class="NSMutableArray" key="NSMenuItems">
@@ -15220,6 +15215,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6637</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">userManagerInstance</string>
+ <reference key="source" ref="427689665"/>
+ <reference key="destination" ref="346502212"/>
+ </object>
+ <int key="connectionID">6639</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -21464,6 +21467,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="object" ref="377328771"/>
<reference key="parent" ref="239882863"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6638</int>
+ <reference key="object" ref="346502212"/>
+ <reference key="parent" ref="0"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -22766,6 +22774,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>662.ImportedFromIB2</string>
<string>663.IBPluginDependency</string>
<string>663.ImportedFromIB2</string>
+ <string>6638.IBPluginDependency</string>
<string>669.IBPluginDependency</string>
<string>669.ImportedFromIB2</string>
<string>67.ImportedFromIB2</string>
@@ -24624,6 +24633,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -24807,7 +24817,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6637</int>
+ <int key="maxID">6639</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -25048,6 +25058,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSDictionary</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/NSDictionary_DeepMutableCopy.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSImageView</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -25502,6 +25519,56 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">SPUserManager</string>
+ <string key="superclassName">NSWindowController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>addHost:</string>
+ <string>addUser:</string>
+ <string>checkAllPrivileges:</string>
+ <string>doApply:</string>
+ <string>doCancel:</string>
+ <string>removeHost:</string>
+ <string>removeUser:</string>
+ <string>uncheckAllPrivileges:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>outlineView</string>
+ <string>privsSupportedByServer</string>
+ <string>tabView</string>
+ <string>treeController</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSOutlineView</string>
+ <string>NSMutableDictionary</string>
+ <string>NSTabView</string>
+ <string>NSTreeController</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPUserManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">TableContent</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
@@ -25751,6 +25818,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>titleAccessoryView</string>
<string>titleImageView</string>
<string>titleStringView</string>
+ <string>userManagerInstance</string>
<string>variablesCountTextField</string>
<string>variablesSearchField</string>
<string>variablesSheet</string>
@@ -25812,6 +25880,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>SPUserManager</string>
<string>NSTextField</string>
<string>NSSearchField</string>
<string>id</string>
@@ -26347,6 +26416,28 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSDictionary</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="424947834">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSDictionary.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSDictionary</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="457038916">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSDictionary</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="299226340">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSDocument</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
@@ -26431,6 +26522,15 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSMutableDictionary</string>
+ <string key="superclassName">NSDictionary</string>
+ <reference key="sourceIdentifier" ref="424947834"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSMutableDictionary</string>
+ <reference key="sourceIdentifier" ref="299226340"/>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSNumberFormatter</string>
<string key="superclassName">NSFormatter</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -26509,7 +26609,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="685326671">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string>
</object>
@@ -26572,17 +26672,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
- </object>
+ <reference key="sourceIdentifier" ref="457038916"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
- </object>
+ <reference key="sourceIdentifier" ref="299226340"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
@@ -26774,6 +26868,19 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSObjectController</string>
+ <string key="superclassName">NSController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">AppKit.framework/Headers/NSObjectController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSOutlineView</string>
+ <string key="superclassName">NSTableView</string>
+ <reference key="sourceIdentifier" ref="685326671"/>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSPanel</string>
<string key="superclassName">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -26975,6 +27082,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSTreeController</string>
+ <string key="superclassName">NSObjectController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">AppKit.framework/Headers/NSTreeController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSUserDefaultsController</string>
<string key="superclassName">NSController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -27028,6 +27143,18 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSWindowController</string>
+ <string key="superclassName">NSResponder</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">showWindow:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">WebView</string>
<string key="superclassName">NSView</string>
<object class="NSMutableDictionary" key="actions">
diff --git a/Interfaces/English.lproj/UserManagerView.xib b/Interfaces/English.lproj/UserManagerView.xib
index 5e0b1e0a..0325f6d2 100644
--- a/Interfaces/English.lproj/UserManagerView.xib
+++ b/Interfaces/English.lproj/UserManagerView.xib
@@ -3,7 +3,7 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10B504</string>
- <string key="IBDocument.InterfaceBuilderVersion">740</string>
+ <string key="IBDocument.InterfaceBuilderVersion">732</string>
<string key="IBDocument.AppKitVersion">1038.2</string>
<string key="IBDocument.HIToolboxVersion">437.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
@@ -15,18 +15,17 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>740</string>
- <string>1.2.1</string>
+ <string>732</string>
+ <string>1.2.2</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="44"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.brandonwalkin.BWToolkit</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.brandonwalkin.BWToolkit</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -52,14 +51,14 @@
<int key="NSWindowStyleMask">1</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{459, 282}, {752, 506}}</string>
- <int key="NSWTFlags">1677722624</int>
+ <int key="NSWTFlags">1140851712</int>
<string key="NSWindowTitle">User Managment</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<string key="NSWindowContentMinSize">{752, 506}</string>
<object class="NSView" key="NSWindowView" id="846307432">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -148,7 +147,7 @@
<string key="NSColorName">controlBackgroundColor</string>
<object class="NSColor" key="NSColor" id="246134814">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="315534074">
@@ -377,7 +376,6 @@
</object>
</object>
</object>
- <int key="NSSelectedIndex">2</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -1605,8 +1603,8 @@
<reference key="NSSupport" ref="746597359"/>
</object>
</object>
- <int key="NSSelectedRow">1</int>
- <reference key="NSSelectedCell" ref="62674029"/>
+ <int key="NSSelectedRow">-1</int>
+ <int key="NSSelectedCol">-1</int>
<reference key="NSBackgroundColor" ref="409859189"/>
<reference key="NSCellBackgroundColor" ref="888720323"/>
<reference key="NSFont" ref="746597359"/>
@@ -1708,11 +1706,10 @@
</object>
</object>
<string key="NSFrameSize">{752, 506}</string>
- <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{752, 528}</string>
- <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
</object>
<object class="NSTreeController" id="889422316">
<object class="NSMutableArray" key="NSDeclaredKeys">
@@ -4298,11 +4295,11 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{396, 275}, {752, 506}}</string>
+ <string>{{37, 275}, {752, 506}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/>
<boolean value="NO"/>
- <string>{{396, 275}, {752, 506}}</string>
+ <string>{{37, 275}, {752, 506}}</string>
<boolean value="NO"/>
<boolean value="YES"/>
<string>{752, 506}</string>
diff --git a/Source/SPUserManager.h b/Source/SPUserManager.h
index 4af00c6c..4983ac49 100644
--- a/Source/SPUserManager.h
+++ b/Source/SPUserManager.h
@@ -44,13 +44,9 @@
}
@property (nonatomic, retain) MCPConnection *mySqlConnection;
-
-- (NSPersistentStoreCoordinator *)persistentStoreCoordinator;
-- (NSManagedObjectModel *)managedObjectModel;
-- (NSManagedObjectContext *)managedObjectContext;
-
-- (id)initWithConnection:(MCPConnection *)connection;
-- (void)initializeChild:(NSManagedObject *)child withItem:(NSDictionary *)item;
+@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
+@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
+@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;
// Add/Remove Users
- (IBAction)addUser:(id)sender;
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index 40300dda..3978bec8 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -42,6 +42,7 @@
- (NSManagedObject *)_createNewSPUser;
- (BOOL)checkAndDisplayMySqlError;
- (void)_clearData;
+- (void)initializeChild:(NSManagedObject *)child withItem:(NSDictionary *)item;
@end
@@ -49,31 +50,31 @@
@synthesize mySqlConnection;
-/**
- * Initialise the user manager with the supplied connection.
- */
-- (id)initWithConnection:(MCPConnection*) connection
+-(id)init
{
- if ((self = [super initWithWindowNibName:@"UserManagerView"])) {
-
- self.mySqlConnection = connection;
-
+ if ((self = [super initWithWindowNibName:@"UserManagerView"]))
+ {
// 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];
+ @"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];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(contextDidSave:)
+ name:NSManagedObjectContextDidSaveNotification
+ object:nil];
+
}
-
return self;
}
@@ -82,28 +83,22 @@
*/
- (void)dealloc
{
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- [managedObjectContext release], managedObjectContext = nil;
- [persistentStoreCoordinator release], persistentStoreCoordinator = nil;
- [managedObjectModel release], managedObjectModel = nil;
- [privColumnToGrantMap release], privColumnToGrantMap = nil;
- [privsSupportedByServer release], privsSupportedByServer = nil;
-
- [mySqlConnection release], mySqlConnection = nil;
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:NSManagedObjectContextDidSaveNotification
+ object:nil];
+ //[treeController release];
+// [managedObjectContext release];
+// [persistentStoreCoordinator release];
+// [managedObjectModel release];
+ [privColumnToGrantMap release];
+ [mySqlConnection release];
+ //[privsSupportedByServer release];
[super dealloc];
}
-/**
- * Initialise various interface controls.
- */
-- (void)awakeFromNib
-{
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(contextDidSave:)
- name:NSManagedObjectContextDidSaveNotification
- object:nil];
+-(void)windowDidLoad
+{
[tabView selectTabViewItemAtIndex:0];
NSTableColumn *tableColumn = [outlineView tableColumnWithIdentifier:COLUMNIDNAME];
@@ -111,12 +106,17 @@
[imageAndTextCell setEditable:NO];
[tableColumn setDataCell:imageAndTextCell];
-
+
[self _initializeUsers];
+ [super windowDidLoad];
}
- (void)_initializeUsers
{
+ /**
+ * This method reads in the users from the mysql.user table of the current
+ * connection. Then uses this information to initialize the NSOutlineView.
+ */
isInitializing = TRUE;
NSMutableString *privKey;
NSArray *privRow;
@@ -125,6 +125,7 @@
NSMutableArray *resultAsArray = [NSMutableArray array];
NSMutableArray *usersResultArray = [NSMutableArray array];
+ // Select users from the mysql.user table
MCPResult *result = [[self.mySqlConnection queryString:@"SELECT * FROM `mysql`.`user` ORDER BY `user`"] retain];
int rows = [result numOfRows];
if (rows > 0)
@@ -177,13 +178,13 @@
for(int i = 0; i < [items count]; i++)
{
NSString *username = [[items objectAtIndex:i] objectForKey:@"User"];
- NSArray *array = [[self _fetchUserWithUserName:username] retain];
+ NSArray *parentResults = [[self _fetchUserWithUserName:username] retain];
NSDictionary *item = [items objectAtIndex:i];
- if (array != nil && [array count] > 0)
+ if (parentResults != nil && [parentResults count] > 0)
{
// Add Children
- NSManagedObject *parent = [array objectAtIndex:0];
+ NSManagedObject *parent = [parentResults objectAtIndex:0];
NSManagedObject *child = [self _createNewSPUser];
[child setParent:parent];
[parent addChildrenObject:child];
@@ -209,7 +210,7 @@
{
[[NSApplication sharedApplication] presentError:error];
}
- [array release];
+ [parentResults release];
}
[outlineView reloadData];
}
@@ -574,7 +575,7 @@
}
droppedUsers = [[droppedUsers substringToIndex:[droppedUsers length]-2] mutableCopy];
[self.mySqlConnection queryString:[NSString stringWithFormat:@"DROP USER %@", droppedUsers]];
-
+ [droppedUsers release];
return TRUE;
}
@@ -681,8 +682,8 @@
- (NSManagedObject *)_createNewSPUser
{
- NSManagedObject *user = [[NSEntityDescription insertNewObjectForEntityForName:@"SPUser"
- inManagedObjectContext:[self managedObjectContext]] autorelease];
+ NSManagedObject *user = [NSEntityDescription insertNewObjectForEntityForName:@"SPUser"
+ inManagedObjectContext:[self managedObjectContext]];
return user;
}
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 30d44084..414b7d4e 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -54,7 +54,9 @@ enum sp_current_query_mode
IBOutlet id extendedTableInfoInstance;
IBOutlet id databaseDataInstance;
IBOutlet id spHistoryControllerInstance;
- IBOutlet id exportControllerInstance;
+ IBOutlet id exportControllerInstance;
+ IBOutlet SPUserManager *userManagerInstance;
+
IBOutlet NSSearchField *listFilterField;
@@ -119,7 +121,6 @@ enum sp_current_query_mode
int passwordSheetReturnCode;
SPConnectionController *connectionController;
- SPUserManager *userManagerInstance;
MCPConnection *mySQLConnection;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 9b00d82b..6cbccd60 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -260,7 +260,7 @@
NSData *pData = [NSData dataWithContentsOfFile:path options:NSUncachedRead error:&readError];
spf = [[NSPropertyListSerialization propertyListFromData:pData
- mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
+ mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] autorelease];
if(!spf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")]
@@ -484,7 +484,6 @@
[spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"auto_connect"];
[connectionController initiateConnection:self];
}
-
}
/**
@@ -640,11 +639,6 @@
[tableDataInstance setConnection:mySQLConnection];
[extendedTableInfoInstance setConnection:mySQLConnection];
[databaseDataInstance setConnection:mySQLConnection];
-
- if (!userManagerInstance) {
- userManagerInstance = [[SPUserManager alloc] initWithConnection:mySQLConnection];
- }
-
userManagerInstance.mySqlConnection = mySQLConnection;
// Set the cutom query editor's MySQL version
@@ -739,8 +733,7 @@
NSPrintPanel *printPanel = [op printPanel];
[printPanel setOptions:[printPanel options] + NSPrintPanelShowsOrientation + NSPrintPanelShowsScaling + NSPrintPanelShowsPaperSize];
- SPPrintAccessory *printAccessory = [[SPPrintAccessory alloc] init];
- [printAccessory initWithNibName:@"PrintAccessory" bundle:nil];
+ SPPrintAccessory *printAccessory = [[SPPrintAccessory alloc] initWithNibName:@"PrintAccessory" bundle:nil];
[printAccessory setPrintView:printWebView];
[printPanel addAccessoryController:printAccessory];
@@ -2415,6 +2408,7 @@
format:NSPropertyListXMLFormat_v1_0
errorDescription:&err];
+ [spf release];
if(err != nil) {
NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while converting connection data", @"error while converting connection data")]
defaultButton:NSLocalizedString(@"OK", @"OK button")
@@ -3551,7 +3545,6 @@
if (taskDrawTimer) [taskDrawTimer release];
if(queryEditorInitString) [queryEditorInitString release];
if(spfSession) [spfSession release];
- if(userManagerInstance) [userManagerInstance release];
if(spfDocData) [spfDocData release];
if(keyChainID) [keyChainID release];
[super dealloc];