2 // AIAbstractLogViewerWindowController.h
5 // Created by Evan Schoenberg on 3/24/06.
8 #import <Adium/AIWindowController.h>
9 #import <AIUtilities/AIAlternatingRowOutlineView.h>
11 @
class AIChatLog
, AILoggerPlugin
;
13 #define REFRESH_RESULTS_INTERVAL 0.5 //Interval between results refreshes while searching
14 #define LOG_SEARCH_STATUS_INTERVAL 20 //1/60ths of a second to wait before refreshing search status
16 #define LOG_CONTENT_SEARCH_MAX_RESULTS 10000 //Max results allowed from a search
17 #define LOG_RESULT_CLUMP_SIZE 10 //Number of logs to fetch at a time
19 #define SEARCH_MENU AILocalizedString(@"Search Menu",nil)
20 #define FROM AILocalizedString(@"From",nil)
21 #define TO AILocalizedString(@"To",nil)
23 #define ACCOUNT AILocalizedString(@"Account",nil)
24 #define DESTINATION AILocalizedString(@"Destination",nil)
26 #define DATE AILocalizedString(@"Date",nil)
27 #define CONTENT AILocalizedString(@"Content",nil)
28 #define DELETE AILocalizedString(@"Delete",nil)
29 #define DELETEALL AILocalizedString(@"Delete All",nil)
30 #define SEARCH AILocalizedString(@"Search",nil)
32 #define KEY_LOG_VIEWER_EMOTICONS @"Log Viewer Emoticons"
33 #define KEY_LOG_VIEWER_SELECTED_COLUMN @"Log Viewer Selected Column Identifier"
34 #define LOG_VIEWER_DID_CREATE_LOG_ARRAYS @"LogViewerDidCreateLogArrays"
35 #define LOG_VIEWER_DID_UPDATE_LOG_ARRAYS @"LogViewerDidUpdateLogArrays"
37 #define DATE_ITEM_IDENTIFIER @"date"
47 AIDateTypeAnyDate
= 0,
49 AIDateTypeSinceYesterday
,
51 AIDateTypeWithinLastTwoWeeks
,
53 AIDateTypeWithinLastTwoMonths
,
59 @
class AIListContact
, AISplitView
, KNShelfSplitView
;
61 @interface AIAbstractLogViewerWindowController
: AIWindowController
{
62 AILoggerPlugin
*plugin
;
64 IBOutlet KNShelfSplitView
*shelf_splitView
;
66 IBOutlet AISplitView
*splitView_contacts_results
;
67 IBOutlet AIAlternatingRowOutlineView
*outlineView_contacts
;
68 IBOutlet NSView
*containingView_contactsSourceList
;
69 float desiredContactsSourceListDeltaX
;
71 IBOutlet NSView
*containingView_results
;
72 IBOutlet AISplitView
*splitView_results
;
73 IBOutlet NSTableView
*tableView_results
;
74 IBOutlet NSTextView
*textView_content
;
76 IBOutlet NSView
*view_SearchField
;
77 IBOutlet NSButton
*button_deleteLogs
;
79 IBOutlet NSView
*view_DatePicker
;
80 IBOutlet NSPopUpButton
*popUp_dateFilter
;
82 IBOutlet NSProgressIndicator
*progressIndicator
;
83 IBOutlet NSTextField
*textField_progress
;
85 IBOutlet NSSearchField
*searchField_logs
;
87 //Array of selected / displayed logs. (Locked access)
88 NSMutableArray
*currentSearchResults
; //Array of filtered/resulting logs
89 NSRecursiveLock
*resultsLock
; //Lock before touching the array
90 NSArray
*displayedLogArray
; //Currently selected/displayed log(s)
92 LogSearchMode searchMode
; //Currently selected search mode
94 NSTableColumn
*selectedColumn
; //Selected/active sort column
97 int activeSearchID
; //ID of the active search thread, all other threads should quit
98 NSLock
*searchingLock
; //Locked when a search is in progress
99 BOOL searching
; //YES if a search is in progress
100 NSString
*activeSearchString
; //Current search string
102 BOOL sortDirection
; //Direction to sort
104 NSTimer
*refreshResultsTimer
;
105 int searchIDToReattemptWhenComplete
;
107 NSString
*filterForAccountName
; //Account name to restrictively match content searches
108 NSMutableSet
*contactIDsToFilter
;
110 AIDateType filterDateType
;
111 NSCalendarDate
*filterDate
;
113 BOOL iCalFirstDayOfWeekDetermined
;
115 NSMutableDictionary
*logToGroupDict
;
116 NSMutableDictionary
*logFromGroupDict
;
118 BOOL automaticSearch
; //YES if this search was performed automatically for the user (view ___'s logs...)
119 BOOL ignoreSelectionChange
; //Hack to prevent automatic table selection changes from clearing the automaticSearch flag
120 BOOL windowIsClosing
; //YES only if windowShouldClose: has been called, to prevent actions after that point
122 NSMutableDictionary
*toolbarItems
;
125 NSImage
*adiumIconHighlighted
;
127 NSMutableArray
*fromArray
; //Array of account names
128 NSMutableArray
*fromServiceArray
; //Array of services for accounts
129 NSMutableArray
*toArray
; //Array of contacts
130 NSMutableArray
*toServiceArray
; //Array of services for accounts
131 NSDateFormatter
*headerDateFormatter
; //Format for dates displayed in the content text view
136 int cachedSelectionIndex
;
137 BOOL deleteOccurred
; // YES only if a delete occurs, allowing the table to preserve selection after a search begins
139 NSString
*horizontalRule
;
141 NSUndoManager
*undoManager
;
143 NSNumber
*allContactsIdentifier
;
148 + (id
)openForPlugin
:(id
)inPlugin
;
149 + (id
)openForContact
:(AIListContact
*)inContact plugin
:(id
)inPlugin
;
150 + (id
)openLogAtPath
:(NSString
*)inPath plugin
:(id
)inPlugin
;
151 + (id
)existingWindowController
;
152 + (void)closeSharedInstance
;
154 - (void)stopSearching
;
156 - (void)displayLog
:(AIChatLog
*)log
;
157 - (void)installToolbar
;
159 - (void)setSearchMode
:(LogSearchMode
)inMode
;
160 - (void)setSearchString
:(NSString
*)inString
;
161 - (IBAction
)updateSearch
:(id
)sender
;
163 - (void)searchComplete
;
164 - (void)startSearchingClearingCurrentResults
:(BOOL
)clearCurrentResults
;
166 - (void)refreshResults
;
168 - (void)selectFirstLog
;
169 - (void)selectDisplayedLog
;
170 - (void)refreshResults
;
171 - (void)refreshResultsSearchIsComplete
:(BOOL
)searchIsComplete
;
172 - (void)updateProgressDisplay
;
173 - (void)logIndexingProgressUpdate
;
175 - (void)rebuildIndices
;
177 - (BOOL
)searchShouldDisplayDocument
:(SKDocumentRef
)inDocument pathComponents
:(NSArray
*)pathComponents testDate
:(BOOL
)testDate
;
178 - (BOOL
)chatLogMatchesDateFilter
:(AIChatLog
*)inChatLog
;
180 - (void)filterLogsWithSearch
:(NSDictionary
*)searchInfoDict
;
182 - (NSMenu
*)dateTypeMenu
;
183 - (NSMenuItem
*)_menuItemForDateType
:(AIDateType
)dateType dict
:(NSDictionary
*)dateTypeTitleDict
;
184 - (IBAction
)selectDateType
:(id
)sender
;
185 - (void)selectedDateType
:(AIDateType
)dateType
;
186 - (void)configureDateFilter
;