From d915e45bc51b59618a054ececa38d46898603a3b Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 16 Dec 2009 01:01:34 +0000 Subject: - Merge in r1608 (SPF saving of custom SSH ports), r1610 (Fix multi-line favourite titles), r1619 (History navigation task not closed) and r1622 (Pagination interface clarification) to the 0.9.7 branch --- Interfaces/English.lproj/DBView.xib | 8 +++---- Interfaces/English.lproj/QueryFavoriteManager.xib | 20 ++++++++--------- Resources/Images/button_pagination.png | Bin 311 -> 717 bytes Source/SPHistoryController.h | 2 +- Source/SPHistoryController.m | 14 +++++++----- Source/SPPreferenceController.m | 26 +++++++++++++++------- Source/TableContent.m | 15 ++----------- Source/TableDocument.m | 2 +- 8 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 0ef9900c..dc251b32 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -2448,7 +2448,7 @@ 290 - {{166, 6}, {327, 22}} + {{166, 6}, {415, 22}} YES @@ -2833,7 +2833,7 @@ 289 - {{493, 9}, {32, 25}} + {{586, 9}, {32, 25}} YES @@ -2857,7 +2857,7 @@ 289 - {{524, 9}, {125, 25}} + {{617, 9}, {32, 25}} YES @@ -17956,9 +17956,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - + diff --git a/Interfaces/English.lproj/QueryFavoriteManager.xib b/Interfaces/English.lproj/QueryFavoriteManager.xib index f45e707e..0c0f0371 100644 --- a/Interfaces/English.lproj/QueryFavoriteManager.xib +++ b/Interfaces/English.lproj/QueryFavoriteManager.xib @@ -25,8 +25,8 @@ YES - com.brandonwalkin.BWToolkit com.apple.InterfaceBuilder.CocoaPlugin + com.brandonwalkin.BWToolkit YES @@ -56,7 +56,7 @@ Query Favorite Manager NSWindow - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {500, 371} @@ -383,7 +383,7 @@ 337772097 - 133120 + 133184 Text Cell @@ -393,7 +393,7 @@ controlBackgroundColor 3 - MC42NjY2NjY2ODY1AA + MC42NjY2NjY2NjY3AA @@ -535,7 +535,7 @@ YES -1804468671 - 272761856 + 272761920 [no selection] @@ -696,7 +696,7 @@ {{20, 54}, {250, 266}} - 514 + 530 @@ -761,7 +761,7 @@ SPQueryFavoriteSplitView 1 - MC42NjY2NjY2ODY1IDAuNjY2NjY2Njg2NSAwLjY2NjY2NjY4NjUAA + MC42NjY2NjY2NjY3IDAuNjY2NjY2NjY2NyAwLjY2NjY2NjY2NjcAA YES @@ -819,7 +819,7 @@ {{0, 0}, {1680, 1028}} {500, 393} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} SPQueryFavoriteManagerWindow @@ -1676,9 +1676,9 @@ YES com.apple.InterfaceBuilder.CocoaPlugin - {{417, 428}, {500, 371}} + {{323, 319}, {500, 371}} com.apple.InterfaceBuilder.CocoaPlugin - {{417, 428}, {500, 371}} + {{323, 319}, {500, 371}} {196, 240} {{357, 418}, {480, 270}} diff --git a/Resources/Images/button_pagination.png b/Resources/Images/button_pagination.png index 89c612df..ed61c791 100644 Binary files a/Resources/Images/button_pagination.png and b/Resources/Images/button_pagination.png differ 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: -- cgit v1.2.3