24 #include <QDesktopServices>
29 : QTextBrowser(parent)
31 setOpenExternalLinks(
false);
40 if (type == QTextDocument::HtmlResource) {
41 QString helpPath =
":/help/";
45 if (!name.path().contains(
"/")) {
47 if (!QDir(
":/help/" + language).exists())
49 helpPath += language +
"/";
52 QFile file(helpPath + name.path());
53 if (!file.open(QIODevice::ReadOnly)) {
54 return tr(
"Error opening help file: ") + name.path();
56 return QString::fromUtf8(file.readAll());
59 return QTextBrowser::loadResource(type, name);
69 if (url.scheme() !=
"qrc" && !url.isRelative()) {
72 tr(
"Opening External Link"),
73 p(tr(
"Vidalia can open the link you selected in your default "
74 "Web browser. If your browser is not currently "
75 "configured to use Tor then the request will not be "
77 p(tr(
"Do you want Vidalia to open the link in your Web "
85 bool ok = QDesktopServices::openUrl(url);
88 tr(
"Unable to Open Link"),
89 tr(
"Vidalia was unable to open the selected link in your Web browser. "
90 "You can still copy the URL and paste it into your browser."),
95 QTextBrowser::setSource(url);