зеркало из https://github.com/mozilla/pjs.git
Adding privacy panel
This commit is contained in:
Родитель
07ef4c3888
Коммит
b84ccc498f
|
@ -49,7 +49,19 @@
|
|||
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
|
||||
{
|
||||
ACTIONS = {clearCookies = id; clearDiskCache = id; };
|
||||
CLASS = PrivacyPane;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mCookies = id;
|
||||
mEnableJS = NSButton;
|
||||
mEnableJava = NSButton;
|
||||
mPromptForCookie = NSButton;
|
||||
};
|
||||
SUPERCLASS = NSPreferencePane;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -3,15 +3,15 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>372 4 356 240 0 0 1152 746 </string>
|
||||
<string>377 51 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBGroupedObjects</key>
|
||||
<dict>
|
||||
<key>3</key>
|
||||
<array>
|
||||
<string>153</string>
|
||||
<string>155</string>
|
||||
<string>0</string>
|
||||
<string>0</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
|
|
Двоичные данные
camino/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib
сгенерированный
Двоичные данные
camino/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -49,7 +49,19 @@
|
|||
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
|
||||
{
|
||||
ACTIONS = {clearCookies = id; clearDiskCache = id; };
|
||||
CLASS = PrivacyPane;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mCookies = id;
|
||||
mEnableJS = NSButton;
|
||||
mEnableJava = NSButton;
|
||||
mPromptForCookie = NSButton;
|
||||
};
|
||||
SUPERCLASS = NSPreferencePane;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -3,15 +3,15 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>372 4 356 240 0 0 1152 746 </string>
|
||||
<string>377 51 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBGroupedObjects</key>
|
||||
<dict>
|
||||
<key>3</key>
|
||||
<array>
|
||||
<string>153</string>
|
||||
<string>155</string>
|
||||
<string>0</string>
|
||||
<string>0</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
|
|
Двоичный файл не отображается.
|
@ -10,10 +10,12 @@
|
|||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSLog(@"Personal Pane awoke from nib");
|
||||
}
|
||||
|
||||
- (void)mainViewDidLoad
|
||||
{
|
||||
NSLog(@"Personal Pane did load main view");
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Двоичный файл не отображается.
|
@ -0,0 +1,16 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import <PreferencePanes/NSPreferencePane.h>
|
||||
|
||||
@interface PrivacyPane : NSPreferencePane
|
||||
{
|
||||
IBOutlet id mCookies;
|
||||
IBOutlet NSButton* mPromptForCookie;
|
||||
|
||||
IBOutlet NSButton* mEnableJS;
|
||||
IBOutlet NSButton* mEnableJava;
|
||||
}
|
||||
|
||||
-(IBAction) clearCookies:(id)aSender;
|
||||
-(IBAction) clearDiskCache:(id)aSender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,108 @@
|
|||
#import "PrivacyPane.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsCCookieManager.h"
|
||||
#include "nsICacheService.h"
|
||||
|
||||
@implementation PrivacyPane
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
NSLog(@"Going away from Privacy Panel!!!!");
|
||||
|
||||
}
|
||||
|
||||
- (id) initWithBundle:(NSBundle *) bundle {
|
||||
self = [super initWithBundle:bundle] ;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSLog(@"PrivacyPane awoke from nib");
|
||||
}
|
||||
|
||||
- (void)mainViewDidLoad
|
||||
{
|
||||
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
|
||||
NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized");
|
||||
if ( !prefService )
|
||||
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);
|
||||
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);
|
||||
[mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)];
|
||||
|
||||
PRBool jsEnabled = PR_TRUE;
|
||||
prefService->GetBoolPref("javascript.enabled", &jsEnabled);
|
||||
[mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)];
|
||||
|
||||
PRBool javaEnabled = PR_TRUE;
|
||||
prefService->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<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:
|
||||
//
|
||||
// Clear all the user's cookies.
|
||||
//
|
||||
-(IBAction) clearCookies:(id)aSender
|
||||
{
|
||||
nsCOMPtr<nsICookieManager> cookieMonster ( do_GetService(NS_COOKIEMANAGER_CONTRACTID) );
|
||||
if ( cookieMonster )
|
||||
cookieMonster->RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// clearDiskCache:
|
||||
//
|
||||
// Clear the user's disk cache
|
||||
//
|
||||
-(IBAction) clearDiskCache:(id)aSender
|
||||
{
|
||||
nsCOMPtr<nsICacheService> cacheServ ( do_GetService("@mozilla.org/network/cache-service;1") );
|
||||
if ( cacheServ )
|
||||
cacheServ->EvictEntries(nsICache::STORE_ON_DISK);
|
||||
}
|
||||
|
||||
@end
|
|
@ -49,7 +49,19 @@
|
|||
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
|
||||
{
|
||||
ACTIONS = {clearCookies = id; clearDiskCache = id; };
|
||||
CLASS = PrivacyPane;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mCookies = id;
|
||||
mEnableJS = NSButton;
|
||||
mEnableJava = NSButton;
|
||||
mPromptForCookie = NSButton;
|
||||
};
|
||||
SUPERCLASS = NSPreferencePane;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -3,15 +3,15 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>372 4 356 240 0 0 1152 746 </string>
|
||||
<string>377 51 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBGroupedObjects</key>
|
||||
<dict>
|
||||
<key>3</key>
|
||||
<array>
|
||||
<string>153</string>
|
||||
<string>155</string>
|
||||
<string>0</string>
|
||||
<string>0</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
|
|
Двоичные данные
chimera/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib
сгенерированный
Двоичные данные
chimera/PreferencePanes/Personal/English.lproj/Personal.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -49,7 +49,19 @@
|
|||
OUTLETS = {_firstKeyView = id; _initialKeyView = id; _lastKeyView = id; _window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
|
||||
{CLASS = PersonalPane; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
|
||||
{
|
||||
ACTIONS = {clearCookies = id; clearDiskCache = id; };
|
||||
CLASS = PrivacyPane;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mCookies = id;
|
||||
mEnableJS = NSButton;
|
||||
mEnableJava = NSButton;
|
||||
mPromptForCookie = NSButton;
|
||||
};
|
||||
SUPERCLASS = NSPreferencePane;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -3,15 +3,15 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>372 4 356 240 0 0 1152 746 </string>
|
||||
<string>377 51 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBGroupedObjects</key>
|
||||
<dict>
|
||||
<key>3</key>
|
||||
<array>
|
||||
<string>153</string>
|
||||
<string>155</string>
|
||||
<string>0</string>
|
||||
<string>0</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
|
|
Двоичный файл не отображается.
|
@ -10,10 +10,12 @@
|
|||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSLog(@"Personal Pane awoke from nib");
|
||||
}
|
||||
|
||||
- (void)mainViewDidLoad
|
||||
{
|
||||
NSLog(@"Personal Pane did load main view");
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Двоичный файл не отображается.
|
@ -0,0 +1,16 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import <PreferencePanes/NSPreferencePane.h>
|
||||
|
||||
@interface PrivacyPane : NSPreferencePane
|
||||
{
|
||||
IBOutlet id mCookies;
|
||||
IBOutlet NSButton* mPromptForCookie;
|
||||
|
||||
IBOutlet NSButton* mEnableJS;
|
||||
IBOutlet NSButton* mEnableJava;
|
||||
}
|
||||
|
||||
-(IBAction) clearCookies:(id)aSender;
|
||||
-(IBAction) clearDiskCache:(id)aSender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,108 @@
|
|||
#import "PrivacyPane.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsCCookieManager.h"
|
||||
#include "nsICacheService.h"
|
||||
|
||||
@implementation PrivacyPane
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
NSLog(@"Going away from Privacy Panel!!!!");
|
||||
|
||||
}
|
||||
|
||||
- (id) initWithBundle:(NSBundle *) bundle {
|
||||
self = [super initWithBundle:bundle] ;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSLog(@"PrivacyPane awoke from nib");
|
||||
}
|
||||
|
||||
- (void)mainViewDidLoad
|
||||
{
|
||||
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
|
||||
NS_ASSERTION(prefService, "Could not get pref service, pref panel left uninitialized");
|
||||
if ( !prefService )
|
||||
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);
|
||||
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);
|
||||
[mPromptForCookie setState:(warnAboutCookies ? NSOnState : NSOffState)];
|
||||
|
||||
PRBool jsEnabled = PR_TRUE;
|
||||
prefService->GetBoolPref("javascript.enabled", &jsEnabled);
|
||||
[mEnableJS setState:(jsEnabled ? NSOnState : NSOffState)];
|
||||
|
||||
PRBool javaEnabled = PR_TRUE;
|
||||
prefService->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<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:
|
||||
//
|
||||
// Clear all the user's cookies.
|
||||
//
|
||||
-(IBAction) clearCookies:(id)aSender
|
||||
{
|
||||
nsCOMPtr<nsICookieManager> cookieMonster ( do_GetService(NS_COOKIEMANAGER_CONTRACTID) );
|
||||
if ( cookieMonster )
|
||||
cookieMonster->RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// clearDiskCache:
|
||||
//
|
||||
// Clear the user's disk cache
|
||||
//
|
||||
-(IBAction) clearDiskCache:(id)aSender
|
||||
{
|
||||
nsCOMPtr<nsICacheService> cacheServ ( do_GetService("@mozilla.org/network/cache-service;1") );
|
||||
if ( cacheServ )
|
||||
cacheServ->EvictEntries(nsICache::STORE_ON_DISK);
|
||||
}
|
||||
|
||||
@end
|
Загрузка…
Ссылка в новой задаче