]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDelimiter.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiDelimiter.cpp
index 0d7ad5d219aff74912db2f268a47c1c2aa257d62..8dc97ffe17bdf186d1aeb3214a8b975032546fdf 100644 (file)
@@ -177,7 +177,7 @@ string getDelimiterName(QListWidgetItem const * lwi)
 }
 
 
-} // anon namespace
+} // namespace
 
 
 GuiDelimiter::GuiDelimiter(GuiView & lv)
@@ -185,7 +185,7 @@ GuiDelimiter::GuiDelimiter(GuiView & lv)
 {
        setupUi(this);
 
-       connect(closePB, SIGNAL(clicked()), this, SLOT(accept()));
+       connect(buttonBox, SIGNAL(rejected()), this, SLOT(accept()));
 
        setFocusProxy(leftLW);
 
@@ -333,7 +333,25 @@ void GuiDelimiter::updateTeXCode(int size)
 }
 
 
-void GuiDelimiter::on_insertPB_clicked()
+void  GuiDelimiter::on_buttonBox_clicked(QAbstractButton * button)
+{
+       switch (buttonBox->standardButton(button)) {
+       case QDialogButtonBox::Apply:
+               insert();
+               break;
+       case QDialogButtonBox::Ok:
+               insert();
+       // fall through
+       case QDialogButtonBox::Cancel:
+               accept();
+               break;
+       default:
+               break;
+       }
+}
+
+
+void GuiDelimiter::insert()
 {
        if (sizeCO->currentIndex() == 0)
                dispatch(FuncRequest(LFUN_MATH_DELIM, tex_code_));
@@ -342,6 +360,7 @@ void GuiDelimiter::on_insertPB_clicked()
                command = support::subst(command, from_ascii(" "), from_ascii("\" \""));
                dispatch(FuncRequest(LFUN_MATH_BIGDELIM, command));
        }
+       buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("Close"));
 }
 
 
@@ -356,7 +375,7 @@ void GuiDelimiter::on_leftLW_itemActivated(QListWidgetItem *)
        // do not auto-apply if !matchCB->isChecked()
        if (!matchCB->isChecked())
                return;
-       on_insertPB_clicked();
+       insert();
        accept();
 }
 
@@ -366,7 +385,7 @@ void GuiDelimiter::on_rightLW_itemActivated(QListWidgetItem *)
        // do not auto-apply if !matchCB->isChecked()
        if (!matchCB->isChecked())
                return;
-       on_insertPB_clicked();
+       insert();
        accept();
 }