]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiSearch.cpp
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / GuiSearch.cpp
index 5564ac567d7dcb91917a999bd2006227db17412e..dd1a002fed95990f038070484ed845d2c4a93673 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,8 @@ GuiSearch::GuiSearch(GuiView & lv)
 {
        setupUi(this);
 
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
+       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 +58,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 +124,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 +134,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 +148,4 @@ Dialog * createGuiSearch(GuiView & lv) { return new GuiSearch(lv); }
 } // namespace lyx
 
 
-#include "GuiSearch_moc.cpp"
+#include "moc_GuiSearch.cpp"