]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiSearch.cpp
Properly track the lifetime of signals2::slots (#8261)
[lyx.git] / src / frontends / qt4 / GuiSearch.cpp
index b6c7cc74006c8a30a7aa6545c6a919ada5be8f33..411ba2ef10eda0c98536a1aaba5f80ff20c7bc84 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 <QCloseEvent>
 #include <QLineEdit>
 #include <QShowEvent>
 
@@ -34,7 +38,7 @@ static void uniqueInsert(QComboBox * box, QString const & text)
                if (box->itemText(i) == text)
                        return;
 
-       box->addItem(text);
+       box->insertItem(0, text);
 }
 
 
@@ -65,18 +69,12 @@ GuiSearch::GuiSearch(GuiView & lv)
 
 void GuiSearch::showEvent(QShowEvent * e)
 {
+       findPB->setFocus();
        findCO->lineEdit()->selectAll();
        GuiDialog::showEvent(e);
 }
 
 
-void GuiSearch::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       GuiDialog::closeEvent(e);
-}
-
-
 void GuiSearch::findChanged()
 {
        if (findCO->currentText().isEmpty()) {
@@ -136,11 +134,12 @@ void GuiSearch::replace(docstring const & search, docstring const & replace,
                            bool forward, bool all)
 {
        docstring const data =
-               replace2string(search, replace, casesensitive,
+               replace2string(replace, search, casesensitive,
                                     matchword, all, forward);
        dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
 }
 
+
 Dialog * createGuiSearch(GuiView & lv) { return new GuiSearch(lv); }
 
 
@@ -148,4 +147,4 @@ Dialog * createGuiSearch(GuiView & lv) { return new GuiSearch(lv); }
 } // namespace lyx
 
 
-#include "GuiSearch_moc.cpp"
+#include "moc_GuiSearch.cpp"