From d6b6cd9b10fb6562961be3714c529441f317aa7d Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 29 Jun 2010 18:32:43 +0000 Subject: =?UTF-8?q?=E2=80=A2=20save=20window's=20vertical=20divider=20posi?= =?UTF-8?q?tion=20in=20spf=20files=20in=20order=20to=20be=20able=20to=20re?= =?UTF-8?q?store=20it=20=E2=80=A2=20do=20not=20save=20tabs=20or=20a=20sing?= =?UTF-8?q?le=20window=20if=20connectionController=20is=20shown=20?= =?UTF-8?q?=E2=80=A2=20added=20comments=20=E2=80=A2=20added=20to=20SPTable?= =?UTF-8?q?Content=20method=20"tablesListWidth"=20to=20retrieve=20tablesLi?= =?UTF-8?q?st's=20view=20width?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPDatabaseDocument.m | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'Source/SPDatabaseDocument.m') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index d2ba3d85..3c83f611 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -546,7 +546,6 @@ if([spfSession objectForKey:@"connectionEncoding"] && ![[self connectionEncoding] isEqualToString:[spfSession objectForKey:@"connectionEncoding"]]) [self setConnectionEncoding:[spfSession objectForKey:@"connectionEncoding"] reloadingViews:YES]; - if(isSelectedTableDefined) { // Set table content details for restore if([spfSession objectForKey:@"contentSortCol"]) @@ -727,13 +726,17 @@ if(spfSession != nil) { + // Restore vertical split view divider for tables' list and right view (Structure, Content, etc.) + if([spfSession objectForKey:@"windowVerticalDividerPosition"]) + [contentViewSplitter setPosition:[[spfSession objectForKey:@"windowVerticalDividerPosition"] floatValue] ofDividerAtIndex:0]; + // Start a task to restore the session details [self startTaskWithDescription:NSLocalizedString(@"Restoring session...", @"Restoring session task description")]; - if ([NSThread isMainThread]) { + if ([NSThread isMainThread]) [NSThread detachNewThreadSelector:@selector(restoreSession) toTarget:self withObject:nil]; - } else { + else [self restoreSession]; - } + } else { switch ([prefs integerForKey:SPDefaultViewMode] > 0 ? [prefs integerForKey:SPDefaultViewMode] : [prefs integerForKey:SPLastViewMode]) { default: @@ -3025,6 +3028,10 @@ NSInteger tabCount = 0; NSInteger selectedTabItem = 0; for(SPDatabaseDocument *doc in [[window windowController] documents]) { + + // Skip not connected docs eg if connection controller is displayed (TODO maybe to be improved) + if(![doc mySQLVersion]) continue; + NSMutableDictionary *tabData = [NSMutableDictionary dictionary]; if([doc isUntitled]) { // new bundle file name for untitled docs @@ -3047,6 +3054,7 @@ selectedTabItem = tabCount; tabCount++; } + if(![tabs count]) continue; [win setObject:tabs forKey:@"tabs"]; [win setObject:[NSNumber numberWithInteger:selectedTabItem] forKey:@"selectedTabIndex"]; [win setObject:NSStringFromRect([window frame]) forKey:@"frame"]; @@ -3213,7 +3221,8 @@ [spfdata setObject:[NSNumber numberWithInteger:1] forKey:@"version"]; [spfdata setObject:@"connection" forKey:@"format"]; [spfdata setObject:@"mysql" forKey:@"rdbms_type"]; - [spfdata setObject:[self mySQLVersion] forKey:@"rdbms_version"]; + if([self mySQLVersion]) + [spfdata setObject:[self mySQLVersion] forKey:@"rdbms_version"]; // Store the preferences - take them from the current document URL to catch renaming [spfdata setObject:[[SPQueryController sharedQueryController] favoritesForFileURL:[self fileURL]] forKey:SPQueryFavorites]; @@ -3314,6 +3323,7 @@ [session setObject:[NSNumber numberWithBool:[tableContentInstance sortColumnIsAscending]] forKey:@"contentSortColIsAsc"]; [session setObject:[NSNumber numberWithInteger:[tableContentInstance pageNumber]] forKey:@"contentPageNumber"]; + [session setObject:[NSNumber numberWithFloat:[tableContentInstance tablesListWidth]] forKey:@"windowVerticalDividerPosition"]; [session setObject:NSStringFromRect([tableContentInstance viewport]) forKey:@"contentViewport"]; if([tableContentInstance filterSettings]) [session setObject:[tableContentInstance filterSettings] forKey:@"contentFilter"]; -- cgit v1.2.3