diff options
-rw-r--r-- | Source/CustomQuery.h | 1 | ||||
-rw-r--r-- | Source/CustomQuery.m | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h index e73f70da..526010ad 100644 --- a/Source/CustomQuery.h +++ b/Source/CustomQuery.h @@ -225,6 +225,7 @@ - (NSUInteger)numberOfQueries; - (NSString *)buildHistoryString; +- (void)addHistoryEntry:(NSString *)entryString; - (void)historyItemsHaveBeenUpdated:(id)manager; diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 2992d373..2e26f08e 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -713,8 +713,7 @@ // add query to history if(!reloadingExistingResult && [usedQuery length]) - [[SPQueryController sharedQueryController] addHistory:usedQuery forFileURL:[tableDocumentInstance fileURL]]; - + [self performSelectorOnMainThread:@selector(addHistoryEntry:) withObject:usedQuery waitUntilDone:NO]; // Error checking if ( [mySQLConnection queryCancelled] || ([errors length] && !queryIsTableSorter)) { @@ -2886,6 +2885,16 @@ { return [[[SPQueryController sharedQueryController] historyForFileURL:[tableDocumentInstance fileURL]] componentsJoinedByString:@";\n"]; } + +/** + * Add a query string to the file/global history, via the query controller. + * Single argument allows calls on the main thread. + */ +- (void)addHistoryEntry:(NSString *)entryString +{ + [[SPQueryController sharedQueryController] addHistory:entryString forFileURL:[tableDocumentInstance fileURL]]; +} + /* * This method is called as part of Key Value Observing which is used to watch for prefernce changes which effect the interface. */ |