mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix file internal links having different effect on history as compared to links that cause a new file to be loaded
This commit is contained in:
parent
ea21d6ae68
commit
0c1f713687
@ -1306,10 +1306,12 @@ class DocumentView(QWebView): # {{{
|
|||||||
|
|
||||||
def mouseReleaseEvent(self, ev):
|
def mouseReleaseEvent(self, ev):
|
||||||
opos = self.document.ypos
|
opos = self.document.ypos
|
||||||
|
if self.manager is not None:
|
||||||
|
prev_pos = self.manager.update_page_number()
|
||||||
ret = QWebView.mouseReleaseEvent(self, ev)
|
ret = QWebView.mouseReleaseEvent(self, ev)
|
||||||
if self.manager is not None and opos != self.document.ypos:
|
if self.manager is not None and opos != self.document.ypos:
|
||||||
self.manager.internal_link_clicked(opos)
|
|
||||||
self.manager.scrolled(self.scroll_fraction)
|
self.manager.scrolled(self.scroll_fraction)
|
||||||
|
self.manager.internal_link_clicked(prev_pos)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -546,9 +546,8 @@ class EbookViewer(MainWindow):
|
|||||||
if self.view.search(text, backwards=backwards):
|
if self.view.search(text, backwards=backwards):
|
||||||
self.scrolled(self.view.scroll_fraction)
|
self.scrolled(self.view.scroll_fraction)
|
||||||
|
|
||||||
def internal_link_clicked(self, frac):
|
def internal_link_clicked(self, prev_pos):
|
||||||
self.update_page_number() # Ensure page number is accurate as it is used for history
|
self.history.add(prev_pos)
|
||||||
self.history.add(self.pos.value())
|
|
||||||
|
|
||||||
def link_clicked(self, url):
|
def link_clicked(self, url):
|
||||||
path = os.path.abspath(unicode(url.toLocalFile()))
|
path = os.path.abspath(unicode(url.toLocalFile()))
|
||||||
@ -692,6 +691,7 @@ class EbookViewer(MainWindow):
|
|||||||
|
|
||||||
def update_page_number(self):
|
def update_page_number(self):
|
||||||
self.set_page_number(self.view.document.scroll_fraction)
|
self.set_page_number(self.view.document.scroll_fraction)
|
||||||
|
return self.pos.value()
|
||||||
|
|
||||||
def close_progress_indicator(self):
|
def close_progress_indicator(self):
|
||||||
self.pi.stop()
|
self.pi.stop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user