From 53b31ea912895de2841e944da074801bf38dbdc4 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 23 Feb 2013 17:21:33 +0100 Subject: [PATCH] Fixed copying url with special characters into clipboard. Also properly encode url for loading in W3 validator. Followup to #762 --- src/lib/webview/webview.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 34cf1ec71..c7cdb2041 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -475,7 +475,7 @@ void WebView::sendPageByMail() void WebView::copyLinkToClipboard() { if (QAction* action = qobject_cast(sender())) { - QApplication::clipboard()->setText(action->data().toString()); + QApplication::clipboard()->setText(action->data().toUrl().toEncoded()); } } @@ -912,9 +912,8 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll())); menu->addSeparator(); if (url().scheme() == QLatin1String("http") || url().scheme() == QLatin1String("https")) { -// bool result = validateConfirm(tr("Do you want to upload this page to an online source code validator?")); -// if (result) - menu->addAction(tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData(QUrl("http://validator.w3.org/check?uri=" + url().toString())); + const QByteArray &w3url = "http://validator.w3.org/check?uri=" + QUrl::toPercentEncoding(url().toEncoded()); + menu->addAction(tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData(QUrl::fromEncoded(w3url)); } menu->addAction(QIcon::fromTheme("text-html"), tr("Show so&urce code"), this, SLOT(showSource()));