334 if not historyFile.exists(): |
334 if not historyFile.exists(): |
335 return |
335 return |
336 if not historyFile.open(QIODevice.ReadOnly): |
336 if not historyFile.open(QIODevice.ReadOnly): |
337 QMessageBox.warning(None, |
337 QMessageBox.warning(None, |
338 self.trUtf8("Loading History"), |
338 self.trUtf8("Loading History"), |
339 self.trUtf8("""Unable to open history file <b>{0}</b>.<br/>""" |
339 self.trUtf8("""<p>Unable to open history file <b>{0}</b>.<br/>""" |
340 """Reason: {1}""")\ |
340 """Reason: {1}</p>""")\ |
341 .format(historyFile.fileName, historyFile.errorString())) |
341 .format(historyFile.fileName, historyFile.errorString())) |
342 return |
342 return |
343 |
343 |
344 history = [] |
344 history = [] |
345 |
345 |
410 opened = f.open(QIODevice.Append) |
410 opened = f.open(QIODevice.Append) |
411 |
411 |
412 if not opened: |
412 if not opened: |
413 QMessageBox.warning(None, |
413 QMessageBox.warning(None, |
414 self.trUtf8("Saving History"), |
414 self.trUtf8("Saving History"), |
415 self.trUtf8("""Unable to open history file <b>{0}</b>.<br/>""" |
415 self.trUtf8("""<p>Unable to open history file <b>{0}</b>.<br/>""" |
416 """Reason: {1}""")\ |
416 """Reason: {1}</p>""")\ |
417 .format(f.fileName(), f.errorString())) |
417 .format(f.fileName(), f.errorString())) |
418 return |
418 return |
419 |
419 |
420 for index in range(first, -1, -1): |
420 for index in range(first, -1, -1): |
421 data = QByteArray() |
421 data = QByteArray() |
430 f.close() |
430 f.close() |
431 if saveAll: |
431 if saveAll: |
432 if historyFile.exists() and not historyFile.remove(): |
432 if historyFile.exists() and not historyFile.remove(): |
433 QMessageBox.warning(None, |
433 QMessageBox.warning(None, |
434 self.trUtf8("Saving History"), |
434 self.trUtf8("Saving History"), |
435 self.trUtf8("""Error removing old history file <b>{0}</b>.""" |
435 self.trUtf8("""<p>Error removing old history file <b>{0}</b>.""" |
436 """<br/>Reason: {1}""")\ |
436 """<br/>Reason: {1}</p>""")\ |
437 .format(historyFile.fileName(), historyFile.errorString())) |
437 .format(historyFile.fileName(), historyFile.errorString())) |
438 if not f.copy(historyFile.fileName()): |
438 if not f.copy(historyFile.fileName()): |
439 QMessageBox.warning(None, |
439 QMessageBox.warning(None, |
440 self.trUtf8("Saving History"), |
440 self.trUtf8("Saving History"), |
441 self.trUtf8("""Error moving new history file over old one """ |
441 self.trUtf8("""<p>Error moving new history file over old one """ |
442 """(<b>{0}</b>).<br/>Reason: {1}""")\ |
442 """(<b>{0}</b>).<br/>Reason: {1}</p>""")\ |
443 .format(historyFile.fileName(), tempFile.errorString())) |
443 .format(historyFile.fileName(), tempFile.errorString())) |
444 |
444 |
445 try: |
445 try: |
446 self.__lastSavedUrl = self.__history[0].url |
446 self.__lastSavedUrl = self.__history[0].url |
447 except IndexError: |
447 except IndexError: |