Core: fix IDocuments aboutToSave and saved filePath

The function emiting those signals can be called with an empty file
path. Use the document file path in this case like in
TextDocument::saveImpl.

Change-Id: I9e3381999a25c49df1d5db060ef5467b12220ad4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2023-08-11 14:41:14 +02:00
parent 28754ba08a
commit 7bb49b58df

View File

@@ -343,10 +343,10 @@ IDocument::OpenResult IDocument::open(QString *errorString, const Utils::FilePat
*/
bool IDocument::save(QString *errorString, const Utils::FilePath &filePath, bool autoSave)
{
emit aboutToSave(filePath, autoSave);
emit aboutToSave(filePath.isEmpty() ? this->filePath() : filePath, autoSave);
const bool success = saveImpl(errorString, filePath, autoSave);
if (success)
emit saved(filePath, autoSave);
emit saved(filePath.isEmpty() ? this->filePath() : filePath, autoSave);
return success;
}