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>
This commit is contained in:
Giuseppe D'Angelo 2013-08-27 12:03:42 +02:00 committed by The Qt Project
parent 5971e09187
commit be72ea7e35

View File

@ -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());