Put NSAutoreleasePool usage around other distributed notification observer methods
[adiumx.git] / Source / AIAbstractLogViewerWindowController.h
blobbfa1077e180b799854de59655108c2905b136ac1
1 //
2 // AIAbstractLogViewerWindowController.h
3 // Adium
4 //
5 // Created by Evan Schoenberg on 3/24/06.
6 //
8 #import <Adium/AIWindowController.h>
9 #import <AIUtilities/AIDividedAlternatingRowOutlineView.h>
11 @class AIChatLog, AILoggerPlugin;
13 #define LOG_SEARCH_STATUS_INTERVAL 20 //1/60ths of a second to wait before refreshing search status
15 #define LOG_CONTENT_SEARCH_MAX_RESULTS 10000 //Max results allowed from a search
16 #define LOG_RESULT_CLUMP_SIZE 10 //Number of logs to fetch at a time
18 #define SEARCH_MENU AILocalizedString(@"Search Menu",nil)
19 #define FROM AILocalizedString(@"From",nil)
20 #define TO AILocalizedString(@"To",nil)
22 #define ACCOUNT AILocalizedString(@"Account",nil)
23 #define DESTINATION AILocalizedString(@"Destination",nil)
25 #define DATE AILocalizedString(@"Date",nil)
26 #define CONTENT AILocalizedString(@"Content",nil)
27 #define DELETE AILocalizedString(@"Delete",nil)
28 #define DELETEALL AILocalizedString(@"Delete All",nil)
29 #define SEARCH AILocalizedString(@"Search",nil)
31 #define KEY_LOG_VIEWER_EMOTICONS @"Log Viewer Emoticons"
32 #define KEY_LOG_VIEWER_SELECTED_COLUMN @"Log Viewer Selected Column Identifier"
33 #define LOG_VIEWER_DID_CREATE_LOG_ARRAYS @"LogViewerDidCreateLogArrays"
34 #define LOG_VIEWER_DID_UPDATE_LOG_ARRAYS @"LogViewerDidUpdateLogArrays"
36 #define DATE_ITEM_IDENTIFIER @"date"
38 typedef enum {
39 LOG_SEARCH_FROM = 0,
40 LOG_SEARCH_TO,
41 LOG_SEARCH_DATE,
42 LOG_SEARCH_CONTENT
43 } LogSearchMode;
45 typedef enum {
46 AIDateTypeAnyDate = 0,
47 AIDateTypeToday,
48 AIDateTypeSinceYesterday,
49 AIDateTypeThisWeek,
50 AIDateTypeWithinLastTwoWeeks,
51 AIDateTypeThisMonth,
52 AIDateTypeWithinLastTwoMonths,
53 AIDateTypeExactly,
54 AIDateTypeBefore,
55 AIDateTypeAfter
56 } AIDateType;
58 @class AIListContact, AISplitView, KNShelfSplitView;
60 @interface AIAbstractLogViewerWindowController : AIWindowController {
61 AILoggerPlugin *plugin;
63 IBOutlet KNShelfSplitView *shelf_splitView;
65 IBOutlet AISplitView *splitView_contacts_results;
66 IBOutlet AIDividedAlternatingRowOutlineView *outlineView_contacts;
67 IBOutlet NSView *containingView_contactsSourceList;
68 float desiredContactsSourceListDeltaX;
70 IBOutlet NSView *containingView_results;
71 IBOutlet AISplitView *splitView_results;
72 IBOutlet NSTableView *tableView_results;
73 IBOutlet NSTextView *textView_content;
75 IBOutlet NSView *view_SearchField;
76 IBOutlet NSButton *button_deleteLogs;
78 IBOutlet NSView *view_DatePicker;
79 IBOutlet NSPopUpButton *popUp_dateFilter;
81 IBOutlet NSProgressIndicator *progressIndicator;
82 IBOutlet NSTextField *textField_progress;
84 IBOutlet NSSearchField *searchField_logs;
86 //Array of selected / displayed logs. (Locked access)
87 NSMutableArray *currentSearchResults; //Array of filtered/resulting logs
88 NSRecursiveLock *resultsLock; //Lock before touching the array
89 NSArray *displayedLogArray; //Currently selected/displayed log(s)
91 LogSearchMode searchMode; //Currently selected search mode
93 NSTableColumn *selectedColumn; //Selected/active sort column
95 //Search information
96 int activeSearchID; //ID of the active search thread, all other threads should quit
97 NSLock *searchingLock; //Locked when a search is in progress
98 BOOL searching; //YES if a search is in progress
99 NSString *activeSearchString; //Current search string
100 BOOL suppressSearchRequests;
101 BOOL isOpeningForContact;
102 int indexingUpdatesReceivedWhileSearching; //Number of times indexing has updated during the current search
104 BOOL sortDirection; //Direction to sort
106 NSTimer *refreshResultsTimer;
107 int searchIDToReattemptWhenComplete;
109 NSString *filterForAccountName; //Account name to restrictively match content searches
110 NSMutableSet *contactIDsToFilter;
112 AIDateType filterDateType;
113 NSCalendarDate *filterDate;
114 int firstDayOfWeek;
115 BOOL iCalFirstDayOfWeekDetermined;
117 NSMutableDictionary *logToGroupDict;
118 NSMutableDictionary *logFromGroupDict;
120 BOOL automaticSearch; //YES if this search was performed automatically for the user (view ___'s logs...)
121 BOOL ignoreSelectionChange; //Hack to prevent automatic table selection changes from clearing the automaticSearch flag
122 BOOL windowIsClosing; //YES only if windowShouldClose: has been called, to prevent actions after that point
124 NSMutableDictionary *toolbarItems;
125 NSImage *blankImage;
126 NSImage *adiumIcon;
127 NSImage *adiumIconHighlighted;
129 NSMutableArray *fromArray; //Array of account names
130 NSMutableArray *fromServiceArray; //Array of services for accounts
131 NSMutableArray *toArray; //Array of contacts
132 NSMutableArray *toServiceArray; //Array of services for accounts
133 NSDateFormatter *headerDateFormatter; //Format for dates displayed in the content text view
135 int sameSelection;
136 BOOL useSame;
138 int cachedSelectionIndex;
139 BOOL deleteOccurred; // YES only if a delete occurs, allowing the table to preserve selection after a search begins
141 NSString *horizontalRule;
143 NSUndoManager *undoManager;
145 NSNumber *allContactsIdentifier;
146 //Old
147 BOOL showEmoticons;
150 + (id)openForPlugin:(id)inPlugin;
151 + (id)openForContact:(AIListContact *)inContact plugin:(id)inPlugin;
152 + (id)openLogAtPath:(NSString *)inPath plugin:(id)inPlugin;
153 + (id)existingWindowController;
154 + (void)closeSharedInstance;
156 - (void)stopSearching;
158 - (void)displayLog:(AIChatLog *)log;
159 - (void)installToolbar;
161 - (void)setSearchMode:(LogSearchMode)inMode;
162 - (void)setSearchString:(NSString *)inString;
163 - (IBAction)updateSearch:(id)sender;
165 - (void)searchComplete;
166 - (void)startSearchingClearingCurrentResults:(BOOL)clearCurrentResults;
168 - (void)refreshResults;
169 - (void)resortLogs;
170 - (void)selectFirstLog;
171 - (void)selectDisplayedLog;
172 - (void)refreshResults;
173 - (void)refreshResultsSearchIsComplete:(BOOL)searchIsComplete;
174 - (void)updateProgressDisplay;
175 - (void)logIndexingProgressUpdate;
177 - (void)rebuildIndices;
179 - (BOOL)searchShouldDisplayDocument:(SKDocumentRef)inDocument pathComponents:(NSArray *)pathComponents testDate:(BOOL)testDate;
180 - (BOOL)chatLogMatchesDateFilter:(AIChatLog *)inChatLog;
182 - (void)filterLogsWithSearch:(NSDictionary *)searchInfoDict;
184 - (NSMenu *)dateTypeMenu;
185 - (NSMenuItem *)_menuItemForDateType:(AIDateType)dateType dict:(NSDictionary *)dateTypeTitleDict;
186 - (IBAction)selectDateType:(id)sender;
187 - (void)selectedDateType:(AIDateType)dateType;
188 - (void)configureDateFilter;
190 @end