Updated nibs for new classnames. Made Privacy pane set prefs as soon

as you click the control, not only when the panel goes away.
This commit is contained in:
pinkerton%netscape.com 2002-05-30 19:12:35 +00:00
Родитель 5b0021ff9d
Коммит 08cd7ea08e
24 изменённых файлов: 250 добавлений и 98 удалений

Просмотреть файл

@ -49,6 +49,11 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{
CLASS = OrgMozillaChimeraPreferencePersonal;
LANGUAGE = ObjC;
SUPERCLASS = NSPreferencePane;
},
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
); );
IBVersion = 1; IBVersion = 1;

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9"> <plist version="0.9">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>372 4 356 240 0 0 1152 746 </string> <string>413 91 356 240 0 0 1152 848 </string>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>248.0</string> <string>248.0</string>
<key>IBGroupedObjects</key> <key>IBGroupedObjects</key>
@ -16,10 +16,6 @@
</dict> </dict>
<key>IBLastGroupID</key> <key>IBLastGroupID</key>
<string>4</string> <string>4</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>5Q125</string> <string>5Q125</string>
</dict> </dict>

Двоичные данные
camino/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -49,6 +49,11 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{
CLASS = OrgMozillaChimeraPreferencePersonal;
LANGUAGE = ObjC;
SUPERCLASS = NSPreferencePane;
},
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
); );
IBVersion = 1; IBVersion = 1;

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9"> <plist version="0.9">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>372 4 356 240 0 0 1152 746 </string> <string>413 91 356 240 0 0 1152 848 </string>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>248.0</string> <string>248.0</string>
<key>IBGroupedObjects</key> <key>IBGroupedObjects</key>
@ -16,10 +16,6 @@
</dict> </dict>
<key>IBLastGroupID</key> <key>IBLastGroupID</key>
<string>4</string> <string>4</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>5Q125</string> <string>5Q125</string>
</dict> </dict>

