]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPrefs.cpp
Fix handling of the add branch textfield in GuiBranches
[lyx.git] / src / frontends / qt4 / GuiPrefs.cpp
index 6d0c0c1ef72a51e4ca158ae971bbc3fc09f85b37..2302cc9fae5ab33cdf3794b906f55b6496da31fc 100644 (file)
@@ -20,6 +20,7 @@
 #include "GuiFontLoader.h"
 #include "GuiKeySymbol.h"
 #include "qt_helpers.h"
+#include "Validator.h"
 
 #include "Author.h"
 #include "BufferList.h"
@@ -43,6 +44,7 @@
 #include "support/filetools.h"
 #include "support/foreach.h"
 #include "support/gettext.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 #include "support/Package.h"
@@ -90,7 +92,7 @@ namespace frontend {
 /** Launch a file dialog and return the chosen file.
        filename: a suggested filename.
        title: the title of the dialog.
-       pattern: *.ps etc.
+       filters: *.ps etc.
        dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
 */
 QString browseFile(QString const & filename,
@@ -194,19 +196,18 @@ QString browseDir(QString const & pathname,
 } // namespace frontend
 
 
-QString browseRelFile(QString const & filename, QString const & refpath,
+QString browseRelToParent(QString const & filename, QString const & relpath,
        QString const & title, QStringList const & filters, bool save,
        QString const & label1, QString const & dir1,
        QString const & label2, QString const & dir2)
 {
-       QString const fname = makeAbsPath(filename, refpath);
-
+       QString const fname = makeAbsPath(filename, relpath);
 
        QString const outname =
                frontend::browseFile(fname, title, filters, save, label1, dir1, label2, dir2);
 
        QString const reloutname =
-               toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(refpath)));
+               toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
 
        if (reloutname.startsWith("../"))
                return outname;
@@ -215,6 +216,29 @@ QString browseRelFile(QString const & filename, QString const & refpath,
 }
 
 
+QString browseRelToSub(QString const & filename, QString const & relpath,
+       QString const & title, QStringList const & filters, bool save,
+       QString const & label1, QString const & dir1,
+       QString const & label2, QString const & dir2)
+{
+       QString const fname = makeAbsPath(filename, relpath);
+
+       QString const outname =
+               frontend::browseFile(fname, title, filters, save, label1, dir1, label2, dir2);
+
+       QString const reloutname =
+               toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
+
+       QString testname = reloutname;
+       testname.remove(QRegExp("^(\\.\\./)+"));
+       
+       if (testname.contains("/"))
+               return outname;
+       else
+               return reloutname;
+}
+
+
 
 /////////////////////////////////////////////////////////////////////
 //
@@ -365,7 +389,11 @@ PrefOutput::PrefOutput(GuiPreferences * form)
        : 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)),
@@ -377,15 +405,16 @@ PrefOutput::PrefOutput(GuiPreferences * form)
        connect(pdfCB, SIGNAL(editTextChanged(QString)),
                this, SIGNAL(changed()));
        dviCB->addItem("");
-       dviCB->addItem("xdvi -sourceposition $$n:$$t $$o");
-       dviCB->addItem("yap -1 -s $$n$$t $$o");
-       dviCB->addItem("okular --unique $$o#src:$$n$$t");
-       dviCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -p %{page+1} $$o\"");
+       dviCB->addItem("xdvi -sourceposition '$$n:\\ $$t' $$o");
+       dviCB->addItem("yap -1 -s \"$$n $$t\" $$o");
+       dviCB->addItem("okular --unique \"file:$$o#src:$$n $$t\"");
+       dviCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -i %{page+1} $$o\"");
        pdfCB->addItem("");
        pdfCB->addItem("CMCDDE SUMATRA control [ForwardSearch(\\\"$$o\\\",\\\"$$t\\\",$$n,0,0,1)]");
+       pdfCB->addItem("SumatraPDF -reuse-instance $$o -forward-search $$t $$n");
        pdfCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"xpdf -raise -remote $$t.tmp $$o %{page+1}\"");
-       pdfCB->addItem("okular --unique $$o#src:$$n$$t");
-       pdfCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -p %{page+1} $$o\"");
+       pdfCB->addItem("okular --unique \"file:$$o#src:$$n $$t\"");
+       pdfCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -i %{page+1} $$o\"");
        pdfCB->addItem("/Applications/Skim.app/Contents/SharedSupport/displayline $$n $$o $$t");
 }
 
@@ -603,6 +632,8 @@ PrefCompletion::PrefCompletion(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(cursorTextCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
+       connect(minlengthSB, SIGNAL(valueChanged(int)),
+                       this, SIGNAL(changed()));
 }
 
 
@@ -638,6 +669,7 @@ void PrefCompletion::apply(LyXRC & rc) const
        rc.completion_cursor_text = cursorTextCB->isChecked();
        rc.completion_popup_after_complete =
                popupAfterCompleteCB->isChecked();
+       rc.completion_minlength = minlengthSB->value();
 }
 
 
@@ -654,6 +686,7 @@ void PrefCompletion::update(LyXRC const & rc)
        cursorTextCB->setChecked(rc.completion_cursor_text);
        popupAfterCompleteCB->setChecked(rc.completion_popup_after_complete);
         enableCB();
+       minlengthSB->setValue(rc.completion_minlength);
 }
 
 
@@ -668,6 +701,16 @@ PrefLatex::PrefLatex(GuiPreferences * form)
        : 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)),
@@ -690,7 +733,7 @@ PrefLatex::PrefLatex(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(latexDviPaperED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
-       connect(latexPaperSizeCO, SIGNAL(activated(int)),
+       connect(latexNomenclED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
 
 #if defined(__CYGWIN__) || defined(_WIN32)
@@ -795,8 +838,6 @@ void PrefLatex::apply(LyXRC & rc) const
        rc.nomencl_command = fromqstr(latexNomenclED->text());
        rc.auto_reset_options = latexAutoresetCB->isChecked();
        rc.view_dvi_paper_option = fromqstr(latexDviPaperED->text());
-       rc.default_papersize =
-               form_->toPaperSize(latexPaperSizeCO->currentIndex());
 #if defined(__CYGWIN__) || defined(_WIN32)
        rc.windows_style_tex_paths = pathCB->isChecked();
 #endif
@@ -873,8 +914,6 @@ void PrefLatex::update(LyXRC const & rc)
        latexNomenclED->setText(toqstr(rc.nomencl_command));
        latexAutoresetCB->setChecked(rc.auto_reset_options);
        latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option));
-       latexPaperSizeCO->setCurrentIndex(
-               form_->fromPaperSize(rc.default_papersize));
 #if defined(__CYGWIN__) || defined(_WIN32)
        pathCB->setChecked(rc.windows_style_tex_paths);
 #endif
@@ -1003,6 +1042,18 @@ void PrefScreenFonts::update(LyXRC const & rc)
        selectTypewriter(screenTypewriterCO->currentText());
 
        screenZoomSB->setValue(rc.zoom);
+       updateScreenFontSizes(rc);
+
+       pixmapCacheCB->setChecked(rc.use_pixmap_cache);
+#if defined(Q_WS_X11)
+       pixmapCacheCB->setEnabled(false);
+#endif
+
+}
+
+
+void PrefScreenFonts::updateScreenFontSizes(LyXRC const & rc)
+{
        doubleToWidget(screenTinyED, rc.font_sizes[FONT_SIZE_TINY]);
        doubleToWidget(screenSmallestED, rc.font_sizes[FONT_SIZE_SCRIPT]);
        doubleToWidget(screenSmallerED, rc.font_sizes[FONT_SIZE_FOOTNOTE]);
@@ -1013,12 +1064,6 @@ void PrefScreenFonts::update(LyXRC const & rc)
        doubleToWidget(screenLargestED, rc.font_sizes[FONT_SIZE_LARGEST]);
        doubleToWidget(screenHugeED, rc.font_sizes[FONT_SIZE_HUGE]);
        doubleToWidget(screenHugerED, rc.font_sizes[FONT_SIZE_HUGER]);
-
-       pixmapCacheCB->setChecked(rc.use_pixmap_cache);
-#if defined(Q_WS_X11)
-       pixmapCacheCB->setEnabled(false);
-#endif
-
 }
 
 
@@ -1070,19 +1115,17 @@ PrefColors::PrefColors(GuiPreferences * form)
        for (int i = 0; i < Color_ignore; ++i) {
                ColorCode lc = static_cast<ColorCode>(i);
                if (lc == Color_none
-                       || lc == Color_black
-                       || lc == Color_white
-                       || lc == Color_red
-                       || lc == Color_green
-                       || lc == Color_blue
-                       || lc == Color_cyan
-                       || lc == Color_magenta
-                       || lc == Color_yellow
-                       || lc == Color_inherit
-                       || lc == Color_ignore
-                       || lc == Color_greyedouttext
-                       || lc == Color_shadedbg) continue;
-
+                   || lc == Color_black
+                   || lc == Color_white
+                   || lc == Color_red
+                   || lc == Color_green
+                   || lc == Color_blue
+                   || lc == Color_cyan
+                   || lc == Color_magenta
+                   || lc == Color_yellow
+                   || lc == Color_inherit
+                   || lc == Color_ignore)
+                       continue;
                lcolors_.push_back(lc);
        }
        sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
