mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
The update found link now opens the update notification dialog instead of going straight to the download page
This commit is contained in:
parent
4d428dfa9a
commit
497b381bfa
@ -148,7 +148,6 @@ class StatusBar(QStatusBar): # {{{
|
||||
self.get_version() + ' ' + _('created by Kovid Goyal')
|
||||
self.device_string = ''
|
||||
self.update_label = QLabel('')
|
||||
self.update_label.setOpenExternalLinks(True)
|
||||
self.addPermanentWidget(self.update_label)
|
||||
self.update_label.setVisible(False)
|
||||
self._font = QFont()
|
||||
@ -174,8 +173,9 @@ class StatusBar(QStatusBar): # {{{
|
||||
self.clearMessage()
|
||||
|
||||
def new_version_available(self, ver, url):
|
||||
msg = (u'<span style="color:red; font-weight: bold">%s: <a href="%s">%s<a></span>') % (
|
||||
_('Update found'), url, ver)
|
||||
msg = (u'<span style="color:red; font-weight: bold">%s: <a'
|
||||
' href="update:%s">%s<a></span>') % (
|
||||
_('Update found'), ver, ver)
|
||||
self.update_label.setText(msg)
|
||||
self.update_label.setCursor(Qt.PointingHandCursor)
|
||||
self.update_label.setVisible(True)
|
||||
@ -240,6 +240,14 @@ class LayoutMixin(object): # {{{
|
||||
self.status_bar.addPermanentWidget(button)
|
||||
self.status_bar.addPermanentWidget(self.jobs_button)
|
||||
self.setStatusBar(self.status_bar)
|
||||
self.status_bar.update_label.linkActivated.connect(self.update_link_clicked)
|
||||
|
||||
def update_link_clicked(self, url):
|
||||
print 11111111, url
|
||||
url = unicode(url)
|
||||
if url.startswith('update:'):
|
||||
version = url.partition(':')[-1]
|
||||
self.update_found(version, force=True)
|
||||
|
||||
def finalize_layout(self):
|
||||
self.status_bar.initialize(self.system_tray_icon)
|
||||
|
@ -52,8 +52,7 @@ class UpdateNotification(QDialog):
|
||||
self.label = QLabel('<p>'+
|
||||
_('%s has been updated to version <b>%s</b>. '
|
||||
'See the <a href="http://calibre-ebook.com/whats-new'
|
||||
'">new features</a>. Visit the download pa'
|
||||
'ge?')%(__appname__, version))
|
||||
'">new features</a>.')%(__appname__, version))
|
||||
self.label.setOpenExternalLinks(True)
|
||||
self.label.setWordWrap(True)
|
||||
self.setWindowTitle(_('Update available!'))
|
||||
@ -94,13 +93,13 @@ class UpdateMixin(object):
|
||||
type=Qt.QueuedConnection)
|
||||
self.update_checker.start()
|
||||
|
||||
def update_found(self, version):
|
||||
def update_found(self, version, force=False):
|
||||
os = 'windows' if iswindows else 'osx' if isosx else 'linux'
|
||||
url = 'http://calibre-ebook.com/download_%s'%os
|
||||
self.status_bar.new_version_available(version, url)
|
||||
|
||||
if config.get('new_version_notification') and \
|
||||
dynamic.get('update to version %s'%version, True):
|
||||
if force or (config.get('new_version_notification') and \
|
||||
dynamic.get('update to version %s'%version, True)):
|
||||
self._update_notification__ = UpdateNotification(version,
|
||||
parent=self)
|
||||
self._update_notification__.show()
|
||||
|
Loading…
x
Reference in New Issue
Block a user