Двоичные данные
camino/PreferencePanes/Personal/Personal.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -49,6 +49,25 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; 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; }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
{ {
ACTIONS = {clearCookies = id; clearDiskCache = id; }; ACTIONS = {clearCookies = id; clearDiskCache = id; };

Двоичные данные
camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib сгенерированный

Двоичный файл не отображается.

19
camino/PreferencePanes/Privacy/Privacy.nib/classes.nib сгенерированный
Просмотреть файл

@ -49,6 +49,25 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; 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; }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
{ {
ACTIONS = {clearCookies = id; clearDiskCache = id; }; ACTIONS = {clearCookies = id; clearDiskCache = id; };

Двоичные данные
camino/PreferencePanes/Privacy/Privacy.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -1,6 +1,8 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <PreferencePanes/NSPreferencePane.h> #import <PreferencePanes/NSPreferencePane.h>
class nsIPref;
@interface OrgMozillaChimeraPreferencePrivacy : NSPreferencePane @interface OrgMozillaChimeraPreferencePrivacy : NSPreferencePane
{ {
IBOutlet id mCookies; IBOutlet id mCookies;
@ -8,9 +10,16 @@
IBOutlet NSButton* mEnableJS; IBOutlet NSButton* mEnableJS;
IBOutlet NSButton* mEnableJava; IBOutlet NSButton* mEnableJava;
nsIPref* mPrefService; // strong ref, but can't use comPtr here
} }
-(IBAction) clearCookies:(id)aSender; -(IBAction) clearCookies:(id)aSender;
-(IBAction) clearDiskCache:(id)aSender; -(IBAction) clearDiskCache:(id)aSender;
-(IBAction) clickPromptForCookie:(id)sender;
-(IBAction) clickEnableCookies:(id)sender;
-(IBAction) clickEnableJS:(id)sender;
-(IBAction) clickEnableJava:(id)sender;
@end @end

Просмотреть файл

@ -10,76 +10,52 @@
- (void) dealloc - (void) dealloc
{ {
NSLog(@"Going away from Privacy Panel!!!!"); NS_IF_RELEASE(mPrefService);
} }
- (id) initWithBundle:(NSBundle *) bundle { - (id) initWithBundle:(NSBundle *) bundle
{
self = [super initWithBundle:bundle] ; self = [super initWithBundle:bundle] ;
nsCOMPtr<nsIPref> 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; return self;
} }
- (void)awakeFromNib - (void)awakeFromNib
{ {
NSLog(@"PrivacyPane awoke from nib");
} }
- (void)mainViewDidLoad - (void)mainViewDidLoad
{ {
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) ); if ( !mPrefService )
NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized");
if ( !prefService )
return; return;
// Hookup cookie prefs. Relies on the tags of the radio buttons in the matrix being // 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. // set such that "enable all" is 0 and "disable all" is 2.
PRInt32 acceptCookies = 0; 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 if ( acceptCookies == 1 ) // be safe in case of importing a mozilla profile
acceptCookies = 2; acceptCookies = 2;
if ( [mCookies selectCellWithTag:acceptCookies] != YES ) if ( [mCookies selectCellWithTag:acceptCookies] != YES )
NS_WARNING("Bad value for network.accept_cookies"); NS_WARNING("Bad value for network.accept_cookies");
PRBool warnAboutCookies = PR_TRUE; PRBool warnAboutCookies = PR_TRUE;
prefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies); mPrefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies);
[mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)]; [mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)];
PRBool jsEnabled = PR_TRUE; PRBool jsEnabled = PR_TRUE;
prefService->GetBoolPref("javascript.enabled", &jsEnabled); mPrefService->GetBoolPref("javascript.enabled", &jsEnabled);
[mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)]; [mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)];
PRBool javaEnabled = PR_TRUE; PRBool javaEnabled = PR_TRUE;
prefService->GetBoolPref("security.enable_java", &javaEnabled); mPrefService->GetBoolPref("security.enable_java", &javaEnabled);
[mEnableJava setState:(javaEnabled ? NSOnState : NSOffState)]; [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<nsIPref> 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: // clearCookies:
// //
@ -92,7 +68,6 @@
cookieMonster->RemoveAll(); cookieMonster->RemoveAll();
} }
// //
// clearDiskCache: // clearDiskCache:
// //
@ -105,4 +80,56 @@
cacheServ->EvictEntries(nsICache::STORE_ON_DISK); 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 @end

Просмотреть файл

@ -49,6 +49,11 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{
CLASS = OrgMozillaChimeraPreferencePersonal;
LANGUAGE = ObjC;
SUPERCLASS = NSPreferencePane;
},
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
); );
IBVersion = 1; IBVersion = 1;

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9"> <plist version="0.9">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>372 4 356 240 0 0 1152 746 </string> <string>413 91 356 240 0 0 1152 848 </string>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>248.0</string> <string>248.0</string>
<key>IBGroupedObjects</key> <key>IBGroupedObjects</key>
@ -16,10 +16,6 @@
</dict> </dict>
<key>IBLastGroupID</key> <key>IBLastGroupID</key>
<string>4</string> <string>4</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>5Q125</string> <string>5Q125</string>
</dict> </dict>

Двоичные данные
chimera/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -49,6 +49,11 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{
CLASS = OrgMozillaChimeraPreferencePersonal;
LANGUAGE = ObjC;
SUPERCLASS = NSPreferencePane;
},
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; } {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
); );
IBVersion = 1; IBVersion = 1;

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9"> <plist version="0.9">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>372 4 356 240 0 0 1152 746 </string> <string>413 91 356 240 0 0 1152 848 </string>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>248.0</string> <string>248.0</string>
<key>IBGroupedObjects</key> <key>IBGroupedObjects</key>
@ -16,10 +16,6 @@
</dict> </dict>
<key>IBLastGroupID</key> <key>IBLastGroupID</key>
<string>4</string> <string>4</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>5Q125</string> <string>5Q125</string>
</dict> </dict>

