* src/frontends/qt4/QBibtex.cpp:
* src/frontends/qt4/QExternal.cpp:
* src/frontends/qt4/QGraphics.cpp:
* src/frontends/qt4/QInclude.cpp:
- remove path validator
* src/support/filetools.{cpp,h}:
- new validator for exporting LaTeX files
* src/insets/ExternalSupport.cpp:
* src/insets/InsetBibtex.cpp:
* src/insets/InsetGraphics.cpp:
* src/insets/InsetInclude.cpp:
- use validator when exporting a LaTeX file
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18897
a592a061-630c-0410-9148-
cb99ea01b6c8
bcview->setOK(add_->addPB);
bcview->setCancel(add_->closePB);
- add_->bibED->setValidator(new PathValidator(true, add_->bibED));
addCheckedLineEdit(add_bc_.view(), add_->bibED, 0);
connect(add_->bibED, SIGNAL(textChanged(const QString &)),
void QBibtex::update_contents()
{
- PathValidator * path_validator =
- getPathValidator(dialog_->add_->bibED);
- if (path_validator)
- path_validator->setChecker(kernel().docType(), lyxrc);
-
bool bibtopic = controller().usingBibtopic();
dialog_->databaseLW->clear();
widthED->setValidator(unsignedLengthValidator(widthED));
heightED->setValidator(unsignedLengthValidator(heightED));
- fileED->setValidator(new PathValidator(true, fileED));
setFocusProxy(fileED);
}
void QExternal::update_contents()
{
- PathValidator * path_validator = getPathValidator(dialog_->fileED);
- if (path_validator)
- path_validator->setChecker(kernel().docType(), lyxrc);
-
dialog_->tab->setCurrentIndex(0);
InsetExternalParams const & params = controller().params();
#include "QGraphicsDialog.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
-#include "Validator.h"
#include "lengthcommon.h"
#include "LyXRC.h"
void QGraphics::update_contents()
{
- PathValidator * path_validator = getPathValidator(dialog_->filename);
- if (path_validator)
- path_validator->setChecker(kernel().docType(), lyxrc);
-
// clear and fill in the comboboxes
vector<string> const bb_units = frontend::getBBUnits();
dialog_->lbXunit->clear();
#include "CheckedLineEdit.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
-#include "Validator.h"
#include "LyXRC.h"
connect(bypassCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(bypassCB, SIGNAL(clicked()), this, SLOT(validate_listings_params()));
- filenameED->setValidator(new PathValidator(true, filenameED));
setFocusProxy(filenameED);
}
void QInclude::update_contents()
{
- PathValidator * path_validator = getPathValidator(dialog_->filenameED);
- if (path_validator)
- path_validator->setChecker(kernel().docType(), lyxrc);
-
InsetCommandParams const & params = controller().params();
dialog_->filenameED->setText(toqstr(params["filename"]));
#include "Buffer.h"
#include "Converter.h"
#include "debug.h"
+#include "gettext.h"
#include "ErrorList.h"
#include "Exporter.h"
#include "Format.h"
#include "Mover.h"
+#include "frontends/alert.h"
+
#include "support/filetools.h"
#include "support/Forkedcall.h"
#include "support/lstrings.h"
namespace lyx {
using support::FileName;
+using support::isValidLaTeXFilename;
namespace external {
bool const use_latex_path = format == "LaTeX";
string str = doSubstitution(params, buffer, cit->second.product,
use_latex_path, external_in_tmpdir);
+
+ string const absname = support::makeAbsPath(
+ params.filename.outputFilename(buffer.filePath()), buffer.filePath()).absFilename();
+
+ if (!external_in_tmpdir && !isValidLaTeXFilename(absname)) {
+ lyx::frontend::Alert::warning(_("Invalid filename"),
+ _("The following filename is likely to cause trouble "
+ "when running the exported file through LaTeX: ") +
+ from_utf8(absname));
+ }
+
str = substituteCommands(params, str, format);
str = substituteOptions(params, str, format);
// FIXME UNICODE
using support::FileName;
using support::findtexfile;
using support::isFileReadable;
+using support::isValidLaTeXFilename;
using support::latex_path;
using support::ltrim;
using support::makeAbsPath;
<< "' to '" << out_file << "'"
<< endl;
}
+ } else if (!runparams.inComment && runparams.nice && not_from_texmf &&
+ !isValidLaTeXFilename(database)) {
+ frontend::Alert::warning(_("Invalid filename"),
+ _("The following filename is likely to cause trouble "
+ "when running the exported file through LaTeX: ") +
+ from_utf8(database));
}
if (it != begin)
using support::float_equal;
using support::getExtension;
using support::isFileReadable;
+using support::isValidLaTeXFilename;
using support::latex_path;
using support::onlyFilename;
using support::removeExtension;
string output_file = support::os::external_path(runparams.nice ?
params().filename.outputFilename(m_buffer->filePath()) :
onlyFilename(temp_file.absFilename()));
+
+ if (runparams.nice && !isValidLaTeXFilename(output_file)) {
+ frontend::Alert::warning(_("Invalid filename"),
+ _("The following filename is likely to cause trouble "
+ "when running the exported file through LaTeX: ") +
+ from_utf8(output_file));
+ }
+
FileName source_file = runparams.nice ? FileName(params().filename) : temp_file;
string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
"latex" : "pdflatex";
using support::getVectorFromString;
using support::isFileReadable;
using support::isLyXFilename;
+using support::isValidLaTeXFilename;
using support::latex_path;
using support::makeAbsPath;
using support::makeDisplayPath;
if (!runparams.nice)
incfile = mangled;
+ else if (!isValidLaTeXFilename(incfile)) {
+ frontend::Alert::warning(_("Invalid filename"),
+ _("The following filename is likely to cause trouble "
+ "when running the exported file through LaTeX: ") +
+ from_utf8(incfile));
+ }
LYXERR(Debug::LATEX) << "incfile:" << incfile << endl;
LYXERR(Debug::LATEX) << "exportfile:" << exportfile << endl;
LYXERR(Debug::LATEX) << "writefile:" << writefile << endl;
}
+bool isValidLaTeXFilename(string const & filename)
+{
+ string const invalid_chars("#$%{}()[]\"^");
+ if (filename.find_first_of(invalid_chars) != string::npos)
+ return false;
+ else
+ return true;
+}
+
+
string const latex_path(string const & original_path,
latex_path_extension extension,
latex_path_dots dots)
///
bool isSGMLFilename(std::string const & filename);
+///
+bool isValidLaTeXFilename(std::string const & filename);
+
/** Returns the path of a library data file.
Search the file name.ext in the subdirectory dir of
-# user_lyxdir