BTW, to create a file with an "unknown" layout for testing, just take any LyX file, open it with vi, and replace something like:
\begin_layout Section
with
\begin_layout BlubberStuff
That's probably unknown. ;-)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25671
a592a061-630c-0410-9148-
cb99ea01b6c8
return;
Layout const & lay = (*text_class_)[layout];
return;
Layout const & lay = (*text_class_)[layout];
- QString const & name = toqstr(lay.name() + (lay.isUnknown() ? " (unknown)" : ""));
- if (name == currentText())
- return;
+ QString const & name = toqstr(lay.name());
+ // FIXME
+ // Commenting this out for now. Not sure exactly how to do this test,
+ // with all the different models that are flying around. As it is, it
+ // won't work with translated or unknown layouts.
+ // if (name == currentText())
+ // return;
QList<QStandardItem *> r = model_->findItems(name, Qt::MatchExactly, 1);
if (r.empty()) {
QList<QStandardItem *> r = model_->findItems(name, Qt::MatchExactly, 1);
if (r.empty()) {
void GuiLayoutBox::addItemSort(docstring const & item, docstring const & category,
void GuiLayoutBox::addItemSort(docstring const & item, docstring const & category,
- bool sorted, bool sortedByCat)
+ bool sorted, bool sortedByCat, bool unknown)
{
QString qitem = toqstr(item);
{
QString qitem = toqstr(item);
- QString titem = toqstr(translateIfPossible(item));
+ // FIXME This is wrong for RTL, I'd suppose.
+ QString titem = toqstr(translateIfPossible(item) +
+ (unknown ? _(" (unknown)") : from_ascii("")));
QString qcat = toqstr(translateIfPossible(category));
QList<QStandardItem *> row;
QString qcat = toqstr(translateIfPossible(category));
QList<QStandardItem *> row;
// if it doesn't require the empty layout, we skip it
if (name == text_class_->emptyLayoutName() && inset_ && !useEmpty)
continue;
// if it doesn't require the empty layout, we skip it
if (name == text_class_->emptyLayoutName() && inset_ && !useEmpty)
continue;
- addItemSort(name + (lit->isUnknown() ? " (unknown)" : ""),
- lit->category(), lyxrc.sort_layouts, lyxrc.group_layouts);
+ addItemSort(name, lit->category(), lyxrc.sort_layouts,
+ lyxrc.group_layouts, lit->isUnknown());
}
set(owner_.view()->cursor().innerParagraph().layout().name());
}
set(owner_.view()->cursor().innerParagraph().layout().name());
// get selection
QModelIndex mindex = filterModel_->mapToSource(filterModel_->index(index, 1));
docstring layoutName = qstring_to_ucs4(model_->itemFromIndex(mindex)->text());
// get selection
QModelIndex mindex = filterModel_->mapToSource(filterModel_->index(index, 1));
docstring layoutName = qstring_to_ucs4(model_->itemFromIndex(mindex)->text());
- if (suffixIs(layoutName, from_ascii(" (unknown)")))
- layoutName = layoutName.substr(0, layoutName.size() - 10); // = len(" (unknown)")
owner_.setFocus();
if (!text_class_) {
owner_.setFocus();
if (!text_class_) {
void updateContents(bool reset);
/// Add Item to Layout box according to sorting settings from preferences
void addItemSort(docstring const & item, docstring const & category,
void updateContents(bool reset);
/// Add Item to Layout box according to sorting settings from preferences
void addItemSort(docstring const & item, docstring const & category,
- bool sorted, bool sortedByCat);
+ bool sorted, bool sortedByCat, bool unknown);