From: Abdelrazak Younes Date: Mon, 9 Jun 2008 14:52:38 +0000 (+0000) Subject: Fix initial focus problem with outline and view-source panes. X-Git-Tag: 1.6.10~4433 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=42cb86adb9cff335c9735b2b3526336dd0366638;p=features.git Fix initial focus problem with outline and view-source panes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25213 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/Dialog.cpp b/src/frontends/qt4/Dialog.cpp index 7a150fb448..801abd2ef8 100644 --- a/src/frontends/qt4/Dialog.cpp +++ b/src/frontends/qt4/Dialog.cpp @@ -187,7 +187,10 @@ void Dialog::showView() } else w->show(); - w->setFocus(); + if (wantInitialFocus()) + w->setFocus(); + else + lyxview_->setFocus(); } diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h index 8bf7420ed1..45afb388d7 100644 --- a/src/frontends/qt4/Dialog.h +++ b/src/frontends/qt4/Dialog.h @@ -124,6 +124,11 @@ public: /// Create the dialog if necessary, update it and display it. void showView(); + /// Decide wether the dialog should grab thekeyboard focus when shown. + /// This method defaults to true, override if a different behaviour + /// is wanted. + virtual bool wantInitialFocus() const { return true; } + /// Update the display of the dialog whilst it is still visible. virtual void updateView() = 0; diff --git a/src/frontends/qt4/GuiToc.h b/src/frontends/qt4/GuiToc.h index 2031465613..5007fe5636 100644 --- a/src/frontends/qt4/GuiToc.h +++ b/src/frontends/qt4/GuiToc.h @@ -48,6 +48,7 @@ public: bool initialiseParams(std::string const & data); void updateView(); void enableView(bool enable); + bool wantInitialFocus() const { return false; } public: /// clean-up on hide. diff --git a/src/frontends/qt4/GuiViewSource.h b/src/frontends/qt4/GuiViewSource.h index 9f460aa105..be476471b2 100644 --- a/src/frontends/qt4/GuiViewSource.h +++ b/src/frontends/qt4/GuiViewSource.h @@ -77,6 +77,7 @@ public: void enableView(bool enable); void saveSession() const; void restoreSession(); + bool wantInitialFocus() const { return false; } ///@} /// The title displayed by the dialog reflects source type.