]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiSearch.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiSearch.cpp
index 5564ac567d7dcb91917a999bd2006227db17412e..4e0c354fc60efe4164691e3f3a9f36807e47c857 100644 (file)
 
 #include <config.h>
 
-#include "GuiSearch.h"
-
+#include "lyxfind.h"
 #include "qt_helpers.h"
-
 #include "FuncRequest.h"
-#include "lyxfind.h"
+#include "BufferView.h"
+#include "Buffer.h"
+#include "Cursor.h"
+#include "GuiSearch.h"
+#include "GuiView.h"
+
+#include "support/gettext.h"
+#include "frontends/alert.h"
 
 #include <QLineEdit>
 #include <QShowEvent>
@@ -33,7 +38,7 @@ static void uniqueInsert(QComboBox * box, QString const & text)
                if (box->itemText(i) == text)
                        return;
 
-       box->addItem(text);
+       box->insertItem(0, text);
 }
 
 
@@ -42,7 +47,14 @@ GuiSearch::GuiSearch(GuiView & lv)
 {
        setupUi(this);
 
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
+       // fix height to minimum
+       setFixedHeight(sizeHint().height());
+
+       // align items in grid on top
+       mainGridLayout->setAlignment(Qt::AlignTop);
+
+       connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+               this, SLOT(slotButtonBox(QAbstractButton *)));
        connect(findPB, SIGNAL(clicked()), this, SLOT(findClicked()));
        connect(replacePB, SIGNAL(clicked()), this, SLOT(replaceClicked()));
        connect(replaceallPB, SIGNAL(clicked()), this, SLOT(replaceallClicked()));
@@ -52,7 +64,7 @@ GuiSearch::GuiSearch(GuiView & lv)
        setFocusProxy(findCO);
 
        bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
-       bc().setCancel(closePB);
+       bc().setCancel(buttonBox->button(QDialogButtonBox::Close));
        bc().addReadOnly(replaceCO);
        bc().addReadOnly(replacePB);
        bc().addReadOnly(replaceallPB);
@@ -118,9 +130,9 @@ void GuiSearch::replaceallClicked()
 void GuiSearch::find(docstring const & search, bool casesensitive,
                         bool matchword, bool forward)
 {
-       docstring const data =
+       docstring const sdata =
                find2string(search, casesensitive, matchword, forward);
-       dispatch(FuncRequest(LFUN_WORD_FIND, data));
+       dispatch(FuncRequest(LFUN_WORD_FIND, sdata));
 }
 
 
@@ -128,12 +140,13 @@ void GuiSearch::replace(docstring const & search, docstring const & replace,
                            bool casesensitive, bool matchword,
                            bool forward, bool all)
 {
-       docstring const data =
-               replace2string(search, replace, casesensitive,
+       docstring const sdata =
+               replace2string(replace, search, casesensitive,
                                     matchword, all, forward);
-       dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
+       dispatch(FuncRequest(LFUN_WORD_REPLACE, sdata));
 }
 
+
 Dialog * createGuiSearch(GuiView & lv) { return new GuiSearch(lv); }
 
 
@@ -141,4 +154,4 @@ Dialog * createGuiSearch(GuiView & lv) { return new GuiSearch(lv); }
 } // namespace lyx
 
 
-#include "GuiSearch_moc.cpp"
+#include "moc_GuiSearch.cpp"