382 if not historyFile.exists(): |
382 if not historyFile.exists(): |
383 return |
383 return |
384 if not historyFile.open(QIODevice.ReadOnly): |
384 if not historyFile.open(QIODevice.ReadOnly): |
385 E5MessageBox.warning( |
385 E5MessageBox.warning( |
386 None, |
386 None, |
387 self.trUtf8("Loading History"), |
387 self.tr("Loading History"), |
388 self.trUtf8( |
388 self.tr( |
389 """<p>Unable to open history file <b>{0}</b>.<br/>""" |
389 """<p>Unable to open history file <b>{0}</b>.<br/>""" |
390 """Reason: {1}</p>""") |
390 """Reason: {1}</p>""") |
391 .format(historyFile.fileName, historyFile.errorString())) |
391 .format(historyFile.fileName, historyFile.errorString())) |
392 return |
392 return |
393 |
393 |
462 opened = f.open(QIODevice.Append) |
462 opened = f.open(QIODevice.Append) |
463 |
463 |
464 if not opened: |
464 if not opened: |
465 E5MessageBox.warning( |
465 E5MessageBox.warning( |
466 None, |
466 None, |
467 self.trUtf8("Saving History"), |
467 self.tr("Saving History"), |
468 self.trUtf8( |
468 self.tr( |
469 """<p>Unable to open history file <b>{0}</b>.<br/>""" |
469 """<p>Unable to open history file <b>{0}</b>.<br/>""" |
470 """Reason: {1}</p>""") |
470 """Reason: {1}</p>""") |
471 .format(f.fileName(), f.errorString())) |
471 .format(f.fileName(), f.errorString())) |
472 return |
472 return |
473 |
473 |
485 f.close() |
485 f.close() |
486 if saveAll: |
486 if saveAll: |
487 if historyFile.exists() and not historyFile.remove(): |
487 if historyFile.exists() and not historyFile.remove(): |
488 E5MessageBox.warning( |
488 E5MessageBox.warning( |
489 None, |
489 None, |
490 self.trUtf8("Saving History"), |
490 self.tr("Saving History"), |
491 self.trUtf8( |
491 self.tr( |
492 """<p>Error removing old history file <b>{0}</b>.""" |
492 """<p>Error removing old history file <b>{0}</b>.""" |
493 """<br/>Reason: {1}</p>""") |
493 """<br/>Reason: {1}</p>""") |
494 .format(historyFile.fileName(), |
494 .format(historyFile.fileName(), |
495 historyFile.errorString())) |
495 historyFile.errorString())) |
496 if not f.copy(historyFile.fileName()): |
496 if not f.copy(historyFile.fileName()): |
497 E5MessageBox.warning( |
497 E5MessageBox.warning( |
498 None, |
498 None, |
499 self.trUtf8("Saving History"), |
499 self.tr("Saving History"), |
500 self.trUtf8( |
500 self.tr( |
501 """<p>Error moving new history file over old one """ |
501 """<p>Error moving new history file over old one """ |
502 """(<b>{0}</b>).<br/>Reason: {1}</p>""") |
502 """(<b>{0}</b>).<br/>Reason: {1}</p>""") |
503 .format(historyFile.fileName(), f.errorString())) |
503 .format(historyFile.fileName(), f.errorString())) |
504 self.historySaved.emit() |
504 self.historySaved.emit() |
505 try: |
505 try: |