]> git.lyx.org Git - features.git/commitdiff
Fix initial focus problem with outline and view-source panes.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 9 Jun 2008 14:52:38 +0000 (14:52 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 9 Jun 2008 14:52:38 +0000 (14:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25213 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/Dialog.cpp
src/frontends/qt4/Dialog.h
src/frontends/qt4/GuiToc.h
src/frontends/qt4/GuiViewSource.h

index 7a150fb44891a54f0481bb322c5ccdcba79667a6..801abd2ef8c684c00f9e826da3c53ed1f4463300 100644 (file)
@@ -187,7 +187,10 @@ void Dialog::showView()
        } else
                w->show();
 
-       w->setFocus();
+       if (wantInitialFocus())
+               w->setFocus();
+       else
+               lyxview_->setFocus();
 }
 
 
index 8bf7420ed1f714b0e8e99dc023ecc3ddb5f644b1..45afb388d7e363e0329ce883d5cead56ee3720f6 100644 (file)
@@ -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;
 
index 2031465613b8aa5854c527ed181a67df3139d681..5007fe5636fecb7984afb868e309970b11af669f 100644 (file)
@@ -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.
index 9f460aa105443ddd38904b784e2602f7ccad4e3c..be476471b2d74bb8c75faf557d229066b6bb82ea 100644 (file)
@@ -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.