aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-06-25 22:26:23 +0000
committerBibiko <bibiko@eva.mpg.de>2010-06-25 22:26:23 +0000
commit4a9e9737832222dac26551c90af7279b348690b2 (patch)
tree763e9464f22c8b6212d60e82fcf729c9bf46701d
parentb8b9b9e732829c21bb422adff2bbd557f1a8eca3 (diff)
downloadsequelpro-4a9e9737832222dac26551c90af7279b348690b2.tar.gz
sequelpro-4a9e9737832222dac26551c90af7279b348690b2.tar.bz2
sequelpro-4a9e9737832222dac26551c90af7279b348690b2.zip
• further progress for open/save session
- remember window position - remember save accessory view settings in spfs file
-rw-r--r--Source/SPAppController.m24
-rw-r--r--Source/SPDatabaseDocument.m9
2 files changed, 23 insertions, 10 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 7d44ee0c..f86a77cf 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -329,17 +329,10 @@
for(NSDictionary *window in [[[spfs objectForKey:@"windows"] reverseObjectEnumerator] allObjects]) {
- static NSPoint cascadeLocation = {.x = 0, .y = 0};
-
// Create a new window controller, and set up a new connection view within it.
SPWindowController *newWindowController = [[SPWindowController alloc] initWithWindowNibName:@"MainWindow"];
NSWindow *newWindow = [newWindowController window];
- // Cascading defaults to on - retrieve the window origin automatically assigned by cascading,
- // and convert to a top left point.
- NSPoint topLeftPoint = [newWindow frame].origin;
- topLeftPoint.y += [newWindow frame].size.height;
-
// The first window should use autosaving; subsequent windows should cascade.
// So attempt to set the frame autosave name; this will succeed for the very
// first window, and fail for others.
@@ -348,8 +341,8 @@
[newWindow setFrameUsingName:@"DBView"];
}
- // Cascade according to the statically stored cascade location.
- cascadeLocation = [newWindow cascadeTopLeftFromPoint:cascadeLocation];
+ if([window objectForKey:@"frame"])
+ [newWindow setFrame:NSRectFromString([window objectForKey:@"frame"]) display:NO];
// Set the window controller as the window's delegate
[newWindow setDelegate:newWindowController];
@@ -389,10 +382,21 @@
}
[newWindowController selectTabAtIndex:[[window objectForKey:@"selectedTabIndex"] intValue]];
- [[NSApp delegate] setSessionURL:filename];
}
+
+ 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"];
+ [spfsDocData setObject:[NSNumber numberWithBool:[[spfs objectForKey:@"save_password"] boolValue]] forKey:@"save_password"];
+ [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"];
+
+ [[NSApp delegate] spfSessionDocData:spfsDocData];
+ [[NSApp delegate] setSessionURL:filename];
+
}
+
[spfs release];
}
else {
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 83288cda..86cfb117 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -2985,6 +2985,14 @@
}
+ [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"encrypted"] boolValue]] forKey:@"encrypted"];
+ [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"auto_connect"] boolValue]] forKey:@"auto_connect"];
+ [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"save_password"] boolValue]] forKey:@"save_password"];
+ [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"include_session"] boolValue]] forKey:@"include_session"];
+ [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"save_editor_content"] boolValue]] forKey:@"save_editor_content"];
+ [info setObject:[NSNumber numberWithInteger:1] forKey:@"version"];
+ [info setObject:@"connection bundle" forKey:@"format"];
+
// Loop through all windows
for(NSWindow *window in [[NSApp delegate] orderedDatabaseConnectionWindows]) {
@@ -3021,6 +3029,7 @@
}
[win setObject:tabs forKey:@"tabs"];
[win setObject:[NSNumber numberWithInteger:selectedTabItem] forKey:@"selectedTabIndex"];
+ [win setObject:NSStringFromRect([window frame]) forKey:@"frame"];
[windows addObject:win];
}
[info setObject:windows forKey:@"windows"];