mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[WebView] Added new conetxt menu action for translating page
Also added icon for W3Validator. Closes #860
This commit is contained in:
parent
23d402a12b
commit
5af425aecc
@ -74,5 +74,6 @@
|
|||||||
<file>icons/other/notification.png</file>
|
<file>icons/other/notification.png</file>
|
||||||
<file>icons/browsers/internet-explorer.png</file>
|
<file>icons/browsers/internet-explorer.png</file>
|
||||||
<file>icons/sites/startpage.png</file>
|
<file>icons/sites/startpage.png</file>
|
||||||
|
<file>icons/sites/w3.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
src/lib/data/icons/sites/w3.png
Normal file
BIN
src/lib/data/icons/sites/w3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 593 B |
@ -943,11 +943,17 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
|
|||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll()));
|
menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll()));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
if (url().scheme() == QLatin1String("http") || url().scheme() == QLatin1String("https")) {
|
if (url().scheme() == QLatin1String("http") || url().scheme() == QLatin1String("https")) {
|
||||||
const QByteArray &w3url = "http://validator.w3.org/check?uri=" + QUrl::toPercentEncoding(url().toEncoded());
|
const QUrl &w3url = QUrl::fromEncoded("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(":icons/sites/w3.png"), tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData(w3url);
|
||||||
|
|
||||||
|
QByteArray langCode = mApp->currentLanguageFile().left(2).toUtf8();
|
||||||
|
const QUrl >url = 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("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()));
|
menu->addAction(QIcon::fromTheme("dialog-information"), tr("Show info ab&out site"), this, SLOT(showSiteInfo()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user