X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fcontrollers%2FControlGraphics.C;h=b1de9231ad39bbedf71bc4f6dfd806e4603419c1;hb=b97138d0e8b5f107a7eac52fcbf5ee9d9f01af0b;hp=c488988803efff0a7113e5fed30e2bba7ea562cb;hpb=f7ba7c8e9f3dcd2a5de79c7e93bf8edeec3b8e35;p=lyx.git diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index c488988803..b1de9231ad 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -24,6 +24,7 @@ #include "ControlGraphics.h" #include "ControlInset.tmpl" #include "buffer.h" +#include "BufferView.h" #include "Dialogs.h" #include "LyXView.h" #include "gettext.h" @@ -33,11 +34,9 @@ #include "insets/insetgraphicsParams.h" // need operator!=() #include "support/FileInfo.h" // for FileInfo -#include "helper_funcs.h" // for browseFile +#include "helper_funcs.h" #include "support/lstrings.h" #include "support/filetools.h" // for AddName, zippedFile -#include "frontends/Alert.h" -#include "BufferView.h" using std::pair; using std::make_pair; @@ -98,7 +97,8 @@ string const ControlGraphics::Browse(string const & in_name) pair dir1(N_("Clipart|#C#c"), clipdir); pair dir2(N_("Documents|#o#O"), string(lyxrc.document_path)); // Show the file browser dialog - return browseFile(&lv_, in_name, title, pattern, dir1, dir2); + return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(), + title, pattern, dir1, dir2); } @@ -135,10 +135,9 @@ string const ControlGraphics::readBB(string const & file) } -void ControlGraphics::checkFilename(string const & fname) { - if (!IsFileReadable(fname)) - Alert::alert(_("Warning!"), - _("Filename") + ' ' - + fname + _(" does not exist!")); - +bool ControlGraphics::isFilenameValid(string const & fname) const +{ + // It may be that the filename is relative. + string const name = MakeAbsPath(fname, lv_.buffer()->filePath()); + return IsFileReadable(name); }