]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormInclude.C
Yet another tweak from J�rgen.
[lyx.git] / src / frontends / xforms / FormInclude.C
index 20902844031f05bc041b8e2617bae0c70a882106..636574b121c51444b9c75c75c1a59a348c1d4714 100644 (file)
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /**
  * \file FormInclude.C
  * Copyright 2001 the LyX Team
@@ -91,8 +90,11 @@ void FormInclude::apply()
 {
        controller().params().noload = fl_get_button(dialog_->check_typeset);
 
-       controller().params().cparams.
-               setContents(fl_get_input(dialog_->input_filename));
+       string const file = fl_get_input(dialog_->input_filename);
+       if (controller().fileExists(file))
+           controller().params().cparams.setContents(file);
+       else
+           controller().params().cparams.setContents("");
 
        if (fl_get_button(dialog_->check_useinput))
                controller().params().flag = InsetInclude::INPUT;
@@ -128,8 +130,10 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long)
 
        } else if (ob == dialog_->button_load) {
                string const in_name = fl_get_input(dialog_->input_filename);
-               if (!strip(in_name).empty()) {
-                       ApplyButton();
+               if (!strip(in_name).empty() && controller().fileExists(in_name)) {
+//                     ApplyButton();
+                       OKButton();
+                       controller().load(strip(in_name));
                        action = ButtonPolicy::SMI_NOOP;
                }