Двоичные данные
chimera/PreferencePanes/Personal/Personal.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -49,6 +49,25 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; 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; }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
{ {
ACTIONS = {clearCookies = id; clearDiskCache = id; }; ACTIONS = {clearCookies = id; clearDiskCache = id; };

Двоичные данные
chimera/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -49,6 +49,25 @@
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; }; OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
SUPERCLASS = NSObject; 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; }, {CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
{ {
ACTIONS = {clearCookies = id; clearDiskCache = id; }; ACTIONS = {clearCookies = id; clearDiskCache = id; };

Двоичные данные
chimera/PreferencePanes/Privacy/Privacy.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -1,6 +1,8 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <PreferencePanes/NSPreferencePane.h> #import <PreferencePanes/NSPreferencePane.h>
class nsIPref;
@interface OrgMozillaChimeraPreferencePrivacy : NSPreferencePane @interface OrgMozillaChimeraPreferencePrivacy : NSPreferencePane
{ {
IBOutlet id mCookies; IBOutlet id mCookies;
@ -8,9 +10,16 @@
IBOutlet NSButton* mEnableJS; IBOutlet NSButton* mEnableJS;
IBOutlet NSButton* mEnableJava; IBOutlet NSButton* mEnableJava;
nsIPref* mPrefService; // strong ref, but can't use comPtr here
} }
-(IBAction) clearCookies:(id)aSender; -(IBAction) clearCookies:(id)aSender;
-(IBAction) clearDiskCache:(id)aSender; -(IBAction) clearDiskCache:(id)aSender;
-(IBAction) clickPromptForCookie:(id)sender;
-(IBAction) clickEnableCookies:(id)sender;
-(IBAction) clickEnableJS:(id)sender;
-(IBAction) clickEnableJava:(id)sender;
@end @end

Просмотреть файл

@ -10,76 +10,52 @@
- (void) dealloc - (void) dealloc
{ {
NSLog(@"Going away from Privacy Panel!!!!"); NS_IF_RELEASE(mPrefService);
} }
- (id) initWithBundle:(NSBundle *) bundle { - (id) initWithBundle:(NSBundle *) bundle
{
self = [super initWithBundle:bundle] ; self = [super initWithBundle:bundle] ;
nsCOMPtr<nsIPref> 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; return self;
} }
- (void)awakeFromNib - (void)awakeFromNib
{ {
NSLog(@"PrivacyPane awoke from nib");
} }
- (void)mainViewDidLoad - (void)mainViewDidLoad
{ {
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) ); if ( !mPrefService )
NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized");
if ( !prefService )
return; return;
// Hookup cookie prefs. Relies on the tags of the radio buttons in the matrix being // 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. // set such that "enable all" is 0 and "disable all" is 2.
PRInt32 acceptCookies = 0; 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 if ( acceptCookies == 1 ) // be safe in case of importing a mozilla profile
acceptCookies = 2; acceptCookies = 2;
if ( [mCookies selectCellWithTag:acceptCookies] != YES ) if ( [mCookies selectCellWithTag:acceptCookies] != YES )
NS_WARNING("Bad value for network.accept_cookies"); NS_WARNING("Bad value for network.accept_cookies");
PRBool warnAboutCookies = PR_TRUE; PRBool warnAboutCookies = PR_TRUE;
prefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies); mPrefService->GetBoolPref("network.cookie.warnAboutCookies", &warnAboutCookies);
[mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)]; [mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)];
PRBool jsEnabled = PR_TRUE; PRBool jsEnabled = PR_TRUE;
prefService->GetBoolPref("javascript.enabled", &jsEnabled); mPrefService->GetBoolPref("javascript.enabled", &jsEnabled);
[mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)]; [mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)];
PRBool javaEnabled = PR_TRUE; PRBool javaEnabled = PR_TRUE;
prefService->GetBoolPref("security.enable_java", &javaEnabled); mPrefService->GetBoolPref("security.enable_java", &javaEnabled);
[mEnableJava setState:(javaEnabled ? NSOnState : NSOffState)]; [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<nsIPref> 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: // clearCookies:
// //
@ -92,7 +68,6 @@
cookieMonster->RemoveAll(); cookieMonster->RemoveAll();
} }
// //
// clearDiskCache: // clearDiskCache:
// //
@ -105,4 +80,56 @@
cacheServ->EvictEntries(nsICache::STORE_ON_DISK); 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 @end