diff --git a/src/LayoutFile.cpp b/src/LayoutFile.cpp
index 7096cf402f..e2d7653454 100644
--- a/src/LayoutFile.cpp
+++ b/src/LayoutFile.cpp
@@ -223,9 +223,8 @@ LayoutFileIndex
BOOST_ASSERT(sub.size() == 4);
// now, create a TextClass with description containing path information
string className(sub.str(2) == "" ? textclass : sub.str(2));
- string description(sub.str(3) + " <" + path + ">");
LayoutFile * tmpl =
- new LayoutFile(textclass, className, description, true);
+ new LayoutFile(textclass, className, localIndex, true);
// This textclass is added on request so it will definitely be
// used. Load it now because other load() calls may fail if they
// are called in a context without buffer path information.
diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp
index 61fbdf8255..d8d96144fa 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -870,6 +870,8 @@ GuiDocument::GuiDocument(GuiView & lv)
this, SLOT(classChanged()));
connect(latexModule->classCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
+ connect(latexModule->layoutPB, SIGNAL(clicked()),
+ this, SLOT(browseLayout()));
selectionManager =
new ModuleSelMan(latexModule->availableLV, latexModule->selectedLV,
@@ -1220,6 +1222,49 @@ void GuiDocument::updatePagestyle(string const & items, string const & sel)
}
+void GuiDocument::browseLayout()
+{
+ QString const label1 = qt_("Layouts|#o#O");
+ QString const dir1 = toqstr(lyxrc.document_path);
+ FileFilterList const filter(_("LyX Layout (*.layout)"));
+ QString file = browseRelFile(QString(), bufferFilepath(),
+ qt_("Local layout file"), filter, false,
+ label1, dir1);
+
+ if (!suffixIs(fromqstr(file), ".layout"))
+ return;
+
+ FileName layoutFile = makeAbsPath(fromqstr(file),
+ fromqstr(bufferFilepath()));
+
+ // load the layout file
+ LayoutFileList & bcl = LayoutFileList::get();
+ string classname = layoutFile.onlyFileName();
+ LayoutFileIndex name = bcl.addLayoutFile(
+ 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::classChanged()
{
int idx = latexModule->classCO->currentIndex();
diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h
index 489cc1efd4..e846f90ac5 100644
--- a/src/frontends/qt4/GuiDocument.h
+++ b/src/frontends/qt4/GuiDocument.h
@@ -135,6 +135,7 @@ private Q_SLOTS:
void setSkip(int);
void enableSkip(bool);
void portraitChanged();
+ void browseLayout();
void classChanged();
void updateModuleInfo();
void setExtraEmbeddedFileList();
diff --git a/src/frontends/qt4/ui/LaTeXUi.ui b/src/frontends/qt4/ui/LaTeXUi.ui
index ee08c1dc9b..7d3e7e9b96 100644
--- a/src/frontends/qt4/ui/LaTeXUi.ui
+++ b/src/frontends/qt4/ui/LaTeXUi.ui
@@ -19,7 +19,7 @@
6
- -
+
-
Modules
@@ -129,7 +129,7 @@
- -
+
-
Qt::Horizontal
@@ -167,6 +167,29 @@
-
+
+
+ 7
+ 0
+ 0
+ 0
+
+
+
+ -
+
+
+
+ 1
+ 0
+ 0
+ 0
+
+
+
+ B&rowse...
+
+
-
@@ -178,7 +201,7 @@
- -
+
-