From eb1f4f590d5592897c6a750afd9c5f6b9d55b443 Mon Sep 17 00:00:00 2001 From: nowrep Date: Thu, 26 Dec 2013 21:26:30 +0100 Subject: [PATCH] [WebView] Fixed GoogleTranslate urls --- src/lib/webview/webview.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 4c246a9cc..e241f1bfc 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -948,7 +948,7 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) 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(); + QByteArray langCode = mApp->currentLanguage().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); } @@ -1019,13 +1019,14 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText); menu->addSeparator(); - QString langCode = mApp->currentLanguageFile().left(2); - QUrl googleTranslateUrl = QUrl(QString("http://translate.google.com/#auto|%1|%2").arg(langCode, selectedText)); + QString langCode = mApp->currentLanguage().left(2).toUtf8(); + QUrl googleTranslateUrl = QUrl(QString("http://translate.google.com/#auto/%1/%2").arg(langCode, selectedText)); Action* gtwact = new Action(QIcon(":icons/sites/translate.png"), tr("Google Translate")); gtwact->setData(googleTranslateUrl); connect(gtwact, SIGNAL(triggered()), this, SLOT(openUrlInSelectedTab())); connect(gtwact, SIGNAL(middleClicked()), this, SLOT(openUrlInBackgroundTab())); menu->addAction(gtwact); + Action* dictact = new Action(QIcon::fromTheme("accessories-dictionary"), tr("Dictionary")); dictact->setData(QUrl("http://" + (!langCode.isEmpty() ? langCode + "." : langCode) + "wiktionary.org/wiki/Special:Search?search=" + selectedText)); connect(dictact, SIGNAL(triggered()), this, SLOT(openUrlInSelectedTab()));