From 65e287ee4a68dcd5019d3fad13b3ebfdd1ef23d4 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 7 Nov 2010 16:35:41 +0100 Subject: First bunch of fixes for the suggestions. We are now respecting users setting on default engines (if someone chooses NONE default search engines, searches are NOT performed) --- src/urlbar/listitem.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/urlbar/listitem.cpp') diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 5fa46470..a0462e76 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -58,6 +58,7 @@ #include #include + ListItem::ListItem(const UrlSearchItem &item, QWidget *parent) : QWidget(parent) , m_option() @@ -81,7 +82,6 @@ ListItem::~ListItem() } - void ListItem::activate() { m_option.state |= QStyle::State_Selected; @@ -166,11 +166,16 @@ TypeIconLabel::TypeIconLabel(int type, QWidget *parent) hLayout->setAlignment(Qt::AlignRight); setLayout(hLayout); - if (type & UrlSearchItem::Search) hLayout->addWidget(getIcon("edit-find")); - if (type & UrlSearchItem::Browse) hLayout->addWidget(getIcon("applications-internet")); - if (type & UrlSearchItem::Bookmark) hLayout->addWidget(getIcon("rating")); - if (type & UrlSearchItem::History) hLayout->addWidget(getIcon("view-history")); - if (type & UrlSearchItem::Suggestion) hLayout->addWidget(getIcon("help-hint")); + if (type & UrlSearchItem::Search) + hLayout->addWidget(getIcon("edit-find")); + if (type & UrlSearchItem::Browse) + hLayout->addWidget(getIcon("applications-internet")); + if (type & UrlSearchItem::Bookmark) + hLayout->addWidget(getIcon("rating")); + if (type & UrlSearchItem::History) + hLayout->addWidget(getIcon("view-history")); + if (type & UrlSearchItem::Suggestion) + hLayout->addWidget(getIcon("help-hint")); } @@ -204,8 +209,10 @@ IconLabel::IconLabel(const KIcon &icon, QWidget *parent) setPixmap(pixmapIcon); } + // --------------------------------------------------------------- + static QString highlightWordsInText(const QString &text, const QStringList &words) { QString ret = text; @@ -241,6 +248,7 @@ static QString highlightWordsInText(const QString &text, const QStringList &word return ret; } + TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget *parent) : QLabel(parent) { @@ -274,6 +282,7 @@ void TextLabel::setEngineText(const QString &engine, const QString &text) setText( i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for %2", engine, Qt::escape(text) ) ); } + // --------------------------------------------------------------- @@ -350,6 +359,7 @@ PreviewLabel::PreviewLabel(const QString &url, int width, int height, QWidget *p } } + // --------------------------------------------------------------- @@ -382,6 +392,7 @@ void ImageLabel::slotResult(KJob *) setPixmap(pix); } + // --------------------------------------------------------------- @@ -416,12 +427,6 @@ QString SearchListItem::text() } -// QString SearchListItem::searchItemTitle(QString engine, QString text) -// { -// return QString(i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for %2", engine, text)); -// } - - void SearchListItem::changeSearchEngine(KService::Ptr engine) { m_titleLabel->setEngineText(engine->name(), m_text); @@ -575,6 +580,7 @@ QString VisualSuggestionListItem::text() return m_text; } + // --------------------------------------------------------------- @@ -627,6 +633,7 @@ ListItem *ListItemFactory::create(const UrlSearchItem &item, const QString &text if (item.type & UrlSearchItem::Suggestion) { + kDebug() << "ITEM URL: " << item.url; if (item.description.isEmpty()) { kDebug() << "Suggestion"; -- cgit v1.2.1