summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@digia.com>2013-01-24 08:49:17 +0100
committerDavid Schulz <david.schulz@digia.com>2013-01-24 11:26:50 +0100
commitd7d4346af36e9dbaba5e33f0594140c0a4195b6d (patch)
treec327f52d0301a68d23c722647a2d018c98b51afb
parente52a35a239ceab5381e289482fca546e26b06366 (diff)
downloadqt-creator-d7d4346af36e9dbaba5e33f0594140c0a4195b6d.tar.gz
Editor: Added documentation and comments to BaseTextDocument::save.
Change-Id: Ia1ccf30209ca2e802268afea6bc1dfeed421007d Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
-rw-r--r--src/plugins/texteditor/basetextdocument.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index d538d39f6f..388ed6b43c 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -196,6 +196,12 @@ ITextMarkable *BaseTextDocument::documentMarker() const
return documentLayout->markableInterface();
}
+/*!
+ * \brief Saves the document to the specified file.
+ * \param errorString output parameter, contains error reason.
+ * \param autoSave signalise that this function was called by the automatic save routine.
+ * If autosave is true, the cursor will be restored and some signals suppressed.
+ */
bool BaseTextDocument::save(QString *errorString, const QString &fileName, bool autoSave)
{
QTextCursor cursor(d->m_document);
@@ -247,6 +253,7 @@ bool BaseTextDocument::save(QString *errorString, const QString &fileName, bool
const bool ok = write(fName, saveFormat, d->m_document->toPlainText(), errorString);
+ // restore text cursor
if (autoSave && undos < d->m_document->availableUndoSteps()) {
d->m_document->undo();
if (editorWidget) {
@@ -263,6 +270,7 @@ bool BaseTextDocument::save(QString *errorString, const QString &fileName, bool
if (autoSave)
return true;
+ // inform about the new filename
const QFileInfo fi(fName);
const QString oldFileName = d->m_fileName;
d->m_fileName = QDir::cleanPath(fi.absoluteFilePath());