Editor: remove duplicated path is empty checks when saving

Change-Id: I1fdaacd44918a63e55bce9f15f3f80782ddcbe55
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2023-08-24 12:48:37 +02:00
parent 541719d443
commit 4526e1908c
11 changed files with 32 additions and 45 deletions

View File

@@ -326,6 +326,7 @@ IDocument::OpenResult IDocument::open(QString *errorString, const Utils::FilePat
/*!
Saves the contents of the document to the \a filePath on disk.
If \a filePath is empty filePath() is used.
If \a autoSave is \c true, the saving is done for an auto-save, so the
document should avoid cleanups or other operations that it does for
@@ -340,13 +341,15 @@ IDocument::OpenResult IDocument::open(QString *errorString, const Utils::FilePat
\sa shouldAutoSave()
\sa aboutToSave()
\sa saved()
\sa filePath()
*/
bool IDocument::save(QString *errorString, const Utils::FilePath &filePath, bool autoSave)
{
emit aboutToSave(filePath.isEmpty() ? this->filePath() : filePath, autoSave);
const bool success = saveImpl(errorString, filePath, autoSave);
const Utils::FilePath savePath = filePath.isEmpty() ? this->filePath() : filePath;
emit aboutToSave(savePath, autoSave);
const bool success = saveImpl(errorString, savePath, autoSave);
if (success)
emit saved(filePath.isEmpty() ? this->filePath() : filePath, autoSave);
emit saved(savePath, autoSave);
return success;
}