Commit 0b111ae2 authored by Stefano Crocco's avatar Stefano Crocco Committed by David Faure
Browse files

Display favicons for bookmarks in submenus

parent b127e708
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "kbookmarkimporter_ie.h" #include "kbookmarkimporter_ie.h"
#include "kbookmarkmanager.h" #include "kbookmarkmanager.h"
#include "konqbookmarkmenu_p.h" #include "konqbookmarkmenu_p.h"
#include "konqpixmapprovider.h"
using namespace Konqueror; using namespace Konqueror;
...@@ -242,8 +243,10 @@ void KonqBookmarkMenu::refill() ...@@ -242,8 +243,10 @@ void KonqBookmarkMenu::refill()
} }
} }
QAction *KonqBookmarkMenu::actionForBookmark(const KBookmark &bm) QAction *KonqBookmarkMenu::actionForBookmark(const KBookmark &_bm)
{ {
//We need a non-const copy of it
KBookmark bm(_bm);
if (bm.isGroup()) { if (bm.isGroup()) {
// qCDebug(KBOOKMARKS_LOG) << "Creating Konq bookmark submenu named " << bm.text(); // qCDebug(KBOOKMARKS_LOG) << "Creating Konq bookmark submenu named " << bm.text();
KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bm, this); KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bm, this);
...@@ -258,7 +261,13 @@ QAction *KonqBookmarkMenu::actionForBookmark(const KBookmark &bm) ...@@ -258,7 +261,13 @@ QAction *KonqBookmarkMenu::actionForBookmark(const KBookmark &bm)
return KBookmarkMenu::actionForBookmark(bm); return KBookmarkMenu::actionForBookmark(bm);
} else { } else {
// qCDebug(KBOOKMARKS_LOG) << "Creating Konq bookmark action named " << bm.text(); // qCDebug(KBOOKMARKS_LOG) << "Creating Konq bookmark action named " << bm.text();
QUrl host = bm.url().adjusted(QUrl::RemovePath | QUrl::RemoveQuery);
bm.setIcon(KonqPixmapProvider::self()->iconNameFor(host));
KBookmarkAction *action = new KBookmarkAction(bm, owner(), this); KBookmarkAction *action = new KBookmarkAction(bm, owner(), this);
connect(KonqPixmapProvider::self(), &KonqPixmapProvider::changed, action, [host, action]() {
action->setIcon(KonqPixmapProvider::self()->iconForUrl(host));
});
KonqPixmapProvider::self()->downloadHostIcon(host);
m_actionCollection->addAction(action->objectName(), action); m_actionCollection->addAction(action->objectName(), action);
m_actions.append(action); m_actions.append(action);
return action; return action;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment