Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added sorting functionality #302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Classes/Dialogs/ServerDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ - (void)deleteChannel:(id)sender
[self reloadChannelTable];
}

- (void)sortChannels:(id)sender {
[_config.channels sortUsingComparator:^NSComparisonResult(IRCChannelConfig* _Nonnull ch1, IRCChannelConfig* _Nonnull ch2) {
NSComparisonResult* result = [ch1.name compare:ch2.name options:NSCaseInsensitiveSearch];
return result;
}];
[self reloadChannelTable];
}

#pragma mark - Ignore Actions

- (void)addIgnore:(id)sender
Expand Down
33 changes: 22 additions & 11 deletions English.lproj/ServerDialog.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="15G19009" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -627,7 +627,7 @@
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" id="3eL-uI-2jU">
<rect key="frame" x="1" y="0.0" width="369" height="205"/>
<autoresizingMask key="autoresizingMask"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" headerView="958" id="113" customClass="ListView">
<rect key="frame" x="0.0" y="0.0" width="369" height="188"/>
Expand Down Expand Up @@ -708,9 +708,9 @@
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" id="gFV-kd-8Wa">
<rect key="frame" x="1" y="1" width="369" height="92"/>
<autoresizingMask key="autoresizingMask"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" spellingCorrection="YES" smartInsertDelete="YES" id="204">
<textView importsGraphics="NO" richText="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" spellingCorrection="YES" smartInsertDelete="YES" id="204">
<rect key="frame" x="0.0" y="0.0" width="369" height="92"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -750,6 +750,17 @@
<action selector="addChannel:" target="-2" id="1014"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="862">
<rect key="frame" x="39" y="170" width="23" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="951">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="deleteChannel:" target="-2" id="1015"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="860">
<rect key="frame" x="333" y="170" width="55" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -761,15 +772,15 @@
<action selector="editChannel:" target="-2" id="1016"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="862">
<rect key="frame" x="39" y="170" width="23" height="23"/>
<button verticalHuggingPriority="750" misplaced="YES" id="AF5-Io-wuw">
<rect key="frame" x="270" y="170" width="55" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="951">
<buttonCell key="cell" type="smallSquare" title="Sort" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="non-nX-SrD">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="deleteChannel:" target="-2" id="1015"/>
<action selector="sortChannels:" target="-2" id="uhd-Pv-bBH"/>
</connections>
</button>
</subviews>
Expand Down Expand Up @@ -832,7 +843,7 @@
<rect key="frame" x="1" y="119" width="223" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="1032">
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="1032">
<rect key="frame" x="224" y="17" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
Expand Down