8 """ |
8 """ |
9 |
9 |
10 |
10 |
11 import os |
11 import os |
12 |
12 |
13 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, QDateTime, QDate, \ |
13 from PyQt5.QtCore import ( |
14 QTime, QUrl, QTimer, QFile, QIODevice, QByteArray, QDataStream, \ |
14 pyqtSignal, pyqtSlot, QFileInfo, QDateTime, QDate, QTime, QUrl, QTimer, |
15 QTemporaryFile, QObject |
15 QFile, QIODevice, QByteArray, QDataStream, QTemporaryFile, QObject |
|
16 ) |
16 |
17 |
17 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
18 |
19 |
19 from Utilities.AutoSaver import AutoSaver |
20 from Utilities.AutoSaver import AutoSaver |
20 import Utilities |
21 import Utilities |
49 |
50 |
50 @param other reference to the history entry to compare against |
51 @param other reference to the history entry to compare against |
51 (HistoryEntry) |
52 (HistoryEntry) |
52 @return flag indicating equality (boolean) |
53 @return flag indicating equality (boolean) |
53 """ |
54 """ |
54 return other.title == self.title and \ |
55 return ( |
55 other.url == self.url and \ |
56 other.title == self.title and |
|
57 other.url == self.url and |
56 other.dateTime == self.dateTime |
58 other.dateTime == self.dateTime |
|
59 ) |
57 |
60 |
58 def __lt__(self, other): |
61 def __lt__(self, other): |
59 """ |
62 """ |
60 Special method determining less relation. |
63 Special method determining less relation. |
61 |
64 |
139 from .HistoryModel import HistoryModel |
142 from .HistoryModel import HistoryModel |
140 from .HistoryFilterModel import HistoryFilterModel |
143 from .HistoryFilterModel import HistoryFilterModel |
141 from .HistoryTreeModel import HistoryTreeModel |
144 from .HistoryTreeModel import HistoryTreeModel |
142 |
145 |
143 self.__historyModel = HistoryModel(self, self) |
146 self.__historyModel = HistoryModel(self, self) |
144 self.__historyFilterModel = \ |
147 self.__historyFilterModel = HistoryFilterModel( |
145 HistoryFilterModel(self.__historyModel, self) |
148 self.__historyModel, self) |
146 self.__historyTreeModel = \ |
149 self.__historyTreeModel = HistoryTreeModel( |
147 HistoryTreeModel(self.__historyFilterModel, self) |
150 self.__historyFilterModel, self) |
148 |
151 |
149 self.__startFrequencyTimer() |
152 self.__startFrequencyTimer() |
150 |
153 |
151 def close(self): |
154 def close(self): |
152 """ |
155 """ |
277 @param title title of the entry to remove (string) |
280 @param title title of the entry to remove (string) |
278 """ |
281 """ |
279 if url.scheme() not in ["eric", "about", "data", "chrome"]: |
282 if url.scheme() not in ["eric", "about", "data", "chrome"]: |
280 cleanUrlStr = self.__cleanUrlStr(url) |
283 cleanUrlStr = self.__cleanUrlStr(url) |
281 for index in range(len(self.__history)): |
284 for index in range(len(self.__history)): |
282 if cleanUrlStr == self.__history[index].url and \ |
285 if ( |
283 (not title or title == self.__history[index].title): |
286 cleanUrlStr == self.__history[index].url and |
|
287 (not title or title == self.__history[index].title) |
|
288 ): |
284 itm = self.__history[index] |
289 itm = self.__history[index] |
285 self.__lastSavedUrl = "" |
290 self.__lastSavedUrl = "" |
286 self.__history.remove(itm) |
291 self.__history.remove(itm) |
287 self.entryRemoved.emit(itm) |
292 self.entryRemoved.emit(itm) |
288 break |
293 break |
408 if period == 0: |
413 if period == 0: |
409 self.__history = [] |
414 self.__history = [] |
410 self.historyReset.emit() |
415 self.historyReset.emit() |
411 else: |
416 else: |
412 breakMS = QDateTime.currentMSecsSinceEpoch() - period |
417 breakMS = QDateTime.currentMSecsSinceEpoch() - period |
413 while self.__history and \ |
418 while ( |
|
419 self.__history and |
414 (QDateTime(self.__history[0].dateTime).toMSecsSinceEpoch() > |
420 (QDateTime(self.__history[0].dateTime).toMSecsSinceEpoch() > |
415 breakMS): |
421 breakMS) |
|
422 ): |
416 itm = self.__history.pop(0) |
423 itm = self.__history.pop(0) |
417 self.entryRemoved.emit(itm) |
424 self.entryRemoved.emit(itm) |
418 self.__lastSavedUrl = "" |
425 self.__lastSavedUrl = "" |
419 self.__saveTimer.changeOccurred() |
426 self.__saveTimer.changeOccurred() |
420 self.__saveTimer.saveIfNeccessary() |
427 self.__saveTimer.saveIfNeccessary() |