1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Send Page now also adds page title as a subject in mail.

- fixed setting fake user agent for google sites
This commit is contained in:
nowrep 2012-03-31 22:16:20 +02:00
parent aa6962f8cb
commit f0a686306e
4 changed files with 13 additions and 4 deletions

View File

@ -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()) {

View File

@ -106,6 +106,7 @@ private:
static QString m_lastUploadLocation;
static QString m_userAgent;
static QString m_fakeUserAgent;
static QUrl m_lastUnsupportedUrl;
QupZilla* p_QupZilla;

View File

@ -339,11 +339,17 @@ void WebView::openUrlInNewWindow()
void WebView::sendLinkByMail()
{
if (QAction* action = qobject_cast<QAction*>(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<QAction*>(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()));

View File

@ -81,6 +81,7 @@ protected slots:
// Context menu slots
void openUrlInNewWindow();
void sendLinkByMail();
void sendPageByMail();
void copyLinkToClipboard();
void downloadPage();
void downloadUrlToDisk();