X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiRef.cpp;h=5d46a471c710bb980c0c062085c8f3a480d405b5;hb=b91e2b99986c0f957ba27eeba74b5ae0460d73bc;hp=c07ce5ce87037c894a3f1813d9187cf2670001b2;hpb=47e85b37eb898ae5e1876e7b3dcd846956676d80;p=lyx.git diff --git a/src/frontends/qt4/GuiRef.cpp b/src/frontends/qt4/GuiRef.cpp index c07ce5ce87..5d46a471c7 100644 --- a/src/frontends/qt4/GuiRef.cpp +++ b/src/frontends/qt4/GuiRef.cpp @@ -76,13 +76,12 @@ GuiRef::GuiRef(GuiView & lv) sortingCO->addItem(qt_("Alphabetically (Case-Insensitive)"), "nocase"); sortingCO->addItem(qt_("Alphabetically (Case-Sensitive)"), "case"); + buttonBox->button(QDialogButtonBox::Reset)->setText(qt_("&Update")); + buttonBox->button(QDialogButtonBox::Reset)->setToolTip(qt_("Update the label list")); + refsTW->setColumnCount(1); refsTW->header()->setVisible(false); - connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); - connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); - connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); - connect(closePB, SIGNAL(clicked()), this, SLOT(resetDialog())); connect(this, SIGNAL(rejected()), this, SLOT(dialogRejected())); connect(typeCO, SIGNAL(activated(int)), @@ -111,8 +110,6 @@ GuiRef::GuiRef(GuiView & lv) this, SLOT(groupToggled())); connect(gotoPB, SIGNAL(clicked()), this, SLOT(gotoClicked())); - connect(updatePB, SIGNAL(clicked()), - this, SLOT(updateClicked())); connect(bufferCO, SIGNAL(activated(int)), this, SLOT(updateClicked())); connect(pluralCB, SIGNAL(clicked()), @@ -125,9 +122,9 @@ GuiRef::GuiRef(GuiView & lv) enableBoxes(); bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); - bc().setOK(okPB); - bc().setApply(applyPB); - bc().setCancel(closePB); + bc().setOK(buttonBox->button(QDialogButtonBox::Ok)); + bc().setApply(buttonBox->button(QDialogButtonBox::Apply)); + bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel)); bc().addReadOnly(typeCO); restored_buffer_ = -1; @@ -263,6 +260,28 @@ void GuiRef::groupToggled() } +void GuiRef::on_buttonBox_clicked(QAbstractButton * button) +{ + switch (buttonBox->standardButton(button)) { + case QDialogButtonBox::Ok: + slotOK(); + break; + case QDialogButtonBox::Apply: + slotApply(); + break; + case QDialogButtonBox::Cancel: + slotClose(); + resetDialog(); + break; + case QDialogButtonBox::Reset: + updateClicked(); + break; + default: + break; + } +} + + void GuiRef::updateClicked() { updateRefs(); @@ -309,9 +328,9 @@ void GuiRef::updateContents() typeCO->addItem(qt_(""), "pageref"); typeCO->addItem(qt_("on page "), "vpageref"); typeCO->addItem(qt_(" on page "), "vref"); + typeCO->addItem(qt_("Textual reference"), "nameref"); if (bufferview()->cursor().inTexted()) { typeCO->addItem(qt_("Formatted reference"), "formatted"); - typeCO->addItem(qt_("Textual reference"), "nameref"); typeCO->addItem(qt_("Label only"), "labelonly"); } else typeCO->addItem(qt_("Formatted reference"), "prettyref"); @@ -491,8 +510,8 @@ void GuiRef::redoRefs() QString const cat = refsCategories.at(i); QTreeWidgetItem * item = new QTreeWidgetItem(refsTW); item->setText(0, cat); - for (int i = 0; i < refsStrings.size(); ++i) { - QString const ref = refsStrings.at(i); + for (int j = 0; j < refsStrings.size(); ++j) { + QString const ref = refsStrings.at(j); if ((ref.startsWith(cat + QString(":"))) || (cat == qt_("") && (!ref.mid(1).contains(":") || ref.left(1).contains(":")))) { @@ -609,9 +628,9 @@ void GuiRef::resetFilter() } -bool GuiRef::initialiseParams(std::string const & data) +bool GuiRef::initialiseParams(std::string const & sdata) { - InsetCommand::string2params(data, params_); + InsetCommand::string2params(sdata, params_); return true; }