When opening for a contact, don't silently switch the search type to "to". Fixes #12001.
authorZachary West <zacw@adium.im>
Thu Nov 26 00:22:17 2009 -0500 (2009-11-26)
changeset 282521c1813a173a
parent 2824 0eb39f6eb39c
child 2826 4a64255881c8
When opening for a contact, don't silently switch the search type to "to". Fixes #12001.

This also moves the automatic selection below the "we're now updating for search" line, so that highlighting is applied to the log (since when it's asked to display, there's no search term for it).
Source/AILogViewerWindowController.m
     1.1 --- a/Source/AILogViewerWindowController.m	Wed Nov 25 23:53:28 2009 -0500
     1.2 +++ b/Source/AILogViewerWindowController.m	Thu Nov 26 00:22:17 2009 -0500
     1.3 @@ -88,6 +88,7 @@
     1.4  - (void)filterForContact:(AIListContact *)inContact;
     1.5  - (void)filterForChatName:(NSString *)chatName withAccount:(AIAccount *)account;
     1.6  - (void)selectCachedIndex;
     1.7 +- (void)tableViewSelectionDidChangeDelayed;
     1.8  
     1.9  - (NSAlert *)alertForDeletionOfLogCount:(NSUInteger)logCount;
    1.10  
    1.11 @@ -447,7 +448,8 @@
    1.12      [self initLogFiltering];
    1.13  
    1.14      //Begin our initial search
    1.15 -	[self setSearchMode:LOG_SEARCH_TO];
    1.16 +	if (!isOpeningForContact)
    1.17 +		[self setSearchMode:LOG_SEARCH_TO];
    1.18  
    1.19      [searchField_logs setStringValue:(activeSearchString ? activeSearchString : @"")];
    1.20  	suppressSearchRequests = NO;
    1.21 @@ -628,6 +630,13 @@
    1.22      NSInteger count = [currentSearchResults count];
    1.23      [resultsLock unlock];
    1.24  	AILog(@"refreshResultsSearchIsComplete: %i (count is %i)",searchIsComplete,count);
    1.25 +	
    1.26 +	if (searchIsComplete &&
    1.27 +		((activeSearchID == searchIDToReattemptWhenComplete) && !windowIsClosing)) {
    1.28 +		searchIDToReattemptWhenComplete = -1;
    1.29 +		[self startSearchingClearingCurrentResults:NO];
    1.30 +	}
    1.31 +	
    1.32      if (!searching || count <= MAX_LOGS_TO_SORT_WHILE_SEARCHING) {
    1.33  		//Sort the logs correctly which will also reload the table
    1.34  		[self resortLogs];
    1.35 @@ -638,19 +647,13 @@
    1.36  			
    1.37  		} else {
    1.38  			BOOL oldAutomaticSearch = automaticSearch;
    1.39 -
    1.40 +			
    1.41  			//We don't want the above re-selection to change our automaticSearch tracking
    1.42  			//(The only reason automaticSearch should change is in response to user action)
    1.43  			automaticSearch = oldAutomaticSearch;
    1.44  		}
    1.45      }
    1.46  	
    1.47 -	if (searchIsComplete &&
    1.48 -		((activeSearchID == searchIDToReattemptWhenComplete) && !windowIsClosing)) {
    1.49 -		searchIDToReattemptWhenComplete = -1;
    1.50 -		[self startSearchingClearingCurrentResults:NO];
    1.51 -	}
    1.52 -	
    1.53  	if(deleteOccurred)
    1.54  		[self selectCachedIndex];
    1.55