bool GuiToc::initialiseParams(string const & data)
{
LYXERR(Debug::GUI, data);
- LYXERR0(data);
QString str = QString::fromUtf8(data.c_str());
- string new_type = "tableofcontents";
- if (str.contains("floatlist")) {
+ string new_type;
+ if (str.contains("tableofcontents"))
+ new_type = "tableofcontents";
+ else if (str.contains("floatlist")) {
if (str.contains("\"figure"))
new_type = "figure";
else if (str.contains("\"table"))
return;
}
- QString current_text = typeCO->currentText();
+ QString const current_text = typeCO->currentText();
typeCO->blockSignals(true);
typeCO->clear();
for (size_t i = 0; i != type_names.size(); ++i) {
}
if (selected_type != -1)
typeCO->setCurrentIndex(selected_type);
+ else {
+ int const new_index = typeCO->findText(current_text);
+ if (new_index != -1)
+ typeCO->setCurrentIndex(new_index);
+ }
+
typeCO->blockSignals(false);
setTocModel(typeCO->currentIndex());