From: Richard Heck Date: Sun, 3 Feb 2008 08:51:58 +0000 (+0000) Subject: Some comments about a better way to do things. X-Git-Tag: 1.6.10~6471 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d4a87d0dce149d29ac6ccc72126ef0227039c3c4;p=features.git Some comments about a better way to do things. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22760 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index b0ce52deb1..f95a6a9cce 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -269,6 +269,13 @@ void GuiLayoutBox::set(docstring const & layout) void GuiLayoutBox::addItemSort(QString const & item, bool sorted) { + //FIXME + //Since we are only storing the text used for display, we have no choice + //below but to compare translated strings to figure out which layout the + //user wants. This is not ideal. A better way is the way module names are + //handled in GuiDocument: viz, the untranslated name can be associated + //with the item via QComboBox::setItemData(). It may be that this can + //even be done by passing: addItem(item, untransName). int const end = count(); if (!sorted || end < 2 || item[0].category() != QChar::Letter_Uppercase) { addItem(item); @@ -314,10 +321,8 @@ void GuiLayoutBox::updateContents(bool reset) TextClass::const_iterator it = text_class_->begin(); TextClass::const_iterator const end = text_class_->end(); - for (; it != end; ++it) { - // ignore obsolete entries + for (; it != end; ++it) addItemSort(toqstr(translateIfPossible((*it)->name())), lyxrc.sort_layouts); - } setCurrentIndex(0); @@ -343,6 +348,10 @@ void GuiLayoutBox::selected(const QString & str) TextClass::const_iterator const end = text_class_->end(); for (; it != end; ++it) { docstring const & itname = (*it)->name(); + //FIXME Comparing translated strings is not ideal. + //This should be done the way module names are handled + //in GuiDocument: viz, the untranslated name should be + //associated with the item via QComboBox::setItemData(). if (translateIfPossible(itname) == name) { FuncRequest const func(LFUN_LAYOUT, itname, FuncRequest::TOOLBAR);