X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiPrefs.cpp;h=7537ead04820af5627a2931f0ab8eb1347082d05;hb=635a7d77ddc94c63d52494dc4d68a930faccf45f;hp=728e8fe3795f594f8a2a1bed88304668a2acd771;hpb=bbeee6bbef8c3b82507e052b5e72511693c2a682;p=features.git diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp index 728e8fe379..7537ead048 100644 --- a/src/frontends/qt/GuiPrefs.cpp +++ b/src/frontends/qt/GuiPrefs.cpp @@ -31,7 +31,6 @@ #include "ConverterCache.h" #include "FontEnums.h" #include "FuncRequest.h" -#include "KeyMap.h" #include "KeySequence.h" #include "Language.h" #include "LyXAction.h" @@ -50,8 +49,6 @@ #include "support/os.h" #include "support/Package.h" -#include "graphics/GraphicsTypes.h" - #include "frontends/alert.h" #include "frontends/Application.h" #include "frontends/FontLoader.h" @@ -191,7 +188,11 @@ QString browseRelToSub(QString const & filename, QString const & relpath, toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath))); QString testname = reloutname; +#if QT_VERSION < 0x060000 testname.remove(QRegExp("^(\\.\\./)+")); +#else + testname.remove(QRegularExpression("^(\\.\\./)+")); +#endif if (testname.contains("/")) return outname; @@ -224,7 +225,7 @@ static void parseFontName(QString const & mangled0, name = mangled; foundry.clear(); } else { - name = mangled.substr(0, idx - 1), + name = mangled.substr(0, idx - 1); foundry = mangled.substr(idx + 1, mangled.size() - idx - 2); } } @@ -317,7 +318,7 @@ static void setComboxFont(QComboBox * cb, string const & family, ///////////////////////////////////////////////////////////////////// PrefOutput::PrefOutput(GuiPreferences * form) - : PrefModule(catOutput, N_("General"), form) + : PrefModule(catOutput, N_("General[[settings]]"), form) { setupUi(this); @@ -923,10 +924,10 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form) QFontDatabase fontdb; QStringList families(fontdb.families()); - for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) { - screenRomanCO->addItem(*it); - screenSansCO->addItem(*it); - screenTypewriterCO->addItem(*it); + for (auto const & family : families) { + screenRomanCO->addItem(family); + screenSansCO->addItem(family); + screenTypewriterCO->addItem(family); } connect(screenRomanCO, SIGNAL(activated(QString)), this, SIGNAL(changed())); @@ -1089,7 +1090,7 @@ PrefColors::PrefColors(GuiPreferences * form) continue; lcolors_.push_back(lc); } - qSort(lcolors_.begin(), lcolors_.end(), ColorSorter); + sort(lcolors_.begin(), lcolors_.end(), ColorSorter); vector::const_iterator cit = lcolors_.begin(); vector::const_iterator const end = lcolors_.end(); for (; cit != end; ++cit) { @@ -1207,8 +1208,8 @@ void PrefColors::resetAllColor() } -bool PrefColors::setColor(int const row, QColor const new_color, - QString const old_color) +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(); @@ -1245,7 +1246,7 @@ void PrefColors::setDisabledResets() } -bool PrefColors::isDefaultColor(int const row, QString const color) +bool PrefColors::isDefaultColor(int const row, QString const & color) { return color == getDefaultColorByRow(row).name(); } @@ -1254,7 +1255,8 @@ bool PrefColors::isDefaultColor(int const row, QString const color) QColor PrefColors::getDefaultColorByRow(int const row) { ColorSet const defaultcolor; - return defaultcolor.getX11Name(lcolors_[size_t(row)]).c_str(); + return defaultcolor.getX11HexName(lcolors_[size_t(row)], + guiApp->colorCache().isDarkMode()).c_str(); } @@ -1303,6 +1305,7 @@ 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())); + connect(ctAdditionsUnderlinedCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); } @@ -1329,6 +1332,7 @@ void PrefDisplay::applyRC(LyXRC & rc) const rc.display_graphics = displayGraphicsCB->isChecked(); rc.preview_scale_factor = previewSizeSB->value(); rc.paragraph_markers = paragraphMarkerCB->isChecked(); + rc.ct_additions_underlined = ctAdditionsUnderlinedCB->isChecked(); // FIXME!! The graphics cache no longer has a changeDisplay method. #if 0 @@ -1357,6 +1361,7 @@ void PrefDisplay::updateRC(LyXRC const & rc) displayGraphicsCB->setChecked(rc.display_graphics); previewSizeSB->setValue(rc.preview_scale_factor); paragraphMarkerCB->setChecked(rc.paragraph_markers); + ctAdditionsUnderlinedCB->setChecked(rc.ct_additions_underlined); previewSizeSB->setEnabled( rc.display_graphics && rc.preview != LyXRC::PREVIEW_OFF); @@ -1876,8 +1881,8 @@ class FormatValidator : public QValidator { public: FormatValidator(QWidget *, Formats const & f); - void fixup(QString & input) const; - QValidator::State validate(QString & input, int & pos) const; + void fixup(QString & input) const override; + QValidator::State validate(QString & input, int & pos) const override; private: virtual QString toString(Format const & format) const = 0; int nr() const; @@ -1943,7 +1948,7 @@ public: : FormatValidator(parent, f) {} private: - QString toString(Format const & format) const + QString toString(Format const & format) const override { return toqstr(format.name()); } @@ -1963,7 +1968,7 @@ public: : FormatValidator(parent, f) {} private: - QString toString(Format const & format) const + QString toString(Format const & format) const override { return toqstr(translateIfPossible(format.prettyname())); } @@ -2412,7 +2417,9 @@ PrefLanguage::PrefLanguage(GuiPreferences * form) this, SIGNAL(changed())); connect(uiLanguageCO, SIGNAL(activated(int)), this, SIGNAL(changed())); - connect(defaultDecimalPointLE, SIGNAL(textChanged(QString)), + connect(defaultDecimalSepED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); + connect(defaultDecimalSepCO, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(defaultLengthUnitCO, SIGNAL(activated(int)), this, SIGNAL(changed())); @@ -2421,8 +2428,12 @@ PrefLanguage::PrefLanguage(GuiPreferences * form) startCommandED->setValidator(new NoNewLineValidator(startCommandED)); endCommandED->setValidator(new NoNewLineValidator(endCommandED)); - defaultDecimalPointLE->setInputMask("X; "); - defaultDecimalPointLE->setMaxLength(1); +#if QT_VERSION < 0x060000 + defaultDecimalSepED->setValidator(new QRegExpValidator(QRegExp("\\S"), this)); +#else + defaultDecimalSepED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this)); +#endif + defaultDecimalSepED->setMaxLength(1); defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM); defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::IN]), Length::IN); @@ -2450,6 +2461,9 @@ PrefLanguage::PrefLanguage(GuiPreferences * form) index.data(Qt::UserRole).toString()); } uiLanguageCO->blockSignals(false); + + // FIXME: restore this when it works (see discussion in #6450). + respectOSkbdCB->hide(); } @@ -2463,7 +2477,19 @@ void PrefLanguage::on_uiLanguageCO_currentIndexChanged(int) void PrefLanguage::on_languagePackageCO_currentIndexChanged(int i) { - languagePackageED->setEnabled(i == 2); + if (i == 2) + languagePackageED->setText(save_langpack_); + else if (!languagePackageED->text().isEmpty()) { + save_langpack_ = languagePackageED->text(); + languagePackageED->clear(); + } + languagePackageED->setEnabled(i == 2); +} + + +void PrefLanguage::on_defaultDecimalSepCO_currentIndexChanged(int i) +{ + defaultDecimalSepED->setEnabled(i == 1); } @@ -2489,7 +2515,10 @@ void PrefLanguage::applyRC(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()); + if (defaultDecimalSepCO->currentIndex() == 0) + rc.default_decimal_sep = "locale"; + else + rc.default_decimal_sep = fromqstr(defaultDecimalSepED->text()); rc.default_length_unit = (Length::UNIT) defaultLengthUnitCO->itemData(defaultLengthUnitCO->currentIndex()).toInt(); } @@ -2505,12 +2534,25 @@ void PrefLanguage::updateRC(LyXRC const & rc) explicitDocLangBeginCB->setChecked(!rc.language_auto_begin); explicitDocLangEndCB->setChecked(!rc.language_auto_end); languagePackageCO->setCurrentIndex(rc.language_package_selection); - languagePackageED->setText(toqstr(rc.language_custom_package)); - languagePackageED->setEnabled(languagePackageCO->currentIndex() == 2); + if (languagePackageCO->currentIndex() == 2) { + languagePackageED->setText(toqstr(rc.language_custom_package)); + languagePackageED->setEnabled(true); + } else { + languagePackageED->clear(); + save_langpack_ = toqstr(rc.language_custom_package); + languagePackageED->setEnabled(false); + } + defaultDecimalSepED->setEnabled(defaultDecimalSepCO->currentIndex() == 1); globalCB->setChecked(rc.language_global_options); startCommandED->setText(toqstr(rc.language_command_begin)); endCommandED->setText(toqstr(rc.language_command_end)); - defaultDecimalPointLE->setText(toqstr(rc.default_decimal_point)); + if (rc.default_decimal_sep == "locale") { + defaultDecimalSepCO->setCurrentIndex(0); + defaultDecimalSepED->clear(); + } else { + defaultDecimalSepCO->setCurrentIndex(1); + defaultDecimalSepED->setText(toqstr(rc.default_decimal_sep)); + } int pos = defaultLengthUnitCO->findData(int(rc.default_length_unit)); defaultLengthUnitCO->setCurrentIndex(pos); @@ -2550,9 +2592,12 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) iconSetCO->addItem(qt_("Classic"), "classic"); iconSetCO->addItem(qt_("Oxygen"), "oxygen"); -#if (!(defined Q_WS_X11 || defined(QPA_XCB)) || QT_VERSION < 0x040600) - useSystemThemeIconsCB->hide(); +#if QT_VERSION >= 0x040600 + if (guiApp->platformName() != "qt4x11" + && guiApp->platformName() != "xcb" + && !guiApp->platformName().contains("wayland")) #endif + useSystemThemeIconsCB->hide(); } @@ -2713,6 +2758,8 @@ PrefEdit::PrefEdit(GuiPreferences * form) this, SIGNAL(changed())); connect(macLikeCursorMovementCB, SIGNAL(clicked()), this, SIGNAL(changed())); + connect(copyCTMarkupCB, SIGNAL(clicked()), + this, SIGNAL(changed())); connect(sortEnvironmentsCB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(groupEnvironmentsCB, SIGNAL(clicked()), @@ -2721,7 +2768,7 @@ PrefEdit::PrefEdit(GuiPreferences * form) this, SIGNAL(changed())); connect(cursorWidthSB, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); - connect(fullscreenLimitGB, SIGNAL(clicked()), + connect(citationSearchLE, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); connect(fullscreenWidthSB, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); @@ -2738,11 +2785,28 @@ PrefEdit::PrefEdit(GuiPreferences * form) } +void PrefEdit::on_fullscreenLimitCB_toggled(bool const state) +{ + fullscreenWidthSB->setEnabled(state); + fullscreenWidthLA->setEnabled(state); + changed(); +} + + +void PrefEdit::on_citationSearchCB_toggled(bool const state) +{ + citationSearchLE->setEnabled(state); + citationSearchLA->setEnabled(state); + changed(); +} + + void PrefEdit::applyRC(LyXRC & rc) const { rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked(); rc.scroll_below_document = scrollBelowCB->isChecked(); rc.mac_like_cursor_movement = macLikeCursorMovementCB->isChecked(); + rc.ct_markup_copied = copyCTMarkupCB->isChecked(); rc.sort_layouts = sortEnvironmentsCB->isChecked(); rc.group_layouts = groupEnvironmentsCB->isChecked(); switch (macroEditStyleCO->currentIndex()) { @@ -2751,13 +2815,15 @@ void PrefEdit::applyRC(LyXRC & rc) const case 2: rc.macro_edit_style = LyXRC::MACRO_EDIT_LIST; break; } rc.cursor_width = cursorWidthSB->value(); + rc.citation_search = citationSearchCB->isChecked(); + rc.citation_search_pattern = fromqstr(citationSearchLE->text()); rc.full_screen_toolbars = toggleToolbarsCB->isChecked(); rc.full_screen_scrollbar = toggleScrollbarCB->isChecked(); rc.full_screen_statusbar = toggleStatusbarCB->isChecked(); rc.full_screen_tabbar = toggleTabbarCB->isChecked(); rc.full_screen_menubar = toggleMenubarCB->isChecked(); rc.full_screen_width = fullscreenWidthSB->value(); - rc.full_screen_limit = fullscreenLimitGB->isChecked(); + rc.full_screen_limit = fullscreenLimitCB->isChecked(); } @@ -2766,17 +2832,24 @@ void PrefEdit::updateRC(LyXRC const & rc) cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); scrollBelowCB->setChecked(rc.scroll_below_document); macLikeCursorMovementCB->setChecked(rc.mac_like_cursor_movement); + copyCTMarkupCB->setChecked(rc.ct_markup_copied); sortEnvironmentsCB->setChecked(rc.sort_layouts); groupEnvironmentsCB->setChecked(rc.group_layouts); macroEditStyleCO->setCurrentIndex(rc.macro_edit_style); cursorWidthSB->setValue(rc.cursor_width); + citationSearchCB->setChecked(rc.citation_search); + citationSearchLE->setText(toqstr(rc.citation_search_pattern)); + citationSearchLE->setEnabled(rc.citation_search); + citationSearchLA->setEnabled(rc.citation_search); toggleScrollbarCB->setChecked(rc.full_screen_scrollbar); toggleStatusbarCB->setChecked(rc.full_screen_statusbar); toggleToolbarsCB->setChecked(rc.full_screen_toolbars); toggleTabbarCB->setChecked(rc.full_screen_tabbar); toggleMenubarCB->setChecked(rc.full_screen_menubar); fullscreenWidthSB->setValue(rc.full_screen_width); - fullscreenLimitGB->setChecked(rc.full_screen_limit); + fullscreenLimitCB->setChecked(rc.full_screen_limit); + fullscreenWidthSB->setEnabled(rc.full_screen_limit); + fullscreenWidthLA->setEnabled(rc.full_screen_limit); } @@ -2791,13 +2864,14 @@ GuiShortcutDialog::GuiShortcutDialog(QWidget * parent) : QDialog(parent) { Ui::shortcutUi::setupUi(this); QDialog::setModal(true); + lfunLE->setValidator(new NoNewLineValidator(lfunLE)); } PrefShortcuts::PrefShortcuts(GuiPreferences * form) : PrefModule(catEditing, N_("Shortcuts"), form), - editItem_(0), mathItem_(0), bufferItem_(0), layoutItem_(0), - systemItem_(0) + editItem_(nullptr), mathItem_(nullptr), bufferItem_(nullptr), layoutItem_(nullptr), + systemItem_(nullptr) { setupUi(this); @@ -2855,8 +2929,8 @@ void PrefShortcuts::applyRC(LyXRC & rc) const // The good thing is that the menus are updated automatically. theTopLevelKeymap().clear(); theTopLevelKeymap().read("site"); - theTopLevelKeymap().read(rc.bind_file, 0, KeyMap::Fallback); - theTopLevelKeymap().read("user", 0, KeyMap::MissingOK); + theTopLevelKeymap().read(rc.bind_file, nullptr, KeyMap::Fallback); + theTopLevelKeymap().read("user", nullptr, KeyMap::MissingOK); } @@ -2972,14 +3046,14 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, + ' ' + lfun.argument()); QString const shortcut = toqstr(seq.print(KeySequence::ForGui)); - QTreeWidgetItem * newItem = 0; + QTreeWidgetItem * newItem = nullptr; // for unbind items, try to find an existing item in the system bind list if (tag == KeyMap::UserUnbind) { QList const items = shortcutsTW->findItems(lfun_name, Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0); - for (int i = 0; i < items.size(); ++i) { - if (items[i]->text(1) == shortcut) { - newItem = items[i]; + for (auto const & item : items) { + if (item->text(1) == shortcut) { + newItem = item; break; } } @@ -2987,13 +3061,13 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, // Such an item is not displayed to avoid confusion (what is // unmatched removed?). if (!newItem) { - return 0; + return nullptr; } } if (!newItem) { switch(lyxaction.getActionType(action)) { case LyXAction::Hidden: - return 0; + return nullptr; case LyXAction::Edit: newItem = new QTreeWidgetItem(editItem_); break; @@ -3066,8 +3140,7 @@ void PrefShortcuts::unhideEmpty(QString const & lfun, bool select) // list of items that match lfun QList items = shortcutsTW->findItems(lfun, Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0); - for (int i = 0; i < items.size(); ++i) { - QTreeWidgetItem * item = items[i]; + for (auto const & item : items) { if (isAlwaysHidden(*item)) { setItemType(item, KeyMap::System); if (select) @@ -3083,24 +3156,24 @@ void PrefShortcuts::removeShortcut() // it seems that only one item can be selected, but I am // removing all selected items anyway. QList items = shortcutsTW->selectedItems(); - for (int i = 0; i < items.size(); ++i) { - string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString()); - string lfun = fromqstr(items[i]->text(0)); - FuncRequest func = lyxaction.lookupFunc(lfun); + for (auto & item : items) { + string shortcut = fromqstr(item->data(1, Qt::UserRole).toString()); + string lfun = fromqstr(item->text(0)); + FuncRequest const func = lyxaction.lookupFunc(lfun); - switch (itemType(*items[i])) { + switch (itemType(*item)) { case KeyMap::System: { // for system bind, we do not touch the item // but add an user unbind item user_unbind_.bind(shortcut, func); - setItemType(items[i], KeyMap::UserUnbind); + setItemType(item, KeyMap::UserUnbind); removePB->setText(qt_("Res&tore")); break; } case KeyMap::UserBind: { // for user_bind, we remove this bind - QTreeWidgetItem * parent = items[i]->parent(); - int itemIdx = parent->indexOfChild(items[i]); + QTreeWidgetItem * parent = item->parent(); + int itemIdx = parent->indexOfChild(item); parent->takeChild(itemIdx); if (itemIdx > 0) shortcutsTW->scrollToItem(parent->child(itemIdx - 1)); @@ -3109,7 +3182,7 @@ void PrefShortcuts::removeShortcut() user_bind_.unbind(shortcut, func); // If this user binding hid an empty system binding, unhide the // latter and select it. - unhideEmpty(items[i]->text(0), true); + unhideEmpty(item->text(0), true); break; } case KeyMap::UserUnbind: { @@ -3121,15 +3194,15 @@ void PrefShortcuts::removeShortcut() if (!validateNewShortcut(func, seq, QString())) break; user_unbind_.unbind(shortcut, func); - setItemType(items[i], KeyMap::System); + setItemType(item, KeyMap::System); removePB->setText(qt_("Remo&ve")); break; } case KeyMap::UserExtraUnbind: { // for user unbind that is not in system bind file, // remove this unbind file - QTreeWidgetItem * parent = items[i]->parent(); - parent->takeChild(parent->indexOfChild(items[i])); + QTreeWidgetItem * parent = item->parent(); + parent->takeChild(parent->indexOfChild(item)); user_unbind_.unbind(shortcut, func); } } @@ -3139,26 +3212,26 @@ void PrefShortcuts::removeShortcut() void PrefShortcuts::deactivateShortcuts(QList const & items) { - for (int i = 0; i < items.size(); ++i) { - string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString()); - string lfun = fromqstr(items[i]->text(0)); - FuncRequest func = lyxaction.lookupFunc(lfun); + for (auto item : items) { + string shortcut = fromqstr(item->data(1, Qt::UserRole).toString()); + string lfun = fromqstr(item->text(0)); + FuncRequest const func = lyxaction.lookupFunc(lfun); - switch (itemType(*items[i])) { + switch (itemType(*item)) { case KeyMap::System: // for system bind, we do not touch the item // but add an user unbind item user_unbind_.bind(shortcut, func); - setItemType(items[i], KeyMap::UserUnbind); + setItemType(item, KeyMap::UserUnbind); break; case KeyMap::UserBind: { // for user_bind, we remove this bind - QTreeWidgetItem * parent = items[i]->parent(); - int itemIdx = parent->indexOfChild(items[i]); + QTreeWidgetItem * parent = item->parent(); + int itemIdx = parent->indexOfChild(item); parent->takeChild(itemIdx); user_bind_.unbind(shortcut, func); - unhideEmpty(items[i]->text(0), false); + unhideEmpty(item->text(0), false); break; } default: @@ -3208,7 +3281,7 @@ void PrefShortcuts::on_searchLE_textEdited() // show all hidden items QTreeWidgetItemIterator it(shortcutsTW, QTreeWidgetItemIterator::Hidden); for (; *it; ++it) - shortcutsTW->setItemHidden(*it, isAlwaysHidden(**it)); + (*it)->setHidden(isAlwaysHidden(**it)); // close all categories for (int i = 0; i < shortcutsTW->topLevelItemCount(); ++i) shortcutsTW->collapseItem(shortcutsTW->topLevelItem(i)); @@ -3223,12 +3296,13 @@ void PrefShortcuts::on_searchLE_textEdited() // hide everyone (to avoid searching in matched QList repeatedly QTreeWidgetItemIterator it(shortcutsTW, QTreeWidgetItemIterator::Selectable); while (*it) - shortcutsTW->setItemHidden(*it++, true); + (*it++)->setHidden(true); // show matched items - for (int i = 0; i < matched.size(); ++i) - if (!isAlwaysHidden(*matched[i])) { - shortcutsTW->setItemHidden(matched[i], false); - shortcutsTW->setItemExpanded(matched[i]->parent(), true); + for (auto & item : matched) + if (!isAlwaysHidden(*item)) { + item->setHidden(false); + if (item->parent()) + item->parent()->setExpanded(true); } } @@ -3314,7 +3388,7 @@ bool PrefShortcuts::validateNewShortcut(FuncRequest const & func, void PrefShortcuts::shortcutOkPressed() { QString const new_lfun = shortcut_->lfunLE->text(); - FuncRequest func = lyxaction.lookupFunc(fromqstr(new_lfun)); + FuncRequest const func = lyxaction.lookupFunc(fromqstr(new_lfun)); KeySequence k = shortcut_->shortcutWG->getKeySequence(); // save_lfun_ contains the text of the lfun to modify, if the user clicked @@ -3335,7 +3409,7 @@ void PrefShortcuts::shortcutOkPressed() if (item) { user_bind_.bind(&k, func); shortcutsTW->sortItems(0, Qt::AscendingOrder); - shortcutsTW->setItemExpanded(item->parent(), true); + item->parent()->setExpanded(true); shortcutsTW->setCurrentItem(item); shortcutsTW->scrollToItem(item); } else { @@ -3379,9 +3453,12 @@ PrefIdentity::PrefIdentity(GuiPreferences * form) this, SIGNAL(changed())); connect(emailED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(initialsED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); nameED->setValidator(new NoNewLineValidator(nameED)); emailED->setValidator(new NoNewLineValidator(emailED)); + initialsED->setValidator(new NoNewLineValidator(initialsED)); } @@ -3389,6 +3466,7 @@ void PrefIdentity::applyRC(LyXRC & rc) const { rc.user_name = fromqstr(nameED->text()); rc.user_email = fromqstr(emailED->text()); + rc.user_initials = fromqstr(initialsED->text()); } @@ -3396,6 +3474,7 @@ void PrefIdentity::updateRC(LyXRC const & rc) { nameED->setText(toqstr(rc.user_name)); emailED->setText(toqstr(rc.user_email)); + initialsED->setText(toqstr(rc.user_initials)); } @@ -3535,7 +3614,8 @@ void GuiPreferences::dispatchParams() // FIXME: these need lfuns // FIXME UNICODE Author const & author = - Author(from_utf8(rc_.user_name), from_utf8(rc_.user_email)); + Author(from_utf8(rc_.user_name), from_utf8(rc_.user_email), + from_utf8(rc_.user_initials)); theBufferList().recordCurrentAuthor(author); theFormats() = formats_; @@ -3621,9 +3701,6 @@ QString GuiPreferences::browse(QString const & file, } -Dialog * createGuiPreferences(GuiView & lv) { return new GuiPreferences(lv); } - - } // namespace frontend } // namespace lyx