aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPAppController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-06-29 18:32:43 +0000
committerBibiko <bibiko@eva.mpg.de>2010-06-29 18:32:43 +0000
commitd6b6cd9b10fb6562961be3714c529441f317aa7d (patch)
tree8dd4ef9e5e97dc3cbc9fb3d0c2969bff671c89c2 /Source/SPAppController.m
parent289a0c98b50b6da590b50a14969dfd986bab18c3 (diff)
downloadsequelpro-d6b6cd9b10fb6562961be3714c529441f317aa7d.tar.gz
sequelpro-d6b6cd9b10fb6562961be3714c529441f317aa7d.tar.bz2
sequelpro-d6b6cd9b10fb6562961be3714c529441f317aa7d.zip
• save window's vertical divider position in spf files in order to be able to restore it
• do not save tabs or a single window if connectionController is shown • added comments • added to SPTableContent method "tablesListWidth" to retrieve tablesList's view width
Diffstat (limited to 'Source/SPAppController.m')
-rw-r--r--Source/SPAppController.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 8635fb29..46709aac 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -327,6 +327,7 @@
NSFileManager *fileManager = [NSFileManager defaultManager];
+ // Retrieve Save Panel accessory view data for remembering them globally
NSMutableDictionary *spfsDocData = [NSMutableDictionary dictionary];
[spfsDocData setObject:[NSNumber numberWithBool:[[spfs objectForKey:@"encrypted"] boolValue]] forKey:@"encrypted"];
[spfsDocData setObject:[NSNumber numberWithBool:[[spfs objectForKey:@"auto_connect"] boolValue]] forKey:@"auto_connect"];
@@ -334,15 +335,19 @@
[spfsDocData setObject:[NSNumber numberWithBool:[[spfs objectForKey:@"include_session"] boolValue]] forKey:@"include_session"];
[spfsDocData setObject:[NSNumber numberWithBool:[[spfs objectForKey:@"save_editor_content"] boolValue]] forKey:@"save_editor_content"];
+ // Set global session properties
[[NSApp delegate] setSpfSessionDocData:spfsDocData];
[[NSApp delegate] setSessionURL:filename];
+ // Loop through each defined window in reversed order to reconstruct the last active window
for(NSDictionary *window in [[[spfs objectForKey:@"windows"] reverseObjectEnumerator] allObjects]) {
// Create a new window controller, and set up a new connection view within it.
SPWindowController *newWindowController = [[SPWindowController alloc] initWithWindowNibName:@"MainWindow"];
NSWindow *newWindow = [newWindowController window];
+ // If window has more than 1 tab then set setHideForSingleTab to NO
+ // in order to avoid animation problems while opening tabs
if([[window objectForKey:@"tabs"] count] > 1)
[newWindowController setHideForSingleTab:NO];
@@ -365,11 +370,14 @@
// Show the window
[newWindowController showWindow:self];
+ // Loop through all defined tabs for each window
for(NSDictionary *tab in [window objectForKey:@"tabs"]) {
NSString *fileName = nil;
BOOL isBundleFile = NO;
+ // If isAbsolutePath then take this path directly
+ // otherwise construct the releative path for the passed spfs file
if([[tab objectForKey:@"isAbsolutePath"] boolValue])
fileName = [tab objectForKey:@"path"];
else {
@@ -377,8 +385,10 @@
isBundleFile = YES;
}
+ // Security check if file really exists
if([fileManager fileExistsAtPath:fileName]) {
+ // Add new the tab
if(newWindowController) {
if ([[newWindowController window] isMiniaturized]) [[newWindowController window] deminiaturize:self];
@@ -394,7 +404,9 @@
}
}
+ // Select active tab
[newWindowController selectTabAtIndex:[[window objectForKey:@"selectedTabIndex"] intValue]];
+ // Reset setHideForSingleTab
[newWindowController setHideForSingleTab:YES];
}