summaryrefslogtreecommitdiffstats
path: root/examples/widgets/richtext/textedit/textedit.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-08-27 12:03:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-27 19:12:06 +0200
commitbe72ea7e35d611c9fef453b1e7dd36f89d166ff7 (patch)
tree00076bc2c5206add65040c940d8d9b4fff99dcb2 /examples/widgets/richtext/textedit/textedit.cpp
parent5971e0918757737425151c39a5f81a238663a17a (diff)
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 <Friedemann.Kleint@digia.com>
Diffstat (limited to 'examples/widgets/richtext/textedit/textedit.cpp')
-rw-r--r--examples/widgets/richtext/textedit/textedit.cpp5
1 files 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());