@@ -1190,28 +1233,34 @@ PrefDisplay::PrefDisplay(GuiPreferences * form)
        connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
        connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed()));
        connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
-       if (instantPreviewCO->currentIndex() == 0)
-               previewSizeSB->setEnabled(false);
-       else
-               previewSizeSB->setEnabled(true);
 }
 
 
 void PrefDisplay::on_instantPreviewCO_currentIndexChanged(int index)
 {
-       if (index == 0)
-               previewSizeSB->setEnabled(false);
-       else
-               previewSizeSB->setEnabled(true);
+       previewSizeSB->setEnabled(index != 0);
+}
+
+
+void PrefDisplay::on_displayGraphicsCB_toggled(bool on)
+{
+       instantPreviewCO->setEnabled(on);
+       previewSizeSB->setEnabled(on && instantPreviewCO->currentIndex() > 0);
 }
 
 
 void PrefDisplay::apply(LyXRC & rc) const
 {
        switch (instantPreviewCO->currentIndex()) {
-               case 0: rc.preview = LyXRC::PREVIEW_OFF; break;
-               case 1: rc.preview = LyXRC::PREVIEW_NO_MATH; break;
-               case 2: rc.preview = LyXRC::PREVIEW_ON; break;
+               case 0:
+                       rc.preview = LyXRC::PREVIEW_OFF;
+                       break;
+               case 1:
+                       rc.preview = LyXRC::PREVIEW_NO_MATH;
+                       break;
+               case 2:
+                       rc.preview = LyXRC::PREVIEW_ON;
+                       break;
        }
 
        rc.display_graphics = displayGraphicsCB->isChecked();
@@ -1246,6 +1295,9 @@ void PrefDisplay::update(LyXRC const & rc)
        instantPreviewCO->setEnabled(rc.display_graphics);
        previewSizeSB->setValue(rc.preview_scale_factor);
        paragraphMarkerCB->setChecked(rc.paragraph_markers);
+       previewSizeSB->setEnabled(
+               rc.display_graphics
+               && rc.preview != LyXRC::PREVIEW_OFF);
 }
 
 
@@ -1288,12 +1340,23 @@ PrefPaths::PrefPaths(GuiPreferences * form)
        connect(tempDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
 
+#if defined(USE_HUNSPELL)
        connect(hunspellDirPB, SIGNAL(clicked()), this, SLOT(selectHunspelldir()));
        connect(hunspellDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+#else
+       hunspellDirPB->setEnabled(false);
+       hunspellDirED->setEnabled(false);
+#endif
 
        connect(pathPrefixED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+
+       connect(texinputsPrefixED, SIGNAL(textChanged(QString)),
+               this, SIGNAL(changed()));
+
+       pathPrefixED->setValidator(new NoNewLineValidator(pathPrefixED));
+       texinputsPrefixED->setValidator(new NoNewLineValidator(texinputsPrefixED));
 }
 
 
@@ -1307,6 +1370,7 @@ void PrefPaths::apply(LyXRC & rc) const
        rc.thesaurusdir_path = internal_path(fromqstr(thesaurusDirED->text()));
        rc.hunspelldir_path = internal_path(fromqstr(hunspellDirED->text()));
        rc.path_prefix = internal_path_list(fromqstr(pathPrefixED->text()));
+       rc.texinputs_prefix = internal_path_list(fromqstr(texinputsPrefixED->text()));
        // FIXME: should be a checkbox only
        rc.lyxpipes = internal_path(fromqstr(lyxserverDirED->text()));
 }
@@ -1322,6 +1386,7 @@ void PrefPaths::update(LyXRC const & rc)
        thesaurusDirED->setText(toqstr(external_path(rc.thesaurusdir_path)));
        hunspellDirED->setText(toqstr(external_path(rc.hunspelldir_path)));
        pathPrefixED->setText(toqstr(external_path_list(rc.path_prefix)));
+       texinputsPrefixED->setText(toqstr(external_path_list(rc.texinputs_prefix)));
        // FIXME: should be a checkbox only
        lyxserverDirED->setText(toqstr(external_path(rc.lyxpipes)));
 }
