From 8e15eef308f82528e304573e6250d09c2fc1ca64 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 25 May 2012 15:58:13 +0200 Subject: clean up rekonqinfo css --- src/data/rekonqinfo.html | 88 +++++++++++++++++++++++++++++++----------------- src/protocolhandler.cpp | 16 ++++++--- src/webpage.cpp | 17 +++++++--- 3 files changed, 82 insertions(+), 39 deletions(-) diff --git a/src/data/rekonqinfo.html b/src/data/rekonqinfo.html index e347f53a..c3e6a8fa 100644 --- a/src/data/rekonqinfo.html +++ b/src/data/rekonqinfo.html @@ -1,55 +1,81 @@ - - + + + + + -%1 +$PAGE_TITLE @@ -57,7 +83,7 @@ margin-bottom: 12px; -
%3
+
$MAIN_CONTENT
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index d69171ac..292ca7d9 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -294,7 +294,14 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list) return QString("rekonq error, sorry :("); } + // 1. default data path + QString dataPath = QL1S("file://") + infoFilePath; + dataPath.remove(QL1S("/htmls/rekonqinfo.html")); + + // 2. title QString title = _url.prettyUrl(); + + // 3. main content QString msg = i18nc("%1=an URL", "

Index of %1

", _url.prettyUrl()); @@ -338,11 +345,12 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list) } msg += ""; + // done. Replace variables and show it + QString html = QL1S(file.readAll()); - QString html = QString(QL1S(file.readAll())) - .arg(title) - .arg(msg) - ; + html.replace(QL1S("$DEFAULT_PATH"), dataPath); + html.replace(QL1S("$PAGE_TITLE"), title); + html.replace(QL1S("$MAIN_CONTENT"), msg); return html; } diff --git a/src/webpage.cpp b/src/webpage.cpp index ce1151da..6cd52bd7 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -574,6 +574,11 @@ QString WebPage::errorPage(QNetworkReply *reply) return QString("Couldn't open the rekonqinfo.html file"); } + // 1. data path + QString dataPath = QL1S("file://") + notfoundFilePath; + dataPath.remove(QL1S("/htmls/rekonqinfo.html")); + + // 2. title QString title = i18n("There was a problem while loading the page"); // NOTE: @@ -583,6 +588,7 @@ QString WebPage::errorPage(QNetworkReply *reply) QString iconPath = QString("file://") + KIconLoader::global()->iconPath("dialog-warning" , KIconLoader::Small); iconPath.replace(QL1S("16"), QL1S("128")); + // 3. main content QString msg; msg += QL1S(""); msg += QL1S("
"); @@ -610,10 +616,13 @@ QString WebPage::errorPage(QNetworkReply *reply) msg += i18n("Search with %1", defaultEngine->name()) + QL1S(""); } - QString html = QString(QL1S(file.readAll())) - .arg(title) - .arg(msg) - ; + // done. Replace variables and show it + QString html = QL1S(file.readAll()); + + html.replace(QL1S("$DEFAULT_PATH"), dataPath); + html.replace(QL1S("$PAGE_TITLE"), title); + html.replace(QL1S("$MAIN_CONTENT"), msg); + return html; } -- cgit v1.2.1