diff options
author | stuconnolly <stuart02@gmail.com> | 2009-10-26 23:56:40 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-10-26 23:56:40 +0000 |
commit | 9e6adb426de189704f0d0fe09b926b286dbb813e (patch) | |
tree | c11c6cd5c89b2daf4bccf0d97156fef2d3db1931 | |
parent | 332c2308514c1c0fe839dd0124d90cd8d24fd9ef (diff) | |
download | sequelpro-9e6adb426de189704f0d0fe09b926b286dbb813e.tar.gz sequelpro-9e6adb426de189704f0d0fe09b926b286dbb813e.tar.bz2 sequelpro-9e6adb426de189704f0d0fe09b926b286dbb813e.zip |
Don't run the add new database sheet modally, thus blocking the main thread. Part of issue #357.
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 156 | ||||
-rw-r--r-- | Source/TableDocument.h | 1 | ||||
-rw-r--r-- | Source/TableDocument.m | 213 | ||||
-rw-r--r-- | Source/TablesList.m | 1 |
4 files changed, 169 insertions, 202 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index b8da8f5b..f31b505c 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -3,7 +3,7 @@ <data> <int key="IBDocument.SystemTarget">1050</int> <string key="IBDocument.SystemVersion">10B504</string> - <string key="IBDocument.InterfaceBuilderVersion">732</string> + <string key="IBDocument.InterfaceBuilderVersion">740</string> <string key="IBDocument.AppKitVersion">1038.2</string> <string key="IBDocument.HIToolboxVersion">437.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> @@ -16,20 +16,20 @@ </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>732</string> - <string>732</string> + <string>740</string> + <string>740</string> <string>1.2.1</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="663"/> + <integer value="557"/> </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.apple.WebKitIBPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -59,10 +59,10 @@ <string key="NSWindowTitle">Connecting...</string> <string key="NSWindowClass">NSWindow</string> <string key="NSViewClass">View</string> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{780, 480}</string> <object class="NSView" key="NSWindowView" id="579726586"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -237,7 +237,7 @@ <string key="NSColorName">controlColor</string> <object class="NSColor" key="NSColor" id="1001122760"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> + <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes> </object> </object> <reference key="NSTextColor" ref="454249633"/> @@ -281,7 +281,6 @@ </object> <string key="NSFrameSize">{212, 26}</string> <reference key="NSSuperview" ref="299440250"/> - <reference key="NSNextKeyView" ref="687169829"/> <reference key="NSDocView" ref="687169829"/> <object class="NSColor" key="NSBGColor" id="1024678221"> <int key="NSColorSpace">6</int> @@ -314,7 +313,6 @@ </object> <string key="NSFrameSize">{212, 26}</string> <reference key="NSSuperview" ref="801427893"/> - <reference key="NSNextKeyView" ref="965350222"/> <int key="NSsFlags">0</int> <reference key="NSVScroller" ref="622721581"/> <reference key="NSHScroller" ref="367421094"/> @@ -412,7 +410,6 @@ </object> <string key="NSFrameSize">{212, 354}</string> <reference key="NSSuperview" ref="233472824"/> - <reference key="NSNextKeyView" ref="251040077"/> <reference key="NSDocView" ref="251040077"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -439,7 +436,6 @@ </object> <string key="NSFrameSize">{212, 354}</string> <reference key="NSSuperview" ref="1017775084"/> - <reference key="NSNextKeyView" ref="73685676"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="693168867"/> <reference key="NSHScroller" ref="656188692"/> @@ -575,7 +571,6 @@ </object> <string key="NSFrameSize">{212, 145}</string> <reference key="NSSuperview" ref="298226231"/> - <reference key="NSNextKeyView" ref="347093764"/> <reference key="NSDocView" ref="347093764"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">6</int> @@ -602,7 +597,6 @@ </object> <string key="NSFrameSize">{212, 145}</string> <reference key="NSSuperview" ref="192579410"/> - <reference key="NSNextKeyView" ref="685057119"/> <int key="NSsFlags">512</int> <reference key="NSVScroller" ref="245346414"/> <reference key="NSHScroller" ref="353686052"/> @@ -2953,29 +2947,6 @@ <object class="NSTextView" id="1055190999"> <reference key="NSNextResponder" ref="1072692119"/> <int key="NSvFlags">6418</int> - <object class="NSMutableSet" key="NSDragTypes"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="set.sortedObjects"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>Apple HTML pasteboard type</string> - <string>Apple PDF pasteboard type</string> - <string>Apple PICT pasteboard type</string> - <string>Apple PNG pasteboard type</string> - <string>Apple URL pasteboard type</string> - <string>CorePasteboardFlavorType 0x6D6F6F76</string> - <string>NSColor pasteboard type</string> - <string>NSFilenamesPboardType</string> - <string>NSStringPboardType</string> - <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> - <string>NeXT RTFD pasteboard type</string> - <string>NeXT Rich Text Format v1.0 pasteboard type</string> - <string>NeXT TIFF v4.0 pasteboard type</string> - <string>NeXT font pasteboard type</string> - <string>NeXT ruler pasteboard type</string> - <string>WebURLsWithTitlesPboardType</string> - <string>public.url</string> - </object> - </object> <string key="NSFrameSize">{688, 14}</string> <reference key="NSSuperview" ref="1072692119"/> <object class="NSTextContainer" key="NSTextContainer" id="326170846"> @@ -3037,7 +3008,6 @@ </object> <string key="NSFrame">{{1, 1}, {688, 155}}</string> <reference key="NSSuperview" ref="71560786"/> - <reference key="NSNextKeyView" ref="1055190999"/> <reference key="NSDocView" ref="1055190999"/> <reference key="NSBGColor" ref="449903125"/> <object class="NSCursor" key="NSCursor" id="32917531"> @@ -3069,7 +3039,6 @@ </object> <string key="NSFrameSize">{690, 157}</string> <reference key="NSSuperview" ref="873437769"/> - <reference key="NSNextKeyView" ref="1072692119"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="413233170"/> <reference key="NSHScroller" ref="783638826"/> @@ -3159,7 +3128,6 @@ </object> <string key="NSFrame">{{1, 17}, {688, 228}}</string> <reference key="NSSuperview" ref="678281118"/> - <reference key="NSNextKeyView" ref="581095761"/> <reference key="NSDocView" ref="581095761"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -3192,7 +3160,6 @@ </object> <string key="NSFrame">{{1, 0}, {688, 17}}</string> <reference key="NSSuperview" ref="678281118"/> - <reference key="NSNextKeyView" ref="1038415606"/> <reference key="NSDocView" ref="1038415606"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -3201,7 +3168,6 @@ </object> <string key="NSFrameSize">{690, 246}</string> <reference key="NSSuperview" ref="345834048"/> - <reference key="NSNextKeyView" ref="90844306"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="472831765"/> <reference key="NSHScroller" ref="851610321"/> @@ -3652,7 +3618,7 @@ </object> <bool key="NSNoAutoenable">YES</bool> </object> - <int key="NSSelectedIndex">1</int> + <int key="NSSelectedIndex">18</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -4866,11 +4832,10 @@ </object> </object> <string key="NSFrameSize">{944, 550}</string> - <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{780, 502}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSFrameAutosaveName"/> </object> <object class="NSWindowTemplate" id="554105051"> @@ -4886,7 +4851,7 @@ <string key="NSWindowContentMaxSize">{292, 112}</string> <string key="NSWindowContentMinSize">{292, 112}</string> <object class="NSView" key="NSWindowView" id="70075497"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -5312,6 +5277,7 @@ </object> </object> <string key="NSFrameSize">{292, 112}</string> + <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{292, 134}</string> @@ -6041,7 +6007,7 @@ <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="329225443"> <nil key="NSNextResponder"/> @@ -6320,7 +6286,7 @@ </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="734744289"> <int key="NSWindowStyleMask">1</int> @@ -6332,7 +6298,7 @@ <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="234287744"> <nil key="NSNextResponder"/> @@ -6488,7 +6454,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="787219800"> <int key="NSWindowStyleMask">1</int> @@ -6498,7 +6464,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowTitle">New Relation</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="842408319"> <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -7099,7 +7065,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSFrameSize">{302, 307}</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="1066802919"> <int key="NSWindowStyleMask">3</int> @@ -7111,7 +7077,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 50}</string> <object class="NSView" key="NSWindowView" id="525490268"> <nil key="NSNextResponder"/> @@ -7231,7 +7197,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{213, 72}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="553728448"> <int key="NSWindowStyleMask">9</int> @@ -7243,7 +7209,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="1052076676"> <nil key="NSNextResponder"/> @@ -7378,7 +7344,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="202784209"> <int key="NSWindowStyleMask">15</int> @@ -7390,7 +7356,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{350, 200}</string> <object class="NSView" key="NSWindowView" id="226131408"> <nil key="NSNextResponder"/> @@ -7694,7 +7660,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{350, 222}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="828950706"> <int key="NSWindowStyleMask">15</int> @@ -7706,7 +7672,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{350, 200}</string> <object class="NSView" key="NSWindowView" id="749598685"> <nil key="NSNextResponder"/> @@ -7908,7 +7874,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{350, 222}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="466147946"> <int key="NSWindowStyleMask">9</int> @@ -7920,7 +7886,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="860968037"> <nil key="NSNextResponder"/> @@ -8069,7 +8035,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="78186995"> <int key="NSWindowStyleMask">31</int> @@ -8079,7 +8045,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowTitle">MySQL Help</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{351, 120}</string> <object class="NSView" key="NSWindowView" id="539508428"> <nil key="NSNextResponder"/> @@ -8473,7 +8439,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string> <string key="NSMinSize">{351, 136}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSFrameAutosaveName">MYSQL_HELP_WINDOW</string> </object> <object class="NSWindowTemplate" id="176945499"> @@ -8486,7 +8452,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{350, 250}</string> <object class="NSView" key="NSWindowView" id="1024486775"> <nil key="NSNextResponder"/> @@ -8877,7 +8843,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{350, 272}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="434046103"> <int key="NSWindowStyleMask">9</int> @@ -9010,7 +8976,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowTitle">Secure Text Input Sheet</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="978976687"> <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -9114,7 +9080,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSFrameSize">{338, 138}</string> </object> <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSCustomView" id="139279766"> <nil key="NSNextResponder"/> @@ -10980,7 +10946,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSColorName">disabledControlTextColor</string> <object class="NSColor" key="NSColor"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes> + <bytes key="NSWhite">MC4zMzMzMzMzNDMzAA</bytes> </object> </object> </object> @@ -11759,22 +11725,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <int key="connectionID">584</int> </object> <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">closeDatabaseSheet:</string> - <reference key="source" ref="427689665"/> - <reference key="destination" ref="875952722"/> - </object> - <int key="connectionID">585</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">closeDatabaseSheet:</string> - <reference key="source" ref="427689665"/> - <reference key="destination" ref="681100483"/> - </object> - <int key="connectionID">586</int> - </object> - <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">tableDocumentInstance</string> <reference key="source" ref="438574515"/> @@ -12656,14 +12606,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">addDatabaseButton</string> - <reference key="source" ref="427689665"/> - <reference key="destination" ref="875952722"/> - </object> - <int key="connectionID">4780</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="839031135"/> <reference key="destination" ref="427689665"/> @@ -15211,6 +15153,30 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <int key="connectionID">6629</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">closePanelSheet:</string> + <reference key="source" ref="427689665"/> + <reference key="destination" ref="681100483"/> + </object> + <int key="connectionID">6632</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">closePanelSheet:</string> + <reference key="source" ref="427689665"/> + <reference key="destination" ref="875952722"/> + </object> + <int key="connectionID">6633</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">addDatabaseButton</string> + <reference key="source" ref="427689665"/> + <reference key="destination" ref="875952722"/> + </object> + <int key="connectionID">6634</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -24798,7 +24764,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">6629</int> + <int key="maxID">6634</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -25605,7 +25571,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>checksumTable:</string> <string>chooseDatabase:</string> <string>chooseEncoding:</string> - <string>closeDatabaseSheet:</string> <string>closeErrorConnectionSheet:</string> <string>closePanelSheet:</string> <string>closePasswordSheet:</string> @@ -25683,7 +25648,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>id</string> <string>id</string> <string>id</string> - <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> diff --git a/Source/TableDocument.h b/Source/TableDocument.h index a6969136..ef941f60 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -176,7 +176,6 @@ enum sp_current_query_mode - (IBAction)setDatabases:(id)sender; - (IBAction)chooseDatabase:(id)sender; - (IBAction)addDatabase:(id)sender; -- (IBAction)closeDatabaseSheet:(id)sender; - (IBAction)removeDatabase:(id)sender; - (IBAction)showMySQLHelp:(id)sender; - (IBAction)saveServerVariables:(id)sender; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index daa8d049..2515dde2 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -60,6 +60,8 @@ @interface TableDocument (PrivateAPI) +- (void)_addDatabase; +- (void)_removeDatabase; - (void)_updateServerVariablesFilterForFilterString:(NSString *)filterString; - (void)_copyServerVariablesToPasteboardIncludingName:(BOOL)name andValue:(BOOL)value; @@ -833,7 +835,6 @@ // Process the template and display the results. NSString *result = [engine processTemplateInFileAtPath:templatePath withVariables:print_data]; - //NSLog(@"result %@", result); return result; } @@ -942,76 +943,15 @@ */ - (IBAction)addDatabase:(id)sender { - int code = 0; - - if (![tablesListInstance selectionShouldChangeInTableView:nil]) { - return; - } + if (![tablesListInstance selectionShouldChangeInTableView:nil]) return; [databaseNameField setStringValue:@""]; [NSApp beginSheet:databaseSheet modalForWindow:tableWindow modalDelegate:self - didEndSelector:nil - contextInfo:nil]; - - code = [NSApp runModalForWindow:databaseSheet]; - - [NSApp endSheet:databaseSheet]; - [databaseSheet orderOut:nil]; - - if (!code) { - (![self database]) ? [chooseDatabaseButton selectItemAtIndex:0] : [chooseDatabaseButton selectItemWithTitle:[self database]]; - return; - } - - // This check is not necessary anymore as the add database button is now only enabled if the name field - // has a length greater than zero. We'll leave it in just in case. - if ([[databaseNameField stringValue] isEqualToString:@""]) { - NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Database must have a name.", @"message of panel when no db name is given")); - return; - } - - NSString *createStatement = [NSString stringWithFormat:@"CREATE DATABASE %@", [[databaseNameField stringValue] backtickQuotedString]]; - - // If there is an encoding selected other than the default we must specify it in CREATE DATABASE statement - if ([databaseEncodingButton indexOfSelectedItem] > 0) { - createStatement = [NSString stringWithFormat:@"%@ DEFAULT CHARACTER SET %@", createStatement, [[self mysqlEncodingFromDisplayEncoding:[databaseEncodingButton title]] backtickQuotedString]]; - } - - // Create the database - [mySQLConnection queryString:createStatement]; - - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { - //error while creating db - NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't create database.\nMySQL said: %@", @"message of panel when creation of db failed"), [mySQLConnection getLastErrorMessage]]); - return; - } - - if (![mySQLConnection selectDB:[databaseNameField stringValue]] ) { //error while selecting new db (is this possible?!) - NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to database %@.\nBe sure that you have the necessary privileges.", @"message of panel when connection to db failed after selecting from popupbutton"), - [databaseNameField stringValue]]); - [self setDatabases:self]; - return; - } - - //select new db - if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil; - selectedDatabase = [[NSString alloc] initWithString:[databaseNameField stringValue]]; - [self setDatabases:self]; - [tablesListInstance setConnection:mySQLConnection]; - [tableDumpInstance setConnection:mySQLConnection]; - - [tableWindow setTitle:[self displaySPName]]; -} - -/** - * closes the add-db sheet and stops modal session - */ -- (IBAction)closeDatabaseSheet:(id)sender -{ - [NSApp stopModalWithCode:[sender tag]]; + didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo:@"addDatabase"]; } /** @@ -1019,11 +959,10 @@ */ - (IBAction)removeDatabase:(id)sender { - if ([chooseDatabaseButton indexOfSelectedItem] == 0) - return; + // No database selected, bail + if ([chooseDatabaseButton indexOfSelectedItem] == 0) return; - if (![tablesListInstance selectionShouldChangeInTableView:nil]) - return; + if (![tablesListInstance selectionShouldChangeInTableView:nil]) return; NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete database '%@'?", @"delete database message"), [self database]] defaultButton:NSLocalizedString(@"Delete", @"delete button") @@ -1039,10 +978,10 @@ [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removedatabase"]; + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removeDatabase"]; } -/* +/** * Returns an array of all available database names */ - (NSArray *)allDatabaseNames @@ -1051,39 +990,28 @@ } /** - * alert sheets method - * invoked when alertSheet get closed - * if contextInfo == removedatabase -> tries to remove the selected database + * Alert sheet method. Invoked when an alert sheet is dismissed. + * + * if contextInfo == removeDatabase -> Remove the selected database + * if contextInfo == addDatabase -> Add a new database */ - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo { - if ([contextInfo isEqualToString:@"removedatabase"]) { - if (returnCode != NSAlertDefaultReturn) - return; - - [mySQLConnection queryString:[NSString stringWithFormat:@"DROP DATABASE %@", [[self database] backtickQuotedString]]]; - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { - // error while deleting db - [self performSelector:@selector(showErrorSheetWith:) - withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"), - [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove database.\nMySQL said: %@", @"message of panel when removing db failed"), - [mySQLConnection getLastErrorMessage]], - nil] - afterDelay:0.3]; - return; + // Remove the current database + if ([contextInfo isEqualToString:@"removeDatabase"]) { + if (returnCode == NSAlertDefaultReturn) { + [self _removeDatabase]; + } + } + // Add a new database + else if ([contextInfo isEqualToString:@"addDatabase"]) { + if (returnCode == NSOKButton) { + [self _addDatabase]; } - - // db deleted with success - if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil; - [self setDatabases:self]; - [tablesListInstance setConnection:mySQLConnection]; - [tableDumpInstance setConnection:mySQLConnection]; - - [tableWindow setTitle:[self displaySPName]]; } } -/* +/** * Show Error sheet (can be called from inside of a endSheet selector) * via [self performSelector:@selector(showErrorSheetWithTitle:) withObject: afterDelay:] */ @@ -1095,11 +1023,10 @@ [error objectAtIndex:1]); } - -/* +/** * Reset the current selected database name */ -- (void) refreshCurrentDatabase +- (void)refreshCurrentDatabase { NSString *dbName; @@ -1130,7 +1057,6 @@ //query finished [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self]; - } #pragma mark - @@ -2476,7 +2402,6 @@ // For dispatching later if(![[spf objectForKey:@"format"] isEqualToString:@"connection"]) { NSLog(@"SPF file format is not 'connection'."); - // [self close]; return NO; } @@ -2658,8 +2583,6 @@ [spfdata setObject:[encryptdata dataEncryptedWithPassword:[spfDocData_temp objectForKey:@"e_string"]] forKey:@"data"]; } - // NSLog(@"%@", spfdata); - NSString *err = nil; NSData *plist = [NSPropertyListSerialization dataFromPropertyList:spfdata format:NSPropertyListXMLFormat_v1_0 @@ -3632,6 +3555,88 @@ @implementation TableDocument (PrivateAPI) /** + * Adds a new database. + */ +- (void)_addDatabase +{ + // This check is not necessary anymore as the add database button is now only enabled if the name field + // has a length greater than zero. We'll leave it in just in case. + if ([[databaseNameField stringValue] isEqualToString:@""]) { + NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Database must have a name.", @"message of panel when no db name is given")); + return; + } + + NSString *createStatement = [NSString stringWithFormat:@"CREATE DATABASE %@", [[databaseNameField stringValue] backtickQuotedString]]; + + // If there is an encoding selected other than the default we must specify it in CREATE DATABASE statement + if ([databaseEncodingButton indexOfSelectedItem] > 0) { + createStatement = [NSString stringWithFormat:@"%@ DEFAULT CHARACTER SET %@", createStatement, [[self mysqlEncodingFromDisplayEncoding:[databaseEncodingButton title]] backtickQuotedString]]; + } + + // Create the database + [mySQLConnection queryString:createStatement]; + + if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + // An error occurred + NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't create database.\nMySQL said: %@", @"message of panel when creation of db failed"), [mySQLConnection getLastErrorMessage]]); + + return; + } + + // Error while selecting the new database (is this even possible?) + if (![mySQLConnection selectDB:[databaseNameField stringValue]] ) { + NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to database %@.\nBe sure that you have the necessary privileges.", @"message of panel when connection to db failed after selecting from popupbutton"), [databaseNameField stringValue]]); + + [self setDatabases:self]; + + return; + } + + // Select the new database + if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil; + + + selectedDatabase = [[NSString alloc] initWithString:[databaseNameField stringValue]]; + [self setDatabases:self]; + + [tablesListInstance setConnection:mySQLConnection]; + [tableDumpInstance setConnection:mySQLConnection]; + + [tableWindow setTitle:[self displaySPName]]; +} + +/** + * Removes the current database. + */ +- (void)_removeDatabase +{ + // Drop the database from the server + [mySQLConnection queryString:[NSString stringWithFormat:@"DROP DATABASE %@", [[self database] backtickQuotedString]]]; + + if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + // An error occurred + [self performSelector:@selector(showErrorSheetWith:) + withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"), + [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove database.\nMySQL said: %@", @"message of panel when removing db failed"), + [mySQLConnection getLastErrorMessage]], + nil] + afterDelay:0.3]; + + return; + } + + // Delete was successful + if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil; + + [self setDatabases:self]; + + [tablesListInstance setConnection:mySQLConnection]; + [tableDumpInstance setConnection:mySQLConnection]; + + [tableWindow setTitle:[self displaySPName]]; +} + +/** * Filter the displayed server variables by matching the variable name and value against the * filter string. */ diff --git a/Source/TablesList.m b/Source/TablesList.m index b5ddb0af..2d56938d 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -496,7 +496,6 @@ */ - (void)sheetDidEnd:(id)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo { - // Order out current sheet to suppress overlapping of sheets if([sheet respondsToSelector:@selector(orderOut:)]) [sheet orderOut:nil]; |