-bool LyXVC::ensureClean()
-{
- if (owner_->isClean())
- return true;
-
- string const file = MakeDisplayPath(owner_->fileName(), 30);
-#if USE_BOOST_FORMAT
- boost::format fmt(_("The document %1$s has unsaved changes.\n\nDo you want to save the document?"));
- fmt % file;
- string text = fmt.str();
-#else
- string text = _("The document ");
- text += file + _(" has unsaved changes.\n\nDo you want to save the document?");
-#endif
- int const ret = Alert::prompt(_("Save changed document?"),
- text, 0, 1, _("&Save"), _("&Cancel"));
-
- if (ret == 0) {
- vcs->owner()->getUser()->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
- }
-
- return owner_->isClean();
-}
-
-