bryner%netscape.com a3c670c75f Landing all changes from CHIMERA_M1_0_1_BRANCH onto the trunk, and adapting to trunk API changes. Not part of any normal build.
git-svn-id: svn://10.0.0.236/trunk@135167 18797224-902f-48f8-a5cc-f745e15eee43
2002-12-12 11:34:25 +00:00

92 lines
2.1 KiB
Plaintext

#import "WebFeatures.h"
#include "nsCOMPtr.h"
#include "nsIServiceManagerUtils.h"
#include "nsIPref.h"
@implementation OrgMozillaChimeraPreferenceWebFeatures
- (void) dealloc
{
[super dealloc];
}
- (void)mainViewDidLoad
{
if ( !mPrefService )
return;
// Set initial value on Java/JavaScript checkboxes
PRBool jsEnabled = PR_TRUE;
mPrefService->GetBoolPref("javascript.enabled", &jsEnabled);
[mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)];
PRBool javaEnabled = PR_TRUE;
mPrefService->GetBoolPref("security.enable_java", &javaEnabled);
[mEnableJava setState:(javaEnabled ? NSOnState : NSOffState)];
PRBool pluginsEnabled = PR_TRUE;
mPrefService->GetBoolPref("chimera.enable_plugins", &pluginsEnabled);
[mEnablePlugins setState:(pluginsEnabled ? NSOnState : NSOffState)];
// set initial value on popup blocking checkbox
BOOL gotPref = NO;
BOOL enablePopupBlocking = [self getBooleanPref:"dom.disable_open_during_load" withSuccess:&gotPref] && gotPref;
[mEnablePopupBlocking setState:enablePopupBlocking];
}
//
// clickEnableJS
//
// Set pref if JavaScript is enabled
//
-(IBAction) clickEnableJS:(id)sender
{
[self setPref:"javascript.enabled" toBoolean:[sender state] == NSOnState];
}
//
// clickEnableJava
//
// Set pref if Java is enabled
//
-(IBAction) clickEnableJava:(id)sender
{
[self setPref:"security.enable_java" toBoolean:[sender state] == NSOnState];
}
//
// clickEnablePlugins
//
// Set pref if plugins are enabled
//
-(IBAction) clickEnablePlugins:(id)sender
{
[self setPref:"chimera.enable_plugins" toBoolean:[sender state] == NSOnState];
}
//
// clickEnablePopupBlocking
//
// Enable and disable mozilla's popup blocking feature. We use a combination of
// two prefs to suppress bad popups.
//
- (IBAction)clickEnablePopupBlocking:(id)sender
{
if ( [sender state] ) {
[self setPref:"dom.disable_open_during_load" toBoolean: YES];
[self setPref:"dom.disable_open_click_delay" toInt: 1000];
}
else {
[self setPref:"dom.disable_open_during_load" toBoolean: NO];
[self setPref:"dom.disable_open_click_delay" toInt: 0];
}
}
@end