]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPrefs.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiPrefs.cpp
index 615c7dabdfdd1d9607e6ebb497ebff7218d826f7..82073bcbe7cbb07e6d9786e6b31184e6ecec89a6 100644 (file)
@@ -19,6 +19,8 @@
 #include "GuiFontExample.h"
 #include "GuiFontLoader.h"
 #include "GuiKeySymbol.h"
+#include "GuiLyXFiles.h"
+#include "GuiView.h"
 #include "qt_helpers.h"
 #include "Validator.h"
 
@@ -61,7 +63,6 @@
 #include <QHeaderView>
 #include <QLineEdit>
 #include <QMessageBox>
-#include <QPixmapCache>
 #include <QPushButton>
 #include <QSpinBox>
 #include <QString>
@@ -126,46 +127,6 @@ QString browseFile(QString const & filename,
 }
 
 
-/** Wrapper around browseFile which tries to provide a filename
-*  relative to the user or system directory. The dir, name and ext
-*  parameters have the same meaning as in the
-*  support::LibFileSearch function.
-*/
-QString browseLibFile(QString const & dir,
-       QString const & name,
-       QString const & ext,
-       QString const & title,
-       QStringList const & filters)
-{
-       // FIXME UNICODE
-       QString const label1 = qt_("&System files");
-       QString const dir1 =
-               toqstr(addName(package().system_support().absFileName(), fromqstr(dir)));
-
-       QString const label2 = qt_("&User files");
-       QString const dir2 =
-               toqstr(addName(package().user_support().absFileName(), fromqstr(dir)));
-
-       QString const result = browseFile(toqstr(
-               libFileSearch(dir, name, ext).absFileName()),
-               title, filters, false, dir1, dir2, QString(), QString(), dir1);
-
-       // remove the extension if it is the default one
-       QString noextresult;
-       if (getExtension(result) == ext)
-               noextresult = removeExtension(result);
-       else
-               noextresult = result;
-
-       // remove the directory, if it is the default one
-       QString const file = onlyFileName(noextresult);
-       if (toqstr(libFileSearch(dir, file, ext).absFileName()) == result)
-               return file;
-       else
-               return noextresult;
-}
-
-
 /** Launch a file dialog and return the chosen directory.
        pathname: a suggested pathname.
        title: the title of the dialog.
@@ -349,35 +310,6 @@ static void setComboxFont(QComboBox * cb, string const & family,
 }
 
 
-/////////////////////////////////////////////////////////////////////
-//
-// StrftimeValidator
-//
-/////////////////////////////////////////////////////////////////////
-
-class StrftimeValidator : public QValidator
-{
-public:
-       StrftimeValidator(QWidget *);
-       QValidator::State validate(QString & input, int & pos) const;
-};
-
-
-StrftimeValidator::StrftimeValidator(QWidget * parent)
-       : QValidator(parent)
-{
-}
-
-
-QValidator::State StrftimeValidator::validate(QString & input, int & /*pos*/) const
-{
-       if (is_valid_strftime(fromqstr(input)))
-               return QValidator::Acceptable;
-       else
-               return QValidator::Intermediate;
-}
-
-
 /////////////////////////////////////////////////////////////////////
 //
 // PrefOutput
@@ -389,12 +321,9 @@ PrefOutput::PrefOutput(GuiPreferences * 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)),
                this, SIGNAL(changed()));
        connect(overwriteCO, SIGNAL(activated(int)),
@@ -430,19 +359,8 @@ PrefOutput::PrefOutput(GuiPreferences * form)
 }
 
 
-void PrefOutput::on_DateED_textChanged(const QString &)
-{
-       QString t = DateED->text();
-       int p = 0;
-       bool valid = DateED->validator()->validate(t, p)
-                    == QValidator::Acceptable;
-       setValid(DateLA, valid);
-}
-
-
 void PrefOutput::applyRC(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());
