Commit d7d4346a authored by David Schulz's avatar David Schulz

Editor: Added documentation and comments to BaseTextDocument::save.

Change-Id: Ia1ccf30209ca2e802268afea6bc1dfeed421007d
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent e52a35a2
......@@ -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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment