Bug 364496: Display a warning during bookmarks recovery alerting the user we're restoring. r=smorgan sr=pink

This commit is contained in:
stridey%gmail.com 2007-01-05 05:01:43 +00:00
Родитель 52fc663aaa
Коммит e6da6186fc
2 изменённых файлов: 14 добавлений и 1 удалений

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

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

@ -109,6 +109,7 @@ enum {
// Reading bookmark files
- (BOOL)readBookmarks;
- (void)showCorruptBookmarksAlert;
- (void)showRestoredBookmarksAlert;
// these versions assume that we're reading all the bookmarks from the file (i.e. not an import into a subfolder)
- (BOOL)readPListBookmarks:(NSString *)pathToFile; // camino or safari
@ -1321,8 +1322,11 @@ static BookmarkManager* gBookmarkManager = nil;
// Try to recover from the backup, if there is one
if ([fM fileExistsAtPath:backupPath]) {
NSLog(@"Recovering from backup bookmarks file '%@'", backupPath);
if ([self readPListBookmarks:backupPath]) {
// This is a background thread, so we can't put up an alert directly.
[self performSelectorOnMainThread:@selector(showRestoredBookmarksAlert) withObject:nil waitUntilDone:NO];
NSLog(@"Recovering from backup bookmarks file '%@'", backupPath);
[fM copyPath:backupPath toPath:bookmarkPath handler:self];
return YES;
}
@ -1358,6 +1362,15 @@ static BookmarkManager* gBookmarkManager = nil;
nil);
}
- (void)showRestoredBookmarksAlert
{
NSRunAlertPanel(NSLocalizedString(@"RestoredBookmarksAlert", nil),
NSLocalizedString(@"RestoredBookmarksMsg", nil),
NSLocalizedString(@"OKButtonText", nil),
nil,
nil);
}
- (BOOL)readPListBookmarks:(NSString *)pathToFile
{
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile:pathToFile];