Hello Planet KDE && OpenSearch in Rekonq
Hello Planet KDE, my name is Lionel, I am French and I finished my Phd Thesis in Computer Sciences two months ago.
During my free time, I like work on Rekonq's UI. I'm the instigator of a number of ideas that make Rekonq differ from Konqueror: a “new tab” button near the tabs, no menubar, button-menus in the toolbar, no statusbar, statusbar's icons moved in the urlbar, a new icon (thank you Ivan for the beautiful colors), tab previews...
I would like to thank Andrea Diamantini who help me to make all these ideas become reality.
Currently I am working on the “awesome” urlbar. I am adding features based on OpenSearch technologies. Support for OpenSearch was introduced to Arora by Jakub Wieczorek [1]. This code has been derivated by Fredy Yanardi for improve Konqueror’s searchbar plugin [2]. I re-used this code for Rekonq and I improved it in order to provide a more elegant UI.
Search engine detection
Opensearch allows a website to inform the browser that a search engine is available [3]. When a page is loaded, Rekonq verifies if it contains a “link” element with the attribute rel="search". For example, wikipedia page source contains:
<link rel="search"
type="application/opensearchdescription+xml"
href="/w/opensearch_desc.php"
title="Wikipedia (en)" />
When this element is present, Arora and Konqueror add an item in the menu of their searchbar [2].
In Rekonq, I decided to provide something more elegant: an icon at the right of the urlbar (like the RSS one). When the user clicks on the icon, a popup (the same as Konqueror) is displayed:
The OpenSearchDescription file defined in the “link” tag (here http://en.wikipedia.org/w/opensearch_desc.php) is downloaded. This XML file contains useful data for create a new webshortcut and for retrieve suggestions.
Visual suggestions
Rekonq 0.6 supports (only) Google suggestions like Arora and Konqueror but they are integrated in our “awesome” urlbar [4].
OpenSearch.org suggests to use JSON as format of the suggestion results [5]. Google uses this format for its suggestions. For instance, the query http://suggestqueries.google.com/complete/search?json=t&hl=en-EN&q=a&nolabels=t returns the following result:
["a",["amazon","aol","att","american airlines","apple","ask","addicting games","abc","amtrak","ako"]]
Microsoft [6] proposes to use XML instead of JSON. With this format, websites can add images to the text of suggestions and then provide “visual suggestions”. Many popular websites such as Wikipedia already provide them. For instance, the query http://en.wikipedia.org/w/api.php?action=opensearch&format=xml&search=a&namespace=0 returns:
<?xml version="1.0"?>
<SearchSuggestion version="2.0" xmlns="http://opensearch.org/searchsuggest2">
<Query xml:space="preserve">a</Query>
<Section>
<Item>
<Text xml:space="preserve">Animal</Text>
<Description xml:space="preserve">Animals are a major group of mostly multicellular, eukaryotic organisms of the kingdom Animalia or Metazoa. </Description>
<Url xml:space="preserve">http://en.wikipedia.org/wiki/Animal</Url>
<Image source="http://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Animal_diversity_October_2007.jpg/42px-Animal_diversity_October_2007.jpg" width="42" height="50" />
</Item>
...
</Section>
</SearchSuggestion>
In Rekonq, beside the JSON parser, I used an XML parser in order to retrieve such visual suggestions. I also modified the list item classes for display them.
These features are works in progress. Visual suggestions can already be tested with the Rekonq git version. Search engine detection can be tested by pulling the opensearchIcon2 branch of my personal git: git.kde.org:clones/rekonq/chauvin/lionel_clone.git
TODO:
- Detect if search engine is already added: do not display the icon
- Fix word wrap bug for display description on several lines
- Fix bugs when user changes search engines
- Image cache
- Fix bold text
- Update all OpenSearchDescription files of webshortcuts that support visual suggestions
[1] http://arorabrowser.blogspot.com/2009/05/opensearch-support.html
[2] http://fyanardi.wordpress.com/2009/08/26/konqueror-now-supports-opensearch-too/
[3] http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML
[4] http://adjamblog.wordpress.com/2010/08/22/rekonq-0-6-beta/
[5] http://www.opensearch.org/Specifications/OpenSearch/Extensions/Suggestions/1.1#JSON-formatted_search_suggestion_responses
[6] http://msdn.microsoft.com/en-us/library/cc848862(VS.85).aspx#dev_xmlsyntax




Comments
Wow! Awesome work! Thank you.
Wow! Awesome work! Thank you. :)