]> git.lyx.org Git - features.git/commitdiff
Moving the GUI consistency update to a more meaningful moment, i.e., when Dialog...
authorTommaso Cucinotta <tommaso@lyx.org>
Fri, 30 Dec 2011 21:26:51 +0000 (21:26 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Fri, 30 Dec 2011 21:26:51 +0000 (21:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40549 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/FindAndReplace.cpp
src/frontends/qt4/FindAndReplace.h

index 49753a639f398b625c51a301ef9cd583499e6a10..1d2a81d4f68cf02833788af60107d6bddf377035 100644 (file)
@@ -67,11 +67,6 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view)
 
 bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
 {
-       bool replace_enabled = view_.documentBufferView() && !view_.documentBufferView()->buffer().isReadonly();
-       replace_work_area_->setEnabled(replace_enabled);
-       replacePB->setEnabled(replace_enabled);
-       replaceallPB->setEnabled(replace_enabled);
-
        if (event->type() != QEvent::KeyPress
                  || (obj != find_work_area_ && obj != replace_work_area_))
                return QWidget::eventFilter(obj, event);
@@ -530,6 +525,12 @@ bool FindAndReplaceWidget::initialiseParams(std::string const & /*params*/)
 }
 
 
+void FindAndReplace::updateView()
+{
+       widget_->updateGUI();
+}
+
+
 FindAndReplace::FindAndReplace(GuiView & parent,
                Qt::DockWidgetArea area, Qt::WindowFlags flags)
        : DockView(parent, "findreplaceadv", qt_("Advanced Find and Replace"),
@@ -554,6 +555,16 @@ bool FindAndReplace::initialiseParams(std::string const & params)
 }
 
 
+void FindAndReplaceWidget::updateGUI()
+{
+       bool replace_enabled = view_.documentBufferView()
+               && !view_.documentBufferView()->buffer().isReadonly();
+       replace_work_area_->setEnabled(replace_enabled);
+       replacePB->setEnabled(replace_enabled);
+       replaceallPB->setEnabled(replace_enabled);
+}
+
+
 Dialog * createGuiSearchAdv(GuiView & lv)
 {
        FindAndReplace * gui = new FindAndReplace(lv, Qt::RightDockWidgetArea);
index cdb244936832f8d30cdf54b7867d5f8abc6c0c85..d2eaf4c1a166c3fcdf83ca498bdd19faad0c54d8 100644 (file)
@@ -39,6 +39,7 @@ class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
 public:
        FindAndReplaceWidget(GuiView & view);
        bool initialiseParams(std::string const & params);
+       void updateGUI();
 
 private:
        ///
@@ -90,7 +91,7 @@ public:
        void selectAll();
 
        /// update
-       void updateView() {}
+       void updateView();
        //virtual void update_contents() {}
 
 protected: