aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-22 21:59:43 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-22 21:59:43 +0000
commitdcd0413d4cc106d1efe17cc225be7c325081a113 (patch)
treeb64ad0cc32741312b285736f02bd59d3c2d9698c
parent82439bd6c54d64a130c74e9c2dfec66e65de043a (diff)
downloadsequelpro-dcd0413d4cc106d1efe17cc225be7c325081a113.tar.gz
sequelpro-dcd0413d4cc106d1efe17cc225be7c325081a113.tar.bz2
sequelpro-dcd0413d4cc106d1efe17cc225be7c325081a113.zip
• first preparations to allow in cell editing in Custom Query (not yet active)
• view data editing - disable add/duplicate/remove row for views - first improvements for editing navigation via keyboard - after editing avoid relaodTable instead use loadTableValues - outsourced: (NSInteger)fieldEditStatusForRow:andColumn: since it will be used for keyboard editing navigation
-rw-r--r--Interfaces/English.lproj/DBView.xib697
-rw-r--r--Source/SPCustomQuery.m49
-rw-r--r--Source/SPTableContent.h3
-rw-r--r--Source/SPTableContent.m352
4 files changed, 929 insertions, 172 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 577c1e6b..d35fb900 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -23,6 +23,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="7168"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -51,7 +52,7 @@
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomView" id="632807581">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -944,7 +945,7 @@
<object class="NSTabViewItem" id="831053945">
<string key="NSIdentifier">source</string>
<object class="NSView" key="NSView" id="461236772">
- <reference key="NSNextResponder" ref="714795046"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2230,7 +2231,6 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {706, 544}}</string>
- <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Structure</string>
<reference key="NSColor" ref="62854682"/>
@@ -2530,11 +2530,11 @@
<reference key="NSControlView" ref="393139604"/>
<int key="NSButtonFlags">-935051009</int>
<int key="NSButtonFlags2">35</int>
- <object class="NSCustomResource" key="NSNormalImage">
+ <object class="NSCustomResource" key="NSNormalImage" id="445801446">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_edit_mode</string>
</object>
- <object class="NSCustomResource" key="NSAlternateImage">
+ <object class="NSCustomResource" key="NSAlternateImage" id="899882477">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_edit_mode_selected</string>
</object>
@@ -2987,7 +2987,7 @@
<object class="NSTabViewItem" id="105987292">
<string key="NSIdentifier">customQuery</string>
<object class="NSView" key="NSView" id="746504912">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="714795046"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -3021,7 +3021,7 @@
<object class="NSTextField" id="896749354">
<reference key="NSNextResponder" ref="556476514"/>
<int key="NSvFlags">266</int>
- <string key="NSFrame">{{68, 1}, {611, 17}}</string>
+ <string key="NSFrame">{{97, 1}, {582, 17}}</string>
<reference key="NSSuperview" ref="556476514"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="820624125">
@@ -3115,6 +3115,28 @@
<bool key="NSAltersState">YES</bool>
</object>
</object>
+ <object class="NSButton" id="67603994">
+ <reference key="NSNextResponder" ref="556476514"/>
+ <int key="NSvFlags">-2147483356</int>
+ <string key="NSFrame">{{62, -1}, {32, 25}}</string>
+ <reference key="NSSuperview" ref="556476514"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="527038904">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="244931163"/>
+ <reference key="NSControlView" ref="67603994"/>
+ <int key="NSButtonFlags">-935051009</int>
+ <int key="NSButtonFlags2">35</int>
+ <reference key="NSNormalImage" ref="445801446"/>
+ <reference key="NSAlternateImage" ref="899882477"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
</object>
<string key="NSFrame">{{6, 11}, {696, 23}}</string>
<reference key="NSSuperview" ref="746504912"/>
@@ -3156,6 +3178,29 @@
<object class="NSTextView" id="793890647">
<reference key="NSNextResponder" ref="888807510"/>
<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="NSFrame">{{0, 2}, {694, 14}}</string>
<reference key="NSSuperview" ref="888807510"/>
<object class="NSTextContainer" key="NSTextContainer" id="845974686">
@@ -4141,6 +4186,7 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {706, 544}}</string>
+ <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Custom Query</string>
<reference key="NSColor" ref="62854682"/>
@@ -5930,14 +5976,14 @@
<reference key="NSTabView" ref="714795046"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="831053945"/>
+ <reference key="NSSelectedTabViewItem" ref="105987292"/>
<reference key="NSFont" ref="26"/>
<int key="NSTvFlags">134217731</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="461236772"/>
+ <reference ref="746504912"/>
</object>
</object>
</object>
@@ -5954,6 +6000,7 @@
</object>
</object>
<string key="NSFrameSize">{943, 549}</string>
+ <reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSWindowTemplate" id="554105051">
@@ -14499,6 +14546,30 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">7462</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.EditInSheetEnabled</string>
+ <reference key="source" ref="67603994"/>
+ <reference key="destination" ref="461189245"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="67603994"/>
+ <reference key="NSDestination" ref="461189245"/>
+ <string key="NSLabel">value: values.EditInSheetEnabled</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.EditInSheetEnabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">7465</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">multipleLineEditingButton</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="67603994"/>
+ </object>
+ <int key="connectionID">7466</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -14549,7 +14620,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="objectID">134</int>
<reference key="object" ref="601471102"/>
<reference key="parent" ref="0"/>
- <string key="objectName">CustomQuery</string>
+ <string key="objectName">SPCustomQuery</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">362</int>
@@ -19619,6 +19690,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="1006311058"/>
<reference ref="896749354"/>
<reference ref="911536978"/>
+ <reference ref="67603994"/>
</object>
<reference key="parent" ref="746504912"/>
</object>
@@ -20391,6 +20463,20 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="object" ref="598509241"/>
<reference key="parent" ref="168895907"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7463</int>
+ <reference key="object" ref="67603994"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="527038904"/>
+ </object>
+ <reference key="parent" ref="556476514"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7464</int>
+ <reference key="object" ref="527038904"/>
+ <reference key="parent" ref="67603994"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -21576,6 +21662,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>7457.IBAttributePlaceholdersKey</string>
<string>7457.IBPluginDependency</string>
<string>7458.IBPluginDependency</string>
+ <string>7463.IBAttributePlaceholdersKey</string>
+ <string>7463.IBPluginDependency</string>
+ <string>7464.IBPluginDependency</string>
<string>748.IBPluginDependency</string>
<string>748.ImportedFromIB2</string>
<string>749.IBPluginDependency</string>
@@ -22912,7 +23001,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{52, 230}, {943, 549}}</string>
+ <string>{{337, 160}, {943, 549}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -23192,6 +23281,16 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<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">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="67603994"/>
+ <string key="toolTip">Toggle between editing simple text cells as a spreadsheet or in pop-up sheets</string>
+ </object>
+ </object>
+ <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>
@@ -23234,7 +23333,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">7462</int>
+ <int key="maxID">7466</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -27940,6 +28039,578 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
</object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">SPCustomQuery</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>chooseQueryFavorite:</string>
+ <string>chooseQueryHistory:</string>
+ <string>clearQueryHistory:</string>
+ <string>closeSheet:</string>
+ <string>copyQueryHistory:</string>
+ <string>filterQueryFavorites:</string>
+ <string>filterQueryHistory:</string>
+ <string>gearMenuItemSelected:</string>
+ <string>helpSearchFindNextInPage:</string>
+ <string>helpSearchFindPreviousInPage:</string>
+ <string>helpSegmentDispatcher:</string>
+ <string>helpSelectHelpTargetMySQL:</string>
+ <string>helpSelectHelpTargetPage:</string>
+ <string>helpSelectHelpTargetWeb:</string>
+ <string>helpTargetDispatcher:</string>
+ <string>runAllQueries:</string>
+ <string>runSelectedQueries:</string>
+ <string>saveQueryHistory:</string>
+ <string>showAutoHelpForCurrentWord:</string>
+ <string>showCompletionList:</string>
+ <string>showHelpForCurrentWord:</string>
+ <string>showHelpForSearchString:</string>
+ <string>toggleQueryInfoPaneCollapse:</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>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>chooseQueryFavorite:</string>
+ <string>chooseQueryHistory:</string>
+ <string>clearQueryHistory:</string>
+ <string>closeSheet:</string>
+ <string>copyQueryHistory:</string>
+ <string>filterQueryFavorites:</string>
+ <string>filterQueryHistory:</string>
+ <string>gearMenuItemSelected:</string>
+ <string>helpSearchFindNextInPage:</string>
+ <string>helpSearchFindPreviousInPage:</string>
+ <string>helpSegmentDispatcher:</string>
+ <string>helpSelectHelpTargetMySQL:</string>
+ <string>helpSelectHelpTargetPage:</string>
+ <string>helpSelectHelpTargetWeb:</string>
+ <string>helpTargetDispatcher:</string>
+ <string>runAllQueries:</string>
+ <string>runSelectedQueries:</string>
+ <string>saveQueryHistory:</string>
+ <string>showAutoHelpForCurrentWord:</string>
+ <string>showCompletionList:</string>
+ <string>showHelpForCurrentWord:</string>
+ <string>showHelpForSearchString:</string>
+ <string>toggleQueryInfoPaneCollapse:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">chooseQueryFavorite:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">chooseQueryHistory:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">clearQueryHistory:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">closeSheet:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">copyQueryHistory:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">filterQueryFavorites:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">filterQueryHistory:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">gearMenuItemSelected:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">helpSearchFindNextInPage:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">helpSearchFindPreviousInPage:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">helpSegmentDispatcher:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">helpSelectHelpTargetMySQL:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">helpSelectHelpTargetPage:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">helpSelectHelpTargetWeb:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">helpTargetDispatcher:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">runAllQueries:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">runSelectedQueries:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveQueryHistory:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">showAutoHelpForCurrentWord:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">showCompletionList:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">showHelpForCurrentWord:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">showHelpForSearchString:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">toggleQueryInfoPaneCollapse:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>affectedRowsText</string>
+ <string>autohelpMenuItem</string>
+ <string>autoindentMenuItem</string>
+ <string>autopairMenuItem</string>
+ <string>autouppercaseKeywordsMenuItem</string>
+ <string>clearHistoryMenuItem</string>
+ <string>commentCurrentQueryMenuItem</string>
+ <string>commentLineOrSelectionMenuItem</string>
+ <string>completionListMenuItem</string>
+ <string>copyHistoryMenuItem</string>
+ <string>customQueryScrollView</string>
+ <string>customQueryView</string>
+ <string>editorFontMenuItem</string>
+ <string>encodingPopUp</string>
+ <string>errorText</string>
+ <string>helpNavigator</string>
+ <string>helpSearchField</string>
+ <string>helpSearchFieldCell</string>
+ <string>helpTargetSelector</string>
+ <string>helpWebView</string>
+ <string>helpWebViewWindow</string>
+ <string>multipleLineEditingButton</string>
+ <string>nextHistoryMenuItem</string>
+ <string>previousHistoryMenuItem</string>
+ <string>queryFavoriteNameTextField</string>
+ <string>queryFavoritesButton</string>
+ <string>queryFavoritesSaveAllMenuItem</string>
+ <string>queryFavoritesSaveAsMenuItem</string>
+ <string>queryFavoritesSearchField</string>
+ <string>queryFavoritesSearchFieldView</string>
+ <string>queryFavoritesSearchMenuItem</string>
+ <string>queryFavoritesSheet</string>
+ <string>queryHistoryButton</string>
+ <string>queryHistorySearchField</string>
+ <string>queryHistorySearchFieldView</string>
+ <string>queryHistorySearchMenuItem</string>
+ <string>queryInfoButton</string>
+ <string>queryInfoPaneSplitView</string>
+ <string>runAllButton</string>
+ <string>runAllMenuItem</string>
+ <string>runSelectionButton</string>
+ <string>runSelectionMenuItem</string>
+ <string>saveHistoryMenuItem</string>
+ <string>saveQueryFavoriteButton</string>
+ <string>saveQueryFavoriteGlobal</string>
+ <string>shiftLeftMenuItem</string>
+ <string>shiftRightMenuItem</string>
+ <string>tableDocumentInstance</string>
+ <string>tablesListInstance</string>
+ <string>textView</string>
+ <string>valueSheet</string>
+ <string>valueTextField</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSScrollView</string>
+ <string>SPCopyTable</string>
+ <string>NSMenuItem</string>
+ <string>NSPopUpButton</string>
+ <string>id</string>
+ <string>NSSegmentedControl</string>
+ <string>NSSearchField</string>
+ <string>NSSearchFieldCell</string>
+ <string>NSSegmentedControl</string>
+ <string>WebView</string>
+ <string>NSWindow</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSTextField</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSSearchField</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSWindow</string>
+ <string>id</string>
+ <string>NSSearchField</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSButton</string>
+ <string>BWSplitView</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSButton</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>id</string>
+ <string>id</string>
+ <string>SPTextView</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>affectedRowsText</string>
+ <string>autohelpMenuItem</string>
+ <string>autoindentMenuItem</string>
+ <string>autopairMenuItem</string>
+ <string>autouppercaseKeywordsMenuItem</string>
+ <string>clearHistoryMenuItem</string>
+ <string>commentCurrentQueryMenuItem</string>
+ <string>commentLineOrSelectionMenuItem</string>
+ <string>completionListMenuItem</string>
+ <string>copyHistoryMenuItem</string>
+ <string>customQueryScrollView</string>
+ <string>customQueryView</string>
+ <string>editorFontMenuItem</string>
+ <string>encodingPopUp</string>
+ <string>errorText</string>
+ <string>helpNavigator</string>
+ <string>helpSearchField</string>
+ <string>helpSearchFieldCell</string>
+ <string>helpTargetSelector</string>
+ <string>helpWebView</string>
+ <string>helpWebViewWindow</string>
+ <string>multipleLineEditingButton</string>
+ <string>nextHistoryMenuItem</string>
+ <string>previousHistoryMenuItem</string>
+ <string>queryFavoriteNameTextField</string>
+ <string>queryFavoritesButton</string>
+ <string>queryFavoritesSaveAllMenuItem</string>
+ <string>queryFavoritesSaveAsMenuItem</string>
+ <string>queryFavoritesSearchField</string>
+ <string>queryFavoritesSearchFieldView</string>
+ <string>queryFavoritesSearchMenuItem</string>
+ <string>queryFavoritesSheet</string>
+ <string>queryHistoryButton</string>
+ <string>queryHistorySearchField</string>
+ <string>queryHistorySearchFieldView</string>
+ <string>queryHistorySearchMenuItem</string>
+ <string>queryInfoButton</string>
+ <string>queryInfoPaneSplitView</string>
+ <string>runAllButton</string>
+ <string>runAllMenuItem</string>
+ <string>runSelectionButton</string>
+ <string>runSelectionMenuItem</string>
+ <string>saveHistoryMenuItem</string>
+ <string>saveQueryFavoriteButton</string>
+ <string>saveQueryFavoriteGlobal</string>
+ <string>shiftLeftMenuItem</string>
+ <string>shiftRightMenuItem</string>
+ <string>tableDocumentInstance</string>
+ <string>tablesListInstance</string>
+ <string>textView</string>
+ <string>valueSheet</string>
+ <string>valueTextField</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBToOneOutletInfo">
+ <string key="name">affectedRowsText</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">autohelpMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">autoindentMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">autopairMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">autouppercaseKeywordsMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">clearHistoryMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">commentCurrentQueryMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">commentLineOrSelectionMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">completionListMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">copyHistoryMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">customQueryScrollView</string>
+ <string key="candidateClassName">NSScrollView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">customQueryView</string>
+ <string key="candidateClassName">SPCopyTable</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">editorFontMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">encodingPopUp</string>
+ <string key="candidateClassName">NSPopUpButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">errorText</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">helpNavigator</string>
+ <string key="candidateClassName">NSSegmentedControl</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">helpSearchField</string>
+ <string key="candidateClassName">NSSearchField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">helpSearchFieldCell</string>
+ <string key="candidateClassName">NSSearchFieldCell</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">helpTargetSelector</string>
+ <string key="candidateClassName">NSSegmentedControl</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">helpWebView</string>
+ <string key="candidateClassName">WebView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">helpWebViewWindow</string>
+ <string key="candidateClassName">NSWindow</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">multipleLineEditingButton</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">nextHistoryMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">previousHistoryMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoriteNameTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoritesButton</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoritesSaveAllMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoritesSaveAsMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoritesSearchField</string>
+ <string key="candidateClassName">NSSearchField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoritesSearchFieldView</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoritesSearchMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryFavoritesSheet</string>
+ <string key="candidateClassName">NSWindow</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryHistoryButton</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryHistorySearchField</string>
+ <string key="candidateClassName">NSSearchField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryHistorySearchFieldView</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryHistorySearchMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryInfoButton</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">queryInfoPaneSplitView</string>
+ <string key="candidateClassName">BWSplitView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">runAllButton</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">runAllMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">runSelectionButton</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">runSelectionMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">saveHistoryMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">saveQueryFavoriteButton</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">saveQueryFavoriteGlobal</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">shiftLeftMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">shiftRightMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">tableDocumentInstance</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">tablesListInstance</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">textView</string>
+ <string key="candidateClassName">SPTextView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">valueSheet</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">valueTextField</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../Source/SPCustomQuery.h</string>
+ </object>
+ </object>
+ </object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
@@ -29004,7 +29675,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>{15, 15}</string>
+ <string>{10, 10}</string>
<string>{8, 8}</string>
<string>{32, 32}</string>
<string>{128, 128}</string>
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 80ec1c33..c7e0a9bf 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -1766,7 +1766,8 @@
NSString *columnName = [columnDefinition objectForKey:@"org_name"];
// NSString *fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn];
-
+ fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]];
+
// Check if the IDstring identifies the current field bijectively
NSInteger numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
if(numberOfPossibleUpdateRows == 1) {
@@ -2149,36 +2150,40 @@
[errorText setStringValue:NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database")];
}
+ // if ([multipleLineEditingButton state] == NSOnState || isBlob) {
- SPFieldEditorController *fieldEditor = [[SPFieldEditorController alloc] init];
+ SPFieldEditorController *fieldEditor = [[SPFieldEditorController alloc] init];
- // Remember edited row for reselecting and setting the scroll view after reload
- editedRow = rowIndex;
- editedScrollViewRect = [customQueryScrollView documentVisibleRect];
+ // Remember edited row for reselecting and setting the scroll view after reload
+ editedRow = rowIndex;
+ editedScrollViewRect = [customQueryScrollView documentVisibleRect];
- // Set max text length
- if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"]
- && [columnDefinition valueForKey:@"char_length"])
- [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] integerValue]];
+ // Set max text length
+ if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"]
+ && [columnDefinition valueForKey:@"char_length"])
+ [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] integerValue]];
- id originalData = [resultData cellDataAtRow:rowIndex column:[[aTableColumn identifier] integerValue]];
- if ([originalData isNSNull]) originalData = [prefs objectForKey:SPNullValue];
+ id originalData = [resultData cellDataAtRow:rowIndex column:[[aTableColumn identifier] integerValue]];
+ if ([originalData isNSNull]) originalData = [prefs objectForKey:SPNullValue];
- id editData = [[fieldEditor editWithObject:originalData
- fieldName:[columnDefinition objectForKey:@"name"]
- usingEncoding:[mySQLConnection encoding]
- isObjectBlob:isBlob
- isEditable:isFieldEditable
- withWindow:[tableDocumentInstance parentWindow]] retain];
+ id editData = [[fieldEditor editWithObject:originalData
+ fieldName:[columnDefinition objectForKey:@"name"]
+ usingEncoding:[mySQLConnection encoding]
+ isObjectBlob:isBlob
+ isEditable:isFieldEditable
+ withWindow:[tableDocumentInstance parentWindow]] retain];
- if ( editData )
- [self tableView:aTableView setObjectValue:[editData copy] forTableColumn:aTableColumn row:rowIndex];
+ if ( editData )
+ [self tableView:aTableView setObjectValue:[editData copy] forTableColumn:aTableColumn row:rowIndex];
- [fieldEditor release];
+ [fieldEditor release];
- if ( editData ) [editData release];
+ if ( editData ) [editData release];
- return NO;
+ return NO;
+
+ // }
+ return isFieldEditable;
} else {
return YES;
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index 51a01520..b1748c2d 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -105,6 +105,7 @@
NSArray *cqColumnDefinition;
NSString *fieldIDQueryString;
+ BOOL isFirstChangeInView;
}
@@ -183,4 +184,6 @@
- (void)openContentFilterManager;
- (void)makeContentFilterHaveFocus;
+- (NSInteger)fieldEditStatusForRow:(NSInteger)rowIndex andColumn:(NSInteger)columnIndex;
+
@end
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 7b012f45..9e50bb67 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -91,6 +91,7 @@
secondBetweenValueToRestore = nil;
tableRowsSelectable = YES;
contentFilterManager = nil;
+ isFirstChangeInView = YES;
isFiltered = NO;
isLimited = NO;
@@ -519,7 +520,7 @@
[[tableDocumentInstance parentWindow] makeFirstResponder:currentFirstResponder];
// Set the state of the table buttons
- [addButton setEnabled:enableInteraction];
+ [addButton setEnabled:(enableInteraction && [tablesListInstance tableType] == SPTableTypeTable)];
[copyButton setEnabled:NO];
[removeButton setEnabled:NO];
@@ -2624,6 +2625,60 @@
}
/*
+ * Check if table cell is editable
+ * Returns the number of possible changes or
+ * -1 if no table name can be found or multiple table origins
+ */
+- (NSInteger)fieldEditStatusForRow:(NSInteger)rowIndex andColumn:(NSInteger)columnIndex
+{
+ NSDictionary *columnDefinition;
+
+ // Retrieve the column defintion
+ for(id c in cqColumnDefinition) {
+ if([[c objectForKey:@"datacolumnindex"] isEqualToNumber:columnIndex]) {
+ columnDefinition = [NSDictionary dictionaryWithDictionary:c];
+ break;
+ }
+ }
+
+ // Resolve the original table name for current column if AS was used
+ NSString *tableForColumn = [columnDefinition objectForKey:@"org_table"];
+
+ // Get the database name which the field belongs to
+ NSString *dbForColumn = [columnDefinition objectForKey:@"db"];
+
+ // No table/database name found indicates that the field's column contains data from more than one table as for UNION
+ // or the field data are not bound to any table as in SELECT 1 or if column database is unset
+ if(!tableForColumn || ![tableForColumn length] || ![dbForColumn length])
+ return -1;
+
+ // if table and database name are given check if field can be identified unambiguously
+ NSString *fieldIDQueryStr = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]];
+ if(!fieldIDQueryStr)
+ return -1;
+
+ [tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Checking field data for editing...", @"checking field data for editing task description")];
+
+ // Actual check whether field can be identified bijectively
+ MCPResult *tempResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@",
+ [[columnDefinition objectForKey:@"db"] backtickQuotedString],
+ [tableForColumn backtickQuotedString],
+ fieldIDQueryStr]];
+
+ [tableDocumentInstance endTask];
+
+ if ([mySQLConnection queryErrored])
+ return -1;
+
+ NSArray *tempRow = [tempResult fetchRowAsArray];
+
+ if(![tempRow count])
+ return -1;
+
+ return [[tempRow objectAtIndex:0] integerValue];
+
+}
+/*
* Close an open sheet.
*/
- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
@@ -3095,15 +3150,14 @@
NSBeep();
return;
}
+
// Resolve the original column name if AS was used
NSString *columnName = [columnDefinition objectForKey:@"org_name"];
[tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Updating field data...", @"updating field task description")];
-
- NSString *fieldIDQueryStringB = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]];
-
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+ NSString *fieldIDQueryStringB = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]];
// Check if the IDstring identifies the current field bijectively
NSInteger numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryStringB]] fetchRowAsArray] objectAtIndex:0] integerValue];
@@ -3138,13 +3192,12 @@
[[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], [columnName backtickQuotedString], newObject, fieldIDQueryStringB]];
- [tableDocumentInstance endTask];
-
// Check for errors while UPDATE
if ([mySQLConnection queryErrored]) {
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, [tableDocumentInstance parentWindow], self, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't write field.\nMySQL said: %@", @"message of panel when error while updating field to db"), [mySQLConnection getLastErrorMessage]]);
+ [tableDocumentInstance endTask];
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
return;
}
@@ -3158,6 +3211,7 @@
} else {
NSBeep();
}
+ [tableDocumentInstance endTask];
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
return;
}
@@ -3172,12 +3226,25 @@
return;
}
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
- [tableDocumentInstance endTask];
// Reload table after each editing due to complex declarations
- [self reloadTable:self];
+ if(isFirstChangeInView) {
+ // Set up the table details for the new table, and trigger an interface update
+ // if the view was modified for the very first time
+ NSDictionary *tableDetails = [NSDictionary dictionaryWithObjectsAndKeys:
+ tableForColumn, @"name",
+ [tableDataInstance columns], @"columns",
+ [tableDataInstance columnNames], @"columnNames",
+ [tableDataInstance getConstraints], @"constraints",
+ nil];
+ [self performSelectorOnMainThread:@selector(setTableDetails:) withObject:tableDetails waitUntilDone:YES];
+ isFirstChangeInView = NO;
+ }
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ [tableDocumentInstance endTask];
+
+ [self loadTableValues];
return;
@@ -3277,6 +3344,12 @@
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
{
+ isFirstChangeInView = YES;
+
+
+ [addButton setEnabled:([tablesListInstance tableType] == SPTableTypeTable)];
+
+
// Check our notification object is our table content view
if ([aNotification object] != tableContentView) return;
@@ -3284,14 +3357,18 @@
if (isEditingRow && [tableContentView selectedRow] != currentlyEditingRow && ![self saveRowOnDeselect]) return;
if (![tableDocumentInstance isWorking]) {
-
// Update the row selection count
// and update the status of the delete/duplicate buttons
- if ([tableContentView numberOfSelectedRows] > 0) {
- [copyButton setEnabled:YES];
- [removeButton setEnabled:YES];
- }
- else {
+ if([tablesListInstance tableType] == SPTableTypeTable) {
+ if ([tableContentView numberOfSelectedRows] > 0) {
+ [copyButton setEnabled:([tableContentView numberOfSelectedRows] == 1)];
+ [removeButton setEnabled:YES];
+ }
+ else {
+ [copyButton setEnabled:NO];
+ [removeButton setEnabled:NO];
+ }
+ } else {
[copyButton setEnabled:NO];
[removeButton setEnabled:NO];
}
@@ -3375,72 +3452,48 @@
// If a data come from a view check if the clicked table field is editable
if([tablesListInstance tableType] == SPTableTypeView) {
- NSDictionary *columnDefinition;
- BOOL noTableName = NO;
- BOOL otherErrorWasDisplayed = NO;
- isFieldEditable = NO;
- NSInteger numberOfPossibleUpdateRows = -1;
-
- // Retrieve the column defintion
- for(id c in cqColumnDefinition) {
- if([[c objectForKey:@"datacolumnindex"] isEqualToNumber:[aTableColumn identifier]]) {
- columnDefinition = [NSDictionary dictionaryWithDictionary:c];
- break;
- }
- }
-
- // Resolve the original table name for current column if AS was used
- NSString *tableForColumn = [columnDefinition objectForKey:@"org_table"];
-
- // Get the database name which the field belongs to
- NSString *dbForColumn = [columnDefinition objectForKey:@"db"];
-
- // No table/database name found indicates that the field's column contains data from more than one table as for UNION
- // or the field data are not bound to any table as in SELECT 1 or if column database is unset
- if(!tableForColumn || ![tableForColumn length] || ![dbForColumn length])
- noTableName = YES;
-
- if(!noTableName) {
- // if table and database name are given check if field can be identified unambiguously
- fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]];
+ NSInteger numberOfPossibleUpdateRows = [self fieldEditStatusForRow:rowIndex andColumn:[aTableColumn identifier]];
+ isFieldEditable = (numberOfPossibleUpdateRows == 1) ? YES : NO;
+ NSPoint pos = [NSEvent mouseLocation];
+ pos.y -= 20;
+ switch(numberOfPossibleUpdateRows) {
+ case -1:
+ [SPTooltip showWithObject:NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database")
+ atLocation:pos
+ ofType:@"text"];
+ isFieldEditable = NO;
+ // Allow to display blobs even it's not editable
+ if(!isBlob && [multipleLineEditingButton state] == NSOffState)
+ return NO;
+ break;
- [tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Checking field data for editing...", @"checking field data for editing task description")];
+ case 0:
+ [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Field is not editable. No matching record found.\nReload table or try to add a primary key field or more fields\nin the view declaration of '%@' to identify\nfield origin unambiguously.", @"Table Content result editing error - could not identify original row"), selectedTable]
+ atLocation:pos
+ ofType:@"text"];
- // Actual check whether field can be identified bijectively
- numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
+ isFieldEditable = NO;
+ // Allow to display blobs even it's not editable
+ if(!isBlob && [multipleLineEditingButton state] == NSOffState)
+ return NO;
+ break;
- [tableDocumentInstance endTask];
+ case 1:
+ isFieldEditable = YES;
+ if(!isBlob && [multipleLineEditingButton state] == NSOffState)
+ return YES;
+ break;
- isFieldEditable = (numberOfPossibleUpdateRows == 1) ? YES : NO;
-
- if(!isFieldEditable) {
- fieldIDQueryString = nil;
- otherErrorWasDisplayed = YES;
- NSPoint pos = [NSEvent mouseLocation];
- pos.y -= 20;
- if(numberOfPossibleUpdateRows == 0)
- [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Field is not editable. No matching record found.\nReload table or try to add a primary key field or more fields\nin the view declaration of '%@' to identify\nfield origin unambiguously.", @"Table Content result editing error - could not identify original row"), tableForColumn]
- atLocation:pos
- ofType:@"text"];
- else
- [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Field is not editable. Couldn't identify field origin unambiguously (%ld match%@).", @"Table Content result editing error - could not match row being edited uniquely"), (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?NSLocalizedString(@"es", @"Plural suffix for row count, eg 4 match*es*"):@""]
- atLocation:pos
- ofType:@"text"];
- // Allow to display blobs even it's not editable
- if(!isBlob && [multipleLineEditingButton state] == NSOffState)
- return NO;
- }
- }
- if(!isFieldEditable && !otherErrorWasDisplayed) {
- NSPoint pos = [NSEvent mouseLocation];
- pos.y -= 20;
- [SPTooltip showWithObject:NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database")
+ default:
+ [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Field is not editable. Couldn't identify field origin unambiguously (%ld match%@).", @"Table Content result editing error - could not match row being edited uniquely"), (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?NSLocalizedString(@"es", @"Plural suffix for row count, eg 4 match*es*"):@""]
atLocation:pos
ofType:@"text"];
-
+
+ isFieldEditable = NO;
// Allow to display blobs even it's not editable
if(!isBlob && [multipleLineEditingButton state] == NSOffState)
return NO;
+
}
}
@@ -3463,7 +3516,7 @@
withWindow:[tableDocumentInstance parentWindow]] retain];
if (editData) {
- if (!isEditingRow) {
+ if (!isEditingRow && [tablesListInstance tableType] != SPTableTypeView) {
[oldRow setArray:[tableValues rowContentsAtIndex:rowIndex]];
isEditingRow = YES;
currentlyEditingRow = rowIndex;
@@ -3629,13 +3682,15 @@
return;
if ( ![[[tableDataInstance statusValues] objectForKey:@"Rows"] isNSNull] && selectedTable && [selectedTable length] && [tableDataInstance tableEncoding]) {
- [addButton setEnabled:YES];
+ [addButton setEnabled:([tablesListInstance tableType] == SPTableTypeTable)];
[self updatePaginationState];
[reloadButton setEnabled:YES];
}
if ([tableContentView numberOfSelectedRows] > 0) {
- [removeButton setEnabled:YES];
- [copyButton setEnabled:YES];
+ if([tablesListInstance tableType] == SPTableTypeTable) {
+ [removeButton setEnabled:YES];
+ [copyButton setEnabled:YES];
+ }
}
[filterButton setEnabled:[fieldField isEnabled]];
tableRowsSelectable = YES;
@@ -3651,8 +3706,6 @@
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
- if([tablesListInstance tableType] == SPTableTypeView) return;
-
NSString *fieldType;
NSUInteger row, column, i;
@@ -3664,73 +3717,98 @@
{
[[control window] makeFirstResponder:control];
- // Save the current line if it's the last field in the table
- if ( column == ( [tableContentView numberOfColumns] - 1 ) ) {
- [self addRowToDB];
+ if([tablesListInstance tableType] == SPTableTypeView) {
+ // Check if next column is a blob column or not editable, and skip to the next non-blob column and editable field
+ if ( column != ( [tableContentView numberOfColumns] - 1 ) ) {
+ i = 1;
+ while (
+ (fieldType = [[tableDataInstance columnWithName:[[NSArrayObjectAtIndex([tableContentView tableColumns], column+i) headerCell] stringValue]] objectForKey:@"typegrouping"])
+ && ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"])
+ || [self fieldEditStatusForRow:row andColumn:[NSArrayObjectAtIndex([tableContentView tableColumns], column+i) identifier]] != 1
+ ) {
+ i++;
+
+ // If there are no columns after the latest blob or text column, save the current line.
+ if ( (column+i) >= [tableContentView numberOfColumns] ) {
+ return TRUE;
+ }
+ }
+
+ [tableContentView editColumn:column+i row:row withEvent:nil select:YES];
+
+ }
} else {
+ // Save the current line if it's the last field in the table
+ if ( column == ( [tableContentView numberOfColumns] - 1 ) ) {
+ [self addRowToDB];
+ } else {
- // Check if next column is a blob column, and skip to the next non-blob column
- i = 1;
- while (
- (fieldType = [[tableDataInstance columnWithName:[[NSArrayObjectAtIndex([tableContentView tableColumns], column+i) headerCell] stringValue]] objectForKey:@"typegrouping"])
- && ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"])
- ) {
- i++;
-
- // If there are no columns after the latest blob or text column, save the current line.
- if ( (column+i) >= [tableContentView numberOfColumns] ) {
- [self addRowToDB];
- return TRUE;
+ // Check if next column is a blob column, and skip to the next non-blob column
+ i = 1;
+ while (
+ (fieldType = [[tableDataInstance columnWithName:[[NSArrayObjectAtIndex([tableContentView tableColumns], column+i) headerCell] stringValue]] objectForKey:@"typegrouping"])
+ && ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"])
+ ) {
+ i++;
+
+ // If there are no columns after the latest blob or text column, save the current line.
+ if ( (column+i) >= [tableContentView numberOfColumns] ) {
+ [self addRowToDB];
+ return TRUE;
+ }
}
- }
- // Edit the column after the blob column
- [tableContentView editColumn:column+i row:row withEvent:nil select:YES];
+ // Edit the column after the blob column
+ [tableContentView editColumn:column+i row:row withEvent:nil select:YES];
+ }
}
return TRUE;
}
-
- // Trap enter key
- else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] )
- {
- [[control window] makeFirstResponder:control];
- [self addRowToDB];
+
+ // Trap enter key
+ else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] )
+ {
+ [[control window] makeFirstResponder:control];
+ if([tablesListInstance tableType] != SPTableTypeView)
+ [self addRowToDB];
return TRUE;
- }
-
- // Trap down arrow key
- else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveDown:)] )
- {
- NSUInteger newRow = row+1;
- if (newRow>=tableRowsCount) return TRUE; //check if we're already at the end of the list
-
- [[control window] makeFirstResponder:control];
- [self addRowToDB];
-
- if (newRow>=tableRowsCount) return TRUE; //check again. addRowToDB could reload the table and change the number of rows
- if (column>=[tableValues columnCount]) return TRUE; //the column count could change too
-
- [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
- [tableContentView editColumn:column row:newRow withEvent:nil select:YES];
+ }
+
+ // Trap down arrow key
+ else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveDown:)] )
+ {
+ NSUInteger newRow = row+1;
+ if (newRow>=tableRowsCount) return TRUE; //check if we're already at the end of the list
+
+ [[control window] makeFirstResponder:control];
+ if([tablesListInstance tableType] != SPTableTypeView)
+ [self addRowToDB];
+
+ if (newRow>=tableRowsCount) return TRUE; //check again. addRowToDB could reload the table and change the number of rows
+ if (column>=[tableValues columnCount]) return TRUE; //the column count could change too
+
+ [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
+ [tableContentView editColumn:column row:newRow withEvent:nil select:YES];
return TRUE;
- }
-
- // Trap up arrow key
- else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveUp:)] )
- {
- if (row==0) return TRUE; //already at the beginning of the list
- NSUInteger newRow = row-1;
-
- [[control window] makeFirstResponder:control];
- [self addRowToDB];
-
- if (newRow>=tableRowsCount) return TRUE; // addRowToDB could reload the table and change the number of rows
- if (column>=[tableValues columnCount]) return TRUE; //the column count could change too
-
- [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
- [tableContentView editColumn:column row:newRow withEvent:nil select:YES];
+ }
+
+ // Trap up arrow key
+ else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveUp:)] )
+ {
+ if (row==0) return TRUE; //already at the beginning of the list
+ NSUInteger newRow = row-1;
+
+ [[control window] makeFirstResponder:control];
+ if([tablesListInstance tableType] != SPTableTypeView)
+ [self addRowToDB];
+
+ if (newRow>=tableRowsCount) return TRUE; // addRowToDB could reload the table and change the number of rows
+ if (column>=[tableValues columnCount]) return TRUE; //the column count could change too
+
+ [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
+ [tableContentView editColumn:column row:newRow withEvent:nil select:YES];
return TRUE;
- }
+ }
// Trap the escape key
else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
@@ -3786,12 +3864,12 @@
if ([menuItem action] == @selector(removeRow:)) {
[menuItem setTitle:([tableContentView numberOfSelectedRows] > 1) ? @"Delete Rows" : @"Delete Row"];
- return ([tableContentView numberOfSelectedRows] > 0);
+ return ([tableContentView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SPTableTypeTable);
}
// Duplicate row
if ([menuItem action] == @selector(copyRow:)) {
- return ([tableContentView numberOfSelectedRows] == 1);
+ return ([tableContentView numberOfSelectedRows] == 1 && [tablesListInstance tableType] == SPTableTypeTable);
}
return YES;