aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CustomQuery.m')
-rw-r--r--Source/CustomQuery.m13
1 files changed, 11 insertions, 2 deletions
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.
*/