@@ -1440,6 +1505,9 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
                        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);
@@ -1453,8 +1521,10 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
 
 void PrefSpellchecker::apply(LyXRC & rc) const
 {
-       rc.spellchecker = fromqstr(spellcheckerCB->itemData(
-                       spellcheckerCB->currentIndex()).toString());
+       string const speller = fromqstr(spellcheckerCB->
+               itemData(spellcheckerCB->currentIndex()).toString());
+       if (!speller.empty())
+               rc.spellchecker = speller;
        rc.spellchecker_alt_lang = fromqstr(altLanguageED->text());
        rc.spellchecker_esc_chars = fromqstr(escapeCharactersED->text());
        rc.spellchecker_accept_compound = compoundWordCB->isChecked();
@@ -1479,7 +1549,7 @@ void PrefSpellchecker::on_spellcheckerCB_currentIndexChanged(int index)
 {
        QString spellchecker = spellcheckerCB->itemData(index).toString();
        
-       compoundWordCB->setEnabled(spellchecker != QString("native"));
+       compoundWordCB->setEnabled(spellchecker == QString("aspell"));
 }
        
        
@@ -1521,6 +1591,8 @@ PrefConverters::PrefConverters(GuiPreferences * form)
        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);
 }
@@ -1801,13 +1873,21 @@ PrefFileformats::PrefFileformats(GuiPreferences * form)
        : PrefModule(qt_(catFiles), qt_("File Formats"), form)
 {
        setupUi(this);
+
        formatED->setValidator(new FormatNameValidator(formatsCB, form_->formats()));
        formatsCB->setValidator(new FormatPrettynameValidator(formatsCB, form_->formats()));
+       extensionsED->setValidator(new NoNewLineValidator(extensionsED));
+       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(vectorCB, SIGNAL(clicked()),
                this, SLOT(setFlags()));
+       connect(exportMenuCB, SIGNAL(clicked()),
+               this, SLOT(setFlags()));
        connect(formatsCB->lineEdit(), SIGNAL(editingFinished()),
                this, SLOT(updatePrettyname()));
        connect(formatsCB->lineEdit(), SIGNAL(textEdited(QString)),
@@ -1833,7 +1913,7 @@ string const l10n_shortcut(string const prettyname, string const shortcut)
        return split(l10n_format, '|');
 }
 
-}; // namespace anon
+} // namespace anon
 
 
 void PrefFileformats::apply(LyXRC & rc) const
@@ -1875,7 +1955,10 @@ void PrefFileformats::updateView()
                formatsCB->addItem(qt_(cit->prettyname()),
                                QVariant(form_->formats().getNumber(cit->name())));
                if (form_->converters().isReachable("latex", cit->name())
-                   || form_->converters().isReachable("pdflatex", cit->name()))
+                   || form_->converters().isReachable("dviluatex", cit->name())
+                   || form_->converters().isReachable("pdflatex", cit->name())
+                   || form_->converters().isReachable("luatex", cit->name())
+                   || form_->converters().isReachable("xetex", cit->name()))
                        defaultFormatCB->addItem(qt_(cit->prettyname()),
                                        QVariant(toqstr(cit->name())));
        }
@@ -1900,11 +1983,14 @@ void PrefFileformats::on_formatsCB_currentIndexChanged(int i)
 
        formatED->setText(toqstr(f.name()));
        copierED->setText(toqstr(form_->movers().command(f.name())));
