Move error reporting out of the NWDoc class
This commit is contained in:
+6
-1
@@ -446,7 +446,12 @@ class GuiDocEditor(QTextEdit):
|
||||
theItem.setParaCount(self.paraCount)
|
||||
|
||||
self.saveCursorPosition()
|
||||
self.nwDocument.writeDocument(docText)
|
||||
if not self.nwDocument.writeDocument(docText):
|
||||
self.theParent.makeAlert([
|
||||
self.tr("Could not save document."), self.nwDocument.getError()
|
||||
], nwAlert.ERROR)
|
||||
return False
|
||||
|
||||
self.setDocumentChanged(False)
|
||||
|
||||
self.theIndex.scanText(tHandle, docText)
|
||||
|
||||
+6
-1
@@ -528,7 +528,12 @@ class GuiProjectTree(QTreeWidget):
|
||||
self.theParent.closeDocument()
|
||||
|
||||
delDoc = NWDoc(self.theProject, tHandle)
|
||||
delDoc.deleteDocument()
|
||||
if not delDoc.deleteDocument():
|
||||
self.makeAlert([
|
||||
self.tr("Could not delete document file."), delDoc.getError()
|
||||
], nwAlert.ERROR)
|
||||
return False
|
||||
|
||||
self.theIndex.deleteHandle(tHandle)
|
||||
self._deleteTreeItem(tHandle)
|
||||
self._setTreeChanged(True)
|
||||
|
||||
Reference in New Issue
Block a user