From 4e170744b831886db9b98ef1260e749df36a79af Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 25 May 2012 18:22:55 +0200 Subject: New rekonq error page :) --- src/data/rekonqinfo.html | 3 +- src/newtabpage.cpp | 35 ++++++++++++++++++++++ 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 #include #include +#include NewTabPage::NewTabPage(QWebFrame *frame) @@ -87,6 +88,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)) { 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("

Oops! Rekonq cannot load %1

", urlString); + + + msg += i18n("

Wrong digited?

"); + msg += QL1S(""); msg += QL1S("
"); - msg += QL1S(""); + + msg += i18n("

"); + msg += i18n("We tried to load url: %1.
", urlString); + msg += i18n("Check your address for errors like ww.kde.org instead of www.kde.org.
"); + msg += i18n("If you digited it right, just try to reload it.
", urlString); + msg += i18n("Otherwise, just take attention on next attempt."); + msg += i18n("

"); + + QString laughIconPath = QString("file://") + KIconLoader::global()->iconPath("face-laugh" , -KIconLoader::SizeHuge, false); msg += QL1S("
"); - msg += QL1S("

") + reply->errorString() + QL1S("

"); - msg += QL1S("

") + i18nc("%1=an URL, e.g.'kde.org'", "When connecting to: %1", urlString) + QL1S("

"); + msg += QL1S(""); + msg += QL1S("
"); + + + msg += i18n("

Network problems?

"); + + QString faceIconPath = QString("file://") + KIconLoader::global()->iconPath("face-surprise" , -KIconLoader::SizeHuge, false); + msg += QL1S(""); + msg += QL1S("
"); + msg += QL1S(""); + msg += QL1S(""); + + msg += i18n("

"); + msg += i18n("Maybe you are having some problems with your network.
"); + msg += i18n("Try checking your network connections", QL1S("about:settings/network")); + msg += i18n(", your proxy settings ", QL1S("about:settings/proxy")); + msg += i18n("and your firewall.
", QL1S("about:settings/firewall")); + msg += i18n("Then try again.
"); + msg += i18n("

"); + msg += QL1S("
"); - msg += QL1S("
  • ") + i18n("Check the address for errors such as ww.kde.org instead of www.kde.org"); - msg += QL1S("
  • ") + i18n("If the address is correct, try to check the network connection.") + QL1S("
  • ") ; - 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("
  • ") + i18n("Of course, if rekonq does not work properly, you can always say it is a programmer error ;)"); - msg += QL1S("


"); - msg += QL1S(""); - //Default SearchEngine + msg += i18n("

Suggestions

"); + + msg += QL1S(""); + msg += QL1S("
"); + + msg += i18n("

"); + + // Default SearchEngine KService::Ptr defaultEngine = SearchEngine::defaultEngine(); if (defaultEngine) { - msg += i18n("or"); + msg += i18n("Consult your default search engine about:"); msg += QL1S(" "); - msg += i18n("Search with %1", defaultEngine->name()) + QL1S(""); + msg += i18n("search with %1", defaultEngine->name()); + msg += QL1S("!
"); + } + 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:
"); + msg += i18n("Try checking the Wayback Machine", QL1S("http://wayback.archive.org/web/*/") + urlString); + msg += i18n(" or the Google Cache.", QL1S("http://google.com/search?q=cache:") + urlString); + msg += i18n("

"); + + QString winkIconPath = QString("file://") + KIconLoader::global()->iconPath("face-wink" , -KIconLoader::SizeHuge, false); + msg += QL1S("
"); + msg += QL1S(""); + msg += QL1S("
"); + + // done. Replace variables and show it QString html = QL1S(file.readAll()); -- cgit v1.2.1