summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-02-18 02:10:51 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-02-18 02:10:51 +0100
commit4dcd02b5317896be0adbe479a4594dac4f048286 (patch)
tree2fd44aeae0e9a60ec4df3b50ef4f5dc090db983b
parentPlease, don't crash on CTRL+W signals :) (diff)
downloadrekonq-4dcd02b5317896be0adbe479a4594dac4f048286.tar.xz
Working around about: protocol..
- honor rekonq settings on about:home page - loads about:blank :) pages
-rw-r--r--src/protocolhandler.cpp29
-rw-r--r--src/rekonqpage/newtabpage.cpp12
-rw-r--r--src/urlbar/urlbar.cpp5
3 files changed, 32 insertions, 14 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index af2e9904..a80f0a46 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -108,6 +108,33 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
// "about" handling
if ( _url.protocol() == QLatin1String("about") )
{
+ if( _url == KUrl("about:blank") )
+ {
+ frame->setHtml( QString() );
+ return true;
+ }
+
+ if( _url == KUrl("about:home") )
+ {
+ switch(ReKonfig::newTabStartPage())
+ {
+ case 0: // favorites
+ _url = KUrl("about:favorites");
+ break;
+ case 1: // closed tabs
+ _url = KUrl("about:closedTabs");
+ break;
+ case 2: // history
+ _url = KUrl("about:history");
+ break;
+ case 3: // bookmarks
+ _url = KUrl("about:bookmarks");
+ break;
+ default: // unuseful
+ break;
+ }
+ }
+
NewTabPage p(frame);
p.generate(_url);
return true;
@@ -149,7 +176,7 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
}
// "file" handling. This is quite trivial :)
- if(_url.protocol() == QLatin1String("file") )
+ if( _url.protocol() == QLatin1String("file") )
{
QFileInfo fileInfo( _url.path() );
if(fileInfo.isDir())
diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp
index ca8ed35e..f7ebcdbf 100644
--- a/src/rekonqpage/newtabpage.cpp
+++ b/src/rekonqpage/newtabpage.cpp
@@ -94,15 +94,6 @@ void NewTabPage::generate(KUrl url)
}
}
- if( url != KUrl("about:home")
- && url != KUrl("about:favorites")
- && url != KUrl("about:closedTabs")
- && url != KUrl("about:history")
- && url != KUrl("about:bookmarks")
- )
- return;
-
-
QWebPage *page = m_root.webFrame()->page();
page->mainFrame()->setHtml(m_html);
@@ -111,7 +102,7 @@ void NewTabPage::generate(KUrl url)
browsingMenu(url);
QString title;
- if(url == KUrl("about:home") || url == KUrl("about:favorites"))
+ if(url == KUrl("about:favorites"))
{
favoritesPage();
title = i18n("Favorites");
@@ -134,7 +125,6 @@ void NewTabPage::generate(KUrl url)
}
m_url = url;
-
m_root.document().findFirst("title").setPlainText(title);
}
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 8cb17b17..3ddadf6b 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -208,8 +208,9 @@ void UrlBar::activated(const QString& urlString)
// this fix urlbar behaviour, removing focus from there and enabling
// loading animation. Temporary fix??
Application::instance()->mainWindow()->currentTab()->setFocus();
- setUrl(urlString);
- emit activated(m_currentUrl);
+
+ setUrl( KUrl(urlString) );
+ emit activated( KUrl(urlString) );
}