parent
deb3c31f2f
commit
9a5839650c
@ -325,7 +325,8 @@ class BrowserPage(QWebPage):
|
|||||||
QWebPage.Notifications: ('content', 'notifications'),
|
QWebPage.Notifications: ('content', 'notifications'),
|
||||||
QWebPage.Geolocation: ('content', 'geolocation'),
|
QWebPage.Geolocation: ('content', 'geolocation'),
|
||||||
}
|
}
|
||||||
if config.get(*options[feature]) == 'ask':
|
config_val = config.get(*options[feature])
|
||||||
|
if config_val == 'ask':
|
||||||
bridge = objreg.get('message-bridge', scope='window',
|
bridge = objreg.get('message-bridge', scope='window',
|
||||||
window=self._win_id)
|
window=self._win_id)
|
||||||
q = usertypes.Question(bridge)
|
q = usertypes.Question(bridge)
|
||||||
@ -361,6 +362,9 @@ class BrowserPage(QWebPage):
|
|||||||
self.loadStarted.connect(q.abort)
|
self.loadStarted.connect(q.abort)
|
||||||
|
|
||||||
bridge.ask(q, blocking=False)
|
bridge.ask(q, blocking=False)
|
||||||
|
elif config_val:
|
||||||
|
self.setFeaturePermission(frame, feature,
|
||||||
|
QWebPage.PermissionGrantedByUser)
|
||||||
else:
|
else:
|
||||||
self.setFeaturePermission(frame, feature,
|
self.setFeaturePermission(frame, feature,
|
||||||
QWebPage.PermissionDeniedByUser)
|
QWebPage.PermissionDeniedByUser)
|
||||||
|
@ -606,11 +606,11 @@ def data(readonly=False):
|
|||||||
"are not affected by this setting."),
|
"are not affected by this setting."),
|
||||||
|
|
||||||
('geolocation',
|
('geolocation',
|
||||||
SettingValue(typ.NoAsk(), 'ask'),
|
SettingValue(typ.BoolAsk(), 'ask'),
|
||||||
"Allow websites to request geolocations."),
|
"Allow websites to request geolocations."),
|
||||||
|
|
||||||
('notifications',
|
('notifications',
|
||||||
SettingValue(typ.NoAsk(), 'ask'),
|
SettingValue(typ.BoolAsk(), 'ask'),
|
||||||
"Allow websites to show notifications."),
|
"Allow websites to show notifications."),
|
||||||
|
|
||||||
#('allow-java',
|
#('allow-java',
|
||||||
|
@ -266,34 +266,6 @@ class BoolAsk(Bool):
|
|||||||
super().validate(value)
|
super().validate(value)
|
||||||
|
|
||||||
|
|
||||||
class NoAsk(BaseType):
|
|
||||||
|
|
||||||
"""A no/ask question."""
|
|
||||||
|
|
||||||
valid_values = ValidValues('false', 'ask')
|
|
||||||
|
|
||||||
def transform(self, value):
|
|
||||||
if value.lower() == 'ask':
|
|
||||||
return 'ask'
|
|
||||||
else:
|
|
||||||
return BOOLEAN_STATES[value.lower()]
|
|
||||||
|
|
||||||
def validate(self, value):
|
|
||||||
if not value:
|
|
||||||
if self._none_ok:
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
raise configexc.ValidationError(value, "may not be empty!")
|
|
||||||
if value.lower() == 'ask':
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
v = BOOLEAN_STATES[value.lower()]
|
|
||||||
if v:
|
|
||||||
raise configexc.ValidationError(value, "must be ask/false!")
|
|
||||||
except KeyError:
|
|
||||||
raise configexc.ValidationError(value, "must be ask/false!")
|
|
||||||
|
|
||||||
|
|
||||||
class Int(BaseType):
|
class Int(BaseType):
|
||||||
|
|
||||||
"""Base class for an integer setting.
|
"""Base class for an integer setting.
|
||||||
|
Loading…
Reference in New Issue
Block a user