Moving the GUI consistency update to a more meaningful moment, i.e., when Dialog::updateView() is called.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40549 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Tommaso Cucinotta 2011-12-30 21:26:51 +00:00
parent 7422c56d67
commit 6f0cc0cecd
2 changed files with 18 additions and 6 deletions

View File

@ -67,11 +67,6 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view)
bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event) 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 if (event->type() != QEvent::KeyPress
|| (obj != find_work_area_ && obj != replace_work_area_)) || (obj != find_work_area_ && obj != replace_work_area_))
return QWidget::eventFilter(obj, event); 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, FindAndReplace::FindAndReplace(GuiView & parent,
Qt::DockWidgetArea area, Qt::WindowFlags flags) Qt::DockWidgetArea area, Qt::WindowFlags flags)
: DockView(parent, "findreplaceadv", qt_("Advanced Find and Replace"), : 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) Dialog * createGuiSearchAdv(GuiView & lv)
{ {
FindAndReplace * gui = new FindAndReplace(lv, Qt::RightDockWidgetArea); FindAndReplace * gui = new FindAndReplace(lv, Qt::RightDockWidgetArea);

View File

@ -39,6 +39,7 @@ class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
public: public:
FindAndReplaceWidget(GuiView & view); FindAndReplaceWidget(GuiView & view);
bool initialiseParams(std::string const & params); bool initialiseParams(std::string const & params);
void updateGUI();
private: private:
/// ///
@ -90,7 +91,7 @@ public:
void selectAll(); void selectAll();
/// update /// update
void updateView() {} void updateView();
//virtual void update_contents() {} //virtual void update_contents() {}
protected: protected: