]> git.lyx.org Git - features.git/commitdiff
forminclude patch from herbert
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 21 Jan 2002 10:47:19 +0000 (10:47 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 21 Jan 2002 10:47:19 +0000 (10:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3428 a592a061-630c-0410-9148-cb99ea01b6c8

po/POTFILES.in
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlInclude.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormInclude.C

index c99cc6e07c20816515514beba6ff454b0234b3f7..92d85d025cb6148fe6015d0df32b5f3e40f06d6c 100644 (file)
@@ -9,7 +9,6 @@ src/converter.C
 src/CutAndPaste.C
 src/debug.C
 src/exporter.C
-src/ext_l10n.h
 src/figure_form.C
 src/figureForm.C
 src/FontLoader.C
@@ -64,6 +63,7 @@ src/frontends/qt2/QRef.C
 src/frontends/qt2/QSearch.C
 src/frontends/qt2/QSpellchecker.C
 src/frontends/qt2/QTabularCreate.C
+src/frontends/qt2/QTexinfo.C
 src/frontends/qt2/QThesaurus.C
 src/frontends/qt2/QToc.C
 src/frontends/qt2/QURL.C
index 9d255189410c05c8efd94042f4ae3d6b3501acdf..f105fbea137084a2fe1dccddac46225d281b4b0b 100644 (file)
@@ -1,5 +1,8 @@
 2002-01-20  Herbert Voss  <voss@perce.de>
 
+       * ControlInclude.[Ch]: better control of unexistings files
+       when entered without the browser
+
        * ControlGraphic.C (Browse): add extension "ps" when browsing for
        a filename
 
index 4d018f0916e6d9f822d7fb6ca86cc7e5dfb3d140..ea92ebed1c93c1ba8c33eb77921b41ad42b79b47 100644 (file)
@@ -20,6 +20,7 @@
 #include "ControlInclude.h"
 #include "ControlInset.tmpl"
 #include "buffer.h"
+#include "Alert.h"
 #include "BufferView.h"
 #include "Dialogs.h"
 #include "LyXView.h"
@@ -80,3 +81,15 @@ void ControlInclude::load(string const & file)
 {
        lv_.getLyXFunc()->dispatch(LFUN_CHILDOPEN, file);
 }
+
+
+bool const ControlInclude::fileExists(string const & file)
+{
+    string const fileWithAbsPath = MakeAbsPath(file, OnlyPath(params().masterFilename_)); 
+    if (IsFileReadable(fileWithAbsPath))
+       return true;
+    else
+       Alert::alert(_("File doesn't exists!"));
+    return false;
+}
+
index 57a52a7d87c2313776afba4124540fd0147996b2..566f35f4cdbe8f4fb43471de7fb78aa3ba1ee531 100644 (file)
@@ -43,6 +43,9 @@ public:
        /// load a file
        void load(string const & file); 
 
+       /// test if file exist
+       bool const fileExists(string const & file); 
+
 private:
        /// Dispatch the changed parameters to the kernel.
        virtual void applyParamsToInset();
index bd3873e5368c9a76ba71f25e979451d6b3158f15..69c4fec606471c27baab015b2fcc59c523a3b9be 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-20  Herbert Voss  <voss@perce.de>
+
+       * FormInclude.[C]: better control of unexistings files
+       when entered without the browser
+
 2002-01-20  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * Toolbar_pimpl.C (update): disable layout combox when LFUN_LAYOUT
index 4387b41262a4a70012b6a0ea6a3188b57877bfd2..636574b121c51444b9c75c75c1a59a348c1d4714 100644 (file)
@@ -90,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;
@@ -127,8 +130,9 @@ 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;
                }