undef_, SLOT(accept()));
connect(undef_->cancelPB, SIGNAL(clicked()),
undef_, SLOT(reject()));
+
+ newBranchLE->setValidator(new NoNewLineValidator(newBranchLE));
}
void GuiBranches::update(BufferParams const & params)
outputModule->synccustomCB->addItem("\\synctex=-1");
outputModule->synccustomCB->addItem("\\usepackage[active]{srcltx}");
+ outputModule->synccustomCB->setValidator(new NoNewLineValidator(
+ outputModule->synccustomCB));
+
// fonts
fontModule = new UiWidget<Ui::FontUi>;
connect(fontModule->osFontsCB, SIGNAL(clicked()),
connect(fontModule->fontOsfCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
+ fontModule->fontencLE->setValidator(new NoNewLineValidator(
+ fontModule->fontencLE));
+ fontModule->cjkFontLE->setValidator(new NoNewLineValidator(
+ fontModule->cjkFontLE));
+
updateFontlist();
fontModule->fontsizeCO->addItem(qt_("Default"));
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
- connect(langModule->languagePackageED, SIGNAL(textChanged(QString)),
+ connect(langModule->languagePackageLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(currentIndexChanged(int)),
this, SLOT(languagePackageChanged(int)));
+ langModule->languagePackageLE->setValidator(new NoNewLineValidator(
+ langModule->languagePackageLE));
+
QAbstractItemModel * language_model = guiApp->languageModel();
// FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
language_model->sort(0);
this, SLOT(change_adaptor()));
connect(biblioModule->bibtexCO, SIGNAL(activated(int)),
this, SLOT(bibtexChanged(int)));
- connect(biblioModule->bibtexOptionsED, SIGNAL(textChanged(QString)),
+ connect(biblioModule->bibtexOptionsLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
+ biblioModule->bibtexOptionsLE->setValidator(new NoNewLineValidator(
+ biblioModule->bibtexOptionsLE));
+
biblioModule->citeStyleCO->addItem(qt_("Author-year"));
biblioModule->citeStyleCO->addItem(qt_("Numerical"));
biblioModule->citeStyleCO->setCurrentIndex(0);
connect(latexModule->refstyleCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
+ latexModule->optionsLE->setValidator(new NoNewLineValidator(
+ latexModule->optionsLE));
+ latexModule->childDocLE->setValidator(new NoNewLineValidator(
+ latexModule->childDocLE));
+
// postscript drivers
for (int n = 0; tex_graphics[n][0]; ++n) {
QString enc = qt_(tex_graphics_gui[n]);
connect(pdfSupportModule->optionsLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
+ pdfSupportModule->titleLE->setValidator(new NoNewLineValidator(
+ pdfSupportModule->titleLE));
+ pdfSupportModule->authorLE->setValidator(new NoNewLineValidator(
+ pdfSupportModule->authorLE));
+ pdfSupportModule->subjectLE->setValidator(new NoNewLineValidator(
+ pdfSupportModule->subjectLE));
+ pdfSupportModule->keywordsLE->setValidator(new NoNewLineValidator(
+ pdfSupportModule->keywordsLE));
+ pdfSupportModule->optionsLE->setValidator(new NoNewLineValidator(
+ pdfSupportModule->optionsLE));
+
for (int i = 0; backref_opts[i][0]; ++i)
pdfSupportModule->backrefCO->addItem(qt_(backref_opts_gui[i]));
void GuiDocument::languagePackageChanged(int i)
{
- langModule->languagePackageED->setEnabled(
+ langModule->languagePackageLE->setEnabled(
langModule->languagePackageCO->itemData(i).toString() == "custom");
}
void GuiDocument::bibtexChanged(int n)
{
- biblioModule->bibtexOptionsED->setEnabled(
+ biblioModule->bibtexOptionsLE->setEnabled(
biblioModule->bibtexCO->itemData(n).toString() != "default");
changed();
}
fromqstr(biblioModule->bibtexCO->itemData(
biblioModule->bibtexCO->currentIndex()).toString());
string const bibtex_options =
- fromqstr(biblioModule->bibtexOptionsED->text());
+ fromqstr(biblioModule->bibtexOptionsLE->text());
if (bibtex_command == "default" || bibtex_options.empty())
bp_.bibtex_command = bibtex_command;
else
langModule->languagePackageCO->currentIndex()).toString();
if (pack == "custom")
bp_.lang_package =
- fromqstr(langModule->languagePackageED->text());
+ fromqstr(langModule->languagePackageLE->text());
else
bp_.lang_package = fromqstr(pack);
int const bpos = biblioModule->bibtexCO->findData(toqstr(command));
if (bpos != -1) {
biblioModule->bibtexCO->setCurrentIndex(bpos);
- biblioModule->bibtexOptionsED->setText(toqstr(options).trimmed());
+ biblioModule->bibtexOptionsLE->setText(toqstr(options).trimmed());
} else {
// We reset to default if we do not know the specified compiler
// This is for security reasons
biblioModule->bibtexCO->setCurrentIndex(
biblioModule->bibtexCO->findData(toqstr("default")));
- biblioModule->bibtexOptionsED->clear();
+ biblioModule->bibtexOptionsLE->clear();
}
- biblioModule->bibtexOptionsED->setEnabled(
+ biblioModule->bibtexOptionsLE->setEnabled(
biblioModule->bibtexCO->currentIndex() != 0);
// indices
if (p == -1) {
langModule->languagePackageCO->setCurrentIndex(
langModule->languagePackageCO->findData("custom"));
- langModule->languagePackageED->setText(toqstr(bp_.lang_package));
+ langModule->languagePackageLE->setText(toqstr(bp_.lang_package));
} else {
langModule->languagePackageCO->setCurrentIndex(p);
- langModule->languagePackageED->clear();
+ langModule->languagePackageLE->clear();
}
//color
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
indexCO->addItem(command, command);
}
+
+ indexOptionsLE->setValidator(new NoNewLineValidator(indexOptionsLE));
+ newIndexLE->setValidator(new NoNewLineValidator(newIndexLE));
}
void GuiIndices::update(BufferParams const & params)
int const pos = indexCO->findData(toqstr(command));
if (pos != -1) {
indexCO->setCurrentIndex(pos);
- indexOptionsED->setText(toqstr(options).trimmed());
+ indexOptionsLE->setText(toqstr(options).trimmed());
} else {
// We reset to default if we do not know the specified compiler
// This is for security reasons
indexCO->setCurrentIndex(indexCO->findData(toqstr("default")));
- indexOptionsED->clear();
+ indexOptionsLE->clear();
}
- indexOptionsED->setEnabled(
+ indexOptionsLE->setEnabled(
indexCO->currentIndex() != 0);
updateView();
string const index_command =
fromqstr(indexCO->itemData(
indexCO->currentIndex()).toString());
- string const index_options = fromqstr(indexOptionsED->text());
+ string const index_options = fromqstr(indexOptionsLE->text());
if (index_command == "default" || index_options.empty())
params.index_command = index_command;
else
void GuiIndices::on_indexCO_activated(int n)
{
- indexOptionsED->setEnabled(
+ indexOptionsLE->setEnabled(
indexCO->itemData(n).toString() != "default");
changed();
}
-void GuiIndices::on_indexOptionsED_textChanged(QString)
+void GuiIndices::on_indexOptionsLE_textChanged(QString)
{
changed();
}
protected Q_SLOTS:
void on_indexCO_activated(int n);
- void on_indexOptionsED_textChanged(QString);
+ void on_indexOptionsLE_textChanged(QString);
void on_addIndexPB_pressed();
void on_renamePB_clicked();
void on_removePB_pressed();
#include "GuiFontLoader.h"
#include "GuiKeySymbol.h"
#include "qt_helpers.h"
+#include "Validator.h"
#include "Author.h"
#include "BufferList.h"
: PrefModule(qt_(catOutput), qt_("General"), form)
{
setupUi(this);
+
DateED->setValidator(new StrftimeValidator(DateED));
+ dviCB->setValidator(new NoNewLineValidator(dviCB));
+ pdfCB->setValidator(new NoNewLineValidator(pdfCB));
+
connect(DateED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
: PrefModule(qt_(catOutput), qt_("LaTeX"), form)
{
setupUi(this);
+
+ latexEncodingED->setValidator(new NoNewLineValidator(latexEncodingED));
+ latexDviPaperED->setValidator(new NoNewLineValidator(latexDviPaperED));
+ latexBibtexED->setValidator(new NoNewLineValidator(latexBibtexED));
+ latexJBibtexED->setValidator(new NoNewLineValidator(latexJBibtexED));
+ latexIndexED->setValidator(new NoNewLineValidator(latexIndexED));
+ latexJIndexED->setValidator(new NoNewLineValidator(latexJIndexED));
+ latexNomenclED->setValidator(new NoNewLineValidator(latexNomenclED));
+ latexChecktexED->setValidator(new NoNewLineValidator(latexChecktexED));
+
connect(latexEncodingCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(latexEncodingED, SIGNAL(textChanged(QString)),
connect(texinputsPrefixED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ pathPrefixED->setValidator(new NoNewLineValidator(pathPrefixED));
+ texinputsPrefixED->setValidator(new NoNewLineValidator(texinputsPrefixED));
}
this, SIGNAL(changed()));
connect(spellcheckNotesCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
+
+ altLanguageED->setValidator(new NoNewLineValidator(altLanguageED));
+ escapeCharactersED->setValidator(new NoNewLineValidator(escapeCharactersED));
#else
spellcheckerCB->setEnabled(false);
altLanguageED->setEnabled(false);
connect(maxAgeLE, SIGNAL(textEdited(QString)),
this, SIGNAL(changed()));
+ converterED->setValidator(new NoNewLineValidator(converterED));
+ converterFlagED->setValidator(new NoNewLineValidator(converterFlagED));
maxAgeLE->setValidator(new QDoubleValidator(maxAgeLE));
//converterDefGB->setFocusProxy(convertersLW);
}
: PrefModule(qt_(catFiles), qt_("File Formats"), form)
{
setupUi(this);
+
formatED->setValidator(new FormatNameValidator(formatsCB, form_->formats()));
formatsCB->setValidator(new FormatPrettynameValidator(formatsCB, form_->formats()));
+ extensionED->setValidator(new NoNewLineValidator(extensionED));
+ shortcutED->setValidator(new NoNewLineValidator(shortcutED));
+ editorED->setValidator(new NoNewLineValidator(editorED));
+ viewerED->setValidator(new NoNewLineValidator(viewerED));
+ copierED->setValidator(new NoNewLineValidator(copierED));
connect(documentCB, SIGNAL(clicked()),
this, SLOT(setFlags()));
connect(defaultDecimalPointLE, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+ languagePackageED->setValidator(new NoNewLineValidator(languagePackageED));
+ startCommandED->setValidator(new NoNewLineValidator(startCommandED));
+ endCommandED->setValidator(new NoNewLineValidator(endCommandED));
+
uiLanguageCO->clear();
QAbstractItemModel * language_model = guiApp->languageModel();
this, SIGNAL(changed()));
connect(printerPaperSizeED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ printerNameED->setValidator(new NoNewLineValidator(printerNameED));
+ printerCommandED->setValidator(new NoNewLineValidator(printerCommandED));
+ printerEvenED->setValidator(new NoNewLineValidator(printerEvenED));
+ printerPageRangeED->setValidator(new NoNewLineValidator(printerPageRangeED));
+ printerCopiesED->setValidator(new NoNewLineValidator(printerCopiesED));
+ printerReverseED->setValidator(new NoNewLineValidator(printerReverseED));
+ printerToFileED->setValidator(new NoNewLineValidator(printerToFileED));
+ printerPaperTypeED->setValidator(new NoNewLineValidator(printerPaperTypeED));
+ printerExtraED->setValidator(new NoNewLineValidator(printerExtraED));
+ printerOddED->setValidator(new NoNewLineValidator(printerOddED));
+ printerCollatedED->setValidator(new NoNewLineValidator(printerCollatedED));
+ printerLandscapeED->setValidator(new NoNewLineValidator(printerLandscapeED));
+ printerToPrinterED->setValidator(new NoNewLineValidator(printerToPrinterED));
+ printerExtensionED->setValidator(new NoNewLineValidator(printerExtensionED));
+ printerPaperSizeED->setValidator(new NoNewLineValidator(printerPaperSizeED));
+ printerSpoolCommandED->setValidator(new NoNewLineValidator(printerSpoolCommandED));
+ printerSpoolPrefixED->setValidator(new NoNewLineValidator(printerSpoolPrefixED));
}
this, SIGNAL(changed()));
connect(emailED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ nameED->setValidator(new NoNewLineValidator(nameED));
+ emailED->setValidator(new NoNewLineValidator(emailED));
}
}
+NoNewLineValidator::NoNewLineValidator(QWidget * parent)
+ : QValidator(parent)
+{}
+
+
+QValidator::State NoNewLineValidator::validate(QString & qtext, int &) const
+{
+ qtext.remove(QRegExp("[\\n\\r]"));
+ return QValidator::Acceptable;
+}
+
+
PathValidator::PathValidator(bool acceptable_if_empty,
QWidget * parent)
: QValidator(parent),
};
+// A class to ascertain that no newline characters are passed.
+class NoNewLineValidator : public QValidator
+{
+ Q_OBJECT
+public:
+ // Define a validator.
+ NoNewLineValidator(QWidget *);
+ // Remove newline characters from input.
+ QValidator::State validate(QString &, int &) const;
+};
+
+
/** A class to ascertain whether the data passed to the @c validate()
* member function is a valid file path.
* The test is active only when the path is to be stored in a LaTeX
<string>&Options:</string>
</property>
<property name="buddy" >
- <cstring>bibtexOptionsED</cstring>
+ <cstring>bibtexOptionsLE</cstring>
</property>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="bibtexOptionsED" >
+ <widget class="QLineEdit" name="bibtexOptionsLE" >
<property name="toolTip" >
<string>Define options such as --min-crossrefs (see the documentation of BibTeX)</string>
</property>
<string>&Options:</string>
</property>
<property name="buddy" >
- <cstring>indexOptionsED</cstring>
+ <cstring>indexOptionsLE</cstring>
</property>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="indexOptionsED" >
+ <widget class="QLineEdit" name="indexOptionsLE" >
<property name="toolTip" >
<string>Define program options of the selected processor.</string>
</property>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="languagePackageED">
+ <widget class="QLineEdit" name="languagePackageLE">
<property name="toolTip">
<string>Enter the command to load the language package (default: \usepackage{babel})</string>
</property>
- Fix instant preview when using Python version 2.4 or lower.
+- Don't allow copy-pasting newline characters in Document->Settings
+ and Tools->Preferences (bug 5840).
+
* ADVANCED FIND AND REPLACE