diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-05-25 18:22:55 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-05-25 18:22:55 +0200 |
commit | 4e170744b831886db9b98ef1260e749df36a79af (patch) | |
tree | ade10f3898848f4b1a781bda0d859ff274da24b7 /src | |
parent | Another clean up in rekonq file:// pages (diff) | |
download | rekonq-4e170744b831886db9b98ef1260e749df36a79af.tar.xz |
New rekonq error page :)
Diffstat (limited to 'src')
-rw-r--r-- | src/data/rekonqinfo.html | 3 | ||||
-rw-r--r-- | src/newtabpage.cpp | 35 | ||||
-rw-r--r-- | src/webpage.cpp | 77 |
3 files changed, 98 insertions, 17 deletions
diff --git a/src/data/rekonqinfo.html b/src/data/rekonqinfo.html index b09ea1f7..35fade4f 100644 --- a/src/data/rekonqinfo.html +++ b/src/data/rekonqinfo.html @@ -55,10 +55,11 @@ body{ h1{ font-size: 150%; font-weight: bold; - border-bottom: 1px solid lightgray; + text-align:center; } h2{ + margin-top: 40px; font-size: 130%; font-weight: bold; border-bottom: 1px solid lightgray; diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index f74e5cf1..17f43735 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -60,6 +60,7 @@ #include <QFile> #include <QAction> #include <QWebFrame> +#include <QProcess> NewTabPage::NewTabPage(QWebFrame *frame) @@ -88,6 +89,40 @@ NewTabPage::NewTabPage(QWebFrame *frame) void NewTabPage::generate(const KUrl &url) { // about:preview links + if (KUrl("about:settings").isParentOf(url)) + { + if (url.fileName() == QL1S("network")) + { + QString program = QL1S("kcmshell4"); + QStringList arguments; + arguments << QL1S("kcm_networkmanagement"); + QProcess *proc = new QProcess(parent()); + proc->start(program, arguments); + return; + } + + if (url.fileName() == QL1S("proxy")) + { + QString program = QL1S("kcmshell4"); + QStringList arguments; + arguments << QL1S("proxy"); + QProcess *proc = new QProcess(parent()); + proc->start(program, arguments); + return; + } + + if (url.fileName() == QL1S("firewall")) + { + QString program = QL1S("kcmshell4"); + QStringList arguments; + arguments << QL1S("kcm-ufw"); + QProcess *proc = new QProcess(parent()); + proc->start(program, arguments); + return; + } + } + + // about:preview links if (KUrl("about:preview").isParentOf(url)) { if (url.fileName() == QL1S("add")) diff --git a/src/webpage.cpp b/src/webpage.cpp index cbf1f573..ff993121 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -585,37 +585,82 @@ QString WebPage::errorPage(QNetworkReply *reply) // 2. title QString title = i18n("There was a problem while loading the page"); - QString iconPath = QString("file://") + KIconLoader::global()->iconPath("dialog-warning" , KIconLoader::Small); - iconPath.replace(QL1S("16"), QL1S("128")); - // 3. main content QString msg; + + msg += i18n("<h1>Oops! Rekonq cannot load <em>%1</em></h1>", urlString); + + + msg += i18n("<h2>Wrong digited?</h2>"); + msg += QL1S("<table>"); msg += QL1S("<tr><td>"); - msg += QL1S("<img src=\"") + iconPath + QL1S("\" />"); + + msg += i18n("<p>"); + msg += i18n("We tried to load url: %1.<br />", urlString); + msg += i18n("Check your address for errors like <em>ww.kde.org</em> instead of <em>www.kde.org</em>.<br />"); + msg += i18n("If you digited it right, just try to <a href=\"%1\">reload it</a>.<br />", urlString); + msg += i18n("Otherwise, just take attention on next attempt."); + msg += i18n("</p>"); + + QString laughIconPath = QString("file://") + KIconLoader::global()->iconPath("face-laugh" , -KIconLoader::SizeHuge, false); msg += QL1S("</td><td>"); - msg += QL1S("<h1>") + reply->errorString() + QL1S("</h1>"); - msg += QL1S("<h2>") + i18nc("%1=an URL, e.g.'kde.org'", "When connecting to: <b>%1</b>", urlString) + QL1S("</h2>"); + msg += QL1S("<img src=\"") + laughIconPath + QL1S("\" />"); + msg += QL1S("</td></tr></table>"); + + + msg += i18n("<h2>Network problems?</h2>"); + + QString faceIconPath = QString("file://") + KIconLoader::global()->iconPath("face-surprise" , -KIconLoader::SizeHuge, false); + msg += QL1S("<table>"); + msg += QL1S("<tr><td width=\"100px\">"); + msg += QL1S("<img src=\"") + faceIconPath + QL1S("\" />"); + msg += QL1S("</td><td>"); + + msg += i18n("<p>"); + msg += i18n("Maybe you are having some problems with your network.<br />"); + msg += i18n("Try checking your <a href=\"%1\">network connections</a>", QL1S("about:settings/network")); + msg += i18n(", your <a href=\"%1\">proxy settings</a> ", QL1S("about:settings/proxy")); + msg += i18n("and your <a href=\"%1\">firewall</a>.<br />", QL1S("about:settings/firewall")); + msg += i18n("Then try again.<br />"); + msg += i18n("</p>"); + msg += QL1S("</td></tr></table>"); - msg += QL1S("<ul><li>") + i18n("Check the address for errors such as <b>ww</b>.kde.org instead of <b>www</b>.kde.org"); - msg += QL1S("</li><li>") + i18n("If the address is correct, try to check the network connection.") + QL1S("</li><li>") ; - msg += i18n("If your computer or network is protected by a firewall or proxy, make sure that rekonq is permitted to access the network."); - msg += QL1S("</li><li>") + i18n("Of course, if rekonq does not work properly, you can always say it is a programmer error ;)"); - msg += QL1S("</li></ul><br/><br/>"); - msg += QL1S("<input type=\"button\" id=\"reloadButton\" onClick=\"document.location.href='") + urlString + QL1S("';\" value=\""); - msg += i18n("Try Again") + QL1S("\" />"); - //Default SearchEngine + msg += i18n("<h2>Suggestions</h2>"); + + msg += QL1S("<table>"); + msg += QL1S("<tr><td>"); + + msg += i18n("<p>"); + + // Default SearchEngine KService::Ptr defaultEngine = SearchEngine::defaultEngine(); if (defaultEngine) { - msg += i18n("or"); + msg += i18n("Consult your default search engine about:"); msg += QL1S(" <a href=\"") + SearchEngine::buildQuery(defaultEngine, urlString) + QL1S("\">"); - msg += i18n("Search with %1", defaultEngine->name()) + QL1S("</a>"); + msg += i18n("search with %1", defaultEngine->name()); + msg += QL1S("</a>!<br />"); + } + else + { + msg += i18n("You don't have a default search engine set. We won't suggest you one."); } + msg += i18n("At least, you can consult a cached snapshot of the site: <br />"); + msg += i18n("Try checking the <a href=\"%1\">Wayback Machine</a>", QL1S("http://wayback.archive.org/web/*/") + urlString); + msg += i18n(" or the <a href=\"%1\">Google Cache</a>.", QL1S("http://google.com/search?q=cache:") + urlString); + msg += i18n("</p>"); + + QString winkIconPath = QString("file://") + KIconLoader::global()->iconPath("face-wink" , -KIconLoader::SizeHuge, false); + msg += QL1S("</td><td>"); + msg += QL1S("<img src=\"") + winkIconPath + QL1S("\" />"); + msg += QL1S("</td></tr></table>"); + + // done. Replace variables and show it QString html = QL1S(file.readAll()); |