298 icon=E5MessageBox.Warning) |
298 icon=E5MessageBox.Warning) |
299 if not res: |
299 if not res: |
300 return |
300 return |
301 fname = Utilities.toNativeSeparators(fname) |
301 fname = Utilities.toNativeSeparators(fname) |
302 |
302 |
|
303 eol = e5App().getObject("Project").getEolString() |
303 try: |
304 try: |
304 f = open(fname, "w", encoding="utf-8") |
305 f = open(fname, "w", encoding="utf-8") |
305 f.write(self.contents.toPlainText()) |
306 f.write(eol.join(self.contents.toPlainText().splitlines())) |
306 f.close() |
307 f.close() |
307 except IOError as why: |
308 except IOError as why: |
308 E5MessageBox.critical(self, self.trUtf8('Save Diff'), |
309 E5MessageBox.critical(self, self.trUtf8('Save Diff'), |
309 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
310 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
310 '<br>Reason: {1}</p>') |
311 '<br>Reason: {1}</p>') |