From 456a8d3e77294de44da86a4f31325e54f4e68098 Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 9 Jan 2012 16:45:36 +0100 Subject: [PATCH] Fixed go to web page + using google translate as dictionary provider. --- bin/locale/cs_CZ.qm | Bin 86603 -> 86660 bytes src/data/icons.qrc | 1 + src/data/icons/menu/translate.png | Bin 0 -> 597 bytes src/webview/webview.cpp | 29 +++++++++++++++++------------ translations/cs_CZ.ts | 22 +++++++++++++--------- translations/de_DE.ts | 24 ++++++++++++------------ translations/el_GR.ts | 24 ++++++++++++------------ translations/empty.ts | 24 ++++++++++++------------ translations/es_ES.ts | 24 ++++++++++++------------ translations/fr_FR.ts | 24 ++++++++++++------------ translations/it_IT.ts | 24 ++++++++++++------------ translations/nl_NL.ts | 24 ++++++++++++------------ translations/pl_PL.ts | 24 ++++++++++++------------ translations/pt_PT.ts | 24 ++++++++++++------------ translations/ru_RU.ts | 24 ++++++++++++------------ translations/sk_SK.ts | 4 ++-- translations/sr_BA.ts | 22 +++++++++++++--------- translations/sr_RS.ts | 22 +++++++++++++--------- translations/zh_CN.ts | 24 ++++++++++++------------ 19 files changed, 191 insertions(+), 173 deletions(-) create mode 100644 src/data/icons/menu/translate.png diff --git a/bin/locale/cs_CZ.qm b/bin/locale/cs_CZ.qm index 161bd075e2feb6c036dd2fb90291e998769a176e..6014c48bbcbc8d18d5bddc380b56ce696ca339a7 100644 GIT binary patch delta 342 zcmWNJJxBs^7>D2Yf8LqjnS~!9+^7UrR#u?6MAFodO(k{6Ws-WJ5;z4}Bos!xG)fRz zQzcyG5K&80R3H^JxEB<-xOc;Ec%BD-&!_x$oo^%=8{lrTpzqSnlMbUz85{U3nprqJCg z0qlJX-5L)V`lWlzB^z~7)_TT*AsVnnaY|jV*$~%MxpxNH$RJ(Vhp?))?M}pJ>h`S~ zhnYzylmRCc$~s=zxK)kxA8`0cFV15uP}UX065Y7YF-i${3?HcOzB5faIRJ1$7)0`Z zddn40v*N)Lmnip7BrTis5yU+_634A?{qp@ fOe;AlUlM&WMM-63F`k!lg^W~`{msQ$?DYHtJjP^& delta 267 zcmV+m0rdWar3K5R1+ZfR0yE5$WdgPWG0Kx213v+qvt0wP0Rd@~4F%5unX}ymUjqRH zlRXKMlhz5g0eiEJ3Qqw6CzIU^hXGuZWeh(71hb_K2LS<$ldTOG0kf0E4Xy$*-;;F? zrUEhjlN}E~0RXdI4-WwWFSBhBMgama@{_d@F9B7v~mI+JY}M*%>SwHT)X29sSGM*)VDr5U>m zH{JsP000;OJOCh*9o8L#h#I$u8Ue5_BMtyl0Bitn0CoUw0PO&42mk;800sa6018BD RV{~b6ZeenHx0Fc%@CXb=QVswB diff --git a/src/data/icons.qrc b/src/data/icons.qrc index 4bdfb1698..70ef115e8 100644 --- a/src/data/icons.qrc +++ b/src/data/icons.qrc @@ -68,5 +68,6 @@ icons/preferences/mail-inbox.png icons/preferences/preferences-system-firewall.png icons/browsers/html.png + icons/menu/translate.png diff --git a/src/data/icons/menu/translate.png b/src/data/icons/menu/translate.png new file mode 100644 index 0000000000000000000000000000000000000000..fddff6085866996efd0d9784e248c07c4e5d9757 GIT binary patch literal 597 zcmV-b0;>IqP)>UANyf!6lZ+&u)%QB*-gEE$1b}k!r$Gxet!S@n zdW8YskU$5x{w2o~aUMTib3DprK04mCLIijijq+`C6M#%M2Vn03Zq7_~;+p~%GT9t{ z-w}t9weJMMvhaRmgM0TMFn4PfuSa5jX^nm3cbYc#pj0W7)+M$IIsnRKk04qFI}abd0wr@ z9V81Q`xSa0x&A;XzGqB;9qoflEJ&Z zbagccZ%p2!UN`ulz`D{4z*OI7`(6MLZ-2EXt+sed5W=g*!7Jkcyg2&~uScS)S8bB2 z)wuTdFsWavX`!K-L(@=mxTa$UK>o=yMrEBox5%4qok&t7k`!6~VrDlnkZ)#SkpPUM z;;@vOKSm@e5-&H~`tn=~fD5sHY_sh|dP0Nd-GM_kxl#D-2+;PM3gK15Sh*|&m%kgO js`Dcnx@NDpZUlwDuxa3?a}JIF00000NkvXXu0mjf$RGv> literal 0 HcmV?d00001 diff --git a/src/webview/webview.cpp b/src/webview/webview.cpp index 60325d7a1..8a8683df2 100644 --- a/src/webview/webview.cpp +++ b/src/webview/webview.cpp @@ -545,7 +545,7 @@ void WebView::contextMenuEvent(QContextMenuEvent* event) if (url().scheme() == "http" || url().scheme() == "https") { // bool result = validateConfirm(tr("Do you want to upload this page to an online source code validator?")); // if (result) { - m_menu->addAction(tr("Validate page"), this, SLOT(openUrlInNewTab()))->setData("http://validator.w3.org/check?uri=" + url().toString()); + m_menu->addAction(tr("Validate page"), this, SLOT(openUrlInNewTab()))->setData("http://validator.w3.org/check?uri=" + url().toString()); // } } @@ -558,21 +558,26 @@ void WebView::contextMenuEvent(QContextMenuEvent* event) mApp->plugins()->populateWebViewMenu(m_menu, this, r); if (!selectedText().isEmpty()) { - m_menu->addAction(pageAction(QWebPage::Copy)); - m_menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText()); - m_menu->addSeparator(); QString selectedText = page()->selectedText(); - QString langCode = mApp->getActiveLanguage().left(2); - m_menu->addAction(tr("Dictionary"), this, SLOT(openUrlInNewTab()))->setData("http://" + (langCode != "" ? langCode + "." : langCode) + "wiktionary.org/wiki/Special:Search?search=" + selectedText); + + m_menu->addAction(pageAction(QWebPage::Copy)); + m_menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText); m_menu->addSeparator(); -// Doing this so that text strings without http:// like "google.com" can be loaded. However, -// there is no way (for now) not to display menu entry for addresses without domain name. - QString trimmedText = selectedText.trimmed(); - QString selectedTextUrl = (trimmedText.left(7) == "http://" || trimmedText.left(6) == "ftp://" || trimmedText.left(7) == "file://" ? trimmedText : "http://" + trimmedText); + QString langCode = mApp->getActiveLanguage().left(2); + QUrl googleTranslateUrl = QUrl(QString("http://translate.google.com/#auto|%1|%2").arg(langCode, selectedText)); + m_menu->addAction(QIcon(":icons/menu/translate.png"), tr("Dictionary (Google Translate)"), this, SLOT(openUrlInNewTab()))->setData(googleTranslateUrl); + m_menu->addSeparator(); - if ((selectedTextUrl.left(7) == "file://" || isUrlValid( QUrl(selectedTextUrl))) && selectedTextUrl.contains(QLatin1Char('.'))) { - m_menu->addAction(QIcon(":/icons/menu/popup.png"), tr("Go to &web address"), this, SLOT(openUrlInNewTab()))->setData(selectedTextUrl); + QString selectedString = selectedText.trimmed(); + if (!selectedString.contains(".")) { + // Try to add .com + selectedString.append(".com"); + } + QUrl guessedUrl = QUrl::fromUserInput(selectedString); + + if (isUrlValid(guessedUrl)) { + m_menu->addAction(QIcon(":/icons/menu/popup.png"), tr("Go to &web address"), this, SLOT(openUrlInNewTab()))->setData(guessedUrl); } selectedText.truncate(20); diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index c17a4483c..d58f2fbe8 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -4427,6 +4427,11 @@ Po přidání či odstranění cest k certifikátům je nutné k projevení změ Show info ab&out site Zobrazit &informace o stránce + + + Dictionary (Google Translate) + Slovník (Google Translate) + Show Web &Inspector @@ -4479,34 +4484,33 @@ Po přidání či odstranění cest k certifikátům je nutné k projevení změ Zobrazit zdrojový kó&d - + Send text... Odeslat text... - Dictionary - Slovník + Slovník - + Go to &web address Přejít na web&ovou adresu - + Search "%1 .." with %2 Hledat "%1 .." s %2 - + No Named Page Bezejmenná stránka - - - + + + New tab Nový panel diff --git a/translations/de_DE.ts b/translations/de_DE.ts index c69280963..cdf045da9 100644 --- a/translations/de_DE.ts +++ b/translations/de_DE.ts @@ -4428,6 +4428,11 @@ Nachdem Speicherpfade hinzugefügt oder gelöscht wurden, muss QupZilla neu gest Show info ab&out site S&eiteninformationen anzeigen + + + Dictionary (Google Translate) + + Show Web &Inspector @@ -4480,34 +4485,29 @@ Nachdem Speicherpfade hinzugefügt oder gelöscht wurden, muss QupZilla neu gest Seitenquelltext &anzeigen - + Send text... - - Dictionary - - - - + Go to &web address - + Search "%1 .." with %2 Suche "%1 .." mit %2 - + No Named Page Leere Seite - - - + + + New tab Neuer Tab diff --git a/translations/el_GR.ts b/translations/el_GR.ts index 9712bfa23..095f03f0a 100644 --- a/translations/el_GR.ts +++ b/translations/el_GR.ts @@ -4341,24 +4341,19 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab Νέα καρτέλα @@ -4513,12 +4508,17 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Εμφάνιση επιθε&ωρητή διαδικτύου - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Αναζήτηση "%1" με %2 - + No Named Page Ανώνυμη σελίδα diff --git a/translations/empty.ts b/translations/empty.ts index 78cb7cb8c..666569f5c 100644 --- a/translations/empty.ts +++ b/translations/empty.ts @@ -4318,24 +4318,19 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab @@ -4486,12 +4481,17 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 - + No Named Page diff --git a/translations/es_ES.ts b/translations/es_ES.ts index 8639bc126..6e8d9a9b8 100644 --- a/translations/es_ES.ts +++ b/translations/es_ES.ts @@ -4340,24 +4340,19 @@ Después de añadir o eliminar rutas de certificados, es necesario reiniciar Qup - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab Nueva pestaña @@ -4512,12 +4507,17 @@ Después de añadir o eliminar rutas de certificados, es necesario reiniciar Qup Ver Inspector &Web - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Buscar "%1 .." con %2 - + No Named Page Página en blanco diff --git a/translations/fr_FR.ts b/translations/fr_FR.ts index 6e1c92d8d..e6481d7ab 100644 --- a/translations/fr_FR.ts +++ b/translations/fr_FR.ts @@ -4345,24 +4345,19 @@ Après avoir ajouté ou retiré un certificat, il est nécessaire de redémarrer - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab Nouvel onglet @@ -4517,12 +4512,17 @@ Après avoir ajouté ou retiré un certificat, il est nécessaire de redémarrer Web &Inspector - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Recherche de %1.."avec %2 - + No Named Page Page non nommée diff --git a/translations/it_IT.ts b/translations/it_IT.ts index f344e744c..365460488 100644 --- a/translations/it_IT.ts +++ b/translations/it_IT.ts @@ -4344,24 +4344,19 @@ Dopo l'aggiunta o la rimozione dei percorsi di certificazione, è necessari - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab Nuova scheda @@ -4516,12 +4511,17 @@ Dopo l'aggiunta o la rimozione dei percorsi di certificazione, è necessari Mostra Is&pettore Web - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Cerca "%1 .." con %2 - + No Named Page Pagina senza nome diff --git a/translations/nl_NL.ts b/translations/nl_NL.ts index 0366d02bd..adf316510 100644 --- a/translations/nl_NL.ts +++ b/translations/nl_NL.ts @@ -4427,6 +4427,11 @@ Na het toevoegen of verwijderen van paden, is het noodzakelijk om de browser te Show info ab&out site Toon info &over site + + + Dictionary (Google Translate) + + Show Web &Inspector @@ -4479,34 +4484,29 @@ Na het toevoegen of verwijderen van paden, is het noodzakelijk om de browser te &Toon broncode - + Send text... - - Dictionary - - - - + Go to &web address - + Search "%1 .." with %2 Zoek "%1 .." met %2 - + No Named Page Niet benoemde pagina - - - + + + New tab Nieuw tabblad diff --git a/translations/pl_PL.ts b/translations/pl_PL.ts index e942c6210..a536e0105 100644 --- a/translations/pl_PL.ts +++ b/translations/pl_PL.ts @@ -4424,6 +4424,11 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Show info ab&out site Pokaż &informacje o stronie + + + Dictionary (Google Translate) + + Show Web &Inspector @@ -4476,34 +4481,29 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Pokaż kod &źródłowy - + Send text... - - Dictionary - - - - + Go to &web address - + Search "%1 .." with %2 Szukaj "%1 .." z %2 - + No Named Page Strona bez nazwy - - - + + + New tab Nowa karta diff --git a/translations/pt_PT.ts b/translations/pt_PT.ts index 9c7320781..5c0c30c9c 100755 --- a/translations/pt_PT.ts +++ b/translations/pt_PT.ts @@ -4340,24 +4340,19 @@ Após adicionar ou remover os caminhos dos certificados, tem que reiniciar o Qup - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab Novo separador @@ -4512,12 +4507,17 @@ Após adicionar ou remover os caminhos dos certificados, tem que reiniciar o Qup Mostrar &inspetor web - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Procurar "%1 .." com %2 - + No Named Page Página sem nome diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts index da110b252..7d4e6e818 100644 --- a/translations/ru_RU.ts +++ b/translations/ru_RU.ts @@ -4354,24 +4354,19 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab Новая вкладка @@ -4526,12 +4521,17 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Показать &Web инспектор - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Искать "%1 .." с %2 - + No Named Page Безымянная страница diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index 12b06a4e1..6e7ed1b17 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -3593,11 +3593,11 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad - Dictionary + Go to &web address - Go to &web address + Dictionary (Google Translate) diff --git a/translations/sr_BA.ts b/translations/sr_BA.ts index ba8dea231..d422c577c 100644 --- a/translations/sr_BA.ts +++ b/translations/sr_BA.ts @@ -4352,24 +4352,23 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Провјера кôда - + Send text... Пошаљи текст... - Dictionary - Рјечник + Рјечник - + Go to &web address Иди на &веб адресу - - - + + + New tab Нови језичак @@ -4520,12 +4519,17 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Прикажи &веб Инспектора - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Тражи „%1“ на %2 - + No Named Page Нема именоване странице diff --git a/translations/sr_RS.ts b/translations/sr_RS.ts index b6705e66a..e26f6cf5c 100644 --- a/translations/sr_RS.ts +++ b/translations/sr_RS.ts @@ -4352,24 +4352,23 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Провера кôда - + Send text... Пошаљи текст... - Dictionary - Речник + Речник - + Go to &web address Иди на &веб адресу - - - + + + New tab Нови језичак @@ -4520,12 +4519,17 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Прикажи &веб Инспектора - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 Тражи „%1“ на %2 - + No Named Page Нема именоване странице diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 43b6829d5..205692014 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -4331,24 +4331,19 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla - + Send text... - - Dictionary - - - - + Go to &web address - - - + + + New tab 新标签 @@ -4503,12 +4498,17 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla 显示Web及督察&I - + + Dictionary (Google Translate) + + + + Search "%1 .." with %2 使用 %2搜索"%1 .." - + No Named Page 无命名页面