diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-08-28 19:24:19 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-08-28 19:24:19 +0200 |
commit | f0c11eadaa4b77a4e36130b014b62cd6200c8211 (patch) | |
tree | 556625dc98766a444ea2b916e76446c2cb379357 /src/application.cpp | |
parent | Merge commit 'refs/merge-requests/192' of git://gitorious.org/rekonq/mainline (diff) | |
download | rekonq-f0c11eadaa4b77a4e36130b014b62cd6200c8211.tar.xz |
Switching to "KDE" icon cache. While this "brute force" change can be dangerous,
it seems let everything work as expected (at least here).
It also lets us to retrieve icons when sites are not visited (eg: search engines or old bookmarks)
It also contains fixes & improvements for icons management in History & Bookmarks classes.
More code to maintain, but more things working.Let's see what'll happen...
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/src/application.cpp b/src/application.cpp index df4c3d51..d66e290f 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -43,6 +43,7 @@ #include "sessionmanager.h" #include "adblockmanager.h" #include "opensearchmanager.h" +#include "iconmanager.h" #include "webview.h" #include "filterurljob.h" #include "tabbar.h" @@ -66,6 +67,7 @@ QWeakPointer<BookmarkProvider> Application::s_bookmarkProvider; QWeakPointer<SessionManager> Application::s_sessionManager; QWeakPointer<AdBlockManager> Application::s_adblockManager; QWeakPointer<OpenSearchManager> Application::s_opensearchManager; +QWeakPointer<IconManager> Application::s_iconManager; Application::Application() @@ -250,10 +252,6 @@ void Application::postLaunch() setWindowIcon(KIcon("rekonq")); - // set Icon Database Path to store "favicons" associated with web sites - QString directory = KStandardDirs::locateLocal("cache" , "" , true); - QWebSettings::setIconDatabasePath(directory); - Application::historyManager(); Application::sessionManager(); @@ -331,38 +329,13 @@ OpenSearchManager *Application::opensearchManager() } -KIcon Application::icon(const KUrl &url) +IconManager *Application::iconManager() { - // avoid infinite loop at startup - if (Application::instance()->mainWindowList().isEmpty()) - return KIcon("text-html"); - - // first things first.. - if (url.isEmpty()) - return KIcon("text-html"); - - QByteArray encodedUrl = url.toEncoded(); - // rekonq icons.. - if (encodedUrl == QByteArray("about:home")) - return KIcon("go-home"); - if (encodedUrl == QByteArray("about:closedTabs")) - return KIcon("tab-close"); - if (encodedUrl == QByteArray("about:history")) - return KIcon("view-history"); - if (encodedUrl == QByteArray("about:bookmarks")) - return KIcon("bookmarks"); - if (encodedUrl == QByteArray("about:favorites")) - return KIcon("emblem-favorite"); - if (encodedUrl == QByteArray("about:downloads")) - return KIcon("download"); - - KIcon icon = KIcon(QWebSettings::iconForUrl(url)); - if (icon.isNull()) + if (s_iconManager.isNull()) { - kDebug() << "null icon"; - icon = KIcon("text-html"); + s_iconManager = new IconManager(instance()); } - return icon; + return s_iconManager.data(); } |