Force document save when manually calling save document

This commit is contained in:
Veronica Berglyd Olsen
2024-05-02 22:30:58 +02:00
parent 2b8338f537
commit 917977ae13
3 changed files with 18 additions and 10 deletions
+11 -5
View File
@@ -575,12 +575,18 @@ class GuiMain(QMainWindow):
self.openDocument(fHandle, tLine=1, doScroll=True)
return
@pyqtSlot()
def saveDocument(self) -> None:
def saveDocument(self, force: bool = False) -> None:
"""Save the current documents."""
self.docEditor.saveCursorPosition()
if SHARED.hasProject and self.docEditor.docChanged:
self.docEditor.saveText()
if SHARED.hasProject:
self.docEditor.saveCursorPosition()
if force or self.docEditor.docChanged:
self.docEditor.saveText()
return
@pyqtSlot()
def forceSaveDocument(self) -> None:
"""Save document even of it has not changed."""
self.saveDocument(force=True)
return
def viewDocument(self, tHandle: str | None = None, sTitle: str | None = None) -> bool: