Camino only - Bug 410110: Use specific cancel text in alerts instead of 'Cancel'. Patch by Markus Magnuson <markus.magnuson@gmail.com>. r=ardissone sr=smorgan

git-svn-id: svn://10.0.0.236/trunk@246833 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
stuart.morgan%alumni.case.edu
2008-03-01 04:44:50 +00:00
parent 304d091bfc
commit b211fbdd16
9 changed files with 128 additions and 87 deletions

View File

@@ -1,14 +1,13 @@
"PreferencePanelLabel" = "History";
"OKButtonText" = "OK";
"CancelButtonText" = "Cancel";
/* Empty cache messages */
/* Empty cache messages (note that these are duplicates from the main bundle) */
"EmptyCacheTitle" = "Are you sure you want to empty the cache?";
"EmptyCacheMessage" = "Camino saves the contents of websites you visit in a cache so that they load more quickly on future visits. You cannot undo this action.";
"EmptyButton" = "Empty Cache";
"EmptyCacheMessage" = "Camino saves the contents of web pages you visit in a cache so that they load more quickly on future visits.\n\nYou cannot undo this action.\n";
"EmptyCacheButtonText" = "Empty Cache";
"DontEmptyButtonText" = "Dont Empty";
/* Clear history message */
/* Clear history message (note that these are duplicates from the main bundle) */
"ClearHistoryTitle" = "Are you sure you want to clear the history?";
"ClearHistoryMessage" = "Clearing your history will erase the list of sites that you have visited. You wont be able to autocomplete the URLs of these sites when typing in the location bar.";
"ClearHistoryButton" = "Clear History";
"ClearHistoryMessage" = "Clearing your history will erase the list of sites that you have visited. You wont be able to autocomplete the URLs of these sites when typing in the location bar.\n\nYou cannot undo this action.\n";
"ClearHistoryButtonText" = "Clear History";
"DontClearButtonText" = "Dont Clear";

View File

@@ -107,47 +107,51 @@ static const int kDefaultExpireDays = 9;
// Clear the user's disk cache
- (IBAction)clearDiskCache:(id)aSender
{
NSBeginCriticalAlertSheet([self localizedStringForKey:@"EmptyCacheTitle"],
[self localizedStringForKey:@"EmptyButton"],
[self localizedStringForKey:@"CancelButtonText"],
nil,
[textFieldHistoryDays window], // any view will do
self,
@selector(clearDiskCacheSheetDidEnd:returnCode:contextInfo:),
nil,
NULL,
[self localizedStringForKey:@"EmptyCacheMessage"]);
NSAlert* clearCacheAlert = [[[NSAlert alloc] init] autorelease];
[clearCacheAlert setMessageText:[self localizedStringForKey:@"EmptyCacheTitle"]];
[clearCacheAlert setInformativeText:[self localizedStringForKey:@"EmptyCacheMessage"]];
[clearCacheAlert addButtonWithTitle:[self localizedStringForKey:@"EmptyCacheButtonText"]];
NSButton* dontEmptyButton = [clearCacheAlert addButtonWithTitle:[self localizedStringForKey:@"DontEmptyButtonText"]];
[dontEmptyButton setKeyEquivalent:@"\e"]; // escape
[clearCacheAlert setAlertStyle:NSCriticalAlertStyle];
[clearCacheAlert beginSheetModalForWindow:[textFieldHistoryDays window]
modalDelegate:self
didEndSelector:@selector(clearDiskCacheAlertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
}
// use the browser history service to clear out the user's global history
- (IBAction)clearGlobalHistory:(id)sender
{
NSBeginCriticalAlertSheet([self localizedStringForKey:@"ClearHistoryTitle"],
[self localizedStringForKey:@"ClearHistoryButton"],
[self localizedStringForKey:@"CancelButtonText"],
nil,
[textFieldHistoryDays window], // any view willl do
self,
@selector(clearGlobalHistorySheetDidEnd:returnCode:contextInfo:),
nil,
NULL,
[self localizedStringForKey:@"ClearHistoryMessage"]);
NSAlert* clearGlobalHistoryAlert = [[[NSAlert alloc] init] autorelease];
[clearGlobalHistoryAlert setMessageText:[self localizedStringForKey:@"ClearHistoryTitle"]];
[clearGlobalHistoryAlert setInformativeText:[self localizedStringForKey:@"ClearHistoryMessage"]];
[clearGlobalHistoryAlert addButtonWithTitle:[self localizedStringForKey:@"ClearHistoryButtonText"]];
NSButton* dontClearButton = [clearGlobalHistoryAlert addButtonWithTitle:[self localizedStringForKey:@"DontClearButtonText"]];
[dontClearButton setKeyEquivalent:@"\e"]; // escape
[clearGlobalHistoryAlert setAlertStyle:NSCriticalAlertStyle];
[clearGlobalHistoryAlert beginSheetModalForWindow:[textFieldHistoryDays window]
modalDelegate:self
didEndSelector:@selector(clearGlobalHistoryAlertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
}
#pragma mark -
- (void)clearDiskCacheSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
- (void)clearDiskCacheAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSAlertDefaultReturn) {
if (returnCode == NSAlertFirstButtonReturn) {
nsCOMPtr<nsICacheService> cacheServ (do_GetService("@mozilla.org/network/cache-service;1"));
if (cacheServ)
cacheServ->EvictEntries(nsICache::STORE_ANYWHERE);
}
}
- (void)clearGlobalHistorySheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
- (void)clearGlobalHistoryAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSAlertDefaultReturn) {
if (returnCode == NSAlertFirstButtonReturn) {
nsCOMPtr<nsIBrowserHistory> hist (do_GetService("@mozilla.org/browser/global-history;2"));
if (hist)
hist->RemoveAllPages();

View File

@@ -8,7 +8,7 @@
"CookieExpiresOnQuit" = "On Quit";
"CancelButtonText" = "Cancel";
"DontRemoveButtonText" = "Dont Remove";
/* cookie removal warning */
"Remove All Cookies" = "Remove All Cookies";

View File

@@ -300,12 +300,16 @@ const int kSortReverse = 1;
- (IBAction)removeAllCookies:(id)aSender
{
if (NSRunCriticalAlertPanel([self localizedStringForKey:@"RemoveAllCookiesWarningTitle"],
[self localizedStringForKey:@"RemoveAllCookiesWarning"],
[self localizedStringForKey:@"Remove All Cookies"],
[self localizedStringForKey:@"CancelButtonText"],
nil) == NSAlertDefaultReturn)
{
NSAlert* removeAllCookiesAlert = [[[NSAlert alloc] init] autorelease];
[removeAllCookiesAlert setMessageText:[self localizedStringForKey:@"RemoveAllCookiesWarningTitle"]];
[removeAllCookiesAlert setInformativeText:[self localizedStringForKey:@"RemoveAllCookiesWarning"]];
[removeAllCookiesAlert addButtonWithTitle:[self localizedStringForKey:@"Remove All Cookies"]];
NSButton* dontRemoveButton = [removeAllCookiesAlert addButtonWithTitle:[self localizedStringForKey:@"DontRemoveButtonText"]];
[dontRemoveButton setKeyEquivalent:@"\e"]; // escape
[removeAllCookiesAlert setAlertStyle:NSCriticalAlertStyle];
if ([removeAllCookiesAlert runModal] == NSAlertFirstButtonReturn) {
[[CHCookieStorage cookieStorage] deleteAllCookies];
[mCookies release];
@@ -512,12 +516,17 @@ const int kSortReverse = 1;
CHPermissionManager* permManager = [CHPermissionManager permissionManager];
if (!permManager)
return;
if (NSRunCriticalAlertPanel([self localizedStringForKey:@"RemoveAllCookiePermissionsWarningTitle"],
[self localizedStringForKey:@"RemoveAllCookiePermissionsWarning"],
[self localizedStringForKey:@"Remove All Exceptions"],
[self localizedStringForKey:@"CancelButtonText"],
nil) == NSAlertDefaultReturn)
{
NSAlert* removeAllCookiePermissionsAlert = [[[NSAlert alloc] init] autorelease];
[removeAllCookiePermissionsAlert setMessageText:[self localizedStringForKey:@"RemoveAllCookiePermissionsWarningTitle"]];
[removeAllCookiePermissionsAlert setInformativeText:[self localizedStringForKey:@"RemoveAllCookiePermissionsWarning"]];
[removeAllCookiePermissionsAlert addButtonWithTitle:[self localizedStringForKey:@"Remove All Exceptions"]];
NSButton* dontRemoveButton = [removeAllCookiePermissionsAlert addButtonWithTitle:[self localizedStringForKey:@"DontRemoveButtonText"]];
[dontRemoveButton setKeyEquivalent:@"\e"]; // escape
[removeAllCookiePermissionsAlert setAlertStyle:NSCriticalAlertStyle];
if ([removeAllCookiePermissionsAlert runModal] == NSAlertFirstButtonReturn) {
NSEnumerator* permissionEnumerator = [mPermissions objectEnumerator];
CHPermission* permission;
while ((permission = [permissionEnumerator nextObject])) {
@@ -637,11 +646,16 @@ const int kSortReverse = 1;
}
- (IBAction)removeAllKeychainExclusions:(id)sender {
if (NSRunCriticalAlertPanel([self localizedStringForKey:@"RemoveAllKeychainExclusionsWarningTitle"],
[self localizedStringForKey:@"RemoveAllKeychainExclusionsWarning"],
[self localizedStringForKey:@"RemoveAllKeychainExclusionsButton"],
[self localizedStringForKey:@"CancelButtonText"],
nil) == NSAlertDefaultReturn) {
NSAlert* removeAllKeychainExclusionsAlert = [[[NSAlert alloc] init] autorelease];
[removeAllKeychainExclusionsAlert setMessageText:[self localizedStringForKey:@"RemoveAllKeychainExclusionsWarningTitle"]];
[removeAllKeychainExclusionsAlert setInformativeText:[self localizedStringForKey:@"RemoveAllKeychainExclusionsWarning"]];
[removeAllKeychainExclusionsAlert addButtonWithTitle:[self localizedStringForKey:@"RemoveAllKeychainExclusionsButton"]];
NSButton* dontRemoveButton = [removeAllKeychainExclusionsAlert addButtonWithTitle:[self localizedStringForKey:@"DontRemoveButtonText"]];
[dontRemoveButton setKeyEquivalent:@"\e"]; // escape
[removeAllKeychainExclusionsAlert setAlertStyle:NSCriticalAlertStyle];
if ([removeAllKeychainExclusionsAlert runModal] == NSAlertFirstButtonReturn) {
[[KeychainDenyList instance] removeAllHosts];
[mKeychainExclusions removeAllObjects];
[mKeychainExclusionsTable reloadData];

View File

@@ -4,6 +4,8 @@
"OKButtonText" = "OK";
"CancelButtonText" = "Cancel";
"QuitButtonText" = "Quit";
"DontQuitButtonText" = "Dont Quit";
"DontCloseButtonText" = "Dont Close";
"ChooseDirectoryOKButton" = "Select";
"DontShowWarningAgainCheckboxLabel" = "Dont show this warning again";
@@ -42,6 +44,7 @@
/* close multiple windows */
"CloseMultipleWindowsMsg" = "Are you sure you want to close all windows?";
"CloseMultipleWindowsExpl" = "You have %u windows open. If you close these windows, you will lose any information that you entered in them.";
"CloseWindowsButtonText" = "Close Windows";
/* quit multiple windows/tabs */
"QuitWithMultipleWindowsMsg" = "Are you sure you want to quit when there are multiple open windows?";
@@ -69,7 +72,6 @@
/* quit with downloads alert */
"QuitWithDownloadsMsg" = "Are you sure you want to quit?";
"QuitWithDownloadsExpl" = "There are downloads in progress that will be stopped if you quit now.";
"QuitWithDownloadsButtonDefault" = "Dont Quit";
/* Parser error loading bookmarks.xml file */
"CorruptedBookmarksAlert" = "Error Reading Bookmarks";
@@ -385,6 +387,7 @@
"Reset Camino Title" = "Are you sure you want to reset Camino?";
"Reset Warning Message" = "Resetting Camino will erase your browsing history, empty the cache, clear downloads, clear all cookies and site cookie permissions, and remove any passwords Camino saved in your Keychain.\n\nYou cannot undo this action.\n";
"Reset Camino" = "Reset Camino";
"DontResetButtonText" = "Dont Reset";
/* History labels */
"Tomorrow" = "Tomorrow";
@@ -401,13 +404,15 @@
/* Empty cache messages (note that these are duplicated in the History prefs panel) */
"EmptyCacheTitle" = "Are you sure you want to empty the cache?";
"EmptyCacheMessage" = "Camino saves the contents of web pages you visit in a cache so that they load more quickly on future visits.\n\nYou cannot undo this action.\n";
"EmptyButton" = "Empty";
"EmptyCacheButtonText" = "Empty Cache";
"DontEmptyButtonText" = "Dont Empty";
/* Clear history message (note that these are duplicated in the History prefs panel) */
"ClearHistoryMenuItem" = "Clear History…";
"ClearHistoryTitle" = "Are you sure you want to clear the history?";
"ClearHistoryMessage" = "Clearing your history will erase the list of sites that you have visited. You wont be able to autocomplete the URLs of these sites when typing in the location bar.\n\nYou cannot undo this action.\n";
"ClearHistoryButton" = "Clear History";
"ClearHistoryButtonText" = "Clear History";
"DontClearButtonText" = "Dont Clear";
"ShowMoreHistoryMenuItem" = "Show More";
@@ -455,6 +460,7 @@
"RestoreDefaultEnginesTitle" = "Restore the default search engines?";
"RestoreDefaultEnginesMessage" = "Restoring the default search engines will replace all of the engines that are currently installed.\n\nYou cannot undo this action.\n";
"RestoreDefaultEnginesActionButton" = "Restore Default Engines";
"DontRestoreDefaultEnginesActionButton" = "Dont Restore";
/* Web Search Plug-ins */
"InstallSearchPluginMenuItem" = "Add “%@”";

View File

@@ -412,7 +412,7 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
title:quitAlertMsg
text:quitAlertExpl
button1:NSLocalizedString(@"QuitButtonText", @"")
button2:NSLocalizedString(@"CancelButtonText", @"")
button2:NSLocalizedString(@"DontQuitButtonText", @"")
button3:nil
checkMsg:NSLocalizedString(@"DontShowWarningAgainCheckboxLabel", @"")
checkValue:&dontShowAgain];
@@ -1020,13 +1020,18 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
//
- (IBAction)resetBrowser:(id)sender
{
if (NSRunCriticalAlertPanel(NSLocalizedString(@"Reset Camino Title", nil),
NSLocalizedString(@"Reset Warning Message", nil),
NSLocalizedString(@"Reset Camino", nil),
NSLocalizedString(@"CancelButtonText", nil),
nil) == NSAlertDefaultReturn)
{
NSAlert* resetBrowserAlert = [[[NSAlert alloc] init] autorelease];
[resetBrowserAlert setMessageText:NSLocalizedString(@"Reset Camino Title", nil)];
[resetBrowserAlert setInformativeText:NSLocalizedString(@"Reset Warning Message", nil)];
[resetBrowserAlert addButtonWithTitle:NSLocalizedString(@"Reset Camino", nil)];
NSButton* dontResetButton = [resetBrowserAlert addButtonWithTitle:NSLocalizedString(@"DontResetButtonText", nil)];
[dontResetButton setKeyEquivalent:@"\e"]; // escape
[resetBrowserAlert setAlertStyle:NSCriticalAlertStyle];
[NSMenu cancelAllTracking];
if ([resetBrowserAlert runModal] == NSAlertFirstButtonReturn) {
// close all windows
NSArray* openWindows = [[NSApp orderedWindows] copy];
NSEnumerator* windowEnum = [openWindows objectEnumerator];
@@ -1086,11 +1091,18 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
//
- (IBAction)emptyCache:(id)sender
{
if (NSRunCriticalAlertPanel(NSLocalizedString(@"EmptyCacheTitle", nil),
NSLocalizedString(@"EmptyCacheMessage", nil),
NSLocalizedString(@"EmptyButton", nil),
NSLocalizedString(@"CancelButtonText", nil), nil) == NSAlertDefaultReturn)
{
NSAlert* emptyCacheAlert = [[[NSAlert alloc] init] autorelease];
[emptyCacheAlert setMessageText:NSLocalizedString(@"EmptyCacheTitle", nil)];
[emptyCacheAlert setInformativeText:NSLocalizedString(@"EmptyCacheMessage", nil)];
[emptyCacheAlert addButtonWithTitle:NSLocalizedString(@"EmptyCacheButtonText", nil)];
NSButton* dontEmptyButton = [emptyCacheAlert addButtonWithTitle:NSLocalizedString(@"DontEmptyButtonText", nil)];
[dontEmptyButton setKeyEquivalent:@"\e"]; // escape
[emptyCacheAlert setAlertStyle:NSCriticalAlertStyle];
[NSMenu cancelAllTracking];
if ([emptyCacheAlert runModal] == NSAlertFirstButtonReturn) {
// remove cache
nsCOMPtr<nsICacheService> cacheServ (do_GetService("@mozilla.org/network/cache-service;1"));
if (cacheServ)
@@ -1274,8 +1286,8 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
doCloseWindows = [controller confirmCheckEx:nil
title:closeAlertMsg
text:closeAlertExpl
button1:NSLocalizedString(@"OKButtonText", @"")
button2:NSLocalizedString(@"CancelButtonText", @"")
button1:NSLocalizedString(@"CloseWindowsButtonText", @"")
button2:NSLocalizedString(@"DontCloseButtonText", @"")
button3:nil
checkMsg:NSLocalizedString(@"DontShowWarningAgainCheckboxLabel", @"")
checkValue:&dontShowAgain];
@@ -1516,12 +1528,18 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
//
- (IBAction)clearHistory:(id)aSender
{
if (NSRunCriticalAlertPanel(NSLocalizedString(@"ClearHistoryTitle", nil),
NSLocalizedString(@"ClearHistoryMessage", nil),
NSLocalizedString(@"ClearHistoryButton", nil),
NSLocalizedString(@"CancelButtonText", nil),
nil) == NSAlertDefaultReturn)
{
NSAlert* clearHistoryAlert = [[[NSAlert alloc] init] autorelease];
[clearHistoryAlert setMessageText:NSLocalizedString(@"ClearHistoryTitle", nil)];
[clearHistoryAlert setInformativeText:NSLocalizedString(@"ClearHistoryMessage", nil)];
[clearHistoryAlert addButtonWithTitle:NSLocalizedString(@"ClearHistoryButtonText", nil)];
NSButton* dontClearButton = [clearHistoryAlert addButtonWithTitle:NSLocalizedString(@"DontClearButtonText", nil)];
[dontClearButton setKeyEquivalent:@"\e"]; // escape
[clearHistoryAlert setAlertStyle:NSCriticalAlertStyle];
[NSMenu cancelAllTracking];
if ([clearHistoryAlert runModal] == NSAlertFirstButtonReturn) {
// clear history
nsCOMPtr<nsIBrowserHistory> hist = do_GetService("@mozilla.org/browser/global-history;2");
if (hist)

View File

@@ -752,7 +752,7 @@ public:
title:NSLocalizedString(@"CloseWindowWithMultipleTabsMsg", @"")
text:[NSString stringWithFormat:closeMultipleTabWarning, numberOfTabs]
button1:NSLocalizedString(@"CloseWindowWithMultipleTabsButton", @"")
button2:NSLocalizedString(@"CancelButtonText", @"")
button2:NSLocalizedString(@"DontCloseButtonText", @"")
button3:nil
checkMsg:NSLocalizedString(@"DontShowWarningAgainCheckboxLabel", @"")
checkValue:&dontShowAgain];

View File

@@ -702,8 +702,7 @@ static id gSharedProgressController = nil;
NSString *title = NSLocalizedString(@"QuitWithDownloadsMsg", nil);
NSString *text = NSLocalizedString(@"QuitWithDownloadsExpl", nil);
NSString *dontQuit = NSLocalizedString(@"QuitWithDownloadsButtonDefault",
nil);
NSString *dontQuit = NSLocalizedString(@"DontQuitButtonText", nil);
NSString *quit = NSLocalizedString(@"QuitButtonText", nil);
nsAlertController* alertController = [nsAlertController sharedController];

View File

@@ -147,16 +147,17 @@ static NSString *const kSearchEngineEditorDraggedEngineType = @"SearchEngineEdit
- (IBAction)restoreDefaultSearchEngines:(id)sender
{
// Since this will remove all existing engines, ask the user for confirmation
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle:NSLocalizedString(@"RestoreDefaultEnginesActionButton", nil)];
[alert addButtonWithTitle:NSLocalizedString(@"CancelButtonText", nil)];
[alert setMessageText:NSLocalizedString(@"RestoreDefaultEnginesTitle", nil)];
[alert setInformativeText:NSLocalizedString(@"RestoreDefaultEnginesMessage", nil)];
[alert setAlertStyle:NSWarningAlertStyle];
[alert beginSheetModalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(restoreDefaultEnginesAlertDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
NSAlert *restoreDefaultSearchEnginesAlert = [[[NSAlert alloc] init] autorelease];
[restoreDefaultSearchEnginesAlert addButtonWithTitle:NSLocalizedString(@"RestoreDefaultEnginesActionButton", nil)];
NSButton* dontRestoreButton = [restoreDefaultSearchEnginesAlert addButtonWithTitle:NSLocalizedString(@"DontRestoreDefaultEnginesActionButton", nil)];
[dontRestoreButton setKeyEquivalent:@"\e"]; // escape
[restoreDefaultSearchEnginesAlert setMessageText:NSLocalizedString(@"RestoreDefaultEnginesTitle", nil)];
[restoreDefaultSearchEnginesAlert setInformativeText:NSLocalizedString(@"RestoreDefaultEnginesMessage", nil)];
[restoreDefaultSearchEnginesAlert setAlertStyle:NSWarningAlertStyle];
[restoreDefaultSearchEnginesAlert beginSheetModalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(restoreDefaultEnginesAlertDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
}
- (void)restoreDefaultEnginesAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo