1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

[WebView] Added new conetxt menu action for translating page

Also added icon for W3Validator.

Closes #860
This commit is contained in:
nowrep 2013-12-24 14:55:43 +01:00
parent 23d402a12b
commit 5af425aecc
3 changed files with 9 additions and 2 deletions

View File

@ -74,5 +74,6 @@
<file>icons/other/notification.png</file>
<file>icons/browsers/internet-explorer.png</file>
<file>icons/sites/startpage.png</file>
<file>icons/sites/w3.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

View File

@ -943,11 +943,17 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
menu->addSeparator();
menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll()));
menu->addSeparator();
if (url().scheme() == QLatin1String("http") || url().scheme() == QLatin1String("https")) {
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));
const QUrl &w3url = QUrl::fromEncoded("http://validator.w3.org/check?uri=" + QUrl::toPercentEncoding(url().toEncoded()));
menu->addAction(QIcon(":icons/sites/w3.png"), tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData(w3url);
QByteArray langCode = mApp->currentLanguageFile().left(2).toUtf8();
const QUrl &gturl = QUrl::fromEncoded("http://translate.google.com/translate?sl=auto&tl=" + langCode + "&u=" + QUrl::toPercentEncoding(url().toEncoded()));
menu->addAction(QIcon(":icons/sites/translate.png"), tr("Translate page"), this, SLOT(openUrlInSelectedTab()))->setData(gturl);
}
menu->addSeparator();
menu->addAction(QIcon::fromTheme("text-html"), tr("Show so&urce code"), this, SLOT(showSource()));
menu->addAction(QIcon::fromTheme("dialog-information"), tr("Show info ab&out site"), this, SLOT(showSiteInfo()));
}