From be72ea7e35d611c9fef453b1e7dd36f89d166ff7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 27 Aug 2013 12:03:42 +0200 Subject: Do not attempt to save a file in the resources A wrong code path caused the textedit example to attempting to try to save the file it was currently editing even if it was loaded from the resource system. Task-number: QTBUG-33105 Change-Id: I9e03168968a98a421e8ab93a8d06f808b72ac3b0 Reviewed-by: Friedemann Kleint --- examples/widgets/richtext/textedit/textedit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp index ae2bdedf13..873a29eb0e 100644 --- a/examples/widgets/richtext/textedit/textedit.cpp +++ b/examples/widgets/richtext/textedit/textedit.cpp @@ -436,8 +436,7 @@ bool TextEdit::maybeSave() { if (!textEdit->document()->isModified()) return true; - if (fileName.startsWith(QLatin1String(":/"))) - return true; + QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("Application"), tr("The document has been modified.\n" @@ -485,6 +484,8 @@ bool TextEdit::fileSave() { if (fileName.isEmpty()) return fileSaveAs(); + if (fileName.startsWith(QStringLiteral(":/"))) + return fileSaveAs(); QTextDocumentWriter writer(fileName); bool success = writer.write(textEdit->document()); -- cgit v1.2.3