From 03e600a1390d61a99ac2a393c9ab1500d8972e9e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 2 Oct 2009 12:01:58 +0200 Subject: Fixing Application::homePage behaviour --- src/application.cpp | 28 +++++++++++++++++----------- src/application.h | 2 +- src/previewimage.cpp | 1 + 3 files changed, 19 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index ba456d2c..bffcb2ae 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -301,11 +301,8 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) } // loading home pages - if (url.scheme() == QLatin1String("about")) - { - homePage(url); + if (homePage(url)) return; - } if (url.scheme() == QLatin1String("mailto")) { @@ -421,12 +418,21 @@ MainWindowList Application::mainWindowList() } -void Application::homePage(const KUrl &url) +bool Application::homePage(const KUrl &url) { - kDebug() << "loading home: " << url; - MainView *view = mainWindow()->mainView(); - WebView *w = view->currentWebView(); - HomePage p(w); - w->setHtml( p.rekonqHomePage(url), url); - return; + if ( url == KUrl("about:lastSites") + || url == KUrl("about:history") + || url == KUrl("about:bookmarks") + || url == KUrl("about:favorites") + || url == KUrl("about:home") + ) + { + kDebug() << "loading home: " << url; + MainView *view = mainWindow()->mainView(); + WebView *w = view->currentWebView(); + HomePage p(w); + w->setHtml( p.rekonqHomePage(url), url); + return true; + } + return false; } diff --git a/src/application.h b/src/application.h index f886982c..7a0e884c 100644 --- a/src/application.h +++ b/src/application.h @@ -101,7 +101,7 @@ public: MainWindow *mainWindow(); MainWindowList mainWindowList(); - void homePage(const KUrl &url = KUrl("about:home")); + bool homePage(const KUrl &url = KUrl("about:home")); static KIcon icon(const KUrl &url); diff --git a/src/previewimage.cpp b/src/previewimage.cpp index 44c0850a..60207fb3 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -93,6 +93,7 @@ QString PreviewImage::guessNameFromUrl(QUrl url) QString name = url.toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash ); // TODO learn Regular Expressions :) + // and implement something better here.. name.remove('/'); name.remove('&'); name.remove('.'); -- cgit v1.2.1