aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPHistoryController.h2
-rw-r--r--Source/SPHistoryController.m14
-rw-r--r--Source/SPPreferenceController.m26
-rw-r--r--Source/TableContent.m15
-rw-r--r--Source/TableDocument.m2
5 files changed, 31 insertions, 28 deletions
diff --git a/Source/SPHistoryController.h b/Source/SPHistoryController.h
index 56303807..1b5ecaf3 100644
--- a/Source/SPHistoryController.h
+++ b/Source/SPHistoryController.h
@@ -64,7 +64,7 @@ enum sphistory_view_types
// Loading history entries
- (void) loadEntryAtPosition:(unsigned int)position;
- (void) loadEntryTaskWithPosition:(NSNumber *)positionNumber;
-- (void) abortEntryLoad;
+- (void) abortEntryLoadWithPool:(NSAutoreleasePool *)pool;
- (void) loadEntryFromMenuItem:(id)theMenuItem;
// History entry details and description
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index 7644f97f..17f2d3d7 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -301,6 +301,8 @@
[tableContentInstance loadTable:[historyEntry objectForKey:@"table"]];
modifyingHistoryState = NO;
[self updateToolbarItem];
+ [theDocument endTask];
+ [loadPool drain];
return;
}
@@ -314,7 +316,7 @@
[chooseDatabaseButton selectItemWithTitle:[historyEntry objectForKey:@"database"]];
[theDocument chooseDatabase:self];
if (![[theDocument database] isEqualToString:[historyEntry objectForKey:@"database"]]) {
- return [self abortEntryLoad];
+ return [self abortEntryLoadWithPool:loadPool];
}
}
@@ -322,11 +324,11 @@
if ([historyEntry objectForKey:@"table"] && ![[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]]) {
NSArray *tables = [tablesListInstance tables];
if ([tables indexOfObject:[historyEntry objectForKey:@"table"]] == NSNotFound) {
- return [self abortEntryLoad];
+ return [self abortEntryLoadWithPool:loadPool];
}
[[tablesListInstance valueForKey:@"tablesListView"] selectRowIndexes:[NSIndexSet indexSetWithIndex:[tables indexOfObject:[historyEntry objectForKey:@"table"]]] byExtendingSelection:NO];
if (![[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]]) {
- return [self abortEntryLoad];
+ return [self abortEntryLoadWithPool:loadPool];
}
} else if (![historyEntry objectForKey:@"table"] && [theDocument table]) {
[tablesListInstance setTableListSelectability:YES];
@@ -355,7 +357,7 @@
break;
}
if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] intValue]) {
- return [self abortEntryLoad];
+ return [self abortEntryLoadWithPool:loadPool];
}
}
@@ -371,10 +373,12 @@
* Convenience method for aborting history load - could at some point
* clean up the history list, show an alert, etc
*/
-- (void) abortEntryLoad
+- (void) abortEntryLoadWithPool:(NSAutoreleasePool *)pool
{
NSBeep();
modifyingHistoryState = NO;
+ [theDocument endTask];
+ if (pool) [pool drain];
}
/**
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index 38c76f9e..ce7c7424 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -267,21 +267,31 @@
[prefs setObject:[NSDictionary dictionaryWithDictionary:toolbarDict] forKey:@"NSToolbar Configuration TableWindowToolbar"];
}
- // For versions prior to r1598 (~0.9.7), convert the query favorites array to an array of dictionaries
- if (recordedVersionNumber < 1598 && [prefs objectForKey:SPQueryFavorites]) {
+ // For versions prior to r1609 (~0.9.7), convert the query favorites array to an array of dictionaries
+ if (recordedVersionNumber < 1609 && [prefs objectForKey:SPQueryFavorites]) {
NSMutableArray *queryFavoritesArray = [NSMutableArray arrayWithArray:[prefs objectForKey:SPQueryFavorites]];
for (i = 0; i < [queryFavoritesArray count]; i++)
{
id favorite = [queryFavoritesArray objectAtIndex:i];
- if (([favorite isKindOfClass:[NSDictionary class]]) && ([favorite objectForKey:@"name"]) && ([favorite objectForKey:@"query"])) continue;
+ // If the favorite is already a dictionary, just make sure there's no newlines in the title
+ if (([favorite isKindOfClass:[NSDictionary class]]) && ([favorite objectForKey:@"name"]) && ([favorite objectForKey:@"query"])) {
+ NSMutableString *favoriteName = [NSMutableString stringWithString:[favorite objectForKey:@"name"]];
+ [favoriteName replaceOccurrencesOfString:@"\n" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [favoriteName length])];
+ [queryFavoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithString:favoriteName], [favorite objectForKey:@"query"], nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]];
+ continue;
+ }
- // By default make the query's name the first 32 characters of the query with '...' appended
- int idx = ( [favorite length] > 32 ) ? 32 : [favorite length]-1;
- NSString *favoriteName = [[[favorite stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]] substringToIndex:idx] stringByAppendingString:@"..."];
-
- [queryFavoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:favoriteName, favorite, nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]];
+ // By default make the query's name the first 32 characters of the query with '...' appended, stripping newlines
+ NSMutableString *favoriteName = [NSMutableString stringWithString:[favorite stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]];
+ [favoriteName replaceOccurrencesOfString:@"\n" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [favoriteName length])];
+ if ([favoriteName length] > 32) {
+ [favoriteName deleteCharactersInRange:NSMakeRange(32, [favoriteName length] - 32)];
+ [favoriteName appendString:@"..."];
+ }
+
+ [queryFavoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithString:favoriteName], favorite, nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]];
}
[prefs setObject:queryFavoritesArray forKey:SPQueryFavorites];
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 98de0278..e1954627 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1149,11 +1149,13 @@
if (paginationViewFrame.size.height == paginationViewHeight) return;
paginationViewFrame.size.height = paginationViewHeight;
[paginationButton setState:NSOnState];
+ [paginationButton setImage:[NSImage imageNamed:@"button_action"]];
[tableWindow makeFirstResponder:paginationPageField];
} else {
if (paginationViewFrame.size.height == 0) return;
paginationViewFrame.size.height = 0;
[paginationButton setState:NSOffState];
+ [paginationButton setImage:[NSImage imageNamed:@"button_pagination"]];
if ([tableWindow firstResponder] == paginationPageField
|| ([[tableWindow firstResponder] respondsToSelector:@selector(superview)]
&& [(id)[tableWindow firstResponder] superview]
@@ -1196,19 +1198,6 @@
// As long as a table is selected (which it will be if this is called), enable pagination detail button
[paginationButton setEnabled:enabledMode];
- // Update the pagination button text
- if ([prefs boolForKey:SPLimitResults]) {
- if (maxPage <= 1) {
- [paginationButton setTitle:@""];
- } else if (isFiltered) {
- [paginationButton setTitle:[NSString stringWithFormat:NSLocalizedString(@"Page %@", @"Filtered pagination button status text"), [numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:contentPage]]]];
- } else {
- [paginationButton setTitle:[NSString stringWithFormat:NSLocalizedString(@"Page %@ of %@", @"Pagination button status text"), [numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:contentPage]], [numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:maxPage]]]];
- }
- } else {
- [paginationButton setTitle:NSLocalizedString(@"Pagination disabled", @"Pagination text shown when LIMIT is off")];
- }
-
// Set the values and maximums for the text field and associated pager
[paginationPageField setStringValue:[numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:contentPage]]];
[[paginationPageField formatter] setMaximum:[NSNumber numberWithUnsignedInteger:maxPage]];
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 06066be3..6d34b7f5 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -2640,7 +2640,7 @@
aString = @"SPSSHTunnelConnection";
[connection setObject:[connectionController sshHost] forKey:@"ssh_host"];
[connection setObject:[connectionController sshUser] forKey:@"ssh_user"];
- if([connectionController port] && [[connectionController port] length])
+ if([connectionController sshPort] && [[connectionController sshPort] length])
[connection setObject:[NSNumber numberWithInt:[[connectionController sshPort] intValue]] forKey:@"ssh_port"];
break;
default: