Fix bug 315886 and bug 295774: add warning sheets when clearing the cache and history in the prefs, and standardize the terminology. Patches based on changes by Smokey Ardisson and Chris Lawson.

git-svn-id: svn://10.0.0.236/trunk@184567 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
smfr%smfr.org
2005-11-14 05:31:36 +00:00
parent ae0564cff6
commit d5cb5a66d2
4 changed files with 58 additions and 5 deletions

View File

@@ -3,10 +3,10 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>111 35 522 320 0 0 1920 1178 </string>
<string>68 33 522 320 0 0 1600 1002 </string>
<key>IBFramework Version</key>
<string>364.0</string>
<string>437.0</string>
<key>IBSystem Version</key>
<string>7W98</string>
<string>8F46</string>
</dict>
</plist>

View File

@@ -47,6 +47,13 @@
const int kDefaultExpireDays = 9;
@interface OrgMozillaChimeraPreferenceHistory(Private)
- (void)doClearDiskCache;
- (void)doClearGlobalHistory;
@end
@implementation OrgMozillaChimeraPreferenceHistory
- (id)initWithBundle:(NSBundle *)bundle
@@ -96,14 +103,60 @@ const int kDefaultExpireDays = 9;
// Clear the user's disk cache
-(IBAction) clearDiskCache:(id)aSender
{
NSBeginCriticalAlertSheet([self getLocalizedString:@"EmptyCacheTitle"],
[self getLocalizedString:@"EmptyButton"],
[self getLocalizedString:@"CancelButtonText"],
nil,
[textFieldHistoryDays window], // any view will do
self,
@selector(clearDiskCacheSheetDidEnd:returnCode:contextInfo:),
nil,
NULL,
[self getLocalizedString:@"EmptyCacheMessage"]);
}
// use the browser history service to clear out the user's global history
- (IBAction)clearGlobalHistory:(id)sender
{
NSBeginCriticalAlertSheet([self getLocalizedString:@"ClearHistoryTitle"],
[self getLocalizedString:@"ClearHistoryButton"],
[self getLocalizedString:@"CancelButtonText"],
nil,
[textFieldHistoryDays window], // any view willl do
self,
@selector(clearGlobalHistorySheetDidEnd:returnCode:contextInfo:),
nil,
NULL,
[self getLocalizedString:@"ClearHistoryMessage"]);
}
#pragma mark -
- (void)clearDiskCacheSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSAlertDefaultReturn)
{
[self doClearDiskCache];
}
}
- (void)clearGlobalHistorySheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSAlertDefaultReturn)
{
[self doClearGlobalHistory];
}
}
- (void)doClearDiskCache
{
nsCOMPtr<nsICacheService> cacheServ ( do_GetService("@mozilla.org/network/cache-service;1") );
if ( cacheServ )
cacheServ->EvictEntries(nsICache::STORE_ANYWHERE);
}
// use the browser history service to clear out the user's global history
- (IBAction)clearGlobalHistory:(id)sender
- (void)doClearGlobalHistory
{
nsCOMPtr<nsIBrowserHistory> hist ( do_GetService("@mozilla.org/browser/global-history;2") );
if ( hist )