Fix bug that prevented old news from being deleted in the calibre library if calibre is never kept running for more than an hour

This commit is contained in:
Kovid Goyal 2010-07-17 12:20:30 -06:00
parent b4656ec119
commit 0a31b96021

View File

@ -228,19 +228,21 @@ class Scheduler(QObject):
self.download_all_scheduled)
self.timer = QTimer(self)
self.timer.start(int(self.INTERVAL * 60000))
self.timer.start(int(self.INTERVAL * 60 * 1000))
self.oldest_timer = QTimer()
self.connect(self.oldest_timer, SIGNAL('timeout()'), self.oldest_check)
self.connect(self.timer, SIGNAL('timeout()'), self.check)
self.oldest = gconf['oldest_news']
self.oldest_timer.start(int(60 * 60000))
self.oldest_check()
self.oldest_timer.start(int(60 * 60 * 1000))
QTimer.singleShot(10 * 1000, self.oldest_check)
self.database_changed = self.recipe_model.database_changed
def oldest_check(self):
if self.oldest > 0:
delta = timedelta(days=self.oldest)
ids = self.recipe_model.db.tags_older_than(_('News'), delta)
if ids:
ids = list(ids)
if ids:
self.delete_old_news.emit(ids)