MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / saveFile

Method saveFile

src/Gui/EditorView.cpp:565–586  ·  view source on GitHub ↗

* Saves the contents to a file. */

Source from the content-addressed store, hash-verified

563 * Saves the contents to a file.
564 */
565bool EditorView::saveFile()
566{
567 if (d->fileName.isEmpty()) {
568 return saveAs();
569 }
570
571 QFile file(d->fileName);
572 if (!file.open(QFile::WriteOnly)) {
573 return false;
574 }
575 QTextStream ts(&file);
576#if QT_VERSION < 0x060000
577 ts.setCodec("UTF-8");
578#endif
579 ts << d->textEdit->document()->toPlainText();
580 file.close();
581 d->textEdit->document()->setModified(false);
582
583 QFileInfo fi(d->fileName);
584 d->timeStamp = fi.lastModified().toSecsSinceEpoch();
585 return true;
586}
587
588void EditorView::undoAvailable(bool undo)
589{

Callers

nothing calls this directly

Calls 7

toPlainTextMethod · 0.80
lastModifiedMethod · 0.80
isEmptyMethod · 0.45
openMethod · 0.45
documentMethod · 0.45
closeMethod · 0.45
setModifiedMethod · 0.45

Tested by

no test coverage detected