diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index 0117fb763..4aa48e58b 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -54,6 +54,7 @@ QString WebPage::m_lastUploadLocation = QDir::homePath(); QString WebPage::m_userAgent = QString(); +QString WebPage::m_fakeUserAgent = "Mozilla/5.0 (" + qz_buildSystem() + ") AppleWebKit/" + qWebKitVersion() + " (KHTML, like Gecko) Chrome/10.0 Safari/" + qWebKitVersion(); QUrl WebPage::m_lastUnsupportedUrl = QUrl(); WebPage::WebPage(QupZilla* mainClass) @@ -425,7 +426,7 @@ QString WebPage::userAgentForUrl(const QUrl &url) const { // Let Google services play nice with us if (url.host().contains("google")) { - return "Mozilla/5.0 " + qz_buildSystem() + " AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7"; + return m_fakeUserAgent; } if (m_userAgent.isEmpty()) { diff --git a/src/lib/webview/webpage.h b/src/lib/webview/webpage.h index 83bf841b3..b4b6c3cf5 100644 --- a/src/lib/webview/webpage.h +++ b/src/lib/webview/webpage.h @@ -106,6 +106,7 @@ private: static QString m_lastUploadLocation; static QString m_userAgent; + static QString m_fakeUserAgent; static QUrl m_lastUnsupportedUrl; QupZilla* p_QupZilla; diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 55741c0d3..34bbb21db 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -339,11 +339,17 @@ void WebView::openUrlInNewWindow() void WebView::sendLinkByMail() { if (QAction* action = qobject_cast(sender())) { - const QUrl &url = QUrl::fromEncoded("mailto:?body=" + QUrl::toPercentEncoding(action->data().toUrl().toEncoded())); - QDesktopServices::openUrl(url); + const QUrl &mailUrl = QUrl::fromEncoded("mailto:?body=" + QUrl::toPercentEncoding(action->data().toUrl().toEncoded())); + QDesktopServices::openUrl(mailUrl); } } +void WebView::sendPageByMail() +{ + const QUrl &mailUrl = QUrl::fromEncoded("mailto:?body=" + QUrl::toPercentEncoding(url().toEncoded()) + "&subject=" + QUrl::toPercentEncoding(title())); + QDesktopServices::openUrl(mailUrl); +} + void WebView::copyLinkToClipboard() { if (QAction* action = qobject_cast(sender())) { @@ -690,7 +696,7 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) menu->addAction(IconProvider::fromTheme("user-bookmarks"), tr("Book&mark page"), this, SLOT(bookmarkLink())); menu->addAction(QIcon::fromTheme("document-save"), tr("&Save page as..."), this, SLOT(downloadPage())); menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy page link"), this, SLOT(copyLinkToClipboard()))->setData(url()); - menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send page link..."), this, SLOT(sendLinkByMail()))->setData(url()); + menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send page link..."), this, SLOT(sendPageByMail())); menu->addAction(QIcon::fromTheme("document-print"), tr("&Print page"), this, SLOT(printPage())); menu->addSeparator(); menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll())); diff --git a/src/lib/webview/webview.h b/src/lib/webview/webview.h index 8d0b2d1e5..3d517b51d 100644 --- a/src/lib/webview/webview.h +++ b/src/lib/webview/webview.h @@ -81,6 +81,7 @@ protected slots: // Context menu slots void openUrlInNewWindow(); void sendLinkByMail(); + void sendPageByMail(); void copyLinkToClipboard(); void downloadPage(); void downloadUrlToDisk();