diff options
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/listitem.cpp | 24 | ||||
-rw-r--r-- | src/urlbar/listitem.h | 30 |
2 files changed, 33 insertions, 21 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 4e6795f0..02605167 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2009-2013 by Andrea Diamantini <adjam7 at gmail dot com> * * * This program is free software; you can redistribute it and/or @@ -424,7 +424,6 @@ SearchListItem::SearchListItem(const UrlSuggestionItem &item, const QString &tex : ListItem(item, parent) , m_text(text) { - m_iconLabel = new IconLabel(item.url, this); m_titleLabel = new TextLabel(this); m_titleLabel->setEngineText(item.description, item.title); @@ -437,11 +436,10 @@ SearchListItem::SearchListItem(const UrlSuggestionItem &item, const QString &tex QHBoxLayout *hLayout = new QHBoxLayout; hLayout->setSpacing(4); - hLayout->addWidget(m_iconLabel); + hLayout->addWidget(new TypeIconLabel(item.type, this)); hLayout->addWidget(m_titleLabel); hLayout->addWidget(new QLabel(i18n("Engines:"), this)); hLayout->addWidget(m_engineBar); - hLayout->addWidget(new TypeIconLabel(item.type, this)); setLayout(hLayout); @@ -496,6 +494,19 @@ EngineBar::EngineBar(KService::Ptr selectedEngine, QWidget *parent) if (SearchEngine::defaultEngine().isNull()) return; + static bool isFirstExecution = true; + if (isFirstExecution) + { + Q_FOREACH(const KService::Ptr & engine, SearchEngine::favorites()) + { + QUrl u = engine->property("Query").toUrl(); + KUrl url = KUrl(u.toString(QUrl::RemovePath | QUrl::RemoveQuery)); + IconManager::self()->provideEngineFavicon(url); + } + + isFirstExecution = false; + } + m_engineGroup->addAction(newEngineAction(SearchEngine::defaultEngine(), selectedEngine)); Q_FOREACH(const KService::Ptr & engine, SearchEngine::favorites()) { @@ -514,7 +525,7 @@ KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selected QUrl u = engine->property("Query").toUrl(); KUrl url = KUrl(u.toString(QUrl::RemovePath | QUrl::RemoveQuery)); - KAction *a = new KAction(IconManager::self()->iconForUrl(url), engine->name(), this); + KAction *a = new KAction(IconManager::self()->engineFavicon(url), engine->name(), this); a->setCheckable(true); if (engine->desktopEntryName() == selectedEngine->desktopEntryName()) a->setChecked(true); a->setData(engine->entryPath()); @@ -631,9 +642,8 @@ BrowseListItem::BrowseListItem(const UrlSuggestionItem &item, const QString &tex QHBoxLayout *hLayout = new QHBoxLayout; hLayout->setSpacing(4); - hLayout->addWidget(new IconLabel(item.url, this)); - hLayout->addWidget(new TextLabel(item.url, text, this)); hLayout->addWidget(new TypeIconLabel(item.type, this)); + hLayout->addWidget(new TextLabel(item.url, text, this)); setLayout(hLayout); } diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index 21867685..54bff109 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2009-2013 by Andrea Diamantini <adjam7 at gmail dot com> * * * This program is free software; you can redistribute it and/or @@ -53,7 +53,7 @@ class KJob; class QActionGroup; -class ListItem : public QWidget +class REKONQ_TESTS_EXPORT ListItem : public QWidget { Q_OBJECT @@ -91,7 +91,7 @@ protected: // ------------------------------------------------------------------------- -class TypeIconLabel : public QLabel +class REKONQ_TESTS_EXPORT TypeIconLabel : public QLabel { Q_OBJECT @@ -106,7 +106,7 @@ private: // ------------------------------------------------------------------------- -class IconLabel : public QLabel +class REKONQ_TESTS_EXPORT IconLabel : public QLabel { Q_OBJECT @@ -133,7 +133,7 @@ public: // ------------------------------------------------------------------------- -class DescriptionLabel : public QLabel +class REKONQ_TESTS_EXPORT DescriptionLabel : public QLabel { Q_OBJECT @@ -145,7 +145,7 @@ public: // ------------------------------------------------------------------------- -class EngineBar : public KToolBar +class REKONQ_TESTS_EXPORT EngineBar : public KToolBar { Q_OBJECT @@ -162,13 +162,14 @@ private Q_SLOTS: private: KAction *newEngineAction(KService::Ptr engine, KService::Ptr selectedEngine); QActionGroup *m_engineGroup; + }; // ------------------------------------------------------------------------- -class SearchListItem : public ListItem +class REKONQ_TESTS_EXPORT SearchListItem : public ListItem { Q_OBJECT @@ -194,7 +195,7 @@ private: // ------------------------------------------------------------------------- -class SuggestionListItem : public ListItem +class REKONQ_TESTS_EXPORT SuggestionListItem : public ListItem { Q_OBJECT @@ -210,7 +211,7 @@ private: // ------------------------------------------------------------------------- -class VisualSuggestionListItem : public ListItem +class REKONQ_TESTS_EXPORT VisualSuggestionListItem : public ListItem { Q_OBJECT @@ -226,7 +227,7 @@ private: // ------------------------------------------------------------------------- -class PreviewListItem : public ListItem +class REKONQ_TESTS_EXPORT PreviewListItem : public ListItem { Q_OBJECT @@ -238,7 +239,7 @@ public: // ------------------------------------------------------------------------- -class PreviewLabel : public QLabel +class REKONQ_TESTS_EXPORT PreviewLabel : public QLabel { Q_OBJECT @@ -249,7 +250,8 @@ public: // ------------------------------------------------------------------------- -class ImageLabel : public QLabel + +class REKONQ_TESTS_EXPORT ImageLabel : public QLabel { Q_OBJECT @@ -269,7 +271,7 @@ private Q_SLOTS: // ------------------------------------------------------------------------- -class BrowseListItem : public ListItem +class REKONQ_TESTS_EXPORT BrowseListItem : public ListItem { Q_OBJECT @@ -281,7 +283,7 @@ public: //------------------------------------------------------------------------------------------------- -class ListItemFactory +class REKONQ_TESTS_EXPORT ListItemFactory { public: static ListItem *create(const UrlSuggestionItem &item, const QString &text, QWidget *parent); |