diff --git a/camino/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib b/camino/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib index dc75f9a235a..8b074a12eb1 100644 --- a/camino/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib +++ b/camino/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib @@ -49,6 +49,11 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + CLASS = OrgMozillaChimeraPreferencePersonal; + LANGUAGE = ObjC; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } ); IBVersion = 1; diff --git a/camino/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib b/camino/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib index a0052e409ef..d5eed5d269f 100644 --- a/camino/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib +++ b/camino/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 372 4 356 240 0 0 1152 746 + 413 91 356 240 0 0 1152 848 IBFramework Version 248.0 IBGroupedObjects @@ -16,10 +16,6 @@ IBLastGroupID 4 - IBOpenObjects - - 5 - IBSystem Version 5Q125 diff --git a/camino/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib b/camino/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib index 26d0953e8a2..dff6e69f37d 100644 Binary files a/camino/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib and b/camino/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib differ diff --git a/camino/PreferencePanes/Personal/Personal.nib/classes.nib b/camino/PreferencePanes/Personal/Personal.nib/classes.nib index dc75f9a235a..8b074a12eb1 100644 --- a/camino/PreferencePanes/Personal/Personal.nib/classes.nib +++ b/camino/PreferencePanes/Personal/Personal.nib/classes.nib @@ -49,6 +49,11 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + CLASS = OrgMozillaChimeraPreferencePersonal; + LANGUAGE = ObjC; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } ); IBVersion = 1; diff --git a/camino/PreferencePanes/Personal/Personal.nib/info.nib b/camino/PreferencePanes/Personal/Personal.nib/info.nib index a0052e409ef..d5eed5d269f 100644 --- a/camino/PreferencePanes/Personal/Personal.nib/info.nib +++ b/camino/PreferencePanes/Personal/Personal.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 372 4 356 240 0 0 1152 746 + 413 91 356 240 0 0 1152 848 IBFramework Version 248.0 IBGroupedObjects @@ -16,10 +16,6 @@ IBLastGroupID 4 - IBOpenObjects - - 5 - IBSystem Version 5Q125 diff --git a/camino/PreferencePanes/Personal/Personal.nib/objects.nib b/camino/PreferencePanes/Personal/Personal.nib/objects.nib index 26d0953e8a2..dff6e69f37d 100644 Binary files a/camino/PreferencePanes/Personal/Personal.nib/objects.nib and b/camino/PreferencePanes/Personal/Personal.nib/objects.nib differ diff --git a/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib b/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib index 146d93b2507..ecc0c692f2c 100644 --- a/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib +++ b/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib @@ -49,6 +49,25 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + ACTIONS = { + clearCookies = id; + clearDiskCache = id; + clickEnableCookies = id; + clickEnableJS = id; + clickEnableJava = id; + clickPromptForCookie = id; + }; + CLASS = OrgMozillaChimeraPreferencePrivacy; + LANGUAGE = ObjC; + OUTLETS = { + mCookies = id; + mEnableJS = NSButton; + mEnableJava = NSButton; + mPromptForCookie = NSButton; + }; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }, { ACTIONS = {clearCookies = id; clearDiskCache = id; }; diff --git a/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib b/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib index 43a0b465abe..f33009c3242 100644 Binary files a/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib and b/camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib differ diff --git a/camino/PreferencePanes/Privacy/Privacy.nib/classes.nib b/camino/PreferencePanes/Privacy/Privacy.nib/classes.nib index 146d93b2507..ecc0c692f2c 100644 --- a/camino/PreferencePanes/Privacy/Privacy.nib/classes.nib +++ b/camino/PreferencePanes/Privacy/Privacy.nib/classes.nib @@ -49,6 +49,25 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + ACTIONS = { + clearCookies = id; + clearDiskCache = id; + clickEnableCookies = id; + clickEnableJS = id; + clickEnableJava = id; + clickPromptForCookie = id; + }; + CLASS = OrgMozillaChimeraPreferencePrivacy; + LANGUAGE = ObjC; + OUTLETS = { + mCookies = id; + mEnableJS = NSButton; + mEnableJava = NSButton; + mPromptForCookie = NSButton; + }; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }, { ACTIONS = {clearCookies = id; clearDiskCache = id; }; diff --git a/camino/PreferencePanes/Privacy/Privacy.nib/objects.nib b/camino/PreferencePanes/Privacy/Privacy.nib/objects.nib index 43a0b465abe..f33009c3242 100644 Binary files a/camino/PreferencePanes/Privacy/Privacy.nib/objects.nib and b/camino/PreferencePanes/Privacy/Privacy.nib/objects.nib differ diff --git a/camino/PreferencePanes/Privacy/PrivacyPane.h b/camino/PreferencePanes/Privacy/PrivacyPane.h index d10ab3c333a..110a0c670a9 100644 --- a/camino/PreferencePanes/Privacy/PrivacyPane.h +++ b/camino/PreferencePanes/Privacy/PrivacyPane.h @@ -1,6 +1,8 @@ #import #import +class nsIPref; + @interface OrgMozillaChimeraPreferencePrivacy : NSPreferencePane { IBOutlet id mCookies; @@ -8,9 +10,16 @@ IBOutlet NSButton* mEnableJS; IBOutlet NSButton* mEnableJava; + + nsIPref* mPrefService; // strong ref, but can't use comPtr here } -(IBAction) clearCookies:(id)aSender; -(IBAction) clearDiskCache:(id)aSender; +-(IBAction) clickPromptForCookie:(id)sender; +-(IBAction) clickEnableCookies:(id)sender; +-(IBAction) clickEnableJS:(id)sender; +-(IBAction) clickEnableJava:(id)sender; + @end diff --git a/camino/PreferencePanes/Privacy/PrivacyPane.mm b/camino/PreferencePanes/Privacy/PrivacyPane.mm index 50ed3ca6607..88657afa09a 100644 --- a/camino/PreferencePanes/Privacy/PrivacyPane.mm +++ b/camino/PreferencePanes/Privacy/PrivacyPane.mm @@ -10,76 +10,52 @@ - (void) dealloc { - NSLog(@"Going away from Privacy Panel!!!!"); - + NS_IF_RELEASE(mPrefService); } -- (id) initWithBundle:(NSBundle *) bundle { +- (id) initWithBundle:(NSBundle *) bundle +{ self = [super initWithBundle:bundle] ; + + nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); + NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized"); + mPrefService = prefService.get(); + NS_IF_ADDREF(mPrefService); + return self; } - (void)awakeFromNib { - NSLog(@"PrivacyPane awoke from nib"); } - (void)mainViewDidLoad { - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized"); - if ( !prefService ) + if ( !mPrefService ) return; // Hookup cookie prefs. Relies on the tags of the radio buttons in the matrix being // set such that "enable all" is 0 and "disable all" is 2. PRInt32 acceptCookies = 0; - prefService->GetIntPref("network.accept_cookies", &acceptCookies); + mPrefService->GetIntPref("network.accept_cookies", &acceptCookies); if ( acceptCookies == 1 ) // be safe in case of importing a mozilla profile acceptCookies = 2; if ( [mCookies selectCellWithTag:acceptCookies] != YES ) NS_WARNING("Bad value for network.accept_cookies"); PRBool warnAboutCookies = PR_TRUE; - prefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies); + mPrefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies); [mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)]; PRBool jsEnabled = PR_TRUE; - prefService->GetBoolPref("javascript.enabled", &jsEnabled); + mPrefService->GetBoolPref("javascript.enabled", &jsEnabled); [mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)]; PRBool javaEnabled = PR_TRUE; - prefService->GetBoolPref("security.enable_java", &javaEnabled); + mPrefService->GetBoolPref("security.enable_java", &javaEnabled); [mEnableJava setState:(javaEnabled ? NSOnState : NSOffState)]; } - -// -// didUnselect -// -// Called when our panel is no longer the current panel, or when the window is going -// away. Use this as an opportunity to save the current values. -// -- (void)didUnselect -{ - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - NS_ASSERTION(prefService, "Could not get pref service, pref panel values not saved"); - if ( !prefService ) - return; - - // Save cookie prefs. Relies on the tags of the radio buttons in the matrix being - // set such that "enable all" is 0 and "disable all" is 2. - prefService->SetIntPref("network.accept_cookies", [[mCookies selectedCell] tag]); - prefService->SetBoolPref("network.cookie.warnAboutCookies", - [mPromptForCookie state] == NSOnState ? PR_TRUE : PR_FALSE); - - prefService->SetBoolPref("javascript.enabled", - [mEnableJS state] == NSOnState ? PR_TRUE : PR_FALSE); - prefService->SetBoolPref("security.enable_java", - [mEnableJava state] == NSOnState ? PR_TRUE : PR_FALSE); -} - - // // clearCookies: // @@ -92,7 +68,6 @@ cookieMonster->RemoveAll(); } - // // clearDiskCache: // @@ -105,4 +80,56 @@ cacheServ->EvictEntries(nsICache::STORE_ON_DISK); } +// +// clickPromptForCookie: +// +// Set if the user should be prompted for each cookie +// +-(IBAction) clickPromptForCookie:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetBoolPref("network.cookie.warnAboutCookies", + [mPromptForCookie state] == NSOnState ? PR_TRUE : PR_FALSE); +} + +// +// clickEnableCookies: +// +// Set cookie prefs. Relies on the tags of the radio buttons in the matrix being +// set such that "enable all" is 0 and "disable all" is 2. +// +-(IBAction) clickEnableCookies:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetIntPref("network.accept_cookies", [[mCookies selectedCell] tag]); +} + +// +// clickEnableJS +// +// Set pref if JavaScript is enabled +// +-(IBAction) clickEnableJS:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetBoolPref("javascript.enabled", + [mEnableJS state] == NSOnState ? PR_TRUE : PR_FALSE); +} + +// +// clickEnableJava +// +// Set pref if Java is enabled +// +-(IBAction) clickEnableJava:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetBoolPref("security.enable_java", + [mEnableJava state] == NSOnState ? PR_TRUE : PR_FALSE); +} + @end diff --git a/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib b/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib index dc75f9a235a..8b074a12eb1 100644 --- a/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib +++ b/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/classes.nib @@ -49,6 +49,11 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + CLASS = OrgMozillaChimeraPreferencePersonal; + LANGUAGE = ObjC; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } ); IBVersion = 1; diff --git a/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib b/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib index a0052e409ef..d5eed5d269f 100644 --- a/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib +++ b/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 372 4 356 240 0 0 1152 746 + 413 91 356 240 0 0 1152 848 IBFramework Version 248.0 IBGroupedObjects @@ -16,10 +16,6 @@ IBLastGroupID 4 - IBOpenObjects - - 5 - IBSystem Version 5Q125 diff --git a/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib b/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib index 26d0953e8a2..dff6e69f37d 100644 Binary files a/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib and b/chimera/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib differ diff --git a/chimera/PreferencePanes/Personal/Personal.nib/classes.nib b/chimera/PreferencePanes/Personal/Personal.nib/classes.nib index dc75f9a235a..8b074a12eb1 100644 --- a/chimera/PreferencePanes/Personal/Personal.nib/classes.nib +++ b/chimera/PreferencePanes/Personal/Personal.nib/classes.nib @@ -49,6 +49,11 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + CLASS = OrgMozillaChimeraPreferencePersonal; + LANGUAGE = ObjC; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } ); IBVersion = 1; diff --git a/chimera/PreferencePanes/Personal/Personal.nib/info.nib b/chimera/PreferencePanes/Personal/Personal.nib/info.nib index a0052e409ef..d5eed5d269f 100644 --- a/chimera/PreferencePanes/Personal/Personal.nib/info.nib +++ b/chimera/PreferencePanes/Personal/Personal.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 372 4 356 240 0 0 1152 746 + 413 91 356 240 0 0 1152 848 IBFramework Version 248.0 IBGroupedObjects @@ -16,10 +16,6 @@ IBLastGroupID 4 - IBOpenObjects - - 5 - IBSystem Version 5Q125 diff --git a/chimera/PreferencePanes/Personal/Personal.nib/objects.nib b/chimera/PreferencePanes/Personal/Personal.nib/objects.nib index 26d0953e8a2..dff6e69f37d 100644 Binary files a/chimera/PreferencePanes/Personal/Personal.nib/objects.nib and b/chimera/PreferencePanes/Personal/Personal.nib/objects.nib differ diff --git a/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib b/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib index 146d93b2507..ecc0c692f2c 100644 --- a/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib +++ b/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/classes.nib @@ -49,6 +49,25 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + ACTIONS = { + clearCookies = id; + clearDiskCache = id; + clickEnableCookies = id; + clickEnableJS = id; + clickEnableJava = id; + clickPromptForCookie = id; + }; + CLASS = OrgMozillaChimeraPreferencePrivacy; + LANGUAGE = ObjC; + OUTLETS = { + mCookies = id; + mEnableJS = NSButton; + mEnableJava = NSButton; + mPromptForCookie = NSButton; + }; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }, { ACTIONS = {clearCookies = id; clearDiskCache = id; }; diff --git a/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib b/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib index 43a0b465abe..f33009c3242 100644 Binary files a/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib and b/chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib differ diff --git a/chimera/PreferencePanes/Privacy/Privacy.nib/classes.nib b/chimera/PreferencePanes/Privacy/Privacy.nib/classes.nib index 146d93b2507..ecc0c692f2c 100644 --- a/chimera/PreferencePanes/Privacy/Privacy.nib/classes.nib +++ b/chimera/PreferencePanes/Privacy/Privacy.nib/classes.nib @@ -49,6 +49,25 @@ OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; SUPERCLASS = NSObject; }, + { + ACTIONS = { + clearCookies = id; + clearDiskCache = id; + clickEnableCookies = id; + clickEnableJS = id; + clickEnableJava = id; + clickPromptForCookie = id; + }; + CLASS = OrgMozillaChimeraPreferencePrivacy; + LANGUAGE = ObjC; + OUTLETS = { + mCookies = id; + mEnableJS = NSButton; + mEnableJava = NSButton; + mPromptForCookie = NSButton; + }; + SUPERCLASS = NSPreferencePane; + }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }, { ACTIONS = {clearCookies = id; clearDiskCache = id; }; diff --git a/chimera/PreferencePanes/Privacy/Privacy.nib/objects.nib b/chimera/PreferencePanes/Privacy/Privacy.nib/objects.nib index 43a0b465abe..f33009c3242 100644 Binary files a/chimera/PreferencePanes/Privacy/Privacy.nib/objects.nib and b/chimera/PreferencePanes/Privacy/Privacy.nib/objects.nib differ diff --git a/chimera/PreferencePanes/Privacy/PrivacyPane.h b/chimera/PreferencePanes/Privacy/PrivacyPane.h index d10ab3c333a..110a0c670a9 100644 --- a/chimera/PreferencePanes/Privacy/PrivacyPane.h +++ b/chimera/PreferencePanes/Privacy/PrivacyPane.h @@ -1,6 +1,8 @@ #import #import +class nsIPref; + @interface OrgMozillaChimeraPreferencePrivacy : NSPreferencePane { IBOutlet id mCookies; @@ -8,9 +10,16 @@ IBOutlet NSButton* mEnableJS; IBOutlet NSButton* mEnableJava; + + nsIPref* mPrefService; // strong ref, but can't use comPtr here } -(IBAction) clearCookies:(id)aSender; -(IBAction) clearDiskCache:(id)aSender; +-(IBAction) clickPromptForCookie:(id)sender; +-(IBAction) clickEnableCookies:(id)sender; +-(IBAction) clickEnableJS:(id)sender; +-(IBAction) clickEnableJava:(id)sender; + @end diff --git a/chimera/PreferencePanes/Privacy/PrivacyPane.mm b/chimera/PreferencePanes/Privacy/PrivacyPane.mm index 50ed3ca6607..88657afa09a 100644 --- a/chimera/PreferencePanes/Privacy/PrivacyPane.mm +++ b/chimera/PreferencePanes/Privacy/PrivacyPane.mm @@ -10,76 +10,52 @@ - (void) dealloc { - NSLog(@"Going away from Privacy Panel!!!!"); - + NS_IF_RELEASE(mPrefService); } -- (id) initWithBundle:(NSBundle *) bundle { +- (id) initWithBundle:(NSBundle *) bundle +{ self = [super initWithBundle:bundle] ; + + nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); + NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized"); + mPrefService = prefService.get(); + NS_IF_ADDREF(mPrefService); + return self; } - (void)awakeFromNib { - NSLog(@"PrivacyPane awoke from nib"); } - (void)mainViewDidLoad { - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized"); - if ( !prefService ) + if ( !mPrefService ) return; // Hookup cookie prefs. Relies on the tags of the radio buttons in the matrix being // set such that "enable all" is 0 and "disable all" is 2. PRInt32 acceptCookies = 0; - prefService->GetIntPref("network.accept_cookies", &acceptCookies); + mPrefService->GetIntPref("network.accept_cookies", &acceptCookies); if ( acceptCookies == 1 ) // be safe in case of importing a mozilla profile acceptCookies = 2; if ( [mCookies selectCellWithTag:acceptCookies] != YES ) NS_WARNING("Bad value for network.accept_cookies"); PRBool warnAboutCookies = PR_TRUE; - prefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies); + mPrefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies); [mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)]; PRBool jsEnabled = PR_TRUE; - prefService->GetBoolPref("javascript.enabled", &jsEnabled); + mPrefService->GetBoolPref("javascript.enabled", &jsEnabled); [mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)]; PRBool javaEnabled = PR_TRUE; - prefService->GetBoolPref("security.enable_java", &javaEnabled); + mPrefService->GetBoolPref("security.enable_java", &javaEnabled); [mEnableJava setState:(javaEnabled ? NSOnState : NSOffState)]; } - -// -// didUnselect -// -// Called when our panel is no longer the current panel, or when the window is going -// away. Use this as an opportunity to save the current values. -// -- (void)didUnselect -{ - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - NS_ASSERTION(prefService, "Could not get pref service, pref panel values not saved"); - if ( !prefService ) - return; - - // Save cookie prefs. Relies on the tags of the radio buttons in the matrix being - // set such that "enable all" is 0 and "disable all" is 2. - prefService->SetIntPref("network.accept_cookies", [[mCookies selectedCell] tag]); - prefService->SetBoolPref("network.cookie.warnAboutCookies", - [mPromptForCookie state] == NSOnState ? PR_TRUE : PR_FALSE); - - prefService->SetBoolPref("javascript.enabled", - [mEnableJS state] == NSOnState ? PR_TRUE : PR_FALSE); - prefService->SetBoolPref("security.enable_java", - [mEnableJava state] == NSOnState ? PR_TRUE : PR_FALSE); -} - - // // clearCookies: // @@ -92,7 +68,6 @@ cookieMonster->RemoveAll(); } - // // clearDiskCache: // @@ -105,4 +80,56 @@ cacheServ->EvictEntries(nsICache::STORE_ON_DISK); } +// +// clickPromptForCookie: +// +// Set if the user should be prompted for each cookie +// +-(IBAction) clickPromptForCookie:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetBoolPref("network.cookie.warnAboutCookies", + [mPromptForCookie state] == NSOnState ? PR_TRUE : PR_FALSE); +} + +// +// clickEnableCookies: +// +// Set cookie prefs. Relies on the tags of the radio buttons in the matrix being +// set such that "enable all" is 0 and "disable all" is 2. +// +-(IBAction) clickEnableCookies:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetIntPref("network.accept_cookies", [[mCookies selectedCell] tag]); +} + +// +// clickEnableJS +// +// Set pref if JavaScript is enabled +// +-(IBAction) clickEnableJS:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetBoolPref("javascript.enabled", + [mEnableJS state] == NSOnState ? PR_TRUE : PR_FALSE); +} + +// +// clickEnableJava +// +// Set pref if Java is enabled +// +-(IBAction) clickEnableJava:(id)sender +{ + if ( !mPrefService ) + return; + mPrefService->SetBoolPref("security.enable_java", + [mEnableJava state] == NSOnState ? PR_TRUE : PR_FALSE); +} + @end