Helpviewer/History/HistoryManager.py

changeset 1853
01812b281a1e
parent 1693
9bb872e26a33
child 2084
d3f083dd0222
equal deleted inserted replaced
1852:12d37ab1baf3 1853:01812b281a1e
326 """ 326 """
327 Public method to indicate a change of preferences. 327 Public method to indicate a change of preferences.
328 """ 328 """
329 self.setDaysToExpire(Preferences.getHelp("HistoryLimit")) 329 self.setDaysToExpire(Preferences.getHelp("HistoryLimit"))
330 330
331 def clear(self): 331 def clear(self, period=0):
332 """ 332 """
333 Public slot to clear the complete history. 333 Public slot to clear the complete history.
334 """ 334
335 self.__history = [] 335 @param period history period in milliseconds to be cleared (integer)
336 """
337 if period == 0:
338 self.__history = []
339 self.historyReset.emit()
340 else:
341 breakMS = QDateTime.currentMSecsSinceEpoch() - period
342 while self.__history and \
343 QDateTime(self.__history[0].dateTime).toMSecsSinceEpoch() > breakMS:
344 itm = self.__history.pop(0)
345 self.entryRemoved.emit(itm)
336 self.__lastSavedUrl = "" 346 self.__lastSavedUrl = ""
337 self.__saveTimer.changeOccurred() 347 self.__saveTimer.changeOccurred()
338 self.__saveTimer.saveIfNeccessary() 348 self.__saveTimer.saveIfNeccessary()
339 self.historyReset.emit()
340 self.historyCleared.emit() 349 self.historyCleared.emit()
341 350
342 def getFileName(self): 351 def getFileName(self):
343 """ 352 """
344 Public method to get the file name of the history file. 353 Public method to get the file name of the history file.

eric ide

mercurial