@@ -467,7 +385,6 @@ void PrefOutput::applyRC(LyXRC & rc) const
 
 void PrefOutput::updateRC(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));
@@ -1039,8 +956,6 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(screenHugerED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
-       connect(pixmapCacheCB, SIGNAL(toggled(bool)),
-               this, SIGNAL(changed()));
 
        screenTinyED->setValidator(new QDoubleValidator(screenTinyED));
        screenSmallestED->setValidator(new QDoubleValidator(screenSmallestED));
@@ -1067,30 +982,16 @@ void PrefScreenFonts::applyRC(LyXRC & rc) const
                rc.typewriter_font_name, rc.typewriter_font_foundry);
 
        rc.defaultZoom = screenZoomSB->value();
-       rc.font_sizes[FONT_SIZE_TINY] = widgetToDoubleStr(screenTinyED);
-       rc.font_sizes[FONT_SIZE_SCRIPT] = widgetToDoubleStr(screenSmallestED);
-       rc.font_sizes[FONT_SIZE_FOOTNOTE] = widgetToDoubleStr(screenSmallerED);
-       rc.font_sizes[FONT_SIZE_SMALL] = widgetToDoubleStr(screenSmallED);
-       rc.font_sizes[FONT_SIZE_NORMAL] = widgetToDoubleStr(screenNormalED);
-       rc.font_sizes[FONT_SIZE_LARGE] = widgetToDoubleStr(screenLargeED);
-       rc.font_sizes[FONT_SIZE_LARGER] = widgetToDoubleStr(screenLargerED);
-       rc.font_sizes[FONT_SIZE_LARGEST] = widgetToDoubleStr(screenLargestED);
-       rc.font_sizes[FONT_SIZE_HUGE] = widgetToDoubleStr(screenHugeED);
-       rc.font_sizes[FONT_SIZE_HUGER] = widgetToDoubleStr(screenHugerED);
-       rc.use_pixmap_cache = pixmapCacheCB->isChecked();
-
-       if (rc.font_sizes != oldrc.font_sizes
-               || rc.roman_font_name != oldrc.roman_font_name
-               || rc.sans_font_name != oldrc.sans_font_name
-               || rc.typewriter_font_name != oldrc.typewriter_font_name
-               || rc.defaultZoom != oldrc.defaultZoom) {
-               // The global QPixmapCache is used in GuiPainter to cache text
-               // painting so we must reset it in case any of the above
-               // parameter is changed.
-               QPixmapCache::clear();
-               guiApp->fontLoader().update();
-               form_->updateScreenFonts();
-       }
+       rc.font_sizes[TINY_SIZE] = widgetToDoubleStr(screenTinyED);
+       rc.font_sizes[SCRIPT_SIZE] = widgetToDoubleStr(screenSmallestED);
+       rc.font_sizes[FOOTNOTE_SIZE] = widgetToDoubleStr(screenSmallerED);
+       rc.font_sizes[SMALL_SIZE] = widgetToDoubleStr(screenSmallED);
+       rc.font_sizes[NORMAL_SIZE] = widgetToDoubleStr(screenNormalED);
+       rc.font_sizes[LARGE_SIZE] = widgetToDoubleStr(screenLargeED);
+       rc.font_sizes[LARGER_SIZE] = widgetToDoubleStr(screenLargerED);
+       rc.font_sizes[LARGEST_SIZE] = widgetToDoubleStr(screenLargestED);
+       rc.font_sizes[HUGE_SIZE] = widgetToDoubleStr(screenHugeED);
+       rc.font_sizes[HUGER_SIZE] = widgetToDoubleStr(screenHugerED);
 }
 
 
@@ -1109,27 +1010,21 @@ void PrefScreenFonts::updateRC(LyXRC const & rc)
 
        screenZoomSB->setValue(rc.defaultZoom);
        updateScreenFontSizes(rc);
