mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the "back" button in the HTML document viewer position the viewport to where it was when a URL was clicked.
This commit is contained in:
parent
fb256ee606
commit
107dfac46f
@ -108,10 +108,14 @@ class DocViewer(Dialog):
|
||||
if not self.back_stack:
|
||||
info_dialog(self, _('Go back'), _('No function to go back to'), show=True)
|
||||
else:
|
||||
name = self.back_stack.pop()
|
||||
place = self.back_stack.pop()
|
||||
if not self.back_stack:
|
||||
self.back_button.setEnabled(False)
|
||||
self.show_function(name)
|
||||
if isinstance(place, int):
|
||||
self.show_all_functions()
|
||||
self.doc_viewer_widget.verticalScrollBar().setSliderPosition(place)
|
||||
else:
|
||||
self.show_function(place)
|
||||
|
||||
def url_clicked(self, qurl):
|
||||
if qurl.scheme().startswith('http'):
|
||||
@ -120,6 +124,9 @@ class DocViewer(Dialog):
|
||||
if self.last_function is not None:
|
||||
self.back_stack.append(self.last_function)
|
||||
self.back_button.setEnabled(True)
|
||||
else:
|
||||
self.back_stack.append(self.doc_viewer_widget.verticalScrollBar().sliderPosition())
|
||||
self.back_button.setEnabled(True)
|
||||
self.show_function(qurl.path())
|
||||
|
||||
def english_cb_state_changed(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user