aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-09-15 12:21:13 +0000
committerstuconnolly <stuart02@gmail.com>2010-09-15 12:21:13 +0000
commitc5d5b115cae8eb5f8295365ffa463a6561b9cccb (patch)
treed0a227e75b4b58de9604f4b2bf191112ab8efa7f
parent99b6e552125002d1d49440908f2228c3eafc53a9 (diff)
downloadsequelpro-c5d5b115cae8eb5f8295365ffa463a6561b9cccb.tar.gz
sequelpro-c5d5b115cae8eb5f8295365ffa463a6561b9cccb.tar.bz2
sequelpro-c5d5b115cae8eb5f8295365ffa463a6561b9cccb.zip
Enable column sorting in the server processes window. Implements issue #816.
-rw-r--r--Interfaces/English.lproj/DatabaseProcessList.xib42
-rw-r--r--Source/SPProcessListController.m14
2 files changed, 55 insertions, 1 deletions
diff --git a/Interfaces/English.lproj/DatabaseProcessList.xib b/Interfaces/English.lproj/DatabaseProcessList.xib
index 13688b15..656f5910 100644
--- a/Interfaces/English.lproj/DatabaseProcessList.xib
+++ b/Interfaces/English.lproj/DatabaseProcessList.xib
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="4"/>
+ <integer value="17"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -134,6 +134,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">Id</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
<object class="NSTableColumn" id="1018814649">
<string key="NSIdentifier">User</string>
@@ -160,6 +165,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">User</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
<object class="NSTableColumn" id="916357082">
<string key="NSIdentifier">Host</string>
@@ -199,6 +209,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">Host</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
<object class="NSTableColumn" id="900862033">
<string key="NSIdentifier">db</string>
@@ -225,6 +240,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">db</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
<object class="NSTableColumn" id="124500548">
<string key="NSIdentifier">Command</string>
@@ -251,6 +271,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">Command</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
<object class="NSTableColumn" id="341933208">
<string key="NSIdentifier">Time</string>
@@ -277,6 +302,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">Time</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
<object class="NSTableColumn" id="938452365">
<string key="NSIdentifier">State</string>
@@ -303,6 +333,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">State</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
<object class="NSTableColumn" id="1006157959">
<string key="NSIdentifier">Info</string>
@@ -329,6 +364,11 @@
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="457137758"/>
+ <object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
+ <string key="NSKey">Info</string>
+ <bool key="NSAscending">YES</bool>
+ <string key="NSSelector">compare:</string>
+ </object>
</object>
</object>
<double key="NSIntercellSpacingWidth">3</double>
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index afb13634..886e6f2b 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -469,6 +469,16 @@
return (![object isNSNull]) ? object : [prefs stringForKey:SPNullValue];
}
+/**
+ * Table view delegate method. Called when the user changes the sort by column.
+ */
+- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray *)oldDescriptors
+{
+ [processesFiltered sortUsingDescriptors:[tableView sortDescriptors]];
+
+ [tableView reloadData];
+}
+
#pragma mark -
#pragma mark Text field delegate methods
@@ -537,6 +547,10 @@
[self _updateServerProcessesFilterForFilterString:[filterProcessesSearchField stringValue]];
}
+ // Reset sort descriptors
+ [processesFiltered sortUsingDescriptors:[processListTableView sortDescriptors]];
+
+ // Reload data
[processListTableView reloadData];
// Enable controls