diff options
author | stuconnolly <stuart02@gmail.com> | 2010-07-05 21:54:28 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-07-05 21:54:28 +0000 |
commit | 9de3398e48f50646f616893df3eba30211d94eec (patch) | |
tree | edfe3297166f27e5424ff1a9b298eee45ab98ce0 | |
parent | ee39747795b41551509a11fa770d8a937feb5f39 (diff) | |
download | sequelpro-9de3398e48f50646f616893df3eba30211d94eec.tar.gz sequelpro-9de3398e48f50646f616893df3eba30211d94eec.tar.bz2 sequelpro-9de3398e48f50646f616893df3eba30211d94eec.zip |
Enable manual sorting of connection favourites in the preferences, which will disable automatic sorting. Also, connection favourites sort order in the preferences and the connection view should now be in sync. Needs thoroughly tested. Fixes issue #655.
-rw-r--r-- | Interfaces/English.lproj/ConnectionView.xib | 279 | ||||
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 60 | ||||
-rw-r--r-- | Source/SPConnectionController.h | 4 | ||||
-rw-r--r-- | Source/SPConnectionController.m | 114 | ||||
-rw-r--r-- | Source/SPPreferenceController.h | 1 | ||||
-rw-r--r-- | Source/SPPreferenceController.m | 36 |
6 files changed, 387 insertions, 107 deletions
diff --git a/Interfaces/English.lproj/ConnectionView.xib b/Interfaces/English.lproj/ConnectionView.xib index 34a56f74..7985272a 100644 --- a/Interfaces/English.lproj/ConnectionView.xib +++ b/Interfaces/English.lproj/ConnectionView.xib @@ -2,10 +2,10 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">10D573</string> - <string key="IBDocument.InterfaceBuilderVersion">762</string> + <string key="IBDocument.SystemVersion">10F569</string> + <string key="IBDocument.InterfaceBuilderVersion">788</string> <string key="IBDocument.AppKitVersion">1038.29</string> - <string key="IBDocument.HIToolboxVersion">460.00</string> + <string key="IBDocument.HIToolboxVersion">461.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> @@ -15,14 +15,13 @@ </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>762</string> + <string>788</string> <string>1.2.5</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="5343"/> - <integer value="5468"/> + <integer value="5481"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -360,6 +359,7 @@ </object> </object> </object> + <int key="NSSelectedIndex">1</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -2770,6 +2770,14 @@ </object> <int key="connectionID">5490</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoritesSortByMenuItem</string> + <reference key="source" ref="545410097"/> + <reference key="destination" ref="623685715"/> + </object> + <int key="connectionID">5491</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -4074,7 +4082,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{77, 293}, {882, 563}}</string> + <string>{{603, 184}, {882, 563}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> @@ -4421,11 +4429,11 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.brandonwalkin.BWToolkit</string> <string>com.brandonwalkin.BWToolkit</string> - <string>{{96, 279}, {97, 37}}</string> + <string>{{591, 171}, {97, 37}}</string> <string>com.brandonwalkin.BWToolkit</string> <string>com.brandonwalkin.BWToolkit</string> <string>com.brandonwalkin.BWToolkit</string> - <string>{{193, 206}, {180, 93}}</string> + <string>{{688, 98}, {180, 93}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -4450,7 +4458,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">5490</int> + <int key="maxID">5491</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -4546,6 +4554,13 @@ <string key="NS.key.0">toggleCollapse:</string> <string key="NS.object.0">id</string> </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <string key="NS.key.0">toggleCollapse:</string> + <object class="IBActionInfo" key="NS.object.0"> + <string key="name">toggleCollapse:</string> + <string key="candidateClassName">id</string> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">Source/SPTablesList.h</string> @@ -4588,6 +4603,80 @@ <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>doDecomposedStringWithCanonicalMapping:</string> + <string>doDecomposedStringWithCompatibilityMapping:</string> + <string>doPrecomposedStringWithCanonicalMapping:</string> + <string>doPrecomposedStringWithCompatibilityMapping:</string> + <string>doRemoveDiacritics:</string> + <string>doSelectionLowerCase:</string> + <string>doSelectionTitleCase:</string> + <string>doSelectionUpperCase:</string> + <string>doTranspose:</string> + <string>insertNULLvalue:</string> + <string>selectCurrentLine:</string> + <string>selectCurrentWord:</string> + <string>selectEnclosingBrackets:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBActionInfo"> + <string key="name">doDecomposedStringWithCanonicalMapping:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doDecomposedStringWithCompatibilityMapping:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doPrecomposedStringWithCanonicalMapping:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doPrecomposedStringWithCompatibilityMapping:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doRemoveDiacritics:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doSelectionLowerCase:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doSelectionTitleCase:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doSelectionUpperCase:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">doTranspose:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">insertNULLvalue:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">selectCurrentLine:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">selectCurrentWord:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">selectEnclosingBrackets:</string> + <string key="candidateClassName">id</string> + </object> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">Source/SPTextViewAdditions.h</string> @@ -4626,6 +4715,50 @@ <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>addFavorite:</string> + <string>editFavorites:</string> + <string>initiateConnection:</string> + <string>reverseSortFavorites:</string> + <string>showHelp:</string> + <string>sortFavorites:</string> + <string>updateFavoriteSelection:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBActionInfo"> + <string key="name">addFavorite:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">editFavorites:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">initiateConnection:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">reverseSortFavorites:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">showHelp:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">sortFavorites:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">updateFavoriteSelection:</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"> @@ -4639,6 +4772,7 @@ <string>delegate</string> <string>errorDetailText</string> <string>errorDetailWindow</string> + <string>favoritesSortByMenuItem</string> <string>favoritesTable</string> <string>helpButton</string> <string>progressIndicator</string> @@ -4664,6 +4798,7 @@ <string>id</string> <string>NSTextView</string> <string>NSWindow</string> + <string>NSMenuItem</string> <string>NSTableView</string> <string>NSButton</string> <string>NSProgressIndicator</string> @@ -4679,6 +4814,130 @@ <string>NSTextField</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>addToFavoritesButton</string> + <string>connectButton</string> + <string>connectionResizeContainer</string> + <string>connectionSplitView</string> + <string>connectionSplitViewButtonBar</string> + <string>connectionView</string> + <string>delegate</string> + <string>errorDetailText</string> + <string>errorDetailWindow</string> + <string>favoritesSortByMenuItem</string> + <string>favoritesTable</string> + <string>helpButton</string> + <string>progressIndicator</string> + <string>progressIndicatorText</string> + <string>socketConnectionFormContainer</string> + <string>socketPasswordField</string> + <string>sshConnectionFormContainer</string> + <string>sshPasswordField</string> + <string>sshSQLHostField</string> + <string>sshSSHPasswordField</string> + <string>standardConnectionFormContainer</string> + <string>standardPasswordField</string> + <string>standardSQLHostField</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBToOneOutletInfo"> + <string key="name">addToFavoritesButton</string> + <string key="candidateClassName">NSButton</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">connectButton</string> + <string key="candidateClassName">NSButton</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">connectionResizeContainer</string> + <string key="candidateClassName">NSView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">connectionSplitView</string> + <string key="candidateClassName">NSSplitView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">connectionSplitViewButtonBar</string> + <string key="candidateClassName">BWAnchoredButtonBar</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">connectionView</string> + <string key="candidateClassName">NSView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">delegate</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">errorDetailText</string> + <string key="candidateClassName">NSTextView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">errorDetailWindow</string> + <string key="candidateClassName">NSWindow</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">favoritesSortByMenuItem</string> + <string key="candidateClassName">NSMenuItem</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">favoritesTable</string> + <string key="candidateClassName">NSTableView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">helpButton</string> + <string key="candidateClassName">NSButton</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">progressIndicator</string> + <string key="candidateClassName">NSProgressIndicator</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">progressIndicatorText</string> + <string key="candidateClassName">NSTextField</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">socketConnectionFormContainer</string> + <string key="candidateClassName">NSView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">socketPasswordField</string> + <string key="candidateClassName">NSSecureTextField</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">sshConnectionFormContainer</string> + <string key="candidateClassName">NSView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">sshPasswordField</string> + <string key="candidateClassName">NSSecureTextField</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">sshSQLHostField</string> + <string key="candidateClassName">NSTextField</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">sshSSHPasswordField</string> + <string key="candidateClassName">NSSecureTextField</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">standardConnectionFormContainer</string> + <string key="candidateClassName">NSView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">standardPasswordField</string> + <string key="candidateClassName">NSSecureTextField</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">standardSQLHostField</string> + <string key="candidateClassName">NSTextField</string> + </object> + </object> + </object> <reference key="sourceIdentifier" ref="968459546"/> </object> <object class="IBPartialClassDescription"> diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index e94835d8..08a3fb4f 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -21,7 +21,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1"/> + <integer value="1590"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -63,6 +63,7 @@ <int key="NSvFlags">256</int> <string key="NSFrameSize">{580, 172}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{580, 72}</string> @@ -605,7 +606,7 @@ <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">12</int> <string key="NSFrame">{{202.5, 176}, {360, 5}}</string> - <string key="NSBounds">{{0.5, 0}, {359, 5}}</string> + <string key="NSBounds">{{1, 0}, {358, 5}}</string> <reference key="NSSuperview" ref="594324362"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -1522,7 +1523,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{-1, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="1068562664"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="907732055"> <int key="NSCellFlags">67239424</int> @@ -1547,7 +1547,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{30, -1}, {32, 24}}</string> <reference key="NSSuperview" ref="1068562664"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="BWAnchoredPopUpButtonCell" key="NSCell" id="858997662"> <int key="NSCellFlags">71433792</int> @@ -1693,7 +1692,6 @@ </object> <string key="NSFrameSize">{229, 23}</string> <reference key="NSSuperview" ref="984943037"/> - <reference key="NSWindow"/> <bool key="BWABBIsResizable">YES</bool> <bool key="BWABBIsAtBottom">YES</bool> <bool key="BWABBHandleIsRightAligned">NO</bool> @@ -1714,7 +1712,6 @@ <int key="NSvFlags">4370</int> <string key="NSFrameSize">{230, 358}</string> <reference key="NSSuperview" ref="253139122"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -1826,7 +1823,6 @@ </object> <string key="NSFrame">{{1, 1}, {230, 358}}</string> <reference key="NSSuperview" ref="533802223"/> - <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="279932544"/> <reference key="NSDocView" ref="279932544"/> <reference key="NSBGColor" ref="887465699"/> @@ -1837,7 +1833,6 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{183, 1}, {11, 317}}</string> <reference key="NSSuperview" ref="533802223"/> - <reference key="NSWindow"/> <int key="NSsFlags">256</int> <reference key="NSTarget" ref="533802223"/> <string key="NSAction">_doScroller:</string> @@ -1848,7 +1843,6 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {311, 15}}</string> <reference key="NSSuperview" ref="533802223"/> - <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="533802223"/> <string key="NSAction">_doScroller:</string> @@ -1857,7 +1851,6 @@ </object> <string key="NSFrame">{{-2, 22}, {232, 360}}</string> <reference key="NSSuperview" ref="984943037"/> - <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="253139122"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="940130901"/> @@ -1868,7 +1861,6 @@ </object> <string key="NSFrameSize">{229, 381}</string> <reference key="NSSuperview" ref="141072039"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="343315962"> @@ -1881,7 +1873,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{-7, 34}, {370, 282}}</string> <reference key="NSSuperview" ref="343315962"/> - <reference key="NSWindow"/> <object class="NSMutableArray" key="NSTabViewItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTabViewItem" id="912523923"> @@ -2233,7 +2224,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 59}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="882064965"> <int key="NSCellFlags">-1804468671</int> @@ -2251,7 +2241,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 33}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="996160392"> <int key="NSCellFlags">-1804468671</int> @@ -2269,7 +2258,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 85}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="782045166"> <int key="NSCellFlags">-1804468671</int> @@ -2287,7 +2275,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 7}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="160881703"> <int key="NSCellFlags">-1804468671</int> @@ -2306,7 +2293,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 61}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="544940669"> <int key="NSCellFlags">68288064</int> @@ -2323,7 +2309,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 35}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="26059905"> <int key="NSCellFlags">68288064</int> @@ -2340,7 +2325,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 87}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="642636551"> <int key="NSCellFlags">68288064</int> @@ -2357,7 +2341,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 9}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="646676137"> <int key="NSCellFlags">68288064</int> @@ -2374,7 +2357,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 153}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="98025404"> <int key="NSCellFlags">-1804468671</int> @@ -2393,7 +2375,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 180}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSSecureTextFieldCell" key="NSCell" id="682598366"> <int key="NSCellFlags">343014976</int> @@ -2415,7 +2396,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 207}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="983072894"> <int key="NSCellFlags">-1804468671</int> @@ -2433,7 +2413,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 126}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1015235520"> <int key="NSCellFlags">-1804468671</int> @@ -2452,7 +2431,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 234}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="153943465"> <int key="NSCellFlags">-1804468671</int> @@ -2470,7 +2448,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 236}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="528636141"> <int key="NSCellFlags">68288064</int> @@ -2487,7 +2464,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 209}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1047551041"> <int key="NSCellFlags">68288064</int> @@ -2504,7 +2480,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 155}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="860519796"> <int key="NSCellFlags">68288064</int> @@ -2521,7 +2496,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 182}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="33269254"> <int key="NSCellFlags">68288064</int> @@ -2538,7 +2512,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 128}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="596887118"> <int key="NSCellFlags">68288064</int> @@ -2553,7 +2526,6 @@ </object> <string key="NSFrame">{{10, 7}, {335, 262}}</string> <reference key="NSSuperview" ref="961025550"/> - <reference key="NSWindow"/> </object> <string key="NSLabel">SSH</string> <reference key="NSColor" ref="700609571"/> @@ -2574,7 +2546,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{112, 342}, {218, 19}}</string> <reference key="NSSuperview" ref="343315962"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="570809913"> <int key="NSCellFlags">-1804468671</int> @@ -2592,7 +2563,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{9, 344}, {98, 14}}</string> <reference key="NSSuperview" ref="343315962"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="299715951"> <int key="NSCellFlags">68288064</int> @@ -2609,7 +2579,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{109, 313}, {224, 22}}</string> <reference key="NSSuperview" ref="343315962"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="658054386"> <int key="NSCellFlags">-2076049856</int> @@ -2676,7 +2645,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{9, 318}, {98, 14}}</string> <reference key="NSSuperview" ref="343315962"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="761091734"> <int key="NSCellFlags">68288064</int> @@ -2691,20 +2659,17 @@ </object> <string key="NSFrame">{{230, 0}, {350, 381}}</string> <reference key="NSSuperview" ref="141072039"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{580, 381}</string> <reference key="NSSuperview" ref="593732956"/> - <reference key="NSWindow"/> <bool key="NSIsVertical">YES</bool> <int key="NSDividerStyle">2</int> </object> </object> <string key="NSFrameSize">{580, 381}</string> <reference key="NSSuperview"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1041614321"> @@ -6688,6 +6653,14 @@ AQAAAAA</bytes> </object> <int key="connectionID">1641</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoritesSortByMenuItem</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="14003497"/> + </object> + <int key="connectionID">1642</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -10238,7 +10211,7 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.brandonwalkin.BWToolkit</string> - <string>{{427, 109}, {124, 81}}</string> + <string>{{339, 317}, {124, 81}}</string> <string>com.brandonwalkin.BWToolkit</string> <string>com.brandonwalkin.BWToolkit</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -10611,7 +10584,7 @@ AQAAAAA</bytes> </object> </object> <nil key="sourceID"/> - <int key="maxID">1641</int> + <int key="maxID">1642</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -10903,6 +10876,7 @@ AQAAAAA</bytes> <string>favoriteUserTextFieldSSH</string> <string>favoriteUserTextFieldSocket</string> <string>favoritesController</string> + <string>favoritesSortByMenuItem</string> <string>favoritesTabView</string> <string>favoritesTableView</string> <string>favoritesView</string> @@ -10932,6 +10906,7 @@ AQAAAAA</bytes> <string>NSTextField</string> <string>NSTextField</string> <string>NSArrayController</string> + <string>NSMenuItem</string> <string>NSTabView</string> <string>NSTableView</string> <string>NSView</string> @@ -10964,6 +10939,7 @@ AQAAAAA</bytes> <string>favoriteUserTextFieldSSH</string> <string>favoriteUserTextFieldSocket</string> <string>favoritesController</string> + <string>favoritesSortByMenuItem</string> <string>favoritesTabView</string> <string>favoritesTableView</string> <string>favoritesView</string> @@ -11027,6 +11003,10 @@ AQAAAAA</bytes> <string key="candidateClassName">NSArrayController</string> </object> <object class="IBToOneOutletInfo"> + <string key="name">favoritesSortByMenuItem</string> + <string key="candidateClassName">NSMenuItem</string> + </object> + <object class="IBToOneOutletInfo"> <string key="name">favoritesTabView</string> <string key="candidateClassName">NSTabView</string> </object> diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h index 6d1f23ed..edf6f5fd 100644 --- a/Source/SPConnectionController.h +++ b/Source/SPConnectionController.h @@ -114,8 +114,10 @@ IBOutlet NSButton *helpButton; IBOutlet NSProgressIndicator *progressIndicator; IBOutlet NSTextField *progressIndicatorText; - + IBOutlet NSMenuItem *favoritesSortByMenuItem; + BOOL reverseFavoritesSort; + SPFavoritesSortItem previousSortItem, currentSortItem; } diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index ee3bb724..a270a716 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -114,13 +114,10 @@ [favoritesTable setDraggingSourceOperationMask:NSDragOperationMove forLocal:YES]; // Sort the favourites to match prefs and select the appropriate row - [self _sortFavorites]; - NSInteger tableRow; - if ([prefs boolForKey:SPSelectLastFavoriteUsed] == YES) { - tableRow = [prefs integerForKey:SPLastFavoriteIndex] + 1; - } else { - tableRow = [prefs integerForKey:SPDefaultFavorite] + 1; - } + if (currentSortItem > -1) [self _sortFavorites]; + + NSInteger tableRow = ([prefs integerForKey:[prefs boolForKey:SPSelectLastFavoriteUsed] ? SPLastFavoriteIndex : SPDefaultFavorite] + 1); + if (tableRow < [favorites count]) { previousType = [[[favorites objectAtIndex:tableRow] objectForKey:@"type"] integerValue]; [self resizeTabViewToConnectionType:[[[favorites objectAtIndex:tableRow] objectForKey:@"type"] integerValue] animating:NO]; @@ -679,9 +676,9 @@ // Perform sorting [self _sortFavorites]; - [[[sender menu] itemAtIndex:previousSortItem] setState:NSOffState]; + if (previousSortItem > -1) [[[sender menu] itemAtIndex:previousSortItem] setState:NSOffState]; + [[[sender menu] itemAtIndex:currentSortItem] setState:NSOnState]; - } /** @@ -891,29 +888,49 @@ } #pragma mark - -#pragma mark Favorites tableview datasource and delegate methods +#pragma mark TableView drag & drop delegate methods -/** - * Returns the number of favorites to display - */ -- (NSInteger) numberOfRowsInTableView:(NSTableView *)aTableView +- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard { - return [favorites count]; + NSData *archivedData = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes]; + [pboard declareTypes:[NSArray arrayWithObject:favoritesPBoardType] owner:self]; + [pboard setData:archivedData forType:favoritesPBoardType]; + return YES; } -/** - * Returns the favorite names to be displayed in the table - */ -- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex +- (NSDragOperation)tableView:(NSTableView *)aTableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation { - return [[favorites objectAtIndex:rowIndex] objectForKey:@"name"]; + if (row == 0) return NSDragOperationNone; + if ([info draggingSource] == aTableView) + { + [aTableView setDropRow:row dropOperation:NSTableViewDropAbove]; + return NSDragOperationMove; + } + return NSDragOperationNone; } -- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id < NSDraggingInfo >)info - row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation +- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation { BOOL acceptedDrop = NO; - if ((row == 0) || ([info draggingSource] != aTableView)) return acceptedDrop; + + if ((row == 0) || ([info draggingSource] != aTableView)) return acceptedDrop; + + // Disable all automatic sorting + currentSortItem = -1; + reverseFavoritesSort = NO; + + [prefs setInteger:currentSortItem forKey:SPFavoritesSortedBy]; + [prefs setBool:NO forKey:SPFavoritesSortedInReverse]; + + // Remove sort descriptors + [favorites sortUsingDescriptors:[NSArray array]]; + + // Uncheck sort by menu items + for (NSMenuItem *menuItem in [[favoritesSortByMenuItem submenu] itemArray]) + { + [menuItem setState:NSOffState]; + } + NSPasteboard* pboard = [info draggingPasteboard]; NSData* rowData = [pboard dataForType:favoritesPBoardType]; NSIndexSet* rowIndexes = [NSKeyedUnarchiver unarchiveObjectWithData:rowData]; @@ -932,39 +949,45 @@ [favorites insertObject:draggedFavorite atIndex:row]; [aTableView reloadData]; [aTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; - // reset the prefs with the new order + + // reset the prefs with the new order NSMutableArray *reorderedFavorites = [[NSMutableArray alloc] initWithArray:favorites]; [reorderedFavorites removeObjectAtIndex:0]; [prefs setObject:reorderedFavorites forKey:SPFavorites]; + [[[NSApp delegate] preferenceController] updateDefaultFavoritePopup]; - [reorderedFavorites release]; - [self updateFavorites]; - acceptedDrop = YES; + + [reorderedFavorites release]; + + [self updateFavorites]; + + acceptedDrop = YES; + return acceptedDrop; - } -- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes - toPasteboard:(NSPasteboard *)pboard +#pragma mark - +#pragma mark Favorites tableview datasource methods + +/** + * Returns the number of favorites to display + */ +- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { - NSData *archivedData = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes]; - [pboard declareTypes:[NSArray arrayWithObject:favoritesPBoardType] owner:self]; - [pboard setData:archivedData forType:favoritesPBoardType]; - return YES; + return [favorites count]; } -- (NSDragOperation)tableView:(NSTableView *)aTableView validateDrop:(id < NSDraggingInfo >)info - proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation +/** + * Returns the favorite names to be displayed in the table + */ +- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { - if (row == 0) return NSDragOperationNone; - if ([info draggingSource] == aTableView) - { - [aTableView setDropRow:row dropOperation:NSTableViewDropAbove]; - return NSDragOperationMove; - } - return NSDragOperationNone; + return [[favorites objectAtIndex:rowIndex] objectForKey:@"name"]; } +#pragma mark - +#pragma mark Favorites tableview delegate methods + /** * Loads a favorite, if any are selected. */ @@ -1021,7 +1044,7 @@ #pragma mark - -#pragma mark NSSplitView delegate methods +#pragma mark SplitView delegate methods /** * When the split view is resized, trigger a resize in the hidden table @@ -1032,6 +1055,7 @@ - (CGFloat)splitView:(NSSplitView *)splitView constrainSplitPosition:(CGFloat)proposedPosition ofSubviewAt:(NSInteger)dividerIndex { [databaseConnectionView setPosition:[[[connectionSplitView subviews] objectAtIndex:0] frame].size.width ofDividerAtIndex:0]; + return proposedPosition; } @@ -1131,6 +1155,4 @@ return YES; } - - @end diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h index c2b4b18a..cf9d2cc1 100644 --- a/Source/SPPreferenceController.h +++ b/Source/SPPreferenceController.h @@ -57,6 +57,7 @@ IBOutlet NSTextField *favoriteUserTextFieldSocket; IBOutlet NSTextField *favoriteUserTextFieldSSH; IBOutlet NSTextField *favoriteHostTextFieldSSH; + IBOutlet NSMenuItem *favoritesSortByMenuItem; IBOutlet id tableCell; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 66dc2597..ab8ec067 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -98,7 +98,9 @@ [prefs synchronize]; - [self _sortFavorites]; + if (currentSortItem > -1) { + [self _sortFavorites]; + } } #pragma mark - @@ -456,7 +458,7 @@ * Sorts the favorites table view based on the selected sort by item */ - (IBAction)sortFavorites:(id)sender -{ +{ previousSortItem = currentSortItem; currentSortItem = [[sender menu] indexOfItem:sender]; @@ -465,8 +467,9 @@ // Perform sorting [self _sortFavorites]; - [[[sender menu] itemAtIndex:previousSortItem] setState:NSOffState]; - [[[sender menu] itemAtIndex:currentSortItem] setState:NSOnState]; + if (previousSortItem > -1) [[[sender menu] itemAtIndex:previousSortItem] setState:NSOffState]; + + [[[sender menu] itemAtIndex:currentSortItem] setState:NSOnState]; } /** @@ -621,12 +624,12 @@ } #pragma mark - -#pragma mark TableView drag & drop datasource methods +#pragma mark TableView drag & drop delegate methods // ------------------------------------------------------------------------------- // tableView:writeRowsWithIndexes:toPasteboard: // ------------------------------------------------------------------------------- -/*- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rows toPasteboard:(NSPasteboard*)pboard +- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rows toPasteboard:(NSPasteboard*)pboard { if ([rows count] == 1) { [pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:nil]; @@ -670,6 +673,22 @@ NSInteger lastFavoriteIndexCached; NSMutableDictionary *draggedRow; + // Disable all automatic sorting + currentSortItem = -1; + reverseFavoritesSort = NO; + + [prefs setInteger:currentSortItem forKey:SPFavoritesSortedBy]; + [prefs setBool:NO forKey:SPFavoritesSortedInReverse]; + + // Remove sort descriptors + [favoritesController setSortDescriptors:[NSArray array]]; + + // Uncheck sort by menu items + for (NSMenuItem *menuItem in [[favoritesSortByMenuItem submenu] itemArray]) + { + [menuItem setState:NSOffState]; + } + originalRow = [[[info draggingPasteboard] stringForType:SPFavoritesPasteboardDragType] integerValue]; destinationRow = row; @@ -701,7 +720,7 @@ [self updateDefaultFavoritePopup]; return YES; -}*/ +} #pragma mark - #pragma mark TableView delegate methods @@ -1384,9 +1403,6 @@ case SPFavoritesSortTypeItem: sortKey = @"type"; break; - default: - sortKey = @"name"; - break; } NSSortDescriptor *sortDescriptor = nil; |