From f1ac4e932e0b8ce222d875ba4bbb14cdc3719617 Mon Sep 17 00:00:00 2001 From: Mert Akengin Date: Wed, 21 Feb 2018 00:04:32 +0200 Subject: [PATCH] added sorting functionality and respective ui button --- Classes/Dialogs/ServerDialog.m | 8 ++++++++ English.lproj/ServerDialog.xib | 33 ++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Classes/Dialogs/ServerDialog.m b/Classes/Dialogs/ServerDialog.m index d05e2147..43ef8319 100644 --- a/Classes/Dialogs/ServerDialog.m +++ b/Classes/Dialogs/ServerDialog.m @@ -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 diff --git a/English.lproj/ServerDialog.xib b/English.lproj/ServerDialog.xib index 69d35908..d0a8d688 100644 --- a/English.lproj/ServerDialog.xib +++ b/English.lproj/ServerDialog.xib @@ -1,8 +1,8 @@ - - + + - + @@ -627,7 +627,7 @@ - + @@ -708,9 +708,9 @@ - + - + @@ -750,6 +750,17 @@ + - @@ -832,7 +843,7 @@ -