1 | // |
---|
2 | // AILogSizeSort.m |
---|
3 | // SortByLogSizePlugin |
---|
4 | // |
---|
5 | // Created by Jon Chambers on 9/28/08. |
---|
6 | // Copyright 2008 Jon Chambers. All rights reserved. |
---|
7 | // |
---|
8 | |
---|
9 | #import "AILogSizeSort.h" |
---|
10 | |
---|
11 | #import <AIUtilities/AITigerCompatibility.h> |
---|
12 | #import <AIUtilities/AIStringUtilities.h> |
---|
13 | #import <Adium/AIContactControllerProtocol.h> |
---|
14 | #import <Adium/AIPreferenceControllerProtocol.h> |
---|
15 | #import <AIUtilities/AIDictionaryAdditions.h> |
---|
16 | #import <Adium/AIListObject.h> |
---|
17 | |
---|
18 | @implementation AILogSizeSort |
---|
19 | |
---|
20 | /*! |
---|
21 | * @brief Did become active first time |
---|
22 | * |
---|
23 | * Called only once; gives the sort controller an opportunity to set defaults and load preferences lazily. |
---|
24 | */ |
---|
25 | - (void)didBecomeActiveFirstTime |
---|
26 | { |
---|
27 | } |
---|
28 | |
---|
29 | /*! |
---|
30 | * @brief Non-localized identifier |
---|
31 | */ |
---|
32 | - (NSString *)identifier{ |
---|
33 | return @"Log size"; |
---|
34 | } |
---|
35 | |
---|
36 | /*! |
---|
37 | * @brief Localized display name |
---|
38 | */ |
---|
39 | - (NSString *)displayName{ |
---|
40 | return AILocalizedString(@"Sort Contacts by Log Size",nil); |
---|
41 | } |
---|
42 | |
---|
43 | /*! |
---|
44 | * @brief Properties which, when changed, should trigger a resort |
---|
45 | */ |
---|
46 | - (NSSet *)statusKeysRequiringResort{ |
---|
47 | return nil; |
---|
48 | } |
---|
49 | |
---|
50 | /*! |
---|
51 | * @brief Attribute keys which, when changed, should trigger a resort |
---|
52 | */ |
---|
53 | - (NSSet *)attributeKeysRequiringResort{ |
---|
54 | return nil; |
---|
55 | } |
---|
56 | |
---|
57 | #pragma mark Configuration |
---|
58 | /*! |
---|
59 | * @brief Window title when configuring the sort |
---|
60 | * |
---|
61 | * Subclasses should provide a title for configuring the sort only if configuration is possible. |
---|
62 | * @result Localized title. If nil, the menu item will be disabled. |
---|
63 | */ |
---|
64 | - (NSString *)configureSortWindowTitle{ |
---|
65 | return AILocalizedString(@"Configure Sort by Log Size",nil); |
---|
66 | } |
---|
67 | |
---|
68 | /*! |
---|
69 | * @brief Nib name for configuration |
---|
70 | */ |
---|
71 | - (NSString *)configureNibName{ |
---|
72 | return @"LogSizeSortConfiguration"; |
---|
73 | } |
---|
74 | |
---|
75 | /*! |
---|
76 | * @brief View did load |
---|
77 | */ |
---|
78 | - (void)viewDidLoad{ |
---|
79 | } |
---|
80 | |
---|
81 | /*! |
---|
82 | * @brief Preference changed |
---|
83 | * |
---|
84 | * Sort controllers should live update as preferences change. |
---|
85 | */ |
---|
86 | - (IBAction)changePreference:(id)sender |
---|
87 | { |
---|
88 | } |
---|
89 | |
---|
90 | #pragma mark Sorting |
---|
91 | /*! |
---|
92 | * @brief Alphabetical sort |
---|
93 | */ |
---|
94 | int alphabeticalSort(id objectA, id objectB, BOOL groups) |
---|
95 | { |
---|
96 | return NSOrderedAscending; |
---|
97 | } |
---|
98 | |
---|
99 | /*! |
---|
100 | * @brief Sort function |
---|
101 | */ |
---|
102 | - (sortfunc)sortFunction{ |
---|
103 | return &alphabeticalSort; |
---|
104 | } |
---|
105 | |
---|
106 | @end |
---|