// We want the ui session to be saved per document and not per
// window number. The filename crc is a good enough identifier.
createView(support::checksum(fname));
- current_view_->openDocument(fname);
+ current_view_->openDocument(fname, cmd.origin());
if (!current_view_->documentBufferView())
current_view_->close();
else if (cmd.origin() == FuncRequest::LYXSERVER) {
current_view_->showNormal();
}
} else {
- current_view_->openDocument(fname);
+ current_view_->openDocument(fname, cmd.origin());
if (cmd.origin() == FuncRequest::LYXSERVER) {
current_view_->raise();
current_view_->activateWindow();
}
-void GuiView::openDocument(string const & fname)
+void GuiView::openDocument(string const & fname, int origin)
{
string initpath = lyxrc.document_path;
// let the user create one
if (!fullname.exists() && !theBufferList().exists(fullname) &&
!LyXVC::file_not_found_hook(fullname)) {
- // The user specifically chose this name. Believe them.
+ // see bug #12609
+ if (origin == FuncRequest::MENU) {
+ docstring const & msg =
+ bformat(_("File\n %1$s\n does not exist. Create empty file?"),
+ from_utf8(filename));
+ int ret = Alert::prompt(_("File does not exist"),
+ msg, 0, 1,
+ _("&Create File"),
+ _("&Cancel"));
+ if (ret == 1)
+ return;
+ }
Buffer * const b = newFile(filename, string(), true);
if (b)
setBuffer(b);
/// closes the buffer
bool closeBuffer(Buffer & buf);
///
- void openDocument(std::string const & filename);
+ void openDocument(std::string const & filename, int origin);
///
void importDocument(std::string const &);