Camino only - Backing out Bug 358689 until we can work around the orangeness.

This commit is contained in:
stridey%gmail.com 2007-01-27 06:19:07 +00:00
Родитель 30565cbd6f
Коммит 95090ac10d
2 изменённых файлов: 9 добавлений и 83 удалений

Двоичный файл не отображается.

Просмотреть файл

@ -102,9 +102,6 @@ const int kOpenNewWindowOnAE = 0;
const int kOpenNewTabOnAE = 1;
const int kReuseWindowOnAE = 2;
// Key in the defaults system used to determine if we crashed last time.
NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTerminatedNormally";
@interface MainController(Private)<NetworkServicesClient>
- (void)setupStartpage;
@ -124,7 +121,6 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
- (void)loadApplicationPage:(NSString*)pageURL;
- (NSArray*)browserWindows;
+ (NSURL*)decodeLocalFileURL:(NSURL*)url;
- (BOOL)previousSessionTerminatedNormally;
@end
@ -265,34 +261,14 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
NSString* charsetPath = [NSBundle pathForResource:@"Charset" ofType:@"dict" inDirectory:[[NSBundle mainBundle] bundlePath]];
mCharsets = [[NSDictionary dictionaryWithContentsOfFile:charsetPath] retain];
// Determine if the previous session's window state should be restored.
// Obey the camino.remember_window_state preference unless Camino crashed
// last time, in which case the user is asked what to do.
BOOL shouldRestoreWindowState = NO;
if ([self previousSessionTerminatedNormally]) {
shouldRestoreWindowState = [prefManager getBooleanPref:"camino.remember_window_state" withSuccess:NULL];
}
else {
NSAlert* restoreAfterCrashAlert = [[[NSAlert alloc] init] autorelease];
[restoreAfterCrashAlert addButtonWithTitle:NSLocalizedString(@"RestoreAfterCrashActionButton", nil)];
[restoreAfterCrashAlert addButtonWithTitle:NSLocalizedString(@"RestoreAfterCrashCancelButton", nil)];
[restoreAfterCrashAlert setMessageText:NSLocalizedString(@"RestoreAfterCrashTitle", nil)];
[restoreAfterCrashAlert setInformativeText:NSLocalizedString(@"RestoreAfterCrashMessage", nil)];
[restoreAfterCrashAlert setAlertStyle:NSWarningAlertStyle];
if ([restoreAfterCrashAlert runModal] == NSAlertFirstButtonReturn)
shouldRestoreWindowState = YES;
}
if (shouldRestoreWindowState) {
// restore previous window state
if ([prefManager getBooleanPref:"camino.remember_window_state" withSuccess:NULL]) {
// if we've already opened a window (e.g., command line argument or apple event), we need
// to pull it to the front after restoring the window state
NSWindow* existingWindow = [self getFrontmostBrowserWindow];
[[SessionManager sharedInstance] restoreWindowState];
[existingWindow makeKeyAndOrderFront:self];
}
else {
[[SessionManager sharedInstance] clearSavedState];
}
// open a new browser window if we don't already have one or we have a specific
// start URL we need to show
@ -392,11 +368,6 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
if (curMainWindow && [[curMainWindow windowController] respondsToSelector:@selector(autosaveWindowFrame)])
[[curMainWindow windowController] autosaveWindowFrame];
// Indicate that Camino exited normally. Write the default to disk
// immediately since we cannot wait for automatic synchronization.
[[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:kPreviousSessionTerminatedNormallyKey];
[[NSUserDefaults standardUserDefaults] synchronize];
// Cancel outstanding site icon loads
[[RemoteDataProvider sharedRemoteDataProvider] cancelOutstandingRequests];
@ -500,37 +471,6 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
[self updateDockMenuBookmarkFolder];
}
//
// -previousSessionTerminatedNormally
//
// Checks a saved default indicating whether the last session ended normally.
// The first invocation of this method will check the default on disk and then
// immediately reset it to "NO". This default is set to "YES" upon normal
// termination in -applicationWillTerminate:.
//
- (BOOL)previousSessionTerminatedNormally
{
static BOOL previousSessionTerminatedNormally = NO; // original value from defaults.
static BOOL checked = NO;
if (!checked) {
// Assume the application terminated normally if no key is present to otherwise
// indicate the termination status. Prevents cases where preferences from older
// versions of Camino would falsely indicate a crash.
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObject:@"YES" forKey:kPreviousSessionTerminatedNormallyKey]];
previousSessionTerminatedNormally = [[NSUserDefaults standardUserDefaults] boolForKey:kPreviousSessionTerminatedNormallyKey];
// Reset the termination status default and write it to disk now.
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:kPreviousSessionTerminatedNormallyKey];
[[NSUserDefaults standardUserDefaults] synchronize];
checked = YES;
}
return previousSessionTerminatedNormally;
}
#pragma mark -
#pragma mark Window Accesssors
@ -1521,6 +1461,13 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
[self loadApplicationPage:pageToLoad];
}
- (IBAction)keyboardShortcutsLink:(id)aSender
{
NSString* pageToLoad = NSLocalizedStringFromTable(@"KeyboardShortcutsPageDefault", @"WebsiteDefaults", nil);
if (![pageToLoad isEqualToString:@"KeyboardShortcutsPageDefault"])
[self loadApplicationPage:pageToLoad];
}
- (IBAction)infoLink:(id)aSender
{
NSString* pageToLoad = NSLocalizedStringFromTable(@"InfoPageDefault", @"WebsiteDefaults", nil);
@ -1533,27 +1480,6 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
[self loadApplicationPage:@"about:plugins"];
}
- (IBAction)releaseNoteLink:(id)aSender
{
NSString* pageToLoad = NSLocalizedStringFromTable(@"ReleaseNotesDefault", @"WebsiteDefaults", nil);
if (![pageToLoad isEqualToString:@"ReleaseNotesDefault"])
[self loadApplicationPage:pageToLoad];
}
- (IBAction)tipsTricksLink:(id)aSender
{
NSString* pageToLoad = NSLocalizedStringFromTable(@"TipsTricksPageDefault", @"WebsiteDefaults", nil);
if (![pageToLoad isEqualToString:@"TipsTricksPageDefault"])
[self loadApplicationPage:pageToLoad];
}
- (IBAction)searchCustomizeLink:(id)aSender
{
NSString* pageToLoad = NSLocalizedStringFromTable(@"SearchCustomPageDefault", @"WebsiteDefaults", nil);
if (![pageToLoad isEqualToString:@"SearchCustomPageDefault"])
[self loadApplicationPage:pageToLoad];
}
#pragma mark -
#pragma mark Menu Maintenance