indicesTW->headerItem()->setText(1, qt_("Label Color"));
indicesTW->setSortingEnabled(true);
+ // NOTE: we do not provide "custom" here for security reasons!
indexCO->clear();
indexCO->addItem(qt_("Default"), QString("default"));
for (set<string>::const_iterator it = lyxrc.index_alternatives.begin();
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
indexCO->addItem(command, command);
}
+
+ indexOptionsLE->setValidator(new NoNewLineValidator(indexOptionsLE));
+ newIndexLE->setValidator(new NoNewLineValidator(newIndexLE));
}
void GuiIndices::update(BufferParams const & params)
int const pos = indexCO->findData(toqstr(command));
if (pos != -1) {
indexCO->setCurrentIndex(pos);
- indexOptionsED->setText(toqstr(options).trimmed());
+ indexOptionsLE->setText(toqstr(options).trimmed());
} else {
- indexCO->setCurrentIndex(0);
- indexOptionsED->clear();
+ // We reset to default if we do not know the specified compiler
+ // This is for security reasons
+ indexCO->setCurrentIndex(indexCO->findData(toqstr("default")));
+ indexOptionsLE->clear();
}
- indexOptionsED->setEnabled(
+ indexOptionsLE->setEnabled(
indexCO->currentIndex() != 0);
updateView();
indicesTW->setItemSelected(newItem, true);
}
}
+ indicesTW->resizeColumnToContents(0);
bool const have_sel =
!indicesTW->selectedItems().isEmpty();
removePB->setEnabled(have_sel);
string const index_command =
fromqstr(indexCO->itemData(
indexCO->currentIndex()).toString());
- string const index_options = fromqstr(indexOptionsED->text());
+ string const index_options = fromqstr(indexOptionsLE->text());
if (index_command == "default" || index_options.empty())
params.index_command = index_command;
else
void GuiIndices::on_indexCO_activated(int n)
{
- indexOptionsED->setEnabled(n != 0);
+ indexOptionsLE->setEnabled(
+ indexCO->itemData(n).toString() != "default");
changed();
}
-void GuiIndices::on_indexOptionsED_textChanged(QString)
+void GuiIndices::on_indexOptionsLE_textChanged(QString)
{
changed();
}
success = indiceslist_.rename(qstring_to_ucs4(sel_index), newname);
newIndexLE->clear();
updateView();
+ if (!success)
+ Alert::error(_("Renaming failed"),
+ _("The index could not be renamed. "
+ "Check if the new name already exists."));
}
- if (!success)
- Alert::error(_("Renaming failed"),
- _("The index could not be renamed. "
- "Check if the new name already exists."));
}
}