- filter_->setButtonPixmap(FancyLineEdit::Right, getPixmap("images/", "editclear", "svgz,png"));
- filter_->setButtonVisible(FancyLineEdit::Right, true);
- filter_->setButtonToolTip(FancyLineEdit::Right, qt_("Clear text"));
- filter_->setAutoHideButton(FancyLineEdit::Right, true);
+ filter_->setClearButton(true);
filter_->setPlaceholderText(qt_("All available labels"));
filter_->setToolTip(qt_("Enter string to filter the list of available labels"));
filter_->setPlaceholderText(qt_("All available labels"));
filter_->setToolTip(qt_("Enter string to filter the list of available labels"));
filterBarL->addWidget(filter_, 0);
findKeysLA->setBuddy(filter_);
filterBarL->addWidget(filter_, 0);
findKeysLA->setBuddy(filter_);
buttonBox->button(QDialogButtonBox::Reset)->setText(qt_("&Update"));
buttonBox->button(QDialogButtonBox::Reset)->setToolTip(qt_("Update the label list"));
buttonBox->button(QDialogButtonBox::Reset)->setText(qt_("&Update"));
buttonBox->button(QDialogButtonBox::Reset)->setToolTip(qt_("Update the label list"));
connect(this, SIGNAL(rejected()), this, SLOT(dialogRejected()));
connect(typeCO, SIGNAL(activated(int)),
connect(this, SIGNAL(rejected()), this, SLOT(dialogRejected()));
connect(typeCO, SIGNAL(activated(int)),
this, SLOT(changed_adaptor()));
connect(noprefixCB, SIGNAL(clicked()),
this, SLOT(changed_adaptor()));
this, SLOT(changed_adaptor()));
connect(noprefixCB, SIGNAL(clicked()),
this, SLOT(changed_adaptor()));
bool const isFormatted = (reftype == "formatted");
bool const isLabelOnly = (reftype == "labelonly");
bool const usingRefStyle = buffer().params().use_refstyle;
bool const isFormatted = (reftype == "formatted");
bool const isLabelOnly = (reftype == "labelonly");
bool const usingRefStyle = buffer().params().use_refstyle;
- pluralCB->setEnabled(isFormatted && usingRefStyle);
- capsCB->setEnabled(isFormatted && usingRefStyle);
- noprefixCB->setEnabled(isLabelOnly);
+ bool const intext = bufferview()->cursor().inTexted();
+ bool const hyper_on = buffer().params().pdfoptions().use_hyperref;
+ pluralCB->setEnabled(intext && isFormatted && usingRefStyle);
+ capsCB->setEnabled(intext && isFormatted && usingRefStyle);
+ noprefixCB->setEnabled(intext && isLabelOnly);
+ // disabling of hyperlinks not supported by formatted references
+ nolinkCB->setEnabled(hyper_on && intext && !isFormatted && !isLabelOnly);
typeCO->addItem(qt_("<reference>"), "ref");
typeCO->addItem(qt_("(<reference>)"), "eqref");
typeCO->addItem(qt_("<page>"), "pageref");
typeCO->addItem(qt_("on page <page>"), "vpageref");
typeCO->addItem(qt_("<reference> on page <page>"), "vref");
typeCO->addItem(qt_("Textual reference"), "nameref");
typeCO->addItem(qt_("<reference>"), "ref");
typeCO->addItem(qt_("(<reference>)"), "eqref");
typeCO->addItem(qt_("<page>"), "pageref");
typeCO->addItem(qt_("on page <page>"), "vpageref");
typeCO->addItem(qt_("<reference> on page <page>"), "vref");
typeCO->addItem(qt_("Textual reference"), "nameref");
- if (bufferview()->cursor().inTexted()) {
- typeCO->addItem(qt_("Formatted reference"), "formatted");
- typeCO->addItem(qt_("Label only"), "labelonly");
- } else
- typeCO->addItem(qt_("Formatted reference"), "prettyref");
+ typeCO->addItem(qt_("Formatted reference"), "formatted");
+ typeCO->addItem(qt_("Label only"), "labelonly");
pluralCB->setChecked(params_["plural"] == "true");
capsCB->setChecked(params_["caps"] == "true");
noprefixCB->setChecked(params_["noprefix"] == "true");
pluralCB->setChecked(params_["plural"] == "true");
capsCB->setChecked(params_["caps"] == "true");
noprefixCB->setChecked(params_["noprefix"] == "true");
from_ascii("true") : from_ascii("false");
params_["noprefix"] = noprefixCB->isChecked() ?
from_ascii("true") : from_ascii("false");
from_ascii("true") : from_ascii("false");
params_["noprefix"] = noprefixCB->isChecked() ?
from_ascii("true") : from_ascii("false");
+inline bool caseInsensitiveLessThanVec(std::tuple<QString, QString, QString> const & s1, std::tuple<QString, QString, QString> const & s2)
+{
+ return std::get<0>(s1).toLower() < std::get<0>(s2).toLower();
+}
+
inline bool caseInsensitiveLessThan(QString const & s1, QString const & s2)
{
return s1.toLower() < s2.toLower();
inline bool caseInsensitiveLessThan(QString const & s1, QString const & s2)
{
return s1.toLower() < s2.toLower();
- QStringList refsStrings;
+ // Plain label, GUI string, and dereferenced string.
+ // This might get resorted below
+ QVector<std::tuple<QString, QString,QString>> refsNames;
+ // List of categories (prefixes)
- QString const lab = toqstr(*iter);
- refsStrings.append(lab);
+ // first: plain label name, second: gui name, third: pretty name
+ QString const lab = toqstr(std::get<0>(*iter));
+ refsNames.append({lab, toqstr(std::get<1>(*iter)),
+ toqstr(std::get<2>(*iter))});
sort(refsCategories.begin(), refsCategories.end(),
caseInsensitiveLessThan /*defined above*/);
if (noprefix)
sort(refsCategories.begin(), refsCategories.end(),
caseInsensitiveLessThan /*defined above*/);
if (noprefix)
QString const sort_method = sortingCO->isEnabled() ?
sortingCO->itemData(sortingCO->currentIndex()).toString()
: QString();
QString const sort_method = sortingCO->isEnabled() ?
sortingCO->itemData(sortingCO->currentIndex()).toString()
: QString();
- sort(refsStrings.begin(), refsStrings.end(),
- caseInsensitiveLessThan /*defined above*/);
+ sort(refsNames.begin(), refsNames.end(),
+ caseInsensitiveLessThanVec /*defined above*/);
if ((ref.startsWith(cat + QString(":")))
|| (cat == qt_("<No prefix>")
&& (!ref.mid(1).contains(":") || ref.left(1).contains(":")))) {
QTreeWidgetItem * child =
new QTreeWidgetItem(item);
if ((ref.startsWith(cat + QString(":")))
|| (cat == qt_("<No prefix>")
&& (!ref.mid(1).contains(":") || ref.left(1).contains(":")))) {
QTreeWidgetItem * child =
new QTreeWidgetItem(item);
- child->setText(0, ref);
+ QString const val = std::get<1>(refsNames.at(j));
+ QString const pretty = std::get<2>(refsNames.at(j));
+ child->setText(0, val);
+ child->setData(0, Qt::UserRole, ref);
+ child->setText(1, pretty);
- item->setText(0, refsStrings.at(i));
+ QString const ref = std::get<0>(refsNames.at(i));
+ QString const val = std::get<1>(refsNames.at(i));
+ QString const pretty = std::get<2>(refsNames.at(i));
+ item->setText(0, val);
+ item->setData(0, Qt::UserRole, ref);
+ item->setText(1, pretty);
{
std::string const lfun = InsetCommand::params2string(params_);
dispatch(FuncRequest(getLfun(), lfun));
{
std::string const lfun = InsetCommand::params2string(params_);
dispatch(FuncRequest(getLfun(), lfun));