aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-04-10 18:16:25 +0000
committerBibiko <bibiko@eva.mpg.de>2010-04-10 18:16:25 +0000
commit1bf7220ca576a3c09b9d9e53e24e0c6f30f15850 (patch)
tree1e9981cbf9585cbc008182edb30f8be6a4f7b979
parent3b59093cd3d5be30a809bdc6bb9f3ba63c9ce275 (diff)
downloadsequelpro-1bf7220ca576a3c09b9d9e53e24e0c6f30f15850.tar.gz
sequelpro-1bf7220ca576a3c09b9d9e53e24e0c6f30f15850.tar.bz2
sequelpro-1bf7220ca576a3c09b9d9e53e24e0c6f30f15850.zip
• added "Import from Clipboard" ⌥⇧⌘I
- sheet showing the first 4kB of pasteboard content and the SQL/CSV accessory view - pasteboard content will be saved as temp file and read by using the current table/connection encoding
-rw-r--r--Interfaces/English.lproj/ImportAccessory.xib476
-rw-r--r--Interfaces/English.lproj/MainMenu.xib277
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPFieldMapperController.m13
-rw-r--r--Source/TableDocument.h1
-rw-r--r--Source/TableDocument.m18
-rw-r--r--Source/TableDump.h7
-rw-r--r--Source/TableDump.m136
9 files changed, 883 insertions, 47 deletions
diff --git a/Interfaces/English.lproj/ImportAccessory.xib b/Interfaces/English.lproj/ImportAccessory.xib
index dfb6d7e8..ac831371 100644
--- a/Interfaces/English.lproj/ImportAccessory.xib
+++ b/Interfaces/English.lproj/ImportAccessory.xib
@@ -2,17 +2,18 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10B504</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038.2</string>
- <string key="IBDocument.HIToolboxVersion">437.00</string>
+ <string key="IBDocument.SystemVersion">10D573</string>
+ <string key="IBDocument.InterfaceBuilderVersion">740</string>
+ <string key="IBDocument.AppKitVersion">1038.29</string>
+ <string key="IBDocument.HIToolboxVersion">460.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">732</string>
+ <string key="NS.object.0">740</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="4"/>
+ <integer value="1"/>
+ <integer value="91"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -106,7 +107,7 @@
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
- <object class="NSColor" key="NSColor">
+ <object class="NSColor" key="NSColor" id="847759587">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
@@ -162,7 +163,7 @@
<string key="NSColorName">controlBackgroundColor</string>
<object class="NSColor" key="NSColor" id="210193283">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
</object>
</object>
<reference key="NSTextColor" ref="107914506"/>
@@ -633,6 +634,260 @@
<object class="NSUserDefaultsController" id="71396687">
<bool key="NSSharedInstance">YES</bool>
</object>
+ <object class="NSWindowTemplate" id="951794958">
+ <int key="NSWindowStyleMask">15</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{131, 75}, {500, 353}}</string>
+ <int key="NSWTFlags">1954022400</int>
+ <string key="NSWindowTitle">Window</string>
+ <string key="NSWindowClass">NSWindow</string>
+ <nil key="NSViewClass"/>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSWindowContentMinSize">{500, 353}</string>
+ <object class="NSView" key="NSWindowView" id="544284300">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSScrollView" id="622997883">
+ <reference key="NSNextResponder" ref="544284300"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSClipView" id="51216656">
+ <reference key="NSNextResponder" ref="622997883"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTextView" id="770071618">
+ <reference key="NSNextResponder" ref="51216656"/>
+ <int key="NSvFlags">2322</int>
+ <string key="NSFrameSize">{500, 29}</string>
+ <reference key="NSSuperview" ref="51216656"/>
+ <object class="NSTextContainer" key="NSTextContainer" id="243631584">
+ <object class="NSLayoutManager" key="NSLayoutManager">
+ <object class="NSTextStorage" key="NSTextStorage">
+ <object class="NSMutableString" key="NSString">
+ <characters key="NS.bytes"/>
+ </object>
+ <nil key="NSDelegate"/>
+ </object>
+ <object class="NSMutableArray" key="NSTextContainers">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="243631584"/>
+ </object>
+ <int key="NSLMFlags">134</int>
+ <nil key="NSDelegate"/>
+ </object>
+ <reference key="NSTextView" ref="770071618"/>
+ <double key="NSWidth">500</double>
+ <int key="NSTCFlags">1</int>
+ </object>
+ <object class="NSTextViewSharedData" key="NSSharedData">
+ <int key="NSFlags">2305</int>
+ <int key="NSTextCheckingTypes">0</int>
+ <nil key="NSMarkedAttributes"/>
+ <reference key="NSBackgroundColor" ref="51181249"/>
+ <object class="NSDictionary" key="NSSelectedAttributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSBackgroundColor</string>
+ <string>NSColor</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">selectedTextBackgroundColor</string>
+ <reference key="NSColor" ref="210193283"/>
+ </object>
+ <object class="NSColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">selectedTextColor</string>
+ <reference key="NSColor" ref="847759587"/>
+ </object>
+ </object>
+ </object>
+ <reference key="NSInsertionColor" ref="847759587"/>
+ <object class="NSDictionary" key="NSLinkAttributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSColor</string>
+ <string>NSCursor</string>
+ <string>NSUnderline</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDEAA</bytes>
+ </object>
+ <object class="NSCursor">
+ <string key="NSHotSpot">{8, -8}</string>
+ <int key="NSCursorType">13</int>
+ </object>
+ <integer value="1"/>
+ </object>
+ </object>
+ <nil key="NSDefaultParagraphStyle"/>
+ </object>
+ <int key="NSTVFlags">6</int>
+ <string key="NSMaxSize">{1002, 1e+07}</string>
+ <string key="NSMinize">{223, 0}</string>
+ <nil key="NSDelegate"/>
+ </object>
+ </object>
+ <string key="NSFrame">{{1, 1}, {500, 124}}</string>
+ <reference key="NSSuperview" ref="622997883"/>
+ <reference key="NSNextKeyView" ref="770071618"/>
+ <reference key="NSDocView" ref="770071618"/>
+ <reference key="NSBGColor" ref="51181249"/>
+ <object class="NSCursor" key="NSCursor">
+ <string key="NSHotSpot">{4, -5}</string>
+ <int key="NSCursorType">1</int>
+ </object>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="177496810">
+ <reference key="NSNextResponder" ref="622997883"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{486, 1}, {15, 109}}</string>
+ <reference key="NSSuperview" ref="622997883"/>
+ <reference key="NSTarget" ref="622997883"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">0.99248123168945312</double>
+ </object>
+ <object class="NSScroller" id="268141998">
+ <reference key="NSNextResponder" ref="622997883"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{1, 110}, {485, 15}}</string>
+ <reference key="NSSuperview" ref="622997883"/>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="622997883"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1</double>
+ <double key="NSPercent">0.94565218687057495</double>
+ </object>
+ </object>
+ <string key="NSFrame">{{-1, 195}, {502, 126}}</string>
+ <reference key="NSSuperview" ref="544284300"/>
+ <reference key="NSNextKeyView" ref="51216656"/>
+ <int key="NSsFlags">562</int>
+ <reference key="NSVScroller" ref="177496810"/>
+ <reference key="NSHScroller" ref="268141998"/>
+ <reference key="NSContentView" ref="51216656"/>
+ </object>
+ <object class="NSButton" id="762525145">
+ <reference key="NSNextResponder" ref="544284300"/>
+ <int key="NSvFlags">289</int>
+ <string key="NSFrame">{{322, 7}, {82, 32}}</string>
+ <reference key="NSSuperview" ref="544284300"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="77256603">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">Cancel</string>
+ <reference key="NSSupport" ref="857116476"/>
+ <reference key="NSControlView" ref="762525145"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="660428801">
+ <reference key="NSNextResponder" ref="544284300"/>
+ <int key="NSvFlags">289</int>
+ <string key="NSFrame">{{404, 7}, {82, 32}}</string>
+ <reference key="NSSuperview" ref="544284300"/>
+ <int key="NSTag">1</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="437878340">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">Open</string>
+ <reference key="NSSupport" ref="857116476"/>
+ <reference key="NSControlView" ref="660428801"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSBox" id="603820420">
+ <reference key="NSNextResponder" ref="544284300"/>
+ <int key="NSvFlags">34</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSView" id="763529399">
+ <reference key="NSNextResponder" ref="603820420"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomView" id="393007690">
+ <reference key="NSNextResponder" ref="763529399"/>
+ <int key="NSvFlags">301</int>
+ <string key="NSFrame">{{18, 6}, {448, 134}}</string>
+ <reference key="NSSuperview" ref="763529399"/>
+ <string key="NSClassName">NSView</string>
+ </object>
+ </object>
+ <string key="NSFrame">{{1, 1}, {484, 143}}</string>
+ <reference key="NSSuperview" ref="603820420"/>
+ </object>
+ </object>
+ <string key="NSFrame">{{7, 44}, {486, 145}}</string>
+ <reference key="NSSuperview" ref="544284300"/>
+ <string key="NSOffsets">{0, 0}</string>
+ <object class="NSTextFieldCell" key="NSTitleCell">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Box</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="989602568"/>
+ <object class="NSColor" key="NSTextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes>
+ </object>
+ </object>
+ <reference key="NSContentView" ref="763529399"/>
+ <int key="NSBorderType">1</int>
+ <int key="NSBoxType">0</int>
+ <int key="NSTitlePosition">0</int>
+ <bool key="NSTransparent">NO</bool>
+ </object>
+ <object class="NSTextField" id="234640380">
+ <reference key="NSNextResponder" ref="544284300"/>
+ <int key="NSvFlags">269</int>
+ <string key="NSFrame">{{175, 329}, {146.219, 17}}</string>
+ <reference key="NSSuperview" ref="544284300"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="467652780">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Import from Clipboard</string>
+ <reference key="NSSupport" ref="857116476"/>
+ <reference key="NSControlView" ref="234640380"/>
+ <reference key="NSBackgroundColor" ref="1043422119"/>
+ <reference key="NSTextColor" ref="107914506"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{500, 353}</string>
+ <reference key="NSSuperview"/>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
+ <string key="NSMinSize">{500, 375}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -749,6 +1004,46 @@
</object>
<int key="connectionID">57</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">closeSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="762525145"/>
+ </object>
+ <int key="connectionID">98</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">closeSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="660428801"/>
+ </object>
+ <int key="connectionID">99</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">importFromClipboardSheet</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="951794958"/>
+ </object>
+ <int key="connectionID">100</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">importFromClipboardTextView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="770071618"/>
+ </object>
+ <int key="connectionID">101</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">importFromClipboardAccessoryView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="393007690"/>
+ </object>
+ <int key="connectionID">102</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -989,6 +1284,111 @@
<reference key="object" ref="71396687"/>
<reference key="parent" ref="0"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">85</int>
+ <reference key="object" ref="951794958"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="544284300"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Import from Clipboard</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">86</int>
+ <reference key="object" ref="544284300"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="622997883"/>
+ <reference ref="603820420"/>
+ <reference ref="660428801"/>
+ <reference ref="762525145"/>
+ <reference ref="234640380"/>
+ </object>
+ <reference key="parent" ref="951794958"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">91</int>
+ <reference key="object" ref="622997883"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="177496810"/>
+ <reference ref="268141998"/>
+ <reference ref="770071618"/>
+ </object>
+ <reference key="parent" ref="544284300"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">94</int>
+ <reference key="object" ref="177496810"/>
+ <reference key="parent" ref="622997883"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">93</int>
+ <reference key="object" ref="268141998"/>
+ <reference key="parent" ref="622997883"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">92</int>
+ <reference key="object" ref="770071618"/>
+ <reference key="parent" ref="622997883"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">90</int>
+ <reference key="object" ref="762525145"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="77256603"/>
+ </object>
+ <reference key="parent" ref="544284300"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">95</int>
+ <reference key="object" ref="77256603"/>
+ <reference key="parent" ref="762525145"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">88</int>
+ <reference key="object" ref="660428801"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="437878340"/>
+ </object>
+ <reference key="parent" ref="544284300"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">97</int>
+ <reference key="object" ref="437878340"/>
+ <reference key="parent" ref="660428801"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">89</int>
+ <reference key="object" ref="603820420"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="393007690"/>
+ </object>
+ <reference key="parent" ref="544284300"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">96</int>
+ <reference key="object" ref="393007690"/>
+ <reference key="parent" ref="603820420"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">103</int>
+ <reference key="object" ref="234640380"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="467652780"/>
+ </object>
+ <reference key="parent" ref="544284300"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">104</int>
+ <reference key="object" ref="467652780"/>
+ <reference key="parent" ref="234640380"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -1001,6 +1401,8 @@
<string>1.ImportedFromIB2</string>
<string>10.IBPluginDependency</string>
<string>10.ImportedFromIB2</string>
+ <string>103.IBPluginDependency</string>
+ <string>104.IBPluginDependency</string>
<string>11.IBAttributePlaceholdersKey</string>
<string>11.IBPluginDependency</string>
<string>11.ImportedFromIB2</string>
@@ -1037,18 +1439,37 @@
<string>8.IBAttributePlaceholdersKey</string>
<string>8.IBPluginDependency</string>
<string>8.ImportedFromIB2</string>
+ <string>85.IBEditorWindowLastContentRect</string>
+ <string>85.IBPluginDependency</string>
+ <string>85.IBWindowTemplateEditedContentRect</string>
+ <string>85.NSWindowTemplate.visibleAtLaunch</string>
+ <string>85.windowTemplate.hasMinSize</string>
+ <string>85.windowTemplate.minSize</string>
+ <string>86.IBPluginDependency</string>
+ <string>88.IBPluginDependency</string>
+ <string>89.IBPluginDependency</string>
<string>9.IBAttributePlaceholdersKey</string>
<string>9.IBPluginDependency</string>
<string>9.ImportedFromIB2</string>
+ <string>90.IBPluginDependency</string>
+ <string>91.IBPluginDependency</string>
+ <string>92.IBPluginDependency</string>
+ <string>93.IBPluginDependency</string>
+ <string>94.IBPluginDependency</string>
+ <string>95.IBPluginDependency</string>
+ <string>96.IBPluginDependency</string>
+ <string>97.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{107, 435}, {417, 135}}</string>
+ <string>{{583, 146}, {417, 135}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
@@ -1106,6 +1527,15 @@
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
+ <string>{{674, 272}, {500, 353}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{674, 272}, {500, 353}}</string>
+ <boolean value="NO"/>
+ <boolean value="YES"/>
+ <string>{500, 353}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
@@ -1116,6 +1546,14 @@
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -1134,7 +1572,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">57</int>
+ <int key="maxID">104</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
@@ -1148,12 +1586,10 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>cancelProgressBar:</string>
<string>changeFormat:</string>
- <string>changeTable:</string>
<string>closeSheet:</string>
<string>panelSelectionDidChange:</string>
<string>reloadTables:</string>
<string>selectTables:</string>
- <string>stepRow:</string>
<string>switchInput:</string>
<string>switchTab:</string>
</object>
@@ -1167,8 +1603,6 @@
<string>id</string>
<string>id</string>
<string>id</string>
- <string>id</string>
- <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -1204,22 +1638,20 @@
<string>exportTableList</string>
<string>exportToolbar</string>
<string>exportWindow</string>
- <string>fieldMappingPopup</string>
- <string>fieldMappingSheet</string>
- <string>fieldMappingTableView</string>
<string>importCSVBox</string>
<string>importCSVView</string>
+ <string>importFieldMapperSheetWindow</string>
<string>importFieldNamesSwitch</string>
<string>importFieldsEnclosedField</string>
<string>importFieldsEscapedField</string>
<string>importFieldsTerminatedField</string>
<string>importFormatPopup</string>
+ <string>importFromClipboardAccessoryView</string>
+ <string>importFromClipboardSheet</string>
+ <string>importFromClipboardTextView</string>
<string>importLinesTerminatedField</string>
<string>multiCSVFullStreamingSwitch</string>
<string>multiXMLFullStreamingSwitch</string>
- <string>recordCountLabel</string>
- <string>rowDownButton</string>
- <string>rowUpButton</string>
<string>singleProgressBar</string>
<string>singleProgressSheet</string>
<string>singleProgressText</string>
@@ -1270,12 +1702,10 @@
<string>id</string>
<string>id</string>
<string>id</string>
- <string>id</string>
- <string>id</string>
<string>NSPopUpButton</string>
<string>id</string>
<string>id</string>
- <string>id</string>
+ <string>NSTextView</string>
<string>id</string>
<string>id</string>
<string>id</string>
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib
index 21153309..f4361457 100644
--- a/Interfaces/English.lproj/MainMenu.xib
+++ b/Interfaces/English.lproj/MainMenu.xib
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="498"/>
+ <integer value="81"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -373,6 +373,17 @@
<reference key="NSMixedImage" ref="315854375"/>
<int key="NSTag">1007</int>
</object>
+ <object class="NSMenuItem" id="853409386">
+ <reference key="NSMenu" ref="709725194"/>
+ <bool key="NSIsAlternate">YES</bool>
+ <string key="NSTitle">Import from Clipboard…</string>
+ <string key="NSKeyEquiv">I</string>
+ <int key="NSKeyEquivModMask">1572864</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ <int key="NSTag">1101</int>
+ </object>
<object class="NSMenuItem" id="934534577">
<reference key="NSMenu" ref="709725194"/>
<bool key="NSIsDisabled">YES</bool>
@@ -2951,6 +2962,14 @@
</object>
<int key="connectionID">1051</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">importFromClipboard:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="853409386"/>
+ </object>
+ <int key="connectionID">1072</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -3171,6 +3190,7 @@
<reference ref="949877576"/>
<reference ref="276532848"/>
<reference ref="390057667"/>
+ <reference ref="853409386"/>
</object>
<reference key="parent" ref="86447006"/>
</object>
@@ -4358,6 +4378,11 @@
<reference key="object" ref="486174990"/>
<reference key="parent" ref="466354362"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1071</int>
+ <reference key="object" ref="853409386"/>
+ <reference key="parent" ref="709725194"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -4391,6 +4416,7 @@
<string>106.ImportedFromIB2</string>
<string>106.editorWindowContentRectSynchronizationRect</string>
<string>1061.IBPluginDependency</string>
+ <string>1071.IBPluginDependency</string>
<string>111.IBPluginDependency</string>
<string>111.ImportedFromIB2</string>
<string>129.IBPluginDependency</string>
@@ -4760,6 +4786,7 @@
<string>{{561, 605}, {181, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
@@ -4838,7 +4865,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{449, 1007}, {197, 53}}</string>
- <string>{{38, 903}, {511, 20}}</string>
+ <string>{{230, 474}, {511, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{506, 836}, {511, 20}}</string>
@@ -4848,7 +4875,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{667, 147}, {210, 133}}</string>
+ <string>{{394, 353}, {210, 133}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{399, 465}, {213, 93}}</string>
@@ -4891,7 +4918,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{230, 610}, {251, 293}}</string>
+ <string>{{235, 443}, {251, 293}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{698, 703}, {184, 133}}</string>
@@ -5013,7 +5040,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{428, 491}, {235, 333}}</string>
+ <string>{{336, 121}, {273, 353}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{180, 535}, {182, 253}}</string>
@@ -5164,7 +5191,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">1070</int>
+ <int key="maxID">1072</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -6100,6 +6127,244 @@
</object>
<reference key="sourceIdentifier" ref="939419192"/>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">TableDocument</string>
+ <string key="superclassName">NSDocument</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>addConnectionToFavorites:</string>
+ <string>addDatabase:</string>
+ <string>analyzeTable:</string>
+ <string>backForwardInHistory:</string>
+ <string>cancelTask:</string>
+ <string>checkTable:</string>
+ <string>checksumTable:</string>
+ <string>chooseDatabase:</string>
+ <string>chooseEncoding:</string>
+ <string>closePanelSheet:</string>
+ <string>closePasswordSheet:</string>
+ <string>closeSheet:</string>
+ <string>copyChecksumFromSheet:</string>
+ <string>copyCreateTableSyntax:</string>
+ <string>copyCreateTableSyntaxFromSheet:</string>
+ <string>export:</string>
+ <string>exportMultipleTables:</string>
+ <string>exportTable:</string>
+ <string>flushPrivileges:</string>
+ <string>flushTable:</string>
+ <string>focusOnTableContentFilter:</string>
+ <string>focusOnTableListFilter:</string>
+ <string>import:</string>
+ <string>importFromClipboard:</string>
+ <string>openCurrentConnectionInNewWindow:</string>
+ <string>optimizeTable:</string>
+ <string>removeDatabase:</string>
+ <string>repairTable:</string>
+ <string>saveConnectionSheet:</string>
+ <string>saveCreateSyntax:</string>
+ <string>setDatabases:</string>
+ <string>showConsole:</string>
+ <string>showCreateTableSyntax:</string>
+ <string>showMySQLHelp:</string>
+ <string>showNavigator:</string>
+ <string>showServerProcesses:</string>
+ <string>showServerVariables:</string>
+ <string>showUserManager:</string>
+ <string>toggleNavigator:</string>
+ <string>validateSaveConnectionAccessory:</string>
+ <string>viewContent:</string>
+ <string>viewQuery:</string>
+ <string>viewRelations:</string>
+ <string>viewStatus:</string>
+ <string>viewStructure:</string>
+ <string>viewTriggers:</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>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <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>addDatabaseButton</string>
+ <string>chooseDatabaseButton</string>
+ <string>connectionErrorDialog</string>
+ <string>contentViewSplitter</string>
+ <string>createTableSyntaxTextField</string>
+ <string>createTableSyntaxTextView</string>
+ <string>createTableSyntaxWindow</string>
+ <string>customQueryInstance</string>
+ <string>customQueryTextView</string>
+ <string>databaseDataInstance</string>
+ <string>databaseEncodingButton</string>
+ <string>databaseNameField</string>
+ <string>databaseSheet</string>
+ <string>dbTablesTableView</string>
+ <string>encodingPopUp</string>
+ <string>exportControllerInstance</string>
+ <string>extendedTableInfoInstance</string>
+ <string>favoritesButton</string>
+ <string>historyControl</string>
+ <string>inputTextWindow</string>
+ <string>inputTextWindowHeader</string>
+ <string>inputTextWindowMessage</string>
+ <string>inputTextWindowSecureTextField</string>
+ <string>listFilterField</string>
+ <string>queryProgressBar</string>
+ <string>saveConnectionAccessory</string>
+ <string>saveConnectionAutoConnect</string>
+ <string>saveConnectionEncrypt</string>
+ <string>saveConnectionEncryptString</string>
+ <string>saveConnectionIncludeData</string>
+ <string>saveConnectionIncludeQuery</string>
+ <string>saveConnectionSavePassword</string>
+ <string>saveConnectionSavePasswordAlert</string>
+ <string>sidebarGrabber</string>
+ <string>spHistoryControllerInstance</string>
+ <string>statusTableAccessoryView</string>
+ <string>statusTableCopyChecksum</string>
+ <string>statusTableView</string>
+ <string>statusValues</string>
+ <string>tableContentInstance</string>
+ <string>tableDataInstance</string>
+ <string>tableDumpInstance</string>
+ <string>tableInfoCollapseButton</string>
+ <string>tableInfoTable</string>
+ <string>tableListSplitter</string>
+ <string>tableRelationsInstance</string>
+ <string>tableSourceInstance</string>
+ <string>tableTabView</string>
+ <string>tableTriggersInstance</string>
+ <string>tableWindow</string>
+ <string>tablesListInstance</string>
+ <string>taskCancelButton</string>
+ <string>taskCancellationCallbackObject</string>
+ <string>taskDescriptionText</string>
+ <string>taskProgressIndicator</string>
+ <string>taskProgressLayer</string>
+ <string>titleAccessoryView</string>
+ <string>titleImageView</string>
+ <string>titleStringView</string>
+ <string>userManagerInstance</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>NSWindow</string>
+ <string>NSSplitView</string>
+ <string>NSTextField</string>
+ <string>NSTextView</string>
+ <string>NSWindow</string>
+ <string>id</string>
+ <string>NSTextView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTableView</string>
+ <string>NSPopUpButton</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSSearchField</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSSecureTextField</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSButton</string>
+ <string>NSTableView</string>
+ <string>NSSplitView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTabView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSButton</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSBox</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>SPUserManager</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../Source/TableDocument.h</string>
+ </object>
+ </object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index b7241136..e6574f31 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -230,6 +230,7 @@ extern NSString *SPCSVImportFieldEnclosedBy;
extern NSString *SPCSVImportFieldEscapeCharacter;
extern NSString *SPCSVImportFirstLineIsHeader;
extern NSString *SPCSVFieldImportMappingAlignment;
+extern NSString *SPImportClipboardTempFileNamePrefix;
// Misc
extern NSString *SPContentFilters;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 8a2729e8..f0d12e51 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -144,6 +144,7 @@ NSString *SPCSVImportFieldTerminator = @"CSVImportFieldTerminator";
NSString *SPCSVImportFirstLineIsHeader = @"CSVImportFirstLineIsHeader";
NSString *SPCSVImportLineTerminator = @"CSVImportLineTerminator";
NSString *SPCSVFieldImportMappingAlignment = @"CSVFieldImportMappingAlignment";
+NSString *SPImportClipboardTempFileNamePrefix = @"/tmp/_SP_ClipBoard_Import_File_";
// Misc
NSString *SPContentFilters = @"ContentFilters";
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index ae935b44..a3d17f1c 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -82,8 +82,13 @@
{
// Set source path
- [fileSourcePath setURL:[NSURL fileURLWithPath:sourcePath]];
+ if([sourcePath hasPrefix:SPImportClipboardTempFileNamePrefix]) {
+ [fileSourcePath setURL:[NSURL fileURLWithPath:NSLocalizedString(@"Clipboard", @"Clipboard")]];
+ } else {
+ [fileSourcePath setURL:[NSURL fileURLWithPath:sourcePath]];
+ }
[fileSourcePath setDoubleAction:@selector(goBackToFileChooser:)];
+
[onupdateTextView setDelegate:theDelegate];
windowMinWidth = [[self window] minSize].width;
windowMinHeigth = [[self window] minSize].height;
@@ -541,7 +546,11 @@
- (IBAction)goBackToFileChooser:(id)sender
{
[NSApp endSheet:[self window] returnCode:[sender tag]];
- [theDelegate importFile];
+ if([sourcePath hasPrefix:SPImportClipboardTempFileNamePrefix]) {
+ [theDelegate importFromClipboard];
+ } else {
+ [theDelegate importFile];
+ }
}
#pragma mark -
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 5f173f9d..e3598c18 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -275,6 +275,7 @@
- (BOOL)validateMenuItem:(NSMenuItem *)anItem;
- (IBAction)saveConnectionSheet:(id)sender;
- (IBAction)import:(id)sender;
+- (IBAction)importFromClipboard:(id)sender;
- (IBAction)export:(id)sender;
- (IBAction)exportTable:(id)sender;
- (IBAction)exportMultipleTables:(id)sender;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index ab8a7ac5..3e442d6e 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1684,7 +1684,7 @@
}
[createTableSyntaxTextField setStringValue:[NSString stringWithFormat:@"Create syntax for %@ '%@'", typeString, [self table]]];
-
+
[createTableSyntaxTextView setEditable:YES];
[createTableSyntaxTextView setString:@""];
[createTableSyntaxTextView insertText:([tablesListInstance tableType] == SPTableTypeView) ? [[tableSyntax createViewSyntaxPrettifier] stringByAppendingString:@";"] : [tableSyntax stringByAppendingString:@";"]];
@@ -3025,6 +3025,14 @@
/**
* Passes the request to the tableDump object
*/
+- (IBAction)importFromClipboard:(id)sender
+{
+ [tableDumpInstance importFromClipboard];
+}
+
+/**
+ * Passes the request to the tableDump object
+ */
- (IBAction)export:(id)sender
{
if ([sender tag] == -1) {
@@ -3086,7 +3094,13 @@
{
return ([self database] != nil);
}
-
+
+ if ([menuItem action] == @selector(importFromClipboard:))
+ {
+ return ([[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:NSStringPboardType, nil]]) ? YES : NO;
+
+ }
+
// Change "Save Query/Queries" menu item title dynamically
// and disable it if no query in the editor
if ([menuItem action] == @selector(saveConnectionSheet:) && [menuItem tag] == 0) {
diff --git a/Source/TableDump.h b/Source/TableDump.h
index 6a6a34b0..af621f68 100644
--- a/Source/TableDump.h
+++ b/Source/TableDump.h
@@ -74,6 +74,10 @@
IBOutlet id importLinesTerminatedField;
IBOutlet id importFieldMapperSheetWindow;
+ IBOutlet id importFromClipboardSheet;
+ IBOutlet NSTextView *importFromClipboardTextView;
+ IBOutlet id importFromClipboardAccessoryView;
+
IBOutlet id addDropTableSwitch;
IBOutlet id addCreateTableSwitch;
IBOutlet id addTableContentSwitch;
@@ -133,11 +137,12 @@
// Import methods
- (void)importFile;
+- (void)importFromClipboard;
- (void)importSQLFile:(NSString *)filename;
- (void)startSQLImportProcessWithFile:(NSString *)filename;
- (void)importCSVFile:(NSString *)filename;
- (IBAction)changeFormat:(id)sender;
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
+- (void)openPanelDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
- (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)dataIsPreviewData ofSoureFile:(NSString*)filename;
- (NSString *) mappedValueStringForRowArray:(NSArray *)csvRowArray;
- (NSString *) mappedUpdateSetStatementStringForRowArray:(NSArray *)csvRowArray;
diff --git a/Source/TableDump.m b/Source/TableDump.m
index a7a1f31d..3021f3c4 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -473,6 +473,51 @@
#pragma mark -
#pragma mark Import methods
+- (void)importFromClipboard
+/*
+ invoked when user clicks on an ImportFromClipboard menuItem
+ */
+{
+ // Load accessory nib each time
+ if(![NSBundle loadNibNamed:@"ImportAccessory" owner:self]) {
+ NSBeep();
+ NSLog(@"ImportAccessory accessory dialog could not be loaded.");
+ return;
+ }
+
+ // clipboard textview with no wrapping
+ const CGFloat LargeNumberForText = 1.0e7;
+ [[importFromClipboardTextView textContainer] setContainerSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
+ [[importFromClipboardTextView textContainer] setWidthTracksTextView:NO];
+ [[importFromClipboardTextView textContainer] setHeightTracksTextView:NO];
+ [importFromClipboardTextView setAutoresizingMask:NSViewNotSizable];
+ [importFromClipboardTextView setMaxSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];
+ [importFromClipboardTextView setHorizontallyResizable:YES];
+ [importFromClipboardTextView setVerticallyResizable:YES];
+ [importFromClipboardTextView setFont:[NSFont fontWithName:@"Monaco" size:11.0f]];
+
+ if([[[NSPasteboard generalPasteboard] stringForType:NSStringPboardType] length] > 4000)
+ [importFromClipboardTextView setString:[[[[NSPasteboard generalPasteboard] stringForType:NSStringPboardType] substringToIndex:4000] stringByAppendingString:@"\n…"]];
+ else
+ [importFromClipboardTextView setString:[[NSPasteboard generalPasteboard] stringForType:NSStringPboardType]];
+
+ // Preset the accessory view with prefs defaults
+ [importFieldsTerminatedField setStringValue:[prefs objectForKey:SPCSVImportFieldTerminator]];
+ [importLinesTerminatedField setStringValue:[prefs objectForKey:SPCSVImportLineTerminator]];
+ [importFieldsEscapedField setStringValue:[prefs objectForKey:SPCSVImportFieldEscapeCharacter]];
+ [importFieldsEnclosedField setStringValue:[prefs objectForKey:SPCSVImportFieldEnclosedBy]];
+ [importFieldNamesSwitch setState:[[prefs objectForKey:SPCSVImportFirstLineIsHeader] boolValue]];
+ [importFromClipboardAccessoryView addSubview:importCSVView];
+
+ [NSApp beginSheet:importFromClipboardSheet
+ modalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
+ contextInfo:@"importFromClipboard"];
+
+ // NSString );
+}
+
- (void)importFile
/*
invoked when user clicks on an import menuItem
@@ -563,6 +608,8 @@
NSLocalizedString(@"OK button label", @"OK button"),
nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"SQL file open error", @"The SQL file you selected could not be found or read."));
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
@@ -608,6 +655,8 @@
[sqlDataBuffer release];
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
@@ -656,6 +705,8 @@
[sqlDataBuffer release];
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
}
@@ -679,7 +730,11 @@
}
// Before entering the following loop, check that we actually have a connection. If not, bail.
- if (![mySQLConnection isConnected]) return;
+ if (![mySQLConnection isConnected]) {
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
+ return;
+ }
// Extract and process any complete SQL queries that can be found in the strings parsed so far
while (query = [sqlParser trimAndReturnStringToCharacter:';' trimmingInclusively:YES returningInclusively:NO]) {
@@ -791,7 +846,9 @@
NSInteger i;
BOOL allDataRead = NO;
BOOL insertBaseStringHasEntries;
+
NSStringEncoding csvEncoding = [MCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]];
+
fieldMappingArray = nil;
fieldMappingGlobalValueArray = nil;
@@ -805,6 +862,8 @@
NSLocalizedString(@"OK button label", @"OK button"),
nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"CSV file open error", @"The CSV file you selected could not be found or read."));
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
@@ -876,6 +935,8 @@
if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
@@ -923,6 +984,8 @@
if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
@@ -974,6 +1037,8 @@
if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
@@ -1024,6 +1089,8 @@
if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
return;
}
@@ -1169,6 +1236,8 @@
if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ if([filename hasPrefix:SPImportClipboardTempFileNamePrefix])
+ [[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
// Close progress sheet
[self closeAndStopProgressSheet];
@@ -1178,8 +1247,8 @@
[self showErrorSheetWithMessage:errors];
}
- // Import finished Growl notification
- [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished"
+ // Import finished Growl notification
+ [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished"
description:[NSString stringWithFormat:NSLocalizedString(@"Finished importing %@",@"description for finished importing growl notification"), [filename lastPathComponent]]
window:tableWindow
notificationName:@"Import Finished"];
@@ -1195,30 +1264,71 @@
}
}
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
+- (void)openPanelDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
+
+ // if contextInfo == nil NSOpenPanel else importFromClipboardPanel
+
// save values to preferences
- [prefs setObject:[sheet directory] forKey:@"openPath"];
+ if(contextInfo == nil)
+ [prefs setObject:[(NSOpenPanel*)sheet directory] forKey:@"openPath"];
+ else
+ [importFromClipboardTextView setString:@""];
+
[prefs setObject:[[importFormatPopup selectedItem] title] forKey:@"importFormatPopupValue"];
- // close sheet, and check if user canceled
- [sheet orderOut:self];
+ // close NSOpenPanel sheet
+ if(contextInfo == nil)
+ [sheet orderOut:self];
+
+ // check if user canceled
if (returnCode != NSOKButton)
return;
// Reset progress cancelled from any previous runs
progressCancelled = NO;
- if(lastFilename) [lastFilename release]; lastFilename = nil;
- lastFilename = [[NSString stringWithString:[sheet filename]] retain];
+ NSString *importFileName;
- if(lastFilename == nil || ![lastFilename length]) {
- NSBeep();
- return;
+ // File path from NSOpenPanel
+ if(contextInfo == nil)
+ {
+ if(lastFilename) [lastFilename release]; lastFilename = nil;
+ lastFilename = [[NSString stringWithString:[(NSOpenPanel*)sheet filename]] retain];
+ importFileName = [NSString stringWithString:lastFilename];
+ if(lastFilename == nil || ![lastFilename length]) {
+ NSBeep();
+ return;
+ }
+ }
+
+ // Import from Clipboard
+ else
+ {
+ importFileName = [NSString stringWithFormat:@"%@%@", SPImportClipboardTempFileNamePrefix,
+ [[NSDate date] descriptionWithCalendarFormat:@"%H%M%S"
+ timeZone:nil
+ locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]];
+
+ // Write clipboard content to temp file using the connection encoding
+
+ NSStringEncoding encoding;
+ if ([[[importFormatPopup selectedItem] title] isEqualToString:@"SQL"])
+ encoding = NSUTF8StringEncoding;
+ else
+ encoding = [MCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]];
+
+ if(![[[NSPasteboard generalPasteboard] stringForType:NSStringPboardType] writeToFile:importFileName atomically:NO encoding:encoding error:nil]) {
+ NSBeep();
+ NSLog(@"Couldn't write clipboard content to temporary file.");
+ return;
+ }
}
+ if(importFileName == nil) return;
+
// begin import process
- [NSThread detachNewThreadSelector:@selector(importBackgroundProcess:) toTarget:self withObject:lastFilename];
+ [NSThread detachNewThreadSelector:@selector(importBackgroundProcess:) toTarget:self withObject:importFileName];
}
- (void)startSQLImportProcessWithFile:(NSString *)filename