This commit is contained in:
Izalia Mae 2022-09-01 17:24:32 -04:00
parent 7c9ce2f05d
commit de5dd44d9a
3 changed files with 7 additions and 3 deletions

View file

@ -6,7 +6,7 @@ from .. import (
default_settings = {
'allow-file-access-from-file-urls': {
'default': False,
'default': True,
'name': 'Local file access',
'description': 'Allow requests in local html files access other local files'
},

View file

@ -192,7 +192,7 @@ class WebviewHandler(ComponentBase):
webview.load_uri(url.replace_property('proto', 'local'))
return True
elif url.proto == 'ftp':
if url.proto == 'ftp':
decision.ignore()
webview.load_uri(url.replace_property('proto', 'filetp'))
return True

View file

@ -89,7 +89,7 @@ class Window(BuilderBase, Gtk.ApplicationWindow):
fc.new_filter('HTML Document', '*.htm', '*.html', '*.xhtml', '*.mhtml')
fc.new_filter('XML', '*.xml', '*.xslt')
fc.new_filter('Text', '*.txt')
fc.set_callback(FileChooserResponse.OK, self.tab_new, switch=True)
fc.set_callback(FileChooserResponse.OK, self.handle_file_open)
fc.set_callback(FileChooserResponse.CANCEL, logging.verbose, 'Canceled file open')
fc.run()
@ -366,6 +366,10 @@ class Window(BuilderBase, Gtk.ApplicationWindow):
self['tabs-closed-menu']['clear'].set_sensitive(not len(self.closed) == 0)
def handle_file_open(self, path):
self.tab_new(f'file://{path}', switch=True)
def handle_menu_button(self, name, arg=None):
tab = self.active_tab