-
-       pixmapCacheCB->setChecked(rc.use_pixmap_cache);
-#if defined(Q_WS_X11) || defined(QPA_XCB)
-       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]);
-       doubleToWidget(screenSmallED, rc.font_sizes[FONT_SIZE_SMALL]);
-       doubleToWidget(screenNormalED, rc.font_sizes[FONT_SIZE_NORMAL]);
-       doubleToWidget(screenLargeED, rc.font_sizes[FONT_SIZE_LARGE]);
-       doubleToWidget(screenLargerED, rc.font_sizes[FONT_SIZE_LARGER]);
-       doubleToWidget(screenLargestED, rc.font_sizes[FONT_SIZE_LARGEST]);
-       doubleToWidget(screenHugeED, rc.font_sizes[FONT_SIZE_HUGE]);
-       doubleToWidget(screenHugerED, rc.font_sizes[FONT_SIZE_HUGER]);
+       doubleToWidget(screenTinyED, rc.font_sizes[TINY_SIZE]);
+       doubleToWidget(screenSmallestED, rc.font_sizes[SCRIPT_SIZE]);
+       doubleToWidget(screenSmallerED, rc.font_sizes[FOOTNOTE_SIZE]);
+       doubleToWidget(screenSmallED, rc.font_sizes[SMALL_SIZE]);
+       doubleToWidget(screenNormalED, rc.font_sizes[NORMAL_SIZE]);
+       doubleToWidget(screenLargeED, rc.font_sizes[LARGE_SIZE]);
+       doubleToWidget(screenLargerED, rc.font_sizes[LARGER_SIZE]);
+       doubleToWidget(screenLargestED, rc.font_sizes[LARGEST_SIZE]);
+       doubleToWidget(screenHugeED, rc.font_sizes[HUGE_SIZE]);
+       doubleToWidget(screenHugerED, rc.font_sizes[HUGER_SIZE]);
 }
 
 
@@ -1207,6 +1102,10 @@ PrefColors::PrefColors(GuiPreferences * form)
 
        connect(colorChangePB, SIGNAL(clicked()),
                this, SLOT(changeColor()));
+       connect(colorResetPB, SIGNAL(clicked()),
+               this, SLOT(resetColor()));
+       connect(colorResetAllPB, SIGNAL(clicked()),
+               this, SLOT(resetAllColor()));
        connect(lyxObjectsLW, SIGNAL(itemSelectionChanged()),
                this, SLOT(changeLyxObjectsSelection()));
        connect(lyxObjectsLW, SIGNAL(itemActivated(QListWidgetItem*)),
@@ -1234,15 +1133,17 @@ void PrefColors::applyRC(LyXRC & rc) const
 
 void PrefColors::updateRC(LyXRC const & rc)
 {
-       for (unsigned int i = 0; i < lcolors_.size(); ++i) {
+       for (size_type i = 0; i < lcolors_.size(); ++i) {
                QColor color = QColor(guiApp->colorCache().get(lcolors_[i], false));
                QPixmap coloritem(32, 32);
                coloritem.fill(color);
-               lyxObjectsLW->item(i)->setIcon(QIcon(coloritem));
+               lyxObjectsLW->item(int(i))->setIcon(QIcon(coloritem));
                newcolors_[i] = curcolors_[i] = color.name();
        }
        syscolorsCB->setChecked(rc.use_system_colors);
        changeLyxObjectsSelection();
+
+       setDisabledResets();
 }
 
 
@@ -1254,25 +1155,115 @@ void PrefColors::changeColor()
        if (row < 0)
                return;
 
-       QString const color = newcolors_[row];
-       QColor c = QColorDialog::getColor(QColor(color), qApp->focusWidget());
+       QString const color = newcolors_[size_t(row)];
+       QColor const c = QColorDialog::getColor(QColor(color), qApp->focusWidget());
 
-       if (c.isValid() && c.name() != color) {
-               newcolors_[row] = c.name();
-               QPixmap coloritem(32, 32);
-               coloritem.fill(c);
-               lyxObjectsLW->currentItem()->setIcon(QIcon(coloritem));
+       if (setColor(row, c, color)) {
+               setDisabledResets();
                // emit signal
                changed();
        }
 }
 
+
+void PrefColors::resetColor()
+{
+       int const row = lyxObjectsLW->currentRow();
+
+       // just to be sure
+       if (row < 0)
+               return;
+
+       QString const color = newcolors_[size_t(row)];
+       QColor const c = getDefaultColorByRow(row);
+
+       if (setColor(row, c, color)) {
+               setDisabledResets();
+               // emit signal
+               changed();
+       }
+}
+
+
+void PrefColors::resetAllColor()
+{
+       bool isChanged = false;
+
+       colorResetAllPB->setDisabled(true);
+
+       for (int irow = 0, count = lyxObjectsLW->count(); irow < count; ++irow) {
+               QString const color = newcolors_[size_t(irow)];
+               QColor const c = getDefaultColorByRow(irow);
+
+               if (setColor(irow, c, color))
+                       isChanged = true;
+       }
+
+       if (isChanged) {
+               setDisabledResets();
+               // emit signal
+               changed();
+       }
+}
+
+
+bool PrefColors::setColor(int const row, QColor const new_color,
+                         QString const old_color)
+{
+       if (new_color.isValid() && new_color.name() != old_color) {
+               newcolors_[size_t(row)] = new_color.name();
+               QPixmap coloritem(32, 32);
+               coloritem.fill(new_color);
+               lyxObjectsLW->item(row)->setIcon(QIcon(coloritem));
+               return true;
+       }
+       return false;
+}
+
+
+void PrefColors::setDisabledResets()
+{
+       int const row = lyxObjectsLW->currentRow();
+       // set disable reset buttons ...
+       if (row >= 0)
+               colorResetPB->setDisabled(isDefaultColor(row, newcolors_[size_t(row)]));
+
+       colorResetAllPB->setDisabled(true);
+
+       // ... in between process qt events to give quicker visual feedback to the user ...
+       guiApp->processEvents();
+
+       // ... set disable Reset All button
+       for (int irow = 0, count = lyxObjectsLW->count(); irow < count; ++irow) {
+               if (!isDefaultColor(irow, newcolors_[size_t(irow)])) {
+                       colorResetAllPB->setDisabled(false);
+                       // the break condition might hide performance issues
+                       // if a non-default color is at the top of the list
+                       break;
+               }
+       }
+}
+
+
+bool PrefColors::isDefaultColor(int const row, QString const color)
+{
+       return color == getDefaultColorByRow(row).name();
+}
+
+
+QColor PrefColors::getDefaultColorByRow(int const row)
+{
+       ColorSet const defaultcolor;
+       return defaultcolor.getX11Name(lcolors_[size_t(row)]).c_str();
+}
+
+
 void PrefColors::changeSysColor()
 {
        for (int row = 0 ; row < lyxObjectsLW->count() ; ++row) {
                // skip colors that are taken from system palette
                bool const disable = syscolorsCB->isChecked()
-                       && guiApp->colorCache().isSystem(lcolors_[row]);
+                       && guiApp->colorCache().isSystem(lcolors_[size_t(row)]);
 
                QListWidgetItem * const item = lyxObjectsLW->item(row);
                Qt::ItemFlags const flags = item->flags();
@@ -1284,9 +1275,17 @@ void PrefColors::changeSysColor()
        }
 }
 
+
 void PrefColors::changeLyxObjectsSelection()
 {
-       colorChangePB->setDisabled(lyxObjectsLW->currentRow() < 0);
+       int currentRow = lyxObjectsLW->currentRow();
+       colorChangePB->setDisabled(currentRow < 0);
+
+       if (currentRow < 0)
+               colorResetPB->setDisabled(true);
+       else
+               colorResetPB->setDisabled(
+                       isDefaultColor(currentRow, newcolors_[size_t(currentRow)]));
 }
 
 
@@ -1320,16 +1319,10 @@ void PrefDisplay::applyRC(LyXRC & rc) const
                        rc.preview = LyXRC::PREVIEW_OFF;
                        break;
                case 1:
-                       if (rc.preview != LyXRC::PREVIEW_NO_MATH) {
-                               rc.preview = LyXRC::PREVIEW_NO_MATH;
-                               form_->updatePreviews();
-                       }
+                       rc.preview = LyXRC::PREVIEW_NO_MATH;
                        break;
                case 2:
-                       if (rc.preview != LyXRC::PREVIEW_ON) {
-                               rc.preview = LyXRC::PREVIEW_ON;
-                               form_->updatePreviews();
-                       }
+                       rc.preview = LyXRC::PREVIEW_ON;
                        break;
        }
 
@@ -2818,20 +2811,20 @@ PrefShortcuts::PrefShortcuts(GuiPreferences * form)
 
        shortcut_ = new GuiShortcutDialog(this);
        shortcut_bc_.setPolicy(ButtonPolicy::OkCancelPolicy);
-       shortcut_bc_.setOK(shortcut_->okPB);
-       shortcut_bc_.setCancel(shortcut_->cancelPB);
+       shortcut_bc_.setOK(shortcut_->buttonBox->button(QDialogButtonBox::Ok));
+       shortcut_bc_.setCancel(shortcut_->buttonBox->button(QDialogButtonBox::Cancel));
 
-       connect(shortcut_->okPB, SIGNAL(clicked()),
+       connect(shortcut_->buttonBox, SIGNAL(accepted()),
                this, SIGNAL(changed()));
-       connect(shortcut_->cancelPB, SIGNAL(clicked()),
+       connect(shortcut_->buttonBox, SIGNAL(rejected()),
                shortcut_, SLOT(reject()));
        connect(shortcut_->clearPB, SIGNAL(clicked()),
                this, SLOT(shortcutClearPressed()));
        connect(shortcut_->removePB, SIGNAL(clicked()),
                this, SLOT(shortcutRemovePressed()));
-       connect(shortcut_->okPB, SIGNAL(clicked()),
+       connect(shortcut_->buttonBox, SIGNAL(accepted()),
                this, SLOT(shortcutOkPressed()));
-       connect(shortcut_->cancelPB, SIGNAL(clicked()),
+       connect(shortcut_->buttonBox, SIGNAL(rejected()),
                this, SLOT(shortcutCancelPressed()));
 }
 
@@ -3410,17 +3403,14 @@ void PrefIdentity::updateRC(LyXRC const & rc)
 /////////////////////////////////////////////////////////////////////
 
 GuiPreferences::GuiPreferences(GuiView & lv)
-       : GuiDialog(lv, "prefs", qt_("Preferences")), update_screen_font_(false),
-         update_previews_(false)
+       : GuiDialog(lv, "prefs", qt_("Preferences"))
 {
        setupUi(this);
 
        QDialog::setModal(false);
 
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
-       connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
+       connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+               this, SLOT(slotButtonBox(QAbstractButton *)));
 
        addModule(new PrefUserInterface(this));
        addModule(new PrefDocHandling(this));
@@ -3442,7 +3432,6 @@ GuiPreferences::GuiPreferences(GuiView & lv)
        addModule(new PrefLanguage(this));
        addModule(new PrefSpellchecker(this));
 
-       //for strftime validator
        PrefOutput * output = new PrefOutput(this);
        addModule(output);
        addModule(new PrefLatex(this));
@@ -3462,13 +3451,14 @@ GuiPreferences::GuiPreferences(GuiView & lv)
 #endif
 
        bc().setPolicy(ButtonPolicy::PreferencesPolicy);
-       bc().setOK(okPB);
-       bc().setApply(applyPB);
-       bc().setCancel(closePB);
-       bc().setRestore(restorePB);
+       bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
+       bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
+       bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
+       bc().setRestore(buttonBox->button(QDialogButtonBox::Reset));
 
-       // initialize the strftime validator
-       bc().addCheckedLineEdit(output->DateED);
+       guilyxfiles_ = new GuiLyXFiles(lv);
+       connect(guilyxfiles_, SIGNAL(fileSelected(QString)),
+                       this, SLOT(slotFileSelected(QString)));
 }
 
 
@@ -3520,8 +3510,6 @@ bool GuiPreferences::initialiseParams(string const &)
        converters_.update(formats_);
        movers_ = theMovers();
        colors_.clear();
-       update_screen_font_ = false;
-       update_previews_ = false;
 
        updateRC(rc_);
        // Make sure that the bc is in the INITIAL state
@@ -3555,24 +3543,10 @@ void GuiPreferences::dispatchParams()
 
        theMovers() = movers_;
 
-       vector<string>::const_iterator it = colors_.begin();
-       vector<string>::const_iterator const end = colors_.end();
-       for (; it != end; ++it)
-               dispatch(FuncRequest(LFUN_SET_COLOR, *it));
+       for (string const & color : colors_)
+               dispatch(FuncRequest(LFUN_SET_COLOR, color));
        colors_.clear();
 
-       if (update_screen_font_) {
-               dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
-               // resets flag in case second apply in same dialog
-               update_screen_font_ = false;
-       }
-
-       if (update_previews_) {
-               // resets flag in case second apply in same dialog
-               theBufferList().updatePreviews();
-               update_previews_ = false;
-       }
-
        // Save permanently
        if (!tempSaveCB->isChecked())
                dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
@@ -3585,36 +3559,54 @@ void GuiPreferences::setColor(ColorCode col, QString const & hex)
 }
 
 
-void GuiPreferences::updateScreenFonts()
+void GuiPreferences::slotFileSelected(QString const file)
 {
-       update_screen_font_ = true;
+       uifile_ = file;
 }
 
 
-void GuiPreferences::updatePreviews()
+QString GuiPreferences::browseLibFile(QString const & dir,
+       QString const & name, QString const & ext)
 {
-       update_previews_ = true;
+       uifile_.clear();
+
+       guilyxfiles_->passParams(fromqstr(dir));
+       guilyxfiles_->selectItem(name);
+       guilyxfiles_->exec();
+
+       QString const result = uifile_;
+
+       // remove the extension if it is the default one
+       QString noextresult;
+       if (getExtension(result) == ext)
+               noextresult = removeExtension(result);
+       else
+               noextresult = result;
+
+       // remove the directory, if it is the default one
+       QString const file = onlyFileName(noextresult);
+       if (toqstr(libFileSearch(dir, file, ext).absFileName()) == result)
+               return file;
+       else
+               return noextresult;
 }
 
 
-QString GuiPreferences::browsebind(QString const & file) const
+QString GuiPreferences::browsebind(QString const & file)
 {
-       return browseLibFile("bind", file, "bind", qt_("Choose bind file"),
-                            QStringList(qt_("LyX bind files (*.bind)")));
+       return browseLibFile("bind", file, "bind");
 }
 
 
-QString GuiPreferences::browseUI(QString const & file) const
+QString GuiPreferences::browseUI(QString const & file)
 {
-       return browseLibFile("ui", file, "ui", qt_("Choose UI file"),
-                            QStringList(qt_("LyX UI files (*.ui)")));
+       return browseLibFile("ui", file, "ui");
 }
 
 
-QString GuiPreferences::browsekbmap(QString const & file) const
+QString GuiPreferences::browsekbmap(QString const & file)
 {
-       return browseLibFile("kbd", file, "kmap", qt_("Choose keyboard map"),
-                            QStringList(qt_("LyX keyboard maps (*.kmap)")));
+       return browseLibFile("kbd", file, "kmap");
 }