Implement #5436 (Feature request: menu button: Fetch News)

This commit is contained in:
Kovid Goyal 2010-05-02 09:19:26 -06:00
parent 138882aabd
commit dc17c13cb2
2 changed files with 12 additions and 3 deletions

View File

@ -220,6 +220,10 @@ class Scheduler(QObject):
self.cac = QAction(QIcon(I('user_profile.svg')), _('Add a custom news source'), self) self.cac = QAction(QIcon(I('user_profile.svg')), _('Add a custom news source'), self)
self.connect(self.cac, SIGNAL('triggered(bool)'), self.customize_feeds) self.connect(self.cac, SIGNAL('triggered(bool)'), self.customize_feeds)
self.news_menu.addAction(self.cac) self.news_menu.addAction(self.cac)
self.news_menu.addSeparator()
self.all_action = self.news_menu.addAction(
_('Download all scheduled new sources'),
self.download_all_scheduled)
self.timer = QTimer(self) self.timer = QTimer(self)
self.timer.start(int(self.INTERVAL * 60000)) self.timer.start(int(self.INTERVAL * 60000))
@ -304,7 +308,11 @@ class Scheduler(QObject):
if urn is not None: if urn is not None:
return self.download(urn) return self.download(urn)
for urn in self.recipe_model.scheduled_urns(): for urn in self.recipe_model.scheduled_urns():
self.download(urn) if not self.download(urn):
break
def download_all_scheduled(self):
self.download_clicked(None)
def download(self, urn): def download(self, urn):
self.lock.lock() self.lock.lock()
@ -316,12 +324,13 @@ class Scheduler(QObject):
'is active')) 'is active'))
d.setModal(False) d.setModal(False)
d.show() d.show()
return return False
self.internet_connection_failed = False self.internet_connection_failed = False
doit = urn not in self.download_queue doit = urn not in self.download_queue
self.lock.unlock() self.lock.unlock()
if doit: if doit:
self.do_download(urn) self.do_download(urn)
return True
def check(self): def check(self):
recipes = self.recipe_model.get_to_be_downloaded_recipes() recipes = self.recipe_model.get_to_be_downloaded_recipes()

View File

@ -113,7 +113,7 @@ Metadata download plugins
When :meth:`fetch` is called, the `self` object will have the following When :meth:`fetch` is called, the `self` object will have the following
useful attributes (each of which may be None):: useful attributes (each of which may be None)::
title, author, publisher, isbn, log, verbose and extra title, book_author, publisher, isbn, log, verbose and extra
Use these attributes to construct the search query. extra is reserved for Use these attributes to construct the search query. extra is reserved for
future use. future use.