Skip to content

Commit

Permalink
Merge pull request supercollider#1371 from supercollider/topic/fix-do…
Browse files Browse the repository at this point in the history
…c-modified-warnings

ide: Fix triggering of doc modified signal
  • Loading branch information
telephon committed May 25, 2015
2 parents 605bfef + 96380ae commit b305a24
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion editors/sc-ide/core/doc_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ bool DocumentManager::doSaveAs( Document *doc, const QString & path )

QString str = doc->textDocument()->toPlainText();
file.write(str.toUtf8());
file.flush();
file.close();

info.refresh();
Expand All @@ -534,10 +535,17 @@ bool DocumentManager::doSaveAs( Document *doc, const QString & path )
(info.suffix() == QString("scd")) ||
(info.suffix() == QString("schelp")));

// It's possible the mod time has not been updated - if it looks like that is the case,
// just set it one second in the future, so we don't trip the external modification alarm.
if (doc->mSaveTime == info.lastModified()) {
doc->mSaveTime = QDateTime::currentDateTime().addMSecs(1000);
} else {
doc->mSaveTime = info.lastModified();
}

doc->mFilePath = cpath;
doc->mTitle = info.fileName();
doc->mDoc->setModified(false);
doc->mSaveTime = info.lastModified();
doc->setPlainText(fileIsPlainText);
doc->removeTmpFile();

Expand Down

0 comments on commit b305a24

Please sign in to comment.