diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-07-31 11:13:50 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-07-31 11:13:50 +0000 |
commit | 43f758956eefb4525766f53d6c32ca4caab473a1 (patch) | |
tree | e8530fe3d682f41b0e46129a99f819e18c2996b9 | |
parent | 9d771214d578c0c81288969191d43b1a597fe7f2 (diff) | |
download | sequelpro-43f758956eefb4525766f53d6c32ca4caab473a1.tar.gz sequelpro-43f758956eefb4525766f53d6c32ca4caab473a1.tar.bz2 sequelpro-43f758956eefb4525766f53d6c32ca4caab473a1.zip |
• Favorite Preferences - Favorite name issues fixed:
- Trap and control the 'name' field of the new added favorite. If the user pressed 'Add Favorite' the 'name' field is set to "New Favorite". If the user do not change the 'name' field or the user deletes the field content it will be set to user@host automatically. This also fixes the issue for empty names.
- focus is set to 'Host' field after "Add Favorite"
- focus is set to 'Name' field after "Duplicate Favorite"
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 238 | ||||
-rw-r--r-- | Source/SPPreferenceController.h | 9 | ||||
-rw-r--r-- | Source/SPPreferenceController.m | 74 |
3 files changed, 292 insertions, 29 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index c5d5fa59..466f74a7 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -8,7 +8,6 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="60"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -686,8 +685,8 @@ <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">.</string> - <string key="NS.thousand">,</string> + <string key="NS.decimal">,</string> + <string key="NS.thousand">.</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">NO</bool> @@ -921,8 +920,8 @@ <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">.</string> - <string key="NS.thousand">,</string> + <string key="NS.decimal">,</string> + <string key="NS.thousand">.</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">NO</bool> @@ -1105,7 +1104,7 @@ <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="593732956"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1124,6 +1123,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{62, -1}, {33, 25}}</string> <reference key="NSSuperview" ref="984943037"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="318654291"> <int key="NSCellFlags">67239424</int> @@ -1148,6 +1148,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{0, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="984943037"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="445051430"> <int key="NSCellFlags">67239424</int> @@ -1172,6 +1173,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{31, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="984943037"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="388903914"> <int key="NSCellFlags">67239424</int> @@ -1206,6 +1208,7 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{198, 358}</string> <reference key="NSSuperview" ref="253139122"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -1287,6 +1290,7 @@ </object> <string key="NSFrame">{{1, 1}, {198, 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"/> @@ -1297,6 +1301,7 @@ <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> @@ -1307,6 +1312,7 @@ <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> @@ -1315,6 +1321,7 @@ </object> <string key="NSFrame">{{-2, 22}, {200, 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"/> @@ -1339,6 +1346,7 @@ </object> <string key="NSFrame">{{95, 0}, {102, 23}}</string> <reference key="NSSuperview" ref="984943037"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="578184809"> <int key="NSCellFlags">130560</int> @@ -1357,6 +1365,7 @@ </object> <string key="NSFrameSize">{197, 381}</string> <reference key="NSSuperview" ref="141072039"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="343315962"> @@ -1369,12 +1378,13 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{-7, 34}, {322, 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"> <string key="NSIdentifier">1</string> <object class="NSView" key="NSView" id="922389102"> - <reference key="NSNextResponder" ref="961025550"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1551,7 +1561,6 @@ </object> </object> <string key="NSFrame">{{10, 7}, {287, 262}}</string> - <reference key="NSSuperview" ref="961025550"/> </object> <string key="NSLabel">Standard</string> <reference key="NSColor" ref="700609571"/> @@ -1712,7 +1721,7 @@ <object class="NSTabViewItem" id="682271284"> <string key="NSIdentifier">Item 2</string> <object class="NSView" key="NSView" id="404987940"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder" ref="961025550"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1721,6 +1730,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 59}, {135, 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> @@ -1738,6 +1748,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 33}, {135, 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> @@ -1755,6 +1766,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 85}, {135, 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> @@ -1772,6 +1784,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 7}, {135, 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> @@ -1790,6 +1803,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{59, 61}, {55, 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> @@ -1806,6 +1820,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{33, 35}, {81, 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> @@ -1822,6 +1837,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{58, 87}, {56, 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> @@ -1838,6 +1854,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{54, 9}, {60, 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> @@ -1854,6 +1871,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 153}, {135, 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> @@ -1872,6 +1890,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 180}, {135, 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> @@ -1893,6 +1912,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 207}, {135, 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> @@ -1910,6 +1930,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 126}, {135, 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> @@ -1928,6 +1949,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 234}, {135, 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> @@ -1945,6 +1967,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{42, 236}, {72, 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> @@ -1961,6 +1984,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{53, 209}, {61, 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> @@ -1977,6 +2001,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{57, 155}, {57, 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> @@ -1993,6 +2018,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{56, 182}, {58, 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> @@ -2009,6 +2035,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{85, 128}, {29, 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> @@ -2022,19 +2049,21 @@ </object> </object> <string key="NSFrame">{{10, 7}, {287, 262}}</string> + <reference key="NSSuperview" ref="961025550"/> + <reference key="NSWindow"/> </object> <string key="NSLabel">SSH</string> <reference key="NSColor" ref="700609571"/> <reference key="NSTabView" ref="961025550"/> </object> </object> - <reference key="NSSelectedTabViewItem" ref="912523923"/> + <reference key="NSSelectedTabViewItem" ref="682271284"/> <reference key="NSFont" ref="26"/> <int key="NSTvFlags">134217731</int> <bool key="NSAllowTruncatedLabels">YES</bool> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="922389102"/> + <reference ref="404987940"/> </object> </object> <object class="NSTextField" id="415835787"> @@ -2042,6 +2071,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{112, 342}, {170, 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> @@ -2059,6 +2089,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{68, 344}, {39, 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> @@ -2075,6 +2106,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{109, 313}, {176, 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> @@ -2141,6 +2173,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{68, 318}, {39, 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> @@ -2155,20 +2188,24 @@ </object> <string key="NSFrame">{{198, 0}, {302, 381}}</string> <reference key="NSSuperview" ref="141072039"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{500, 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">{500, 381}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1041614321"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2177,7 +2214,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 81}, {187, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1060471631"> <int key="NSCellFlags">67239424</int> @@ -2200,7 +2236,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 44}, {334, 5}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -2223,7 +2258,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 58}, {261, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="695439962"> <int key="NSCellFlags">67239424</int> @@ -2246,7 +2280,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 18}, {207, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="641765383"> <int key="NSCellFlags">67239424</int> @@ -2269,7 +2302,6 @@ <int key="NSvFlags">-2147483380</int> <string key="NSFrame">{{180, -5}, {77, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="135236421"> <int key="NSCellFlags">67239424</int> @@ -2292,7 +2324,6 @@ <int key="NSvFlags">-2147483380</int> <string key="NSFrame">{{180, -28}, {123, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="510254021"> <int key="NSCellFlags">67239424</int> @@ -2315,7 +2346,6 @@ <int key="NSvFlags">-2147483380</int> <string key="NSFrame">{{180, -51}, {154, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="29352039"> <int key="NSCellFlags">67239424</int> @@ -2338,7 +2368,6 @@ <int key="NSvFlags">-2147483380</int> <string key="NSFrame">{{180, -74}, {63, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="545580787"> <int key="NSCellFlags">67239424</int> @@ -2358,12 +2387,10 @@ </object> </object> <string key="NSFrameSize">{500, 117}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="369742224"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2590,7 +2617,6 @@ AQAAAAA</bytes> </object> </object> <string key="NSFrameSize">{500, 153}</string> - <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="769132533"> @@ -2687,8 +2713,8 @@ AQAAAAA</bytes> <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">.</string> - <string key="NS.thousand">,</string> + <string key="NS.decimal">,</string> + <string key="NS.thousand">.</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">YES</bool> @@ -5458,6 +5484,54 @@ AQAAAAA</bytes> </object> <int key="connectionID">1368</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoriteHostTextField</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="77492794"/> + </object> + <int key="connectionID">1373</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoriteUserTextField</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="133134378"/> + </object> + <int key="connectionID">1374</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoriteNameTextField</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="415835787"/> + </object> + <int key="connectionID">1375</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoriteUserTextFieldSocket</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="119091130"/> + </object> + <int key="connectionID">1376</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoriteHostTextFieldSSH</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="619305072"/> + </object> + <int key="connectionID">1377</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">favoriteUserTextFieldSSH</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="917213113"/> + </object> + <int key="connectionID">1378</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -8410,7 +8484,7 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{402, 220}, {500, 381}}</string> + <string>{{427, 341}, {500, 381}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -8581,7 +8655,7 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{605, 337}, {500, 153}}</string> + <string>{{431, 337}, {500, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -8719,7 +8793,7 @@ AQAAAAA</bytes> </object> </object> <nil key="sourceID"/> - <int key="maxID">1368</int> + <int key="maxID">1378</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -8873,6 +8947,112 @@ AQAAAAA</bytes> </object> </object> <object class="IBPartialClassDescription"> + <string key="className">SPPreferenceController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addFavorite:</string> + <string>changeFont:</string> + <string>displayAutoUpdatePreferences:</string> + <string>displayEditorPreferences:</string> + <string>displayFavoritePreferences:</string> + <string>displayGeneralPreferences:</string> + <string>displayNetworkPreferences:</string> + <string>displayNotificationPreferences:</string> + <string>displayTablePreferences:</string> + <string>duplicateFavorite:</string> + <string>favoriteTypeDidChange:</string> + <string>removeFavorite:</string> + <string>saveFavorite:</string> + <string>setDefaultColors:</string> + <string>showCustomQueryFontPanel:</string> + <string>updateDefaultFavorite:</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> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>autoUpdateView</string> + <string>defaultFavoritePopup</string> + <string>editorFontName</string> + <string>editorView</string> + <string>favoriteHostTextField</string> + <string>favoriteHostTextFieldSSH</string> + <string>favoriteHostTextFieldSocket</string> + <string>favoriteNameTextField</string> + <string>favoriteUserTextField</string> + <string>favoriteUserTextFieldSSH</string> + <string>favoriteUserTextFieldSocket</string> + <string>favoritesController</string> + <string>favoritesTabView</string> + <string>favoritesTableView</string> + <string>favoritesView</string> + <string>generalView</string> + <string>networkView</string> + <string>notificationsView</string> + <string>preferencesWindow</string> + <string>socketPasswordField</string> + <string>sshPasswordField</string> + <string>sshSQLPasswordField</string> + <string>standardPasswordField</string> + <string>tablesView</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSView</string> + <string>NSPopUpButton</string> + <string>NSTextField</string> + <string>NSView</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSArrayController</string> + <string>NSTabView</string> + <string>NSTableView</string> + <string>NSView</string> + <string>NSView</string> + <string>NSView</string> + <string>NSView</string> + <string>NSWindow</string> + <string>NSSecureTextField</string> + <string>NSSecureTextField</string> + <string>NSSecureTextField</string> + <string>NSSecureTextField</string> + <string>NSView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../Source/SPPreferenceController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">SUUpdater</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h index f5035787..515221e9 100644 --- a/Source/SPPreferenceController.h +++ b/Source/SPPreferenceController.h @@ -49,6 +49,12 @@ IBOutlet NSSecureTextField *socketPasswordField; IBOutlet NSSecureTextField *sshSQLPasswordField; IBOutlet NSSecureTextField *sshPasswordField; + IBOutlet NSTextField *favoriteNameTextField; + IBOutlet NSTextField *favoriteUserTextField; + IBOutlet NSTextField *favoriteHostTextField; + IBOutlet NSTextField *favoriteUserTextFieldSocket; + IBOutlet NSTextField *favoriteUserTextFieldSSH; + IBOutlet NSTextField *favoriteHostTextFieldSSH; KeyChain *keychain; NSDictionary *currentFavorite; @@ -67,6 +73,9 @@ NSToolbarItem *shortcutItem; NSUserDefaults *prefs; + + BOOL favoriteNameFieldWasTouched; + int favoriteType; } - (void)applyRevisionChanges; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index bf5d9389..79be5318 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -64,6 +64,8 @@ currentFavorite = nil; keychain = nil; + favoriteNameFieldWasTouched = YES; + favoriteType = 0; } return self; @@ -285,6 +287,10 @@ [favoritesTableView reloadData]; [favoritesTableView scrollRowToVisible:[favoritesTableView selectedRow]]; [self updateDefaultFavoritePopup]; + + favoriteNameFieldWasTouched = NO; + + [[self window] makeFirstResponder:favoriteHostTextField]; } // ------------------------------------------------------------------------------- @@ -367,6 +373,8 @@ [favoritesTableView reloadData]; [favoritesTableView scrollRowToVisible:[favoritesTableView selectedRow]]; [self updateDefaultFavoritePopup]; + + [[self window] makeFirstResponder:favoriteNameTextField]; } } @@ -625,6 +633,8 @@ NSString *keychainSSHName = [keychain nameForSSHForFavoriteName:[currentFavorite objectForKey:@"name"] id:[currentFavorite objectForKey:@"id"]]; NSString *keychainSSHAccount = [keychain accountForSSHUser:[currentFavorite objectForKey:@"sshUser"] sshHost:[currentFavorite objectForKey:@"sshHost"]]; [sshPasswordField setStringValue:[keychain getPasswordForName:keychainSSHName account:keychainSSHAccount]]; + + favoriteNameFieldWasTouched = YES; } #pragma mark - @@ -725,6 +735,58 @@ } // ------------------------------------------------------------------------------- +// controlTextDidChange: +// Trap and control the 'name' field of the selected favorite. If the user pressed +// 'Add Favorite' the 'name' field is set to "New Favorite". If the user do not +// change the 'name' field or delete that field it will be set to user@host automatically. +// ------------------------------------------------------------------------------- +- (void)controlTextDidChange:(NSNotification *)aNotification +{ + + id field = [aNotification object]; + BOOL nameFieldIsEmpty = ( + [[favoritesController valueForKeyPath:@"selection.name"] isEqualToString:@""] + || [[favoriteNameTextField stringValue] isEqualToString:@""]); + + switch(favoriteType) { + case 0: + if(nameFieldIsEmpty || (!favoriteNameFieldWasTouched && (field == favoriteUserTextField || field == favoriteHostTextField))) { + [favoriteNameTextField setStringValue:[NSString stringWithFormat:@"%@@%@", [favoriteUserTextField stringValue], [favoriteHostTextField stringValue]]]; + [favoritesController setValue:[favoriteNameTextField stringValue] forKeyPath:@"selection.name"]; + [prefs synchronize]; + // if name field is empty enable user@host update + if(nameFieldIsEmpty) favoriteNameFieldWasTouched = NO; + } + break; + case 1: + if(nameFieldIsEmpty || (!favoriteNameFieldWasTouched && field == favoriteUserTextFieldSocket)) { + [favoriteNameTextField setStringValue:[NSString stringWithFormat:@"%@@%@", [favoriteUserTextFieldSocket stringValue], [favoritesController valueForKeyPath:@"selection.host"]]]; + [favoritesController setValue:[favoriteNameTextField stringValue] forKeyPath:@"selection.name"]; + [prefs synchronize]; + // if name field is empty enable user@host update + if(nameFieldIsEmpty) favoriteNameFieldWasTouched = NO; + } + break; + case 2: + if(nameFieldIsEmpty || (!favoriteNameFieldWasTouched && (field == favoriteUserTextFieldSSH || field == favoriteHostTextFieldSSH))) { + [favoriteNameTextField setStringValue:[NSString stringWithFormat:@"%@@%@", [favoriteUserTextFieldSSH stringValue], [favoriteHostTextFieldSSH stringValue]]]; + [favoritesController setValue:[favoriteNameTextField stringValue] forKeyPath:@"selection.name"]; + [prefs synchronize]; + // if name field is empty enable user@host update + if(nameFieldIsEmpty) favoriteNameFieldWasTouched = NO; + } + break; + default: + break; + } + + + if(field == favoriteNameTextField) { + favoriteNameFieldWasTouched = YES; + } + +} +// ------------------------------------------------------------------------------- // favoriteTypeDidChange: // Update the favorite host when the type changes. // ------------------------------------------------------------------------------- @@ -736,6 +798,17 @@ [favoritesController setValue:@"" forKeyPath:@"selection.host"]; } + favoriteType = [sender indexOfSelectedItem]; + + // Update the name for a new added favorite if not touched by the user + if(!favoriteNameFieldWasTouched) { + [favoriteNameTextField setStringValue:[NSString stringWithFormat:@"%@@%@", + ([favoritesController valueForKeyPath:@"selection.user"]) ? [favoritesController valueForKeyPath:@"selection.user"] : @"", + ([favoritesController valueForKeyPath:@"selection.host"]) ? [favoritesController valueForKeyPath:@"selection.host"] : @""]]; + [favoritesController setValue:[favoriteNameTextField stringValue] forKeyPath:@"selection.name"]; + } + + // Request a password refresh to keep keychain references in synch with the favorites [self updateFavoritePasswordsFromField:nil]; } @@ -833,6 +906,7 @@ // ------------------------------------------------------------------------------- - (void)windowWillClose:(NSNotification *)notification { + // Mark the currently selected field in the window as having finished editing, to trigger saves. if ([preferencesWindow firstResponder]) [preferencesWindow endEditingFor:[preferencesWindow firstResponder]]; |