337 icon = E5MessageBox.Warning) |
337 icon = E5MessageBox.Warning) |
338 if not res: |
338 if not res: |
339 return |
339 return |
340 fname = Utilities.toNativeSeparators(fname) |
340 fname = Utilities.toNativeSeparators(fname) |
341 |
341 |
|
342 eol = e5App().getObject("Project").getEolString() |
342 try: |
343 try: |
343 f = open(fname, "w", encoding = "utf-8") |
344 f = open(fname, "w", encoding = "utf-8") |
344 f.write(self.contents.toPlainText()) |
345 f.write(eol.join(self.contents.toPlainText().splitlines())) |
345 f.close() |
346 f.close() |
346 except IOError as why: |
347 except IOError as why: |
347 E5MessageBox.critical(self, self.trUtf8('Save Diff'), |
348 E5MessageBox.critical(self, self.trUtf8('Save Diff'), |
348 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
349 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
349 '<br>Reason: {1}</p>') |
350 '<br>Reason: {1}</p>') |