+void GuiDocument::browseLayout()
+{
+ QString const label1 = qt_("Layouts|#o#O");
+ QString const dir1 = toqstr(lyxrc.document_path);
+ QStringList const filter(qt_("LyX Layout (*.layout)"));
+ QString file = browseRelFile(QString(), bufferFilepath(),
+ qt_("Local layout file"), filter, false,
+ label1, dir1);
+
+ if (!file.endsWith(".layout"))
+ return;
+
+ FileName layoutFile = support::makeAbsPath(fromqstr(file),
+ fromqstr(bufferFilepath()));
+
+ int const ret = Alert::prompt(_("Local layout file"),
+ _("The layout file you have selected is a local layout\n"
+ "file, not one in the system or user directory. Your\n"
+ "document may not work with this layout if you do not\n"
+ "keep the layout file in the document directory."),
+ 1, 1, _("&Set Layout"), _("&Cancel"));
+ if (ret == 1)
+ return;
+
+ // load the layout file
+ LayoutFileList & bcl = LayoutFileList::get();
+ string classname = layoutFile.onlyFileName();
+ // this will update an existing layout if that layout has been loaded before.
+ LayoutFileIndex name = bcl.addLocalLayout(
+ classname.substr(0, classname.size() - 7),
+ layoutFile.onlyPath().absFilename());
+
+ if (name.empty()) {
+ Alert::error(_("Error"),
+ _("Unable to read local layout file."));
+ return;
+ }
+
+ // do not trigger classChanged if there is no change.
+ if (latexModule->classCO->currentText() == toqstr(name))
+ return;
+
+ // add to combo box
+ int idx = latexModule->classCO->findText(toqstr(name));
+ if (idx == -1) {
+ classes_model_.insertRow(0, toqstr(name), name);
+ latexModule->classCO->setCurrentIndex(0);
+ } else
+ latexModule->classCO->setCurrentIndex(idx);
+
+ classChanged();
+}
+
+
+void GuiDocument::browseMaster()
+{
+ QString const title = qt_("Select master document");
+ QString const dir1 = toqstr(lyxrc.document_path);
+ QString const old = latexModule->childDocLE->text();
+ QString const docpath = toqstr(support::onlyPath(buffer().absFileName()));
+ QStringList const filter(qt_("LyX Files (*.lyx)"));
+ QString file = browseRelFile(old, docpath, title, filter, false,
+ qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
+
+ latexModule->childDocLE->setText(file);
+}
+
+