352 # double check, that the history file is sorted as it is read |
352 # double check, that the history file is sorted as it is read |
353 needToSort = False |
353 needToSort = False |
354 lastInsertedItem = HistoryEntry() |
354 lastInsertedItem = HistoryEntry() |
355 data = QByteArray(historyFile.readAll()) |
355 data = QByteArray(historyFile.readAll()) |
356 stream = QDataStream(data, QIODevice.ReadOnly) |
356 stream = QDataStream(data, QIODevice.ReadOnly) |
|
357 stream.setVersion(QDataStream.Qt_4_6) |
357 while not stream.atEnd(): |
358 while not stream.atEnd(): |
358 ver = stream.readUInt32() |
359 ver = stream.readUInt32() |
359 if ver != HISTORY_VERSION: |
360 if ver != HISTORY_VERSION: |
360 continue |
361 continue |
361 itm = HistoryEntry() |
362 itm = HistoryEntry() |
425 return |
426 return |
426 |
427 |
427 for index in range(first, -1, -1): |
428 for index in range(first, -1, -1): |
428 data = QByteArray() |
429 data = QByteArray() |
429 stream = QDataStream(data, QIODevice.WriteOnly) |
430 stream = QDataStream(data, QIODevice.WriteOnly) |
|
431 stream.setVersion(QDataStream.Qt_4_6) |
430 itm = self.__history[index] |
432 itm = self.__history[index] |
431 stream.writeUInt32(HISTORY_VERSION) |
433 stream.writeUInt32(HISTORY_VERSION) |
432 stream.writeString(itm.url.encode()) |
434 stream.writeString(itm.url.encode()) |
433 stream << itm.dateTime |
435 stream << itm.dateTime |
434 stream.writeString(itm.title.encode()) |
436 stream.writeString(itm.title.encode()) |