382 # double check, that the history file is sorted as it is read |
382 # double check, that the history file is sorted as it is read |
383 needToSort = False |
383 needToSort = False |
384 lastInsertedItem = HistoryEntry() |
384 lastInsertedItem = HistoryEntry() |
385 data = QByteArray(historyFile.readAll()) |
385 data = QByteArray(historyFile.readAll()) |
386 stream = QDataStream(data, QIODevice.ReadOnly) |
386 stream = QDataStream(data, QIODevice.ReadOnly) |
|
387 stream.setVersion(QDataStream.Qt_4_6) |
387 while not stream.atEnd(): |
388 while not stream.atEnd(): |
388 ver = stream.readUInt32() |
389 ver = stream.readUInt32() |
389 if ver != HISTORY_VERSION: |
390 if ver != HISTORY_VERSION: |
390 continue |
391 continue |
391 itm = HistoryEntry() |
392 itm = HistoryEntry() |
455 return |
456 return |
456 |
457 |
457 for index in range(first, -1, -1): |
458 for index in range(first, -1, -1): |
458 data = QByteArray() |
459 data = QByteArray() |
459 stream = QDataStream(data, QIODevice.WriteOnly) |
460 stream = QDataStream(data, QIODevice.WriteOnly) |
|
461 stream.setVersion(QDataStream.Qt_4_6) |
460 itm = self.__history[index] |
462 itm = self.__history[index] |
461 stream.writeUInt32(HISTORY_VERSION) |
463 stream.writeUInt32(HISTORY_VERSION) |
462 stream.writeString(itm.url.encode()) |
464 stream.writeString(itm.url.encode()) |
463 stream << itm.dateTime |
465 stream << itm.dateTime |
464 stream.writeString(itm.title.encode()) |
466 stream.writeString(itm.title.encode()) |