зеркало из https://github.com/mozilla/pjs.git
Fixing bug 344036, give certain pref checkboxes mixed state look when neither on nor off. Checking in source changes, nib changes next due to synching issues (trunk vs. 1.8.1 branch). Patch by froodian <stridey@gmail.com>, r=hwaara, sr=pink.
This commit is contained in:
Родитель
408c413be0
Коммит
7226be3c60
|
@ -296,11 +296,16 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
PRInt32 acceptCookies = eAcceptAllCookies;
|
||||
mPrefService->GetIntPref("network.cookie.cookieBehavior", &acceptCookies);
|
||||
[self mapCookiePrefToGUI:acceptCookies];
|
||||
|
||||
// lifetimePolicy now controls asking about cookies, despite being totally unintuitive
|
||||
PRInt32 lifetimePolicy = kAcceptCookiesNormally;
|
||||
mPrefService->GetIntPref("network.cookie.lifetimePolicy", &lifetimePolicy);
|
||||
if (lifetimePolicy == kWarnAboutCookies)
|
||||
[mAskAboutCookies setState:YES];
|
||||
[mAskAboutCookies setState:NSOnState];
|
||||
else if (lifetimePolicy == kAcceptCookiesNormally)
|
||||
[mAskAboutCookies setState:NSOffState];
|
||||
else
|
||||
[mAskAboutCookies setState:NSMixedState];
|
||||
|
||||
// store permission manager service and cache the enumerator.
|
||||
nsCOMPtr<nsIPermissionManager> pm(do_GetService(NS_PERMISSIONMANAGER_CONTRACTID));
|
||||
|
@ -980,6 +985,7 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
|
||||
-(IBAction) clickAskAboutCookies:(id)sender
|
||||
{
|
||||
[sender setAllowsMixedState:NO];
|
||||
[self setPref:"network.cookie.lifetimePolicy" toInt:([sender state] == NSOnState) ? kWarnAboutCookies : kAcceptCookiesNormally];
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,14 @@
|
|||
[radioOpenForAE selectCellWithTag:[self getIntPref:"browser.reuse_window" withSuccess:&gotPref]];
|
||||
[checkboxLoadTabsInBackground setState:[self getBooleanPref:"browser.tabs.loadInBackground" withSuccess:&gotPref]];
|
||||
[mTabBarVisiblity setState:[self getBooleanPref:"camino.tab_bar_always_visible" withSuccess:&gotPref]];
|
||||
[mSingleWindowMode setState:([self getIntPref:"browser.link.open_newwindow" withSuccess:&gotPref] == nsIBrowserDOMWindow::OPEN_NEWTAB)];
|
||||
|
||||
int swmBehavior = [self getIntPref:"browser.link.open_newwindow" withSuccess:&gotPref];
|
||||
if (swmBehavior == nsIBrowserDOMWindow::OPEN_DEFAULTWINDOW)
|
||||
[mSingleWindowMode setState:NSOffState];
|
||||
else if (swmBehavior == nsIBrowserDOMWindow::OPEN_NEWTAB)
|
||||
[mSingleWindowMode setState:NSOnState];
|
||||
else
|
||||
[mSingleWindowMode setState:NSMixedState];
|
||||
}
|
||||
|
||||
- (IBAction)checkboxClicked:(id)sender
|
||||
|
@ -86,6 +93,7 @@
|
|||
[self setPref:"camino.tab_bar_always_visible" toBoolean:[sender state]];
|
||||
}
|
||||
else if (sender == mSingleWindowMode) {
|
||||
[sender setAllowsMixedState:NO];
|
||||
int newState = [sender state] ? nsIBrowserDOMWindow::OPEN_NEWTAB : nsIBrowserDOMWindow::OPEN_DEFAULTWINDOW;
|
||||
[self setPref:"browser.link.open_newwindow" toInt:newState];
|
||||
}
|
||||
|
|
|
@ -63,8 +63,17 @@ static NSString* const AdBlockingChangedNotificationName = @"AdBlockingChanged";
|
|||
const int kFocusLinks = (1 << 2);
|
||||
const int kFocusForms = (1 << 1);
|
||||
|
||||
// for annoyance blocker prefs
|
||||
const int kAnnoyancePrefNone = 1;
|
||||
const int kAnnoyancePrefAll = 2;
|
||||
const int kAnnoyancePrefSome = 3;
|
||||
|
||||
@interface OrgMozillaChimeraPreferenceWebFeatures(PRIVATE)
|
||||
|
||||
-(NSString*)profilePath;
|
||||
- (int)annoyingWindowPrefs;
|
||||
- (int)preventAnimationCheckboxState;
|
||||
|
||||
@end
|
||||
|
||||
@implementation OrgMozillaChimeraPreferenceWebFeatures
|
||||
|
@ -110,18 +119,19 @@ const int kFocusForms = (1 << 1);
|
|||
[mEnablePopupBlocking setState:enablePopupBlocking];
|
||||
[mEditWhitelist setEnabled:enablePopupBlocking];
|
||||
|
||||
// set initial value on annoyance blocker checkbox. out of all the prefs,
|
||||
// if the "status" capability is turned off, we use that as an indicator
|
||||
// to turn them all off.
|
||||
BOOL enableAnnoyanceBlocker = [self getBooleanPref:"dom.disable_window_status_change" withSuccess:&gotPref];
|
||||
[mEnableAnnoyanceBlocker setState:enableAnnoyanceBlocker];
|
||||
// set initial value on annoyance blocker checkbox.
|
||||
if([self annoyingWindowPrefs] == kAnnoyancePrefAll)
|
||||
[mEnableAnnoyanceBlocker setState:NSOnState];
|
||||
else if([self annoyingWindowPrefs] == kAnnoyancePrefNone)
|
||||
[mEnableAnnoyanceBlocker setState:NSOffState];
|
||||
else // annoyingWindowPrefs == kAnnoyancePrefSome
|
||||
[mEnableAnnoyanceBlocker setState:NSMixedState];
|
||||
|
||||
// set initial value on image-resizing
|
||||
BOOL enableImageResize = [self getBooleanPref:"browser.enable_automatic_image_resizing" withSuccess:&gotPref];
|
||||
[mImageResize setState:enableImageResize];
|
||||
|
||||
BOOL preventAnimation = [[self getStringPref:"image.animation_mode" withSuccess:&gotPref] isEqualToString:@"once"];
|
||||
[mPreventAnimation setState:preventAnimation];
|
||||
[mPreventAnimation setState:[self preventAnimationCheckboxState]];
|
||||
|
||||
BOOL enableAdBlock = [self getBooleanPref:"camino.enable_ad_blocking" withSuccess:&gotPref];
|
||||
[mEnableAdBlocking setState:enableAdBlock];
|
||||
|
@ -202,6 +212,7 @@ const int kFocusForms = (1 << 1);
|
|||
//
|
||||
-(IBAction) clickPreventAnimation:(id)sender
|
||||
{
|
||||
[sender setAllowsMixedState:NO];
|
||||
[self setPref:"image.animation_mode" toString:([sender state] ? @"once" : @"normal")];
|
||||
}
|
||||
|
||||
|
@ -405,6 +416,7 @@ const int kFocusForms = (1 << 1);
|
|||
//
|
||||
-(IBAction) clickEnableAnnoyanceBlocker:(id)sender
|
||||
{
|
||||
[sender setAllowsMixedState:NO];
|
||||
if ( [sender state] )
|
||||
[self setAnnoyingWindowPrefsTo:YES];
|
||||
else
|
||||
|
@ -424,6 +436,31 @@ const int kFocusForms = (1 << 1);
|
|||
[self setPref:"dom.disable_window_flip" toBoolean:inValue];
|
||||
}
|
||||
|
||||
- (int)annoyingWindowPrefs
|
||||
{
|
||||
BOOL disableStatusChangePref = [self getBooleanPref:"dom.disable_window_status_change" withSuccess:NULL];
|
||||
BOOL disableMoveResizePref = [self getBooleanPref:"dom.disable_window_move_resize" withSuccess:NULL];
|
||||
BOOL disableWindowFlipPref = [self getBooleanPref:"dom.disable_window_flip" withSuccess:NULL];
|
||||
|
||||
if(disableStatusChangePref && disableMoveResizePref && disableWindowFlipPref)
|
||||
return kAnnoyancePrefAll;
|
||||
if(!disableStatusChangePref && !disableMoveResizePref && !disableWindowFlipPref)
|
||||
return kAnnoyancePrefNone;
|
||||
|
||||
return kAnnoyancePrefSome;
|
||||
}
|
||||
|
||||
- (int)preventAnimationCheckboxState
|
||||
{
|
||||
NSString* preventAnimation = [self getStringPref:"image.animation_mode" withSuccess:NULL];
|
||||
if ([preventAnimation isEqualToString:@"once"])
|
||||
return NSOnState;
|
||||
else if ([preventAnimation isEqualToString:@"normal"])
|
||||
return NSOffState;
|
||||
else
|
||||
return NSMixedState;
|
||||
}
|
||||
|
||||
//
|
||||
// -profilePath
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче