]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiPrefs.cpp
add support for decimal alignment in tables
[features.git] / src / frontends / qt4 / GuiPrefs.cpp
index d1ea7437514d2fcdb55f15e2ece03f26fb9985d9..d8f1504b4fa5b1feeaf3ebd7eb59c3e23fc69246 100644 (file)
@@ -31,6 +31,7 @@
 #include "KeySequence.h"
 #include "Language.h"
 #include "LyXAction.h"
+#include "LyX.h"
 #include "PanelStack.h"
 #include "paper.h"
 #include "Session.h"
@@ -114,9 +115,9 @@ QString browseFile(QString const & filename,
        FileDialog::Result result;
 
        if (save)
-               result = dlg.save(lastPath, filters, onlyFilename(filename));
+               result = dlg.save(lastPath, filters, onlyFileName(filename));
        else
-               result = dlg.open(lastPath, filters, onlyFilename(filename));
+               result = dlg.open(lastPath, filters, onlyFileName(filename));
 
        return result.second;
 }
@@ -136,14 +137,14 @@ QString browseLibFile(QString const & dir,
        // FIXME UNICODE
        QString const label1 = qt_("System files|#S#s");
        QString const dir1 =
-               toqstr(addName(package().system_support().absFilename(), fromqstr(dir)));
+               toqstr(addName(package().system_support().absFileName(), fromqstr(dir)));
 
        QString const label2 = qt_("User files|#U#u");
        QString const dir2 =
-               toqstr(addName(package().user_support().absFilename(), fromqstr(dir)));
+               toqstr(addName(package().user_support().absFileName(), fromqstr(dir)));
 
        QString const result = browseFile(toqstr(
-               libFileSearch(dir, name, ext).absFilename()),
+               libFileSearch(dir, name, ext).absFileName()),
                title, filters, false, dir1, dir2, QString(), QString(), dir1);
 
        // remove the extension if it is the default one
@@ -154,8 +155,8 @@ QString browseLibFile(QString const & dir,
                noextresult = result;
 
        // remove the directory, if it is the default one
-       QString const file = onlyFilename(noextresult);
-       if (toqstr(libFileSearch(dir, file, ext).absFilename()) == result)
+       QString const file = onlyFileName(noextresult);
+       if (toqstr(libFileSearch(dir, file, ext).absFileName()) == result)
                return file;
        else
                return noextresult;
@@ -183,7 +184,7 @@ QString browseDir(QString const & pathname,
        dlg.setButton2(label2, dir2);
 
        FileDialog::Result const result =
-               dlg.opendir(lastPath, onlyFilename(pathname));
+               dlg.opendir(lastPath, onlyFileName(pathname));
 
        return result.second;
 }
@@ -324,34 +325,6 @@ static void setComboxFont(QComboBox * cb, string const & family,
 }
 
 
-
-/////////////////////////////////////////////////////////////////////
-//
-// PrefPlaintext
-//
-/////////////////////////////////////////////////////////////////////
-
-PrefPlaintext::PrefPlaintext(GuiPreferences * form)
-       : PrefModule(qt_(catOutput), qt_("Plain text"), form)
-{
-       setupUi(this);
-       connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
-               this, SIGNAL(changed()));
-}
-
-
-void PrefPlaintext::apply(LyXRC & rc) const
-{
-       rc.plaintext_linelen = plaintextLinelengthSB->value();
-}
-
-
-void PrefPlaintext::update(LyXRC const & rc)
-{
-       plaintextLinelengthSB->setValue(rc.plaintext_linelen);
-}
-
-
 /////////////////////////////////////////////////////////////////////
 //
 // StrftimeValidator
@@ -383,21 +356,40 @@ QValidator::State StrftimeValidator::validate(QString & input, int & /*pos*/) co
 
 /////////////////////////////////////////////////////////////////////
 //
-// PrefDate
+// PrefOutput
 //
 /////////////////////////////////////////////////////////////////////
 
-PrefDate::PrefDate(GuiPreferences * form)
-       : PrefModule(qt_(catOutput), qt_("Date format"), form)
+PrefOutput::PrefOutput(GuiPreferences * form)
+       : PrefModule(qt_(catOutput), qt_("General"), form)
 {
        setupUi(this);
        DateED->setValidator(new StrftimeValidator(DateED));
        connect(DateED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+       connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
+               this, SIGNAL(changed()));
+       connect(overwriteCO, SIGNAL(activated(int)),
+               this, SIGNAL(changed()));
+       connect(dviCB, SIGNAL(editTextChanged(QString)),
+               this, SIGNAL(changed()));
+       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\"");
+       pdfCB->addItem("");
+       pdfCB->addItem("CMCDDE SUMATRA control [ForwardSearch(\\\"$$o\\\",\\\"$$t\\\",$$n,0,0,1)]");
+       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("/Applications/Skim.app/Contents/SharedSupport/displayline $$n $$o $$t");
 }
 
 
-void PrefDate::on_DateED_textChanged(const QString &)
+void PrefOutput::on_DateED_textChanged(const QString &)
 {
        QString t = DateED->text();
        int p = 0;
@@ -407,15 +399,45 @@ void PrefDate::on_DateED_textChanged(const QString &)
 }
 
 
-void PrefDate::apply(LyXRC & rc) const
+void PrefOutput::apply(LyXRC & rc) const
 {
        rc.date_insert_format = fromqstr(DateED->text());
+       rc.plaintext_linelen = plaintextLinelengthSB->value();
+       rc.forward_search_dvi = fromqstr(dviCB->currentText());
+       rc.forward_search_pdf = fromqstr(pdfCB->currentText());
+
+       switch (overwriteCO->currentIndex()) {
+       case 0:
+               rc.export_overwrite = NO_FILES;
+               break;
+       case 1:
+               rc.export_overwrite = MAIN_FILE;
+               break;
+       case 2:
+               rc.export_overwrite = ALL_FILES;
+               break;
+       }
 }
 
 
-void PrefDate::update(LyXRC const & rc)
+void PrefOutput::update(LyXRC const & rc)
 {
        DateED->setText(toqstr(rc.date_insert_format));
+       plaintextLinelengthSB->setValue(rc.plaintext_linelen);
+       dviCB->setEditText(toqstr(rc.forward_search_dvi));
+       pdfCB->setEditText(toqstr(rc.forward_search_pdf));
+
+       switch (rc.export_overwrite) {
+       case NO_FILES:
+               overwriteCO->setCurrentIndex(0);
+               break;
+       case MAIN_FILE:
+               overwriteCO->setCurrentIndex(1);
+               break;
+       case ALL_FILES:
+               overwriteCO->setCurrentIndex(2);
+               break;
+       }
 }
 
 
@@ -590,6 +612,8 @@ PrefLatex::PrefLatex(GuiPreferences * form)
        : PrefModule(qt_(catOutput), qt_("LaTeX"), form)
 {
        setupUi(this);
+       connect(latexEncodingCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
        connect(latexEncodingED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
        connect(latexChecktexED, SIGNAL(textChanged(QString)),
@@ -623,6 +647,12 @@ PrefLatex::PrefLatex(GuiPreferences * form)
 }
 
 
+void PrefLatex::on_latexEncodingCB_stateChanged(int state)
+{
+       latexEncodingED->setEnabled(state == Qt::Checked);
+}
+
+
 void PrefLatex::on_latexBibtexCO_activated(int n)
 {
        QString const bibtex = latexBibtexCO->itemData(n).toString();
@@ -699,7 +729,10 @@ void PrefLatex::apply(LyXRC & rc) const
        else
                rc.index_command = fromqstr(index) + " " + fromqstr(idxopt);
 
-       rc.fontenc = fromqstr(latexEncodingED->text());
+       if (latexEncodingCB->isChecked())
+               rc.fontenc = fromqstr(latexEncodingED->text());
+       else
+               rc.fontenc = "default";
        rc.chktex_command = fromqstr(latexChecktexED->text());
        rc.jbibtex_command = fromqstr(latexJBibtexED->text());
        rc.jindex_command = fromqstr(latexJIndexED->text());
@@ -770,7 +803,14 @@ void PrefLatex::update(LyXRC const & rc)
                latexIndexOptionsLA->setText(qt_("Co&mmand:"));
        }
 
-       latexEncodingED->setText(toqstr(rc.fontenc));
+       if (rc.fontenc == "default") {
+               latexEncodingCB->setChecked(false);
+               latexEncodingED->setEnabled(false);
+       } else {
+               latexEncodingCB->setChecked(true);
+               latexEncodingED->setEnabled(true);
+               latexEncodingED->setText(toqstr(rc.fontenc));
+       }
        latexChecktexED->setText(toqstr(rc.chktex_command));
        latexJBibtexED->setText(toqstr(rc.jbibtex_command));
        latexJIndexED->setText(toqstr(rc.jindex_command));
@@ -987,7 +1027,9 @@ PrefColors::PrefColors(GuiPreferences * form)
                        || lc == Color_magenta
                        || lc == Color_yellow
                        || lc == Color_inherit
-                       || lc == Color_ignore) continue;
+                       || lc == Color_ignore
+                       || lc == Color_greyedouttext
+                       || lc == Color_shadedbg) continue;
 
                lcolors_.push_back(lc);
        }
@@ -995,7 +1037,7 @@ PrefColors::PrefColors(GuiPreferences * form)
        vector<ColorCode>::const_iterator cit = lcolors_.begin();
        vector<ColorCode>::const_iterator const end = lcolors_.end();
        for (; cit != end; ++cit) {
-                       (void) new QListWidgetItem(QIcon(icon),
+               (void) new QListWidgetItem(QIcon(icon),
                        toqstr(lcolor.getGUIName(*cit)), lyxObjectsLW);
        }
        curcolors_.resize(lcolors_.size());
@@ -1142,28 +1184,39 @@ PrefPaths::PrefPaths(GuiPreferences * form)
        : PrefModule(QString(), qt_("Paths"), form)
 {
        setupUi(this);
-       connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(selectExampledir()));
-       connect(templateDirPB, SIGNAL(clicked()), this, SLOT(selectTemplatedir()));
-       connect(tempDirPB, SIGNAL(clicked()), this, SLOT(selectTempdir()));
-       connect(backupDirPB, SIGNAL(clicked()), this, SLOT(selectBackupdir()));
+
        connect(workingDirPB, SIGNAL(clicked()), this, SLOT(selectWorkingdir()));
-       connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(selectLyxPipe()));
-       connect(thesaurusDirPB, SIGNAL(clicked()), this, SLOT(selectThesaurusdir()));
-       connect(hunspellDirPB, SIGNAL(clicked()), this, SLOT(selectHunspelldir()));
        connect(workingDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
-       connect(exampleDirED, SIGNAL(textChanged(QString)),
-               this, SIGNAL(changed()));
+
+       connect(templateDirPB, SIGNAL(clicked()), this, SLOT(selectTemplatedir()));
        connect(templateDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
-       connect(backupDirED, SIGNAL(textChanged(QString)),
+
+       connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(selectExampledir()));
+       connect(exampleDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
-       connect(tempDirED, SIGNAL(textChanged(QString)),
+
+       connect(backupDirPB, SIGNAL(clicked()), this, SLOT(selectBackupdir()));
+       connect(backupDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+
+       connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(selectLyxPipe()));
        connect(lyxserverDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+
+       connect(thesaurusDirPB, SIGNAL(clicked()), this, SLOT(selectThesaurusdir()));
        connect(thesaurusDirED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+
+       connect(tempDirPB, SIGNAL(clicked()), this, SLOT(selectTempdir()));
+       connect(tempDirED, SIGNAL(textChanged(QString)),
+               this, SIGNAL(changed()));
+
+       connect(hunspellDirPB, SIGNAL(clicked()), this, SLOT(selectHunspelldir()));
+       connect(hunspellDirED, SIGNAL(textChanged(QString)),
+               this, SIGNAL(changed()));
+
        connect(pathPrefixED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
 }
@@ -1282,40 +1335,61 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
 {
        setupUi(this);
 
-       spellcheckerCB->addItem("aspell");
-       spellcheckerCB->addItem("hunspell");
+#if defined(USE_ASPELL)
+       spellcheckerCB->addItem(qt_("aspell"), QString("aspell"));
+#endif
+#if defined(USE_ENCHANT)
+       spellcheckerCB->addItem(qt_("enchant"), QString("enchant"));
+#endif
+#if defined(USE_HUNSPELL)
+       spellcheckerCB->addItem(qt_("hunspell"), QString("hunspell"));
+#endif
 
-       connect(spellcheckerCB, SIGNAL(currentIndexChanged(int)),
-               this, SIGNAL(changed()));
-       connect(altLanguageED, SIGNAL(textChanged(QString)),
-               this, SIGNAL(changed()));
-       connect(escapeCharactersED, SIGNAL(textChanged(QString)),
-               this, SIGNAL(changed()));
-       connect(compoundWordCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
-       connect(spellcheckContinuouslyCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
+       #if defined(USE_ASPELL) || defined(USE_ENCHANT) || defined(USE_HUNSPELL)
+               connect(spellcheckerCB, SIGNAL(currentIndexChanged(int)),
+                       this, SIGNAL(changed()));
+               connect(altLanguageED, SIGNAL(textChanged(QString)),
+                       this, SIGNAL(changed()));
+               connect(escapeCharactersED, SIGNAL(textChanged(QString)),
+                       this, SIGNAL(changed()));
+               connect(compoundWordCB, SIGNAL(clicked()),
+                       this, SIGNAL(changed()));
+               connect(spellcheckContinuouslyCB, SIGNAL(clicked()),
+                       this, SIGNAL(changed()));
+               connect(spellcheckNotesCB, SIGNAL(clicked()),
+                       this, SIGNAL(changed()));
+       #else
+               spellcheckerCB->setEnabled(false);
+               altLanguageED->setEnabled(false);
+               escapeCharactersED->setEnabled(false);
+               compoundWordCB->setEnabled(false);
+               spellcheckContinuouslyCB->setEnabled(false);
+               spellcheckNotesCB->setEnabled(false);
+       #endif
 }
 
 
 void PrefSpellchecker::apply(LyXRC & rc) const
 {
-       rc.spellchecker = fromqstr(spellcheckerCB->currentText());
+       rc.spellchecker = fromqstr(spellcheckerCB->itemData(
+                       spellcheckerCB->currentIndex()).toString());
        rc.spellchecker_alt_lang = fromqstr(altLanguageED->text());
        rc.spellchecker_esc_chars = fromqstr(escapeCharactersED->text());
        rc.spellchecker_accept_compound = compoundWordCB->isChecked();
        rc.spellcheck_continuously = spellcheckContinuouslyCB->isChecked();
+       rc.spellcheck_notes = spellcheckNotesCB->isChecked();
 }
 
 
 void PrefSpellchecker::update(LyXRC const & rc)
 {
-       spellcheckerCB->setCurrentIndex(spellcheckerCB->findText(
-               toqstr(rc.spellchecker)));
+       spellcheckerCB->setCurrentIndex(
+               spellcheckerCB->findData(toqstr(rc.spellchecker)));
        altLanguageED->setText(toqstr(rc.spellchecker_alt_lang));
        escapeCharactersED->setText(toqstr(rc.spellchecker_esc_chars));
        compoundWordCB->setChecked(rc.spellchecker_accept_compound);
        spellcheckContinuouslyCB->setChecked(rc.spellcheck_continuously);
+       spellcheckNotesCB->setChecked(rc.spellcheck_notes);
 }
 
 
@@ -1449,6 +1523,8 @@ void PrefConverters::changeConverter()
 
 void PrefConverters::updateButtons()
 {
+       if (form_->formats().size() == 0)
+               return;
        Format const & from = form_->formats().get(converterFromCO->currentIndex());
        Format const & to = form_->formats().get(converterToCO->currentIndex());
        int const sel = form_->converters().getNumber(from.name(), to.name());
@@ -1685,8 +1761,8 @@ void PrefFileformats::update(LyXRC const & rc)
        bool const init = defaultFormatCB->currentText().isEmpty();
        updateView();
        if (init) {
-               int const pos = defaultFormatCB->findData(toqstr(
-               rc.default_view_format));
+               int const pos =
+                       defaultFormatCB->findData(toqstr(rc.default_view_format));
                defaultFormatCB->setCurrentIndex(pos);
        }
 }
@@ -1727,6 +1803,8 @@ void PrefFileformats::updateView()
 
 void PrefFileformats::on_formatsCB_currentIndexChanged(int i)
 {
+       if (form_->formats().size() == 0)
+               return;
        int const nr = formatsCB->itemData(i).toInt();
        Format const f = form_->formats().get(nr);
 
@@ -1859,10 +1937,12 @@ namespace {
 void PrefFileformats::updateViewers()
 {
        Format const f = currentFormat();
+       viewerCO->blockSignals(true);
        viewerCO->clear();
        viewerCO->addItem(qt_("None"), QString());
        updateComboBox(viewer_alternatives, f.name(), viewerCO);
        viewerCO->addItem(qt_("Custom"), QString("custom viewer"));
+       viewerCO->blockSignals(false);
 
        int pos = viewerCO->findData(toqstr(f.viewer()));
        if (pos != -1) {
@@ -1880,10 +1960,12 @@ void PrefFileformats::updateViewers()
 void PrefFileformats::updateEditors()
 {
        Format const f = currentFormat();
+       editorCO->blockSignals(true);
        editorCO->clear();
        editorCO->addItem(qt_("None"), QString());
        updateComboBox(editor_alternatives, f.name(), editorCO);
        editorCO->addItem(qt_("Custom"), QString("custom editor"));
+       editorCO->blockSignals(false);
 
        int pos = editorCO->findData(toqstr(f.editor()));
        if (pos != -1) {
@@ -1892,7 +1974,7 @@ void PrefFileformats::updateEditors()
                editorCO->setCurrentIndex(pos);
        } else {
                editorED->setEnabled(true);
-               editorED->setText(toqstr(f.viewer()));
+               editorED->setText(toqstr(f.editor()));
                editorCO->setCurrentIndex(editorCO->findData(toqstr("custom editor")));
        }
 }
@@ -1909,10 +1991,10 @@ void PrefFileformats::on_viewerCO_currentIndexChanged(int i)
 
 void PrefFileformats::on_editorCO_currentIndexChanged(int i)
 {
-       bool const custom = editorCO->itemData(i).toString() == "custom viewer";
+       bool const custom = editorCO->itemData(i).toString() == "custom editor";
        editorED->setEnabled(custom);
        if (!custom)
-               currentFormat().setViewer(fromqstr(editorCO->itemData(i).toString()));
+               currentFormat().setEditor(fromqstr(editorCO->itemData(i).toString()));
 }
 
 
@@ -1988,6 +2070,8 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(uiLanguageCO, SIGNAL(activated(int)),
                this, SIGNAL(changed()));
+       connect(defaultDecimalPointLE, SIGNAL(textChanged(QString)),
+               this, SIGNAL(changed()));
 
        uiLanguageCO->clear();
 
@@ -2031,6 +2115,7 @@ void PrefLanguage::apply(LyXRC & rc) const
        rc.language_command_end = fromqstr(endCommandED->text());
        rc.gui_language = fromqstr(
                uiLanguageCO->itemData(uiLanguageCO->currentIndex()).toString());
+       rc.default_decimal_point = fromqstr(defaultDecimalPointLE->text());
 }
 
 
@@ -2050,6 +2135,7 @@ void PrefLanguage::update(LyXRC const & rc)
        languagePackageED->setText(toqstr(rc.language_package));
        startCommandED->setText(toqstr(rc.language_command_begin));
        endCommandED->setText(toqstr(rc.language_command_end));
+       defaultDecimalPointLE->setText(toqstr(rc.default_decimal_point));
 
        int pos = uiLanguageCO->findData(toqstr(rc.gui_language));
        uiLanguageCO->blockSignals(true);
@@ -2194,6 +2280,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(backupCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
+       connect(saveCompressedCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
        connect(lastfilesSB, SIGNAL(valueChanged(int)),
                this, SIGNAL(changed()));
        connect(tooltipCB, SIGNAL(toggled(bool)),
@@ -2208,8 +2296,9 @@ void PrefUserInterface::apply(LyXRC & rc) const
        rc.use_lastfilepos = restoreCursorCB->isChecked();
        rc.load_session = loadSessionCB->isChecked();
        rc.allow_geometry_session = allowGeometrySessionCB->isChecked();
-       rc.autosave = autoSaveCB->isChecked()?  autoSaveSB->value() * 60 : 0;
+       rc.autosave = autoSaveCB->isChecked() ?  autoSaveSB->value() * 60 : 0;
        rc.make_backup = backupCB->isChecked();
+       rc.save_compressed = saveCompressedCB->isChecked();
        rc.num_lastfiles = lastfilesSB->value();
        rc.use_tooltip = tooltipCB->isChecked();
        rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked();
@@ -2235,6 +2324,7 @@ void PrefUserInterface::update(LyXRC const & rc)
        autoSaveCB->setChecked(autosave);
        autoSaveSB->setEnabled(autosave);
        backupCB->setChecked(rc.make_backup);
+       saveCompressedCB->setChecked(rc.save_compressed);
        lastfilesSB->setValue(rc.num_lastfiles);
        tooltipCB->setChecked(rc.use_tooltip);
        openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs);
@@ -2359,8 +2449,6 @@ PrefShortcuts::PrefShortcuts(GuiPreferences * form)
                this, SLOT(selectBind()));
        connect(bindFileED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
-       connect(removePB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
 
        shortcut_ = new GuiShortcutDialog(this);
        shortcut_bc_.setPolicy(ButtonPolicy::OkCancelPolicy);
@@ -2388,7 +2476,7 @@ void PrefShortcuts::apply(LyXRC & rc) const
 {
        rc.bind_file = internal_path(fromqstr(bindFileED->text()));
        // write user_bind and user_unbind to .lyx/bind/user.bind
-       FileName bind_dir(addPath(package().user_support().absFilename(), "bind"));
+       FileName bind_dir(addPath(package().user_support().absFileName(), "bind"));
        if (!bind_dir.exists() && !bind_dir.createDirectory(0777)) {
                lyxerr << "LyX could not create the user bind directory '"
                       << bind_dir << "'. All user-defined key bindings will be lost." << endl;
@@ -2399,7 +2487,7 @@ void PrefShortcuts::apply(LyXRC & rc) const
                       << bind_dir << "'. All user-defined key bindings will be lost." << endl;
                return;
        }
-       FileName user_bind_file(bind_dir.absFilename() + "/user.bind");
+       FileName user_bind_file(bind_dir.absFileName() + "/user.bind");
        user_unbind_.write(user_bind_file.toFilesystemEncoding(), false, true);
        user_bind_.write(user_bind_file.toFilesystemEncoding(), true, false);
        // immediately apply the keybindings. Why this is not done before?
@@ -2504,7 +2592,7 @@ void PrefShortcuts::setItemType(QTreeWidgetItem * item, KeyMap::ItemType tag)
 QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun,
                KeySequence const & seq, KeyMap::ItemType tag)
 {
-       FuncCode action = lfun.action;
+       FuncCode const action = lfun.action();
        string const action_name = lyxaction.getActionName(action);
        QString const lfun_name = toqstr(from_utf8(action_name)
                        + ' ' + lfun.argument());
@@ -2591,7 +2679,7 @@ void PrefShortcuts::modifyShortcut()
        QTreeWidgetItem * item = shortcutsTW->currentItem();
        if (item->flags() & Qt::ItemIsSelectable) {
                shortcut_->lfunLE->setText(item->text(0));
-               save_lfun_ = item->text(0);
+               save_lfun_ = item->text(0).trimmed();
                shortcut_->shortcutWG->setText(item->text(1));
                KeySequence seq;
                seq.parse(fromqstr(item->data(1, Qt::UserRole).toString()));
@@ -2684,6 +2772,7 @@ void PrefShortcuts::on_newPB_pressed()
 
 void PrefShortcuts::on_removePB_pressed()
 {
+       changed();
        removeShortcut();
 }
 
@@ -2717,7 +2806,7 @@ void PrefShortcuts::on_searchLE_textEdited()
 
 docstring makeCmdString(FuncRequest const & f)
 {
-       docstring actionStr = from_ascii(lyxaction.getActionName(f.action));
+       docstring actionStr = from_ascii(lyxaction.getActionName(f.action()));
        if (!f.argument().empty())
                actionStr += " " + f.argument();
        return actionStr;
@@ -2729,7 +2818,7 @@ void PrefShortcuts::shortcutOkPressed()
        QString const new_lfun = shortcut_->lfunLE->text();
        FuncRequest func = lyxaction.lookupFunc(fromqstr(new_lfun));
 
-       if (func.action == LFUN_UNKNOWN_ACTION) {
+       if (func.action() == LFUN_UNKNOWN_ACTION) {
                Alert::error(_("Failed to create shortcut"),
                        _("Unknown or invalid LyX function"));
                return;
@@ -2744,31 +2833,27 @@ void PrefShortcuts::shortcutOkPressed()
 
        // check to see if there's been any change
        FuncRequest oldBinding = system_bind_.getBinding(k);
-       if (oldBinding.action == LFUN_UNKNOWN_ACTION)
+       if (oldBinding.action() == LFUN_UNKNOWN_ACTION)
                oldBinding = user_bind_.getBinding(k);
-       if (oldBinding == func) {
-               docstring const actionStr = makeCmdString(func);
-               Alert::error(_("Failed to create shortcut"),
-                       bformat(_("Shortcut `%1$s' is already bound to:\n%2$s"), 
-                       k.print(KeySequence::ForGui), actionStr));
+       if (oldBinding == func)
+               // nothing has changed
                return;
-       }
        
        // make sure this key isn't already bound---and, if so, not unbound
-       FuncCode const unbind = user_unbind_.getBinding(k).action;
-       if (oldBinding.action != LFUN_UNKNOWN_ACTION && unbind == LFUN_UNKNOWN_ACTION)
-       {
+       FuncCode const unbind = user_unbind_.getBinding(k).action();
+       docstring const action_string = makeCmdString(oldBinding);
+       if (oldBinding.action() > LFUN_NOACTION && unbind == LFUN_UNKNOWN_ACTION
+                 && save_lfun_ != toqstr(action_string)) {
                // FIXME Perhaps we should offer to over-write the old shortcut?
                // If so, we'll need to remove it from our list, etc.
-               docstring const actionStr = makeCmdString(oldBinding);
                Alert::error(_("Failed to create shortcut"),
                        bformat(_("Shortcut `%1$s' is already bound to:\n%2$s\n"
                          "You need to remove that binding before creating a new one."), 
-                       k.print(KeySequence::ForGui), actionStr));
+                       k.print(KeySequence::ForGui), action_string));
                return;
        }
 
-       if (!save_lfun_.isEmpty() && new_lfun == save_lfun_)
+       if (!save_lfun_.isEmpty())
                // real modification of the lfun's shortcut,
                // so remove the previous one
                removeShortcut();
@@ -2872,10 +2957,10 @@ GuiPreferences::GuiPreferences(GuiView & lv)
        addModule(new PrefLanguage(this));
        addModule(new PrefSpellchecker(this));
 
+       //for strftime validator
+       PrefOutput * output = new PrefOutput(this); 
+       addModule(output);
        addModule(new PrefPrinter(this));
-       PrefDate * dateFormat = new PrefDate(this);
-       addModule(dateFormat);
-       addModule(new PrefPlaintext(this));
        addModule(new PrefLatex(this));
 
        PrefConverters * converters = new PrefConverters(this);
@@ -2899,7 +2984,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
        bc().setRestore(restorePB);
 
        // initialize the strftime validator
-       bc().addCheckedLineEdit(dateFormat->DateED);
+       bc().addCheckedLineEdit(output->DateED);
 }