]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiDocument.cpp
* GuiDocument.cpp (dispatchParams):
[features.git] / src / frontends / qt4 / GuiDocument.cpp
index 0ad171b5aaf72f3d2e4f8a4181c1fa6fae88ca57..23baa30ce6cf8d3730c8082ee518c5cfbee374d6 100644 (file)
@@ -2365,7 +2365,19 @@ void GuiDocument::dispatchParams()
                           support::onlyPath(buffer().absFileName()));
                if (isLyXFilename(master_file.absFilename())) {
                        Buffer * master = checkAndLoadLyXFile(master_file);
-                       const_cast<Buffer &>(buffer()).setParent(master);
+                       if (master) {
+                               if (master->isChild(const_cast<Buffer *>(&buffer())))
+                                       const_cast<Buffer &>(buffer()).setParent(master);
+                               else
+                                       Alert::warning(_("Assigned master does not include this file"), 
+                                               bformat(_("You must include this file in the document\n"
+                                                         "'%1$s' in order to use the master document\n"
+                                                         "feature."), from_utf8(params().master)));
+                       } else
+                               Alert::warning(_("Could not load master"), 
+                                               bformat(_("The master file '%1$s'\n"
+                                                          "could not be loaded."),
+                                                          from_utf8(params().master)));
                }
        }