[rekonq] src/urlbar: let people search with custom engine with ONE click

Andrea Diamantini adjam7 at gmail.com
Wed Feb 8 10:14:50 UTC 2012


Git commit 57ca016320ffbebe984c85f8736c5d4cb7b23e8e by Andrea Diamantini.
Committed on 08/02/2012 at 11:17.
Pushed by adjam into branch 'master'.

let people search with custom engine with ONE click

BUG:255799
CCMAIL: rekonq at kde.org

M  +7    -4    src/urlbar/listitem.cpp
M  +1    -1    src/urlbar/listitem.h

http://commits.kde.org/rekonq/57ca016320ffbebe984c85f8736c5d4cb7b23e8e

diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index d285e39..d3e95ef 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-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
 *
 *
 * This program is free software; you can redistribute it and/or
@@ -309,7 +309,7 @@ DescriptionLabel::DescriptionLabel(const QString &text, QWidget *parent)
     if (wasItalic)
         t = QL1S("<i>") + t + QL1S("</i>");
 
-    setWordWrap(false); //TODO: why setWordWrap(true) make items have a strange behavior ?
+    setWordWrap(false); //NOTE: why setWordWrap(true) make items have a strange behavior ?
     setText(t);
     setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
 }
@@ -451,8 +451,11 @@ QString SearchListItem::text()
 
 void SearchListItem::changeSearchEngine(KService::Ptr engine)
 {
-    UrlResolver::setSearchEngine(engine);
-    emit updateList();
+    // NOTE: This to let rekonq loading text typed in the requested engine on click.
+    // There probably is a better way to do it. I just cannot see it now...
+    UrlSearchItem item = UrlSearchItem(UrlSearchItem::Search, SearchEngine::buildQuery(engine, m_text), m_text);
+    SearchListItem sItem(item, m_text, this);
+    emit itemClicked(&sItem, Qt::LeftButton, Qt::NoModifier);
 }
 
 
diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h
index 1768438..c2f79c9 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-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
 *
 *
 * This program is free software; you can redistribute it and/or


More information about the rekonq mailing list