From: Richard Heck Date: Sat, 25 Jun 2016 02:04:59 +0000 (+0100) Subject: Fix bug #8814: Ask for place to export a file if it has not X-Git-Tag: 2.3.0alpha1~1411 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b6d182b81a882aadec6f27e17a60ebf7a3305b4a;p=features.git Fix bug #8814: Ask for place to export a file if it has not yet been saved. --- diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 87ee553df2..445678fdc7 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -3528,16 +3528,20 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) case LFUN_BUFFER_EXPORT: { if (!doc_buffer) break; - FileName target_dir = doc_buffer->fileName().onlyPath(); - string const dest = cmd.getArg(1); - if (!dest.empty() && FileName::isAbsolute(dest)) - target_dir = FileName(support::onlyPath(dest)); // GCC only sees strfwd.h when building merged if (::lyx::operator==(cmd.argument(), "custom")) { dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"), dr); break; } - if (!target_dir.isDirWritable()) { + + string const dest = cmd.getArg(1); + FileName target_dir; + if (!dest.empty() && FileName::isAbsolute(dest)) + target_dir = FileName(support::onlyPath(dest)); + else + target_dir = doc_buffer->fileName().onlyPath(); + + if (doc_buffer->isUnnamed() || !target_dir.isDirWritable()) { exportBufferAs(*doc_buffer, cmd.argument()); break; }