]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDocument.cpp
* hyperref: add check for newline chars in user input.
[lyx.git] / src / frontends / qt4 / GuiDocument.cpp
index 59973edb9f2ffa50448667e1ee65c2f5d09448f1..ab66d2685b8c5bafeabc7dfc33e5cc3890eb591c 100644 (file)
@@ -1242,7 +1242,20 @@ void GuiDocument::classChanged()
        if (idx < 0) 
                return;
        string const classname = classes_model_.getIDString(idx);
-       // FIXME There is a bug here: 4594
+       // check if this is a local layout file
+       if (prefixIs(classname, BaseClassList::localPrefix)) {
+               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 same directory."),
+                                 1, 1, _("&Set Layout"), _("&Cancel"));
+               if (ret == 1) {
+                       // try to reset the layout combo
+                       setLayoutComboByIDString(bp_.baseClassID());
+                       return;
+               }
+       }
        if (!bp_.setBaseClass(classname)) {
                Alert::error(_("Error"), _("Unable to set document class."));
                return;
@@ -1250,7 +1263,7 @@ void GuiDocument::classChanged()
        if (lyxrc.auto_reset_options) {
                if (applyPB->isEnabled()) {
                        int const ret = Alert::prompt(_("Unapplied changes"),
-                                       _("Some changes in the dialog were not yet applied."
+                                       _("Some changes in the dialog were not yet applied.\n"
                                        "If you do not apply now, they will be lost after this action."),
                                        1, 1, _("&Apply"), _("&Dismiss"));
                        if (ret == 0)
@@ -1684,7 +1697,8 @@ void GuiDocument::apply(BufferParams & params)
                pdf.pagemode = pdf.pagemode_fullscreen;
        else
                pdf.pagemode.clear();
-       pdf.quoted_options = fromqstr(pdfSupportModule->optionsLE->text());
+       pdf.quoted_options = pdf.quoted_options_check(
+                               fromqstr(pdfSupportModule->optionsLE->text()));
 
        // Embedded files
        // FIXME
@@ -1830,12 +1844,8 @@ void GuiDocument::updateParams(BufferParams const & params)
        }
 
        // text layout
-       string const & classname = params.baseClassID();
-       int idx = classes_model_.findIDString(classname);
-       if (idx < 0)
-               lyxerr << "Unable to set layout for classname " << classname << std::endl;
-       else 
-               latexModule->classCO->setCurrentIndex(idx);
+       string const & layoutID = params.baseClassID();
+       setLayoutComboByIDString(layoutID);
 
        updatePagestyle(documentClass().opt_pagestyle(),
                                 params.pagestyle);
@@ -2094,6 +2104,17 @@ void GuiDocument::useClassDefaults()
 }
 
 
+void GuiDocument::setLayoutComboByIDString(std::string const & idString)
+{
+       int idx = classes_model_.findIDString(idString);
+       if (idx < 0)
+               Alert::warning(_("Can't set layout!"), 
+                       bformat(_("Unable to set layout for ID: %1$s"), from_utf8(idString)));
+       else 
+               latexModule->classCO->setCurrentIndex(idx);
+}
+
+
 bool GuiDocument::isValid()
 {
        return (validate_listings_params().empty() &&