18 #include <keduvocexpression.h>
21 #include <QDragEnterEvent>
23 using namespace Editor;
28 m_currentTranslation = -1;
30 m_currentProvider = 0;
32 m_htmlPart =
new KHTMLPart(widget);
34 widget->setLayout(layout);
37 connect(m_htmlPart->browserExtension(),
38 SIGNAL(openUrlRequest(
const KUrl&,
const KParts::OpenUrlArguments&,
const KParts::BrowserArguments&)),
39 this, SLOT(openUrl(
const KUrl&)));
41 connect(showCurrentButton, SIGNAL(clicked()), SLOT(showCurrentTranslation()));
44 connect(providerComboBox, SIGNAL(currentIndexChanged(
int)), SLOT(providerChanged(
int)));
46 m_htmlPart->setJavaEnabled(
false);
47 m_htmlPart->setPluginsEnabled(
false);
48 m_htmlPart->setJScriptEnabled(
true);
49 m_htmlPart->setMetaRefreshEnabled(
true);
50 m_htmlPart->setDNDEnabled(
true);
53 void BrowserWidget::setupProviders()
55 providerComboBox->clear();
58 provider.
name =
"De-Es Beolingus";
59 provider.
url =
"http://beolingus.org/dings.cgi?service=dees&query=\\{@}";
61 m_providers.append(provider);
62 providerComboBox->addItem(provider.
name);
64 provider.
name =
"De-En Beolingus";
65 provider.
url =
"http://beolingus.org/dings.cgi?query=\\{@}";
67 m_providers.append(provider);
68 providerComboBox->addItem(provider.
name);
70 provider.
name =
"De-En Leo";
71 provider.
url =
"http://dict.leo.org/?search=\\{@}";
73 m_providers.append(provider);
74 providerComboBox->addItem(provider.
name);
76 provider.
name =
"De-Es Leo";
77 provider.
url =
"http://dict.leo.org/?lp=esde&search=\\{@}";
79 m_providers.append(provider);
80 providerComboBox->addItem(provider.
name);
82 provider.
name =
"De-Fr Leo";
83 provider.
url =
"http://dict.leo.org/?lp=frde&search=\\{@}";
85 m_providers.append(provider);
86 providerComboBox->addItem(provider.
name);
88 provider.
name =
"De-Es Pons";
89 provider.
url =
"http://www.ponsline.de/cgi-bin/wb/w.pl?von=pons.de&Richtung=Spanisch&Begriff=\\{@}";
91 m_providers.append(provider);
92 providerComboBox->addItem(provider.
name);
94 provider.
name =
"Ru-En Multitran";
95 provider.
url =
"http://multitran.ru/c/m.exe?SHL=1&CL=1&l1=1&s=\\{@}";
97 m_providers.append(provider);
98 providerComboBox->addItem(provider.
name);
100 provider.
name =
"Ru-De Multitran";
101 provider.
url =
"http://multitran.ru/c/m.exe?SHL=1&CL=1&l1=3&s=\\{@}";
103 m_providers.append(provider);
104 providerComboBox->addItem(provider.
name);
106 provider.
name =
"Ru-Fr Multitran";
107 provider.
url =
"http://multitran.ru/c/m.exe?SHL=1&CL=1&l1=4&s=\\{@}";
109 m_providers.append(provider);
110 providerComboBox->addItem(provider.
name);
112 provider.
name =
"Heinzelnisse";
113 provider.
url =
"http://heinzelnisse.info/dict?setOptions=true&searchItem=\\{@}&dictDeNoSearch=on&dictNoDeSearch=on&dictExactSearch=on&dictPhoneticSearch=on&wikiSearch=on&dictNynorskSearch=on&dictBokmaalSearch=checked&forumKeywordSearch=on&suggestion=on";
115 m_providers.append(provider);
116 providerComboBox->addItem(provider.
name);
122 m_currentTranslation = translation;
125 if (followTableCheckBox->isChecked()) {
126 showCurrentTranslation();
130 void BrowserWidget::showCurrentTranslation()
133 if (m_entry->translation(m_currentTranslation)) {
134 QString text = m_entry->translation(m_currentTranslation)->text();
136 m_htmlPart->openUrl(KUrl(
QString(m_providers.value(m_currentProvider).url.replace(
"\\{@}", text))));
142 void BrowserWidget::openUrl(
const KUrl & targetUrl)
144 m_htmlPart->openUrl(targetUrl);
147 void BrowserWidget::providerChanged(
int provider)
149 m_currentProvider = provider;
150 showCurrentTranslation();
154 #include "browserwidget.moc"
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)