-       extensionED->setText(toqstr(f.extension()));
+       extensionsED->setText(toqstr(f.extensions()));
+       mimeED->setText(toqstr(f.mime()));
        shortcutED->setText(
                toqstr(l10n_shortcut(f.prettyname(), f.shortcut())));
        documentCB->setChecked((f.documentFormat()));
        vectorCB->setChecked((f.vectorFormat()));
+       exportMenuCB->setChecked((f.inExportMenu()));
+       exportMenuCB->setEnabled((f.documentFormat()));
        updateViewers();
        updateEditors();
 }
@@ -1917,7 +2003,10 @@ void PrefFileformats::setFlags()
                flags |= Format::document;
        if (vectorCB->isChecked())
                flags |= Format::vector;
+       if (exportMenuCB->isChecked())
+               flags |= Format::export_menu;
        currentFormat().setFlags(flags);
+       exportMenuCB->setEnabled(documentCB->isChecked());
        changed();
 }
 
@@ -1930,12 +2019,13 @@ void PrefFileformats::on_copierED_textEdited(const QString & s)
 }
 
 
-void PrefFileformats::on_extensionED_textEdited(const QString & s)
+void PrefFileformats::on_extensionsED_textEdited(const QString & s)
 {
-       currentFormat().setExtension(fromqstr(s));
+       currentFormat().setExtensions(fromqstr(s));
        changed();
 }
 
+
 void PrefFileformats::on_viewerED_textEdited(const QString & s)
 {
        currentFormat().setViewer(fromqstr(s));
@@ -1950,6 +2040,13 @@ void PrefFileformats::on_editorED_textEdited(const QString & s)
 }
 
 
+void PrefFileformats::on_mimeED_textEdited(const QString & s)
+{
+       currentFormat().setMime(fromqstr(s));
+       changed();
+}
+
+
 void PrefFileformats::on_shortcutED_textEdited(const QString & s)
 {
        string const new_shortcut = fromqstr(s);
@@ -2107,7 +2204,7 @@ Format & PrefFileformats::currentFormat()
 
 void PrefFileformats::on_formatNewPB_clicked()
 {
-       form_->formats().add("", "", "", "", "", "", Format::none);
+       form_->formats().add("", "", "", "", "", "", "", Format::none);
        updateView();
        formatsCB->setCurrentIndex(0);
        formatsCB->setFocus(Qt::OtherFocusReason);
@@ -2171,19 +2268,38 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(defaultDecimalPointLE, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+       connect(defaultLengthUnitCO, SIGNAL(activated(int)),
+               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();
        // FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
        language_model->sort(0);
+       defaultDecimalPointLE->setInputMask("X; ");
+       defaultDecimalPointLE->setMaxLength(1);
+
+       defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM);
+       defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::IN]), Length::IN);
 
-       // FIXME: This is wrong, we need filter this list based on the available
-       // translation.
+       set<string> added;
        uiLanguageCO->blockSignals(true);
        uiLanguageCO->addItem(qt_("Default"), toqstr("auto"));
        for (int i = 0; i != language_model->rowCount(); ++i) {
                QModelIndex index = language_model->index(i, 0);
+               // Filter the list based on the available translation and add
+               // each language code only once
+               string const name = fromqstr(index.data(Qt::UserRole).toString());
+               Language const * lang = languages.getLanguage(name);
+               // never remove the currently selected language
+               if (lang && name != form->rc().gui_language && name != lyxrc.gui_language)
+                       if (!lang->translated() || added.find(lang->code()) != added.end())
+                               continue;
+               added.insert(lang->code());
                uiLanguageCO->addItem(index.data(Qt::DisplayRole).toString(),
                        index.data(Qt::UserRole).toString());
        }
@@ -2229,6 +2345,7 @@ void PrefLanguage::apply(LyXRC & rc) const
        rc.gui_language = fromqstr(
                uiLanguageCO->itemData(uiLanguageCO->currentIndex()).toString());
        rc.default_decimal_point = fromqstr(defaultDecimalPointLE->text());
+       rc.default_length_unit = (Length::UNIT) defaultLengthUnitCO->itemData(defaultLengthUnitCO->currentIndex()).toInt();
 }
 
 
