From 119090c28c82676ab99c6078de7bbf1eae856f1c Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 20 Feb 2012 18:28:09 +0100 Subject: [PATCH] Fixed showing edit context menu on gmail.com --- plugins/TestPlugin/testplugin.cpp | 3 +-- src/network/qupzillaschemehandler.cpp | 20 ++++++++++---------- src/webview/webview.cpp | 12 +++++++----- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/plugins/TestPlugin/testplugin.cpp b/plugins/TestPlugin/testplugin.cpp index 2c9d81e35..cd9036083 100644 --- a/plugins/TestPlugin/testplugin.cpp +++ b/plugins/TestPlugin/testplugin.cpp @@ -87,8 +87,7 @@ void TestPlugin::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitTe title += " on link"; } - QWebElement element = r.element(); - if (!element.isNull() && (element.tagName().toLower() == "input" || element.tagName().toLower() == "textarea")) { + if (r.isContentEditable()) { title += " on input"; } diff --git a/src/network/qupzillaschemehandler.cpp b/src/network/qupzillaschemehandler.cpp index 169800531..dbaf9bf23 100644 --- a/src/network/qupzillaschemehandler.cpp +++ b/src/network/qupzillaschemehandler.cpp @@ -185,10 +185,10 @@ QString QupZillaSchemeReply::aboutPage() aPage.replace("%VERSION-INFO%", QString("
%1
%2
").arg(tr("Version"), QupZilla::VERSION - #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" - #endif - ) + +#ifdef GIT_REVISION + + " (" + GIT_REVISION + ")" +#endif + ) + QString("
%1
%2
").arg(tr("WebKit version"), QupZilla::WEBKITVERSION)); aPage.replace("%MAIN-DEVELOPER%", tr("Main developer")); aPage.replace("%MAIN-DEVELOPER-TEXT%", authorString(QupZilla::AUTHOR.toUtf8(), "nowrep@gmail.com")); @@ -199,7 +199,7 @@ QString QupZillaSchemeReply::aboutPage() authorString("Mariusz Fik", "fisiu@opensuse.org") + "
" + authorString("Jan Rajnoha", "honza.rajny@hotmail.com") + "
" + authorString("Daniele Cocca", "jmc@chakra-project.org") - ); + ); aPage.replace("%TRANSLATORS%", tr("Translators")); aPage.replace("%TRANSLATORS-TEXT%", authorString("Heimen Stoffels", "vistausss@gmail.com") + " (Dutch)
" + @@ -221,7 +221,7 @@ QString QupZillaSchemeReply::aboutPage() authorString("Mladen Pejaković", "pejakm@gmail.com") + " (Serbian)
" + authorString("Unink-Lio", "unink4451@163.com") + " (Chinese)
" + authorString("Wu Cheng-Hong", "stu2731652@gmail.com") + " (Traditional Chinese)" - ); + ); } return aPage; @@ -316,10 +316,10 @@ QString QupZillaSchemeReply::configPage() cPage.replace("%VERSION-INFO%", QString("
%1
%2
").arg(tr("Application version"), QupZilla::VERSION - #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" - #endif - ) + +#ifdef GIT_REVISION + + " (" + GIT_REVISION + ")" +#endif + ) + QString("
%1
%2
").arg(tr("Qt version"), QT_VERSION_STR) + QString("
%1
%2
").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) + QString("
%1
%2
").arg(tr("Build time"), QupZilla::BUILDTIME) + diff --git a/src/webview/webview.cpp b/src/webview/webview.cpp index 1bc7baf93..010239c41 100644 --- a/src/webview/webview.cpp +++ b/src/webview/webview.cpp @@ -511,8 +511,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c createMediaContextMenu(menu, hitTest); } - QWebElement element = hitTest.element(); - if (!element.isNull() && (element.tagName().toLower() == "input" || element.tagName().toLower() == "textarea")) { + if (hitTest.isContentEditable()) { if (menu->isEmpty()) { QMenu* pageMenu = page()->createStandardContextMenu(); @@ -523,9 +522,12 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c continue; } - // Hiding double Direction menu (bug in QtWebKit 2.2) - if (i == 0 && act->menu()) { - act->setVisible(false); + // Hiding double Direction + Fonts menu (bug in QtWebKit 2.2) + if (i <= 1 && act->menu()) { + if (act->menu()->actions().contains(pageAction(QWebPage::SetTextDirectionDefault)) || + act->menu()->actions().contains(pageAction(QWebPage::ToggleBold))) { + act->setVisible(false); + } } menu->addAction(act);