563 if not ext: |
563 if not ext: |
564 ex = selectedFilter.split("(*")[1].split(")")[0] |
564 ex = selectedFilter.split("(*")[1].split(")")[0] |
565 if ex: |
565 if ex: |
566 fname += ex |
566 fname += ex |
567 if QFileInfo(fname).exists(): |
567 if QFileInfo(fname).exists(): |
568 res = E5MessageBox.yesNo(self, |
568 res = E5MessageBox.yesNo( |
|
569 self, |
569 self.trUtf8("Save Chat"), |
570 self.trUtf8("Save Chat"), |
570 self.trUtf8("<p>The file <b>{0}</b> already exists." |
571 self.trUtf8("<p>The file <b>{0}</b> already exists." |
571 " Overwrite it?</p>").format(fname), |
572 " Overwrite it?</p>").format(fname), |
572 icon=E5MessageBox.Warning) |
573 icon=E5MessageBox.Warning) |
573 if not res: |
574 if not res: |
577 try: |
578 try: |
578 f = open(fname, "w", encoding="utf-8") |
579 f = open(fname, "w", encoding="utf-8") |
579 f.write(txt) |
580 f.write(txt) |
580 f.close() |
581 f.close() |
581 except IOError as err: |
582 except IOError as err: |
582 E5MessageBox.critical(self, |
583 E5MessageBox.critical( |
|
584 self, |
583 self.trUtf8("Error saving Chat"), |
585 self.trUtf8("Error saving Chat"), |
584 self.trUtf8("""<p>The chat contents could not be""" |
586 self.trUtf8("""<p>The chat contents could not be""" |
585 """ written to <b>{0}</b></p>""" |
587 """ written to <b>{0}</b></p>""" |
586 """<p>Reason: {1}</p>""") .format( |
588 """<p>Reason: {1}</p>""") .format( |
587 fname, str(err))) |
589 fname, str(err))) |