Permalink
Browse files

Regression: Fix "can't go up/down the list of suggestions" bug introd…

…uced while fixing "sync between currently active article and the 'found in dictionaries' pane for web dictionaries" bug. See other focusReasons at http://doc.qt.nokia.com/4.7-snapshot/qt.html#FocusReason-enum
  • Loading branch information...
1 parent e362b4d commit f5cd1502012a4a23def9798c46d46d9b9b81a890 @chulai chulai committed Sep 3, 2011
Showing with 19 additions and 1 deletion.
  1. +1 −1 article_maker.cc
  2. +17 −0 articlewebview.cc
  3. +1 −0 articlewebview.hh
View
@@ -101,7 +101,7 @@ std::string ArticleMaker::makeHtmlHeader( QString const & word,
"function processIframeMouseOut() { overIframeId = null; top.focus(); }"
"function processIframeMouseOver( newId ) { overIframeId = newId; }"
"function processIframeClick() { if( overIframeId != null ) { overIframeId = overIframeId.replace( 'gdexpandframe-', '' ); gdMakeArticleActive( overIframeId ) } }"
- "function init() { window.addEventListener('blur', processIframeClick, false); top.focus(); }"
+ "function init() { window.addEventListener('blur', processIframeClick, false); }"
"window.addEventListener('load', init, false);"
"</script>";
View
@@ -38,3 +38,20 @@ void ArticleWebView::mouseDoubleClickEvent( QMouseEvent * event )
}
}
+
+void ArticleWebView::focusInEvent( QFocusEvent * event )
+{
+ QWebView::focusInEvent( event );
+
+ switch( event->reason() )
+ {
+ case Qt::MouseFocusReason:
+ case Qt::TabFocusReason:
+ case Qt::BacktabFocusReason:
+ page()->mainFrame()->evaluateJavaScript("top.focus();");
+ break;
+
+ default:
+ break;
+ }
+}
View
@@ -38,6 +38,7 @@ protected:
void mousePressEvent( QMouseEvent * event );
void mouseReleaseEvent( QMouseEvent * event );
void mouseDoubleClickEvent( QMouseEvent * event );
+ void focusInEvent( QFocusEvent * event );
private:

0 comments on commit f5cd150

Please sign in to comment.