Helpviewer/History/HistoryManager.py

changeset 1853
01812b281a1e
parent 1693
9bb872e26a33
child 2084
d3f083dd0222
--- a/Helpviewer/History/HistoryManager.py	Sun May 06 16:01:03 2012 +0200
+++ b/Helpviewer/History/HistoryManager.py	Sun May 06 18:10:24 2012 +0200
@@ -328,15 +328,24 @@
         """
         self.setDaysToExpire(Preferences.getHelp("HistoryLimit"))
     
-    def clear(self):
+    def clear(self, period=0):
         """
         Public slot to clear the complete history.
+        
+        @param period history period in milliseconds to be cleared (integer)
         """
-        self.__history = []
+        if period == 0:
+            self.__history = []
+            self.historyReset.emit()
+        else:
+            breakMS = QDateTime.currentMSecsSinceEpoch() - period
+            while self.__history and \
+                  QDateTime(self.__history[0].dateTime).toMSecsSinceEpoch() > breakMS:
+                itm = self.__history.pop(0)
+                self.entryRemoved.emit(itm)
         self.__lastSavedUrl = ""
         self.__saveTimer.changeOccurred()
         self.__saveTimer.saveIfNeccessary()
-        self.historyReset.emit()
         self.historyCleared.emit()
     
     def getFileName(self):

eric ide

mercurial