]> git.lyx.org Git - features.git/commitdiff
Fixed focusing issue when dialog already open on lyx start,
authorTommaso Cucinotta <tommaso@lyx.org>
Wed, 2 Feb 2011 08:55:59 +0000 (08:55 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Wed, 2 Feb 2011 08:55:59 +0000 (08:55 +0000)
and added selection of entire find/replace WAs when switching
among them on Tab/Alt+Tab.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37413 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/FindAndReplace.cpp

index 46e4989fd2e7686f778bcc971087a819c1224390..fa79c3fe0dbd9e1a51849eac11ba2f4ec421f3ec 100644 (file)
@@ -79,6 +79,7 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view)
        replace_work_area_->setFrameStyle(QFrame::StyledPanel);
 
        // We don't want two cursors blinking.
+       find_work_area_->stopBlinkingCursor();
        replace_work_area_->stopBlinkingCursor();
 }
 
@@ -119,6 +120,9 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
                        if (obj == find_work_area_){
                                LYXERR(Debug::FIND, "Focusing replace WA");
                                replace_work_area_->setFocus();
+                               LYXERR(Debug::FIND, "Selecting entire replace buffer");
+                               dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
+                               dispatch(FuncRequest(LFUN_BUFFER_END_SELECT));
                                return true;
                        }
                }
@@ -128,6 +132,9 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
                if (obj == replace_work_area_) {
                        LYXERR(Debug::FIND, "Focusing find WA");
                        find_work_area_->setFocus();
+                       LYXERR(Debug::FIND, "Selecting entire find buffer");
+                       dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
+                       dispatch(FuncRequest(LFUN_BUFFER_END_SELECT));
                        return true;
                }
                break;
@@ -525,6 +532,7 @@ void FindAndReplaceWidget::on_replaceallPB_clicked()
 
 void FindAndReplaceWidget::showEvent(QShowEvent * /* ev */)
 {
+       LYXERR(Debug::DEBUG, "showEvent()" << endl);
        BufferView * bv = view_.documentBufferView();
        if (bv) {
                Buffer & doc_buf = bv->buffer();
@@ -541,14 +549,15 @@ void FindAndReplaceWidget::showEvent(QShowEvent * /* ev */)
                FuncRequest cmd(LFUN_LANGUAGE, lang);
                find_buf.text().dispatch(find_work_area_->bufferView().cursor(), cmd);
                replace_buf.text().dispatch(replace_work_area_->bufferView().cursor(), cmd);
-
-               view_.setCurrentWorkArea(find_work_area_);
-               LYXERR(Debug::FIND, "Selecting entire find buffer");
-               dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
-               dispatch(FuncRequest(LFUN_BUFFER_END_SELECT));
        }
+
        find_work_area_->installEventFilter(this);
        replace_work_area_->installEventFilter(this);
+
+       view_.setCurrentWorkArea(find_work_area_);
+       LYXERR(Debug::FIND, "Selecting entire find buffer");
+       dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
+       dispatch(FuncRequest(LFUN_BUFFER_END_SELECT));
 }