summaryrefslogtreecommitdiff
path: root/src/urlbar/listitem.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-08-28 19:24:19 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-08-28 19:24:19 +0200
commitf0c11eadaa4b77a4e36130b014b62cd6200c8211 (patch)
tree556625dc98766a444ea2b916e76446c2cb379357 /src/urlbar/listitem.cpp
parentMerge commit 'refs/merge-requests/192' of git://gitorious.org/rekonq/mainline (diff)
downloadrekonq-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/urlbar/listitem.cpp')
-rw-r--r--src/urlbar/listitem.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 5bd2253f..6c09f9a5 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -37,6 +37,7 @@
#include "websnap.h"
#include "completionwidget.h"
#include "searchengine.h"
+#include "iconmanager.h"
// KDE Includes
#include <KIcon>
@@ -187,12 +188,20 @@ QLabel *TypeIconLabel::getIcon(QString icon)
IconLabel::IconLabel(const QString &icon, QWidget *parent)
: QLabel(parent)
{
- QPixmap pixmapIcon = Application::icon(KUrl(icon)).pixmap(16);
+ QPixmap pixmapIcon = Application::iconManager()->iconForUrl(KUrl(icon)).pixmap(16);
setFixedSize(16, 16);
setPixmap(pixmapIcon);
}
+IconLabel::IconLabel(const KIcon &icon, QWidget *parent)
+ : QLabel(parent)
+{
+ QPixmap pixmapIcon = icon.pixmap(16);
+ setFixedSize(16, 16);
+ setPixmap(pixmapIcon);
+}
+
// ---------------------------------------------------------------
@@ -294,7 +303,8 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q
m_url = SearchEngine::buildQuery(engine, query);
- m_iconLabel = new IconLabel("edit-find", this); //TODO: get the default engine icon (will be easy in KDE SC 4.5)
+ KIcon icon = Application::iconManager()->iconForUrl( SearchEngine::defaultEngine()->property("Query").toUrl() );
+ m_iconLabel = new IconLabel(icon, this); //TODO: get the default engine icon (will be easy in KDE SC 4.5)
m_titleLabel = new TextLabel(searchItemTitle(engine->name(), query), query, this);
m_engineBar = new EngineBar(engine, parent);
@@ -328,7 +338,7 @@ QString SearchListItem::searchItemTitle(QString engine, QString text)
void SearchListItem::changeSearchEngine(KService::Ptr engine)
{
m_titleLabel->setText(searchItemTitle(engine->name(), m_text));
- m_iconLabel->setPixmap(Application::icon(KUrl(engine->property("Query").toString())).pixmap(16));
+ m_iconLabel->setPixmap( Application::iconManager()->iconForUrl(KUrl(engine->property("Query").toString())).pixmap(16) );
m_url = SearchEngine::buildQuery(engine, m_text);
qobject_cast<CompletionWidget *>(parent())->setSearchEngine(engine);
}
@@ -371,7 +381,7 @@ KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selected
KUrl url = KUrl( u.toString( QUrl::RemovePath | QUrl::RemoveQuery ) );
kDebug() << "Engine NAME: " << engine->name() << " URL: " << url;
- KAction *a = new KAction(Application::icon(url), engine->name(), this);
+ KAction *a = new KAction(Application::iconManager()->iconForUrl(url), engine->name(), this);
a->setCheckable(true);
if (engine->desktopEntryName() == selectedEngine->desktopEntryName()) a->setChecked(true);
a->setData(engine->entryPath());