Added the possibility to open a selected link in a new tab.

This commit is contained in:
Antoni Boucher 2015-05-30 13:15:53 -04:00
parent 6ca541d359
commit a56a14fb70
2 changed files with 10 additions and 3 deletions

View File

@ -986,9 +986,15 @@ class CommandDispatcher:
self._open(url, tab, bg, window)
@cmdutils.register(instance='command-dispatcher', name='select-follow', scope='window')
def select_follow(self):
"""Follow the selected text."""
def select_follow(self, tab=False):
"""Follow the selected text.
Args:
tab: Load the selected link in a new tab.
"""
widget = self._current_widget()
if tab:
widget.page().open_target = usertypes.ClickTarget.tab
widget.page().currentFrame().evaluateJavaScript('window.getSelection().anchorNode.parentNode.click()')
@cmdutils.register(instance='command-dispatcher', name='inspector',

View File

@ -1239,7 +1239,8 @@ KEY_DATA = collections.OrderedDict([
('stop', ['<Ctrl-s>']),
('print', ['<Ctrl-Alt-p>']),
('open qute:settings', ['Ss']),
('select-follow', ['<Return>', '<Ctrl-Return>']),
('select-follow', ['<Return>']),
('select-follow -t', ['<Ctrl-Return>']),
])),
('insert', collections.OrderedDict([