@@ -2250,8 +2367,10 @@ void PrefLanguage::update(LyXRC const & rc)
        startCommandED->setText(toqstr(rc.language_command_begin));
        endCommandED->setText(toqstr(rc.language_command_end));
        defaultDecimalPointLE->setText(toqstr(rc.default_decimal_point));
+       int pos = defaultLengthUnitCO->findData(int(rc.default_length_unit));
+       defaultLengthUnitCO->setCurrentIndex(pos);
 
-       int pos = uiLanguageCO->findData(toqstr(rc.gui_language));
+       pos = uiLanguageCO->findData(toqstr(rc.gui_language));
        uiLanguageCO->blockSignals(true);
        uiLanguageCO->setCurrentIndex(pos);
        uiLanguageCO->blockSignals(false);
@@ -2305,6 +2424,24 @@ PrefPrinter::PrefPrinter(GuiPreferences * form)
                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));
 }
 
 
@@ -2384,6 +2521,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
                this, SLOT(selectUi()));
        connect(uiFileED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+       connect(iconSetCO, SIGNAL(activated(int)),
+               this, SIGNAL(changed()));
        connect(restoreCursorCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
        connect(loadSessionCB, SIGNAL(clicked()),
@@ -2403,11 +2542,18 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
        connect(tooltipCB, SIGNAL(toggled(bool)),
                this, SIGNAL(changed()));
        lastfilesSB->setMaximum(maxlastfiles);
+
+       iconSetCO->addItem(qt_("Default"), QString());
+       iconSetCO->addItem(qt_("Classic"), "classic");
+       iconSetCO->addItem(qt_("Oxygen"), "oxygen");
 }
 
 
 void PrefUserInterface::apply(LyXRC & rc) const
 {
+       rc.icon_set = fromqstr(iconSetCO->itemData(
+               iconSetCO->currentIndex()).toString());
+
        rc.ui_file = internal_path(fromqstr(uiFileED->text()));
        rc.use_lastfilepos = restoreCursorCB->isChecked();
        rc.load_session = loadSessionCB->isChecked();
@@ -2428,6 +2574,10 @@ void PrefUserInterface::apply(LyXRC & rc) const
 
 void PrefUserInterface::update(LyXRC const & rc)
 {
+       int iconset = iconSetCO->findData(toqstr(rc.icon_set));
+       if (iconset < 0)
+               iconset = 0;
+       iconSetCO->setCurrentIndex(iconset);
        uiFileED->setText(toqstr(external_path(rc.ui_file)));
        restoreCursorCB->setChecked(rc.use_lastfilepos);
        loadSessionCB->setChecked(rc.load_session);
@@ -2445,7 +2595,8 @@ void PrefUserInterface::update(LyXRC const & rc)
        lastfilesSB->setValue(rc.num_lastfiles);
        tooltipCB->setChecked(rc.use_tooltip);
        openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs);
-       singleInstanceCB->setChecked(rc.single_instance);
+       singleInstanceCB->setChecked(rc.single_instance && !rc.lyxpipes.empty());
+       singleInstanceCB->setEnabled(!rc.lyxpipes.empty());
        singleCloseTabButtonCB->setChecked(rc.single_close_tab_button);
 }
 
@@ -2480,12 +2631,16 @@ PrefEdit::PrefEdit(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(scrollBelowCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
+       connect(macLikeWordMovementCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
        connect(sortEnvironmentsCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
        connect(groupEnvironmentsCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
        connect(macroEditStyleCO, SIGNAL(activated(int)),
                this, SIGNAL(changed()));
+       connect(cursorWidthSB, SIGNAL(valueChanged(int)),
+               this, SIGNAL(changed()));
        connect(fullscreenLimitGB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
        connect(fullscreenWidthSB, SIGNAL(valueChanged(int)),
@@ -2505,6 +2660,7 @@ void PrefEdit::apply(LyXRC & rc) const
 {
        rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
        rc.scroll_below_document = scrollBelowCB->isChecked();
+       rc.mac_like_word_movement = macLikeWordMovementCB->isChecked();
        rc.sort_layouts = sortEnvironmentsCB->isChecked();
        rc.group_layouts = groupEnvironmentsCB->isChecked();
        switch (macroEditStyleCO->currentIndex()) {
@@ -2512,6 +2668,7 @@ void PrefEdit::apply(LyXRC & rc) const
                case 1: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE; break;
                case 2: rc.macro_edit_style = LyXRC::MACRO_EDIT_LIST;   break;
        }
+       rc.cursor_width = cursorWidthSB->value();
        rc.full_screen_toolbars = toggleToolbarsCB->isChecked();
        rc.full_screen_scrollbar = toggleScrollbarCB->isChecked();
        rc.full_screen_tabbar = toggleTabbarCB->isChecked();
@@ -2525,9 +2682,11 @@ void PrefEdit::update(LyXRC const & rc)
 {
        cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
        scrollBelowCB->setChecked(rc.scroll_below_document);
+       macLikeWordMovementCB->setChecked(rc.mac_like_word_movement);
        sortEnvironmentsCB->setChecked(rc.sort_layouts);
        groupEnvironmentsCB->setChecked(rc.group_layouts);
        macroEditStyleCO->setCurrentIndex(rc.macro_edit_style);
+       cursorWidthSB->setValue(rc.cursor_width);
        toggleScrollbarCB->setChecked(rc.full_screen_scrollbar);
        toggleToolbarsCB->setChecked(rc.full_screen_toolbars);
        toggleTabbarCB->setChecked(rc.full_screen_tabbar);
@@ -3023,6 +3182,9 @@ PrefIdentity::PrefIdentity(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(emailED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+
+       nameED->setValidator(new NoNewLineValidator(nameED));
+       emailED->setValidator(new NoNewLineValidator(emailED));
 }
 
 
@@ -3062,7 +3224,10 @@ GuiPreferences::GuiPreferences(GuiView & lv)
        addModule(new PrefUserInterface(this));
        addModule(new PrefEdit(this));
        addModule(new PrefShortcuts(this));
-       addModule(new PrefScreenFonts(this));
+       PrefScreenFonts * screenfonts = new PrefScreenFonts(this);
+       connect(this, SIGNAL(prefsApplied(LyXRC const &)),
+                       screenfonts, SLOT(updateScreenFontSizes(LyXRC const &)));
+       addModule(screenfonts);
        addModule(new PrefColors(this));
        addModule(new PrefDisplay(this));
        addModule(new PrefInput(this));
@@ -3170,6 +3335,9 @@ void GuiPreferences::dispatchParams()
        ostringstream ss;
        rc_.write(ss, true);
        dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
+       // issue prefsApplied signal. This will update the
+       // localized screen font sizes.
+       prefsApplied(rc_);
        // FIXME: these need lfuns
        // FIXME UNICODE
        Author const & author = 
@@ -3241,60 +3409,6 @@ QString GuiPreferences::browse(QString const & file,
 }
 
 
-// We support less paper sizes than the document dialog
-// Therefore this adjustment is needed.
-PAPER_SIZE GuiPreferences::toPaperSize(int i) const
-{
-       switch (i) {
-       case 0:
-               return PAPER_DEFAULT;
-       case 1:
-               return PAPER_USLETTER;
-       case 2:
-               return PAPER_USLEGAL;
-       case 3:
-               return PAPER_USEXECUTIVE;
-       case 4:
-               return PAPER_A3;
-       case 5:
-               return PAPER_A4;
-       case 6:
-               return PAPER_A5;
-       case 7:
-               return PAPER_B5;
-       default:
-               // should not happen
-               return PAPER_DEFAULT;
-       }
-}
-
-
-int GuiPreferences::fromPaperSize(PAPER_SIZE papersize) const
-{
-       switch (papersize) {
-       case PAPER_DEFAULT:
-               return 0;
-       case PAPER_USLETTER:
-               return 1;
-       case PAPER_USLEGAL:
-               return 2;
-       case PAPER_USEXECUTIVE:
-               return 3;
-       case PAPER_A3:
-               return 4;
-       case PAPER_A4:
-               return 5;
-       case PAPER_A5:
-               return 6;
-       case PAPER_B5:
-               return 7;
-       default:
-               // should not happen
-               return 0;
-       }
-}
-
-
 Dialog * createGuiPreferences(GuiView & lv) { return new GuiPreferences(lv); }