}
-void GuiView::insertLyXFile(docstring const & fname, bool ignorelang)
+bool GuiView::insertLyXFile(docstring const & fname, bool ignorelang)
{
BufferView * bv = documentBufferView();
if (!bv)
- return;
+ return false;
// FIXME UNICODE
FileName filename(to_utf8(fname));
QStringList(qt_("LyX Documents (*.lyx)")));
if (result.first == FileDialog::Later)
- return;
+ return false;
// FIXME UNICODE
filename.set(fromqstr(result.second));
if (filename.empty()) {
// emit message signal.
message(_("Canceled."));
- return;
+ return false;
}
}
bv->insertLyXFile(filename, ignorelang);
bv->buffer().errors("Parse");
+ return true;
}
break;
case LFUN_FILE_INSERT: {
- if (cmd.getArg(1) == "ignorelang")
- insertLyXFile(from_utf8(cmd.getArg(0)), true);
- else
- insertLyXFile(cmd.argument());
- dr.forceBufferUpdate();
- dr.screenUpdate(Update::Force);
+ bool const ignore_lang = cmd.getArg(1) == "ignorelang";
+ if (insertLyXFile(from_utf8(cmd.getArg(0)), ignore_lang)) {
+ dr.forceBufferUpdate();
+ dr.screenUpdate(Update::Force);
+ }
break;
}
bool lfunUiToggle(std::string const & ui_component);
///
void toggleFullScreen();
- ///
- void insertLyXFile(docstring const & fname, bool ignorelang = false);
+ /// \return whether we did anything
+ bool insertLyXFile(docstring const & fname, bool ignorelang = false);
///
/// Open Export As ... dialog. \p iformat is the format the
/// filter is initially set to.