зеркало из https://github.com/mozilla/pjs.git
Bug 364496: Display a warning during bookmarks recovery alerting the user we're restoring. r=smorgan sr=pink
This commit is contained in:
Родитель
52fc663aaa
Коммит
e6da6186fc
Двоичные данные
camino/resources/localized/English.lproj/Localizable.strings
Двоичные данные
camino/resources/localized/English.lproj/Localizable.strings
Двоичный файл не отображается.
|
@ -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];
|
||||
|
|
Загрузка…
Ссылка в новой задаче