201041 default
authorhgs
Fri, 15 Oct 2010 17:30:59 -0400
changeset 16 3c88a81ff781
parent 14 6aeb7a756187
201041
bedrockProvisioning/bedrockProvisioning.pro
bedrockProvisioning/bedrockprovisioning.cpp
bedrockProvisioning/bedrockprovisioning.h
bedrockProvisioning/template/200267EA.ini
browsercore/appfw/Api/Bookmarks/Bookmarks.pri
browsercore/appfw/Api/Common/UiUtil.cpp
browsercore/appfw/Api/Common/UiUtil.h
browsercore/appfw/Api/Common/ViewEventContext.h
browsercore/appfw/Api/Common/WebViewEventContext.cpp
browsercore/appfw/Api/Common/WebViewEventContext.h
browsercore/appfw/Api/Common/wrtBrowserUtils.h
browsercore/appfw/Api/Managers/ContentAgent.cpp
browsercore/appfw/Api/Managers/HistoryManager.cpp
browsercore/appfw/Api/Managers/Managers.pri
browsercore/appfw/Api/Managers/bookmarkscontroller.cpp
browsercore/appfw/Api/Managers/bookmarkscontroller.h
browsercore/appfw/Api/Managers/geolocationManager.cpp
browsercore/appfw/Api/Managers/geolocationManager.h
browsercore/appfw/Api/Managers/hsbookmarkpublishclient.cpp
browsercore/appfw/Api/Managers/webpagecontroller.cpp
browsercore/appfw/Api/Managers/webpagecontroller.h
browsercore/appfw/Api/Views/HistoryFlowView.cpp
browsercore/appfw/Api/Views/HistoryFlowView.h
browsercore/appfw/Api/Views/HistoryView.cpp
browsercore/appfw/Api/Views/Views.pri
browsercore/appfw/Api/Views/WindowView.cpp
browsercore/appfw/Api/Views/WindowView.h
browsercore/appfw/Api/Views/controllableview.h
browsercore/appfw/Api/Views/controllableviewimpl.h
browsercore/appfw/Api/Views/mostvisitedpagestore.cpp
browsercore/appfw/Api/Views/mostvisitedpagestore.h
browsercore/appfw/Common/Common.pri
browsercore/appfw/Common/FilmstripFlow.cpp
browsercore/appfw/Common/FilmstripFlow.h
browsercore/appfw/Common/FlowInterface.cpp
browsercore/appfw/Common/FlowInterface.h
browsercore/appfw/Common/PictureFlow.cpp
browsercore/appfw/Common/PictureFlow.h
browsercore/appfw/appfw-includepath.pri
browsercore/core/ZoomMetaData.h
browsercore/core/core.pri
browsercore/core/core.pro
browsercore/core/network/SchemeHandlerBrDefault_p.cpp
browsercore/core/network/SchemeHandlerBrDefault_p.h
browsercore/core/network/SchemeHandlerBrQtHighway_p.cpp
browsercore/core/network/SchemeHandlerBrQtHighway_p.h
browsercore/core/network/WebNetworkConnectionManager.h
browsercore/core/network/WebNetworkSession.cpp
browsercore/core/network/WrtTelService.rss
browsercore/core/network/WrtTelServiceBr.cpp
browsercore/core/network/WrtTelServiceBr.h
browsercore/core/network/WrtTelServiceBr_p.h
browsercore/core/network/cacheworkerthread.h
browsercore/core/network/featherweightcache.cpp
browsercore/core/network/featherweightcache.h
browsercore/core/network/featherweightcache_p.h
browsercore/core/network/webcookiejar.cpp
browsercore/core/network/webcookiejar.h
browsercore/core/network/webnetworkaccessmanager.cpp
browsercore/core/network/webnetworkaccessmanager.h
browsercore/core/webpagedata.h
browsercore/core/wrtbrowsercontainer.cpp
browsercore/core/wrtbrowsercontainer.h
browsercore/core/wrtbrowsercontainer_p.h
browserui.pri
browserui.pro
flags.pri
ginebra2/ActionButton.cpp
ginebra2/ActionButton.h
ginebra2/ActionButtonSnippet.cpp
ginebra2/ActionButtonSnippet.h
ginebra2/Application.cpp
ginebra2/Application.h
ginebra2/BookmarksToolbarSnippet.cpp
ginebra2/Charms/ExternalEventCharm.cpp
ginebra2/Charms/ExternalEventCharm.h
ginebra2/ChromeDOM.cpp
ginebra2/ChromeDOM.h
ginebra2/ChromeItem.cpp
ginebra2/ChromeItem.h
ginebra2/ChromeLayout.cpp
ginebra2/ChromeLayout.h
ginebra2/ChromeSnippet.h
ginebra2/ChromeView.cpp
ginebra2/ChromeView.h
ginebra2/ChromeWidget.cpp
ginebra2/ChromeWidget.h
ginebra2/ChromeWidgetJSObject.h
ginebra2/ContentToolbarChromeItem.cpp
ginebra2/ContentToolbarChromeItem.h
ginebra2/ContentToolbarSnippet.cpp
ginebra2/ContentToolbarSnippet.h
ginebra2/ContentViews/BrowserWindow.cpp
ginebra2/ContentViews/BrowserWindow.h
ginebra2/ContentViews/ContentViewContextMenu.cpp
ginebra2/ContentViews/ContentViewContextMenu.h
ginebra2/ContentViews/GWebContentView.cpp
ginebra2/ContentViews/GWebContentView.h
ginebra2/ContentViews/GWebContentViewJSObject.h
ginebra2/ContentViews/GWebContentViewWidget.cpp
ginebra2/ContentViews/GWebContentViewWidget.h
ginebra2/ContentViews/ScrollableWebContentView.cpp
ginebra2/ContentViews/ScrollableWebContentView.h
ginebra2/ContentViews/SuperPageView.cpp
ginebra2/ContentViews/SuperPageView.h
ginebra2/ContentViews/TiledWebView.cpp
ginebra2/ContentViews/TiledWebView.h
ginebra2/ContentViews/ViewportMetaData.cpp
ginebra2/ContentViews/ViewportMetaData.h
ginebra2/ContentViews/ViewportMetaDataParser.cpp
ginebra2/ContentViews/ViewportMetaDataParser.h
ginebra2/ContentViews/WebContentAnimationItem.cpp
ginebra2/ContentViews/WebContentAnimationItem.h
ginebra2/ContentViews/WebContentViewWidget.cpp
ginebra2/ContentViews/WebContentViewWidget.h
ginebra2/ContentViews/WebView.cpp
ginebra2/ContentViews/WebView.h
ginebra2/ContentViews/WindowsView.cpp
ginebra2/ContentViews/WindowsView.h
ginebra2/ContextMenu.h
ginebra2/CopyCutPasteSnippet.cpp
ginebra2/CopyCutPasteSnippet.h
ginebra2/EditorSnippet.cpp
ginebra2/EditorSnippet.h
ginebra2/EditorWidget.cpp
ginebra2/EditorWidget.h
ginebra2/GWebTouchNavigation.cpp
ginebra2/GWebTouchNavigation.h
ginebra2/Gestures/GestureEvent.cpp
ginebra2/Gestures/GestureRecognizer.cpp
ginebra2/GridView.cpp
ginebra2/GridView.h
ginebra2/MostVisitedView.cpp
ginebra2/MostVisitedView.h
ginebra2/PopupWebChromeItem.cpp
ginebra2/RecentUrlToolbarSnippet.cpp
ginebra2/ScaleNinePainter.cpp
ginebra2/ScaleNinePainter.h
ginebra2/ScaleThreePainter.cpp
ginebra2/ScaleThreePainter.h
ginebra2/ScrollHelper.cpp
ginebra2/ScrollHelper.h
ginebra2/ScrollableViewBase.cpp
ginebra2/ScrollableViewBase.h
ginebra2/SettingsToolbarSnippet.cpp
ginebra2/SlidingWidget.cpp
ginebra2/SlidingWidget.h
ginebra2/TitleItem.cpp
ginebra2/TitleItem.h
ginebra2/TitleUrlContainerSnippet.cpp
ginebra2/TitleUrlContainerSnippet.h
ginebra2/Toolbar.h
ginebra2/ToolbarChromeItem.cpp
ginebra2/ToolbarChromeItem.h
ginebra2/UrlSearchSnippet.cpp
ginebra2/UrlSearchSnippet.h
ginebra2/ViewController.cpp
ginebra2/ViewController.h
ginebra2/ViewStack.cpp
ginebra2/ViewStack.h
ginebra2/WebChromeItem.cpp
ginebra2/WebChromeItem.h
ginebra2/WebGestureHelper.cpp
ginebra2/WebGestureHelper.h
ginebra2/WebTouchNavigation.cpp
ginebra2/WebTouchNavigation.h
ginebra2/WindowToolbarSnippet.cpp
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/BookmarkView.html
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.css
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.js
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialogTenone.css
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.css
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.js
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewTenone.css
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewTenone.js
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewmaemo.js
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/circle_bg.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/delete_btn.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_cross.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_cross_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_tick.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_tick_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open_bg.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/edit_btn.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/icon_add.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/icon_add_disabled.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/icon_add_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/list_itembg.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/list_itembg_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/menu_icon_bookmarks.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/yes_deselected.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/yes_selected.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/yes_deselected.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/yes_selected.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/add_bookmark_bg.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/cc0d0d-hatch.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/delete_btn.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_bottom.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_center.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_top.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/edit_btn.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg_pressed.png
ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/menu_icon_bookmarks.png
ginebra2/chrome/bedrockchrome/chrome.css
ginebra2/chrome/bedrockchrome/chrome.html
ginebra2/chrome/bedrockchrome/chrome.js
ginebra2/chrome/bedrockchrome/chrome_maemo.css
ginebra2/chrome/bedrockchrome/chrome_maemo.html
ginebra2/chrome/bedrockchrome/chrome_tenone.html
ginebra2/chrome/bedrockchrome/contextmenu.snippet/ContextMenuTenone.css
ginebra2/chrome/bedrockchrome/contextmenu.snippet/ViewContextMenu.js
ginebra2/chrome/bedrockchrome/contextmenu.snippet/contextmenu.css
ginebra2/chrome/bedrockchrome/contextmenu.snippet/contextmenu.js
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/links_deselected.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/links_selected.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/list_contextmenu.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/list_contextmenu_pressed.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/menu_tail.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/nav_deselected.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/nav_selected.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/page_deselected.png
ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/page_selected.png
ginebra2/chrome/bedrockchrome/download.snippet/download.css
ginebra2/chrome/bedrockchrome/download.snippet/download.js
ginebra2/chrome/bedrockchrome/download.snippet/downloadTenone.css
ginebra2/chrome/bedrockchrome/geolocation.snippet/geolocationDialog.css
ginebra2/chrome/bedrockchrome/geolocation.snippet/geolocationDialog.js
ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_cross.png
ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_cross_pressed.png
ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_tick.png
ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_tick_pressed.png
ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/icon_dialog_error.png
ginebra2/chrome/bedrockchrome/historyview.superpage/clearhistorydialog.css
ginebra2/chrome/bedrockchrome/historyview.superpage/clearhistorydialogTenone.css
ginebra2/chrome/bedrockchrome/historyview.superpage/historyView.html
ginebra2/chrome/bedrockchrome/historyview.superpage/historyview.css
ginebra2/chrome/bedrockchrome/historyview.superpage/historyviewTenone.css
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_cancel_press.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_cancel_wait.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_ok_press.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_ok_wait.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/clear_history_bg.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerarrow_closed.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerarrow_open.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerbg_closed.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerbg_open.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_itembg.png
ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_itembg_pressed.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_press.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_wait.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_press.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_wait.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/clear_history_bg.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_closed.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_open.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_closed.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_open.png
ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_itembg.png
ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_left.png
ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_left_tenone.png
ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_middle.png
ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_middle_tenone.png
ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_right.png
ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_right_tenone.png
ginebra2/chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/button_dialog_ok_press.png
ginebra2/chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/button_dialog_ok_wait.png
ginebra2/chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/icon_dialog_error.png
ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatus.css
ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatus.js
ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatusTenone.css
ginebra2/chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/button_dialog_out_of_memory_ok_press.png
ginebra2/chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/button_dialog_out_of_memory_ok_wait.png
ginebra2/chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/icon_dialog_error.png
ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.css
ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.js
ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialogTenone.css
ginebra2/chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/button_dialog_ok_press.png
ginebra2/chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/button_dialog_ok_wait.png
ginebra2/chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/icon_dialog_error.png
ginebra2/chrome/bedrockchrome/prompt.snippet/prompt.css
ginebra2/chrome/bedrockchrome/prompt.snippet/prompt.js
ginebra2/chrome/bedrockchrome/prompt.snippet/promptTenone.css
ginebra2/chrome/bedrockchrome/settingsview.superpage/LegalNotice.html
ginebra2/chrome/bedrockchrome/settingsview.superpage/LegalNoticeMaemo.html
ginebra2/chrome/bedrockchrome/settingsview.superpage/LegalNoticeTenone.html
ginebra2/chrome/bedrockchrome/settingsview.superpage/SettingsView.html
ginebra2/chrome/bedrockchrome/settingsview.superpage/SettingsViewMaemo.html
ginebra2/chrome/bedrockchrome/settingsview.superpage/SettingsViewTenone.html
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerarrow_closed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerarrow_open.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerbg_closed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerbg_open.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_itembg.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/broom_sweep.gif
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/broom_sweep.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerarrow_closed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerarrow_open.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerbg_closed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerbg_open.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_about.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_general_ce.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_pressed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_off.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_on.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/yes_deselected.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/yes_selected.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/radio_off.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/radio_on.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/broom_sweep.gif
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/broom_sweep.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/delete_btn.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/delete_btn_pressed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerarrow_closed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerarrow_open.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_closed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_open.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg_pressed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/no_deselected.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/no_selected.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/radio_off.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/radio_on.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_btn.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_btn_pressed.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_deselected.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_selected.png
ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsview.css
ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsview.js
ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewTenone.css
ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewTenone.js
ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.css
ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.js
ginebra2/chrome/bedrockchrome/statusbar.snippet/statusbar.css
ginebra2/chrome/bedrockchrome/statusbar.snippet/statusbar.js
ginebra2/chrome/bedrockchrome/suggests.snippet/icons/iconsTenone/divider.png
ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.css
ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.html
ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.js
ginebra2/chrome/bedrockchrome/suggests.snippet/suggestsTenone.css
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom+.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom+_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom+_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom-.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom-_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom-_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/circle_bg.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_menu.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_menu_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_menu_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_mostvisited.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_mostvisited_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_fullTB.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_fullTB_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_partialTB.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_partialTB_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_zoom.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_zoom_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_zoom_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomLeft.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomMiddle.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomRight.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_middleMiddle.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topLeft.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topMiddle.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topRight.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/circle_bg.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_bar_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom_disabled.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom_pressed.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomLeft.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomMiddle.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomRight.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_middleMiddle.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topLeft.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topMiddle.png
ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topRight.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/go_btn_pressed.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/URL_search_divider.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep_no_bg.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep_pressed.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/go_btn.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/refresh_btn.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/stop_btn.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/url_title_ind_btn.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/url_title_ind_btn_secure.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/refresh_btn_pressed.png
ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/stop_btn_pressed.png
ginebra2/chrome/bedrockchrome/windowcount.snippet/windowcount.css
ginebra2/chrome/bedrockchrome/windowcount.snippet/windowcount.js
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+_disabled.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+_pressed.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-_disabled.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-_pressed.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom_disabled.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom_pressed.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/zoom_menu_bg.png
ginebra2/chrome/bedrockchrome/zoombar.snippet/zoombar.css
ginebra2/chrome/bedrockchrome/zoombar.snippet/zoombar.js
ginebra2/chrome/localpages/bedrock.png
ginebra2/chrome/localpages/mostvisitedpages.dat
ginebra2/chrome/localpages/relnotes.html
ginebra2/chrome/localpages/startpage.css
ginebra2/chrome/localpages/startpage.html
ginebra2/chrome/localpagesmaemo/back.png
ginebra2/chrome/localpagesmaemo/bedrock.png
ginebra2/chrome/localpagesmaemo/bedrock_splash.png
ginebra2/chrome/localpagesmaemo/button1.png
ginebra2/chrome/localpagesmaemo/button2.png
ginebra2/chrome/localpagesmaemo/button3.png
ginebra2/chrome/localpagesmaemo/button4.png
ginebra2/chrome/localpagesmaemo/button_back.png
ginebra2/chrome/localpagesmaemo/button_del.png
ginebra2/chrome/localpagesmaemo/button_rel_notes.png
ginebra2/chrome/localpagesmaemo/button_report_bug.png
ginebra2/chrome/localpagesmaemo/button_search_google.png
ginebra2/chrome/localpagesmaemo/button_survey.png
ginebra2/chrome/localpagesmaemo/google.png
ginebra2/chrome/localpagesmaemo/grad_tall.jpg
ginebra2/chrome/localpagesmaemo/installnotes.html
ginebra2/chrome/localpagesmaemo/mostvisitedpages.dat
ginebra2/chrome/localpagesmaemo/nokia_logo.png
ginebra2/chrome/localpagesmaemo/relnotes.html
ginebra2/chrome/localpagesmaemo/startpage.css
ginebra2/chrome/localpagesmaemo/startpage.html
ginebra2/chrome/localpagesmaemo/startpage_101.html
ginebra2/chrome/localpagesmaemo/subpage.css
ginebra2/data/backup_registration.xml
ginebra2/deployment.pri
ginebra2/emulator/browser.cpp
ginebra2/emulator/browser.h
ginebra2/emulator/browsermaemo.cpp
ginebra2/emulator/main.cpp
ginebra2/ginebra2.pro
ginebra2/ginebra2.qrc
ginebra2/ginebra_maemo.qrc
ginebra2/ginebra_tenone.qrc
ginebra2/linearflowsnippet.cpp
ginebra2/mostvisitedpageview.cpp
ginebra2/mostvisitedpageview.h
ginebra2/mostvisitedsnippet.cpp
ginebra2/mostvisitedsnippet.h
ginebra2/mostvisitedsnippetmaemo.cpp
ginebra2/mostvisitedsnippetmaemo.h
ginebra2/qrc/ginebra2.qrc
ginebra2/qrc/ginebraMaemo.qrc
ginebra2/qrc/ginebraTenone.qrc
ginebra2/translations/Browser.xls
ginebra2/translations/Browser_textids_metrics_tenone.xls
ginebra2/translations/browserloc.qm
ginebra2/translations/browserloc.ts
homescreen/widgetplugins/hsbookmarkwidgetplugin/hsbookmarkwidgetplugin.pro
homescreen/widgetplugins/hsbookmarkwidgetplugin/inc/hsbookmarkwidget.h
homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/hsbookmarkwidget.css
homescreen/widgetplugins/hsbookmarkwidgetplugin/src/hsbookmarkwidget.cpp
qstmgesturelib/qstmcallbacktimer.h
qstmgesturelib/qstmfilelogger/qstmfilelogger.cpp
qstmgesturelib/qstmfilelogger/qstmfilelogger.h
qstmgesturelib/qstmgenericsimplegesture.cpp
qstmgesturelib/qstmgenericsimplegesture.h
qstmgesturelib/qstmgesture_if.h
qstmgesturelib/qstmgestureapi.cpp
qstmgesturelib/qstmgestureapi.h
qstmgesturelib/qstmgestureengine.cpp
qstmgesturelib/qstmgestureengine.h
qstmgesturelib/qstmgestureengine_if.h
qstmgesturelib/qstmgestureevent.cpp
qstmgesturelib/qstmgestureevent.h
qstmgesturelib/qstmgesturelib.pro
qstmgesturelib/qstmstateengine.cpp
qstmgesturelib/qstmstateengine.h
qstmgesturelib/qstmstateengineconfig.cpp
qstmgesturelib/qstmstateengineconfig.h
qstmgesturelib/qstmstatemachine.cpp
qstmgesturelib/qstmstatemachine.h
qstmgesturelib/qstmuievent.cpp
qstmgesturelib/qstmuievent.h
qstmgesturelib/qstmuievent_if.h
qstmgesturelib/qstmuieventsender.cpp
qstmgesturelib/qstmutils.cpp
qstmgesturelib/recognisers/qstmedgescrollgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmedgescrollgesturerecogniser.h
qstmgesturelib/recognisers/qstmflickgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmhoveringgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmleftrightgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmleftrightgesturerecogniser.h
qstmgesturelib/recognisers/qstmlongpressgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmmaybetapgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmmaybetapgesturerecogniser.h
qstmgesturelib/recognisers/qstmpangesturerecogniser.cpp
qstmgesturelib/recognisers/qstmpinchgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmpinchgesturerecogniser.h
qstmgesturelib/recognisers/qstmreleasegesturerecogniser.cpp
qstmgesturelib/recognisers/qstmtapgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmtapgesturerecogniser.h
qstmgesturelib/recognisers/qstmtouchgesturerecogniser.cpp
qstmgesturelib/recognisers/qstmunknowngesturerecogniser.cpp
qstmgesturelib/recognisers/qstmupdowngesturerecogniser.cpp
qstmgesturelib/recognisers/qstmupdowngesturerecogniser.h
qstmgesturelib/recognisers/qstmzoomgesturerecogniser.cpp
qstmgesturelib/uitimer.h
rom/NokiaBrowser_stub.sis
rom/browser.iby
utilities/OriginalSources.txt
utilities/downloadmanager/DownloadManager.pro
utilities/downloadmanager/bwins/BrDownloadMgru.def
utilities/downloadmanager/eabi/BrDownloadMgru.def
utilities/downloadmanager/inc/backgrounddownload.h
utilities/downloadmanager/inc/backgrounddownloadmanager.h
utilities/downloadmanager/inc/clientdownload.h
utilities/downloadmanager/inc/dmcommon.h
utilities/downloadmanager/inc/dmcommoninternal.h
utilities/downloadmanager/inc/dmpimpl.h
utilities/downloadmanager/inc/download.h
utilities/downloadmanager/inc/downloadbackend.h
utilities/downloadmanager/inc/downloadcore.h
utilities/downloadmanager/inc/downloadcoremanager.h
utilities/downloadmanager/inc/downloadevent.h
utilities/downloadmanager/inc/downloadfactory.h
utilities/downloadmanager/inc/downloadinfo.h
utilities/downloadmanager/inc/downloadmanager.h
utilities/downloadmanager/inc/downloadmanagerclient.h
utilities/downloadmanager/inc/downloadstore.h
utilities/downloadmanager/inc/drmstorage.h
utilities/downloadmanager/inc/filestorage.h
utilities/downloadmanager/inc/httpdownloadbackend.h
utilities/downloadmanager/inc/oma2downloadbackend.h
utilities/downloadmanager/inc/omaddparser.h
utilities/downloadmanager/inc/omadownloadbackend.h
utilities/downloadmanager/inc/paralleldownloadmanager.h
utilities/downloadmanager/inc/progressivedownloadserver.h
utilities/downloadmanager/inc/sequentialdownloadmanager.h
utilities/downloadmanager/inc/storageutility.h
utilities/downloadmanager/inc/wmdrmdownloadbackend.h
utilities/downloadmanager/src/backgrounddownload.cpp
utilities/downloadmanager/src/backgrounddownloadmanager.cpp
utilities/downloadmanager/src/clientdownload.cpp
utilities/downloadmanager/src/downloadbackend.cpp
utilities/downloadmanager/src/downloadcore.cpp
utilities/downloadmanager/src/downloadcoremanager.cpp
utilities/downloadmanager/src/downloadevent.cpp
utilities/downloadmanager/src/downloadfactory.cpp
utilities/downloadmanager/src/downloadinfo.cpp
utilities/downloadmanager/src/downloadmanager.cpp
utilities/downloadmanager/src/downloadmanagerclient.cpp
utilities/downloadmanager/src/drmstorage.cpp
utilities/downloadmanager/src/filestorage.cpp
utilities/downloadmanager/src/httpdownloadbackend.cpp
utilities/downloadmanager/src/oma2downloadbackend.cpp
utilities/downloadmanager/src/omaddparser.cpp
utilities/downloadmanager/src/omadownloadbackend.cpp
utilities/downloadmanager/src/paralleldownloadmanager.cpp
utilities/downloadmanager/src/progressivedownloadserver.cpp
utilities/downloadmanager/src/sequentialdownloadmanager.cpp
utilities/downloadmanager/src/storageutility.cpp
utilities/downloadmanager/src/wmdrmdownloadbackend.cpp
utilities/serviceipcclient/bwins/brserviceipcclientu.def
utilities/serviceipcclient/eabi/brserviceipcclientu.def
utilities/serviceipcclient/platform/qt/serviceipclocalsocket.cpp
utilities/serviceipcclient/platform/qt/serviceipclocalsocket_p.h
utilities/serviceipcclient/platform/s60/serviceipcsymbian.cpp
utilities/serviceipcclient/platform/s60/serviceipcsymbian_p.h
utilities/serviceipcclient/platform/s60/serviceipcsymbiansession.cpp
utilities/serviceipcclient/platform/s60/serviceipcsymbiansession.h
utilities/serviceipcclient/serviceipc.cpp
utilities/serviceipcclient/serviceipc.h
utilities/serviceipcclient/serviceipc_p.h
utilities/serviceipcclient/serviceipcclient.cpp
utilities/serviceipcclient/serviceipcclient.h
utilities/serviceipcclient/serviceipcclient.loc
utilities/serviceipcclient/serviceipcclient.pro
utilities/serviceipcclient/serviceipcclient.rss
utilities/serviceipcclient/serviceipcdefs.h
utilities/serviceipcclient/serviceipcfactory.cpp
utilities/serviceipcclient/serviceipcfactory.h
utilities/serviceipcclient/serviceipcsharedmem.cpp
utilities/serviceipcclient/serviceipcsharedmem_p.h
utilities/serviceipcserver/bwins/brserviceipcserveru.def
utilities/serviceipcserver/clientinfo.h
utilities/serviceipcserver/eabi/brserviceipcserveru.def
utilities/serviceipcserver/platform/qt/serviceipclocalsocketsession.cpp
utilities/serviceipcserver/platform/qt/serviceipclocalsocketsession.h
utilities/serviceipcserver/platform/qt/serviceipcserverlocalsocket.cpp
utilities/serviceipcserver/platform/qt/serviceipcserverlocalsocket_p.h
utilities/serviceipcserver/platform/s60/serviceipcserversymbianserver.cpp
utilities/serviceipcserver/platform/s60/serviceipcserversymbianserver_p.h
utilities/serviceipcserver/platform/s60/serviceipcserversymbiansession.cpp
utilities/serviceipcserver/platform/s60/serviceipcserversymbiansession.h
utilities/serviceipcserver/serviceipcobserver.h
utilities/serviceipcserver/serviceipcrequest.cpp
utilities/serviceipcserver/serviceipcrequest.h
utilities/serviceipcserver/serviceipcserver.cpp
utilities/serviceipcserver/serviceipcserver.h
utilities/serviceipcserver/serviceipcserver.pro
utilities/serviceipcserver/serviceipcserver_p.h
utilities/serviceipcserver/serviceipcserverfactory.cpp
utilities/serviceipcserver/serviceipcserverfactory.h
utilities/serviceipcserver/serviceipcserversession.cpp
utilities/serviceipcserver/serviceipcserversession.h
utilities/serviceipcserver/sessionidtable.cpp
utilities/serviceipcserver/sessionidtable.h
utilities/standaloneallocator/CHANGELOG.txt
utilities/standaloneallocator/README.txt
utilities/standaloneallocator/dla_p.h
utilities/standaloneallocator/newallocator.cpp
utilities/standaloneallocator/newallocator_hook.cpp
utilities/standaloneallocator/newallocator_p.h
utilities/standaloneallocator/standaloneallocator.pro
utilities/utilities.pro
--- a/bedrockProvisioning/bedrockProvisioning.pro	Thu Sep 23 15:32:11 2010 -0400
+++ b/bedrockProvisioning/bedrockProvisioning.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -31,16 +31,10 @@
 
 symbian: {
     TARGET.EPOCALLOWDLLDATA=1
-    TARGET.CAPABILITY = All -TCB -DRM -AllFiles 
+    TARGET.CAPABILITY = All -TCB -DRM 
     TARGET.UID3 = 0x200267EA
     TARGET.VID = VID_DEFAULT
-    
-    bedrockprovisioning.sources = BedrockProvisioning.dll
-    bedrockprovisioning.path = /sys/bin    
-    provisioningtemplate.sources = ./template/200267EA.ini
-    provisioningtemplate.path = /data/.config/Nokia
-    
-    DEPLOYMENT += bedrockprovisioning provisioningtemplate
+
     LIBS += -lefsrv
     
     isEmpty(BEDROCK_OUTPUT_DIR): {
@@ -87,5 +81,12 @@
    message( "building for coverage statics" )
 }
 
+# For 9.2 and 10.1, turn on multi-touch
+contains (browser_addon, ninetwo) {
+    DEFINES += ADVANCED_POINTER_EVENTS
+}
+isEmpty (browser_addon){
+    DEFINES += ADVANCED_POINTER_EVENTS
+}
 
 symbian:MMP_RULES += SMPSAFE
--- a/bedrockProvisioning/bedrockprovisioning.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/bedrockProvisioning/bedrockprovisioning.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -5,14 +5,14 @@
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, version 2.1 of the License.
-* 
+*
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
+* along with this program.  If not,
 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
 *
 * Description:
@@ -25,7 +25,7 @@
 #include <QDesktopServices>
 #include <QProcessEnvironment>
 #include <QWebSettings>
-#include "bedrockprovisioning.h" 
+#include "bedrockprovisioning.h"
 
 namespace BEDROCK_PROVISIONING {
 
@@ -41,6 +41,7 @@
 BedrockProvisioning::BedrockProvisioning( QObject* parent, QString uid ) :
       QSettings(IniFormat, UserScope, BEDROCK_ORGANIZATION_NAME, uid, parent)
 {
+    
     setObjectName(QString::fromUtf8("BedrockProvisioning"));
     m_appuid = uid;
     init();
@@ -71,7 +72,7 @@
             QString baseDir = QDir::homePath(); // Not sure if this is valid
 #endif /* QT_NO_DESKTOPSERVICES */
 #elif defined Q_WS_MAEMO_5
-            QString baseDir = "/opt/browser";
+            QString baseDir = "/opt/nokia-browser";
 #else /* Win or Linux */
             QString baseDir = "."; /* Should this also be homePath()? */
 #endif
@@ -93,6 +94,15 @@
 #endif
             QSettings::setValue("DataBaseDirectory", baseDir + "/");
         }
+        
+        if (!QSettings::contains("DataBaseName")) {
+#if defined Q_WS_MAEMO_5
+						QString baseDir = QDir::homePath();
+            QSettings::setValue("DataBaseName", baseDir + "/browserContent.db");
+#else						
+            QSettings::setValue("DataBaseName", "browserContent.db");
+#endif
+        }
 
         if (!QSettings::contains("ChromeBaseDirectory")) {
             QString chromeBaseDir = ":/chrome/";
@@ -102,39 +112,42 @@
             if (envChromeBaseDir != "")
                 chromeBaseDir = envChromeBaseDir;
 #endif
-          QSettings::setValue("ChromeBaseDirectory", chromeBaseDir); 
-        }        	
+          QSettings::setValue("ChromeBaseDirectory", chromeBaseDir);
+        }
 
         if (!QSettings::contains("LocalPagesBaseDirectory")) {
 #ifdef Q_OS_SYMBIAN
             QString localpagesBaseDir = QSettings::value("ROMBaseDirectory").toString() + "localpages/";
+#elif defined Q_WS_MAEMO_5
+            QDir localpages("/opt/nokia-browser/localpagesmaemo/");
+            QString localpagesBaseDir;
+            if(localpages.exists())  //harware build
+                localpagesBaseDir  = "/opt/nokia-browser/localpagesmaemo/";
+            else //emulator
+                localpagesBaseDir = "./sf/app/browserui/ginebra2/chrome/localpagesmaemo/";
 #else        
-            QString localpagesBaseDir = QSettings::value("ChromeBaseDirectory").toString() + "localpages/";
-            // Maemo, Linux, Windows can override using an env var
+            QString localpagesBaseDir = "chrome/localpages/";
+            // Linux, Windows can override using an env var
             static const QString envBaseDir = QProcessEnvironment::systemEnvironment().value("BROWSER_LOCALPAGES"); // allow env var overriding for dev
             if (envBaseDir != "")
                 localpagesBaseDir = envBaseDir;
 #endif
-          QSettings::setValue("LocalPagesBaseDirectory", localpagesBaseDir); 
+          QSettings::setValue("LocalPagesBaseDirectory", localpagesBaseDir);
         }
-        
+
         if (!QSettings::contains("StartUpChrome")) {
-#ifdef  BROWSER_LAYOUT_TENONE
-          QSettings::setValue("StartUpChrome", "bedrockchrome/chrome_tenone.html"); 
-#else
-          QSettings::setValue("StartUpChrome", "bedrockchrome/chrome.html"); 
-#endif
-        }        	
+          QSettings::setValue("StartUpChrome", "chrome.html"); 
+        }
 
         if (!QSettings::contains("SplashImage")) {
-          QSettings::setValue("SplashImage", "localpages/bedrock_splash.png"); 
+          QSettings::setValue("SplashImage", "bedrock_splash.png"); 
         }        	
 
         if (!QSettings::contains("NetworkProxy")) {
 // For s60 arm and maemo arm (i.e. not x86 emulator build) we need to set no proxy
 #if (defined(Q_OS_SYMBIAN)  && !defined(Q_CC_NOKIAX86)) || (defined(Q_WS_MAEMO_5) && !defined(QT_ARCH_I386))
           // empty proxy only for ARMV5 Symbian targets
-	        QSettings::setValue("NetworkProxy", QString()); 
+	        QSettings::setValue("NetworkProxy", QString());
 // everything else, linux, win, s60 emulator, maemo emulator needs proxy
 #else
   	      QSettings::setValue("NetworkProxy", "bswebproxy01.americas.nokia.com");
@@ -145,7 +158,7 @@
 // For s60 arm and maemo arm (i.e. not x86 emulator build) we need to set no proxy
 #if (defined(Q_OS_SYMBIAN)  && !defined(Q_CC_NOKIAX86)) || (defined(Q_WS_MAEMO_5) && !defined(QT_ARCH_I386))
           // empty proxy only for ARMV5 Symbian targets
-	        QSettings::setValue("NetworkPort", QString()); 
+	        QSettings::setValue("NetworkPort", QString());
 // everything else, linux, win, s60 emulator, maemo emulator needs proxy
 #else
   	      QSettings::setValue("NetworkPort", "8080");
@@ -155,19 +168,14 @@
             QSettings::setValue("DiskCacheEnabled", "1");
 
         if (!QSettings::contains("DiskCacheMaxSize"))
-            QSettings::setValue("DiskCacheMaxSize", "4194304");
+            QSettings::setValue("DiskCacheMaxSize", "6291456"); //6M
 
         if (!QSettings::contains("MaxPagesInCache"))
             QSettings::setValue("MaxPagesInCache", "3");
 
         if (!QSettings::contains("DnsPrefetchEnabled"))
             QSettings::setValue("DnsPrefetchEnabled", "0");
-
-#ifdef Q_OS_SYMBIAN
-        const QString diskCacheBaseDir = "d:/system/";
-#else
         const QString diskCacheBaseDir = QSettings::value("DataBaseDirectory").toString();
-#endif
 
         if (!QSettings::contains("DiskCacheDirectoryPath")) {
             QSettings::setValue("DiskCacheDirectoryPath", diskCacheBaseDir + "brCache");
@@ -195,7 +203,11 @@
         }
 
         if (!QSettings::contains("Html5DatabaseStorage")) {
+        	  #if defined Q_WS_MAEMO_5
+            QSettings::setValue("Html5DatabaseStorage", "0");
+            #else
             QSettings::setValue("Html5DatabaseStorage", "1");
+            #endif
         }
 
         if (!QSettings::contains("Html5DatabaseStorageMaxSize")) {
@@ -224,43 +236,285 @@
             QString maxSize = QString::number(200 * 1024 * 1024);
             QSettings::setValue("Html5ApplicationCacheMaxSize", maxSize);
         }
-        
+
+
+
+        // Gestures library settings
+        initGestureParams();
+
+
         // reserved entries for local bookmarks
         if (!QSettings::contains("Bookmark0Title")) {
             QSettings::setValue("Bookmark0Title", "Browser Welcome Page");
         }
-        
+
         if (!QSettings::contains("Bookmark0Url")) {
             QSettings::setValue("Bookmark0Url", "startpage.html");
         }
-        
+
         if (!QSettings::contains("Bookmark1Title")) {
             QSettings::setValue("Bookmark1Title", "");
         }
-        
+
         if (!QSettings::contains("Bookmark1Url")) {
             QSettings::setValue("Bookmark1Url", "");
         }
-        
+
         if (!QSettings::contains("Bookmark2Title")) {
             QSettings::setValue("Bookmark2Title", "");
         }
-        
+
         if (!QSettings::contains("Bookmark2Url")) {
             QSettings::setValue("Bookmark2Url", "");
         }
     }
-	
-	        // userAgentStringSetup, default empty.  
-        if (!QSettings::contains("UserAgentString"))
+
+	        // userAgentStringSetup, default empty.
+	      
+	      if (!QSettings::contains("UserAgentString"))
         {
-            QSettings::setValue("UserAgentString", QString());
-        }          				
+        	  #if defined Q_WS_MAEMO_5
+            QSettings::setValue("UserAgentString", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7");        
+            #else  // Symbian, Linux etc.
+            QSettings::setValue("UserAgentString", QString());  
+            #endif  
+        }          
+        
+                    				
+        
+        //Scrolling options
+        initScrollingParams();
+        
+        //Tiling options
+        initTilingParams();
+        
     endGroup(); // m_appuid
     sync();
 }
 
 
+void BedrockProvisioning::initScrollingParams()
+{
+    if (!QSettings::contains("KineticDeceleration")) {    
+        QSettings::setValue("KineticDeceleration", 2.0);
+    }
+    
+    if (!QSettings::contains("MaxFlickSpeed")) {    
+        QSettings::setValue("MaxFlickSpeed", 1.2);
+    }
+
+    if (!QSettings::contains("MidFlickSpeed")) {
+        QSettings::setValue("MidFlickSpeed", 0.5);
+    }
+
+    if (!QSettings::contains("MinFlickSpeed")) {
+        QSettings::setValue("MinFlickSpeed", 0.15);
+    }
+
+    if (!QSettings::contains("MaxFlickInViewportUnits")) {
+       QSettings::setValue("MaxFlickInViewportUnits", 0.7);
+    }
+    if (!QSettings::contains("MidFlickInViewportUnits")) {
+       QSettings::setValue("MidFlickInViewportUnits", 0.4);
+    }
+    if (!QSettings::contains("MinFlickInViewportUnits")) {
+       QSettings::setValue("MinFlickInViewportUnits", 0.2);
+    }
+
+    if (!QSettings::contains("MaxFlickDuration")) {
+       QSettings::setValue("MaxFlickDuration", 1000);
+    }
+    if (!QSettings::contains("MidFlickDuration")) {
+       QSettings::setValue("MidFlickDuration", 800);
+    }
+    if (!QSettings::contains("MinFlickDuration")) {
+       QSettings::setValue("MinFlickDuration", 500);
+    }
+    if (!QSettings::contains("ScrollOvershoot")) {
+       QSettings::setValue("ScrollOvershoot", 1.70158);
+    }
+}
+
+void BedrockProvisioning::initTilingParams()
+{
+    if (!QSettings::contains("EnableTiling")) {    
+        QSettings::setValue("EnableTiling", 1);
+    }
+    if (!QSettings::contains("TilesWidth")) {    
+        QSettings::setValue("TilesWidth", 256);
+    }
+    if (!QSettings::contains("TilesHeight")) {    
+        QSettings::setValue("TilesHeight", 256);
+    }
+    if (!QSettings::contains("TileCreationDelay")) {    
+        QSettings::setValue("TileCreationDelay", 50);
+    }
+    if (!QSettings::contains("TileCoverAreaMultiplier")) {    
+        QSettings::setValue("TileCoverAreaMultiplier", 2.5);
+    }
+    if (!QSettings::contains("TileKeepAreaMultiplier")) {    
+        QSettings::setValue("TileKeepAreaMultiplier", 2.5);
+    }    
+}
+
+void BedrockProvisioning::initGestureParams()
+{
+    // Enable/disable specific gestures
+    if (!QSettings::contains("GesturesEnableTap")) {
+        QSettings::setValue("GesturesEnableTap", 1);
+    }
+    if (!QSettings::contains("GesturesEnablePan")) {
+        QSettings::setValue("GesturesEnablePan", 1);
+    }
+    if (!QSettings::contains("GesturesEnableHover")) {
+        QSettings::setValue("GesturesEnableHover", 0);
+    }
+    if (!QSettings::contains("GesturesEnableLeftRight")) {
+        QSettings::setValue("GesturesEnableLeftRight", 1);
+    }
+    if (!QSettings::contains("GesturesEnableUpDown")) {
+        QSettings::setValue("GesturesEnableUpDown", 1);
+    }
+    if (!QSettings::contains("GesturesEnableFlick")) {
+        QSettings::setValue("GesturesEnableFlick", 1);
+    }
+    if (!QSettings::contains("GesturesEnableRelease")) {
+        QSettings::setValue("GesturesEnableRelease", 1);
+    }
+    if (!QSettings::contains("GesturesEnableTouch")) {
+        QSettings::setValue("GesturesEnableTouch", 1);
+    }
+    if (!QSettings::contains("GesturesEnableEdgeScroll")) {
+        QSettings::setValue("GesturesEnableEdgeScroll", 0);
+    }
+    if (!QSettings::contains("GesturesEnableCornerZoom")) {
+        QSettings::setValue("GesturesEnableCornerZoom", 0);
+    }
+    if (!QSettings::contains("GesturesEnablePinch")) {
+        QSettings::setValue("GesturesEnablePinch", 1);
+    }
+    if (!QSettings::contains("GesturesEnableLongPress")) {
+        QSettings::setValue("GesturesEnableLongPress", 1);
+    }
+    if (!QSettings::contains("GesturesEnableUnknown")) {
+        QSettings::setValue("GesturesEnableUnknown", 1);
+    }
+
+    // General gesture settings
+    if (!QSettings::contains("GesturesEnableLogging")) {
+        QSettings::setValue("GesturesEnableLogging", 0);
+    }
+    if (!QSettings::contains("GesturesSuppressTimeout")) {
+        QSettings::setValue("GesturesSuppressTimeout", 0);
+    }
+    if (!QSettings::contains("GesturesMoveSuppressTimeout")) {
+        QSettings::setValue("GesturesMoveSuppressTimeout", 0);
+    }
+    if (!QSettings::contains("GesturesCapacitiveUpUsed")) {
+#ifdef ADVANCED_POINTER_EVENTS
+        QSettings::setValue("GesturesCapacitiveUpUsed", 1);
+#else
+        QSettings::setValue("GesturesCapacitiveUpUsed", 0);
+#endif
+    }
+    if (!QSettings::contains("GesturesAdjustYPos")) {
+#ifdef ADVANCED_POINTER_EVENTS
+        QSettings::setValue("GesturesAdjustYPos", 0);
+#else
+        QSettings::setValue("GesturesAdjustYPos", 0);
+#endif
+    }
+    if (!QSettings::contains("GesturesEnableFiltering")) {
+        QSettings::setValue("GesturesEnableFiltering", 1);
+    }
+    if (!QSettings::contains("GesturesWServMessageInterception")) {
+        QSettings::setValue("GesturesWServMessageInterception", 0);
+    }
+
+    // Individual gesture specific settings
+    // Tap
+    if (!QSettings::contains("GesturesDoubleTapTimeout")) {
+        QSettings::setValue("GesturesDoubleTapTimeout", 600);
+    }
+    // Pan
+    if (!QSettings::contains("GesturesPanSpeedLow")) {
+        QSettings::setValue("GesturesPanSpeedLow", 5);
+    }
+    if (!QSettings::contains("GesturesPanSpeedHigh")) {
+        QSettings::setValue("GesturesPanSpeedHigh", 50);
+    }
+    if (!QSettings::contains("GesturesPanDisabledWhileHovering")) {
+        QSettings::setValue("GesturesPanDisabledWhileHovering", 0);
+    }
+    if (!QSettings::contains("GesturesMoveTolerance")) {
+        QSettings::setValue("GesturesMoveTolerance", 0);
+    }
+    // Hover
+    if (!QSettings::contains("GesturesHoverSpeed")) {
+        QSettings::setValue("GesturesHoverSpeed", 0);
+    }
+    if (!QSettings::contains("GesturesHoverDisabledWhilePanning")) {
+        QSettings::setValue("GesturesHoverDisabledWhilePanning", 0);
+    }
+    // Flick
+    if (!QSettings::contains("GesturesFlickSpeed")) {
+        QSettings::setValue("GesturesFlickSpeed", 35);
+    }
+    // EdgeScroll
+    if (!QSettings::contains("GesturesEdgeScrollRange")) {
+        QSettings::setValue("GesturesEdgeScrollRange", 20);
+    }
+    // CornerZoom
+    if (!QSettings::contains("GesturesZoomCornerSize")) {
+        QSettings::setValue("GesturesZoomCornerSize", 7);
+    }
+    // Area settings
+    if (!QSettings::contains("GesturesTouchAreaShape")) {
+        QSettings::setValue("GesturesTouchAreaShape", 1);
+    }
+    if (!QSettings::contains("GesturesTouchAreaTimeout")) {
+        QSettings::setValue("GesturesTouchAreaTimeout", 50);
+    }
+    if (!QSettings::contains("GesturesTouchAreaWidth")) {
+        QSettings::setValue("GesturesTouchAreaWidth", 7);
+    }
+    if (!QSettings::contains("GesturesTouchAreaHeight")) {
+        QSettings::setValue("GesturesTouchAreaHeight", 7);
+    }
+    if (!QSettings::contains("GesturesTimeAreaShape")) {
+        QSettings::setValue("GesturesTimeAreaShape", 1);
+    }
+    if (!QSettings::contains("GesturesTimeAreaTimeout")) {
+        QSettings::setValue("GesturesTimeAreaTimeout", 0);
+    }
+    if (!QSettings::contains("GesturesTimeAreaWidth")) {
+        QSettings::setValue("GesturesTimeAreaWidth", 11);
+    }
+    if (!QSettings::contains("GesturesTimeAreaHeight")) {
+        QSettings::setValue("GesturesTimeAreaHeight", 11);
+    }
+    if (!QSettings::contains("GesturesHoldAreaShape")) {
+        QSettings::setValue("GesturesHoldAreaShape", 1);
+    }
+    if (!QSettings::contains("GesturesHoldAreaTimeout")) {
+        QSettings::setValue("GesturesHoldAreaTimeout", 1000);
+    }
+    if (!QSettings::contains("GesturesHoldAreaWidth")) {
+        QSettings::setValue("GesturesHoldAreaWidth", 7);
+    }
+    if (!QSettings::contains("GesturesHoldAreaHeight")) {
+        QSettings::setValue("GesturesHoldAreaHeight", 7);
+    }
+    if (!QSettings::contains("GesturesAxisLockThreshold")) {
+        QSettings::setValue("GesturesAxisLockThreshold", 0.5);
+    }
+    
+    if (!QSettings::contains("EnableGestures")) {
+            QSettings::setValue("EnableGestures", 1);
+    }
+}
+
+
 QString BedrockProvisioning::valueAsString(const QString &key, const QVariant &defaultValue)
 {
     return value(key, defaultValue).toString();
--- a/bedrockProvisioning/bedrockprovisioning.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/bedrockProvisioning/bedrockprovisioning.h	Fri Oct 15 17:30:59 2010 -0400
@@ -30,9 +30,11 @@
 #define BEDROCK_ORGANIZATION_NAME "Nokia"
 #define BEDROCK_APPLICATION_NAME "NokiaBrowser"
 #define BEDROCK_VERSION_DEFAULT "NO_VER"
+#define BedrockSettings BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()
 
 namespace BEDROCK_PROVISIONING {
 
+
 class BEDROCKPROVISIONING_EXPORT BedrockProvisioning : public QSettings
 {
     Q_OBJECT
@@ -54,7 +56,9 @@
 private:
     BedrockProvisioning( QObject *parent = 0, QString uid=BEDROCK_PROVISIONING_UID  );
     void init();
-
+    void initGestureParams();
+    void initTilingParams();
+    void initScrollingParams();
 private:
     static BedrockProvisioning* m_BedrockProvisioning;
     QString m_appuid;
--- a/bedrockProvisioning/template/200267EA.ini	Thu Sep 23 15:32:11 2010 -0400
+++ b/bedrockProvisioning/template/200267EA.ini	Fri Oct 15 17:30:59 2010 -0400
@@ -1,4 +1,8 @@
 [200267EA]
 Version=BedrockInternal
-BedrockVersion=8.0.36010
+BedrockVersion=8.0.37190
 DiskCacheEnabled=0
+GesturesAdjustYPos=0
+GesturesEnableFiltering=1
+GesturesEnableLogging=0
+
--- a/browsercore/appfw/Api/Bookmarks/Bookmarks.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Bookmarks/Bookmarks.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -35,3 +35,7 @@
         $$PWD/UnicodeFile.cpp \  
         $$PWD/BookmarkDumpMain.cpp
 }
+
+symbian: {   
+LIBS +=  -lFavouritesEngine  
+}
\ No newline at end of file
--- a/browsercore/appfw/Api/Common/UiUtil.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Common/UiUtil.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -20,6 +20,8 @@
 */
 
 #include <QRegExp>
+#include <QDebug>
+#include <QStringList>
 #include "UiUtil.h"
 
 #define GOOGLE_SEARCH_ENGINE "http://www.google.com/search?q="
@@ -52,48 +54,117 @@
 
 QUrl UiUtil::searchUrl(const QString &string)
 {
-	QString urlStr = string.trimmed();
-	QUrl url(QLatin1String(GOOGLE_SEARCH_ENGINE) + urlStr, QUrl::TolerantMode);
+    QUrl url = searchUrlWithoutCheck(string);
     if(url.isValid())
-		return url;
+        return url;
     else
         return QUrl();
 }
 
+QUrl UiUtil::searchUrlWithoutCheck(const QString &string)
+{
+    QString urlStr = string.trimmed();
+    QString urlStrEncoded = QUrl::toPercentEncoding(string);
+    QUrl url(QLatin1String(GOOGLE_SEARCH_ENGINE) + urlStrEncoded, QUrl::TolerantMode);
+    return url;
+}
+
+QUrl UiUtil::encodeQueryItems(QUrl& url, bool encodeNonAscii)
+{
+    QList< QPair<QString, QString> > queryItems = url.queryItems();
+    if (queryItems.size() != 0) {
+        QString urlStr = url.toString();
+        int queryIndex = urlStr.indexOf("?");
+        int queryLength = urlStr.length() - queryIndex - 1;
+        Q_ASSERT(queryIndex != -1 && queryLength >= 0);
+        urlStr = urlStr.right(queryLength);
+
+        QString queryStr;
+        bool hasValidQuery = false;
+        QStringList queryList = urlStr.split("&");
+        //qDebug() << "queryList!!!!!!!!!!!!!!!:" << queryList;
+        for(int i = 0; i < queryList.size(); i++) {
+            QString query = queryList.at(i);
+            //qDebug() << "query!!!!!!!!!!!!:" << query;
+
+            if (query.isEmpty()) {
+              if ((i == queryList.size() - 1) && queryList.at(i - 1).isEmpty()) // "&&" ==> ["","",""] ==> "%25%25"
+                  continue;
+              queryStr += QUrl::toPercentEncoding("&"); // encode '&' since it is a part of the query text
+            } else {
+                int delimiterIndex = query.indexOf("=");
+                if (delimiterIndex == -1 || delimiterIndex == 0) {
+                    // it is not a valid query, instead, it is a part of query
+                    if (hasValidQuery)
+                        queryStr += QUrl::toPercentEncoding("&"); // encode '&' since it is a part of the query text
+                    queryStr += encodeNonAscii ? QUrl::toPercentEncoding(query, "%") : query; // "q=a&dc$da" ==> ["q=a","dc$da"] ==> for "dc$da", it is a part of the last query
+                }
+                else {
+                    // it is a valid query, close last query before add a new one
+                    // "q=a=c&z=dcda" ==> ["q=a=c","z=dcda"] ==> for "q=a=c", "q" is the key and "a=c" is the value
+                    if (hasValidQuery)
+                        queryStr += "&"; // don't encode this '&' since it is a part of the query delimiter
+                    QString key = encodeNonAscii ? QUrl::toPercentEncoding(query.left(delimiterIndex), "%") : query.left(delimiterIndex);
+                    QString value = encodeNonAscii ? QUrl::toPercentEncoding(query.right(query.length() - delimiterIndex - 1), "%") : query.right(query.length() - delimiterIndex - 1);
+                    QString newQuery = key + "=" + value;
+                    queryStr += newQuery;
+                    hasValidQuery = true;
+                }
+            }
+                
+        }
+        QUrl encodedUrl = QUrl(url.toString().left(queryIndex + 1) + queryStr);
+        return encodedUrl;
+        //qDebug() << "new query url ---> " << url.toString();
+    }
+    
+    return url;
+}
+
 QUrl UiUtil::guessUrlFromString(const QString &string)
 {
     QString urlStr = string.trimmed();
     QRegExp schemaTest(QLatin1String("^[a-zA-Z]+\\:.*"));
+    QRegExp fileTest(QLatin1String("^[a-zA-Z]:/.*"));
+    
+    //remove new line character
+    if (urlStr.contains("\n"))
+        urlStr.replace(QLatin1String("\n"), QLatin1String(""));
 
     // Check if it looks like a qualified URL. Try parsing it and see.
     bool hasSchema = schemaTest.exactMatch(urlStr);
+    bool isFileUrl = fileTest.exactMatch(urlStr);
     bool hasSpaces = urlStr.contains(" ");
+
+    // Is it a file path (ex. "c:/data/test.html")?
+    if (isFileUrl) {
+        if (QFile::exists(urlStr)) {
+            return QUrl::fromLocalFile(urlStr);
+        }
+    }
+    
     if (hasSchema) {
         if(!hasSpaces){
-			QUrl url(urlStr, QUrl::TolerantMode);
-			if (url.isValid())
-				return url;
-		}
-		else{
-			if(urlStr.contains("https://")){
-				urlStr.remove("https://" ,Qt::CaseInsensitive);
-			}
-			else if(urlStr.contains("http://")){
-				urlStr.remove("http://" ,Qt::CaseInsensitive);
-			}
-			else if(urlStr.contains("rtsp://")){
-				urlStr.remove("rtsp://" ,Qt::CaseInsensitive);
-			}
-			QUrl url(QLatin1String(GOOGLE_SEARCH_ENGINE) + urlStr, QUrl::TolerantMode);
-			if(url.isValid())
-				return url;
-		}
+            QUrl url(urlStr, QUrl::TolerantMode);
+            if (url.isValid())
+                return encodeQueryItems(url, false);
+        }
+        else{
+            if(urlStr.contains("https://")){
+                urlStr.remove("https://" ,Qt::CaseInsensitive);
+            }
+            else if(urlStr.contains("http://")){
+                urlStr.remove("http://" ,Qt::CaseInsensitive);
+            }
+            else if(urlStr.contains("rtsp://")){
+                urlStr.remove("rtsp://" ,Qt::CaseInsensitive);
+            }
+            QUrl url = searchUrlWithoutCheck(urlStr);
+            if(url.isValid())
+                return url;
+        }
     }
-    // Might be a file.
-    if (hasSchema) {
-        if (QFile::exists(urlStr))
-            return QUrl::fromLocalFile(urlStr);
-    }  
+    
     // Might be a shorturl - try to detect the schema.
     if (!hasSchema) {
         int dotIndex = urlStr.indexOf(QLatin1Char('.'));
@@ -101,25 +172,26 @@
             QUrl url;
             urlStr.endsWith(".") ? ( url.setUrl(QLatin1String("http://") + urlStr + QLatin1String("com"), QUrl::TolerantMode) ) : ( url.setUrl(QLatin1String("http://") + urlStr, QUrl::TolerantMode) );
             if (url.isValid()){
-                return url;
+                return encodeQueryItems(url, false);
             }
-    //--Condition for Character DOT(.)--
+            //--Condition for Character DOT(.)--
             else {
-                QUrl url(QLatin1String(GOOGLE_SEARCH_ENGINE) + urlStr, QUrl::TolerantMode);
+                QUrl url = searchUrlWithoutCheck(urlStr);
                 if(url.isValid())
                     return url;
             }
         }
-    //--The string parameter is simple text and a search should be performed. Like for Special Character :\ etc.--
-		else {
-            QUrl url(QLatin1String(GOOGLE_SEARCH_ENGINE) + urlStr, QUrl::TolerantMode);
+        //--The string parameter is simple text and a search should be performed. Like for Special Character :\ etc.--
+        else {
+            QUrl url = searchUrlWithoutCheck(urlStr);
             if(url.isValid())
                 return url;
         }
     }
 
     // Fall back to QUrl's own tolerant parser.
-    return QUrl(string, QUrl::TolerantMode);
+    QUrl url = QUrl(string, QUrl::TolerantMode);
+    return encodeQueryItems(url, false);
 }
 
 }
--- a/browsercore/appfw/Api/Common/UiUtil.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Common/UiUtil.h	Fri Oct 15 17:30:59 2010 -0400
@@ -32,5 +32,8 @@
         static QUrl guessUrlFromString(const QString &string);
      	static QUrl searchUrl(const QString &string);
         static QString removeScheme(const QString & str);
+        static QUrl encodeQueryItems(QUrl& url, bool encodeNonAscii);
+    private:
+        static QUrl searchUrlWithoutCheck(const QString &string);
     };
 }
--- a/browsercore/appfw/Api/Common/ViewEventContext.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Common/ViewEventContext.h	Fri Oct 15 17:30:59 2010 -0400
@@ -61,6 +61,10 @@
       protected:
         QString m_viewType;
         ScriptPoint m_pos;        
+      private:
+#ifdef ENABLE_TESTS
+        friend class ViewEventContextTest;
+#endif
     };
 
 #endif /* VIEWEVENTCONTEXT_H_ */
--- a/browsercore/appfw/Api/Common/WebViewEventContext.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Common/WebViewEventContext.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -38,6 +38,7 @@
     m_elementId(hitTest.element().attribute("id")),
     m_frameName(hitTest.frame() ? hitTest.frame()->frameName() : QString::null),
     m_imageUrl(hitTest.imageUrl().toString()),
+    m_isContentEditable(hitTest.isContentEditable()),
     m_isContentSelected(hitTest.isContentSelected()),
     m_linkElementId(hitTest.linkElement().attribute("id")),
     m_linkFrameName(hitTest.linkTargetFrame() ? hitTest.linkTargetFrame()->frameName() : QString::null)
@@ -54,6 +55,7 @@
     m_elementId(o.getElementId()),
     m_frameName(o.getFrameName()),
     m_imageUrl(o.getImageUrl()),
+    m_isContentEditable(o.getIsContentEditable()),
     m_isContentSelected(o.getIsContentSelected()),
     m_linkElementId(o.getLinkFrameName()),
     m_linkFrameName(o.getLinkFrameName())
--- a/browsercore/appfw/Api/Common/WebViewEventContext.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Common/WebViewEventContext.h	Fri Oct 15 17:30:59 2010 -0400
@@ -68,6 +68,9 @@
         QString getImageUrl() const { return m_imageUrl; }
         Q_PROPERTY(QString imageUrl READ getImageUrl)
 
+        bool getIsContentEditable () const { return m_isContentEditable; }
+        Q_PROPERTY(bool isContentEditable READ getIsContentEditable)
+
         bool getIsContentSelected () const { return m_isContentSelected; }
         Q_PROPERTY(bool isContentSelected READ getIsContentSelected)
         
@@ -78,6 +81,7 @@
         QString m_elementId;
         QString m_frameName;
         QString m_imageUrl;
+        bool m_isContentEditable;
         bool m_isContentSelected;
         QString m_linkElementId;
         QString m_linkFrameName;
--- a/browsercore/appfw/Api/Common/wrtBrowserUtils.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Common/wrtBrowserUtils.h	Fri Oct 15 17:30:59 2010 -0400
@@ -25,6 +25,7 @@
 #include <QWebElement>
 #include "wrtBrowserDefs.h"
 #include "brtglobal.h"
+#include <QWebHitTestResult>
 
 class WRT_BROWSER_EXPORT wrtBrowserUtils
 {
--- a/browsercore/appfw/Api/Managers/ContentAgent.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/ContentAgent.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -22,6 +22,7 @@
 #include "ContentAgent.h"
 #include "bookmarks.h"
 #include <browsercontentdll.h>
+#include "bedrockprovisioning.h"
 
 
 namespace WRT {
@@ -33,9 +34,10 @@
     m_loadedHistory(false),
     m_maxUrls(10) 
 {
-    QFileInfo dbFile("browserContent.db");
-  
-    m_bookmarkSession=new BrowserContent("Bedrock");
+	 
+    QString databaseName = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseName");
+    m_bookmarkSession=new BrowserContent("Bedrock", databaseName);
+    
     if (m_bookmarkSession) {
         m_connectedToBookmarks = true;
     } else {
--- a/browsercore/appfw/Api/Managers/HistoryManager.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/HistoryManager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -47,17 +47,8 @@
 {
     QFileInfo dbFile("browserContent.db");
 
-#ifdef Q_WS_MAEMO_5
-    m_import = false;    
-    if (dbFile.exists()){
-      m_import = false;
-    }
-    else {
-      m_import = true;
-    }
-#endif
-
-    m_historySession=new BrowserContent("Bedrock");
+    QString databaseName = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseName");
+    m_historySession=new BrowserContent("Bedrock",databaseName);
     if (m_historySession) {
         m_connectedToHistory = true;
     } else {
@@ -278,4 +269,3 @@
 {
     return d->m_historySession->findSimilarHistoryItems(title);
 }
-
--- a/browsercore/appfw/Api/Managers/Managers.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/Managers.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -43,6 +43,12 @@
     HEADERS += $$PWD/hsbookmarkpublishclient.h
     SOURCES += $$PWD/hsbookmarkpublishclient.cpp
 }
+
+contains(br_geolocation, yes) {
+    HEADERS += $$PWD/geolocationManager.h
+    SOURCES += $$PWD/geolocationManager.cpp
+}  
+	
 symbian::SOURCES += $$PWD/lowmemoryhandler_p_s60.cpp
 !symbian::SOURCES += $$PWD/lowmemoryhandler_p.cpp
 INCLUDEPATH += $$PWD/../../../../../../mw/browser/bookmarks
--- a/browsercore/appfw/Api/Managers/bookmarkscontroller.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/bookmarkscontroller.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -16,11 +16,12 @@
 #include "BookmarkResults.h"
 #include "HistoryManager.h"
 
+
 BookmarksController::BookmarksController(QWidget *parent) :
 	    QObject(parent)
 {
 	setObjectName("bookmarksController");
-	m_bm = new BookmarksManager(parent);
+	m_bm = B_Mgr;
 }
 
 BookmarksController::~BookmarksController() {
@@ -138,4 +139,5 @@
 
 }
 
+
 // TODO add tag stuff when we get a ui for it
--- a/browsercore/appfw/Api/Managers/bookmarkscontroller.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/bookmarkscontroller.h	Fri Oct 15 17:30:59 2010 -0400
@@ -15,7 +15,6 @@
 class BookmarksManager;
 class BookmarkResults;
 class BookmarkFav;
-//#include "BookmarksManager.h"
 
 class BWF_EXPORT Suggestion : public QObject
 {
@@ -35,7 +34,6 @@
             QString suggestUrl() {return m_url;}
 };
 
-
 class BWF_EXPORT BookmarksController : public QObject {
 
 	  Q_OBJECT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/geolocationManager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 2.1 of the License.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, 
+ * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+ *
+ * Description: This implements the geolocation database API's.
+ *
+ */
+
+#include<QString>
+#include<QFile>
+#include<QFileInfo>
+#include<QDebug>
+#include<QSqlQuery>
+#include<QSqlError>
+#include<QWidget>
+#include<QDateTime>
+#include<QtGui>
+
+#include "geolocationManager.h"
+
+/* Declare the user defined meta type for use with QVariant in geolocation. */
+Q_DECLARE_METATYPE(QWebPage::PermissionPolicy);
+
+GeolocationManager* GeolocationManager::getSingleton() 
+{
+    static GeolocationManager* s_instance;
+    if(!s_instance) {
+        s_instance = new GeolocationManager();
+    }
+    Q_ASSERT(s_instance);
+    return s_instance;    
+}
+
+GeolocationManager::GeolocationManager(QWidget *parent) :
+    QObject(parent)
+{
+    setObjectName("geolocationManager");
+    
+    /* Register user defined Meta Types used in geolocation API. */
+    qRegisterMetaType<QWebPage::PermissionPolicy>("QWebPage::PermissionPolicy");
+    
+    m_geo = QSqlDatabase::database(GEOLOCATION_DB_NAME);
+    if (!m_geo.isValid()) {
+        m_geo = QSqlDatabase::addDatabase("QSQLITE", GEOLOCATION_DB_NAME);
+        m_geo.setDatabaseName(GEOLOCATION_DB_FILE);
+    }
+    if (m_geo.open()) {
+        if(!doesTableExist(GEOLOCATION_TABLE_NAME)) {
+            createGeolocationSchema();
+        }
+    }
+}
+
+GeolocationManager::~GeolocationManager()
+{
+    m_geo.close();
+    QSqlDatabase::removeDatabase(GEOLOCATION_DB_NAME);
+}
+
+bool GeolocationManager::doesTableExist(QString tableName)
+{
+    bool retVal = false;
+       
+    if (!m_geo.isValid() || !m_geo.isOpen())
+         return false;
+       
+    QSqlQuery query(m_geo);
+    query.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name=:tableName");
+    query.bindValue(":tableName", QVariant(tableName));
+    if (query.exec()) {
+        if (query.next()) 
+            retVal = true;
+        query.finish();
+    }
+    return retVal;
+}
+   
+void GeolocationManager::createGeolocationSchema()
+{
+    if (!doQuery("CREATE TABLE IF NOT EXISTS geolocationdata("
+        "domain text PRIMARY KEY,"
+        "creationtime int, "
+        "permission text)")) {
+        // TODO: do some error handling here!
+        return;
+    }
+    // We do lookups by domain
+    if (!doQuery("CREATE INDEX IF NOT EXISTS geo_domain_idx ON geolocationdata(domain ASC)")) {
+        // TODO: do some error handling here!
+        return;
+    }
+}
+
+// TODO refactor this - nothing except the schema creation can use it as is
+bool GeolocationManager::doQuery(QString query)
+{
+    QSqlQuery db_query(m_geo);
+    bool ok = db_query.exec(query);
+    if (!ok) {
+        qDebug() << "GeolocationManager::doQuery" << QString("ERR: %1 %2").arg(
+                db_query.lastError().type()).arg(db_query.lastError().text())
+                << " Query: " << db_query.lastQuery();
+    }
+    return ok;
+}
+
+/**===================================================================================
+ * Description: Converts database permission string into enum
+ * Returns: permission enum
+ ======================================================================================*/
+QWebPage::PermissionPolicy GeolocationManager::convertStringIntoPermission(QString permission)
+{
+    QWebPage::PermissionPolicy permissionPolicy = QWebPage::PermissionUnknown;
+    	
+    if (permission == "G") 
+        permissionPolicy = QWebPage::PermissionGranted;
+    else if (permission == "D") 
+        permissionPolicy = QWebPage::PermissionDenied;
+    else if (permission == "U") 
+        permissionPolicy = QWebPage::PermissionUnknown;
+    
+    return permissionPolicy;
+}
+
+/**===================================================================================
+ * Description: Converts permission enum into database string
+ * Returns: String
+ ======================================================================================*/
+QString GeolocationManager::convertPermissionIntoString(QWebPage::PermissionPolicy permission)
+{
+    QString retVal;
+
+    switch (permission) {
+      case QWebPage::PermissionGranted:
+         retVal = "G";
+         break;
+      case QWebPage::PermissionDenied:
+         retVal = "D";
+         break;
+      case QWebPage::PermissionUnknown:
+         retVal = "U";
+         break;
+      default:
+         retVal = "";    
+    }
+    
+    return retVal;
+}
+
+/**===================================================================================
+ * Description: Delete the geolocation item.
+ * Returns: SUCCESS(0) or Failure(-1 or -2)
+ ======================================================================================*/
+int GeolocationManager::deleteGeodomain(QString domain)
+{
+   int retVal = SUCCESS;
+       
+    if (domain.isEmpty())
+        retVal = FAILURE;
+       
+    if (retVal == SUCCESS) {
+        if (m_geo.isOpen()) {
+        QSqlQuery query(m_geo);
+               
+        query.prepare("DELETE FROM geolocationdata WHERE domain=:geodomain");
+        query.bindValue(":geodomain", domain);
+        if (!query.exec()) {
+            lastErrMsg(query);
+            retVal = DATABASEERROR;
+        }
+        } else 
+               retVal = FAILURE;
+    }
+       
+    return retVal;
+}
+ 
+/**===================================================================================
+ * Description: Delete all records from the geolocation table.
+ * Returns: SUCCESS(0) or FAILURE(-1 or -2)
+ ======================================================================================*/
+int GeolocationManager::clearAllGeodata()
+{
+    int retVal = SUCCESS;
+    
+    if (m_geo.isOpen()) {
+        QSqlQuery query(m_geo);
+        
+        if (!query.exec("DELETE FROM geolocationdata")) {
+            lastErrMsg(query);
+            retVal = DATABASEERROR;
+        }
+    } else
+        retVal = FAILURE;
+    
+    return retVal;
+}
+
+
+
+/**================================================================
+ * Description: Adds a domain to the database. 
+ * Returns: SUCCESS(0) or FAILURE (-1 or -2)
+ ==================================================================*/
+int GeolocationManager::addGeodomain(QString domainToAdd, QWebPage::PermissionPolicy permission)
+{
+    int retVal = SUCCESS;
+    
+    if (domainToAdd.isEmpty() || permission == QWebPage::PermissionUnknown)
+        retVal = FAILURE;
+    
+    if (retVal == SUCCESS) {
+        QString permissionPolicy(convertPermissionIntoString(permission));
+        
+        QDateTime dt  = QDateTime::currentDateTime();
+        int timestamp = dt.toTime_t();
+    
+        if (m_geo.isOpen()) {
+            QSqlQuery query(m_geo);
+            m_geo.transaction();
+            query.prepare("SELECT domain FROM geolocationdata WHERE domain=:domain");
+            query.bindValue(":domain",domainToAdd);
+            if (!query.exec()) {
+                 lastErrMsg(query);
+                 m_geo.rollback();
+                return DATABASEERROR;
+            }
+            if(!query.next()) {
+                QSqlQuery query2(m_geo);
+                query2.prepare("INSERT INTO geolocationdata (domain, creationtime, permission) "
+                        "VALUES (:domain, :ctime, :ppermisson)");
+                query2.bindValue(":domain", QVariant(domainToAdd));
+                query2.bindValue(":ctime", QVariant(timestamp));
+                query2.bindValue(":ppermission", QVariant(permissionPolicy));
+                if (!query2.exec()) {
+                    lastErrMsg(query);
+                    m_geo.rollback();
+                    retVal = DATABASEERROR;
+                }
+            }
+            query.finish();
+            if (!m_geo.commit()) {
+                 qDebug() << m_geo.lastError().text();
+                 m_geo.rollback();
+                 return DATABASEERROR;
+            }
+        } else
+            retVal = FAILURE;
+    }
+    
+    return retVal;
+}
+
+/**==============================================================
+ * Description: Finds attributes (row) including permission policy for a domain.
+ * Returns: empty list (not found) or list of attributes
+ ===============================================================*/
+QList<QVariant> GeolocationManager::findGeodomain(QString domainToFind)
+{ 
+    QList<QVariant> retValue;
+    
+    if (m_geo.isOpen()) {
+        QSqlQuery query(m_geo);
+        query.prepare(
+                "SELECT permission FROM geolocationdata WHERE domain=:domain");
+        query.bindValue(":domain",domainToFind);
+        if (query.exec()) {
+            if (query.next()) {
+                QWebPage::PermissionPolicy permission = convertStringIntoPermission(query.value(0).toString());
+                QVariant v;
+                v.setValue(permission);
+                retValue << v;
+                return retValue;
+            }
+        } else {
+            lastErrMsg(query);
+        }
+    }
+    
+    return retValue;
+}
+
+/**==============================================================
+ * Description: Prints a last error message from the query.
+ * Returns: Nothing.
+ ===============================================================*/
+void GeolocationManager::lastErrMsg(QSqlQuery& query)
+{
+    qDebug() << "GeolocationManager::lastErrMsg" << QString("ERR: %1 %2").arg(
+            query.lastError().type()).arg(query.lastError().text())
+            << " Query: " << query.lastQuery();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/geolocationManager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not, 
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description: 
+*
+*/
+#ifndef GEOLOCATIONMANAGER_H
+#define GEOLOCATIONMANAGER_H
+
+#include <QString>
+#include <QObject>
+#include <QSqlDatabase>
+#include <QSqlError>
+#include <QVariant>
+#include <QWebPage>
+#include "BWFGlobal.h"
+
+class QWidget;
+
+#define GEOLOCATION_DB_NAME   "Geolocation"
+#define GEOLOCATION_DB_FILE   "geolocation.db"
+#define GEOLOCATION_TABLE_NAME   "geolocationdata"
+
+
+
+class BWF_EXPORT GeolocationManager : public QObject {
+  
+  Q_OBJECT
+
+public:
+    enum status {
+        SUCCESS = 0,
+        FAILURE = -1,
+        DATABASEERROR = -2
+    };
+   
+    static GeolocationManager* getSingleton();
+    virtual ~GeolocationManager();
+ 
+public slots:
+
+    int addGeodomain(QString domainToAdd, QWebPage::PermissionPolicy permission);
+    int deleteGeodomain(QString domain);
+    int clearAllGeodata();
+    QList<QVariant> findGeodomain(QString domain);
+    
+ private:
+    GeolocationManager(QWidget *parent = 0);
+    bool doQuery(QString query);
+    bool doesTableExist(QString tableName);
+    void createGeolocationSchema();
+    void lastErrMsg(QSqlQuery& query);
+    QWebPage::PermissionPolicy convertStringIntoPermission(QString permission);
+    QString convertPermissionIntoString(QWebPage::PermissionPolicy permission);
+
+    QSqlDatabase  m_geo;
+};
+
+#endif //GEOLOCATIONMANAGER_H
--- a/browsercore/appfw/Api/Managers/hsbookmarkpublishclient.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/hsbookmarkpublishclient.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -87,7 +87,7 @@
     params["faviconFileName"] = iconFileName;
     
     saveFavicon(Url, iconFileName);
-    
+  
     QObject* service = manager.loadInterface(interfaces.first());
 
     // access service's addWidget function
--- a/browsercore/appfw/Api/Managers/webpagecontroller.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/webpagecontroller.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -34,6 +34,7 @@
 #include "LoadController.h"
 #include "ContentAgent.h"
 #include "lowmemoryhandler.h"
+#include "webnetworkaccessmanager.h"
 #include <QWebFrame>
 #include <QWebHistory>
 #include <QGraphicsWebView>
@@ -45,6 +46,9 @@
 #include <QWebDatabase>
 #include <QWebSettings>
 #include <QtCore/QSettings>
+#include <QUrl>
+#include <QDesktopServices>
+
 using namespace WRT;
 
 #ifdef ORBIT_UI
@@ -275,12 +279,11 @@
     
     QString historyFile = d->m_historyDir + QLatin1String("/history") + indexStr + QLatin1String(".history");
     QFile file(historyFile);    
-    if(file.open(QIODevice::ReadOnly)) 
+    if(file.exists())
     {
     	  if(file.size() <= 12) // empty file
     	  {	
         	file.remove();
-        	file.close();
         	return NULL;
         }
         else
@@ -417,7 +420,13 @@
     connect( page->networkAccessManager(), SIGNAL( networkErrorHappened(const QString &) ), this, SIGNAL( networkErrorHappened(const QString &) ) );
     connect( page->networkAccessManager(), SIGNAL( networkErrorHappened(const QString &) ), this, SLOT( processNetworkErrorHappened(const QString &) ) );
     connect( page->networkAccessManager(), SIGNAL( networkErrorUrl(const QUrl &) ), this, SLOT( processNetworkErrorUrl(const QUrl &) ) );
-    
+
+#ifdef QT_GEOLOCATION
+    // Connect geolocation permission
+    connect(page, SIGNAL(requestGeolocationPermission(QWebFrame*, QWebPage::PermissionDomain, QString)),
+        this, SLOT(handleRequestGeolocationPermission(QWebFrame*, QWebPage::PermissionDomain, QString)));
+#endif // QT_GEOLOCATION
+
     connect(currentPage(), SIGNAL(pageScrollPositionZero()), this, SIGNAL(pageScrollPositionZero()) );
     connect(page, SIGNAL(scrollRequested(int, int, const QRect & )), this, SIGNAL(pageScrollRequested(int, int, const QRect & )) );
 
@@ -479,6 +488,23 @@
 	}
 }
 
+#ifdef QT_GEOLOCATION
+void WebPageController::handleRequestGeolocationPermission(QWebFrame* frame, QWebPage::PermissionDomain permissionDomain, QString domain)
+{ 	  
+    emit requestGeolocationPermission(dynamic_cast<QObject*>(frame), dynamic_cast<QObject*>(currentPage()), domain);
+    
+    qDebug() << "WebPageController::handleRequestGeolocationPermission";
+}
+
+void WebPageController::setGeolocationPermission(QObject* _frame, QObject* _page, bool permissionGranted, bool saveSetting)
+{
+	  QWebFrame* frame = dynamic_cast<QWebFrame*>(_frame);
+	  WRT::WrtBrowserContainer* page = dynamic_cast<WRT::WrtBrowserContainer*>(_page);
+	  	  	
+    page->setGeolocationPermission(frame, QWebPage::GeolocationPermissionDomain, permissionGranted, saveSetting);
+}
+#endif // QT_GEOLOCATION
+
 void WebPageController::updateHistory()
 {
     HistoryManager::getSingleton()->addHistory(currentDocUrl(), currentDocTitle());
@@ -713,7 +739,7 @@
 
 void WebPageController::currentLoad(const QString &url)
 {
-    currentLoad(QUrl(url));
+    currentLoad(QUrl::fromUserInput(url));
 }
 
 /*
@@ -774,7 +800,11 @@
 #else
 void WebPageController::share(const QString &url)
 {
-    return; // Not supported 
+    //format is:  mailto:?body=url
+
+    QString emailString = "mailto:?body=" + url;
+    QUrl emailUrl(emailString);
+    QDesktopServices::openUrl(emailUrl);
 }
 #endif 
 
@@ -838,7 +868,13 @@
 #else
 void WebPageController::feedbackMail(const QString &mailAddress, const QString &mailBody)
 {
-    return; // Not supported 
+    //format is:   mailto:test@somewhere.com?body=TestBody
+
+    QString emailString = "mailto:" + mailAddress + "?body=" + mailBody;
+    QUrl url(emailString);
+    QDesktopServices::openUrl(url);
+    	
+    return;
 }
 #endif 
 /*!
@@ -948,10 +984,10 @@
         case SecureUIController::untrustedLoadFinished:
         case SecureUIController::mixedLoadFinished:
         case SecureUIController::untrustedMixedLoadFinished:
-            emit showSecureIcon();
+            emit showSecureIcon(true);
             break;
         case SecureUIController::unsecureLoadFinished:
-            emit hideSecureIcon();
+            emit showSecureIcon(false);
             break;
         default:
             break; 
@@ -1000,9 +1036,9 @@
 
 void WebPageController::loadLocalFile()
 	{
-    QString chromeBaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("LocalPagesBaseDirectory");
+    QString localPagesBaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("LocalPagesBaseDirectory");
     QString startPage = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("StartPage");
-    QString startPagePath = chromeBaseDir + startPage;
+    QString startPagePath = localPagesBaseDir + startPage;
 
     currentLoad(startPagePath);
 	}
@@ -1114,6 +1150,7 @@
     
     // Get index of current page
     WRT::WrtBrowserContainer* theCurrentPage = currentPage();
+
     int currentIndex = d->m_allPages.indexOf(theCurrentPage);
          
     for (int tIndex = 0; tIndex < pageCount; tIndex++)
@@ -1463,6 +1500,13 @@
             index++;          
         }
     }
+    //Delete all the cookies from the QNetworkCookie.
+    unsigned int pageCount =  d->m_allPages.count();
+    QNetworkAccessManager* accessManager = NULL;
+    for (int tIndex = 0; tIndex < pageCount; tIndex++){
+        accessManager = d->m_allPages.at(tIndex)->networkAccessManager();
+        static_cast<WebNetworkAccessManager*>(accessManager)->deleteCookiesFromMemory();
+    }
 }
 
 void WebPageController::deleteCache()
@@ -1500,48 +1544,10 @@
     	return;
     	
     //QDir dir1(d->m_historyDir +"/cwrtCache/http");	  
-    QDir dir1(diskCacheDir + "/http");
-    	
-    QFileInfoList fileList1(dir1.entryInfoList(QDir::Files));
-      
-    foreach (const QFileInfo fileInfo, fileList1) {
-            const QString filePath(fileInfo.absoluteFilePath());
-            QFile file(filePath);
-            if(file.open(QIODevice::ReadOnly)) {
-               file.remove();
-               file.close();
-            }            
+    QDirIterator it(diskCacheDir, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
+    while (it.hasNext()) {
+        QFile::remove(it.next());
     }
-    
-    //QDir dir2(d->m_historyDir +"/cwrtCache/https");
-    QDir dir2(diskCacheDir +"/https");
-    
-    QFileInfoList fileList2(dir2.entryInfoList(QDir::Files));
-      
-    foreach (const QFileInfo fileInfo, fileList2) {
-            const QString filePath(fileInfo.absoluteFilePath());
-            QFile file(filePath);
-            if(file.open(QIODevice::ReadOnly)) {
-               file.remove();
-               file.close();
-            }            
-    }
-    
-    //QDir dir3(d->m_historyDir +"/brCache/prepared");
-    QDir dir3(diskCacheDir +"/cwrtCache/prepared");
-    
-    QFileInfoList fileList3(dir3.entryInfoList(QDir::Files));
-      
-    foreach (const QFileInfo fileInfo, fileList3) {
-            const QString filePath(fileInfo.absoluteFilePath());
-            QFile file(filePath);
-            if(file.open(QIODevice::ReadOnly)) {
-               file.remove();
-               file.close();
-            }            
-    }
-    
-    
 }
 
 void WebPageController::urlChanged(const QUrl& url)
@@ -1574,13 +1580,13 @@
     return NULL;
 }
 
-void WebPageController::checkAndUpdatePageThumbnails()
+void WebPageController::checkAndUpdatePageThumbnails(QSize &s)
 {
 //    WebContentWidget* view = qobject_cast<WebContentWidget*> (webView());
-    QGraphicsWebView *view = webView();
-    WRT::WrtBrowserContainer* savedPage = qobject_cast<WRT::WrtBrowserContainer*> (view->page());
-    if(!savedPage) return;
-    QSize currSize = view->size().toSize();
+//    QGraphicsWebView *view = webView();
+//    WRT::WrtBrowserContainer* savedPage = qobject_cast<WRT::WrtBrowserContainer*> (view->page());
+//    if(!savedPage) return;
+//    QSize currSize = view->size().toSize();
 
     bool needRestore =  false;
 
@@ -1591,6 +1597,7 @@
 
         // If not still a blank window, check whether we need to update the img
         if (!page->emptyWindow() ){
+/*
             QImage img = data.m_thumbnail;
             bool isSameMode = ( (img.size().width() > img.size().height()) == (currSize.width() > currSize.height()) );
             if (img.isNull() || !isSameMode) {
@@ -1605,33 +1612,32 @@
                 page->savePageDataToHistoryItem(page->mainFrame(), &item);
                 page->setUpdateThumbnail(false);
             }
+*/
          }
     }
 
     // restore
-    if (needRestore) {    
+/*    if (needRestore) {
         view->setPage(savedPage);
         savedPage->setWebWidget(view);
-    }
+    }*/
 }
 
 void WebPageController::updatePageThumbnails()
 {
     // update current page's thumbnail forcely since the scrolling position may change
     WRT::WrtBrowserContainer *page = currentPage();
-    if(page) {
        QWebHistoryItem item = page->history()->currentItem();
-       page->savePageDataToHistoryItem(page->mainFrame(), &item);
+//    page->savePageDataToHistoryItem(page->mainFrame(), &item);
        page->setUpdateThumbnail(false);
-       checkAndUpdatePageThumbnails();
-    }
+//    checkAndUpdatePageThumbnails();
 }
 
 void WebPageController::resizeAndUpdatePageThumbnails(QSize& s)
 {
-    webView()->resize(s); // resize the view
+//    webView()->resize(s); // resize the view
 
-    checkAndUpdatePageThumbnails();
+    checkAndUpdatePageThumbnails(s);
 }
 
 void WebPageController::urlTextChanged(QString str ) {
@@ -1702,6 +1708,34 @@
     return m_promptReserved; 
 } 
 
+void WebPageController::copy() {
+    WRT::WrtBrowserContainer * activePage = currentPage();
+    if(activePage)
+        activePage->triggerAction(QWebPage::Copy);
+}
+
+void WebPageController::cut() {
+    WRT::WrtBrowserContainer * activePage = currentPage();
+    if(activePage)
+        activePage->triggerAction(QWebPage::Cut);
+}
+
+void WebPageController::paste() {
+    WRT::WrtBrowserContainer * activePage = currentPage();
+    if(activePage)
+        activePage->triggerAction(QWebPage::Paste);
+}
+
+bool WebPageController::hasTextOnClipBoard() {
+    const QClipboard *clipboard = QApplication::clipboard();
+    if (clipboard) {
+        const QMimeData *mimeData = clipboard->mimeData();
+        if (mimeData)
+            return mimeData->hasText();
+    }
+    return false;
+}
+
 /*!
   \fn void WebPageController::pageCreated(WrtPage* newPage);
   emitted when a page is created
--- a/browsercore/appfw/Api/Managers/webpagecontroller.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Managers/webpagecontroller.h	Fri Oct 15 17:30:59 2010 -0400
@@ -27,6 +27,7 @@
 #include <QNetworkReply>
 #include <QSslError>
 #include <QWebFrame>
+#include <QWebPage>
 #include <QIcon>
 #include <QEvent>
 #include "browserpagefactory.h"
@@ -168,7 +169,7 @@
     Q_PROPERTY(bool editMode READ editMode)
 
 private:
-    void checkAndUpdatePageThumbnails();
+    void checkAndUpdatePageThumbnails(QSize &s);
     WRT::WrtBrowserContainer* openPage(QObject* parent, WRT::WrtBrowserContainer* page=0);
     void releaseMemory();
 
@@ -185,7 +186,7 @@
     void deleteCache();
     void deleteDataFiles();
     void savePopupSettings(int);
-    bool getPopupSettings();
+    bool getPopupSettings();	// Returns true if popups are blocked.
     void saveSaverestoreSettings(int);
     bool getSaverestoreSettings();
     void clearHistoryInMemory();
@@ -205,7 +206,12 @@
     void gotoCurrentItem();
     void setCurrentPage(WRT::WrtBrowserContainer*);
     void LoadInNewWindow(const QString & url);
-         	    
+
+    void copy();
+    void cut();
+    void paste();
+    bool hasTextOnClipBoard();
+
     static WebPageController* getSingleton();
 
     void urlTextChanged(QString );
@@ -220,7 +226,10 @@
     void updateHistory();
     
     void share(const QString &url); 
-    void feedbackMail(const QString &mailAddress, const QString &mailBody); 
+    void feedbackMail(const QString &mailAddress, const QString &mailBody);
+#ifdef QT_GEOLOCATION
+    void setGeolocationPermission(QObject* frame, QObject* page, bool permissionGranted, bool saveSetting);
+#endif // QT_GEOLOCATION
 
 private slots:
     void updateStatePageLoading();
@@ -239,6 +248,10 @@
     void onLoadFinished(bool);
     void onDatabaseQuotaExceeded (QWebFrame *,QString);  
     void onLoadFinishedForBackgroundWindow(bool);
+#ifdef QT_GEOLOCATION
+    void handleRequestGeolocationPermission(QWebFrame* frame, QWebPage::PermissionDomain permissionDomain, QString domain);
+#endif // QT_GEOLOCATION
+   
 signals:
     void creatingPage( WRT::WrtBrowserContainer* newPage);
     void pageCreated( WRT::WrtBrowserContainer* newPage);
@@ -268,8 +281,7 @@
     void pageScrollPositionZero();
     void pageScrollRequested(int, int, const QRect & );
 
-    void showSecureIcon();
-    void hideSecureIcon();
+    void showSecureIcon(bool);
 
     // All signals for urlsearch 
     void pageLoadStarted();
@@ -285,6 +297,11 @@
     // Signals for low and out of memory
     void lowMemory();
     void outOfMemory();
+
+#ifdef QT_GEOLOCATION   
+    // Signal for geolocation permission
+    void requestGeolocationPermission(QObject *frame, QObject *page, QString domain);
+#endif // QT_GEOLOCATION
  
 private:
 
--- a/browsercore/appfw/Api/Views/HistoryFlowView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-* 
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-
-#include <QDebug>
-
-#include "webpagecontroller.h"
-#include "HistoryView_p.h"
-#include "HistoryFlowView.h"
-#include "PictureFlow.h"
-
-
-#include <QWebHistory>
-#include <QWebFrame>
-#include "wrtbrowsercontainer.h"
-#include "webpagedata.h"
-
-namespace WRT {
-
-ControllableView* HistoryFlowView::createNew(QWidget *parent)
-{
-    return new HistoryFlowView(WebPageController::getSingleton(),parent, Type());
-}
-
-ControllableViewBase* HistoryFlowView::createNew(QGraphicsWidget *parent)
-{
-    return new HistoryFlowView(WebPageController::getSingleton(),parent, Type());
-}
-
-/*!
- * \class HistoryFlowView
- *
- * \brief presents the history of the current page in the "Flow" style
- *
- * This class implements the HistoryView base class
- */
-
-/*!
-  Basic HistoryFlowView constructor requires a PageManager to manage the pages
-  and a parent QWidget
-  @param mgr : WebPageController handle for this class
-  @param parent : Widget parent for this class
-  @see  WebPageController
-*/
-HistoryFlowView::HistoryFlowView(WebPageController* mgr, QWidget* parent, const QString& aType) :
-    HistoryView(mgr,parent)
-,   m_type(aType)
-{
-    m_jsObject = new HistoryViewJSObject(this, 0, type());
-}
-
-/*!
-  Basic HistoryFlowView constructor requires a PageManager to manage the pages
-  and a parent QGraphicsWidget
-  Note: This functionality is not yet tested
-  @param mgr : WebPageController handle for this class
-  @param parent : Graphics Widget parent for this class
-  @see  WebPageController
-  
-*/
-HistoryFlowView::HistoryFlowView(WebPageController* mgr, QGraphicsWidget* parent,const QString& aType) :
-    HistoryView(mgr,parent)
-,   m_type(aType)
-{
-m_jsObject = new HistoryViewJSObject(this, 0, type());
-}
-
-/*!
-  activate the view's resources. Could be connected by client to view visibility
-*/
-void HistoryFlowView::activate()
-{
-    if (!d->m_flowInterface) {
-      d->m_flowInterface = new GraphicsPictureFlow(d->m_widgetParent);
-      emit instantiated(this);
-    }
-    HistoryView::activate();
-}
-
-/*! 
-  set the history view's center index
-  @param i   : history index to be set
-*/
-void HistoryFlowView::setCenterIndex(int i)
-{    
-    HistoryView::setCenterIndex(i);
-    GraphicsPictureFlow * pf = static_cast<GraphicsPictureFlow*>(d->m_flowInterface);
-    pf->showSlide(i);
-}
-
-/*!
-  get the history view's current slide image
-  @return QImage
-*/
-
-QImage HistoryFlowView::getCurrentSlide()
-{
-    GraphicsPictureFlow * pf = static_cast<GraphicsPictureFlow*>(d->m_flowInterface);
-    qDebug()<<pf->centerIndex();
-    return pf->slide(pf->centerIndex());
-}
-
-} // namespace WRT
--- a/browsercore/appfw/Api/Views/HistoryFlowView.h	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-* 
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-#ifndef __HISTORYFLOWVIEW_H__
-#define __HISTORYFLOWVIEW_H__
-
-#include <QObject>
-#include <QAction>
-#include "HistoryView.h"
-#include "controllableview.h"
-
-class QWebHistory;
-class WebPageController;
-
-namespace WRT {
-
-    class BWF_EXPORT HistoryFlowView : public HistoryView
-    {
-        Q_OBJECT
-    public:
-        HistoryFlowView(WebPageController * mgr, QWidget* parent,const QString& aType);
-        HistoryFlowView(WebPageController * mgr, QGraphicsWidget* parent,const QString& aType);
-        virtual QString type() const { return m_type; }
-        
-        static const QString Type() { return "HistoryView"; }
-        static ControllableView *createNew(QWidget *parent);
-        static ControllableViewBase  *createNew(QGraphicsWidget* parent);
-
-        QImage getCurrentSlide();
-    public slots:
-        void activate();
-        void setCenterIndex(int i);
-    protected:
-        QString m_type;
-    };
-
-}
-#endif // __HISTORYFLOWVIEW_H__
--- a/browsercore/appfw/Api/Views/HistoryView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/HistoryView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -307,8 +307,8 @@
     for (int i = 0; i < d->m_activePage->history()->count(); i++) {
         QWebHistoryItem item = items.at(i);
         WebPageData data = item.userData().value<WebPageData>();
-        QImage img = data.m_thumbnail;
-        d->m_flowInterface->addSlide(img);
+//        QImage img = data.m_thumbnail;
+//        d->m_flowInterface->addSlide(img);
     }
 
     int currentItemIndex(d->m_activePage->history()->currentItemIndex());
--- a/browsercore/appfw/Api/Views/Views.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/Views.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -24,17 +24,15 @@
     $$PWD/controllableviewjsobject.h \
     $$PWD/HistoryView_p.h \
     $$PWD/HistoryView.h \
-    $$PWD/HistoryFlowView.h \   
     $$PWD/WindowFlowView.h \
     $$PWD/WindowView.h \
     $$PWD/WindowView_p.h \
-    $$PWD/mostvisitedpagestore.h 
+    $$PWD/mostvisitedpagestore.h
 
 SOURCES += \
     $$PWD/controllableviewimpl.cpp \
     $$PWD/controllableviewjsobject.cpp \
     $$PWD/HistoryView.cpp \
-    $$PWD/HistoryFlowView.cpp \
     $$PWD/WindowFlowView.cpp \
     $$PWD/WindowView.cpp \
     $$PWD/mostvisitedpagestore.cpp 
--- a/browsercore/appfw/Api/Views/WindowView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/WindowView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -25,6 +25,7 @@
 #include "WindowView_p.h"
 #include "WindowView.h"
 
+#include <QGraphicsWebView>
 #include <QWebHistory>
 #include <QWebFrame>
 #include "wrtbrowsercontainer.h"
@@ -380,7 +381,7 @@
     d->m_mode = m;
 }
 
-void WindowView::setSize(QSize& size)
+void WindowView::setSize(QSize size)
 {
     d->m_windowViewSize = size;
 }
@@ -404,11 +405,14 @@
         setCenterIndex(currIndex);
 }
 
-void WindowView::displayModeChanged(QString& newMode)
+void WindowView::displayModeChanged(QString& newMode, QSize sz)
 {
     //qDebug() << "WindowView::displayModeChanged:::" << newMode;
+    d->m_windowViewSize = sz;
+
     // update page thumbnails
     QSize s = d->m_flowInterface->size().toSize();
+    //qDebug() << "WindowView::displayModeChanged:::" << d->m_windowViewSize << "Widget size" << s;
 
     d->m_pageManager->resizeAndUpdatePageThumbnails(s);
 
@@ -416,17 +420,21 @@
     updateImages();
 
     // update the flow interface
-    d->m_flowInterface->displayModeChanged(newMode);
+    d->m_flowInterface->displayModeChanged(d->m_windowViewSize);
 }
 
 void WindowView::updateImages()
 {
     Q_ASSERT(d && d->m_flowInterface);
 
+    QSize sz = d->m_flowInterface->size().toSize();
+    if(sz.isNull()) sz = static_cast<QGraphicsWidget*>(d->m_pageManager->webView()->parentItem())->size().toSize(); // get the viewport size
+
     // clear PictureFlow
     if (d->m_flowInterface->slideCount() != 0)
         d->m_flowInterface->clear();
 
+    d->m_pageManager->currentPage()->requestPageDataUpdate();
     d->m_pageList = d->m_pageManager->allPages();
     for (int i = 0; i < d->m_pageList->count(); i++) {
         WrtBrowserContainer* window = d->m_pageList->at(i);
@@ -434,9 +442,9 @@
         if (title.isEmpty())
             title =  qtTrId("txt_browser_windows_new_window");
 
-         QWebHistoryItem item = window->history()->currentItem();
+/*         QWebHistoryItem item = window->history()->currentItem();
          WebPageData data = item.userData().value<WebPageData>();
-         QImage img = data.m_thumbnail;
+         QImage img; // = data.m_thumbnail;
 
          QSize size = window->webWidget()->size().toSize();
          QSize imgSize = img.size();
@@ -446,10 +454,11 @@
              size.scale(imgSize, Qt::KeepAspectRatio);
              img = img.copy(0, 0, size.width(), size.height());
          }
+*/
 #ifdef BROWSER_LAYOUT_TENONE
-         d->m_flowInterface->addSlide(img);
+         d->m_flowInterface->addSlide(window->thumbnail(sz));
 #else
-         d->m_flowInterface->addSlide(img, title);
+         d->m_flowInterface->addSlide(window->thumbnail(sz), title);
 #endif
      }
      setCenterIndex(d->m_pageManager->currentPage());
--- a/browsercore/appfw/Api/Views/WindowView.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/WindowView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -31,7 +31,6 @@
 class WebPageController;
 
 namespace WRT {
-
     class WrtBrowserContainer;
     class WindowViewPrivate;
 
@@ -74,7 +73,7 @@
         QAction * getActionAddWindow();
         QAction * getActionDelWindow();
 
-        void setSize(QSize& size);
+        void setSize(QSize size);
 
         void setMode(Mode mode);
 
@@ -82,7 +81,7 @@
         QString title() const;
         bool isActive();
         QList<QAction*> getContext();
-        void displayModeChanged(QString& newMode);
+        void displayModeChanged(QString& newMode, QSize sz);
         QGraphicsWidget* widget() const;
 
         int pageCount();
@@ -129,9 +128,12 @@
         void setCenterIndex(WrtBrowserContainer *);
         void indexChangeInActiveState(int);
         void updateImages();
-
+#ifdef ENABLE_TESTS
+    friend class WindowViewTest;
+#endif
     protected:
         WindowViewPrivate * const d;
+
     };
 
     class BWF_EXPORT WindowViewJSObject : public ControllableViewJSObject {
@@ -148,8 +150,7 @@
     protected:
         WindowView * windowView() { return static_cast<WindowView *>(m_contentView); }
         WindowView * windowViewConst() const { return static_cast<WindowView *>(m_contentView); }
-
-    
+       
     };
 
 }
--- a/browsercore/appfw/Api/Views/controllableview.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/controllableview.h	Fri Oct 15 17:30:59 2010 -0400
@@ -122,7 +122,7 @@
 //    virtual bool signal_connect(const char *signal,const QObject *receiver, const char *member) = 0;
 //    virtual bool slot_connect(const QObject *sender, const char *signal, const char *member) = 0;
     
-    virtual void displayModeChanged(QString&) = 0;
+    virtual void displayModeChanged(QString&, QSize) = 0;
 
 };
 
--- a/browsercore/appfw/Api/Views/controllableviewimpl.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/controllableviewimpl.h	Fri Oct 15 17:30:59 2010 -0400
@@ -58,7 +58,7 @@
     //! deactivate the view's resources. Could be connected by client to view visibility
     virtual void deactivate() { m_isActive = false; }
 
-    virtual void displayModeChanged(QString&) {}
+    virtual void displayModeChanged(QString&, QSize) {}
 
     virtual void connectAll() {}
 
--- a/browsercore/appfw/Api/Views/mostvisitedpagestore.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/mostvisitedpagestore.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -23,16 +23,20 @@
 
 #include "mostvisitedpagestore.h"
 #include "bedrockprovisioning.h"
+#include "wrtbrowsercontainer.h"
+#include "webpagecontroller.h"
+#include "HistoryManager.h"
 
 const QString KMostVistedStoreFile = "mostvisitedpages.dat";
 const uint KMostVistedStoreVersion = 1;
-const uint KMostVistedStoreLimit = 5;
+const uint KMostVistedStoreLimit = 6;
 
 const QString KDefaultPage1 = "http://www.nytimes.com/";
-const QString KDefaultPage2 = "http://www.google.com/";
+const QString KDefaultPage2 = "http://news.google.com/";
 const QString KDefaultPage3 = "http://www.nokia.com/";
-const QString KDefaultPage4 = "http://www.ovi.com/";
+const QString KDefaultPage4 = "http://www.meego.com/";
 const QString KDefaultPage5 = "http://www.cnn.com/";
+const QString KDefaultPage6 = "http://www.iltalehti.fi/etusivu/";
 
 MostVisitedPage::MostVisitedPage()
     : m_pageThumbnail(0)
@@ -99,20 +103,32 @@
 
 
 MostVisitedPageStore::MostVisitedPageStore()
-        : m_needPersistWrite(false)
+        : m_needPersistWrite(false) 
 {
     // initialize the dir used to store bookmarks
 #ifndef QT_NO_DESKTOPSERVICES
         m_mvpFile = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/" + KMostVistedStoreFile;
+        #ifdef Q_WS_MAEMO_5	
+        	QString databaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseDirectory");
+    			m_mvpFile = databaseDir + KMostVistedStoreFile;
+    		#endif
 #else
-        m_mvpFile =  = QDir::homePath() + "/" +KMostVistedStoreFile;
+        m_mvpFile =  = QDir::homePath() + "/" +KMostVistedStoreFile;  
 #endif
 
-    readStore();
+    readStore(); 
+    
+    //#ifdef Q_WS_MAEMO_5
+    // Note: this should be done by the owner of the MostVisitedPageStore object.
+    WebPageController* pageController = WebPageController::getSingleton();
+    connect(pageController, SIGNAL(loadFinished(const bool)), this, SLOT(onLoadFinished(const bool)));
+    connect(WRT::HistoryManager::getSingleton(),SIGNAL(historyCleared()),this,SLOT(clear()));
+    //#endif
+
 }
 
 
-void MostVisitedPageStore::clearMostVisitedPageStore()
+void MostVisitedPageStore::clear()
 {
     for (int i = m_pageList.size() - 1; i >= 0; --i)
         delete m_pageList.takeAt(i);
@@ -185,8 +201,7 @@
         
         m_pageList[found]->m_pageThumbnail = pageThumbnail;
     }
-
-    m_needPersistWrite = true;
+		m_needPersistWrite = true;    
     writeStore();
 }
 
@@ -236,7 +251,15 @@
 void MostVisitedPageStore::readStore()
 {
     QFile file(m_mvpFile);
-
+     
+     
+    
+   	#ifndef Q_WS_MAEMO_5
+   	if(!file.exists()){
+    	file.copy("Z:/Private/10008d39/localpages/mostvisitedpages.dat", "C:/Private/10008d39/mostvisitedpages.dat"); // will be replaced by value from .ini file
+    }
+   	#endif
+   
     if (file.open(QFile::ReadOnly)) {
         QDataStream in(&file);   
         //Check the store version.
@@ -251,7 +274,8 @@
             }
         }
         file.close();
-    }
+    }   	
+    
     
     initializeDefaultPageThumbnails();
 }
@@ -286,9 +310,49 @@
     if (!m_pageList.isEmpty()) 
         return;
     
+    
     m_pageList.append(new MostVisitedPage(KDefaultPage1));
     m_pageList.append(new MostVisitedPage(KDefaultPage2));
     m_pageList.append(new MostVisitedPage(KDefaultPage3));
     m_pageList.append(new MostVisitedPage(KDefaultPage4));
     m_pageList.append(new MostVisitedPage(KDefaultPage5));
+    m_pageList.append(new MostVisitedPage(KDefaultPage6));
 }
+
+
+void MostVisitedPageStore::onLoadFinished(const bool ok)   // slot
+{
+	 //#ifdef Q_WS_MAEMO_5
+    if (ok) {
+       WRT::WrtBrowserContainer * activePage = WebPageController::getSingleton()->currentPage();
+       update(activePage);
+    }
+   //#endif
+  
+}
+
+void MostVisitedPageStore::update(WRT::WrtBrowserContainer *page) 
+{
+	//#ifdef Q_WS_MAEMO_5
+    Q_ASSERT(page);
+    //Q_ASSERT(!page->mainFrame()->url().isEmpty());
+
+    // Url is empty on history loads. Do not add it to most visited in this case.
+    if(page->mainFrame()->url().isEmpty())
+        return;
+
+    QUrl pageUrl = page->mainFrame()->url();
+    int pageRank = 0;
+    QImage* pageThumbnail = NULL;
+    //check if page exists in store along with its thumbnail
+    if (!contains(pageUrl.toString(), true)) {
+        QImage img = page->pageThumbnail(0.30375, 0.30375);
+        pageThumbnail = new QImage(img);        
+    }
+
+    //if it is a new page to the store, get its rank from history
+    //FIX ME : need to optimize this code
+    pageRank = WRT::HistoryManager::getSingleton()->getPageRank(pageUrl.toString());
+    pageAccessed(pageUrl, pageThumbnail, pageRank);
+    // #endif
+}
--- a/browsercore/appfw/Api/Views/mostvisitedpagestore.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Api/Views/mostvisitedpagestore.h	Fri Oct 15 17:30:59 2010 -0400
@@ -18,13 +18,22 @@
 * Description:
 *
 */
-#include "BWFGlobal.h"
+#ifndef MOSTVISITEDPAGESTORE_H
+#define MOSTVISITEDPAGESTORE_H
+
+
+#include "BWFGlobal.h" 
+#include <QObject>
+#include "singleton.h"
+#include "wrtbrowsercontainer.h"
 
 class QDataStream;
 
+
 //Most visited page item
 class BWF_EXPORT MostVisitedPage : public QObject
 {
+	  Q_OBJECT
     Q_PROPERTY(QString pageUrl READ pageUrl)
 public:
 
@@ -58,6 +67,7 @@
 //Store for managing MV pages
 class BWF_EXPORT MostVisitedPageStore : public QObject
 {
+	  Q_OBJECT
 public:
     //Construction and destruction
     MostVisitedPageStore();
@@ -74,12 +84,16 @@
     MostVisitedPage *pageAt(int index);
     
     void initializeDefaultPageThumbnails();
-    void clearMostVisitedPageStore();
+private slots:
+  	void update(WRT::WrtBrowserContainer *page);  	
+    void clear();
+    void onLoadFinished(const bool ok);
 protected:
     bool compareUrls(QString& url1, QString &url2);
     void readStore();
     void writeStore();
 
+
 private:
     MostVisitedPageList m_pageList;
     QString m_mvpFile;
@@ -88,3 +102,5 @@
 		friend class MostVistedPageTest;
 #endif
 };
+typedef Singleton<MostVisitedPageStore> MostVisitedPageStoreSingleton;
+#endif
\ No newline at end of file
--- a/browsercore/appfw/Common/Common.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Common/Common.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -20,10 +20,9 @@
 
 HEADERS += \
     $$PWD/FlowInterface.h \
-    $$PWD/PictureFlow.h \
     $$PWD/FilmstripFlow.h
 
 SOURCES += \
-    $$PWD/PictureFlow.cpp \
     $$PWD/FilmstripFlow.cpp \
+    $$PWD/FlowInterface.cpp
 
--- a/browsercore/appfw/Common/FilmstripFlow.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Common/FilmstripFlow.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -1444,13 +1444,10 @@
 }
 
 //! handle the display mode change
-void GraphicsFilmstripFlow::displayModeChanged(QString& newMode)
+void GraphicsFilmstripFlow::displayModeChanged(QSize sz)
 {
-    Q_UNUSED(newMode);
-    Q_ASSERT(d);
-    QSize s = this->size().toSize();
-    //qDebug() << "FilmstripFlow::displayModeChanged: "  << s;
-    adjustFilmstripSize(s);
+    //qDebug() << "FilmstripFlow::displayModeChanged: "  << sz;
+    adjustFilmstripSize(sz);
     update();
 }
 
@@ -1471,8 +1468,9 @@
     if (w >= h) { // landscape
         d->m_sideWindowSize = QSize(w * L_SIDE_WIDTH_P_C, w * L_SIDE_WIDTH_P_C / ratio);
         d->m_centerWindowSize = QSize(w * L_CENTER_WIDTH_P_C, w * L_CENTER_WIDTH_P_C / ratio);
-        d->m_centerTopSpace = h * L_CENTER_TOP_SPACE_P_C;
-        d->m_sideTopSpace = h * L_SIDE_TOP_SPACE_P_C;
+        // Calculate the center top space and side top space
+        d->m_centerTopSpace =( h - d->m_centerWindowSize.height())/2;
+        d->m_sideTopSpace = (h - d->m_sideWindowSize.height())/2;
         d->m_space = w * L_SPACE_P_C;
         ix = (w * (1 + L_CENTER_WIDTH_P_C) - d->m_closeIcon->size().width() + FRAME_WIDTH)/2.0;
     } else { // portrait
@@ -1621,7 +1619,11 @@
     Q_ASSERT(d);
     QGraphicsWidget::resizeEvent(event);
     d->m_widgetSize = event->newSize().toSize();
-    adjustFilmstripSize(d->m_widgetSize);
+    // Do not adjust the film strip size here. The widget size is
+    // used only to get the page thumbnails. Positioning
+    // of the thumbnails within the view is based on the size that
+    // WindowView provides.
+//    adjustFilmstripSize(d->m_widgetSize);
 }
 
 void GraphicsFilmstripFlow::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
--- a/browsercore/appfw/Common/FilmstripFlow.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Common/FilmstripFlow.h	Fri Oct 15 17:30:59 2010 -0400
@@ -27,6 +27,8 @@
 #include <QWidget>
 
 #include "FlowInterface.h"
+#include "BWFGlobal.h"
+
 
 namespace WRT {
 
@@ -37,7 +39,7 @@
 /*!
   Class FilmstripFlow
  */ 
-class FilmstripFlow: public FlowInterface  
+class BWF_EXPORT FilmstripFlow: public FlowInterface  
 {
 Q_OBJECT
 friend class Filmstrip;
@@ -147,12 +149,14 @@
 /*!
   Class GraphicsFilmstripFlow
  */ 
-class GraphicsFilmstripFlow: public GraphicsFlowInterface
+class BWF_EXPORT GraphicsFilmstripFlow: public GraphicsFlowInterface
 {
 Q_OBJECT
 friend class Filmstrip;
 friend class FilmstripMovieFactory;
-
+#ifdef ENABLE_TESTS
+    friend class GraphicsFilmstripFlowTest;
+#endif
 public:
     /*!
     Creates a new FilmstripFlow widget.
@@ -215,7 +219,7 @@
     void backgroundColor(const QRgb& c);
 
     //! handle the display mode change
-    void displayModeChanged(QString& newMode);
+    void displayModeChanged(QSize sz);
 
     //! prepare start-animation
     void prepareStartAnimation();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Common/FlowInterface.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,23 @@
+
+
+#include "FlowInterface.h"
+#include "qstmgestureevent.h"
+
+
+namespace WRT {
+GraphicsFlowInterface::GraphicsFlowInterface(QGraphicsItem* parent) : QGraphicsWidget(parent) 
+{
+    //grabGesture(QStm_Gesture::assignedType());
+}
+
+
+bool GraphicsFlowInterface::event(QEvent* event) 
+{
+    bool ret = false;     
+    //ret = QStm_GestureEventFilter::instance()->event(event);
+    if (!ret) {
+        ret = QGraphicsWidget::event(event);
+    }
+    return ret;
+}
+}
--- a/browsercore/appfw/Common/FlowInterface.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/Common/FlowInterface.h	Fri Oct 15 17:30:59 2010 -0400
@@ -29,6 +29,8 @@
 #include <QGraphicsItem>
 
 class QPainter;
+#include "BWFGlobal.h"
+
 
 namespace WRT {
     /*!
@@ -40,7 +42,7 @@
      * This class is designed so that the Views using these engines can implement some functionality
      * in common modules, and assign the specific engine at a higher level
      */
-    class FlowInterfaceBase
+    class BWF_EXPORT FlowInterfaceBase
     {
     public:
         //! Perform init steps on flow
@@ -88,6 +90,9 @@
         //! handle the display mode change
         virtual void displayModeChanged(QString&) {}
 
+        //! handle the display mode change
+        virtual void displayModeChanged(QSize) {}
+
         //! prepare start-animation
         virtual void prepareStartAnimation() {}
 
@@ -98,7 +103,7 @@
         virtual void runEndAnimation() {}
     };
 
-    class FlowInterface : public QWidget, public FlowInterfaceBase
+    class BWF_EXPORT FlowInterface : public QWidget, public FlowInterfaceBase
     {
         Q_OBJECT
     public:
@@ -112,13 +117,14 @@
         void cancel();
     };
 
-    class GraphicsFlowInterface : public QGraphicsWidget, public FlowInterfaceBase
+    class BWF_EXPORT GraphicsFlowInterface : public QGraphicsWidget, public FlowInterfaceBase
     {
         Q_OBJECT
     public:
         //! Init the FlowInterface with a QWidget parent
-        GraphicsFlowInterface(QGraphicsItem* parent) : QGraphicsWidget(parent) {}
-
+        GraphicsFlowInterface(QGraphicsItem* parent);
+        bool event(QEvent* event);
+        
     signals:
         void centerIndexChanged(int index);
         void ok(int index);
--- a/browsercore/appfw/Common/PictureFlow.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1637 +0,0 @@
-/*
-  PictureFlow - animated image show widget
-  http://pictureflow.googlecode.com
-  
-  Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-  Copyright (C) 2008 Ariya Hidayat (ariya@kde.org)
-  Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy
-  of this software and associated documentation files (the "Software"), to deal
-  in the Software without restriction, including without limitation the rights
-  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  copies of the Software, and to permit persons to whom the Software is
-  furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in
-  all copies or substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-  THE SOFTWARE.
-*/
-
-#include "PictureFlow.h"
-
-// detect Qt version
-#if QT_VERSION >= 0x040000
-#define PICTUREFLOW_QT4
-#elif QT_VERSION >= 0x030000
-#define PICTUREFLOW_QT3
-#elif QT_VERSION >= 235
-#define PICTUREFLOW_QT2
-#else
-#error PictureFlow widgets need Qt 2, Qt 3 or Qt 4
-#endif
-
-#include <QGraphicsSceneResizeEvent>
-#include <QGraphicsSceneMouseEvent>
-#include <QGraphicsSceneMoveEvent>
-
-#ifdef PICTUREFLOW_QT4
-#include <QApplication>
-#include <QCache>
-#include <QHash>
-#include <QImage>
-#include <QKeyEvent>
-#include <QPainter>
-#include <QPixmap>
-#include <QTimer>
-#include <QVector>
-#include <QWidget>
-#endif
-
-#include <QDebug>
-
-#ifdef PICTUREFLOW_QT3
-#include <qapplication.h>
-#include <qcache.h>
-#include <qimage.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qdatetime.h>
-#include <qtimer.h>
-#include <qvaluevector.h>
-#include <qwidget.h>
-
-#define qMax(x,y) ((x) > (y)) ? (x) : (y)
-#define qMin(x,y) ((x) < (y)) ? (x) : (y)
-
-#define QVector QValueVector
-
-#define toImage convertToImage
-#define contains find
-#define modifiers state
-#define ControlModifier ControlButton
-#endif
-
-#ifdef PICTUREFLOW_QT2
-#include <qapplication.h>
-#include <qarray.h>
-#include <qcache.h>
-#include <qimage.h>
-#include <qintdict.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qdatetime.h>
-#include <qtimer.h>
-#include <qwidget.h>
-
-#define qMax(x,y) ((x) > (y)) ? (x) : (y)
-#define qMin(x,y) ((x) < (y)) ? (x) : (y)
-
-#define QVector QArray
-
-#define toImage convertToImage
-#define contains find
-#define modifiers state
-#define ControlModifier ControlButton
-#define flush flushX
-#endif
-
-// for fixed-point arithmetic, we need minimum 32-bit long
-// long long (64-bit) might be useful for multiplication and division
-typedef long PFreal;
-#define PFREAL_SHIFT 10
-#define PFREAL_ONE (1 << PFREAL_SHIFT)
-
-#define IANGLE_MAX 1024
-#define IANGLE_MASK 1023
-
-namespace WRT {
-
-const int slideRatio1 = 2;
-const int slideRatio2 = 5;
-const int KScrollTimeout = 250;
-
-inline PFreal fmul(PFreal a, PFreal b)
-{
-  return ((long long)(a))*((long long)(b)) >> PFREAL_SHIFT;
-}
-
-inline PFreal fdiv(PFreal num, PFreal den)
-{
-  long long p = (long long)(num) << (PFREAL_SHIFT*2);
-  long long q = p / (long long)den;
-  long long r = q >> PFREAL_SHIFT;
-
-  return r;
-}
-
-inline PFreal fsin(int iangle)
-{
-  // warning: regenerate the table if IANGLE_MAX and PFREAL_SHIFT are changed!
-  static const PFreal tab[] = {
-     3,    103,    202,    300,    394,    485,    571,    652,
-   726,    793,    853,    904,    947,    980,   1004,   1019,
-  1023,   1018,   1003,    978,    944,    901,    849,    789,
-   721,    647,    566,    479,    388,    294,    196,     97,
-    -4,   -104,   -203,   -301,   -395,   -486,   -572,   -653,
-  -727,   -794,   -854,   -905,   -948,   -981,  -1005,  -1020,
- -1024,  -1019,  -1004,   -979,   -945,   -902,   -850,   -790,
-  -722,   -648,   -567,   -480,   -389,   -295,   -197,    -98,
-  3
-  };
-
-  while(iangle < 0)
-    iangle += IANGLE_MAX;
-  iangle &= IANGLE_MASK;
-
-  int i = (iangle >> 4);
-  PFreal p = tab[i];
-  PFreal q = tab[(i+1)];
-  PFreal g = (q - p);
-  return p + g * (iangle-i*16)/16;
-}
-
-inline PFreal fcos(int iangle)
-{
-  return fsin(iangle + (IANGLE_MAX >> 2));
-}
-
-/* ----------------------------------------------------------
-
-PictureFlowState stores the state of all slides, i.e. all the necessary
-information to be able to render them.
-
-PictureFlowAnimator is responsible to move the slides during the
-transition between slides, to achieve the effect similar to Cover Flow,
-by changing the state.
-
-PictureFlowSoftwareRenderer (or PictureFlowOpenGLRenderer) is
-the actual 3-d renderer. It should render all slides given the state
-(an instance of PictureFlowState).
-
-Instances of all the above three classes are stored in
-PictureFlowPrivate.
-
-------------------------------------------------------- */
-
-struct SlideInfo
-{
-  int slideIndex;
-  int angle;
-  PFreal cx;
-  PFreal cy;
-  int blend;
-};
-
-class PictureFlowState
-{
-public:
-  PictureFlowState();
-  ~PictureFlowState();
-
-  void reposition();
-  void reset();
-
-  QRgb backgroundColor;
-  int slideWidth;
-  int slideHeight;
-  ReflectionEffect reflectionEffect;
-  QVector<QImage*> slideImages;
-
-  int angle;
-  int spacing;
-  PFreal offsetX;
-  PFreal offsetY;
-
-  SlideInfo centerSlide;
-  QVector<SlideInfo> leftSlides;
-  QVector<SlideInfo> rightSlides;
-  int centerIndex;
-};
-
-class PictureFlowAnimator
-{
-public:
-  PictureFlowAnimator();
-  PictureFlowState* state;
-
-  void start(int slide);
-  void stop(int slide);
-  void update();
-
-  int target;
-  int step;
-  int frame;
-  QTimer animateTimer;
-};
-
-class PictureFlowAbstractRenderer
-{
-public:
-  PictureFlowAbstractRenderer(): state(0), dirty(false), widget(0), gWidget(0), gPainter(0) {}
-  virtual ~PictureFlowAbstractRenderer() {}
-
-  PictureFlowState* state;
-  bool dirty;
-  QWidget* widget;
-  QGraphicsWidget* gWidget;
-  QPainter* gPainter;
-  QRect cRect; // central rect
-
-  virtual void init() = 0;
-  virtual void paint() = 0;
-};
-
-class PictureFlowSoftwareRenderer: public PictureFlowAbstractRenderer
-{
-public:
-  PictureFlowSoftwareRenderer();
-  ~PictureFlowSoftwareRenderer();
-
-  virtual void init();
-  virtual void paint();
-
-  QRect renderSlide(const SlideInfo &slide, int col1 = -1, int col2 = -1);
-private:
-  QSize size;
-  QRgb bgcolor;
-  int effect;
-  QImage buffer;
-  QVector<PFreal> rays;
-  QImage* blankSurface;
-#ifdef PICTUREFLOW_QT4
-  QCache<int,QImage> surfaceCache;
-  QHash<int,QImage*> imageHash;
-#endif
-#ifdef PICTUREFLOW_QT3
-  QCache<QImage> surfaceCache;
-  QMap<int,QImage*> imageHash;
-#endif
-#ifdef PICTUREFLOW_QT2
-  QCache<QImage> surfaceCache;
-  QIntDict<QImage> imageHash;
-#endif
-
-  void render();
-  void renderSlides();
-  QImage* surface(int slideIndex);
-};
-
-// ------------- PictureFlowState ---------------------------------------
-
-PictureFlowState::PictureFlowState():
-backgroundColor(0), slideWidth(150), slideHeight(200),
-reflectionEffect(BlurredReflection), centerIndex(0)
-{
-}
-
-PictureFlowState::~PictureFlowState()
-{
-  for(int i = 0; i < (int)slideImages.count(); i++)
-    delete slideImages[i];
-}
-
-// readjust the settings, call this when slide dimension is changed
-void PictureFlowState::reposition()
-{
-  angle = 60*IANGLE_MAX / 360;
-
-  offsetX = slideWidth/2 * (PFREAL_ONE-fcos(angle));
-  offsetY = slideWidth/2 * fsin(angle);
-  offsetX += slideWidth * PFREAL_ONE;
-  offsetY += slideWidth * PFREAL_ONE / 4;
-  spacing = 20;
-}
-
-// adjust slides so that they are in "steady state" position
-void PictureFlowState::reset()
-{
-  centerSlide.angle = 0;
-  centerSlide.cx = 0;
-  centerSlide.cy = 0;
-  centerSlide.slideIndex = centerIndex;
-  centerSlide.blend = 256;
-
-  leftSlides.resize(6);
-  for(int i = 0; i < (int)leftSlides.count(); i++)
-  {
-    SlideInfo& si = leftSlides[i];
-    si.angle = angle;
-    si.cx = -(offsetX + spacing*i*PFREAL_ONE);
-    si.cy = offsetY;
-    si.slideIndex = centerIndex-1-i;
-    si.blend = 256;
-    if(i == (int)leftSlides.count()-2)
-      si.blend = 128;
-    if(i == (int)leftSlides.count()-1)
-      si.blend = 0;
-  }
-
-  rightSlides.resize(6);
-  for(int i = 0; i < (int)rightSlides.count(); i++)
-  {
-    SlideInfo& si = rightSlides[i];
-    si.angle = -angle;
-    si.cx = offsetX + spacing*i*PFREAL_ONE;
-    si.cy = offsetY;
-    si.slideIndex = centerIndex+1+i;
-    si.blend = 256;
-    if(i == (int)rightSlides.count()-2)
-      si.blend = 128;
-    if(i == (int)rightSlides.count()-1)
-      si.blend = 0;
-  }
-}
-
-// ------------- PictureFlowAnimator  ---------------------------------------
-
-PictureFlowAnimator::PictureFlowAnimator():
-state(0), target(0), step(0), frame(0)
-{
-}
-
-void PictureFlowAnimator::start(int slide)
-{
-  target = slide;
-  if(!animateTimer.isActive() && state)
-  {
-    step = (target < state->centerSlide.slideIndex) ? -1 : 1;
-    animateTimer.start(30);
-  }
-}
-
-void PictureFlowAnimator::stop(int slide)
-{
-  step = 0;
-  target = slide;
-  frame = slide << 16;
-  animateTimer.stop();
-}
-
-void PictureFlowAnimator::update()
-{
-  if(!animateTimer.isActive())
-    return;
-  if(step == 0)
-    return;
-  if(!state)
-    return;
-
-  int speed = 16384/4;
-
-#if 1
-  // deaccelerate when approaching the target
-  // we disabled clicking until the animation is done so this has to be fast enough to not annoy users
-  const int max = 65536 + 16384; // was 65536*2 but that was too slow when we disabled clicks
-
-  int fi = frame;
-  fi -= (target << 16);
-  if(fi < 0)
-    fi = -fi;
-  fi = qMin(fi, max);
-
-  int ia = IANGLE_MAX * (fi-max/2) / (max*2);
-  speed = 512 + 16384 * (PFREAL_ONE+fsin(ia))/PFREAL_ONE;
-#endif
-
-  frame += speed*step;
-
-  int index = frame >> 16;
-  int pos = frame & 0xffff;
-  int neg = 65536 - pos;
-  int tick = (step < 0) ? neg : pos;
-  PFreal ftick = (tick * PFREAL_ONE) >> 16;
-
-  if(step < 0)
-    index++;
-
-  if(state->centerIndex != index)
-  {
-    state->centerIndex = index;
-    frame = index << 16;
-    state->centerSlide.slideIndex = state->centerIndex;
-    for(int i = 0; i < (int)state->leftSlides.count(); i++)
-      state->leftSlides[i].slideIndex = state->centerIndex-1-i;
-    for(int i = 0; i < (int)state->rightSlides.count(); i++)
-      state->rightSlides[i].slideIndex = state->centerIndex+1+i;
-  }
-
-  state->centerSlide.angle = (step * tick * state->angle) >> 16;
-  state->centerSlide.cx = -step * fmul(state->offsetX, ftick);
-  state->centerSlide.cy = fmul(state->offsetY, ftick);
-
-  if(state->centerIndex == target)
-  {
-    stop(target);
-    state->reset();
-    return;
-  }
-
-  for(int i = 0; i < (int)state->leftSlides.count(); i++)
-  {
-    SlideInfo& si = state->leftSlides[i];
-    si.angle = state->angle;
-    si.cx = -(state->offsetX + state->spacing*i*PFREAL_ONE + step*state->spacing*ftick);
-    si.cy = state->offsetY;
-  }
-
-  for(int i = 0; i < (int)state->rightSlides.count(); i++)
-  {
-    SlideInfo& si = state->rightSlides[i];
-    si.angle = -state->angle;
-    si.cx = state->offsetX + state->spacing*i*PFREAL_ONE - step*state->spacing*ftick;
-    si.cy = state->offsetY;
-  }
-
-  if(step > 0)
-  {
-    PFreal ftick = (neg * PFREAL_ONE) >> 16;
-    state->rightSlides[0].angle = -(neg * state->angle) >> 16;
-    state->rightSlides[0].cx = fmul(state->offsetX, ftick);
-    state->rightSlides[0].cy = fmul(state->offsetY, ftick);
-  }
-  else
-  {
-    PFreal ftick = (pos * PFREAL_ONE) >> 16;
-    state->leftSlides[0].angle = (pos * state->angle) >> 16;
-    state->leftSlides[0].cx = -fmul(state->offsetX, ftick);
-    state->leftSlides[0].cy = fmul(state->offsetY, ftick);
-  }
-
-  // must change direction ?
-  if(target < index) if(step > 0)
-    step = -1;
-  if(target > index) if(step < 0)
-    step = 1;
-
-  // the first and last slide must fade in/fade out
-  int nleft = state->leftSlides.count();
-  int nright = state->rightSlides.count();
-  int fade = pos / 256;
-
-  for(int index = 0; index < nleft; index++)
-  {
-    int blend = 256;
-    if(index == nleft-1)
-      blend = (step > 0) ? 0 : 128-fade/2;
-    if(index == nleft-2)
-      blend = (step > 0) ? 128-fade/2 : 256-fade/2;
-    if(index == nleft-3)
-      blend = (step > 0) ? 256-fade/2 : 256;
-    state->leftSlides[index].blend = blend;
-  }
-  for(int index = 0; index < nright; index++)
-  {
-    int blend = (index < nright-2) ? 256 : 128;
-    if(index == nright-1)
-      blend = (step > 0) ? fade/2 : 0;
-    if(index == nright-2)
-      blend = (step > 0) ? 128+fade/2 : fade/2;
-    if(index == nright-3)
-      blend = (step > 0) ? 256 : 128+fade/2;
-    state->rightSlides[index].blend = blend;
-  }
-}
-
-// ------------- PictureFlowSoftwareRenderer ---------------------------------------
-
-PictureFlowSoftwareRenderer::PictureFlowSoftwareRenderer():
-PictureFlowAbstractRenderer(), size(0,0), bgcolor(0), effect(-1), blankSurface(0)
-{
-#ifdef PICTUREFLOW_QT3
-  surfaceCache.setAutoDelete(true);
-#endif
-}
-
-PictureFlowSoftwareRenderer::~PictureFlowSoftwareRenderer()
-{
-  surfaceCache.clear();
-  buffer = QImage();
-  delete blankSurface;
-}
-
-void PictureFlowSoftwareRenderer::paint()
-{
-  if(!widget && !gWidget)
-    return;
-
-  if(widget && widget->size() != size)
-    init();
-  else if (gWidget && gWidget->size().toSize() != size)
-    init();
-
-  if(state->backgroundColor != bgcolor)
-  {
-    bgcolor = state->backgroundColor;
-    surfaceCache.clear();
-  }
-
-  if((int)(state->reflectionEffect) != effect)
-  {
-    effect = (int)state->reflectionEffect;
-    surfaceCache.clear();
-  }
-
-  if(dirty)
-    render();
-
-  if (widget) {
-      QPainter painter(widget);
-      painter.drawImage(QPoint(0,0), buffer);
-  } else if (gWidget && gPainter) {
-      gPainter->drawImage(QPoint(0,0), buffer);
-  }
-}
-
-void PictureFlowSoftwareRenderer::init()
-{
-  if(!widget && !gWidget)
-    return;
-
-  surfaceCache.clear();
-  blankSurface = 0;
-
-  if (widget)
-    size = widget->size();
-  else
-    size = gWidget->size().toSize();
-  
-  int ww = size.width();
-  int wh = size.height();
-  int w = (ww+1)/2;
-  int h = (wh+1)/2;
-
-#ifdef PICTUREFLOW_QT4
-  buffer = QImage(ww, wh, QImage::Format_RGB32);
-#endif
-#if defined(PICTUREFLOW_QT3) || defined(PICTUREFLOW_QT2)
-  buffer.create(ww, wh, 32);
-#endif
-  buffer.fill(bgcolor);
-
-  rays.resize(w*2);
-  for(int i = 0; i < w; i++)
-  {
-    PFreal gg = ((PFREAL_ONE >> 1) + i * PFREAL_ONE) / (2*h);
-    rays[w-i-1] = -gg;
-    rays[w+i] = gg;
-  }
-
-  dirty = true;
-}
-
-// TODO: optimize this with lookup tables
-static QRgb blendColor(QRgb c1, QRgb c2, int blend)
-{
-  int r = qRed(c1) * blend/256 + qRed(c2)*(256-blend)/256;
-  int g = qGreen(c1) * blend/256 + qGreen(c2)*(256-blend)/256;
-  int b = qBlue(c1) * blend/256 + qBlue(c2)*(256-blend)/256;
-  return qRgb(r, g, b);
-}
-
-
-static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcolor,
-ReflectionEffect reflectionEffect)
-{
-#ifdef PICTUREFLOW_QT4
-  Qt::TransformationMode mode = Qt::SmoothTransformation;
-  QImage img = slideImage->scaled(w, h, Qt::IgnoreAspectRatio, mode);
-#endif
-#if defined(PICTUREFLOW_QT3) || defined(PICTUREFLOW_QT2)
-  QImage img = slideImage->smoothScale(w, h);
-#endif
-
-  // slightly larger, to accomodate for the reflection
-  int hs = h * 2;
-  int hofs = h / 3;
-
-  // offscreen buffer: black is sweet
-#ifdef PICTUREFLOW_QT4
-  QImage* result = new QImage(hs, w, QImage::Format_RGB32);
-#endif
-#if defined(PICTUREFLOW_QT3) || defined(PICTUREFLOW_QT2)
-  QImage* result = new QImage;
-  result->create(hs, w, 32);
-#endif
-  result->fill(bgcolor);
-
-  // transpose the image, this is to speed-up the rendering
-  // because we process one column at a time
-  // (and much better and faster to work row-wise, i.e in one scanline)
-  for(int x = 0; x < w; x++)
-    for(int y = 0; y < h; y++)
-      result->setPixel(hofs + y, x, img.pixel(x, y));
-
-  if(reflectionEffect != NoReflection)
-  {
-    // create the reflection
-    int ht = hs - h - hofs;
-    int hte = ht;
-    for(int x = 0; x < w; x++)
-      for(int y = 0; y < ht; y++)
-      {
-        QRgb color = img.pixel(x, img.height()-y-1);
-        result->setPixel(h+hofs+y, x, blendColor(color,bgcolor,128*(hte-y)/hte));
-      }
-
-    if(reflectionEffect == BlurredReflection)
-    {
-      // blur the reflection everything first
-      // Based on exponential blur algorithm by Jani Huhtanen
-      QRect rect(hs/2, 0, hs/2, w);
-      rect &= result->rect();
-
-      int r1 = rect.top();
-      int r2 = rect.bottom();
-      int c1 = rect.left();
-      int c2 = rect.right();
-
-      int bpl = result->bytesPerLine();
-      int rgba[4];
-      unsigned char* p;
-
-      // how many times blur is applied?
-      // for low-end system, limit this to only 1 loop
-      for(int loop = 0; loop < 2; loop++)
-      {
-        for(int col = c1; col <= c2; col++)
-        {
-          p = result->scanLine(r1) + col*4;
-          for(int i = 0; i < 3; i++)
-            rgba[i] = p[i] << 4;
-
-          p += bpl;
-          for(int j = r1; j < r2; j++, p += bpl)
-            for(int i = 0; i < 3; i++)
-              p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
-        }
-
-        for(int row = r1; row <= r2; row++)
-        {
-          p = result->scanLine(row) + c1*4;
-          for(int i = 0; i < 3; i++)
-            rgba[i] = p[i] << 4;
-
-          p += 4;
-          for(int j = c1; j < c2; j++, p+=4)
-            for(int i = 0; i < 3; i++)
-              p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
-        }
-
-        for(int col = c1; col <= c2; col++)
-        {
-          p = result->scanLine(r2) + col*4;
-          for(int i = 0; i < 3; i++)
-            rgba[i] = p[i] << 4;
-
-          p -= bpl;
-          for(int j = r1; j < r2; j++, p -= bpl)
-            for(int i = 0; i < 3; i++)
-              p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
-        }
-
-        for(int row = r1; row <= r2; row++)
-        {
-          p = result->scanLine(row) + c2*4;
-          for(int i = 0; i < 3; i++)
-            rgba[i] = p[i] << 4;
-
-          p -= 4;
-          for(int j = c1; j < c2; j++, p-=4)
-            for(int i = 0; i < 3; i++)
-              p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
-        }
-      }
-
-      // overdraw to leave only the reflection blurred (but not the actual image)
-      for(int x = 0; x < w; x++)
-        for(int y = 0; y < h; y++)
-          result->setPixel(hofs + y, x, img.pixel(x, y));
-    }
-  }
-
-  return result;
-}
-
-QImage* PictureFlowSoftwareRenderer::surface(int slideIndex)
-{
-  if(!state)
-    return 0;
-  if(slideIndex < 0)
-    return 0;
-  if(slideIndex >= (int)state->slideImages.count())
-    return 0;
-
-#ifdef PICTUREFLOW_QT4
-  int key = slideIndex;
-#endif
-#if defined(PICTUREFLOW_QT3) || defined(PICTUREFLOW_QT2)
-  QString key = QString::number(slideIndex);
-#endif
-
-  QImage* img = state->slideImages.at(slideIndex);
-  bool empty = img ? img->isNull() : true;
-  if(empty)
-  {
-    surfaceCache.remove(key);
-    imageHash.remove(slideIndex);
-    if(!blankSurface)
-    {
-      int sw = state->slideWidth;
-      int sh = state->slideHeight;
-
-#ifdef PICTUREFLOW_QT4
-      QImage img = QImage(sw, sh, QImage::Format_RGB32);
-
-      QPainter painter(&img);
-      QPoint p1(sw*4/10, 0);
-      QPoint p2(sw*6/10, sh);
-      QLinearGradient linearGrad(p1, p2);
-      linearGrad.setColorAt(0, Qt::black);
-      linearGrad.setColorAt(1, Qt::white);
-      painter.setBrush(linearGrad);
-      painter.fillRect(0, 0, sw, sh, QBrush(linearGrad));
-
-      painter.setPen(QPen(QColor(64,64,64), 4));
-      painter.setBrush(QBrush());
-      painter.drawRect(2, 2, sw-3, sh-3);
-      painter.end();
-#endif
-#if defined(PICTUREFLOW_QT3) || defined(PICTUREFLOW_QT2)
-      QPixmap pixmap(sw, sh, 32);
-      QPainter painter(&pixmap);
-      painter.fillRect(pixmap.rect(), QColor(192,192,192));
-      painter.fillRect(5, 5, sw-10, sh-10, QColor(64,64,64));
-      painter.end();
-      QImage img = pixmap.convertToImage();
-#endif
-
-      blankSurface = prepareSurface(&img, sw, sh, bgcolor, state->reflectionEffect);
-    }
-    return blankSurface;
-  }
-
-#ifdef PICTUREFLOW_QT4
-  bool exist = imageHash.contains(slideIndex);
-  if(exist)
-  if(img == imageHash.find(slideIndex).value())
-#endif
-#ifdef PICTUREFLOW_QT3
-  bool exist = imageHash.find(slideIndex) != imageHash.end();
-  if(exist)
-  if(img == imageHash.find(slideIndex).data())
-#endif
-#ifdef PICTUREFLOW_QT2
-  if(img == imageHash[slideIndex])
-#endif
-    if(surfaceCache.contains(key))
-        return surfaceCache[key];
-
-  QImage* sr = prepareSurface(img, state->slideWidth, state->slideHeight, bgcolor, state->reflectionEffect);
-  surfaceCache.insert(key, sr);
-  imageHash.insert(slideIndex, img);
-
-  return sr;
-}
-
-// Renders a slide to offscreen buffer. Returns a rect of the rendered area.
-// col1 and col2 limit the column for rendering.
-QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1, int col2)
-{
-  int blend = slide.blend;
-  if(!blend)
-    return QRect();
-
-  QImage* src = surface(slide.slideIndex);
-  if(!src)
-    return QRect();
-
-  QRect rect(0, 0, 0, 0);
-
-  int sw = src->height();
-  int sh = src->width();
-  int h = buffer.height();
-  int w = buffer.width();
-
-  if(col1 > col2)
-  {
-    int c = col2;
-    col2 = col1;
-    col1 = c;
-  }
-
-  col1 = (col1 >= 0) ? col1 : 0;
-  col2 = (col2 >= 0) ? col2 : w-1;
-  col1 = qMin(col1, w-1);
-  col2 = qMin(col2, w-1);
-
-  int zoom = 100;
-  int distance = h * 100 / zoom;
-  PFreal sdx = fcos(slide.angle);
-  PFreal sdy = fsin(slide.angle);
-  PFreal xs = slide.cx - state->slideWidth * sdx/2;
-  PFreal ys = slide.cy - state->slideWidth * sdy/2;
-  PFreal dist = distance * PFREAL_ONE;
-  int xi = qMax((PFreal)0, (w*PFREAL_ONE/2) + fdiv(xs*h, dist+ys) >> PFREAL_SHIFT);
-  if(xi >= w)
-    return rect;
-
-  bool flag = false;
-  rect.setLeft(xi);
-  
-  int centerY = 0;
-  for(int x = qMax(xi, col1); x <= col2; x++)
-  {
-    PFreal hity = 0;
-    PFreal fk = rays[x];
-    if(sdy)
-    {
-      fk = fk - fdiv(sdx,sdy);
-      hity = -fdiv((rays[x]*distance - slide.cx + slide.cy*sdx/sdy), fk);
-    }
-
-    dist = distance*PFREAL_ONE + hity;
-    if(dist < 0)
-      continue;
-
-    PFreal hitx = fmul(dist, rays[x]);
-    PFreal hitdist = fdiv(hitx - slide.cx, sdx);
-
-    int column = sw/2 + (hitdist >> PFREAL_SHIFT);
-    if(column >= sw)
-      break;
-    if(column < 0)
-      continue;
-
-    rect.setRight(x);
-    if(!flag)
-      rect.setLeft(x);
-    flag = true;
-
-    int y1 = h/2;
-    int y2 = y1+ 1;
-    centerY = y1;
-    QRgb* pixel1 = (QRgb*)(buffer.scanLine(y1)) + x;
-    QRgb* pixel2 = (QRgb*)(buffer.scanLine(y2)) + x;
-    QRgb pixelstep = pixel2 - pixel1;
-
-    int center = (sh/2);
-    int dy = dist / h;
-    int p1 = center*PFREAL_ONE - dy/2;
-    int p2 = center*PFREAL_ONE + dy/2;
-
-    const QRgb *ptr = (const QRgb*)(src->scanLine(column));
-    if(blend == 256)
-      while((y1 >= 0) && (y2 < h) && (p1 >= 0))
-      {
-        *pixel1 = ptr[p1 >> PFREAL_SHIFT];
-        *pixel2 = ptr[p2 >> PFREAL_SHIFT];
-        p1 -= dy;
-        p2 += dy;
-        y1--;
-        y2++;
-        pixel1 -= pixelstep;
-        pixel2 += pixelstep;
-      }
-    else
-      while((y1 >= 0) && (y2 < h) && (p1 >= 0))
-      {
-        QRgb c1 = ptr[p1 >> PFREAL_SHIFT];
-        QRgb c2 = ptr[p2 >> PFREAL_SHIFT];
-        *pixel1 = blendColor(c1, bgcolor, blend);
-        *pixel2 = blendColor(c2, bgcolor, blend);
-        p1 -= dy;
-        p2 += dy;
-        y1--;
-        y2++;
-        pixel1 -= pixelstep;
-        pixel2 += pixelstep;
-     }
-   }
-
-   int yTop = (3 * centerY - 2 * state->slideHeight) / 3;
-   rect.setTop(yTop);
-   rect.setBottom(state->slideHeight + yTop);
-   return rect;
-}
-
-void PictureFlowSoftwareRenderer::renderSlides()
-{
-  int nleft = state->leftSlides.count();
-  int nright = state->rightSlides.count();
-
-  QRect r = renderSlide(state->centerSlide);
-  int c1 = r.left();
-  int c2 = r.right();
-  cRect = r;
-  for(int index = 0; index < nleft; index++)
-  {
-    QRect rs = renderSlide(state->leftSlides[index], 0, c1-1);
-    if(!rs.isEmpty())
-      c1 = rs.left();
-  }
-  for(int index = 0; index < nright; index++)
-  {
-    QRect rs = renderSlide(state->rightSlides[index], c2+1, buffer.width());
-    if(!rs.isEmpty())
-      c2 = rs.right();
-  }
-}
-
-// Render the slides. Updates only the offscreen buffer.
-void PictureFlowSoftwareRenderer::render()
-{
-  buffer.fill(state->backgroundColor);
-  renderSlides();
-  dirty = false;
-}
-
-// -----------------------------------------
-
-class PictureFlowPrivate
-{
-public:
-  PictureFlowState* state;
-  PictureFlowAnimator* animator;
-  PictureFlowAbstractRenderer* renderer;
-  QTimer triggerTimer;
-  QTimer scrollTimer;
-};
-
-
-PictureFlow::PictureFlow(QWidget* parent): FlowInterface(parent)
-{
-  d = new PictureFlowPrivate;
-
-  d->state = new PictureFlowState;
-  d->state->reset();
-  d->state->reposition();
-
-  d->renderer = new PictureFlowSoftwareRenderer;
-  d->renderer->state = d->state;
-  d->renderer->widget = this;
-  d->renderer->init();
-
-  d->animator = new PictureFlowAnimator;
-  d->animator->state = d->state;
-  QObject::connect(&d->animator->animateTimer, SIGNAL(timeout()), this, SLOT(updateAnimation()));
-
-  QObject::connect(&d->triggerTimer, SIGNAL(timeout()), this, SLOT(render()));
-  QObject::connect(&d->scrollTimer, SIGNAL(timeout()), this, SLOT(scroll()));
-
-#ifdef PICTUREFLOW_QT4
-  setAttribute(Qt::WA_StaticContents, true);
-  setAttribute(Qt::WA_OpaquePaintEvent, true);
-  setAttribute(Qt::WA_NoSystemBackground, true);
-#endif
-#ifdef PICTUREFLOW_QT3
-  setWFlags(getWFlags() | Qt::WStaticContents);
-  setWFlags(getWFlags() | Qt::WNoAutoErase);
-#endif
-#ifdef PICTUREFLOW_QT2
-  setWFlags(getWFlags() | Qt::WPaintClever);
-  setWFlags(getWFlags() | Qt::WRepaintNoErase);
-  setWFlags(getWFlags() | Qt::WResizeNoErase);
-#endif
-}
-
-PictureFlow::~PictureFlow()
-{
-  delete d->renderer;
-  delete d->animator;
-  delete d->state;
-  delete d;
-}
-
-int PictureFlow::slideCount() const
-{
-  return d->state->slideImages.count();
-}
-
-QColor PictureFlow::backgroundColor() const
-{
-  return QColor(d->state->backgroundColor);
-}
-
-void PictureFlow::setBackgroundColor(const QColor& c)
-{
-  d->state->backgroundColor = c.rgb();
-  triggerRender();
-}
-
-QSize PictureFlow::slideSize() const
-{
-  return QSize(d->state->slideWidth, d->state->slideHeight);
-}
-
-void PictureFlow::setSlideSize(QSize size)
-{
-  d->state->slideWidth = size.width();
-  d->state->slideHeight = size.height();
-  d->state->reposition();
-  triggerRender();
-}
-
-ReflectionEffect PictureFlow::reflectionEffect() const
-{
-  return d->state->reflectionEffect;
-}
-
-void PictureFlow::setReflectionEffect(ReflectionEffect effect)
-{
-  d->state->reflectionEffect = effect;
-  triggerRender();
-}
-
-QImage PictureFlow::slide(int index) const
-{
-  QImage* i = 0;
-  if((index >= 0) && (index < slideCount()))
-    i = d->state->slideImages[index];
-  return i ? QImage(*i) : QImage();
-}
-
-void PictureFlow::addSlide(const QImage& image)
-{
-  int c = d->state->slideImages.count();
-  d->state->slideImages.resize(c+1);
-  d->state->slideImages[c] = new QImage(image);
-  triggerRender();
-}
-
-void PictureFlow::addSlide(const QPixmap& pixmap)
-{
-  addSlide(pixmap.toImage());
-}
-
-void PictureFlow::setSlide(int index, const QImage& image)
-{
-  if((index >= 0) && (index < slideCount()))
-  {
-    QImage* i = image.isNull() ? 0 : new QImage(image);
-    delete d->state->slideImages[index];
-    d->state->slideImages[index] = i;
-    triggerRender();
-  }
-}
-
-void PictureFlow::setSlide(int index, const QPixmap& pixmap)
-{
-  setSlide(index, pixmap.toImage());
-}
-
-int PictureFlow::centerIndex() const
-{
-  return d->state->centerIndex;
-}
-
-bool PictureFlow::slideAnimationOngoing() const
-{
-    return d->animator->animateTimer.isActive();
-}
-
-void PictureFlow::setCenterIndex(int index)
-{
-  index = qMin(index, slideCount()-1);
-  index = qMax(index, 0);
-  d->state->centerIndex = index;
-  d->state->reset();
-  d->animator->stop(index);
-  triggerRender();
-}
-
-void PictureFlow::clear()
-{
-  int c = d->state->slideImages.count();
-  for(int i = 0; i < c; i++)
-    delete d->state->slideImages[i];
-  d->state->slideImages.resize(0);
-
-  d->state->reset();
-  triggerRender();
-}
-
-void PictureFlow::render()
-{
-  d->renderer->dirty = true;
-  update();
-}
-
-void PictureFlow::triggerRender()
-{
-#ifdef PICTUREFLOW_QT4
-  d->triggerTimer.setSingleShot(true);
-  d->triggerTimer.start(0);
-#endif
-#if defined(PICTUREFLOW_QT3) || defined(PICTUREFLOW_QT2)
-  d->triggerTimer.start(0, true);
-#endif
-}
-
-void PictureFlow::showPrevious()
-{
-  int step = d->animator->step;
-  int center = d->state->centerIndex;
-
-  if(step > 0)
-    d->animator->start(center);
-
-  if(step == 0)
-    if(center > 0)
-      d->animator->start(center - 1);
-
-  if(step < 0)
-    d->animator->target = qMax(0, center - 2);
-}
-
-void PictureFlow::showNext()
-{
-  int step = d->animator->step;
-  int center = d->state->centerIndex;
-
-  if(step < 0)
-    d->animator->start(center);
-
-  if(step == 0)
-    if(center < slideCount()-1)
-      d->animator->start(center + 1);
-
-  if(step > 0)
-    d->animator->target = qMin(center + 2, slideCount()-1);
-}
-
-void PictureFlow::showSlide(int index)
-{
-  index = qMax(index, 0);
-  index = qMin(slideCount()-1, index);
-  if(index == d->state->centerSlide.slideIndex)
-    return;
-
-  d->animator->start(index);
-}
-
-void PictureFlow::keyPressEvent(QKeyEvent* event)
-{
-    switch (event->key()) {
-        case Qt::Key_Escape:
-            emit cancel();
-            return;
-
-        case Qt::Key_Enter:
-        case Qt::Key_Return:
-        case Qt::Key_Select:
-            emit ok(centerIndex());
-            return;
-        case Qt::Key_Left:
-            if(event->modifiers() == Qt::ControlModifier)
-                showSlide(centerIndex()-10);
-            else
-                showPrevious();
-            event->accept();
-            return;
-        case Qt::Key_Right:
-            if(event->modifiers() == Qt::ControlModifier)
-                showSlide(centerIndex()+10);
-            else
-                showNext();
-            event->accept();
-            return;
-    }
-    event->ignore();
-}
-
-void PictureFlow::mousePressEvent(QMouseEvent* event)
-{
-    m_lastMoveEventPos = event->pos();
-    if (d->scrollTimer.isActive())
-        d->scrollTimer.stop();
-	d->scrollTimer.start(KScrollTimeout);
-    scroll();
-}
-
-void PictureFlow::mouseMoveEvent(QMouseEvent* event)
-{
-    m_lastMoveEventPos = event->pos();
-}
-
-void PictureFlow::mouseReleaseEvent(QMouseEvent* event)
-{
-    d->scrollTimer.stop();        
-	if (slideAnimationOngoing()) {
-//		qDebug() << "pf:mouseReleaseEvent slideanimation running, ignoring click";
-		return;
-	}
-    if(event->x() > ((width() * (slideRatio2 - slideRatio1)) / (2 * slideRatio2)) && event->x() < ((width() * (slideRatio2 + slideRatio1)) / (2 * slideRatio2))) {
-        emit ok(centerIndex());
-        return;
-    }
-}
-
-void PictureFlow::scroll()
-{
-    if(m_lastMoveEventPos.x() < ((width() * (slideRatio2 - slideRatio1)) / (2 * slideRatio2))) {
-        showPrevious();
-    }
-    else if (m_lastMoveEventPos.x() > ((width() * (slideRatio2 + slideRatio1)) / (2 * slideRatio2))) {
-        showNext();
-    }
-}
-
-
-void PictureFlow::paintEvent(QPaintEvent* event)
-{
-  Q_UNUSED(event);
-  d->renderer->paint();
-}
-
-void PictureFlow::resizeEvent(QResizeEvent* event)
-{
-    QWidget::resizeEvent(event);
-
-    QSize s = event->size(); //parentWidget()->rect().size();
-    setSlideSize(QSize((s.width() * slideRatio1) / slideRatio2, (s.height() * slideRatio1) / slideRatio2));
-}
-
-void PictureFlow::updateAnimation()
-{
-  int old_center = d->state->centerIndex;
-  d->animator->update();
-  triggerRender();
-  if(d->state->centerIndex != old_center)
-    emit centerIndexChanged(d->state->centerIndex);
-}
-
-void PictureFlow::init()
-{   
-    QSize s = size(); //parentWidget()->rect().size();
- 
-    setSlideSize(QSize((s.width() * slideRatio1) / slideRatio2, (s.height() * slideRatio1) / slideRatio2));
-    //resize(s);
-//TODO: Disable refrection ?
-//    setReflectionEffect(PictureFlow::NoReflection); 
-    setBackgroundColor(Qt::black);
-    // ensure that system cursor is an arrow, not a random icon
-    // This is not an issue if the platform does not have a system cursor
-#ifndef __SYMBIAN32__
-    setCursor(Qt::ArrowCursor);
-#endif
-    setFocusPolicy(Qt::WheelFocus);
-    setFocus(Qt::OtherFocusReason);
-}
-
-QRect PictureFlow::centralRect() const 
-{
-    if (d->renderer) {
-        /* Render the slide to get the rectangle */
-        SlideInfo s = d->state->centerSlide;
-        QRect r = ((PictureFlowSoftwareRenderer*)d->renderer)->renderSlide(s);
-        return r;
-    }
-    else
-        return QRect();
-}
-
-//-----------------------------------------------
-// GraphicsPictureFlow class
-
-GraphicsPictureFlow::GraphicsPictureFlow(QObject* parent): GraphicsFlowInterface(NULL)
-{
-  setParent(parent);
-
-  d = new PictureFlowPrivate;
-
-  d->state = new PictureFlowState;
-  d->state->reset();
-  d->state->reposition();
-
-  d->renderer = new PictureFlowSoftwareRenderer;
-  d->renderer->state = d->state;
-  d->renderer->gWidget = this;
-  d->renderer->init();
-
-  d->animator = new PictureFlowAnimator;
-  d->animator->state = d->state;
-  QObject::connect(&d->animator->animateTimer, SIGNAL(timeout()), this, SLOT(updateAnimation()));
-
-  QObject::connect(&d->triggerTimer, SIGNAL(timeout()), this, SLOT(render()));
-  QObject::connect(&d->scrollTimer, SIGNAL(timeout()), this, SLOT(scroll()));
-
-#ifdef PICTUREFLOW_QT4
-  setAttribute(Qt::WA_StaticContents, true);
-  setAttribute(Qt::WA_OpaquePaintEvent, true);
-  setAttribute(Qt::WA_NoSystemBackground, true);
-#endif
-#ifdef PICTUREFLOW_QT3
-  setWFlags(getWFlags() | Qt::WStaticContents);
-  setWFlags(getWFlags() | Qt::WNoAutoErase);
-#endif
-#ifdef PICTUREFLOW_QT2
-  setWFlags(getWFlags() | Qt::WPaintClever);
-  setWFlags(getWFlags() | Qt::WRepaintNoErase);
-  setWFlags(getWFlags() | Qt::WResizeNoErase);
-#endif
-}
-
-GraphicsPictureFlow::~GraphicsPictureFlow()
-{
-  delete d->renderer;
-  delete d->animator;
-  delete d->state;
-  delete d;
-}
-
-int GraphicsPictureFlow::slideCount() const
-{
-  return d->state->slideImages.count();
-}
-
-QColor GraphicsPictureFlow::backgroundColor() const
-{
-  return QColor(d->state->backgroundColor);
-}
-
-void GraphicsPictureFlow::setBackgroundColor(const QColor& c)
-{
-  d->state->backgroundColor = c.rgb();
-  triggerRender();
-}
-
-QSize GraphicsPictureFlow::slideSize() const
-{
-  return QSize(d->state->slideWidth, d->state->slideHeight);
-}
-
-void GraphicsPictureFlow::setSlideSize(QSize size)
-{
-  d->state->slideWidth = size.width();
-  d->state->slideHeight = size.height();
-  d->state->reposition();
-  triggerRender();
-}
-
-ReflectionEffect GraphicsPictureFlow::reflectionEffect() const
-{
-  return d->state->reflectionEffect;
-}
-
-void GraphicsPictureFlow::setReflectionEffect(ReflectionEffect effect)
-{
-  d->state->reflectionEffect = effect;
-  triggerRender();
-}
-
-QImage GraphicsPictureFlow::slide(int index) const
-{
-  QImage* i = 0;
-  if((index >= 0) && (index < slideCount()))
-    i = d->state->slideImages[index];
-  return i ? QImage(*i) : QImage();
-}
-
-void GraphicsPictureFlow::addSlide(const QImage& image)
-{
-  int c = d->state->slideImages.count();
-  d->state->slideImages.resize(c+1);
-  d->state->slideImages[c] = new QImage(image);
-  triggerRender();
-}
-
-void GraphicsPictureFlow::addSlide(const QPixmap& pixmap)
-{
-  addSlide(pixmap.toImage());
-}
-
-void GraphicsPictureFlow::setSlide(int index, const QImage& image)
-{
-  if((index >= 0) && (index < slideCount()))
-  {
-    QImage* i = image.isNull() ? 0 : new QImage(image);
-    delete d->state->slideImages[index];
-    d->state->slideImages[index] = i;
-    triggerRender();
-  }
-}
-
-void GraphicsPictureFlow::setSlide(int index, const QPixmap& pixmap)
-{
-  setSlide(index, pixmap.toImage());
-}
-
-int GraphicsPictureFlow::centerIndex() const
-{
-  return d->state->centerIndex;
-}
-
-bool GraphicsPictureFlow::slideAnimationOngoing() const
-{
-    return d->animator->animateTimer.isActive();
-}
-
-void GraphicsPictureFlow::setCenterIndex(int index)
-{
-  index = qMin(index, slideCount()-1);
-  index = qMax(index, 0);
-  d->state->centerIndex = index;
-  d->state->reset();
-  d->animator->stop(index);
-  triggerRender();
-}
-
-void GraphicsPictureFlow::clear()
-{
-  int c = d->state->slideImages.count();
-  for(int i = 0; i < c; i++)
-    delete d->state->slideImages[i];
-  d->state->slideImages.resize(0);
-
-  d->state->reset();
-  triggerRender();
-}
-
-void GraphicsPictureFlow::render()
-{
-  d->renderer->dirty = true;
-  update();
-}
-
-void GraphicsPictureFlow::triggerRender()
-{
-#ifdef PICTUREFLOW_QT4
-  d->triggerTimer.setSingleShot(true);
-  d->triggerTimer.start(0);
-#endif
-#if defined(PICTUREFLOW_QT3) || defined(PICTUREFLOW_QT2)
-  d->triggerTimer.start(0, true);
-#endif
-}
-
-void GraphicsPictureFlow::showPrevious()
-{
-  int step = d->animator->step;
-  int center = d->state->centerIndex;
-
-  if(step > 0)
-    d->animator->start(center);
-
-  if(step == 0)
-    if(center > 0)
-      d->animator->start(center - 1);
-
-  if(step < 0)
-    d->animator->target = qMax(0, center - 2);
-}
-
-void GraphicsPictureFlow::showNext()
-{
-  int step = d->animator->step;
-  int center = d->state->centerIndex;
-
-  if(step < 0)
-    d->animator->start(center);
-
-  if(step == 0)
-    if(center < slideCount()-1)
-      d->animator->start(center + 1);
-
-  if(step > 0)
-    d->animator->target = qMin(center + 2, slideCount()-1);
-}
-
-void GraphicsPictureFlow::showSlide(int index)
-{
-  index = qMax(index, 0);
-  index = qMin(slideCount()-1, index);
-  if(index == d->state->centerSlide.slideIndex)
-    return;
-
-  d->animator->start(index);
-}
-
-void GraphicsPictureFlow::keyPressEvent(QKeyEvent* event)
-{
-    switch (event->key()) {
-        case Qt::Key_Escape:
-            emit cancel();
-            return;
-
-        case Qt::Key_Enter:
-        case Qt::Key_Return:
-        case Qt::Key_Select:
-            emit ok(centerIndex());
-            return;
-        case Qt::Key_Left:
-            if(event->modifiers() == Qt::ControlModifier)
-                showSlide(centerIndex()-10);
-            else
-                showPrevious();
-            event->accept();
-            return;
-        case Qt::Key_Right:
-            if(event->modifiers() == Qt::ControlModifier)
-                showSlide(centerIndex()+10);
-            else
-                showNext();
-            event->accept();
-            return;
-    }
-    event->ignore();
-}
-
-void GraphicsPictureFlow::mousePressEvent(QGraphicsSceneMouseEvent* event)
-{
-    m_lastMoveEventPos = event->pos().toPoint();
-    if (d->scrollTimer.isActive())
-        d->scrollTimer.stop();
-	d->scrollTimer.start(KScrollTimeout);
-    scroll();
-}
-
-void GraphicsPictureFlow::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
-{
-    m_lastMoveEventPos = event->pos().toPoint();
-}
-
-void GraphicsPictureFlow::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
-{
-    d->scrollTimer.stop();        
-	if (slideAnimationOngoing()) {
-//		qDebug() << "pf:mouseReleaseEvent slideanimation running, ignoring click";
-		return;
-	}
-    if(event->pos().x() > ((size().width() * (slideRatio2 - slideRatio1)) / (2 * slideRatio2)) && event->pos().x() < ((size().width() * (slideRatio2 + slideRatio1)) / (2 * slideRatio2))) {
-        emit ok(centerIndex());
-        return;
-    }
-}
-
-void GraphicsPictureFlow::scroll()
-{
-    if(m_lastMoveEventPos.x() < ((size().width() * (slideRatio2 - slideRatio1)) / (2 * slideRatio2))) {
-        showPrevious();
-    }
-    else if (m_lastMoveEventPos.x() > ((size().width() * (slideRatio2 + slideRatio1)) / (2 * slideRatio2))) {
-        showNext();
-    }
-}
-
-void GraphicsPictureFlow::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
-{
-    d->renderer->gPainter = painter;
-    d->renderer->paint();
-    d->renderer->gPainter = NULL;
-}
-
-void GraphicsPictureFlow::resizeEvent(QGraphicsSceneResizeEvent* event)
-{
-    QGraphicsWidget::resizeEvent(event);
-
-    QSize s = event->newSize().toSize();
-    setSlideSize(QSize((s.width() * slideRatio1) / slideRatio2, (s.height() * slideRatio1) / slideRatio2));
-}
-
-void GraphicsPictureFlow::updateAnimation()
-{
-  int old_center = d->state->centerIndex;
-  d->animator->update();
-  triggerRender();
-  if(d->state->centerIndex != old_center)
-    emit centerIndexChanged(d->state->centerIndex);
-}
-
-void GraphicsPictureFlow::init()
-{   
-    QSize s = size().toSize(); //parentWidget()->rect().size();
- 
-    setSlideSize(QSize((s.width() * slideRatio1) / slideRatio2, (s.height() * slideRatio1) / slideRatio2));
-    //resize(s);
-//TODO: Disable refrection ?
-//    setReflectionEffect(PictureFlow::NoReflection); 
-    setBackgroundColor(Qt::black);
-    // ensure that system cursor is an arrow, not a random icon
-    // This is not an issue if the platform does not have a system cursor
-#ifndef __SYMBIAN32__
-    setCursor(Qt::ArrowCursor);
-#endif
-    setFocusPolicy(Qt::WheelFocus);
-    setFocus(Qt::OtherFocusReason);
-}
-
-QRect GraphicsPictureFlow::centralRect() const 
-{
-    if (d->renderer) {
-        /* Render the slide to get the rectangle */
-        SlideInfo s = d->state->centerSlide;
-        QRect r = ((PictureFlowSoftwareRenderer*)d->renderer)->renderSlide(s);
-        return r;
-    }
-    else
-        return QRect();
-}
-}
--- a/browsercore/appfw/Common/PictureFlow.h	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,379 +0,0 @@
-/*
-  PictureFlow - animated image show widget
-  http://pictureflow.googlecode.com
-
-  Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-  Copyright (C) 2008 Ariya Hidayat (ariya@kde.org)
-  Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy
-  of this software and associated documentation files (the "Software"), to deal
-  in the Software without restriction, including without limitation the rights
-  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  copies of the Software, and to permit persons to whom the Software is
-  furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in
-  all copies or substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-  THE SOFTWARE.
-*/
-
-#ifndef PICTUREFLOW_H
-#define PICTUREFLOW_H
-
-#include <qwidget.h>
-#include "FlowInterface.h"
-
-namespace WRT {
-
-class PictureFlowPrivate;
-
-enum ReflectionEffect
-{
-    NoReflection,
-    PlainReflection,
-    BlurredReflection
-};
-
-/*!
-  Class PictureFlow implements an image show widget with animation effect 
-  like Apple's CoverFlow (in iTunes and iPod). Images are arranged in form 
-  of slides, one main slide is shown at the center with few slides on 
-  the left and right sides of the center slide. When the next or previous 
-  slide is brought to the front, the whole slides flow to the right or 
-  the right with smooth animation effect; until the new slide is finally 
-  placed at the center.
-
- */ 
-class PictureFlow : public FlowInterface 
-{
-Q_OBJECT
-
-  Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
-  Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize)
-  Q_PROPERTY(int slideCount READ slideCount)
-  Q_PROPERTY(int centerIndex READ centerIndex WRITE setCenterIndex)
-
-public:
-
-
-
-  /*!
-    Creates a new PictureFlow widget.
-  */  
-  PictureFlow(QWidget* parent = 0);
-
-  /*!
-    Destroys the widget.
-  */
-  ~PictureFlow();
-
-  /*!
-    Returns the background color.
-  */
-  QColor backgroundColor() const;
-
-  /*!
-    Sets the background color. By default it is black.
-  */
-  void setBackgroundColor(const QColor& c);
-
-  /*!
-    Returns the dimension of each slide (in pixels).
-  */  
-  QSize slideSize() const;
-
-  /*!
-    Sets the dimension of each slide (in pixels).
-  */  
-  void setSlideSize(QSize size);
-
-  /*!
-    Returns the total number of slides.
-  */
-  int slideCount() const;
-
-  /*!
-    Returns QImage of specified slide.
-  */  
-  QImage slide(int index) const;
-
-  /*!
-    Returns the index of slide currently shown in the middle of the viewport.
-  */  
-  int centerIndex() const;
-
-  /*!
-    Return true if slide animation is ongoing
-  */
-  bool slideAnimationOngoing() const;
-
-  /*!
-    Returns the effect applied to the reflection.
-  */  
-  ReflectionEffect reflectionEffect() const;
-
-  /*!
-    Sets the effect applied to the reflection. The default is PlainReflection.
-  */  
-  void setReflectionEffect(ReflectionEffect effect);
-
-  QRect centralRect() const;
-
-  void init();
-  
-public slots:
-
-  /*!
-    Adds a new slide.
-  */  
-  void addSlide(const QImage& image);
-
-  /*!
-    Adds a new slide.
-  */  
-  void addSlide(const QPixmap& pixmap);
-
-  /*!
-    Sets an image for specified slide. If the slide already exists,
-    it will be replaced.
-  */  
-  void setSlide(int index, const QImage& image);
-
-  /*!
-    Sets a pixmap for specified slide. If the slide already exists,
-    it will be replaced.
-  */  
-  void setSlide(int index, const QPixmap& pixmap);
-
-  /*!
-    Sets slide to be shown in the middle of the viewport. No animation 
-    effect will be produced, unlike using showSlide.
-  */  
-  void setCenterIndex(int index);
-
-  /*!
-    Clears all slides.
-  */
-  void clear();
-
-  /*!
-    Shows previous slide using animation effect.
-  */
-  void showPrevious();
-
-  /*!
-    Shows next slide using animation effect.
-  */
-  void showNext();
-
-  /*!
-    Go to specified slide using animation effect.
-  */
-  void showSlide(int index);
-
-  /*!
-    Rerender the widget. Normally this function will be automatically invoked
-    whenever necessary, e.g. during the transition animation.
-  */
-  void render();
-
-  /*!
-    Schedules a rendering update. Unlike render(), this function does not cause
-    immediate rendering.
-  */  
-  void triggerRender();
-
-signals:
-  void centerIndexChanged(int index);
-  void ok(int index);
-  void cancel();
-
-protected:
-  void paintEvent(QPaintEvent *event);
-  void keyPressEvent(QKeyEvent* event);
-  void mousePressEvent(QMouseEvent* event);
-  void resizeEvent(QResizeEvent* event);
-  void mouseMoveEvent(QMouseEvent* event);
-  void mouseReleaseEvent(QMouseEvent* event);
-
-private slots:
-  void updateAnimation();
-  void scroll();
-  
-private:
-  PictureFlowPrivate* d;
-  QTimer* m_scrollTimer;
-  QPoint m_lastMoveEventPos;
-};
-
-class GraphicsPictureFlow : public GraphicsFlowInterface 
-{
-Q_OBJECT
-
-  Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
-  Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize)
-  Q_PROPERTY(int slideCount READ slideCount)
-  Q_PROPERTY(int centerIndex READ centerIndex WRITE setCenterIndex)
-
-public:
-
-  /*!
-    Creates a new PictureFlow widget.
-  */  
-  GraphicsPictureFlow(QObject* parent = 0);
-
-  /*!
-    Destroys the widget.
-  */
-  ~GraphicsPictureFlow();
-
-  /*!
-    Returns the background color.
-  */
-  QColor backgroundColor() const;
-
-  /*!
-    Sets the background color. By default it is black.
-  */
-  void setBackgroundColor(const QColor& c);
-
-  /*!
-    Returns the dimension of each slide (in pixels).
-  */  
-  QSize slideSize() const;
-
-  /*!
-    Sets the dimension of each slide (in pixels).
-  */  
-  void setSlideSize(QSize size);
-
-  /*!
-    Returns the total number of slides.
-  */
-  int slideCount() const;
-
-  /*!
-    Returns QImage of specified slide.
-  */  
-  QImage slide(int index) const;
-
-  /*!
-    Returns the index of slide currently shown in the middle of the viewport.
-  */  
-  int centerIndex() const;
-
-  /*!
-    Return true if slide animation is ongoing
-  */
-  bool slideAnimationOngoing() const;
-
-  /*!
-    Returns the effect applied to the reflection.
-  */  
-  ReflectionEffect reflectionEffect() const;
-
-  /*!
-    Sets the effect applied to the reflection. The default is PlainReflection.
-  */  
-  void setReflectionEffect(ReflectionEffect effect);
-
-  QRect centralRect() const;
-
-  void init();
-  
-public slots:
-
-  /*!
-    Adds a new slide.
-  */  
-  void addSlide(const QImage& image);
-
-  /*!
-    Adds a new slide.
-  */  
-  void addSlide(const QPixmap& pixmap);
-
-  /*!
-    Sets an image for specified slide. If the slide already exists,
-    it will be replaced.
-  */  
-  void setSlide(int index, const QImage& image);
-
-  /*!
-    Sets a pixmap for specified slide. If the slide already exists,
-    it will be replaced.
-  */  
-  void setSlide(int index, const QPixmap& pixmap);
-
-  /*!
-    Sets slide to be shown in the middle of the viewport. No animation 
-    effect will be produced, unlike using showSlide.
-  */  
-  void setCenterIndex(int index);
-
-  /*!
-    Clears all slides.
-  */
-  void clear();
-
-  /*!
-    Shows previous slide using animation effect.
-  */
-  void showPrevious();
-
-  /*!
-    Shows next slide using animation effect.
-  */
-  void showNext();
-
-  /*!
-    Go to specified slide using animation effect.
-  */
-  void showSlide(int index);
-
-  /*!
-    Rerender the widget. Normally this function will be automatically invoked
-    whenever necessary, e.g. during the transition animation.
-  */
-  void render();
-
-  /*!
-    Schedules a rendering update. Unlike render(), this function does not cause
-    immediate rendering.
-  */  
-  void triggerRender();
-
-signals:
-  void centerIndexChanged(int index);
-  void ok(int index);
-  void cancel();
-
-protected:
-  void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); 
-  void resizeEvent(QGraphicsSceneResizeEvent* event); 
-  void keyPressEvent(QKeyEvent* event);
-  void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
-  void mousePressEvent(QGraphicsSceneMouseEvent* event);
-  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
-
-private slots:
-  void updateAnimation();
-  void scroll();
-  
-private:
-  PictureFlowPrivate* d;
-  QTimer* m_scrollTimer;
-  QPoint m_lastMoveEventPos;
-};
-
-}
-#endif // PICTUREFLOW_H
-
--- a/browsercore/appfw/appfw-includepath.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/appfw/appfw-includepath.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -24,4 +24,5 @@
     $$PWD/Api/Common \
     $$PWD/Api/Dialogs \
     $$PWD/Api/Managers \
-    $$PWD/Api/Views
+    $$PWD/Api/Views \
+    $$PWD/../../qstmgesturelib
--- a/browsercore/core/ZoomMetaData.h	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-* 
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-#ifndef __ZOOMMETADATA_H__
-#define __ZOOMMETADATA_H__
-
-#ifdef BEDROCK_TILED_BACKING_STORE
-#include <QRectF>
-#include <QString>
-#endif
-
-// To store the view port proeperties that affect zoom set through meta data. 
-// This is available in the main frame of the page but to avoid parsing the meta
-// data again, store it
-
-struct ZoomMetaData{
-
-public:
-
-   /* These are currently not needed when we set the zoom again */
-   /* 
-   int viewportWidth;
-   int viewportHeight;
-   qreal initialScale;
-   */ 
-   qreal minScale;
-   qreal maxScale;
-   qreal zoomValue;
-   bool userScalable;
-#ifdef BEDROCK_TILED_BACKING_STORE
-   qreal initialScale;
-   QRectF rect;
-   QRectF webViewSize;
-   qreal scale;
-   QSizeF viewportSize;
-   QString m_specifiedWidth;
-   QString m_specifiedHeight;
-#endif
-};
-#endif  //__ZOOMMETADATA_H__
--- a/browsercore/core/core.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/core.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -24,6 +24,9 @@
     $$PWD/network/webnetworkaccessmanager.h \
     $$PWD/network/SchemeHandlerBr.h \
     $$PWD/network/SchemeHandlerBr_p.h \
+    $$PWD/network/cacheworkerthread.h \
+    $$PWD/network/featherweightcache_p.h \
+    $$PWD/network/featherweightcache.h \
     $$PWD/actionjsobject.h \
     $$PWD/browserpagefactory.h \
     $$PWD/brtglobal.h \
@@ -37,6 +40,7 @@
     $$PWD/network/webcookiejar.cpp \
     $$PWD/network/webnetworkaccessmanager.cpp \
     $$PWD/network/SchemeHandlerBr.cpp \
+    $$PWD/network/featherweightcache.cpp \
     $$PWD/actionjsobject.cpp \
     $$PWD/wrtbrowsercontainer.cpp
     
@@ -64,11 +68,4 @@
     $$PWD/network/SchemeHandlerBrDefault_p.h
 SOURCES += \
     $$PWD/network/SchemeHandlerBrDefault_p.cpp
-
-symbian: {
-SOURCES += $$PWD/network/WrtTelServiceBr.cpp 
-HEADERS += \
-   $$PWD/network/WrtTelServiceBr.h \
-   $$PWD/network/WrtTelServiceBr_p.h 
 }
-}
--- a/browsercore/core/core.pro	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/core.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -54,7 +54,7 @@
     }
 }
 
-LIBS += -lBedrockProvisioning -lbrowsercontentdll  
+LIBS += -lBedrockProvisioning -lbrowsercontentdll -lqstmgesturelib
 LIBS += -lbookmarksapi
 
 contains(br_orbit_ui, yes) {
@@ -75,32 +75,13 @@
     } else {
         DEFINES += SYMBIAN_PUB_SDK
     }
-    #LIBS += -llibpthread -letel -lsysutil -lWrtTelService -lsendui -letext -lcommonengine -lcone -lefsrv 
+    #LIBS += -llibpthread -letel -lsysutil -lsendui -letext -lcommonengine -lcone -lefsrv 
     LIBS += -llibpthread -letel -lsysutil -lsendui -letext -lcommonengine -lcommonui -lcone -lefsrv -lServiceHandler -lapmime -lapparc
 
     isEmpty(SYMBIAN_PUB_SDK) {
     LIBS +=  \
         -laiwdialdata
 		}
-
-    AIWResource = \
-        "START RESOURCE WrtTelService.rss" \
-        "HEADER" \
-        "TARGETPATH resource/apps" \
-        "END"
-
-    MMP_RULES += AIWResource 
-
-
-    browsercorelibs.sources = BrowserCore.dll
-
-    browsercorelibs.path = /sys/bin
-
-    #browsercoreresources.sources = /epoc32/data/z/resource/apps/WrtTelService.rsc
-    #browsercoreresources.path = /resource/apps
-
-    DEPLOYMENT += browsercorelibs 
-    #browsercoreresources
 }
 
 UTILITIES_DIR = $$ROOT_DIR/utilities
@@ -134,6 +115,11 @@
     LIBS += -lxqservice -lxqserviceutil
 }
 
+# Geolocation asychronous API should be support by Qt 4.7/QWebKit 2.1, but need to qulify for each platform
+contains(br_geolocation, yes) {
+   DEFINES += QT_GEOLOCATION
+}
+
 contains(QT_CONFIG, embedded): CONFIG += embedded
 
 !CONFIG(QTDIR_build) {
@@ -152,6 +138,7 @@
 
 contains(br_tiled_backing_store, yes) {
     DEFINES += BEDROCK_TILED_BACKING_STORE
+    DEFINES += OWN_BACKING_STORE
 }
 
 
@@ -174,10 +161,9 @@
 symbian: {
     DEFINES += NO_IOSTREAM
     TARGET.EPOCALLOWDLLDATA=1
-    TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB
     DEFINES += _WCHAR_T_DECLARED
     QMAKE_CXXFLAGS.CW = -O1 -wchar_t on
-    TARGET.CAPABILITY = All -TCB -DRM -AllFiles 
+    TARGET.CAPABILITY = All -TCB -DRM 
     TARGET.UID3 = 0x200267BB
     TARGET.VID = VID_DEFAULT
     MMP_RULES += EXPORTUNFROZEN
@@ -221,6 +207,7 @@
     $$PWD/../../bedrockProvisioning \
     #FIXME_10.1 fix path below
     $$PWD/../../../../mw/browser/bookmarksengine/browsercontentdll/inc
+    
 symbian: {
     INCLUDEPATH +=  $$PWD $$MW_LAYER_SYSTEMINCLUDE $$APP_LAYER_SYSTEMINCLUDE
 #   INCLUDEPATH += /epoc32/include/oem/tgfw
--- a/browsercore/core/network/SchemeHandlerBrDefault_p.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/SchemeHandlerBrDefault_p.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -25,7 +25,6 @@
 #include <QStringList>
 
 #if defined(Q_OS_SYMBIAN)
-#include "WrtTelServiceBr.h"
 #include <miutset.h>                // KUidMsgTypeSMTP
 #include <sendui.h>                 // CSendUi
 #include <cmessagedata.h>           // CMessageData
@@ -50,19 +49,6 @@
 
 namespace WRT {
 
-DefSchemeHandlerPrivate::DefSchemeHandlerPrivate()
-#if defined(Q_OS_SYMBIAN)
-    : m_telService(NULL)
-#endif
-{
-}
-
-DefSchemeHandlerPrivate::~DefSchemeHandlerPrivate()
-{
-#if defined(Q_OS_SYMBIAN) 
-    delete m_telService;
-#endif
-}
 
 /*!
  * HandleUrl
@@ -70,11 +56,6 @@
  */
 SchemeHandler::SchemeHandlerError DefSchemeHandlerPrivate::HandleUrl(const QUrl &url, bool confirmDTMF)
 {
-#if defined(Q_OS_SYMBIAN) 
-    if (!m_telService)
-        m_telService = new WrtTelService();
-#endif
-
     return SchemeHandlerPrivate::HandleUrl(url, confirmDTMF);
 }
 
@@ -236,18 +217,12 @@
 
 SchemeHandler::SchemeHandlerError DefSchemeHandlerPrivate::HandleTelScheme(const QUrl &url)
 {
-    //QString path = url.path();
-    
-    // should probably delete this call to m_telService method
-    //m_telService->MakeCall(path, confirmDTMF);
     QDesktopServices::openUrl(url);
     return SchemeHandler::NoError;
 }
 
 SchemeHandler::SchemeHandlerError DefSchemeHandlerPrivate::HandleSipScheme(const QUrl &url)
 {
-    // should probably delete this call to m_telService method
-    //m_telService->MakeVOIPCall(path, confirmDTMF);
     QDesktopServices::openUrl(url);
     return SchemeHandler::NoError;
 }
@@ -257,8 +232,6 @@
     QString path = url.path();
     QString number = path.mid(path.indexOf(';') + 1);
     
-    // should probably delete this call to m_telService method
-    //m_telService->MakeCall(number, confirmDTMF);
     number = "tel:" + number;
     QUrl dialUrl(number);
     QDesktopServices::openUrl(dialUrl);
--- a/browsercore/core/network/SchemeHandlerBrDefault_p.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/SchemeHandlerBrDefault_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -36,9 +36,6 @@
 
 class QUrl;
 
-#if defined(Q_OS_SYMBIAN)
-class WrtTelService;
-#endif
 
 namespace WRT {
 
@@ -50,9 +47,6 @@
 Q_OBJECT
 
 public:
-    DefSchemeHandlerPrivate();
-    ~DefSchemeHandlerPrivate();
-    
     virtual SchemeHandler::SchemeHandlerError HandleUrl(const QUrl &url, bool confirmDTMF);
     virtual SchemeHandler::SchemeHandlerError HandleScheme(const QUrl &url);
 
@@ -69,11 +63,7 @@
     TPtrC qt_QString2TPtrC( const QString& string );
     HBufC* qt_QString2HBufC(const QString& string);
 #endif
-    
-private:
-#if defined(Q_OS_SYMBIAN)
-    WrtTelService* m_telService; ///< Owned.
-#endif
+
 };
 
 }
--- a/browsercore/core/network/SchemeHandlerBrQtHighway_p.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/SchemeHandlerBrQtHighway_p.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -23,19 +23,23 @@
 #include <QUrl>
 #include <QList>
 #include <xqaiwdecl.h>
-
 #include "SchemeHandlerBrQtHighway_p.h"
 
 
 namespace WRT {
 
 
-QtHighwaySchemeHandlerPrivate::QtHighwaySchemeHandlerPrivate()
+QtHighwaySchemeHandlerPrivate::QtHighwaySchemeHandlerPrivate() : 
+    mRequestPtr(NULL)
 {
 }
 
 QtHighwaySchemeHandlerPrivate::~QtHighwaySchemeHandlerPrivate()
 {
+    if (mRequestPtr) {
+        delete mRequestPtr;
+        mRequestPtr = NULL;
+    }
 }
 
 SchemeHandler::SchemeHandlerError QtHighwaySchemeHandlerPrivate::HandleScheme(const QUrl &url)
@@ -55,29 +59,35 @@
     QtHighwaySchemeHandlerPrivate::SendStandardUriViewRequest(const QUrl& url)
 {
     SchemeHandler::SchemeHandlerError retVal = SchemeHandler::NoError;
-    XQAiwRequest *request = NULL; // Application Interworking request
     bool embedded = false;  // window groups not chained
 
     // Create request - Apply first implementation of url, "com.nokia.symbian.IUriView"
     // interface name and "view(QString)" operation.
-    request = mAiwMgr.create(url, embedded);
+    if (mRequestPtr)
+        delete mRequestPtr; // ensure previous requests deleted
+    mRequestPtr = mAiwMgr.create(url, embedded);
     
-    if (request) {
+    if (mRequestPtr) {
         // Debug - what service and interface are we using?
-        //XQAiwInterfaceDescriptor const &desc = request->descriptor();
-        //qDebug() << "HandleTelScheme: sn=" << desc.serviceName() << "if=" << desc.interfaceName();
+        //XQAiwInterfaceDescriptor const &desc = mRequestPtr->descriptor();
+        //qDebug() << "SendStandardUriViewRequest: sn=" << desc.serviceName() << "if=" << desc.interfaceName();
     
         // Set function parameters
         QList<QVariant> args;
         args << url.toString();
-        request->setArguments(args);
-        request->setEmbedded(embedded);
-        request->setSynchronous(false); // asynchronous request
+        mRequestPtr->setArguments(args);
+        mRequestPtr->setEmbedded(embedded);
+        mRequestPtr->setSynchronous(false); // asynchronous request
 
         // Send the request
-        if (!request->send()) {
-            // to debug get error code from request->lastError()
-            // or connect to requestError() signal
+        if (mRequestPtr->send()) {
+            // connect request signals to slots
+            connect(mRequestPtr, SIGNAL(requestOk(const QVariant&)), 
+                this, SLOT(handleOk(const QVariant&)));
+            connect(mRequestPtr, SIGNAL(requestError(int,const QString&)), 
+                this, SLOT(handleError(int, const QString&)));
+        } else {
+            // requestError() signal will be sent with error code
             retVal = SchemeHandler::LaunchFailed;
         }
     } else {
@@ -85,13 +95,30 @@
         retVal = SchemeHandler::SchemeUnsupported;
     }
     
-    // if need to get service result connect to requestOk() signal
-    
-    // currently not interested in requestOk() or requestError() signals so
-    // OK to delete request now
-    delete request;
-    
     return retVal;
 }
 
+// Aiw request responses
+void QtHighwaySchemeHandlerPrivate::handleOk(const QVariant& result)
+{
+    // service application launched ok, result is application return value
+    // service app should handle UI for errors, this is just for cleanup
+    if (mRequestPtr) {
+        delete mRequestPtr;
+        mRequestPtr = NULL;
+    }
+}
+
+// handles errors in interworking request handling
+void QtHighwaySchemeHandlerPrivate::handleError(int errorCode, 
+    const QString& errorMessage)
+{
+    // UI relies on return error from XQAiwRequest::send() to alert user of problem
+    // add debug code here to find out cause of error
+    if (mRequestPtr) {
+        delete mRequestPtr;
+        mRequestPtr = NULL;
+    }
+}
+
 } // WRT
--- a/browsercore/core/network/SchemeHandlerBrQtHighway_p.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/SchemeHandlerBrQtHighway_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -51,8 +51,15 @@
 private:
     SchemeHandler::SchemeHandlerError SendStandardUriViewRequest(const QUrl& url);
 
+private slots:
+    // Aiw request responses
+    void handleOk(const QVariant &result);
+    void handleError(int errorCode, const QString& errorMessage);
+
+private:
     // application interworking manager from QtHighway
     XQApplicationManager mAiwMgr;
+    XQAiwRequest *mRequestPtr; // Application Interworking request
 };
 
 } // WRT
--- a/browsercore/core/network/WebNetworkConnectionManager.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/WebNetworkConnectionManager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -26,9 +26,10 @@
 #include <qnetworksession.h>
 #ifdef QT_MOBILITY_SYSINFO
 #include <qsysteminfo.h>
+QTM_USE_NAMESPACE
 #endif // QT_MOBILITY_SYSINFO
 
-QTM_USE_NAMESPACE
+
 
 namespace WRT {
 	
--- a/browsercore/core/network/WebNetworkSession.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/WebNetworkSession.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -111,22 +111,9 @@
 */
 void WebNetworkSession::handleNewConfigurationActivated()
 {
-    bool isConnected = true;
-    
-    // isConnectionGood = testConnection();
-    if (isConnected)
-    {
-        m_NetworkSession->accept();
-        qDebug() << "Accept new Network Connection";
-        // flash the new connection network
-    }
-    else
-    {
-        m_NetworkSession->reject();
-        // flash the old connection network
-        qDebug() << "Reject new Network Connection";
-    }
-
+    m_NetworkSession->accept();
+    qDebug() << "Accept new Network Connection";
+ 
     emit sessionConfigurationChanged(activeConfiguration()); 
 }
 
@@ -256,4 +243,4 @@
     return activeConfig;
 }
 
-} // namespace WRT
\ No newline at end of file
+} // namespace WRT
--- a/browsercore/core/network/WrtTelService.rss	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-* 
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-NAME WTEL
-
-#include <eikon.rh>
-#include <eikon.rsg>
-
-#include <AiwCommon.hrh>
-#include <AiwCommon.rh>
-
-
-//***************************************************************************************
-//
-// COMMON
-//
-//***************************************************************************************
-
-RESOURCE RSS_SIGNATURE { }
-
-RESOURCE AIW_INTEREST r_wrttelservices_menu_aiw_interests
-    {
-    items=
-        {
-        AIW_CRITERIA_ITEM      
-            {
-            id              = 0;         // dummy id
-#if !defined (SYMBIAN_PUB_SDK)
-            serviceCmd      = KAiwCmdCall;
-#endif
-            serviceClass    = KAiwClassMenu;
-            contentType     = "*";
-            defaultProvider = 0x101F868E; // remove hard coding
-            maxProviders    = 1;
-            }
-        };
-    }
--- a/browsercore/core/network/WrtTelServiceBr.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-* 
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include <QObject>
-#include <QStringList>
-#include <QMessageBox>
-#include <QChar>
-#include <eikenv.h> // CCoeEnv::Static()
-
-
-#include <WrtTelService.rsg>
-#include <data_caging_path_literals.hrh>
-_LIT( KResourceFileName, "wrttelservice.rsc" );
-
-#include "WrtTelServiceBr.h"
-#include "WrtTelServiceBr_p.h"
-
-static const QString VALIDDTMFCHARS = "wW/pP*#0123456789ABCDabcd," ;
-static const QString DTMFWAITCHARS = "/wWpP,*#" ;
-static const QString DTMFINVALIDWAITCHARS = "/," ;
-static const QString POSTD = ";postd=";
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-WrtTelService::WrtTelService( ): QObject()
-    ,d(new WrtTelServicePrivate())
-{
-}
-
-void WrtTelService::MakeVOIPCall( QString number, bool sendDTMFAlwaysConfirm )
-{
-    d->MakeCall( number, sendDTMFAlwaysConfirm, true );
-}
-
-void WrtTelService::MakeCall( QString orgNumber, bool sendDTMFAlwaysConfirm )
-{
-    d->MakeCall( orgNumber, sendDTMFAlwaysConfirm, false);
-}
-
-WrtTelService::~WrtTelService()
-{
-    delete d;
-}
-
-// ================= WrtTelServicePrivate FUNCTIONS =======================
-
-WrtTelServicePrivate::WrtTelServicePrivate( ) : QObject(0)
-    ,m_CallInProgress( false )
-    ,m_ResourceLoader( *CCoeEnv::Static() )
-    ,m_ResourceOpened( false )
-    ,m_ServiceHandler( NULL )
-#if !defined (SYMBIAN_PUB_SDK)
-    ,m_DialData( NULL )
-#endif
-{
-}
-
-WrtTelServicePrivate::~WrtTelServicePrivate()
-{
-    delete m_ServiceHandler;
-#if !defined (SYMBIAN_PUB_SDK)
-    delete m_DialData;
-#endif
-    if ( m_ResourceOpened ) {
-        m_ResourceLoader.Close();
-        m_ResourceOpened = false;
-    }
-}
-
-    
-//---------------------------------------------------------------------------------------
-// WrtTelService::MakeCall()
-//---------------------------------------------------------------------------------------
-//
-void WrtTelServicePrivate::MakeCall( QString orgNumber, bool sendDTMFAlwaysConfirm, bool voipCall )
-{
-#if !defined (SYMBIAN_PUB_SDK)
-    if( m_CallInProgress || orgNumber.length() == 0 ||
-        orgNumber.length() > AIWDialDataExt::KMaximumPhoneNumberLength )
-        return;
-
-    // Handle postd format  
-    QString postdParm = FindPostdParm( orgNumber );
-    
-    if(voipCall)
-        FindAndRipVoipParameters( orgNumber );
-    
-    // Rip URI parameters from Tel URI, in order to that
-    // number validation and DTMF works as earlier
-    // Parameters will be added back in later phase
-    QString params = FindAndRipURIParameters( orgNumber );
-
-    QString number = ValidateNumber( orgNumber );
-    
-    QString dtmfNumber = FindAndRipDTMFSequence( number );
-
-    if ( dtmfNumber.isEmpty() )
-        dtmfNumber = postdParm;
-        
-    bool isPostd = (!dtmfNumber.isEmpty());
-
-    m_CallInProgress = true;
-    if( QMessageBox::question( 0, QString(), QObject::tr("Call %1").arg(number), (QMessageBox::Yes | QMessageBox::No) ) == QMessageBox::Yes ) {            
-        if(! dtmfNumber.isEmpty() ) {
-            // Confirm the user (s)he wants to send the DTMF
-            if( !sendDTMFAlwaysConfirm || QMessageBox::question( 0, QString(), QObject::tr("Send DTMF %1").arg(dtmfNumber), (QMessageBox::Yes | QMessageBox::No) ) == QMessageBox::Yes ) {
-                if ( isPostd )
-                    number.append("p");
-                number.append(dtmfNumber);
-            }
-         }
-
-        // ... and make the call
-        TRAP_IGNORE(DoMakeCallL( number, voipCall ));
-    }
-    m_CallInProgress = false;
-#endif
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::DoMakeCallL()
-//---------------------------------------------------------------------------------------
-//
-void WrtTelServicePrivate::DoMakeCallL( QString number, bool voipCall )
-{
-    
-#if !defined (SYMBIAN_PUB_SDK)
-    if (!m_ServiceHandler)
-        m_ServiceHandler = CAiwServiceHandler::NewL();
-    if (!m_DialData)
-        m_DialData = CAiwDialData::NewL();
-
-    if (!m_ResourceOpened) {
-        // Resouce file loading
-        TParse* fileParser = new (ELeave) TParse;
-        CleanupStack::PushL( fileParser );
-        fileParser->Set( KResourceFileName, &KDC_APP_RESOURCE_DIR, NULL ); 
-        m_ResourceFileName = fileParser->FullName();
-        m_ResourceLoader.OpenL( m_ResourceFileName );
-        m_ResourceOpened = ETrue;
-        CleanupStack::PopAndDestroy( fileParser ); // fileParser
-        
-        m_ServiceHandler->AttachL( R_WRTTELSERVICES_MENU_AIW_INTERESTS );
-        
-    } 
-
-    CAiwGenericParamList& paramList = m_ServiceHandler->InParamListL();
-    CAiwGenericParamList& output = m_ServiceHandler->OutParamListL();
-
-    HBufC* numberPtr = qt_QString2HBufCNewL( number );
-    CleanupStack::PushL( numberPtr );
-    m_DialData->SetPhoneNumberL( *numberPtr );
-    CleanupStack::PopAndDestroy( ); // numberPtr
-    
-    if( !voipCall )
-        m_DialData->SetCallType( CAiwDialData::EAIWVideo );
-    else
-        m_DialData->SetCallType( CAiwDialData::EAIWVoiP );
-
-    m_DialData->FillInParamListL( paramList );
-    
-    
-    m_ServiceHandler->ExecuteServiceCmdL(
-                    KAiwCmdCall,
-                    paramList,
-                    output,
-                    0,      // No options used.
-                    0 ); //
-
-#endif
-    
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::ValidateNumber()
-//---------------------------------------------------------------------------------------
-//
-QString WrtTelServicePrivate::ValidateNumber( const QString number )
-{
-    QString newNumber;
-    bool first = true;
-    foreach(QChar currentChar, number )
-        {
-        if( currentChar.isDigit() )
-            newNumber.append(currentChar);
-        else {
-            char ch = currentChar.toUpper().toLatin1();
-            switch( ch ) {
-
-                case '+':
-                    if( !first )
-                        return QString();
-                    else
-                        newNumber.append(ch);
-                    break;
-                case '*':
-                case '#':
-                case 'A':
-                case 'B':
-                case 'C':
-                case 'D':
-                case 'P':
-                case 'W':
-                case ',':
-                case '/':
-                    if( first )
-                        return QString();
-                    else
-                        newNumber.append(ch);
-                    break;
-               case '.': 
-               case '-':
-               case '(':
-               case ')':
-               case ' ':
-                    break; 
-               default:
-                    return QString();
-               }
-            }
-        first = false;
-        }
-    return newNumber;
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::FindPostdParm()
-//---------------------------------------------------------------------------------------
-//
-QString WrtTelServicePrivate::FindPostdParm( QString& number )
-{
-    QString tmpStr;
-    int offset = number.indexOf( POSTD );
-    if ( offset > 0 ) {
-        tmpStr = number.mid( offset + POSTD.length() );
-        number = number.left( offset );
-    }
-    return tmpStr;
-}
-
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::FindAndRipDTMFSequence()
-//---------------------------------------------------------------------------------------
-//
-QString WrtTelServicePrivate::FindAndRipDTMFSequence( QString& number )
-{
-    QString tmpStr;
-    int i = -1;
-    // Look for the first DTMF-wait char and extract the
-    // dtmf string from the phonenumber
-    foreach( QChar ch, number ) {
-        i++;
-        if (DTMFWAITCHARS.indexOf(ch) > 0) {
-            if (ch == '#' || ch == '*') // these are included
-                tmpStr = number.mid(i);
-            else
-                tmpStr = number.mid(i+1);
-            number = number.left(i);
-
-            // Remove all the invalid wait chars from 
-            // the sequence which is not accepted by CallUi
-            foreach(QChar c, DTMFINVALIDWAITCHARS)
-                tmpStr.remove(c);
-
-            break;
-            }
-        }
-    return tmpStr;    
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::FindAndRipURIParameters()
-//---------------------------------------------------------------------------------------
-//
-QString WrtTelServicePrivate::FindAndRipURIParameters( QString& number )
-{
-    QString tmpStr;
-    int offset = number.indexOf(';');
-    if( offset > 0 ) { // Separator is not allowed to be a first char
-        tmpStr = number.mid( offset );
-        number = number.left( offset );
-    }
-    return tmpStr;       
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::FindAndRipVoipParameters()
-//---------------------------------------------------------------------------------------
-//
-QString WrtTelServicePrivate::FindAndRipVoipParameters( QString& number )
-{
-    QString tmpStr;
-    int offset = number.indexOf('@');
-    if( offset > 0 ) { // Separator is not allowed to be a first char
-        tmpStr = number.mid( offset );
-        number = number.left( offset );
-    }
-    return tmpStr;
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::ValidateDTMFNumber()
-//---------------------------------------------------------------------------------------
-//
-void WrtTelServicePrivate::ValidateDTMFNumber( QString& number )
-{
-    QString orgNumber = number;
-    foreach(QChar c, orgNumber)
-        if (VALIDDTMFCHARS.indexOf(c) < 0)
-              number.remove(c);
-    
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::HandleNotifyL()
-//---------------------------------------------------------------------------------------
-//
-TInt WrtTelServicePrivate::HandleNotifyL( TInt /*aCmdId*/, TInt /*aEventId*/,
-                                        CAiwGenericParamList& /*aEventParamList*/,
-                                        const CAiwGenericParamList& /*aInParamList*/ )
-{
-    return KErrNone;
-}
-
-//---------------------------------------------------------------------------------------
-// WrtTelServicePrivate::qt_QString2HBufCNewL()
-//     copied from qcore_symbian_p.cpp
-//---------------------------------------------------------------------------------------
-//
-HBufC* WrtTelServicePrivate::qt_QString2HBufCNewL(const QString& aString)
-{
-    HBufC *buffer;
-#ifdef QT_NO_UNICODE
-    TPtrC8 ptr(reinterpret_cast<const TUint8*>(aString.toLocal8Bit().constData()));
-    buffer = HBufC8::NewL(ptr.Length());
-    buffer->Des().Copy(ptr);
-#else
-    TPtrC16 ptr(reinterpret_cast<const TUint16*>(aString.utf16()));
-    buffer = HBufC16::NewL(ptr.Length());
-    buffer->Des().Copy(ptr);
-#endif
-    return buffer;
-}
-
-
--- a/browsercore/core/network/WrtTelServiceBr.h	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-* 
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-// INCLUDE FILES
-#ifndef __WRTTELSERVICE_H
-#define __WRTTELSERVICE_H
-
-#include <QtCore/QObject>
-#include <QString>
-
-  
-// FORWARD DECLARATIONS
-class WrtTelServicePrivate;
-
-
-// CLASS DECLARATION
-
-/**
-*  Implements telephony services for browser.
-*  This class implements required telephony services for multipurpose browser.
-*/
-class WrtTelService : public QObject {
-  
-	  Q_OBJECT
-	  
-public:
-	
-	  WrtTelService();
-		~WrtTelService();
-
-		void MakeCall( QString number, bool sendDTMFAlwaysConfirm );
-
-		void MakeVOIPCall( QString number, bool sendDTMFAlwaysConfirm );
-		
-private:
-    WrtTelServicePrivate* d;
-	};
-
-#endif // __WRTTELSERVICE_H
--- a/browsercore/core/network/WrtTelServiceBr_p.h	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-* 
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-// INCLUDE FILES
-#ifndef __WRTTELSERVICE_P_H
-#define __WRTTELSERVICE_P_H
-
-#if defined(Q_OS_SYMBIAN)
-
-
-#include "WrtTelServiceBr.h"
-#include <QtCore/QObject>
-#include <QString>
-
-#include <ConeResLoader.h>
-
-// AIW related headers
-#include <AiwServiceHandler.h>
-
-#if !defined (SYMBIAN_PUB_SDK)
-#include <AiwDialData.h>
-#include <AiwDialDataExt.h>
-#endif
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-  
-class WrtTelServicePrivate : public QObject
-    , public MAiwNotifyCallback
-{
-  
-  public:
-  
-    WrtTelServicePrivate( );
-    ~WrtTelServicePrivate();
-
-    void MakeCall( QString number, bool sendDTMFAlwaysConfirm, bool voipCall );
-    
-    QString ValidateNumber( const QString number );
-
-    QString FindPostdParm( QString& number );
-
-    QString FindAndRipDTMFSequence( QString& number );
-
-    QString FindAndRipURIParameters( QString& number );
-
-    QString FindAndRipVoipParameters( QString& number );
-
-    void ValidateDTMFNumber( QString& number );
-    
-  protected:
-  
-    /**
-    * From MAiwNotifyCallback
-    */
-    TInt HandleNotifyL( TInt aCmdId,
-                        TInt aEventId,
-                        CAiwGenericParamList& aEventParamList,
-                        const CAiwGenericParamList& aInParamList );
-
-    
-  private:
-    void DoMakeCallL( QString number, bool sendDTMFAlwaysConfirm );
-        
-    HBufC* qt_QString2HBufCNewL(const QString& aString);
-
-    
-  private:  // Data
-    bool m_CallInProgress;
-    TFileName                   m_ResourceFileName; ///< Temp storage for the file name.
-    RConeResourceLoader         m_ResourceLoader; ///< Resource loader.
-    bool                        m_ResourceOpened; ///< Indicate if the resource is opened.
-    // AIW related members
-    CAiwServiceHandler* m_ServiceHandler;
-
-#if !defined (SYMBIAN_PUB_SDK)
-    // DialData.
-    CAiwDialData*      m_DialData;
-#endif
-
-  };
-  
-#endif  
-
-#endif // __WRTTELSERVICE_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/core/network/cacheworkerthread.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef CACHEWORKERTHREAD_H
+#define CACHEWORKERTHREAD_H
+
+#include <QThread>
+
+
+#endif // CACHEWORKERTHREAD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/core/network/featherweightcache.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,924 @@
+/****************************************************************************
+**
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+# include <QAbstractNetworkCache>
+# include <QNetworkCacheMetaData>
+# include <QDateTime>
+# include <QDir>
+# include <QDirIterator>
+# include <QFile>
+# include <QtGlobal>
+# include <QDebug>
+# include <QQueue>
+# include <featherweightcache.h>
+# include <featherweightcache_p.h>
+#if defined(Q_OS_SYMBIAN)
+#include <e32std.h>
+#endif
+
+//#define FEATHERWEIGHTCACHE_DEBUG
+
+#define CACHE_POSTFIX QLatin1String(".d")
+#define PREPARED_SLASH QLatin1String("prepared/")
+#define DATA_SLASH QLatin1String("data/")
+#define MAX_COMPRESSION_SIZE (1024 * 1024 * 3)
+
+namespace WRT {
+
+/*!
+    \class FeatherWeightCache
+
+    \brief The FeatherWeightCache class provides a very basic disk cache.
+
+    FeatherWeightCache stores each url in its own file inside of the
+    cacheDirectory using QDataStream.  Files with a text MimeType
+    are compressed using qCompress.  Each cache file starts with "cache_"
+    and ends in ".cache".  Data is written to disk only in insert()
+    and updateMetaData().
+
+    Currently you can not share the same cache files with more then
+    one disk cache.
+
+    FeatherWeightCache by default limits the amount of space that the cache will
+    use on the system to 50MB.
+
+    Note you have to set the cache directory before it will work.
+
+    A network disk cache can be enabled by:
+
+    \snippet doc/src/snippets/code/src_network_access_FeatherWeightCache.cpp 0
+
+    When sending requests, to control the preference of when to use the cache
+    and when to use the network, consider the following:
+
+    \snippet doc/src/snippets/code/src_network_access_FeatherWeightCache.cpp 1
+
+    To check whether the response came from the cache or from the network, the
+    following can be applied:
+
+    \snippet doc/src/snippets/code/src_network_access_FeatherWeightCache.cpp 2
+*/
+
+/*!
+    Creates a new disk cache. The \a parent argument is passed to
+    QAbstractNetworkCache's constructor.
+ */
+FeatherWeightCache::FeatherWeightCache(QObject *parent)
+    : QAbstractNetworkCache(parent)
+{
+
+    d = new FeatherWeightCachePrivate(this);
+}
+
+/*!
+    Destroys the cache object.  This does not clear the disk cache.
+ */
+FeatherWeightCache::~FeatherWeightCache()
+{
+    QHashIterator<QIODevice*, CacheItem*> it(d->inserting);
+    while (it.hasNext()) {
+        it.next();
+        delete it.value();
+    }
+
+}
+
+/*!
+    Returns the location where cached files will be stored.
+*/
+QString FeatherWeightCache::cacheDirectory() const
+{
+    return d->cacheDirectory;
+}
+
+/*!
+    Sets the directory where cached files will be stored to \a cacheDir
+
+    FeatherWeightCache will create this directory if it does not exists.
+
+    Prepared cache items will be stored in the new cache directory when
+    they are inserted.
+
+    \sa QDesktopServices::CacheLocation
+*/
+void FeatherWeightCache::setCacheDirectory(const QString &cacheDir)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    qDebug() << "FeatherWeightCache::setCacheDirectory()" << cacheDir;
+#endif
+    if (cacheDir.isEmpty())
+        return;
+    d->cacheDirectory = cacheDir;
+    QDir dir(d->cacheDirectory);
+    d->cacheDirectory = dir.absolutePath();
+    if (!d->cacheDirectory.endsWith(QLatin1Char('/')))
+        d->cacheDirectory += QLatin1Char('/');
+
+    d->prepareLayout();
+}
+
+/*!
+    \reimp
+*/
+qint64 FeatherWeightCache::cacheSize() const
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    qDebug() << "FeatherWeightCache::cacheSize()";
+#endif
+    if (d->cacheDirectory.isEmpty())
+        return 0;
+    if (d->currentCacheSize < 0) {
+        FeatherWeightCache *that = const_cast<FeatherWeightCache*>(this);
+        that->d->currentCacheSize = that->expire();
+    }
+    return d->currentCacheSize;
+}
+
+/*!
+    \reimp
+*/
+QIODevice *FeatherWeightCache::prepare(const QNetworkCacheMetaData &metaData)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    //qDebug() << "FeatherWeightCache::prepare()" << metaData.url();
+#endif
+    if (!metaData.isValid() || !metaData.url().isValid() || !metaData.saveToDisk())
+        return 0;
+
+    if (d->cacheDirectory.isEmpty()) {
+        qWarning() << "FeatherWeightCache::prepare() The cache directory is not set";
+        return 0;
+    }
+
+    foreach (QNetworkCacheMetaData::RawHeader header, metaData.rawHeaders()) {
+        if (header.first.toLower() == "content-length") {
+            qint64 size = header.second.toInt();
+            if (size > (maximumCacheSize() * 3)/4)
+                return 0;
+            break;
+        }
+    }
+    QScopedPointer<CacheItem> cacheItem(new CacheItem);
+    cacheItem->metaData = metaData;
+
+    QIODevice *device = 0;
+    if (cacheItem->canCompress()) {
+        cacheItem->data.open(QBuffer::ReadWrite);
+        device = &(cacheItem->data);
+    } else {
+        QString templateName = d->tmpCacheFileName();
+        QT_TRY {
+            cacheItem->file = new QTemporaryFile(templateName, &cacheItem->data);
+        } QT_CATCH(...) {
+            cacheItem->file = 0;
+        }
+        if (!cacheItem->file || !cacheItem->file->open()) {
+            qWarning() << "FeatherWeightCache::prepare() unable to open temporary file";
+            cacheItem.reset();
+            return 0;
+        }
+        cacheItem->writeHeader(cacheItem->file);
+        device = cacheItem->file;
+    }
+    d->inserting[device] = cacheItem.take();
+    return device;
+}
+
+/*!
+    \reimp
+*/
+void FeatherWeightCache::insert(QIODevice *device)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    //qDebug() << "FeatherWeightCache::insert()" << device;
+#endif
+    QHash<QIODevice*, CacheItem*>::iterator it = d->inserting.find(device);
+    if (it == d->inserting.end()) {
+        qWarning() << "FeatherWeightCache::insert() called on a device we don't know about" << device;
+        return;
+    }
+
+    d->storeItem(it.value());
+    delete it.value();
+    d->inserting.erase(it);
+}
+
+
+/*!
+    Create subdirectories and other housekeeping on the filesystem.
+    Prevents too many files from being present in any single directory.
+*/
+void FeatherWeightCachePrivate::prepareLayout()
+{
+    QDir prepared;
+    prepared.mkpath(cacheDirectory + PREPARED_SLASH);
+
+    QString path = cacheDirectory + DATA_SLASH;
+    QDir dataDirectory(path);
+
+    //Create directory and subdirectories 0-F
+    dataDirectory.mkpath(path);
+    for ( uint i = 0; i < 16 ; i++ ) {
+        QString str = QString::number(i, 16);
+        QString subdir = dataDirectory.path() + QDir::separator() + str;
+        dataDirectory.mkdir(subdir);
+    }
+
+    // TODO: populate volumeInfo members here base on which disk/fileystem
+    // you plan to write (a) temp ("prepared") files to (b) write final cache files too
+    // volumeInfo->clusterSize = 1024;
+    // volumeInfo->readBufSize = 16384;
+    // volumeInfo->writeBufSize = 16384;
+#ifdef Q_OS_SYMBIAN
+    //VolumeIOParam(TInt aDriveNo, TVolumeIOParamInfo &aParamInfo) const;
+#endif
+}
+
+// CRC32 implementation.
+// Could be made into new API QByteArray:qChecksum32()
+static const quint32 crc_tbl32[256] = {
+    0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
+    0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
+    0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+    0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
+    0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+    0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+    0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
+    0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
+    0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+    0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+    0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
+    0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+    0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
+    0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
+    0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+    0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
+    0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
+    0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+    0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
+    0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+    0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+    0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
+    0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
+    0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+    0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+    0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
+    0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+    0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
+    0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
+    0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+    0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
+    0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
+    0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+    0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
+    0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+    0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+    0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
+    0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
+    0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+    0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+    0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
+    0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+    0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
+    0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
+    0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+    0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
+    0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
+    0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+    0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
+    0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+    0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+    0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
+    0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
+    0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+    0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+    0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
+    0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+    0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
+    0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
+    0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+    0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
+    0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
+    0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+    0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+};
+
+quint32 FeatherWeightCachePrivate::crc32(const char *data, uint len)
+{
+    const uchar *p = reinterpret_cast<const uchar *>(data);
+    const uchar *q = p + len;
+    const quint32 init = 0xFFFFFFFFL;
+
+    quint32 crc32 = init;
+    while (p < q) {
+        crc32 = (crc32 >> 8) ^ crc_tbl32[(crc32 ^ *p++) & 0xffL];
+    }
+    return crc32 ^ init ;
+}
+
+void FeatherWeightCachePrivate::storeItem(CacheItem *cacheItem)
+{
+    Q_ASSERT(cacheItem->metaData.saveToDisk());
+
+    QString fileName = cacheFileName(cacheItem->metaData.url());
+    Q_ASSERT(!fileName.isEmpty());
+
+
+    if (currentCacheSize > 0) {
+        currentCacheSize += FILESYSTEMOVERHEAD + cacheItem->size();
+    }
+
+
+    //lut.insert( URL2HASH(cacheItem->metaData.url()), FILESYSTEMOVERHEAD + cacheItem->size() ) ;
+
+    currentCacheSize = (reinterpret_cast<FeatherWeightCache *>(parent()))->expire();
+
+
+
+    if (!cacheItem->file) {
+        QString templateName = tmpCacheFileName();
+        cacheItem->file = new QTemporaryFile(templateName, &cacheItem->data);
+        if (cacheItem->file->open()) {
+            cacheItem->writeHeader(cacheItem->file);
+            cacheItem->writeCompressedData(cacheItem->file);
+        }
+    }
+
+    if (cacheItem->file
+        && cacheItem->file->isOpen()
+        && cacheItem->file->error() == QFile::NoError) {
+        cacheItem->file->setAutoRemove(false);
+        // ### use atomic rename rather then remove & rename
+        if (cacheItem->file->rename(fileName))
+            currentCacheSize += cacheItem->file->size();
+        else {
+            // Presume that the destination file exists and/or is open. So try nuking.
+            bool err1 = QFile::remove(fileName);
+            Q_UNUSED(err1);
+            bool err2 = cacheItem->file->rename(fileName);
+            // You are hopeless. Don't persist
+            if (!err2)  {
+                cacheItem->file->setAutoRemove(true);
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+                qWarning() << "FeatherWeightCache: couldn't replace the cache file " << fileName;
+#endif
+            }
+        }
+    }
+    if (cacheItem->metaData.url() == lastItem.metaData.url())
+        lastItem.reset();
+}
+
+/*!
+    \reimp
+*/
+bool FeatherWeightCache::remove(const QUrl &url)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    //qDebug() << "FeatherWeightCache::remove()" << url;
+#endif
+
+    // remove is also used to cancel insertions, not a common operation
+    QHashIterator<QIODevice*, CacheItem*> it(d->inserting);
+    while (it.hasNext()) {
+        it.next();
+        CacheItem *item = it.value();
+        if (item && item->metaData.url() == url) {
+            delete item;
+            d->inserting.remove(it.key());
+            return true;
+        }
+    }
+
+    if (d->lastItem.metaData.url() == url)
+        d->lastItem.reset();
+    return d->removeFile(d->cacheFileName(url));
+}
+
+/*!
+    Put all of the misc file removing into one function to be extra safe
+ */
+bool FeatherWeightCachePrivate::removeFile(const QString &file)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    //qDebug() << "FeatherWeightCache::removFile()" << file;
+#endif
+    if (file.isEmpty())
+        return false;
+    QFileInfo info(file);
+    QString fileName = info.fileName();
+    if (!fileName.endsWith(CACHE_POSTFIX))
+        return false;
+    qint64 size = info.size();
+    if (QFile::remove(file)) {
+        currentCacheSize -= size;
+        return true;
+    }
+    return false;
+}
+
+/*!
+    Use signal from worker thread to update disk usage awareness
+ */
+void FeatherWeightCachePrivate::updateCacheSize(qint64 newSize)
+{
+    currentCacheSize = newSize;
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    qDebug() << "FeatherWeightCachePrivate::updateCacheSize " << " new size " << currentCacheSize;
+#endif
+}
+
+/*!
+    \reimp
+*/
+QNetworkCacheMetaData FeatherWeightCache::metaData(const QUrl &url)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    //qDebug() << "FeatherWeightCache::metaData()" << url;
+#endif
+    if (d->lastItem.metaData.url() == url)
+        return d->lastItem.metaData;
+    return fileMetaData(d->cacheFileName(url));
+}
+
+/*!
+    Returns the QNetworkCacheMetaData for the cache file \a fileName.
+
+    If \a fileName is not a cache file QNetworkCacheMetaData will be invalid.
+ */
+QNetworkCacheMetaData FeatherWeightCache::fileMetaData(const QString &fileName) const
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    //qDebug() << "FeatherWeightCache::fileMetaData()" << fileName;
+#endif
+    QFile file(fileName);
+    if (!file.open(QFile::ReadOnly))
+        return QNetworkCacheMetaData();
+    if (!d->lastItem.read(&file, false)) {
+        file.close();
+        FeatherWeightCachePrivate *that = const_cast<FeatherWeightCachePrivate*>(d);
+        that->removeFile(fileName);
+    }
+    return d->lastItem.metaData;
+}
+
+/*!
+    \reimp
+*/
+QIODevice *FeatherWeightCache::data(const QUrl &url)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    //qDebug() << "FeatherWeightCache::data()" << url;
+#endif
+
+    QScopedPointer<QBuffer> buffer;
+    if (!url.isValid())
+        return 0;
+    if (d->lastItem.metaData.url() == url && d->lastItem.data.isOpen()) {
+        buffer.reset(new QBuffer);
+        buffer->setData(d->lastItem.data.data());
+    } else {
+        QScopedPointer<QFile> file(new QFile(d->cacheFileName(url)));
+        if (!file->open(QFile::ReadOnly | QIODevice::Unbuffered))
+            return 0;
+
+        if (!d->lastItem.read(file.data(), true)) {
+            file->close();
+            remove(url);
+            return 0;
+        }
+        if (d->lastItem.data.isOpen()) {
+            // compressed
+            buffer.reset(new QBuffer);
+            buffer->setData(d->lastItem.data.data());
+        } else {
+            buffer.reset(new QBuffer);
+            // ### verify that QFile uses the fd size and not the file name
+            qint64 size = file->size() - file->pos();
+            const uchar *p = 0;
+#ifndef Q_OS_WINCE
+            p = file->map(file->pos(), size);
+#endif
+            if (p) {
+                buffer->setData((const char *)p, size);
+                file.take()->setParent(buffer.data());
+            } else {
+                buffer->setData(file->readAll());
+            }
+        }
+    }
+    buffer->open(QBuffer::ReadOnly);
+    return buffer.take();
+}
+
+/*!
+    \reimp
+*/
+void FeatherWeightCache::updateMetaData(const QNetworkCacheMetaData &metaData)
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    qDebug() << "FeatherWeightCache::updateMetaData()" << metaData.url();
+#endif
+    QUrl url = metaData.url();
+    QIODevice *oldDevice = data(url);
+    if (!oldDevice) {
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+        qDebug() << "FeatherWeightCache::updateMetaData(), no device!";
+#endif
+        return;
+    }
+
+    QIODevice *newDevice = prepare(metaData);
+    if (!newDevice) {
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+        qDebug() << "FeatherWeightCache::updateMetaData(), no new device!" << url;
+#endif
+        return;
+    }
+    //TODO: Optimize this somehow?
+    char data[1024];
+    while (!oldDevice->atEnd()) {
+        qint64 s = oldDevice->read(data, 1024);
+        newDevice->write(data, s);
+    }
+    delete oldDevice;
+    insert(newDevice);
+}
+
+/*!
+    Returns the current maximum size for the disk cache.
+
+    \sa setMaximumCacheSize()
+ */
+qint64 FeatherWeightCache::maximumCacheSize() const
+{
+    return d->maximumCacheSize;
+}
+
+/*!
+    Sets the maximum size of the disk cache to be \a size.
+
+    If the new size is smaller then the current cache size then the cache will call expire().
+
+    \sa maximumCacheSize()
+ */
+void FeatherWeightCache::setMaximumCacheSize(qint64 size)
+{
+
+    bool expireCache = (size < d->maximumCacheSize);
+    d->maximumCacheSize = size;
+    if (expireCache)
+        d->currentCacheSize = expire();
+}
+
+/*!
+    Cleans the cache so that its size is under the maximum cache size.
+    Returns the current size of the cache.
+
+    When the current size of the cache is greater than the maximumCacheSize()
+    older cache files are removed until the total size is less then 90% of
+    maximumCacheSize() starting with the oldest ones first using the file
+    creation date to determine how old a cache file is.
+
+    Subclasses can reimplement this function to change the order that cache
+    files are removed taking into account information in the application
+    knows about that FeatherWeightCache does not, for example the number of times
+    a cache is accessed.
+
+    Note: cacheSize() calls expire if the current cache size is unknown.
+
+    \sa maximumCacheSize(), fileMetaData()
+ */
+qint64 FeatherWeightCache::expire()
+{
+
+    if (d->currentCacheSize >= 0 && d->currentCacheSize < maximumCacheSize())
+        return d->currentCacheSize;
+
+    if (cacheDirectory().isEmpty()) {
+        qWarning() << "FeatherWeightCache::expire() The cache directory is not set";
+        return 0;
+    }
+
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    qDebug() << "Calling expire, size = " << d->currentCacheSize << " , max = " << maximumCacheSize() ;
+#endif
+    return d->expire();
+}
+
+/*!
+    \reimp
+*/
+void FeatherWeightCache::clear()
+{
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    qDebug() << "FeatherWeightCache::clear()";
+#endif
+
+    qint64 size = d->maximumCacheSize;
+    d->maximumCacheSize = 0;
+    d->currentCacheSize = expire();
+    d->maximumCacheSize = size;
+}
+
+qint64 FeatherWeightCachePrivate::expire()
+{
+
+    // ASYNC expiration via background thread
+    beastOfBurden.expireLazily(cacheDirectory, maximumCacheSize);
+
+    // Note: this cache size will not/cannot reflect the reduced
+    // cache size due to the async nature of the expire() above.
+    return currentCacheSize;
+}
+
+QByteArray FeatherWeightCachePrivate::generateId(const QUrl &url)
+{
+    QUrl cleanUrl = url;
+    cleanUrl.setPassword(QString());
+    cleanUrl.setFragment(QString());
+    QByteArray blob = cleanUrl.toEncoded();
+
+    QByteArray hash;
+    hash.setNum(crc32(blob.data(), blob.length()), 16);
+    return hash;
+}
+
+QString FeatherWeightCachePrivate::tmpCacheFileName() const
+{
+    //The subdirectory is presumed to be already read for use.
+    return cacheDirectory + PREPARED_SLASH + QLatin1String("XXXXXX") + CACHE_POSTFIX;
+}
+
+/*!
+    Genrates fully qualified path of cached resource from a URL.
+ */
+QString FeatherWeightCachePrivate::cacheFileName(const QUrl &url) const
+{
+    if (!url.isValid())
+        return QString();
+
+    // map URL to a unique enough signature
+    const QByteArray unique(generateId(url));
+
+    // generates <cache dir>/data/e/cache_beefcafe.cache
+    // where 'e' is the last character of a hex string
+    QString fullpath = cacheDirectory + DATA_SLASH
+                       + QLatin1Char(unique.at(unique.length()-1)) + QLatin1String("/")
+                       + QLatin1String(unique) + CACHE_POSTFIX;
+
+    return  fullpath;
+}
+
+
+/* Important: This c'tor runs in the same thread as main cache */
+WorkerThread::WorkerThread()
+{
+    abort = false;
+}
+
+/* Important: This d'tor runs in the same thread as main cache */
+WorkerThread::~WorkerThread()
+{
+    // The destructor can be called at any point while the thread is active.
+    // So we set abort to true to tell run() to stop running as soon as possible.
+    mutex.lock();
+    abort = true;
+    condition.wakeOne(); // wake up thread if it has nothing to do
+    mutex.unlock();
+
+    wait(); // waits for run() to return
+}
+
+/* Important: This method runs in its own thread, unlike the c'tor and d'tor */
+void WorkerThread::run()
+{
+
+#if defined(Q_OS_SYMBIAN)
+    // Remove this once QTBUG-10271 is fixed
+    RThread myThread;
+    myThread.SetPriority(EPriorityLess);
+#endif
+
+    qint64 size = expireImpl();
+    emit onDiskSizeChanged(size);
+
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    qDebug() << "New on-disk cache size: " << size <<  QThread::currentThreadId();
+#endif
+
+
+}
+
+qint64 WorkerThread::expireImpl()
+{
+    QDir::Filters filters = QDir::AllDirs | QDir:: Files | QDir::NoDotAndDotDot;
+    QDirIterator it(this->cacheDir, filters, QDirIterator::Subdirectories);
+
+    QMultiMap<QDateTime, QString> cacheItems;
+    qint64 totalSize = 0;
+    while (it.hasNext()) {
+        QString path = it.next();
+        QFileInfo info = it.fileInfo();
+        QString fileName = info.fileName();
+        if (fileName.endsWith(CACHE_POSTFIX)) {
+            cacheItems.insert(info.created(), path);
+            totalSize += info.size();
+        }
+
+        // Interrupts this slow loop when d'tor is called
+        if (abort) {
+            // potentially incorrect, but can't do any better
+            return totalSize;
+        }
+    }
+
+    int removedFiles = 0;
+    // this goal setting could be made smarter based on max cache size
+    // e.g on desktop with large 50MB caches, freeing 10% is probably enough
+    // but on mobile where caches are smaller (e.g 5MB) and disks are slow, you want
+    // to free atleast 0.5-1MB if going through all this trouble.
+    // Also TODO: Move to LRU algorithm
+    qint64 goal = (this->maxCacheSize * 8) / 10;
+    QMultiMap<QDateTime, QString>::const_iterator i = cacheItems.constBegin();
+    while (i != cacheItems.constEnd()) {
+        if (totalSize < goal)
+            break;
+        QString name = i.value();
+        QFile file(name);
+        qint64 size = file.size();
+        file.remove();
+        totalSize -= size;
+        ++removedFiles;
+        ++i;
+
+        // Interrupts this slow loop when d'tor is called
+        if (abort) {
+            // potentially incorrect, but can't do any better
+            return totalSize;
+        }
+
+    }
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+    if (removedFiles > 0) {
+        qDebug() << "FeatherWeightCache::expire()"
+                << "Removed:" << removedFiles
+                << "Kept:" << cacheItems.count() - removedFiles;
+    }
+#endif
+
+    //TODO: Why do we do this in the original
+    //implementation? It isn't necessary that
+    //running expiration logics caused last
+    //insertion to become invalid?
+    //if (removedFiles > 0)
+    //    lastItem.reset();
+
+    return totalSize;
+
+}
+
+/* Important: this function runs in the same thread as main cache */
+void WorkerThread::expireLazily(QString cacheDir, qint64 maxCacheSize)
+{
+
+    //lock mutex. unlock automatically when locker goes out of scope
+    QMutexLocker locker(&mutex);
+
+    //make private copy so that other member functions can use this
+    this->cacheDir = cacheDir;
+    this->maxCacheSize = maxCacheSize;
+
+    if (!isRunning()) {
+
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+        qDebug() << "Starting worker thread a low priority";
+#endif
+
+        start(LowPriority);
+
+    } else {
+
+#if defined(FEATHERWEIGHTCACHE_DEBUG)
+        qDebug() << "Waking up sleeping worker thread";
+#endif
+
+        condition.wakeOne();
+
+    }
+
+}
+
+
+/*!
+    We compress small text and JavaScript files.
+ */
+bool CacheItem::canCompress() const
+{
+#if 1
+    bool sizeOk = false;
+    bool typeOk = false;
+    foreach (QNetworkCacheMetaData::RawHeader header, metaData.rawHeaders()) {
+        if (header.first.toLower() == "content-length") {
+            qint64 size = header.second.toLongLong();
+            if (size > MAX_COMPRESSION_SIZE)
+                return false;
+            else
+                sizeOk = true;
+        }
+
+        if (header.first.toLower() == "content-type") {
+            QByteArray type = header.second;
+            if (type.startsWith("text/")
+                    || (type.startsWith("application/")
+                        && (type.endsWith("javascript") || type.endsWith("ecmascript"))))
+                typeOk = true;
+            else
+                return false;
+        }
+        if (sizeOk && typeOk)
+            return true;
+    }
+    return false;
+#else
+    return false;
+#endif
+
+}
+
+enum
+{
+    CacheMagic = 0xe8,
+    CurrentCacheVersion = 7
+};
+
+void CacheItem::writeHeader(QFile *device) const
+{
+    QDataStream out(device);
+
+    out << qint32(CacheMagic);
+    out << qint32(CurrentCacheVersion);
+    out << metaData;
+    bool compressed = canCompress();
+    out << compressed;
+}
+
+void CacheItem::writeCompressedData(QFile *device) const
+{
+    QDataStream out(device);
+
+    out << qCompress(data.data());
+}
+
+/*!
+    Returns false if the file is a cache file,
+    but is an older version and should be removed otherwise true.
+ */
+bool CacheItem::read(QFile *device, bool readData)
+{
+    reset();
+
+    QDataStream in(device);
+
+    qint32 marker;
+    qint32 v;
+    in >> marker;
+    in >> v;
+    if (marker != CacheMagic)
+        return true;
+
+    // If the cache magic is correct, but the version is not we should remove it
+    if (v != CurrentCacheVersion)
+        return false;
+
+    bool compressed;
+    QByteArray dataBA;
+    in >> metaData;
+    in >> compressed;
+    if (readData && compressed) {
+        in >> dataBA;
+        data.setData(qUncompress(dataBA));
+        data.open(QBuffer::ReadOnly);
+    }
+    return metaData.isValid();
+}
+
+} // namespace WRT
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/core/network/featherweightcache.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef FEATHERWEIGHTCACHE_H
+#define FEATHERWEIGHTCACHE_H
+
+# include <QAbstractNetworkCache>
+# include <QNetworkCacheMetaData>
+# include <QDir>
+# include <QFile>
+# include <QtGlobal>
+
+#include "brtglobal.h"
+
+namespace WRT {
+class FeatherWeightCachePrivate;
+class WRT_BROWSER_EXPORT FeatherWeightCache : public QAbstractNetworkCache
+{
+    Q_OBJECT
+
+public:
+    explicit FeatherWeightCache(QObject *parent = 0);
+    ~FeatherWeightCache();
+
+    QString cacheDirectory() const;
+    void setCacheDirectory(const QString &cacheDir);
+
+    qint64 maximumCacheSize() const;
+    void setMaximumCacheSize(qint64 size);
+
+    qint64 cacheSize() const;
+    QNetworkCacheMetaData metaData(const QUrl &url);
+    void updateMetaData(const QNetworkCacheMetaData &metaData);
+    QIODevice *data(const QUrl &url);
+    bool remove(const QUrl &url);
+    QIODevice *prepare(const QNetworkCacheMetaData &metaData);
+    void insert(QIODevice *device);
+
+    QNetworkCacheMetaData fileMetaData(const QString &fileName) const;
+
+public Q_SLOTS:
+    void clear();
+
+protected:
+     qint64 expire();
+
+private:
+    FeatherWeightCachePrivate* d;
+    friend class FeatherWeightCachePrivate;
+    Q_DISABLE_COPY(FeatherWeightCache)
+};
+} // namespace WRT
+
+#endif // FEATHERWEIGHTCACHE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/core/network/featherweightcache_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef FEATHERWEIGHTCACHE_P_H
+#define FEATHERWEIGHTCACHE_P_H
+
+#include <QBuffer>
+#include <QHash>
+#include <QTemporaryFile>
+#include <QFile>
+#include <QNetworkCacheMetaData>
+#include <QObject>
+#include <QQueue>
+#include <QMutex>
+#include <QWaitCondition>
+#include <cacheworkerthread.h>
+
+namespace WRT {
+class CacheItem
+{
+public:
+    CacheItem() : file(0)
+    {
+    }
+    ~CacheItem()
+    {
+        reset();
+    }
+
+    QNetworkCacheMetaData metaData;
+    QBuffer data;
+    QTemporaryFile *file;
+    inline qint64 size() const
+        { return file ? file->size() : data.size(); }
+
+    inline void reset() {
+        metaData = QNetworkCacheMetaData();
+        data.close();
+        delete file;
+        file = 0;
+    }
+    void writeHeader(QFile *device) const;
+    void writeCompressedData(QFile *device) const;
+    bool read(QFile *device, bool readData);
+
+    bool canCompress() const;
+};
+
+
+class WorkerThread : public QThread
+{
+
+    Q_OBJECT
+
+public:
+    WorkerThread();
+    ~WorkerThread();
+
+    void expireLazily(QString cacheDir, qint64 maxCacheSize);
+
+protected:
+    void run();
+
+private:
+    QMutex mutex;
+    QWaitCondition condition;
+    bool abort;
+    qint64 expireImpl();
+
+    QString cacheDir;
+    qint64 maxCacheSize;
+
+signals:
+    void onDiskSizeChanged(qint64 newSize);
+
+};
+
+
+#define URL2HASH(url) FeatherWeightCachePrivate::generateId(url).toUInt()
+
+// Assume this much higher physical disk usage. Platform and media dependent
+// TODO: On Symbian, we could instead round up number to multiple of TVolumeIOParamInfo.iClusterSize
+#define FILESYSTEMOVERHEAD 2048
+#define ROUNDUPTOMULTIPLE(x, multipleof)    ( (x + multipleof - 1) & ~(multipleof - 1) )
+
+class FeatherWeightCachePrivate : public QObject
+{
+    Q_OBJECT
+
+public:
+    FeatherWeightCachePrivate(QObject* parent): QObject(parent)
+        , maximumCacheSize(1024 * 1024 * 10) //set the maximum default cache to 10M 
+        , currentCacheSize(-1)
+    {
+        // Queued connection because onDiskSizeChanged() is currently always triggered from run() method of worker thread
+        QObject::connect( &beastOfBurden, SIGNAL( onDiskSizeChanged(qint64) ), this, SLOT( updateCacheSize(qint64) ), Qt::DirectConnection );
+    }
+
+    ~FeatherWeightCachePrivate()
+    {
+        // When beastOfBurden's d'tor is called
+        // it will wait() and then auto-terminate
+
+        QObject::disconnect(&beastOfBurden, SIGNAL( onDiskSizeChanged(qint64) ), this, SLOT( updateCacheSize(qint64)));
+    }
+
+    qint64 expire();
+    static QByteArray generateId(const QUrl &url);
+    QString cacheFileName(const QUrl &url) const;
+    QString tmpCacheFileName() const;
+    bool removeFile(const QString &file);
+    void storeItem(CacheItem *item);
+    void prepareLayout();
+    static quint32 crc32(const char *data, uint len);
+
+    mutable CacheItem lastItem;
+    QString cacheDirectory;
+    qint64 maximumCacheSize;
+    qint64 currentCacheSize;
+
+    QHash<QIODevice*, CacheItem*> inserting;
+
+    WorkerThread beastOfBurden;
+
+    // a look up table (LUT) that stores file sizes
+    // corresponding to cached URLs. Helps speed up
+    // cache eviction or expiration logic.
+    // key = CRC32 hash of url , value = size of file on disk
+    // QHash<quint32, qint64> lut;
+
+    // bool isTrimPending;
+
+    //Recommended buffer sizes for fast IO on caching volume
+    struct {
+        quint32 readBufSize;
+        quint32 writeBufSize;
+        quint32 clusterSize;
+    } volumeInfo;
+
+public slots:
+    void updateCacheSize(qint64);
+};
+}
+
+#endif // FEATHERWEIGHTCACHE_P_H
--- a/browsercore/core/network/webcookiejar.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/webcookiejar.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -299,4 +299,17 @@
     return addedCookies;
 }
 
+// Remove all the cookies from memory
+void CookieJar::deleteCookiesFromMemory()
+{
+    QList<QNetworkCookie> cookies = allCookies();
+    if (cookies.isEmpty())
+        return;
+    int oldCount = cookies.count();
+    for (int i = cookies.count() - 1; i >= 0; --i) 
+        cookies.removeAt(i);
+    if (oldCount != cookies.count())
+	    setAllCookies(cookies);
 }
+
+}
--- a/browsercore/core/network/webcookiejar.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/webcookiejar.h	Fri Oct 15 17:30:59 2010 -0400
@@ -39,6 +39,7 @@
     bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
 
     void clear();
+    void deleteCookiesFromMemory();
 
 private slots:
     void save();
--- a/browsercore/core/network/webnetworkaccessmanager.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/webnetworkaccessmanager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -229,9 +229,11 @@
 {
 
 #if QT_VERSION >= 0x040500
-    qDiskCache = new QNetworkDiskCache(this);
-
-    
+    #ifndef QTHTTPCACHE         
+        qDiskCache = new FeatherWeightCache(this);
+    #else
+        qDiskCache = new QNetworkDiskCache(this);
+    #endif
     if ( !BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("DiskCacheEnabled").toBool() ) 
 		return;
 
@@ -247,5 +249,10 @@
 
 #endif
 }
+void WebNetworkAccessManager::deleteCookiesFromMemory()
+{
+    if (m_cookieJar)
+        m_cookieJar->deleteCookiesFromMemory();
+}
 
 }
--- a/browsercore/core/network/webnetworkaccessmanager.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/network/webnetworkaccessmanager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -5,14 +5,14 @@
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, version 2.1 of the License.
-* 
+*
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not, 
+* along with this program.  If not,
 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
 *
 * Description:
@@ -32,6 +32,12 @@
 
 #endif
 
+//#define QTHTTPCACHE
+
+#ifndef QTHTTPCACHE
+#include "featherweightcache.h"
+#endif
+
 namespace WRT {
 
 class WrtBrowserContainer;
@@ -48,8 +54,9 @@
     virtual ~WebNetworkAccessManager();
 
     void onMessageBoxResponse(int retValue);
-    int activeNetworkInterfaces(); 
-    
+    int activeNetworkInterfaces();
+    void deleteCookiesFromMemory();
+
 public slots:
 
 protected:
@@ -63,7 +70,7 @@
 
 private slots:
     void onfinished(QNetworkReply* reply);
-    
+
 private:
     WrtBrowserContainer* m_browserContainer;
     CookieJar* m_cookieJar;
@@ -72,14 +79,17 @@
     SchemeHandler::SchemeHandlerError m_schemeError;
 
 #if QT_VERSION >= 0x040500
+#ifndef QTHTTPCACHE
+    FeatherWeightCache *qDiskCache;
+#else
     QNetworkDiskCache *qDiskCache;
-
+#endif
 #endif
 
 signals:
     void showMessageBox(WRT::MessageBoxProxy* data);
-    void networkErrorHappened(const QString & msg); 
-    void networkErrorUrl(const QUrl & url); 
+    void networkErrorHappened(const QString & msg);
+    void networkErrorUrl(const QUrl & url);
 };
 }
 #endif
--- a/browsercore/core/webpagedata.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/webpagedata.h	Fri Oct 15 17:30:59 2010 -0400
@@ -27,16 +27,86 @@
 #include <QMetaType>
 #include "BWFGlobal.h"
 
-class BWF_EXPORT WebPageData : public QObject
+class BWF_EXPORT WebPageData
 {
-    Q_OBJECT
+static const unsigned int DataMagic = 0x5AFEF00D;
+
 public:
-    WebPageData(){};
-    WebPageData(QObject *parent) : QObject(parent) {};
-    WebPageData(const WebPageData& o) :  m_thumbnail(o.m_thumbnail),m_zoomFactor(o.m_zoomFactor),m_contentsPos(o.m_contentsPos) {};
-    QImage  m_thumbnail;
-    qreal   m_zoomFactor;
-    QPoint  m_contentsPos;
+    WebPageData() :
+                    magic(0) // default constructor should create valid item
+            ,       minScale(1.0)
+            ,       maxScale(1.0)
+            ,       userScalable(true)
+            ,       initialScale(1.0)
+            ,       rect(QRectF())
+            ,       webViewRect(QRectF())
+            ,       scale(1.0)
+            ,       viewportSize(QSizeF())
+            ,       specifiedWidth(QString())
+            ,       specifiedHeight(QString())
+            ,       fitToScreen(0)
+    {};
+
+    WebPageData(qreal aMaxScale, qreal aMinScale, qreal aUserScalable, qreal aInitialScale) :
+                    magic(DataMagic)
+            ,       minScale(aMinScale)
+            ,       maxScale(aMaxScale)
+            ,       userScalable(aUserScalable)
+            ,       initialScale(aInitialScale)
+            ,       rect(QRectF())
+            ,       webViewRect(QRectF())
+            ,       scale(1.0)
+            ,       viewportSize(QSizeF())
+            ,       specifiedWidth(QString())
+            ,       specifiedHeight(QString())
+            ,       fitToScreen(0)
+    {};
+
+    WebPageData(qreal aMaxScale, qreal aMinScale, qreal aUserScalable, qreal aInitialScale, const QRectF& aRect, const QRectF& aWebViewRect,
+                qreal aScale, const QSizeF& aViewportSize, const QString& aSpecifiedWidth, const QString& aSpecifiedHeight, bool aFitToScreen) :
+                    magic(DataMagic)
+            ,       minScale(aMinScale)
+            ,       maxScale(aMaxScale)
+            ,       userScalable(aUserScalable)
+            ,       initialScale(aInitialScale)
+            ,       rect(aRect)
+            ,       webViewRect(aWebViewRect)
+            ,       scale(aScale)
+            ,       viewportSize(aViewportSize)
+            ,       specifiedWidth(aSpecifiedWidth)
+            ,       specifiedHeight(aSpecifiedHeight)
+            ,       fitToScreen(aFitToScreen)
+    {};
+
+    WebPageData(const WebPageData& o) : //: QObject()
+                    magic(o.magic)
+            ,       minScale(o.minScale)
+            ,       maxScale(o.maxScale)
+            ,       userScalable(o.userScalable)
+            ,       initialScale(o.initialScale)
+            ,       rect(o.rect)
+            ,       webViewRect(o.webViewRect)
+            ,       scale(o.scale)
+            ,       viewportSize(o.viewportSize)
+            ,       specifiedWidth(o.specifiedWidth)
+            ,       specifiedHeight(o.specifiedHeight)
+            ,       fitToScreen(o.fitToScreen)
+    {};
+
+    bool isValid() const { return magic == DataMagic; }
+
+    unsigned int magic;
+    qreal minScale;
+    qreal maxScale;
+    bool userScalable;
+    qreal initialScale;
+    QRectF rect;
+    QRectF webViewRect;
+    qreal scale;
+    QSizeF viewportSize;
+    QString specifiedWidth;
+    QString specifiedHeight;
+    bool fitToScreen;
 };
 Q_DECLARE_METATYPE (WebPageData)
 QDataStream &operator<<(QDataStream &out, const WebPageData &myObj);
--- a/browsercore/core/wrtbrowsercontainer.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/wrtbrowsercontainer.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -38,15 +38,44 @@
 #include <QWebFrame>
 #include <QGraphicsWebView>
 
+#ifdef QT_GEOLOCATION
+#include "geolocationManager.h"
+
+/* Declare the user defined meta type for use with QVariant in geolocation. */
+Q_DECLARE_METATYPE(QWebPage::PermissionPolicy);
+#endif // QT_GEOLOCATION
+
 QDataStream &operator<<(QDataStream &out, const WebPageData &myObj)
 {
-   out << myObj.m_thumbnail << myObj.m_zoomFactor << myObj.m_contentsPos;
+    out << myObj.magic
+        << myObj.minScale
+        << myObj.maxScale
+        << myObj.userScalable
+        << myObj.initialScale
+        << myObj.rect
+        << myObj.webViewRect
+        << myObj.scale
+        << myObj.viewportSize
+        << myObj.specifiedWidth
+        << myObj.specifiedHeight
+        << myObj.fitToScreen;
    return out;
 }
 
 QDataStream &operator>>(QDataStream &in, WebPageData &myObj)
 {
-   in >> myObj.m_thumbnail >> myObj.m_zoomFactor >> myObj.m_contentsPos;
+    in >> myObj.magic
+       >> myObj.minScale
+       >> myObj.maxScale
+       >> myObj.userScalable
+       >> myObj.initialScale
+       >> myObj.rect
+       >> myObj.webViewRect
+       >> myObj.scale
+       >> myObj.viewportSize
+       >> myObj.specifiedWidth
+       >> myObj.specifiedHeight
+       >> myObj.fitToScreen;
    return in;
 }
 
@@ -109,11 +138,16 @@
 {
     
   settings()->setAttribute(QWebSettings::PluginsEnabled, true);
-  settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("PopupBlocking").toInt());
-	// Download related enable "forwardUnsupportedContent" to redirect unsupported content to download manager
+  BEDROCK_PROVISIONING::BedrockProvisioning * provisioning = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning();
+  settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !provisioning->value("PopupBlocking").toInt());
+
+  // Download related enable "forwardUnsupportedContent" to redirect unsupported content to download manager
 	setForwardUnsupportedContent(true);
 #ifdef BEDROCK_TILED_BACKING_STORE
-    settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
+#ifndef OWN_BACKING_STORE
+	bool enableTiling = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("EnableTiling").toBool(); 
+    settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, enableTiling);
+#endif // OWN_BACKING_STORE
     settings()->setAttribute(QWebSettings::ZoomTextOnly, false);
     settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, true);
 
@@ -123,11 +157,17 @@
     //of the current viewport (centered to the viewport) with tiles and would drop tiles
     //after they are outside an area 2x the width and 2.5x the height of the viewport.
     //Refer https://bugs.webkit.org/show_bug.cgi?id=39874
-
-    setProperty("_q_TiledBackingStoreTileSize", QSize(256, 256));
-    setProperty("_q_TiledBackingStoreTileCreationDelay", 25);
-    setProperty("_q_TiledBackingStoreCoverAreaMultiplier", QSizeF(1.5, 1.5));
-    setProperty("_q_TiledBackingStoreKeepAreaMultiplier", QSizeF(2., 2.5));
+    
+    BEDROCK_PROVISIONING::BedrockProvisioning* brSettings = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning();
+    int tileW = brSettings->value("TilesWidth").toInt();
+    int tileH = brSettings->value("TilesHeight").toInt();
+    int tileCreationDelay = brSettings->value("TileCreationDelay").toInt();
+    qreal coverAreaMultiplier = brSettings->value("TileCoverAreaMultiplier").toDouble();
+    qreal keepAreaMultiplier = brSettings->value("TileKeepAreaMultiplier").toDouble();
+    setProperty("_q_TiledBackingStoreTileSize", QSize(tileW, tileH));
+    setProperty("_q_TiledBackingStoreTileCreationDelay", tileCreationDelay);
+    setProperty("_q_TiledBackingStoreCoverAreaMultiplier", QSizeF(coverAreaMultiplier, coverAreaMultiplier));
+    setProperty("_q_TiledBackingStoreKeepAreaMultiplier", QSizeF(keepAreaMultiplier, keepAreaMultiplier));
 #endif
 
 #ifndef NO_NETWORK_ACCESS_MANAGER	
@@ -146,8 +186,17 @@
     connect(this, SIGNAL(loadProgress(int)), d->m_loadController, SLOT(loadProgress(int)));
     connect(this, SIGNAL(loadFinished(bool)), d->m_loadController, SLOT(loadFinished(bool)));
     connect(mainFrame(), SIGNAL(urlChanged(QUrl)), d->m_loadController, SLOT(urlChanged(QUrl)));
-	connect(mainFrame(), SIGNAL(initialLayoutCompleted()), d->m_loadController, SLOT(initialLayoutCompleted()));
+    connect(mainFrame(), SIGNAL(initialLayoutCompleted()), d->m_loadController, SLOT(initialLayoutCompleted()));
+	  
+#ifdef QT_GEOLOCATION 
+    d->m_geolocationManager = GeolocationManager::getSingleton();
     
+    /* Register user defined Meta Types used in geolocation API. */
+    qRegisterMetaType<QWebPage::PermissionPolicy>("QWebPage::PermissionPolicy");
+    /* Connect the geolocation permission signal to the geolocation handler. */
+    connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)),
+        this, SLOT(handleRequestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)));
+#endif // QT_GEOLOCATION
 }
 
 /*!
@@ -212,14 +261,51 @@
 }
 
 /*!
- * This function page thumbnail for this page as specified by X & Y co-ordinate scale factors
+ *  This function returns a thumbnail image for this page as specified by X & Y co-ordinate scale factors
  * @param  scaleX :  X Co-ordinate scale factor for the page thumbnail
  * @param  scaleY :  y Co-ordinate scale factor for the page thumbnail
  */
+QImage WrtBrowserContainer::thumbnail(QSize s)
+{
+    QImage image(s, QImage::Format_RGB32);
+    qreal fitWidth = s.width();
+    QPoint renderPos(0, 0);
+    WebPageData* d = pageZoomMetaData();
+    qreal scale = 1.0;
+    if(d->isValid())
+    {
+        fitWidth = d->rect.width();
+        if(fitWidth > d->webViewRect.width() * d->scale)
+            fitWidth = d->webViewRect.width() * d->scale;
+        renderPos = d->webViewRect.topLeft().toPoint();
+        scale = s.width() / (fitWidth / d->scale);
+    }
+
+    if (image.isNull()) {
+        return QImage();
+    }
+    QPainter painter(&image);
+    QRect r(QPoint(0,0),s);
+    QRegion clip(r);
+    painter.setBrush(Qt::white);
+    painter.fillRect(r,Qt::white);
+
+    QTransform transform;
+    transform.scale(scale,scale);
+    renderPos /= scale;
+    transform.translate(renderPos.x(),renderPos.y());
+    painter.setTransform(transform);
+
+    mainFrame()->render(&painter);
+    return image;
+}
 QImage WrtBrowserContainer::pageThumbnail(qreal scaleX, qreal scaleY)
 {
-    qDebug() << "WrtBrowserContainer::pageThumbnail:" << webWidget()->size();
-    QSize size = webWidget()->size().toSize();
+    #ifdef Q_WS_MAEMO_5
+    QSize size(800,424);
+    #else
+    QSize size(640,360);
+    #endif
     QImage image(size, QImage::Format_RGB32);
 
     QPainter painter(&image);
@@ -229,8 +315,11 @@
     painter.setBrush(Qt::white);
     painter.drawRect(r);
     painter.restore();
+    qreal saveZoomFactor = mainFrame()->zoomFactor();
+    mainFrame()->setZoomFactor(1.0);
     mainFrame()->render(&painter, clip);
-    QImage thumbnail = image.scaled(scaleX * size.width(), scaleY * size.height());
+    mainFrame()->setZoomFactor(saveZoomFactor);
+    QImage thumbnail = image.scaled(scaleX * size.width(), scaleY * size.height(),Qt::KeepAspectRatio,Qt::SmoothTransformation);
     return thumbnail;
 }
 
@@ -255,8 +344,9 @@
         return;
     }
     if (restoreSession()) return;
-    	
-    WebPageData data(this);
+
+//    item->setUserData(QVariant::fromValue(d->m_zoomData));
+/*    WebPageData data(this);
     //   WebPageData data = item->userData().value<WebPageData>();
     data.m_zoomFactor = 1.0; // Need to find a way to get this.  Not used right now anyway
     data.m_thumbnail = pageThumbnail(0.5, 0.5);//data.m_zoomFactor, data.m_zoomFactor);
@@ -267,7 +357,7 @@
     data.m_contentsPos = pos;
     QVariant variant;
     variant.setValue(data);
-    item->setUserData(variant);
+    item->setUserData(variant); */
     //ii++;
 }
 
@@ -304,6 +394,62 @@
     }
 }
 
+#ifdef QT_GEOLOCATION
+void WrtBrowserContainer::handleRequestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain permissionDomain)
+{
+    QList<QVariant> attributes;
+    QUrl baseUrl = frame->baseUrl();
+    QString domain = baseUrl.host();
+    
+    qDebug() << "handleRequestPermissionFromUser";
+    
+    // Check if the domian from the frame already exisit in the database
+    attributes = d->m_geolocationManager->findGeodomain(domain);
+    
+    if (!attributes.isEmpty())
+    {
+        QWebPage::PermissionPolicy permission
+            = attributes.at(0).value<QWebPage::PermissionPolicy>();
+       
+        setUserPermission(frame, permissionDomain, permission);
+    }
+    else
+    {
+        // If the domain is empty string, provide whole base url
+        if (domain == "")
+            domain = baseUrl.toString();
+	          
+        emit requestGeolocationPermission(frame, permissionDomain, domain);
+    }
+}
+
+void WrtBrowserContainer::setGeolocationPermission(QWebFrame* frame, QWebPage::PermissionDomain permissionDomain, 
+	       bool permissionGranted, bool saveSetting)
+{
+    QWebPage::PermissionPolicy permission = QWebPage::PermissionUnknown;
+    	
+    if (permissionGranted == true)
+        permission = QWebPage::PermissionGranted;
+    else
+        permission = QWebPage::PermissionDenied;
+	  	  	
+    setUserPermission(frame, permissionDomain, permission);
+    
+    // save the geolocation permission setting (granted/denied) in the data base
+    if (saveSetting)
+    {
+        QUrl baseUrl = frame->baseUrl();
+        QString domain = baseUrl.host();
+	      
+        // If the domain is empty string, provide whole base url
+        if (domain == "")
+            domain = baseUrl.toString();
+	          
+        d->m_geolocationManager->addGeodomain(domain, permission);
+    }
+}
+#endif // QT_GEOLOCATION 
+
 void WrtBrowserContainer::setPageFactory(BrowserPageFactory* f)
 {
     d->m_pageFactory = f;
@@ -358,13 +504,23 @@
     return result;
 }
 
-ZoomMetaData WrtBrowserContainer::pageZoomMetaData() {
-    return d->m_zoomData ;
+WebPageData* WrtBrowserContainer::pageZoomMetaData()
+{
+    QVariant userData = history()->currentItem().userData();
+    QVariant::Type t = userData.type();
+    int ut = userData.userType();
 
+    if(userData.isValid() && t == QVariant::UserType &&
+       ut == QMetaTypeId<WebPageData>::qt_metatype_id())
+       return (WebPageData*)(history()->currentItem().userData().constData());
+    else {
+        static WebPageData dummyData;
+        return &dummyData;
+    }
 }
-void WrtBrowserContainer::setPageZoomMetaData( ZoomMetaData  zoomData ){
 
-    d->m_zoomData = zoomData;
+void WrtBrowserContainer::setPageZoomMetaData(const WebPageData &zoomData ){
+    history()->currentItem().setUserData(qVariantFromValue(zoomData));
 }
 
 
@@ -420,6 +576,11 @@
     return wrtPage;
 }
 
+void WrtBrowserContainer::requestPageDataUpdate()
+{
+    QWebHistoryItem i = history()->currentItem();
+    emit saveFrameStateRequested(mainFrame(),&i);
+}
 
 } // namespace WRT
 
--- a/browsercore/core/wrtbrowsercontainer.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/wrtbrowsercontainer.h	Fri Oct 15 17:30:59 2010 -0400
@@ -27,14 +27,13 @@
 #include <QWebPage>
 #include "wrtbrowsercontainer_p.h"
 #include "wrtBrowserDefs.h"
-#include "ZoomMetaData.h"
 
 
 #include <QWidget>
 #include <QNetworkProxy>
 
 struct BrowserPageFactory;
-struct ZoomMetaData;
+class WebPageData;
 class QWebFrame;
 class QWebHistoryItem;
 class QNetworkReply;
@@ -71,7 +70,8 @@
     void setWebWidget(QGraphicsWidget* view);
     SchemeHandler* schemeHandler() const;
 
-    QImage pageThumbnail(qreal scaleX, qreal scaley);
+    QImage thumbnail(QSize s);
+    QImage pageThumbnail(qreal scaleX, qreal scaleY);
 
     void setPageFactory(BrowserPageFactory* f);
 
@@ -80,8 +80,9 @@
     int secureState();
     WRT::LoadController * loadController( ) {return d->m_loadController;}
 
-    ZoomMetaData pageZoomMetaData() ;
-    void setPageZoomMetaData( ZoomMetaData zoomData );
+    WebPageData* pageZoomMetaData() ;
+    void setPageZoomMetaData(const WebPageData &zoomData);
+    void requestPageDataUpdate();
     
     /* Indicates whether this is a blank window with no page loaded*/
     bool emptyWindow();
@@ -104,11 +105,21 @@
 
     void secureStateChange(int);
 
+#ifdef QT_GEOLOCATION
+    void requestGeolocationPermission(QWebFrame* frame, QWebPage::PermissionDomain permissionDomain, QString domain);
+#endif // QT_GEOLOCATION
+
 public slots:
     void savePageDataToHistoryItem(QWebFrame*, QWebHistoryItem* item);
     void slotAuthenticationRequired(QNetworkReply *, QAuthenticator *);
     void slotProxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *);
-    
+
+#ifdef QT_GEOLOCATION
+    void handleRequestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain);
+    void setGeolocationPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, 
+    	       bool permissionGranted, bool saveSetting);
+#endif // QT_GEOLOCATION
+   
 private slots:
     void pageSecureState(int);
 
--- a/browsercore/core/wrtbrowsercontainer_p.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/browsercore/core/wrtbrowsercontainer_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -21,12 +21,15 @@
 
 #ifndef __WRTBROWSERCONTAINER_P_H__
 #define __WRTBROWSERCONTAINER_P_H__
-#include "ZoomMetaData.h"
+
+#include "webpagedata.h"
 
 class QGraphicsWidget;
 class QObject;
 struct BrowserPageFactory;
-struct ZoomMetaData;
+#ifdef QT_GEOLOCATION
+class GeolocationManager;
+#endif // QT_GEOLOCATION
 
 namespace WRT {
     class SchemeHandler;
@@ -47,9 +50,11 @@
         QGraphicsWidget* m_widget;
         WRT::SecureUIController *m_secureController; //Owned
         WRT::LoadController * m_loadController; //Owned
-        ZoomMetaData m_zoomData;
         WrtBrowserFileChooser * m_fileChooser; // Owned
         bool m_needUpdateThumbnail;
+#ifdef QT_GEOLOCATION
+        GeolocationManager *m_geolocationManager;
+#endif // QT_GEOLOCATION
     };
 }
 #endif
--- a/browserui.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/browserui.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -28,6 +28,11 @@
 
     _BROWSERUI_PRI_INCLUDED_=1
 
+    # ;;; Temporary
+    maemo {
+        DEFINES += Q_WS_MAEMO_5
+    }
+    
     symbian {
         CONFIG += debug_and_release
         MMP_RULES += EXPORTUNFROZEN
@@ -78,7 +83,11 @@
     br_orbit_ui=no
     br_openurl=no
     br_qthighway=no
-    br_tiled_backing_store=no
+    br_tiled_backing_store=yes
+    br_geolocation=no
+    # Use browser localization file.
+    br_platform_localization=no
+
     br_layout=default
     
     # For now Symbian only, Windows, Maemo will use the defaults    
@@ -90,8 +99,8 @@
        }
        contains (browser_addon, ninetwo) {
           br_fast_allocator=yes
-          br_mobility_sysinfo=yes
-          br_mobility_bearer=yes
+          br_mobility_sysinfo=no
+          br_mobility_bearer=no
        }
        isEmpty (browser_addon){
           browser_addon=no
@@ -101,8 +110,14 @@
           br_orbit_ui=yes
           br_openurl=yes
           br_qthighway=yes
+          br_geolocation=no
           br_layout=tenone
+          # Use platform localization file.
+          br_platform_localization=yes
        }
     }
+    maemo {
+    	 br_layout=maemolayout
+    }
 }
 
--- a/browserui.pro	Thu Sep 23 15:32:11 2010 -0400
+++ b/browserui.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -2,9 +2,17 @@
 CONFIG += ordered
 
 include (browserui.pri)
-    SUBDIRS += bedrockProvisioning
-    SUBDIRS += browsercore
-    SUBDIRS += ginebra2
+symbian : {
+    contains(browser_addon, ninetwo) {
+SUBDIRS += utilities
+    }
+}
+SUBDIRS += internal/tests/perfTracing
+SUBDIRS += qstmgesturelib
+SUBDIRS += bedrockProvisioning
+SUBDIRS += browsercore
+SUBDIRS += ginebra2
+
 symbian : {
     contains(browser_addon, no) {
         SUBDIRS += homescreen
@@ -25,6 +33,7 @@
 contains(browser_addon, no ) {
     BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
                                  "rom/browser.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(browser.iby)" \
-                                 "rom/browserresources.iby    LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(browserresources.iby)"
+                                 "rom/browserresources.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(browserresources.iby)" \
+                                 "rom/NokiaBrowser_stub.sis  z:/system/install/NokiaBrowser_stub.sis
     }  
 }
--- a/flags.pri	Thu Sep 23 15:32:11 2010 -0400
+++ b/flags.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -4,13 +4,10 @@
 # Build without page resizing on load 
 #DEFINES+=NO_RESIZE_ON_LOAD
 
-# Build without gestures
-DEFINES += NO_QSTM_GESTURE
-
 # Build without chrome
 #DEFINES += __gva_no_chrome__
 
 # Enable perfTracer
-#DEFINES += ENABLE_PERF_TRACE
+DEFINES += ENABLE_PERF_TRACE
 
 #DEFINES += NO_HISTORY
--- a/ginebra2/ActionButton.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ActionButton.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -20,11 +20,12 @@
 */
 
 #include "ActionButton.h"
+#include "qstmgestureevent.h"
 #include <QDebug>
 
 namespace GVA {
 
-  ActionButton::ActionButton(ChromeSnippet * snippet, QGraphicsItem* parent)
+  ActionButton::ActionButton(ChromeSnippet * snippet, const QString &objectName, QGraphicsItem* parent)
     : NativeChromeItem(snippet, parent),
       m_internalAction(NULL),
       m_triggerOnUp(true),
@@ -32,8 +33,7 @@
       m_active(false),
       m_activeOnPress(true)
   {
-
-
+	setObjectName(objectName);
   }
 
   void ActionButton::paint( QPainter * painter, const QStyleOptionGraphicsItem * opt, QWidget * widget )
@@ -53,9 +53,17 @@
             mode = QIcon::Disabled;
         }
     }
+    
+    #ifndef  Q_WS_MAEMO_5
     m_icon.paint(painter, boundingRect().toRect(), Qt::AlignCenter, mode, QIcon::On);
+    #else
+    m_icon.paint(painter, boundingRect().toRect(), Qt::AlignLeft, mode, QIcon::On);
+    #endif
+    
     painter->restore();
+#ifndef BROWSER_LAYOUT_TENONE
     NativeChromeItem::paint(painter, opt, widget);
+#endif
   }
 
   void ActionButton::mousePressEvent( QGraphicsSceneMouseEvent * ev )
@@ -133,6 +141,11 @@
     m_internalAction->setEnabled(enabled);
   }
 
+  void ActionButton::setTriggerOnUp(bool triggeronup)
+  {
+     m_triggerOnUp = triggeronup;
+  }
+  
   void ActionButton::setActiveOnPress(bool active)
   {
     m_activeOnPress = active;
@@ -184,5 +197,43 @@
     }
   }
 
+  
+  bool ActionButton::handleGesture(QEvent* event)
+    {
+      /*
+        if (event->type() == QEvent::Gesture) {
+            QStm_Gesture* gesture = getQStmGesture(event);
+            if (gesture) {
+                QStm_GestureType type = gesture->getGestureStmType();
+                QEvent::Type mouseEventType = gesture->gestureType2GraphicsSceneMouseType();
+                
+                if (mouseEventType == QEvent::GraphicsSceneMousePress || 
+                    mouseEventType == QEvent::GraphicsSceneMouseRelease) {
+                    QGraphicsSceneMouseEvent gsme(mouseEventType);
+                    QPoint gpos = gesture->position();
+                    qstmSetGraphicsSceneMouseEvent(gpos, this, gsme);
+                    if (mouseEventType == QEvent::GraphicsSceneMousePress) {
+                        mousePressEvent(&gsme);    
+                    }
+                    else if (mouseEventType == QEvent::GraphicsSceneMouseRelease) {
+                        mouseReleaseEvent(&gsme);
+                    }
+                }
+            }
+        }
+      */  
+      return false;
+    }
 
+  
+  bool ActionButton::eventFilter(QObject* receiver, QEvent* event)
+  {
+      /*
+      if (receiver == this) {
+          return QStm_GestureEventFilter::instance()->eventFilter(receiver, event);
+      }
+      */
+      return false;
+  }
+  
 }//end of name space
--- a/ginebra2/ActionButton.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ActionButton.h	Fri Oct 15 17:30:59 2010 -0400
@@ -34,7 +34,13 @@
         Q_OBJECT
 
     public:
-        ActionButton( ChromeSnippet * snippet, QGraphicsItem * parent = 0 );
+        /*!
+         * Contructs an ActionButton based on the given snippet.  
+         * \param snippet the chrome snippet that defines this ActionButton.
+         * \param objectName the object name of the button.  REQUIRED to enable automated testing.
+         * \param parent the QGraphicsItem parent.
+         */
+        ActionButton( ChromeSnippet * snippet, const QString &objectName, QGraphicsItem * parent = 0 );
         virtual ~ActionButton() {};
         void paint( QPainter * painter, const QStyleOptionGraphicsItem * opt, QWidget * widget );
         void addIcon( const QString & icon, QIcon::Mode mode = QIcon::Normal );
@@ -43,9 +49,12 @@
         void setEnabled(bool);
         void setActive(bool);
         void setActiveOnPress(bool);
+        void setTriggerOnUp(bool);
         QAction * defaultAction();
         bool isChecked() {return m_internalAction->isChecked();}
-
+        bool handleGesture(QEvent* event);
+        bool eventFilter(QObject* receiver, QEvent* event);
+        
     public Q_SLOTS:
         void onActionChanged();
         void onHidden();
--- a/ginebra2/ActionButtonSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ActionButtonSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -33,7 +33,7 @@
   ActionButtonSnippet * ActionButtonSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element)
   {
       ActionButtonSnippet* that = new ActionButtonSnippet(elementId, chrome, 0, element);
-      that->setChromeWidget( new ActionButton( that ) );
+      that->setChromeWidget( new ActionButton( that, elementId ) );
       return that;
   }
 
@@ -98,6 +98,11 @@
     static_cast<ActionButton*>(m_widget)->setActive(enabled);
   }
 
+  void ActionButtonSnippet::setTriggerOnUp( bool triggeronup )
+  {
+    static_cast<ActionButton*>(m_widget)->setTriggerOnUp(triggeronup);
+  }
+
   void ActionButtonSnippet::setActiveOnPress( bool active )
   {
     static_cast<ActionButton*>(m_widget)->setActiveOnPress(active);
--- a/ginebra2/ActionButtonSnippet.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ActionButtonSnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -34,6 +34,13 @@
   {
     Q_OBJECT
     public:
+      /*!
+       * Contructs an ActionButtonSnippet.
+       * \param elementId the chrome HTML element's id.  Also used as the object name of the enclosed ActionButton.
+       * \param chrome the ChromeWidget that the ActionButtonSnippet will be a part of.
+       * \param widget the enclosing graphics widget.
+       * \param element the HTML element in the chrome that defines this snippet.
+       */
        ActionButtonSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
        virtual ~ActionButtonSnippet() {;}
        static ActionButtonSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element);
@@ -43,6 +50,7 @@
        bool isChecked();
        void setActive( bool active );
        void setActiveOnPress( bool );
+       void setTriggerOnUp( bool);
 
     public slots:
        void setIcon( const QString & icon );
--- a/ginebra2/Application.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/Application.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -20,6 +20,7 @@
 */
 
 #include <QtGui>
+#include <QAction>
 #include "Application.h"
 
 #ifdef Q_OS_SYMBIAN
@@ -66,6 +67,25 @@
       qDebug() << msg;
 }
 
+QObject *GinebraApplication::createAction(const QString &text, const QString &iconPath, bool checkable) {
+    // Note: the object created here won't be garbage collected by the script engines but will be deleted
+    // at shutdown because it is a child of the GinebraApplication object.  Unused actions should be
+    // deleted by hand from javascript using the delete operator.
+    QAction *action = new QAction(this);
+    action->setText(text);
+    
+    #ifdef Q_WS_MAEMO_5
+    action->setCheckable(checkable);
+
+    if(!iconPath.isEmpty()) {
+        action->setIcon(QIcon(iconPath));
+        action->setIconVisibleInMenu(true);
+    }
+    #endif
+    
+    return action;
+}
+
 QString GinebraApplication::layoutType() {
 
     QString layout;
@@ -78,5 +98,19 @@
     return layout;
 }
 
+void GinebraApplication::addMenuBarAction(QObject *action) {
+    QAction *a = dynamic_cast<QAction *>(action);
+    if(a) {
+        emit addMenuBarActionRequest(a);
+    }
+    else {
+        qDebug() << "GinebraApplication::addMenuBarAction: invalid argument";
+    }
+}
+
+void GinebraApplication::setMenuBarEnabled(bool value) {
+    emit setMenuBarEnabledRequest(value);
+}
+
 
 }
--- a/ginebra2/Application.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/Application.h	Fri Oct 15 17:30:59 2010 -0400
@@ -22,9 +22,12 @@
 #define __GINEBRA_APPLICATION_H__
 
 #include <QObject>
+#include <QAction>
 
 #ifdef ORBIT_UI
 #define UI_FRAMEWORK "orbit_ui"
+#elif defined(Q_WS_MAEMO_5)
+#define UI_FRAMEWORK "maemo5_ui"
 #else
 #define UI_FRAMEWORK ""
 #endif // ORBIT_UI
@@ -35,6 +38,12 @@
 #define MOBILITY_SERVICE_FRAMEWORK "junk"
 #endif // QT_MOBILITY_SERVICE_FRAMEWORK
 
+#ifdef QT_GEOLOCATION
+#define GEOLOCATION true
+#else
+#define GEOLOCATION false
+#endif
+
 class QCoreApplication;
 
 namespace GVA {
@@ -59,7 +68,14 @@
     QString ui() const { return UI_FRAMEWORK; }
     QString layoutType() ;
     QString serviceFramework() const { return MOBILITY_SERVICE_FRAMEWORK; }
+    bool geolocation() const { return GEOLOCATION; }
     void sendToBackground();
+    
+    /// Create a QAction object
+    QObject *createAction(const QString &text = QString::null, const QString &iconPath = QString::null, bool checkable = false);
+    void addMenuBarAction(QObject *action);
+    void setMenuBarEnabled(bool value);
+    
     /*
      * You can use this to breakpoint inside your javascript.  Here's how:
      * 1) put a breakpoint on this function
@@ -70,6 +86,13 @@
     void breakpoint() {}
   signals:
     void aboutToQuit();
+    
+    /// Sent when an action needs to be added to the platform menu bar.
+    void addMenuBarActionRequest(QAction *action);
+    
+    /// Sent when the platform menu bar's menu should be disabled.
+    void setMenuBarEnabledRequest(bool value);
+    
   private:
     QCoreApplication * m_app;
 };
--- a/ginebra2/BookmarksToolbarSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/BookmarksToolbarSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -59,22 +59,23 @@
     }
     
     void BookmarksToolbarSnippet::addChild(ChromeSnippet * child) {
+ 
         WebChromeContainerSnippet * s =  dynamic_cast<WebChromeContainerSnippet* >(child);
         if (!s) {
             ToolbarActions_t* t = new ToolbarActions_t();
             if (child->elementId() == "BookmarksBackButton" ) {
                 t->actionId = BOOKMARKS_VIEW_ACTION_BACK;
                 t->actionName = BOOKMARKS_TOOLBAR_BACK;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png";
-                t->disabledImg = "";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png";
+                t->normalImg = ":/toolbar/icon_back_bg.png";
+                t->disabledImg = ":/toolbar/icon_back_bg_disabled.png";
+                t->activeImg = ":/toolbar/icon_back_bg_pressed.png";
             }
             else if (child->elementId() == "BookmarksAddButton" ) {
                 t->actionId = BOOKMARKS_VIEW_ACTION_ADD;
                 t->actionName = BOOKMARKS_TOOLBAR_ADD;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png";
-                t->disabledImg = "";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png";
+                t->normalImg = ":/toolbar/icon_add.png";
+                t->disabledImg = ":/toolbar/icon_add_disabled.png";
+                t->activeImg = ":/toolbar/icon_add_pressed.png";
             }
             t->id = child->elementId();
             m_actionInfo.append(t);
--- a/ginebra2/Charms/ExternalEventCharm.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/Charms/ExternalEventCharm.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -19,6 +19,7 @@
 */
 
 #include "ExternalEventCharm.h"
+#include "qstmgestureevent.h"
 
 namespace GVA {
 
@@ -38,16 +39,19 @@
 
 bool ExternalEventCharm::eventFilter(QObject *object, QEvent *event) {
     checkForExternalEvent(this, event);
+    checkForExternalGesture(event);
 
     switch (event->type()) {
       case QEvent::Show:
       {
-          scene()->installEventFilter(this);
+          if(scene())
+          	scene()->installEventFilter(this);
           break;
       }
       case QEvent::Hide:
       {
-          scene()->removeEventFilter(this);
+          if(scene())
+          	scene()->removeEventFilter(this);
           break;
       }
       default: break;
@@ -102,6 +106,52 @@
     }
 }
 
+
+bool ExternalEventCharm::checkForExternalGesture(QEvent* event)
+{
+    if (event->type() != QEvent::Gesture) return false;
+    bool emitClick = false;
+    bool isGestureStarted = false;
+    bool isGestureEnded = false;
+    QStm_Gesture* gesture = getQStmGesture(event);
+    if (gesture) {
+        QStm_GestureType gtype = gesture->getGestureStmType();
+        QPoint gpos = gesture->position();
+        isGestureStarted = (gtype == QStmTouchGestureType);
+        isGestureEnded = (gtype == QStmMaybeTapGestureType ||
+                               gesture->isGestureEnded());
+
+        if (isGestureStarted || isGestureEnded) {
+            QGraphicsObject *item = static_cast<QGraphicsObject*>(m_object);
+            QPointF pos = qstmMapToScene(gpos, item);
+            if (isGestureStarted) {
+                m_pressed = true;
+            }
+            else if (isGestureEnded) {
+                if (m_pressed) {
+                    emitClick = true;
+                    m_pressed = false;
+                }
+            }
+
+            if (!item->sceneBoundingRect().contains(pos)) {
+
+                QGraphicsSceneMouseEvent me(emitClick ? QEvent::GraphicsSceneMouseRelease :
+                                                        QEvent::GraphicsSceneMousePress);
+
+                qstmSetGraphicsSceneMouseEvent(pos, item, me);
+                if(emitClick) {
+                    emit externalMouseEvent(&me, s_mouseClick, "");
+                }
+                else {
+                    emitExternalEvent(&me);
+                }
+            }
+        }
+    }
+    return isGestureStarted || isGestureEnded;
+}
+
 void ExternalEventCharm::emitExternalEvent(QEvent * e)
 {
     QString description;
--- a/ginebra2/Charms/ExternalEventCharm.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/Charms/ExternalEventCharm.h	Fri Oct 15 17:30:59 2010 -0400
@@ -47,6 +47,7 @@
             const QString & description);
   private:
     void checkForExternalEvent(QObject * o, QEvent * e);
+    bool checkForExternalGesture(QEvent* event);
     void emitExternalEvent(QEvent * e);
     bool eventFilter(QObject *object, QEvent *event);
     QGraphicsScene *scene();
--- a/ginebra2/ChromeDOM.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeDOM.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -44,11 +44,15 @@
 #include "SettingsToolbarSnippet.h"
 #include "ActionButton.h"
 #include "ActionButtonSnippet.h"
-#include "mostvisitedpageview.h"
+//#ifndef Q_WS_MAEMO_5
 #include "mostvisitedsnippet.h"
+//#else 
+//#include "mostvisitedsnippetmaemo.h"
+//#endif
 #include "TitleUrlContainerSnippet.h"
 #include "UrlSearchSnippet.h"
 #include "EditorSnippet.h"
+#include "CopyCutPasteSnippet.h"
 
 #include <QDebug>
 
@@ -164,6 +168,9 @@
       else if (className == "TitleUrlContainerSnippet") {
           return TitleUrlContainerSnippet::instance(elementId, m_chrome, element);
       }
+      else if (className == "CopyCutPasteSnippet") {
+          return CopyCutPasteSnippet::instance(elementId, m_chrome, element);
+      }
       else {
           ChromeSnippet* result = new ChromeSnippet(elementId, m_chrome, 0, element);
           result->setChromeWidget(new QGraphicsWidget());
@@ -171,9 +178,7 @@
       }
   }
   
-  ChromeSnippet *ChromeDOM::getSnippet(const QString &docElementId, QGraphicsItem* parent) {
-    Q_UNUSED(parent)
-
+  ChromeSnippet *ChromeDOM::getSnippet(const QString &docElementId) {
     ChromeSnippet * snippet = 0;
     QWebElement doc = m_page->mainFrame()->documentElement();
     QWebElement element = doc.findFirst("#" + docElementId);
--- a/ginebra2/ChromeDOM.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeDOM.h	Fri Oct 15 17:30:59 2010 -0400
@@ -51,7 +51,7 @@
   QRect getElementRect(const QString &id);
   QString getElementAttribute(const QString &id, const QString &attribute);
   QList <QWebElement> getInitialElements();
-  ChromeSnippet * getSnippet(const QString &docElementId, QGraphicsItem* parent = 0);
+  ChromeSnippet * getSnippet(const QString &docElementId);
   //QString getCacheableScript();
   QList<CachedHandler> getCachedHandlers(const QString &elementId, const QRectF & ownerArea);
   int height() { return m_height; }
--- a/ginebra2/ChromeItem.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeItem.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -23,14 +23,20 @@
 #include "ChromeItem.h"
 #include "ChromeEffect.h"
 #include <QtGui>
+#include "qstmgestureevent.h"
+
 
 namespace GVA {
+using namespace qstmGesture;
 
-ChromeItem::ChromeItem(ChromeSnippet * snippet, QGraphicsItem* parent)
-: QGraphicsWidget(parent),
+  ChromeItem::ChromeItem(ChromeSnippet * snippet, QGraphicsItem* parent)
+    : QGraphicsWidget(parent),
   m_snippet(snippet)
-{
-}
+  {
+    grabGesture(QStm_Gesture::assignedType());
+    setObjectName("ChromeItem");
+    installEventFilter(this);
+  }
 
 ChromeItem::~ChromeItem() {
 
@@ -50,5 +56,32 @@
         painter->restore();
     }
 }
+  
+  
+bool ChromeItem::handleGesture(QEvent* event)
+{
+    //return QStm_GestureEventFilter::instance()->event(event);
+	return false;
+}
 
+bool ChromeItem::eventFilter(QObject* receiver, QEvent* event)
+{
+    //if (receiver == this) {
+    //    return QStm_GestureEventFilter::instance()->eventFilter(receiver, event);
+    //}
+    return false;
+}
+
+  bool ChromeItem::event(QEvent* event)
+  {
+      bool ret = false;
+      if (event->type() == QEvent::Gesture) {
+          ret = handleGesture(event);
+      }
+      if (!ret) {
+          ret = QGraphicsWidget::event(event);
+      }
+      return ret;
+  }
+  
 } // end of namespace GVA
--- a/ginebra2/ChromeItem.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeItem.h	Fri Oct 15 17:30:59 2010 -0400
@@ -37,7 +37,10 @@
     virtual ~ChromeItem();
     virtual ChromeSnippet * snippet() { return m_snippet;}
     virtual void  setSnippet(ChromeSnippet * s);
-
+    virtual bool handleGesture(QEvent* event);    
+    bool event(QEvent* event);
+    bool eventFilter(QObject* receiver, QEvent* event);
+    
   Q_SIGNALS:
     void mouseEvent(QEvent::Type type);
   protected:
--- a/ginebra2/ChromeLayout.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeLayout.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -146,6 +146,11 @@
     return m_viewPort->shrink(delta);
   }
   
+  qreal ChromeLayout::setViewSlide(qreal pos)
+  {
+      return m_viewPort->setSlide(pos);
+  }
+
   qreal ChromeLayout::slideView(qreal delta)
   {
     return m_viewPort->slide(delta);
@@ -304,5 +309,10 @@
     }
 
   }
+
+  QSize ChromeLayout::viewPortSize(bool withoutTop ){
+
+      return (m_viewPort->viewPortSize(withoutTop));
+  }
   
 } // endof namespace GVA
--- a/ginebra2/ChromeLayout.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeLayout.h	Fri Oct 15 17:30:59 2010 -0400
@@ -81,9 +81,12 @@
     QString getDisplayMode() const;
     Q_PROPERTY(QString displayMode READ getDisplayMode)
 
+    QSize viewPortSize(bool withoutTop=false);
+
   public slots:
     void snippetShown(ChromeSnippet * snippet);
     void snippetHiding(ChromeSnippet * snippet);
+    qreal setViewSlide(qreal pos);
     qreal slideView(qreal delta);
     qreal shrinkView(qreal delta);
     int width(){ return (int)size().width(); }
--- a/ginebra2/ChromeSnippet.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeSnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -92,7 +92,7 @@
     void setEffect(const QString & effect);
     void enableEffect(bool enable);
     void toggleEffect();
-    void grabFocus();
+    virtual void grabFocus();
     QObject *setVisibilityAnimator(const QString& animator);
     void visibilityFinished(bool visiblity);
     void moveBy(int dx, int dy);
@@ -112,6 +112,12 @@
     //NB: deprecate repaint: if this is needed, then there are bugs that are preventing updates
     void repaint() { m_widget->update(); }
     void onContextMenuEvent(QGraphicsSceneContextMenuEvent * ev);
+    virtual bool editable() { return false; }
+    virtual bool useNativeCopyPasteMenu() { return false; }
+    virtual void cut() {}
+    virtual void copy() {}
+    virtual void paste() {}
+    virtual void setContextMenuStatus(bool on) { Q_UNUSED(on); }
 
   signals:
     void hidden();
--- a/ginebra2/ChromeView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -30,9 +30,9 @@
 #include "ChromeView.h"
 #include "ChromeWidget.h" //TODO: get rid of this, refer directly to layout
 #include "ChromeLayout.h" 
-#ifndef NO_QSTM_GESTURE
+
 #include "qstmgestureevent.h"
-#endif
+
 
 #ifdef ENABLE_PERF_TRACE
 #include "wrtperftracer.h"
@@ -55,7 +55,7 @@
 
   // Initialize the ChromeWidget with the scene created in the ChromeView
   chrome->layout()->setScene(scene());
-
+  scene()->installEventFilter(this);
   //setGeometry(chrome->geometry().toRect());
   setObjectName("ChromeView");
   //When content view is external widget, make the background transparent
@@ -71,16 +71,16 @@
 #endif  
 	
   //NB: maybe not needed?
-  setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
+  setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
   //installEventFilter(this);
   //chrome->page()->setView(this);
-#ifndef NO_QSTM_GESTURE
+
   ungrabGesture(Qt::PanGesture);
   ungrabGesture(Qt::TapGesture);
   ungrabGesture(Qt::TapAndHoldGesture);
   ungrabGesture(Qt::PinchGesture);
   ungrabGesture(Qt::SwipeGesture);
-#endif
+
 
 #ifdef ORBIT_UI
   /* Hide the platform title bar */
@@ -94,8 +94,26 @@
 {
 }
 
+bool ChromeView::eventFilter(QObject* o, QEvent* event)
+{
+    bool ret = false;
+    if (o == scene() && event->type() == QEvent::GestureOverride) {
+        ret = true;
+    }
+    else {
+        ret = QGraphicsView::eventFilter(o, event);
+    }
+    return ret;
+}
+
+
 void ChromeView::resizeEvent(QResizeEvent * ev)
 {
+    if (scene()) {
+        QRectF rect(QPointF(0, 0), size());
+        scene()->setSceneRect(rect);
+    }
+
     //Resize the chrome to match the view and scene rectangle size
     if (m_topWidget) {
 
@@ -116,12 +134,6 @@
      QGraphicsView::resizeEvent(ev);
 #endif 
 	
-#ifdef BEDROCK_TILED_BACKING_STORE
-    if (scene()) {
-        QRectF rect(QPointF(0, 0), size());
-        scene()->setSceneRect(rect);
-    }
-#endif	
 }
 
 //Never scroll the chrome
@@ -150,24 +162,24 @@
 
     }*/
 
+
 bool ChromeView::event(QEvent* event)
 {
-#ifndef NO_QSTM_GESTURE
-      if (event->type() == QEvent::Gesture) {
-          QStm_Gesture* gesture = getQStmGesture(event);
-          if (gesture) {
-              QPoint pos = mapFromGlobal(gesture->position());
-              QGraphicsScene* gs = scene();
-              QGraphicsItem* gi = gs->itemAt(QPointF(pos));
-
-              if (gi) {
-                  gs->sendEvent(gi, event);
+    bool ret = false;
+    switch(event->type())
+    {
+        case QEvent::Gesture:
+        {
+            ret = qstmDeliverGestureEventToGraphicsItem(this, event);
+            break;
               }
-              return true;
+        default:
+        {
+            ret = QGraphicsView::event(event);
+            break;
           }
       }
-#endif
-    return QGraphicsView::event(event);
+    return ret;
 }
 
 
--- a/ginebra2/ChromeView.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -44,8 +44,7 @@
   bool event(QEvent* event);
   void scrollContentsBy(int dx, int dy);
   //protected:
-  //bool eventFilter(QObject * obj, QEvent * ev);
-
+  bool eventFilter(QObject* o, QEvent* event);
  private:
   QGraphicsWidget * m_topWidget;
   ChromeWidget * m_chrome; //TODO: get rid of this
--- a/ginebra2/ChromeWidget.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeWidget.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -47,6 +47,9 @@
 //#include "ViewStack.h"
 #include "HistoryManager.h"
 #include "bookmarkscontroller.h"
+#ifdef QT_GEOLOCATION
+#include "geolocationManager.h"
+#endif // QT_GEOLOCATION
 #include "ScriptObjects.h"
 #include "LocaleDelegate.h"
 #include "DeviceDelegate.h"
@@ -55,6 +58,7 @@
 #include "bedrockprovisioning.h"
 #include "Utilities.h"
 #include "PopupWebChromeItem.h"
+#include "UrlSearchSnippet.h"
 #ifdef QT_MOBILITY_SYSINFO
 #include "SystemDeviceImpl.h"
 #include "SystemNetworkImpl.h"
@@ -80,6 +84,7 @@
       m_renderer(0),
       m_dom(0),
       m_viewController(new ViewController()),
+      m_app(0),
       m_jsObject(new ChromeWidgetJSObject(0, this)),
       m_localeDelegate(new LocaleDelegate(this)),
       m_downloads(new Downloads())
@@ -106,14 +111,17 @@
     m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
 #endif
     m_viewController->setObjectName("views");
-
-    connect(m_viewController, SIGNAL(currentViewChanged()), this, SLOT(onCurrentViewChanged()));
+    connect(m_viewController, SIGNAL(currentViewChanged(ControllableViewBase *)), this, SLOT(onCurrentViewChanged(ControllableViewBase *))); 
+    
 #ifndef __gva_no_chrome__
 
     m_jsObject->setObjectName("chrome");
 
     // Pass some signals from this object to the Javascript object.
     QObject::connect(this, SIGNAL(chromeComplete()), m_jsObject, SIGNAL(chromeComplete()));
+    #ifdef Q_WS_MAEMO_5
+    QObject::connect(this, SIGNAL(chromeActivated()), m_jsObject, SIGNAL(chromeActivated()));
+    #endif
     QObject::connect(this, SIGNAL(aspectChanged(int)), m_jsObject, SIGNAL(aspectChanged(int)));
     QObject::connect(this, SIGNAL(prepareForGeometryChange()), m_jsObject, SIGNAL(prepareForGeometryChange()));
     QObject::connect(this, SIGNAL(symbianCarriageReturn()), m_jsObject, SIGNAL(symbianCarriageReturn()));
@@ -176,7 +184,6 @@
     delete m_localeDelegate;
     delete m_deviceDelegate;
     delete m_networkDelegate;
-    delete m_app;
     delete m_downloads;
   }
 
@@ -198,8 +205,14 @@
   {
     QString mode = (aspect == landscape ? "Landscape" : "Portrait");
     ControllableViewBase* cview = m_viewController->currentView();
-    if (cview)
-      cview->displayModeChanged(mode);
+
+    if (cview){
+        //The size is the viewport size without the title/url  bar widget height.
+        // This is currently used only by Windows View as it needs to use this size
+        // to position the thumbnails but need the viewport size to generate
+        // the new thumbnails
+        cview->displayModeChanged(mode, viewSize());
+    }
     emit aspectChanged(aspect);
   }
 
@@ -278,9 +291,9 @@
     m_viewController->showView(name);
   }
 
-  void ChromeWidget::onCurrentViewChanged() {
+	void ChromeWidget::onCurrentViewChanged(ControllableViewBase *newView) {
     m_layout->addView(m_viewController->currentView());
-  }
+  } 
 
   // Clean up all existing snippets;
 
@@ -335,6 +348,9 @@
     addJSObjectToPage(WebPageController::getSingleton(), page);
     addJSObjectToPage(BookmarksController::getSingleton(), page);
     addJSObjectToPage(WRT::HistoryManager::getSingleton(), page);
+#ifdef QT_GEOLOCATION
+    addJSObjectToPage(GeolocationManager::getSingleton(), page);
+#endif // QT_GEOLOCATION
     addJSObjectToPage(ViewStack::getSingleton(), page);
     addJSObjectToPage(m_localeDelegate, page);
     addJSObjectToPage(m_deviceDelegate, page);
@@ -380,10 +396,10 @@
     m_layout->adjustAnchorOffset(snippet, delta);
   }
 
-  ChromeSnippet *ChromeWidget::getSnippet(const QString & docElementId, QGraphicsItem * parent) {
+  ChromeSnippet *ChromeWidget::getSnippet(const QString & docElementId) {
     ChromeSnippet *result = m_snippets->getSnippet(docElementId);
     if (!result){
-      result = m_dom->getSnippet(docElementId, parent);
+      result = m_dom->getSnippet(docElementId);
       if (result) {
         result->setParent(m_snippets); // Exports to "Snippets" JS object
         addSnippet(result, docElementId);
@@ -411,7 +427,8 @@
 
   void ChromeWidget::addJSObjectToPage(QObject *object, QWebPage *page)
   {
-    page->mainFrame()->addToJavaScriptWindowObject(object->objectName(), object);
+    if (object && page)
+      page->mainFrame()->addToJavaScriptWindowObject(object->objectName(), object);
   }
 
   QObjectList ChromeWidget::getSnippets() {
@@ -458,6 +475,20 @@
       emit popupHidden(popupId);
   }
 
+// Activate is called by the WindowsView when a new window is created.
+#ifdef Q_WS_MAEMO_5
+  void ChromeWidget::activate() {
+      emit chromeActivated();
+  }
+#endif  
+
+  void ChromeWidget::windowStateChange(Qt::WindowStates state) {
+      emit windowStateChanged(state);
+  }
+
+  QSize ChromeWidget::viewSize() {
+      return m_layout->viewPortSize(true);
+  }
 
   void ChromeWidget::dump() {
     qDebug() << "---------------------";
--- a/ginebra2/ChromeWidget.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeWidget.h	Fri Oct 15 17:30:59 2010 -0400
@@ -34,6 +34,7 @@
 
 class MostVisitedPageStore;
 class ControllableViewBase;
+class GinebraBrowser;
 
 using namespace WRT;
 
@@ -76,7 +77,7 @@
     ChromeRenderer * renderer() { return m_renderer; }
     ChromeDOM * dom() { return m_dom; }
     QRect getSnippetRect(const QString &docElementId);
-    ChromeSnippet * getSnippet(const QString & docElementId, QGraphicsItem * parent = 0);
+    ChromeSnippet * getSnippet(const QString & docElementId);
     //  QScriptValue evalWithEngineContext(const QString& program);
     ControllableViewBase * getView(const QString& name);
     void showView(const QString &name);
@@ -93,6 +94,21 @@
     void sizeChange(QSize sz){ emit prepareForSizeChange(sz) ;}
     void emitPopupShown(const QString &popupId);
     void emitPopupHidden(const QString &popupId);
+    void setApp(QObject *app) { m_app = app; }
+    #ifdef Q_WS_MAEMO_5
+    void activate();
+    #endif
+
+    void emitRequestShowFullScreen() { emit requestShowFullScreen(); }
+    void emitRequestShowNormal() { emit requestShowNormal(); }
+    void emitRequestToggleNormalFullsreen() { emit requestToggleNormalFullScreen(); }
+
+    /// windowStateChange() should be called by the owner of the ChromeWidget when the state of the
+    /// top-level window changes.
+    void windowStateChange(Qt::WindowStates state);
+
+    // Returns the viewport size without the top widget (title-url bar)
+    QSize viewSize(); 
 
   public slots:
     void loadStarted();
@@ -101,7 +117,7 @@
     void exportJSObjectsToPage(QWebPage *page);
     void alert(const QString & msg);
     void onViewInstantiated(ControllableViewBase *view);
-    void onCurrentViewChanged();
+    void onCurrentViewChanged(ControllableViewBase *newView);    
     void chromeInitialized();
     void reloadChrome();
     void loadUrlToCurrentPage(const QUrl & url);
@@ -120,6 +136,21 @@
     void popupShown(const QString &id);
     void popupHidden(const QString &id);
     void goToBackground();
+    #ifdef Q_WS_MAEMO_5
+    void chromeActivated();
+    #endif
+
+    /// Sent when the current window should be shown fullscreen.
+    void requestShowFullScreen();
+
+    /// Sent when the current window should be shown in normal mode.
+    void requestShowNormal();
+
+    /// Sent when the current window should be toggled between normal and fullscreen modes.
+    void requestToggleNormalFullScreen();
+
+    /// Sent when the top-level window has changed states.
+    void windowStateChanged(Qt::WindowStates state);
 
   public:
     Q_PROPERTY(QObjectList snippets READ getSnippets)
@@ -146,7 +177,7 @@
     ViewController *m_viewController;
     //QList<QObject*> m_jsObjects;
     //QScriptEngine m_engine;
-    GinebraApplication *m_app;
+    QObject *m_app;  // Application object, exposed to javascript.  Not owned. 
     ChromeWidgetJSObject *m_jsObject;
     LocaleDelegate *m_localeDelegate; // Owned
     DeviceDelegate *m_deviceDelegate;
--- a/ginebra2/ChromeWidgetJSObject.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ChromeWidgetJSObject.h	Fri Oct 15 17:30:59 2010 -0400
@@ -81,6 +81,9 @@
   void symbianCarriageReturn();
   void popupShown(const QString &id);
   void popupHidden(const QString &id);
+  #ifdef Q_WS_MAEMO_5
+  void chromeActivated();
+  #endif
 
 public:
   /// Returns a list of all existing snippets.
--- a/ginebra2/ContentToolbarChromeItem.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentToolbarChromeItem.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -30,7 +30,11 @@
 #include "webpagecontroller.h"
 #include "ViewController.h"
 #include "ChromeEffect.h"
+#include "qstmgestureevent.h"
 
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+#include "ScaleNinePainter.h"
+#endif
 
 #include <QTimeLine>
 #include <QDebug>
@@ -41,8 +45,8 @@
 
 namespace GVA {
 
-  ToolbarFadeAnimator::ToolbarFadeAnimator(): m_timeLine(NULL)
-  {
+  ToolbarFadeAnimator::ToolbarFadeAnimator(): m_timeLine(NULL) {
+
   }
 
 
@@ -81,12 +85,19 @@
   }
 
   void ToolbarFadeAnimator::valueChange(qreal step) {
+
     emit  updateVisibility(step);
   }
 
   ContentToolbarChromeItem::ContentToolbarChromeItem(ChromeSnippet* snippet, QGraphicsItem* parent)
       : ToolbarChromeItem(snippet, parent),
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+      m_backgroundPainter(0),
+      m_backgroundPixmap(0),
+      m_backgroundDirty(true),
+#else
       m_background(NULL),
+#endif
       m_state(CONTENT_TOOLBAR_STATE_FULL),
       m_autoHideToolbar(true),
       m_timerState(CONTENT_TOOLBAR_TIMER_STATE_ALLOW)
@@ -105,29 +116,62 @@
     }
     
     setFlags(QGraphicsItem::ItemDoesntPropagateOpacityToChildren);
+    
+    #ifdef  Q_WS_MAEMO_5	
+     m_backgroundPainter = new ScaleNinePainter(
+             ":/toolbar/toolBar_bkg_topLeft.png",
+            ":/toolbar/toolBar_bkg_topMiddle.png",
+            ":/toolbar/toolBar_bkg_topRight.png",
+            "",
+            ":/toolbar/toolBar_bkg_middleMiddle.png",
+            "",
+            ":/toolbar/toolBar_bkg_bottomLeft.png",
+            ":/toolbar/toolBar_bkg_bottomMiddle.png",
+            ":/toolbar/toolBar_bkg_bottomRight.png"
+            );
+    #endif
 
+#ifdef BROWSER_LAYOUT_TENONE
+    m_backgroundPainter = new ScaleNinePainter(
+            ":/toolbar/toolBar_bkg_topLeft.png",
+            ":/toolbar/toolBar_bkg_topMiddle.png",
+            ":/toolbar/toolBar_bkg_topRight.png",
+            "",
+            "",
+            "",
+            ":/toolbar/toolBar_bkg_bottomLeft.png",
+            ":/toolbar/toolBar_bkg_bottomMiddle.png",
+            ":/toolbar/toolBar_bkg_bottomRight.png"
+            );
+#endif
   }
 
-  ContentToolbarChromeItem::~ContentToolbarChromeItem()
-  {
+  ContentToolbarChromeItem::~ContentToolbarChromeItem() {
+
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+    delete m_backgroundPainter;
+    delete m_backgroundPixmap;
+#else
     if (m_background )
         delete m_background;
+#endif
     delete m_inactivityTimer;
 
     delete m_animator;
 
   }
 
-  void ContentToolbarChromeItem::resizeEvent(QGraphicsSceneResizeEvent * ev)
-  {
+  void ContentToolbarChromeItem::resizeEvent(QGraphicsSceneResizeEvent * ev) {
+
     //qDebug() << __PRETTY_FUNCTION__ << boundingRect();
     ToolbarChromeItem::resizeEvent(ev);
     addFullBackground();
-
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+    m_backgroundDirty = true;
+#endif
   }
 
-  void ContentToolbarChromeItem::mousePressEvent(QGraphicsSceneMouseEvent * ev)
-  {
+  void ContentToolbarChromeItem::mousePressEvent(QGraphicsSceneMouseEvent * ev)  {
       // If we are not in full state, ignore the event. Once igonre, none of the
       // other mouse events are received until the next mouse press
       if (m_state == CONTENT_TOOLBAR_STATE_PARTIAL ) {
@@ -142,15 +186,15 @@
       }
   }
 
-  void ContentToolbarChromeItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * ev)
-  {
+  void ContentToolbarChromeItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * ev) {
+
       Q_UNUSED(ev);
       // Do nothing - prevent the event from trickling down
       
   }
 
-  void ContentToolbarChromeItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget)
-  {
+  void ContentToolbarChromeItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget) {
+
     Q_UNUSED(opt)
     Q_UNUSED(widget)
 
@@ -167,12 +211,22 @@
           ToolbarChromeItem::paint(painter, opt, widget);
           break;
         case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL:
+          // intentional fall through  
         case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
           ToolbarChromeItem::paint(painter, opt, widget);
+          // intentional fall through
         case CONTENT_TOOLBAR_STATE_FULL:
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+          if(m_backgroundDirty) {
+              updateBackgroundPixmap(geometry().size().toSize(), widget);
+              m_backgroundPainter->unloadPixmaps();
+          }
+          painter->drawPixmap(opt->exposedRect, *m_backgroundPixmap, opt->exposedRect);
+#else
           // fill path with color
           painter->fillPath(*m_background,QBrush(grad()));
           painter->drawPath(*m_background);
+#endif
           if(m_state == CONTENT_TOOLBAR_STATE_FULL && !isEnabled()) {
               // Disabled, apply whitewash.
               ChromeEffect::paintDisabledRect(painter, opt->exposedRect);
@@ -200,15 +254,15 @@
 
   void ContentToolbarChromeItem::onChromeComplete() {
 
-    GWebContentView* webView  = static_cast<GWebContentView*> (m_snippet->chrome()->getView("WebView"));
+    m_webView  = static_cast<GWebContentView*> (m_snippet->chrome()->getView("WebView"));
     //qDebug() << __PRETTY_FUNCTION__ << webView;
-    if (webView ) {
-        connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
-        connect(webView, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
+    if (m_webView ) {
+        connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
+        connect(m_webView, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
 #ifdef BEDROCK_TILED_BACKING_STORE
-        connect(webView, SIGNAL(contextEvent(::WebViewEventContext *)), this, SLOT(resetTimer()));
+        connect(m_webView, SIGNAL(contextEvent(::WebViewEventContext *)), this, SLOT(resetTimer()));
 #else
-        connect(webView->widget(), SIGNAL(contextEvent(::WebViewEventContext *)), this, SLOT(resetTimer()));
+        connect(m_webView->widget(), SIGNAL(contextEvent(::WebViewEventContext *)), this, SLOT(resetTimer()));
 #endif
     }
 
@@ -224,6 +278,14 @@
   void ContentToolbarChromeItem::onLoadFinished(bool ok) {
 
     Q_UNUSED(ok);
+
+      if(!ok) {
+          // Don't hide the toolbar etc. on load error since the user is likely to start
+          // typing in the UrlSearch bar, we don't want to trigger the flashing and re-layout
+          // that happens when switching screen modes.
+          return;
+      }
+
     //qDebug() << __PRETTY_FUNCTION__ << m_state << "Timer Allowed" << m_timerState;
 
     if (m_autoHideToolbar  && m_timerState == CONTENT_TOOLBAR_TIMER_STATE_ALLOW) {
@@ -261,7 +323,11 @@
     //We are here because inactivity timer timed out. So we have to be in full toolbar state with no
     // popups. So change fade to Partial state after stopping inactivity timer
     m_inactivityTimer->stop();
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+    emit inactivityTimer();
+#else
     changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true);
+#endif
   }
 
   void ContentToolbarChromeItem::onSnippetMouseEvent( QEvent::Type type) {
@@ -293,13 +359,7 @@
             // animation completes
             break;
           case CONTENT_TOOLBAR_STATE_FULL:
-            // if MV is active then wait for it to hide before changing the toolbar state
-            if (mvSnippetVisible()) {
-                changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, false);
-            }
-            else {
-                changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true);
-            }
+            changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true);
             break;
           default:
             break;
@@ -359,18 +419,30 @@
   }
   void ContentToolbarChromeItem::addFullBackground() {
 
-    //qDebug() << __PRETTY_FUNCTION__ ;
     qreal roundness((boundingRect().height() -TOOLBAR_MARGIN)/2);
     QRectF r(1, 1, boundingRect().width()-TOOLBAR_MARGIN, boundingRect().height()-TOOLBAR_MARGIN);
 
+#if !defined(BROWSER_LAYOUT_TENONE) && !defined(Q_WS_MAEMO_5)
     if (m_background ) {
         delete m_background;
         m_background = NULL;
     }
     m_background = new QPainterPath();
     m_background->addRoundedRect(r, roundness, roundness);
+#endif
   }
 
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+	  void ContentToolbarChromeItem::updateBackgroundPixmap(const QSize &size, QWidget* widget) {
+      delete m_backgroundPixmap;
+      m_backgroundPixmap = new QPixmap(size);
+      m_backgroundPixmap->fill(QColor(0xff, 0xff, 0xff, 0));
+      QPainter painter(m_backgroundPixmap);
+      m_backgroundPainter->paint(&painter, QRect(0, 0, size.width(), size.height()), widget);
+      m_backgroundDirty = false;
+  }
+#endif
+
   void ContentToolbarChromeItem::stateEnterFull(bool animate) {
 
     //qDebug() <<__PRETTY_FUNCTION__ ;
@@ -378,12 +450,17 @@
 
     // Show the middle snippet and reset the opacity if we are here directly with no aniamtion
     if (!animate) {
+#if !defined(BROWSER_LAYOUT_TENONE) || !defined(Q_WS_MAEMO_5)
       m_bgopacity = 0.75;
+#else
+      m_bgopacity = 1.0;
+#endif
       s->middleSnippet()->show();
     }
 
     m_state = CONTENT_TOOLBAR_STATE_FULL;
     s->middleSnippet()->widget()->setOpacity(1.0);
+    s->handleToolbarStateChange(m_state);
     // TODO: specify the rect to be updated to avoid full repaint
     update();
   }
@@ -400,7 +477,9 @@
 
     s->middleSnippet()->hide();
     m_state = CONTENT_TOOLBAR_STATE_PARTIAL;
-
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+    s->handleToolbarStateChange(m_state);
+#endif
   }
 
   void ContentToolbarChromeItem::stateEnterAnimToFull(bool animate) {
@@ -431,29 +510,30 @@
   }
 
   void ContentToolbarChromeItem::changeState( ContentToolbarState state, bool animate){
-
     onStateEntry(state, animate);
   }
 
   void ContentToolbarChromeItem::onStateEntry(ContentToolbarState state, bool animate){
-
-   //qDebug() << __PRETTY_FUNCTION__ ;
-   switch (state) {
-        case CONTENT_TOOLBAR_STATE_PARTIAL:
-          stateEnterPartial(animate);
-          break;
-        case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL:
-          stateEnterAnimToFull(animate);
-          break;
-        case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
-          stateEnterAnimToPartial(animate);
-          break;
-        case CONTENT_TOOLBAR_STATE_FULL:
-          stateEnterFull(animate);
-          break;
-        default:
-          qDebug() << "ContentToolbarChromeItem::onStateEntry -  invalid state" ;
-          break;
+      if(state != m_state)
+      {
+        //qDebug() << __PRETTY_FUNCTION__ ;
+        switch (state) {
+            case CONTENT_TOOLBAR_STATE_PARTIAL:
+              stateEnterPartial(animate);
+              break;
+            case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL:
+              stateEnterAnimToFull(animate);
+              break;
+            case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
+              stateEnterAnimToPartial(animate);
+              break;
+            case CONTENT_TOOLBAR_STATE_FULL:
+              stateEnterFull(animate);
+              break;
+            default:
+              qDebug() << "ContentToolbarChromeItem::onStateEntry -  invalid state" ;
+              break;
+        }
     }
   }
 
@@ -475,6 +555,21 @@
       m_linkedChildren.at(i)->hide();
     }
   }
+  
+  bool ContentToolbarChromeItem::event(QEvent* event)
+  {
+      bool ret = false;
+      if (event->type() == QEvent::Gesture &&
+          m_state != CONTENT_TOOLBAR_STATE_FULL) {
+          
+          ret = m_webView->webWidget()->event(event);
+      }
+      else {     
+          ret = ChromeItem::event(event);    
+      }
+      return ret;
+  }
+    
 } // end of namespace GVA
 
 
--- a/ginebra2/ContentToolbarChromeItem.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentToolbarChromeItem.h	Fri Oct 15 17:30:59 2010 -0400
@@ -30,6 +30,7 @@
 class QTimer;
 
 namespace GVA {
+  class GWebContentView;
 
   class ToolbarFadeAnimator: public QObject
   {
@@ -70,6 +71,16 @@
       void toggleMiddleSnippet();
       bool autoHideToolbar() { return  m_autoHideToolbar ;}
 
+      bool event(QEvent* event);    
+
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+      void changeState( ContentToolbarState state, bool animate = false);
+
+    signals:
+      // Sent when the inactivity timer has fired.
+      void inactivityTimer();
+#endif
+
     protected:
       virtual void resizeEvent(QGraphicsSceneResizeEvent * ev);
       /// Reimplemented to consume the events
@@ -93,7 +104,9 @@
 
     private:
       void addFullBackground();
+#if !defined(BROWSER_LAYOUT_TENONE) && !defined(Q_WS_MAEMO_5)
       void changeState( ContentToolbarState state, bool animate = false);
+#endif
       void onStateEntry(ContentToolbarState state, bool animate);
       bool mvSnippetVisible();
       void hideLinkedChildren() ;
@@ -104,8 +117,18 @@
       void  stateEnterAnimToPartial(bool animate =false);
       void  stateEnterAnimToFull(bool animate =false);
 
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+      void updateBackgroundPixmap(const QSize &size, QWidget* widget);
+#endif
+
       ToolbarFadeAnimator * m_animator;
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+      class ScaleNinePainter *m_backgroundPainter;
+      QPixmap *m_backgroundPixmap;
+      bool m_backgroundDirty;
+#else
       QPainterPath* m_background;
+#endif
       QTimer* m_inactivityTimer;
       QList <ChromeSnippet *> m_linkedChildren;
       qreal m_bgopacity;
@@ -113,6 +136,7 @@
       ContentToolbarState m_state;
       bool m_autoHideToolbar;
       ContentToolbarTimerState m_timerState;
+      GWebContentView* m_webView; 
   };
 
 } // end of namespace GVA
--- a/ginebra2/ContentToolbarSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentToolbarSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -56,7 +56,9 @@
       m_type = TOOLBAR_WEB_VIEW;
       m_subChromeInactiveTimer = new QTimer(this);
       connect(m_subChromeInactiveTimer, SIGNAL(timeout()), this, SLOT(onInactivityTimer()));
-
+#ifdef Q_WS_MAEMO_5
+      connect(m_chrome, SIGNAL(windowStateChanged(Qt::WindowStates)), this, SLOT(onWindowStateChanged(Qt::WindowStates)));
+#endif
   }
 
   ContentToolbarSnippet::~ContentToolbarSnippet()
@@ -68,6 +70,10 @@
   {
       ContentToolbarSnippet * that = new ContentToolbarSnippet( elementId, chrome, element );
       that->setChromeWidget( new ContentToolbarChromeItem( that ) );
+#ifdef BROWSER_LAYOUT_TENONE
+      ToolbarChromeItem * w = static_cast<ToolbarChromeItem*>(that->widget());
+      w->addCornerBackground();
+#endif      
       return that;
   }
   
@@ -78,6 +84,17 @@
 
   }
 
+  void ContentToolbarSnippet::setChromeWidget(QGraphicsWidget * newWidget){
+      if(widget()) {
+          // Disconnect from existing widget.
+          disconnect(widget(), SIGNAL(inactivityTimer()), this, SLOT(onWidgetInactivityTimer()));
+      }
+      // Connect to new widget.
+      connect(newWidget, SIGNAL(inactivityTimer()), this, SLOT(onWidgetInactivityTimer()));
+
+      ToolbarSnippet::setChromeWidget(newWidget);
+  }
+
   void ContentToolbarSnippet::updateOwnerArea() {
 
 
@@ -85,16 +102,16 @@
     setWidth(m_chrome->layout()->size().width());
     ToolbarSnippet::updateOwnerArea();
 
-      //qDebug()  << "------------Relayout "<< elementId() << hidesContent();
-      // If hidesContent is true, it means that the snippet is tied to the chrome's layout. Hence, we
-      // should invalidate and activate the layout here so that the layout and recalculate all
-      // edges (we don't want to wait for the asynchronous layout request to be handled as
-      // that would cause the this snippet to be painted in incorrect position before the layoutRequest
-      // is handled
-      if (hidesContent() ) {
-	chrome()->layout()->layout()->invalidate();
-	chrome()->layout()->layout()->activate();
-      }
+    //qDebug()  << "------------Relayout "<< elementId() << hidesContent();
+    // If hidesContent is true, it means that the snippet is tied to the chrome's layout. Hence, we
+    // should invalidate and activate the layout here so that the layout and recalculate all
+    // edges (we don't want to wait for the asynchronous layout request to be handled as
+    // that would cause the this snippet to be painted in incorrect position before the layoutRequest
+    // is handled
+    if (hidesContent() ) {
+        chrome()->layout()->layout()->invalidate();
+        chrome()->layout()->layout()->activate();
+    }
   }
 
   void ContentToolbarSnippet::setWidth(int width ){
@@ -121,35 +138,49 @@
       ToolbarActions_t* t = new ToolbarActions_t();
       if (id == "BackButtonSnippet" ) {
           t->actionId = CONTENT_VIEW_ACTION_BACK;
-          t->actionName = CONTENT_TOTOLBAR_BACK;
-          t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png";
-          t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_disabled.png";
-          t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png";
+          t->actionName = CONTENT_TOOLBAR_BACK;
+          t->normalImg = ":/toolbar/icon_back.png";
+          t->disabledImg = ":/toolbar/icon_back_disabled.png";
+          t->activeImg = ":/toolbar/icon_back_pressed.png";
+      }
+       else if (id  == "ZoomButtonSnippet" ) {
+          t->actionId = CONTENT_VIEW_ACTION_ZOOM;
+          t->actionName = CONTENT_TOOLBAR_ZOOM;
+          t->normalImg = ":/toolbar/icon_zoom.png";
+          t->disabledImg = ":/toolbar/icon_zoom_disabled.png";
+          t->activeImg = ":/toolbar/icon_zoom_pressed.png";
       }
-      else if (id  == "ZoomButtonSnippet" ) {
-          t->actionId = CONTENT_VIEW_ACTION_ZOOM;
-          t->actionName = CONTENT_TOTOLBAR_ZOOM;
-          t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom.png";
-          t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_disabled.png";
-          t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_pressed.png";
+      else if (id  == "ZoomInButtonSnippet" ) {
+          t->actionId = CONTENT_VIEW_ACTION_ZOOM_IN;
+          t->actionName = CONTENT_TOOLBAR_ZOOM_IN;
+          t->normalImg = ":/toolbar/icon_zoom+.png";
+          t->disabledImg = ":/toolbar/icon_zoom+_disabled.png";
+          t->activeImg = ":/toolbaricon_zoom+_pressed.png";
+      }
+      else if (id  == "ZoomOutButtonSnippet" ) {
+          t->actionId = CONTENT_VIEW_ACTION_ZOOM_OUT;
+          t->actionName = CONTENT_TOOLBAR_ZOOM_OUT;
+          t->normalImg = ":/toolbar/icon_zoom-.png";
+          t->disabledImg = ":/toolbar/icon_zoom-_disabled.png";
+          t->activeImg = ":/toolbar/icon_zoom-_pressed.png";
       }
       else if (id == "MenuButtonSnippet" ) {
           t->actionId = CONTENT_VIEW_ACTION_MENU;
-          t->actionName = CONTENT_TOTOLBAR_MENU;
-          t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_menu.png";
+          t->actionName = CONTENT_TOOLBAR_MENU;
+          t->normalImg = ":/toolbar/icon_menu.png";
           t->disabledImg = "";
-          t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_menu_pressed.png";
+          t->activeImg = ":/toolbar/icon_menu_pressed.png";
       }
       else if (id == "MostVisitedButtonSnippet" ) {
           t->actionId = CONTENT_VIEW_ACTION_MOSTVISITED;
-          t->actionName = CONTENT_TOTOLBAR_MOSTVISITED;
-          t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited.png";
+          t->actionName = CONTENT_TOOLBAR_MOSTVISITED;
+          t->normalImg = ":/toolbar/icon_mostvisited.png";
           t->disabledImg = "";
-          t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited_pressed.png";
+          t->activeImg = ":/toolbar/icon_mostvisited_pressed.png";
       }
       else if (id == "ToggleTBButtonSnippet" ) {
           t->actionId = CONTENT_VIEW_ACTION_TOGGLETB;
-          t->actionName = CONTENT_TOTOLBAR_TOGGLETB;
+          t->actionName = CONTENT_TOOLBAR_TOGGLETB;
           t->normalImg = TOOLBAR_FULL_TB_TOGGLE_ICON;
           t->disabledImg = "";
           t->activeImg = TOOLBAR_FULL_TB_SELECTED_TOGGLE_ICON;
@@ -270,6 +301,7 @@
       // Set selected on press to false here so that we can control when to
       // change action button icon state
       button->setActiveOnPress(false); 
+      if (button->getDefaultAction())
       button->getDefaultAction()->setCheckable(true);
 
       ChromeItem * item = static_cast<ChromeItem*>(s->widget());
@@ -283,11 +315,18 @@
 
           switch (t->actionId) {
 
+              case CONTENT_VIEW_ACTION_MENU:
+                  addMenuButton(action, button);
+                  break;
               case CONTENT_VIEW_ACTION_ZOOM:
                   addZoomButton(action, button);
                   break;
-              case CONTENT_VIEW_ACTION_MENU:
-                  addMenuButton(action, button);
+              case CONTENT_VIEW_ACTION_ZOOM_IN:
+              case CONTENT_VIEW_ACTION_ZOOM_OUT:
+                  button->setActiveOnPress(true);
+                  #if defined(Q_WS_MAEMO_5) && defined(BEDROCK_TILED_BACKING_STORE)
+                  button->setTriggerOnUp(false);
+                  #endif
                   break;
               case CONTENT_VIEW_ACTION_MOSTVISITED:
                   addMostVisitedButton(action, button);
@@ -315,7 +354,7 @@
 
      
   }
-
+  
   void ContentToolbarSnippet::addMenuButton(QAction * action, ActionButtonSnippet* button) {
 
       assert(action);
@@ -350,7 +389,6 @@
       connect(action,  SIGNAL(triggered()), this, SLOT(handleToggleTBButton()));
   }
 
-
   void ContentToolbarSnippet::handleZoomButton() {
 
       ActionButtonSnippet * button  = getActionButtonSnippet(CONTENT_VIEW_ACTION_ZOOM);
@@ -406,8 +444,25 @@
  void ContentToolbarSnippet::handleToggleTBButton() {
      ContentToolbarChromeItem * w = static_cast<ContentToolbarChromeItem*>(widget());
      w->toggleMiddleSnippet();
+#ifdef Q_WS_MAEMO_5
+     if(m_chrome)
+        m_chrome->emitRequestToggleNormalFullsreen();
+#else
+     ActionButtonSnippet * button  = getActionButtonSnippet(CONTENT_VIEW_ACTION_TOGGLETB);
+     hideOtherPopups(button->elementId());
+#endif
   }
 
+ void ContentToolbarSnippet::onWidgetInactivityTimer() {
+     ActionButtonSnippet * button  = getActionButtonSnippet(CONTENT_VIEW_ACTION_TOGGLETB);
+     if(button) {
+         QAction *action = button->getDefaultAction();
+         if(action) {
+             action->trigger();
+         }
+     }
+ }
+
 
   void ContentToolbarSnippet::hideOtherPopups(QString id) {
 
@@ -492,6 +547,11 @@
           // is not visible
           if (!linkedSnippet || (linkedSnippet && (!linkedSnippet->isVisible() ))) {
               buttonSnippet->setActive(true);
+#ifndef Q_WS_MAEMO_5
+              if (type == QEvent::GraphicsSceneMousePress && buttonSnippet->elementId() == "BackButtonSnippet") {
+                  hideOtherPopups(buttonSnippet->elementId()); 
+              }
+#endif
           } 
       }
   }
@@ -592,24 +652,21 @@
 
 void ContentToolbarSnippet::handleToolbarStateChange(ContentToolbarState state){
 
-
     ActionButtonSnippet * button  =  getActionButtonSnippet(CONTENT_VIEW_ACTION_TOGGLETB);
 
     // set the appopriate icons based on the state
 
     if (state != CONTENT_TOOLBAR_STATE_INVALID ) {
-        if (state  == CONTENT_TOOLBAR_STATE_PARTIAL ) {
+        if (state == CONTENT_TOOLBAR_STATE_PARTIAL ) {
             button->setIcon(TOOLBAR_PARTIAL_TB_TOGGLE_ICON);
             button->setActiveIcon(TOOLBAR_PARTIAL_TB_SELECTED_TOGGLE_ICON);
         }
         else if (state == CONTENT_TOOLBAR_STATE_FULL ) {
             button->setIcon(TOOLBAR_FULL_TB_TOGGLE_ICON);
             button->setActiveIcon(TOOLBAR_FULL_TB_SELECTED_TOGGLE_ICON);
-
         }
         // Also reset the button state if the change in state was triggered by toggle-button selection 
         button->updateButtonState(false);
-
     }
 }  
 
@@ -626,10 +683,25 @@
 
     }
     return linkedButton;
-
-
 }
 
+#ifdef Q_WS_MAEMO_5
+void ContentToolbarSnippet::onWindowStateChanged(Qt::WindowStates state) {
+    ContentToolbarChromeItem * w = static_cast<ContentToolbarChromeItem*>(widget());
+    if(!w) return;
+
+    switch(state) {
+      case Qt::WindowFullScreen:
+        w->changeState(CONTENT_TOOLBAR_STATE_PARTIAL, false);
+        break;
+      case Qt::WindowNoState:
+        w->changeState(CONTENT_TOOLBAR_STATE_FULL, false);
+        break;
+      default:
+        break;
+    }
+}
+#endif
 } // end of namespace GVA
 
 
--- a/ginebra2/ContentToolbarSnippet.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentToolbarSnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -42,6 +42,7 @@
     static ContentToolbarSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element);
     WebChromeContainerSnippet * middleSnippet() { return m_middleSnippet;}
     void handleToolbarStateChange(ContentToolbarState);
+    virtual void setChromeWidget(QGraphicsWidget * newWidget);
 
   Q_SIGNALS:
     void menuButtonSelected();
@@ -67,6 +68,16 @@
     void onHidden();
     void onShown();
     void onInactivityTimer();
+
+    /// Called when the ContentToolbarChromeItem's inactivityTimer() signal is sent.
+    void onWidgetInactivityTimer();
+
+#ifdef Q_WS_MAEMO_5
+    /// Called when the top-level window changes state -- typically from
+    /// full screen to normal or vice versa.
+    void onWindowStateChanged(Qt::WindowStates state);
+#endif
+
     void onExternalMouse(QEvent * ev, const QString & name, const QString & description);
     void onAspectChanged( ); 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/BrowserWindow.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,375 @@
+#include "BrowserWindow.h"
+#include "WindowsView.h"
+#include "ChromeLayout.h"
+#include "ChromeWidget.h"
+#include "ChromeView.h"
+#include "ChromeDOM.h" //Get rid of this dependency
+#include "GWebContentView.h"
+#include <QGraphicsWidget>
+#include <QGraphicsScene>
+#include <QGraphicsTextItem>
+#include <QVBoxLayout>
+#include "webpagecontroller.h"
+#include "ViewStack.h"
+#ifdef Q_WS_MAEMO_5
+#include <QtGui/QX11Info>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#endif
+
+namespace GVA {
+
+  bool BrowserWindow::m_preventDisconnectPageTitleChanged = false; // workaraound for multiple windows crash
+  bool BrowserWindow::m_preventConnectPageTitleChanged = false;    // workaround for multiple windows crash
+
+  BrowserWindow::BrowserWindow(ChromeWidget * chrome, WindowsView * windows, QWidget * parent, Qt::WindowFlags flags)
+    : QMainWindow(parent, flags),
+      m_page(0),
+      m_specialPage(0),
+      m_decorated(false),
+      m_chrome(chrome),
+      m_scene(new QGraphicsScene()),
+      m_snapshot(0),
+      m_windows(windows),
+      m_state(menuEnabled),   
+      m_slidedUp(false),   
+      m_viewName("WebView"),
+      m_changingMode(false)
+  {
+    m_view = new ChromeView(m_scene, m_chrome, this);
+    setCentralWidget(m_view);
+    show();
+    ViewController *controller = viewController();
+    if(controller) {
+        connect(controller, SIGNAL(currentViewChanged(ControllableViewBase *)), this, SLOT(onViewChanged(ControllableViewBase *)));
+    }
+    slideViewIfRequired(100); // display UrlSearchBar for every new window
+  }
+
+  void BrowserWindow::setPage(WRT::WrtBrowserContainer * page)
+  { 
+    m_page = page;
+    connectPageTitleChanged();
+  }
+
+	// hide or show UrlSearchBar if required
+	// This is a workaround for the problem that created by the fact that
+	// multiple instances of BrowserWindow use same instance of m_chrome and m_chrome->layout()
+	// 
+  void BrowserWindow::slideViewIfRequired(int value)
+  {
+      if(value > 0) { // slide up to display UrlSearchBar
+           m_chrome->layout()->slideView(value);
+           m_slidedUp = true;
+           return;
+      }
+
+      if((m_slidedUp == true) && (value < 0)) { // slide down UrlSearchBar
+           m_chrome->layout()->slideView(value);
+           m_slidedUp = false;
+           return;
+      }
+  }
+  
+  void BrowserWindow::toggleDecoration() 
+  { 
+    m_decorated = !m_decorated;
+    if(m_decorated) {
+      showDecoration();
+    } 
+    else {
+      hideDecoration();
+    }
+  }
+
+  void BrowserWindow::showDecoration()
+  {
+    m_state |= active;
+    if(m_page)       
+      WebPageController::getSingleton()->setCurrentPage(m_page);
+    m_windows->deactivate(this);
+    if(m_snapshot)
+      m_snapshot->hide();
+    if(m_chrome){
+      m_chrome->layout()->setPos(0,0);
+      m_scene->addItem(m_chrome->layout());
+      m_chrome->layout()->show();
+      // Ensure that the layout size is in-synch with the window size.
+      m_chrome->layout()->resize(size());
+    }
+  }
+
+  void BrowserWindow::hideDecoration()
+  {
+    m_state &= ~active;
+
+    m_windows->activate(this);
+    if(m_chrome)
+      m_scene->removeItem(m_chrome->layout());
+
+    if(m_page){
+      m_page->triggerAction(QWebPage::Stop);
+      //QImage image = WebPageController::getSingleton()->pageThumbnail(m_page);
+      //	if(image.isNull()){
+      //QImage image =  m_page->pageThumbnail(1,1);
+      //
+      
+      QImage image;
+      //This is really a bit hackish: the page controller should be able
+      //to figure this out;
+      //if(m_windows->contentView()->currentPageIsSuperPage()){
+	//m_specialPage = static_cast<WRT::WrtBrowserContainer*>(m_windows->contentView()->wrtPage());
+        //m_windows->contentView()->updateWebPage(m_page);
+	//image = m_windows->contentView()->pageThumbnail(1,1);
+      //}
+      //else
+        QSize s(800,464);
+        image = m_page->thumbnail(s);
+      if(m_snapshot){
+	m_scene->removeItem(m_snapshot);
+	delete m_snapshot;
+      }
+      m_snapshot = new QGraphicsPixmapItem(QPixmap::fromImage(image));
+      m_scene->addItem(m_snapshot);
+      m_snapshot->show();
+    } else {
+      qDebug() << "BrowserWindow::hideDecoration: page not set";
+    }
+  }
+  
+  void BrowserWindow::closeWindow()
+  {
+    //Tell the page controler to close this page.
+    //The controller emits pageClosed. WindowsView
+    //handles this and deletes this browser window
+    // Don't delete if only 1 window open..causes crash on exit
+    if (WebPageController::getSingleton()->pageCount() > 1)
+      WebPageController::getSingleton()->closePage(m_page);
+  }
+
+  //Handle window events
+  bool BrowserWindow::event(QEvent * event) 
+  {
+    //qDebug() << "=====================BrowserWindow:event: " << event->type();
+    switch (event->type()) {
+    case QEvent::WindowBlocked:
+      m_state |= blocked;
+      break;
+    case QEvent::WindowUnblocked:
+      m_state &= ~blocked;
+      break;
+    case QEvent::WindowActivate: //Newly shown window or window maximized
+      handleWindowActivate();
+      m_chrome->windowStateChange(windowState());
+      break;
+    case QEvent::WindowDeactivate:
+      handleWindowDeactivate();
+      m_chrome->windowStateChange(windowState());
+      break;
+    case QEvent::Close:
+      m_state |= blocked; 
+      closeWindow();
+      break;    
+    default:
+      break;
+    }
+    return QMainWindow::event(event);
+  }
+
+ void BrowserWindow::changeEvent(QEvent * event) {
+    switch (event->type()) {
+      case QEvent::WindowStateChange:
+        m_chrome->windowStateChange(windowState());
+        break;
+      default:
+        break;
+    }
+    QMainWindow::changeEvent(event);
+  }
+
+  void BrowserWindow::handleWindowActivate() {
+      if(m_changingMode) {
+          // Ignore if in the process of changing from fullscreen to normal.  We get a deactivate followed by
+          // an activate call when this is done.  Clear the flag for the next time activate or deactivate is
+          // called for some other reason.
+          m_changingMode = false;
+          return;
+      }
+#ifdef Q_WS_MAEMO_5
+      grabZoomKeys(true);
+#endif
+      showDecoration();
+      if(m_chrome) {
+          connect(m_chrome, SIGNAL(requestToggleNormalFullScreen()), this, SLOT(toggleNormalFullScreen()));
+      }
+  }
+
+  void BrowserWindow::handleWindowDeactivate() {
+      if(m_changingMode) {
+          // Ignore if in the process of changing from fullscreen to normal.
+          return;
+      }
+#ifdef Q_WS_MAEMO_5
+      grabZoomKeys(false);
+#endif
+      if(!((m_state & blocked) == blocked))
+        hideDecoration();
+      slideViewIfRequired(-100); // hide UrlSearchBar if required
+      if(m_chrome) {
+          disconnect(m_chrome, SIGNAL(requestToggleNormalFullScreen()), this, SLOT(toggleNormalFullScreen()));
+      }
+  }
+
+  void BrowserWindow::setMenuEnabled(bool enabled)
+  {
+    if(enabled)
+      m_state |= menuEnabled;
+    else
+      m_state &= ~menuEnabled;
+
+    fixupWindowTitle();
+  }
+
+  void BrowserWindow::setTitle(const QString &title)
+  {
+    if(title.isEmpty()) {
+        setWindowTitle(QApplication::applicationName());
+    }
+    else {
+        setWindowTitle(title);
+    }
+
+    fixupWindowTitle();
+  }
+
+  /// Hack to hide the menu bar arrow when the menu is disabled.
+  void BrowserWindow::fixupWindowTitle() {
+      QString title = windowTitle();
+      title = title.trimmed();
+      if(!m_windows->isMenuEnabled()) {
+          // The menu is disabled, add some spaces to the title to push the down arrow out of view.
+          title += QString(60, ' ');
+      }
+      setWindowTitle(title);
+  }
+
+  void BrowserWindow::onPageTitleChanged(const QString &title)
+  {
+      setTitle(title);
+  }
+
+  void BrowserWindow::onViewChanged(ControllableViewBase *newView) {
+      Q_ASSERT(newView);
+
+      if(m_windows->contentView()->currentPageIsSuperPage()) {
+          if(!m_preventDisconnectPageTitleChanged)
+            disconnectPageTitleChanged();
+          m_preventDisconnectPageTitleChanged = true;
+          m_preventConnectPageTitleChanged = false;
+      }
+      else {
+          if(!m_preventConnectPageTitleChanged)
+            connectPageTitleChanged();
+          m_preventDisconnectPageTitleChanged = false;
+          m_preventConnectPageTitleChanged = true;
+      }
+      if(m_state & active) {
+          setTitle(newView->title());
+      }
+  }
+
+  ViewController *BrowserWindow::viewController() {
+    ViewStack *viewStack = ViewStack::getSingleton();
+    if(viewStack) {
+        return viewStack->getViewController();
+    }
+
+    return 0;
+  }
+
+  void BrowserWindow::connectPageTitleChanged() {
+      connect(m_page->mainFrame(), SIGNAL(titleChanged(const QString &)),
+              this, SLOT(onPageTitleChanged(const QString &)));
+  }
+
+  void BrowserWindow::disconnectPageTitleChanged() {
+      disconnect(m_page->mainFrame(), SIGNAL(titleChanged(const QString &)),
+              this, SLOT(onPageTitleChanged(const QString &)));
+  }
+  
+  
+   void BrowserWindow::toggleNormalFullScreen() {
+      m_changingMode = true;
+
+      // Block paint updates while switching modes.  This avoids ugly flicker in toolbar.
+      setUpdatesEnabled(false);
+
+      if(isFullScreen())
+          showNormal();
+      else {
+          // Show full screen unless it's showing a super page: bookmarks, histroy etc. should always
+          // be in normal mode.
+          if(!m_windows->contentView()->currentPageIsSuperPage()) {
+              showFullScreen();
+          }
+      }
+      // Un-block updates.
+      setUpdatesEnabled(true);
+  }
+  
+  #ifdef Q_WS_MAEMO_5
+  // Tell the system we want to handle volume key events (or not).
+  void BrowserWindow::grabZoomKeys(bool grab)
+  {
+      if (!winId()) {
+          qWarning("Can't grab keys unless we have a window id");
+          return;
+      }
+
+      unsigned long val = (grab) ? 1 : 0;
+      Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
+      if (!atom) {
+          qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM. This example will only work "
+                   "on a Maemo 5 device!");
+          return;
+      }
+
+      XChangeProperty (QX11Info::display(),
+              winId(),
+              atom,
+              XA_INTEGER,
+              32,
+              PropModeReplace,
+              reinterpret_cast<unsigned char *>(&val),
+              1);
+  }
+
+  void BrowserWindow::keyPressEvent(QKeyEvent* event)
+  {
+      switch (event->key()) {
+      case Qt::Key_F7:
+          {
+              // Handle "volume down" key by triggering zoom-in.
+              ControllableViewBase *view = m_chrome->getView("WebView");
+              if(view) {
+                  view->triggerAction("ZoomIn");
+              }
+              event->accept();
+          }
+          break;
+
+      case Qt::Key_F8:
+          {
+              // Handle "volume up" key by triggering zoom-out.
+              ControllableViewBase *view = m_chrome->getView("WebView");
+              if(view) {
+                  view->triggerAction("ZoomOut");
+              }
+              event->accept();
+          }
+          break;
+      }
+      QWidget::keyPressEvent(event);
+  }
+#endif
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/BrowserWindow.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,86 @@
+/*
+ * BrowserWindow.h
+ *
+ */
+
+#ifndef BROWSERWINDOW_H
+#define BROWSERWINDOW_H_
+
+#include <QMainWindow>
+#include "wrtbrowsercontainer.h"
+
+class QGraphicsWidget;
+class QGraphicsScene;
+class QGraphicsItem;
+
+class ControllableViewBase;
+
+namespace GVA {
+
+class ChromeLayout;
+class ChromeWidget;
+class ChromeView;
+class WindowsView;
+class ViewController;
+
+class BrowserWindow : public QMainWindow
+{      
+
+ Q_OBJECT
+
+ enum {
+   blocked = 1,
+   active = 2,
+   menuEnabled = 4
+ };
+
+ public:
+  BrowserWindow(ChromeWidget * chrome, WindowsView * windows, QWidget * parent = 0, Qt::WindowFlags flags = 0 );
+  virtual ~BrowserWindow() { ; }
+  void setPage(WRT::WrtBrowserContainer * page);
+  void closeWindow();
+  void toggleDecoration(); 
+  void showDecoration();
+  void hideDecoration();
+  const QString & view() { return m_viewName; }
+  void setView(const QString & view) { m_viewName = view; }
+  void setMenuEnabled(bool enabled);
+  void setTitle(const QString &title);
+ protected slots:
+  void onViewChanged(ControllableViewBase *newView);
+  void onPageTitleChanged(const QString &title);
+  void toggleNormalFullScreen();
+ protected:
+  ViewController *viewController();
+  virtual bool event(QEvent * event);
+  virtual void changeEvent(QEvent * event);
+  void connectPageTitleChanged();
+  void disconnectPageTitleChanged();
+  void fixupWindowTitle();
+  void slideViewIfRequired(int value); // hide or show UrlSearchBar if required
+  void handleWindowActivate();
+  void handleWindowDeactivate();
+  
+  #ifdef Q_WS_MAEMO_5
+  void grabZoomKeys(bool grab);
+  virtual void keyPressEvent(QKeyEvent* event);
+	#endif
+	
+ private:
+  WRT::WrtBrowserContainer * m_page; //Not owned
+  WRT::WrtBrowserContainer * m_specialPage;
+  bool m_decorated;
+  ChromeWidget * m_chrome; //Shared, not owned
+  ChromeView * m_view;
+  QGraphicsScene * m_scene;
+  QGraphicsItem * m_snapshot;
+  WindowsView * m_windows;
+  int m_state;
+  QString m_viewName;  
+  static bool m_preventDisconnectPageTitleChanged;
+  static bool m_preventConnectPageTitleChanged;
+  bool m_slidedUp;
+  bool m_changingMode;
+};
+}
+#endif /* BROWSERWINDOW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/ContentViewContextMenu.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,48 @@
+
+#include <QDebug>
+#include <QWebHitTestResult>
+
+#include "ContentViewContextMenu.h"
+#include "webpagecontroller.h"
+#include "Downloads.h"
+
+namespace GVA {
+
+ContentViewContextMenu::ContentViewContextMenu(QWebHitTestResult *hitTest, QWidget *parent) :
+    ContextMenu(parent),
+    m_menu(parent),
+    m_hitTest(hitTest)
+{
+    if(m_hitTest->linkUrl().isValid()) {
+        addAction("Open in New Window", this, SLOT(onOpenLink()));
+        addAction("Share Link", this, SLOT(onShareLink()));
+    }
+    if(m_hitTest->imageUrl().isValid()) {
+        addAction("View Image", this, SLOT(onViewImage()));
+        addAction("Save Image", this, SLOT(onSaveImage()));
+        addAction("Share Image", this, SLOT(onShareImage()));
+
+    }
+}
+
+void ContentViewContextMenu::onOpenLink() {
+    WebPageController::getSingleton()->LoadInNewWindow(m_hitTest->linkUrl().toString());
+}
+
+void ContentViewContextMenu::onViewImage() {
+    WebPageController::getSingleton()->LoadInNewWindow(m_hitTest->imageUrl().toString());
+}
+
+void ContentViewContextMenu::onShareImage() {
+    WebPageController::getSingleton()->share(m_hitTest->imageUrl().toString());
+}
+
+void ContentViewContextMenu::onSaveImage() {
+}
+
+void ContentViewContextMenu::onShareLink() {
+    WebPageController::getSingleton()->share(m_hitTest->linkUrl().toString());
+
+}
+
+}  // GVA namespace
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/ContentViewContextMenu.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,53 @@
+#ifndef CONTENTVIEWCONTEXTMENU_H
+#define CONTENTVIEWCONTEXTMENU_H
+
+#include <QMenu>
+#include <QTimer>
+
+#include "ContextMenu.h"
+
+namespace GVA {
+
+/*!
+ * Context menu implementation for web content views.
+ */
+class ContentViewContextMenu : public ContextMenu {
+    Q_OBJECT
+public:
+    ContentViewContextMenu(QWebHitTestResult *hitTest, QWidget *parent = 0);
+
+    virtual void addAction(QAction *action) {
+        m_menu.addAction(action);
+    }
+
+    virtual void addAction(const QString text, const QObject * receiver, const char * member, const QKeySequence & shortcut = 0) {
+        m_menu.addAction(text, receiver, member, shortcut);
+    }
+
+    virtual void exec(const QPoint & p) {
+        if(!m_menu.isEmpty()){
+            QPoint newp(p);
+
+            if(p.x() < 570)  // left part of the screen; depends on screen size. should be replaced by something more reliable
+                newp.rx()+=20; // start menu 20 px right of point p
+            else  // right part of the screen
+                newp.rx()-=(20 +  m_menu.sizeHint().width()); //start menu left of point p
+            m_menu.exec(newp);
+        }
+    }
+
+private slots:
+    void onOpenLink();
+    void onShareLink();
+    void onShareImage();
+    void onSaveImage();
+    void onViewImage();
+
+protected:
+    QMenu m_menu;
+    QWebHitTestResult *m_hitTest;
+};
+
+}  // GVA namespace
+
+#endif // CONTENTVIEWCONTEXTMENU_H
--- a/ginebra2/ContentViews/GWebContentView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/GWebContentView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -28,6 +28,10 @@
 #include "browserpagefactory.h"
 #include "wrtbrowsercontainer.h"
 
+#ifdef Q_WS_MAEMO_5
+#include "ContentViewContextMenu.h"
+#endif
+
 #ifdef BEDROCK_TILED_BACKING_STORE
 #include "WebContentViewWidget.h"
 #endif
@@ -35,9 +39,8 @@
 #include "webpagecontroller.h"
 #include "Utilities.h"
 #include "GSuperWebPage.h"
-#ifndef NO_QSTM_GESTURE
 #include "qstmgestureevent.h"
-#endif
+
 
 #include <QGraphicsWebView>
 #include <QWebHistory>
@@ -68,7 +71,9 @@
       m_currentPageIsSuperPage(false),
       m_timer(NULL),
       m_enabled(true),
-      m_savedZoomValueInView(KInitialZoomFactorValue) 
+      m_savedZoomValueInView(KInitialZoomFactorValue),
+      m_firstLoadHack(true),
+      m_savedZoomData(0)
   {
       setObjectName(objectName);
       WRT::WrtBrowserContainer* page = BrowserPageFactory::openBrowserPage();
@@ -76,11 +81,16 @@
       setActions();
 
 #ifdef BEDROCK_TILED_BACKING_STORE
-      m_widget = new WebContentViewWidget(parent, page);
+      m_widget = new WebContentViewWidget(parent, this, page);
       connect(m_widget
               , SIGNAL(updateZoomActions(bool,bool))
               , this
               , SLOT(setZoomActions(bool, bool)));
+
+      connect(m_widget
+              , SIGNAL(mouseEvent(QEvent::Type)) 
+              , this
+              , SIGNAL(contentViewMouseEvent(QEvent::Type)));
 #else
       m_widget = new GWebContentViewWidget(parent, this, page);
 #endif
@@ -94,7 +104,7 @@
       webWidget()->page()->currentFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
 
 #ifndef BEDROCK_TILED_BACKING_STORE
-#ifdef NO_QSTM_GESTURE
+
       m_touchNavigation = new GContentViewTouchNavigation(page, m_widget);
       m_touchNavigation->setChromeWidget(m_chrome);
       m_touchNavigation->setParent(m_jsObject);
@@ -102,18 +112,19 @@
       safe_connect(m_touchNavigation, SIGNAL(mouseEvent(QEvent::Type)) , this, SIGNAL(contentViewMouseEvent(QEvent::Type)));
       safe_connect(m_touchNavigation, SIGNAL(longPressEvent(QPoint)),
                    webWidget(), SLOT(onLongPressEvent(QPoint)));
-#endif
+
 #endif
       WRT::WrtBrowserContainer * wrtPage = static_cast<WRT::WrtBrowserContainer *>(page);
       if (wrtPage) {
           wrtPage->setWebWidget(webWidget());
-          pageCreated(wrtPage);
+          //pageCreated(wrtPage);
       }
 
       connectAll();
   }
 
   GWebContentView::~GWebContentView() {
+      deactivate();
       disconnect(m_jsObject);
       disconnect(webWidget());
 #ifndef BEDROCK_TILED_BACKING_STORE
@@ -249,25 +260,6 @@
 
 #endif
 
-
-bool GWebContentView::gesturesEnabled() const 
-{ 
-#ifndef BEDROCK_TILED_BACKING_STORE
-    return m_touchNavigation->enabled(); 
-#else	
-    return m_widget->gesturesEnabled();
-#endif
-}
-
-void GWebContentView::setGesturesEnabled(bool value) 
-{ 
-#ifndef BEDROCK_TILED_BACKING_STORE		  
-    m_touchNavigation->setEnabled(value); 
-#else
-    m_widget->setGesturesEnabled(value);
-#endif
-}
-
   void GWebContentView::connectAll() {
     //qDebug() << "GWebContentView::connectAll: " << widget();
 
@@ -282,9 +274,9 @@
                  , SLOT(onContextEvent(::WebViewEventContext*)));
 
     safe_connect(m_widget
-                , SIGNAL(contextEventObject(QWebHitTestResult*))
+                , SIGNAL(contextEventObject(QWebHitTestResult*, QPointF))
                 , this
-                , SLOT(handleContextEventObject(QWebHitTestResult*)));
+                , SLOT(handleContextEventObject(QWebHitTestResult*, QPointF)));
 
     safe_connect(m_widget
                  , SIGNAL(viewScrolled(QPoint&, QPoint&))
@@ -299,6 +291,9 @@
     
 #endif
     QObject::connect(webWidget(), SIGNAL(titleChanged(const QString &)), m_jsObject, SIGNAL(titleChanged(const QString &)));
+    #ifdef Q_WS_MAEMO_5
+    QObject::connect(webWidget(), SIGNAL(titleChanged(const QString &)), this, SIGNAL(titleChanged(const QString &)));    
+    #endif
     QObject::connect(webWidget(), SIGNAL(loadStarted()), m_jsObject, SIGNAL(loadStarted()));
     QObject::connect(webWidget(), SIGNAL(loadProgress(int)), m_jsObject, SIGNAL(loadProgress(int)));
     QObject::connect(webWidget(), SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
@@ -318,8 +313,8 @@
 #else
     connect(this, SIGNAL(startingPanGesture(int)), m_jsObject, SIGNAL(startingPanGesture(int)));
 #endif
-
-	QObject::connect(this, SIGNAL(superPageShown(const QString&)), m_jsObject, SIGNAL(superPageShown(const QString&)));         
+    safe_connect(this, SIGNAL(superPageShown(const QString&)), m_jsObject, SIGNAL(superPageShown(const QString&)));
+    safe_connect(this, SIGNAL(normalPageShown()), m_jsObject, SIGNAL(normalPageShown()));
 #endif
     connect(WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer*)),
             this, SLOT(pageCreated(WRT::WrtBrowserContainer*)));
@@ -404,22 +399,33 @@
 
   }
 
-  void GWebContentView::triggerAction(const QString & action)
+   void GWebContentView::triggerAction(const QString & action)
   {
-    QWebPage::WebAction webAction;
     if (action=="Stop")
-      webAction = QWebPage::Stop;
+        webWidget()->triggerPageAction(QWebPage::Stop);
     else if (action=="Back")
-      webAction = QWebPage::Back;
+        webWidget()->triggerPageAction(QWebPage::Back);
     else if (action=="Reload")
-      webAction = QWebPage::Reload;
+        webWidget()->triggerPageAction(QWebPage::Reload);
     else if (action=="Forward")
-      webAction = QWebPage::Forward;
-    else
-      return;
-    webWidget()->triggerPageAction(webAction);
+        webWidget()->triggerPageAction(QWebPage::Forward);
+    else if (action=="ZoomIn")
+        triggerZoomInAction();
+    else if (action=="ZoomOut")
+        triggerZoomOutAction();
   }
 
+  void GWebContentView::triggerZoomInAction() {
+      if(m_actions.contains("zoomIn"))
+          m_actions["zoomIn"]->trigger();
+  }
+
+  void GWebContentView::triggerZoomOutAction() {
+      if(m_actions.contains("zoomOut"))
+          m_actions["zoomOut"]->trigger();
+  }
+
+
   void GWebContentView::deactivateZoomActions()
   {
     m_actions.value("zoomIn")->setEnabled(false);
@@ -427,6 +433,7 @@
   }
 
   void GWebContentView::changeZoomAction(qreal zoom){
+    Q_UNUSED(zoom)
   #ifndef BEDROCK_TILED_BACKING_STORE
     if (!webWidget()) return;
     if (!(webWidget()->isUserScalable() ) ){
@@ -471,9 +478,10 @@
     m_actions.value("zoomIn")->setEnabled(enableZoomIn);
     m_actions.value("zoomOut")->setEnabled(enableZoomOut);
 }
-  qreal GWebContentView::getZoomFactor(){
+
+qreal GWebContentView::getZoomFactor(){
     return webWidgetConst() ? webWidgetConst()->scale() : 0.0;
-  }
+}
 
 #else
   qreal GWebContentView::getZoomFactor() const {
@@ -493,7 +501,7 @@
 #ifdef BEDROCK_TILED_BACKING_STORE
     if (!currentPageIsSuperPage()) {
         WRT::WrtBrowserContainer* currentPage = WebPageController::getSingleton()->currentPage();
-        currentPage->setPageZoomMetaData(m_widget->currentPageInfo());
+        currentPage->setPageZoomMetaData(m_widget->pageDataFromViewportInfo());
     }
 #endif
       ControllableViewBase::deactivate();
@@ -786,12 +794,11 @@
           m_currentPageIsSuperPage = true;
 #ifndef BEDROCK_TILED_BACKING_STORE
           webWidget()->setPage(currentSuperPage()->page());
-          m_touchNavigation->setPage(webWidget()->page());
-          m_touchNavigation->setWantSlideViewCalls(false);
+          m_touchNavigation->setPage(webWidget()->page(), false);
           webWidget()->page()->setPreferredContentsSize(webWidget()->size().toSize());
 #else
           WRT::WrtBrowserContainer *pg = WebPageController::getSingleton()->currentPage();
-          pg->setPageZoomMetaData(m_widget->currentPageInfo());
+          pg->setPageZoomMetaData(m_widget->pageDataFromViewportInfo());
           m_widget->setPage(currentSuperPage()->page());
           m_widget->showPage(true);
 #endif  
@@ -805,6 +812,14 @@
 
   void GWebContentView::showNormalPage() {
     if (webWidget()) {
+#ifndef BEDROCK_TILED_BACKING_STORE
+      webWidget()->showNormalPage();
+      webWidget()->setViewportSize();
+      m_touchNavigation->setPage(currentPage());
+      m_touchNavigation->setWantSlideViewCalls(true);
+#else
+      m_widget->showPage(false);
+#endif
       //TODO: Further testing is needed to show if the following is a net benefit.
       if (currentPageIsSuperPage()) {
           if(currentSuperPage()->page() == m_sharedPage){
@@ -821,18 +836,13 @@
 #ifndef BEDROCK_TILED_BACKING_STORE
     webWidget()->showNormalPage();
     webWidget()->setViewportSize();
-    m_touchNavigation->setPage(currentPage());
-    m_touchNavigation->setWantSlideViewCalls(true);
+    m_touchNavigation->setPage(currentPage(), true);
 #else
     m_widget->showPage(false);
 #endif
+    emit normalPageShown(); 
     }
-	WRT::WrtBrowserContainer * currPage = WebPageController::getSingleton()->currentPage();
-			if(currPage){
-			  webWidget()->initializeViewportParams();
-			  webWidget()->setZoomFactor(currPage->pageZoomMetaData().zoomValue);
 			}
-  }
 
   QObjectList GWebContentView::getSuperPages() {
     QObjectList *result = new QObjectList;
@@ -854,6 +864,7 @@
 #if defined(__gva_no_chrome__) || defined(NO_RESIZE_ON_LOAD)
       m_widget->onLoadStarted();
 #endif
+
     emit loadStarted();
   }
 
@@ -887,6 +898,13 @@
 #if defined(__gva_no_chrome__) || defined(NO_RESIZE_ON_LOAD)
     m_widget->onLoadFinished();
 #endif
+    if(m_savedZoomData) {
+        WrtBrowserContainer* curPage = WebPageController::getSingleton()->currentPage();
+        curPage->setPageZoomMetaData(*m_savedZoomData);
+        delete m_savedZoomData;
+        m_savedZoomData = 0;
+        m_widget->restoreViewportFromHistory(curPage->mainFrame());
+    }
   }
 
   void GWebContentView::dump() {
@@ -915,7 +933,7 @@
       WRT::WrtBrowserContainer * currPage = WebPageController::getSingleton()->currentPage();
       if (currPage) {
           QWebHistoryItem item = currPage->history()->currentItem();
-          currPage->savePageDataToHistoryItem(currPage->mainFrame(), &item);
+          //currPage->savePageDataToHistoryItem(currPage->mainFrame(), &item);
       }
 
       // When new windows are created from window view, as the content is empty, we should disable
@@ -925,6 +943,9 @@
 #ifndef BEDROCK_TILED_BACKING_STORE
       newPage->setPageZoomMetaData(webWidget()->defaultZoomData());
 #else
+      if(newPage->pageZoomMetaData()->isValid())
+         m_widget->setPageDataToViewportInfo(*(newPage->pageZoomMetaData())); // data from history
+      else
 	newPage->setPageZoomMetaData(m_widget->defaultZoomData());
 #endif
       /* Set the new page as the current page */
@@ -958,8 +979,8 @@
 
 #ifndef BEDROCK_TILED_BACKING_STORE
           // Change navigation also to the current page
-          m_touchNavigation->setPage(pg);
-          m_touchNavigation->setWantSlideViewCalls(true);
+          m_touchNavigation->setPage(pg,true );
+          m_touchNavigation->setLoadingFlag( WebPageController::getSingleton()->isPageLoading());
 #endif
 
       }
@@ -976,23 +997,27 @@
   }
 
 #ifdef BEDROCK_TILED_BACKING_STORE
-  void GWebContentView::handleContextEventObject(QWebHitTestResult* eventTarget)
+  void GWebContentView::handleContextEventObject(QWebHitTestResult* hitTest, QPointF position)
   {
-      WebViewEventContext context(type(), *eventTarget);
+      WebViewEventContext context(type(),  *hitTest);
       if (currentPageIsSuperPage()) {
           // Let the superpage handle the event.
-          currentSuperPage()->onContextEvent(&context);
+          //currentSuperPage()->onContextEvent(&context);
+          emit contextEvent(&context);
       }
       else {
-          // Send the event directly.
+          #ifdef Q_WS_MAEMO_5
+          ContentViewContextMenu menu(hitTest, 0);
+          menu.exec(widget()->mapToScene(position).toPoint());
+          #else
           emit contextEvent(&context);
+          #endif
       }
   }
 void GWebContentView::handleViewScrolled(QPoint& scrollPos, QPoint& delta)
 {
-    if (delta.manhattanLength() && (delta.y() > 0  || scrollPos.y() + delta.y() <= 40) 
-        && !currentPageIsSuperPage())
-        m_chrome->layout()->slideView(-delta.y());
+    if(!currentPageIsSuperPage() && !WebPageController::getSingleton()->isPageLoading())
+        m_chrome->layout()->setViewSlide(scrollPos.y() + delta.y());
     
     emit startingPanGesture(1);
 }
@@ -1014,7 +1039,7 @@
          webWidget()->setPageZoomFactor(newPage->mainFrame()->zoomFactor());
       }
 #else
-	 m_widget->setCurrentPageInfo(newPage->pageZoomMetaData());
+         m_widget->setPageDataToViewportInfo(*(newPage->pageZoomMetaData()));
 #endif
   }
 
@@ -1035,6 +1060,27 @@
       widget()->setEnabled(value);
       widget()->update();
   }
+  
+  
+  bool GWebContentView::gesturesEnabled() const 
+  { 
+#ifndef BEDROCK_TILED_BACKING_STORE
+      return m_touchNavigation->enabled(); 
+#else   
+      return m_widget->gesturesEnabled();
+#endif
+  }
+
+  void GWebContentView::setGesturesEnabled(bool value) 
+  { 
+#ifndef BEDROCK_TILED_BACKING_STORE       
+      m_touchNavigation->setEnabled(value); 
+#else
+      m_widget->setGesturesEnabled(value);
+#endif
+  }
+
+#ifndef BEDROCK_TILED_BACKING_STORE
   void GWebContentView::setSavedZoomValueInView(qreal zoomValue){
 	  m_savedZoomValueInView = zoomValue;
   }
@@ -1042,6 +1088,18 @@
   qreal GWebContentView::getSavedZoomValueInView() const{
       return m_savedZoomValueInView;
   }
+#endif
+
+  void GWebContentView::saveZoomDataAndRestoreAfterLoad()
+  {
+      QVariant userData = m_widget->webView()->page()->history()->currentItem().userData();
+      QVariant::Type t = userData.type();
+      int ut = userData.userType();
+
+      if(userData.isValid() && t == QVariant::UserType &&
+         ut == QMetaTypeId<WebPageData>::qt_metatype_id())
+        m_savedZoomData = new WebPageData(userData.value<WebPageData>());
+  }
 } // end of namespace GVA
 
 
--- a/ginebra2/ContentViews/GWebContentView.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/GWebContentView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -29,10 +29,10 @@
 #include <QGraphicsWebView>
 #include "controllableviewimpl.h"
 #include "messageboxproxy.h"
-#include "ZoomMetaData.h"
 #include "GSuperWebPage.h"
 #include "ContentViewDelegate.h"
 #include "GContentViewTouchNavigation.h"
+#include "webpagedata.h"
 
 static const char KBOOKMARKURLFILE[]            = "file://";
 static const char KBOOKMARKURLFILESLASH[]       = "file:///";
@@ -134,7 +134,7 @@
       }
 
       bool gesturesEnabled() const;
-      void setGesturesEnabled(bool value);
+      void setGesturesEnabled(bool value); 
 
       bool enabled() const;
       void setEnabled(bool value);
@@ -173,7 +173,8 @@
       void forwardEnabled(bool enabled);
       void startingPanGesture(int);
       void contentViewMouseEvent(QEvent::Type type);
-	  void superPageShown(const QString &name);
+	    void superPageShown(const QString &name);
+	    void normalPageShown();
 #ifdef BEDROCK_TILED_BACKING_STORE
       void contextEvent(::WebViewEventContext* context);
 #endif      
@@ -209,6 +210,7 @@
       void showNormalPage();
 
       void dump();
+      void saveZoomDataAndRestoreAfterLoad();
 
   private slots:
     void updateZoom(qreal delta);
@@ -222,7 +224,7 @@
     void pageChanged(WRT::WrtBrowserContainer * , WRT::WrtBrowserContainer *);
 
 #ifdef BEDROCK_TILED_BACKING_STORE
-    void handleContextEventObject(QWebHitTestResult* eventTarget);
+    void handleContextEventObject(QWebHitTestResult* hitTest, QPointF position);
     void handleViewScrolled(QPoint& scrollPos, QPoint& delta);
 #endif
   protected:
@@ -234,8 +236,9 @@
     ChromeWidget *chrome() { return m_chrome; }
     void updateWebPage(WRT::WrtBrowserContainer * pg);
     void changeContentViewZoomInfo(WRT::WrtBrowserContainer* newPage);
+    void triggerZoomInAction();
+    void triggerZoomOutAction();
 
-  protected:
 #ifdef BEDROCK_TILED_BACKING_STORE
     WebContentViewWidget* m_widget;
 #else
@@ -268,6 +271,8 @@
     bool m_gesturesEnabled;
     bool m_enabled;
     qreal m_savedZoomValueInView;
+    bool m_firstLoadHack;
+    WebPageData* m_savedZoomData;
   };
 
 }
--- a/ginebra2/ContentViews/GWebContentViewJSObject.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/GWebContentViewJSObject.h	Fri Oct 15 17:30:59 2010 -0400
@@ -56,6 +56,7 @@
     {
         return webContentViewConst()->gesturesEnabled();
     }
+
     void setGesturesEnabled(bool value)
     {
         webContentView()->setGesturesEnabled(value);
@@ -111,7 +112,9 @@
         return false;
 #endif
     }
+#ifndef BEDROCK_TILED_BACKING_STORE
     void setSavedZoomValueInView(qreal zoomValue){ webContentView()->setSavedZoomValueInView(zoomValue); }
+#endif
 
 signals:
     void ContextChanged();
@@ -132,7 +135,11 @@
     void onDisplayModeChanged(const QString &orientation);
 
     void contextEvent(QObject *context);
-	void superPageShown(const QString &name);
+    
+    /// Sent when a superpage is shown.
+	  void superPageShown(const QString &name);
+	  /// Send when the normal content page is shown, ie. switching away from a super-page.
+	  void normalPageShown();
     
 
 private slots:
--- a/ginebra2/ContentViews/GWebContentViewWidget.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/GWebContentViewWidget.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -25,6 +25,10 @@
 #include "Utilities.h"
 #include "ChromeEffect.h"
 
+#ifdef Q_WS_MAEMO_5
+#include "ContentViewContextMenu.h"
+#endif
+
 #include <QGraphicsSceneResizeEvent>
 #include <QGraphicsSceneContextMenuEvent>
 #include <QWebFrame>
@@ -88,9 +92,6 @@
 
   m_currentinitialScale = zoomFactor();
 
-#ifndef NO_QSTM_GESTURE
-  m_touchNavigation = new WebTouchNavigation(this);
-#endif
   // Fixes missing radio button problem with certain themes
   QPalette pal = palette();
   pal.setColor(QPalette::ButtonText,Qt::black);
@@ -213,17 +214,7 @@
 
 bool GWebContentViewWidget::event(QEvent * e) {
 
-    if (e->type() == QEvent::Gesture) {
-#ifndef NO_QSTM_GESTURE
-          QStm_Gesture* gesture = getQStmGesture(e, WebGestureHelper::getAssignedGestureType());
-          if (gesture) {
-              m_touchNavigation->handleQStmGesture(gesture);
-              return true;
-          }
-#endif
-    }
-
-    else if (e->type() == WebPageControllerUpdateViewPortEvent::staticType()) {
+    if (e->type() == WebPageControllerUpdateViewPortEvent::staticType()) {
         updateViewport();
     }
     return QGraphicsWebView::event(e);
@@ -271,7 +262,7 @@
 
 void GWebContentViewWidget::onLongPressEvent(QPoint pos) {
     QWebHitTestResult hitTest = page()->currentFrame()->hitTestContent(pos);
-    //qDebug() << "GWebContentViewWidget::contextMenuEvent:"
+    qDebug() << "GWebContentViewWidget::onLongPressEvent:";
     //        << "\n\t pos=" << hitTest.pos()
     //        << "\n\t linkUrl=" << hitTest.linkUrl()
     //        << "\n\t imageUrl=" << hitTest.imageUrl();
@@ -285,13 +276,29 @@
     }
     else {
         // Send the event directly.
+       #ifndef Q_WS_MAEMO_5
         emit contextEvent(context);
+       #endif
     }
 }
 
 void GWebContentViewWidget::contextMenuEvent(::QGraphicsSceneContextMenuEvent *event) {
+	  #ifndef Q_WS_MAEMO_5
     // Ignore.  The touch navigation code handles long presses.
-    event->accept();
+    	event->accept();
+    #else	
+    	QWebHitTestResult hitTest = page()->currentFrame()->hitTestContent(this->mapFromScene(event->scenePos()).toPoint());
+    	if (m_webContentView && m_webContentView->currentPageIsSuperPage()) {
+        // Let the superpage handle the event.
+        ::WebViewEventContext *context =
+                new ::WebViewEventContext(view()->type(), hitTest);
+        m_webContentView->currentSuperPage()->onContextEvent(context);
+    }
+    else {
+        ContentViewContextMenu menu(&hitTest, 0);
+        menu.exec(event->scenePos().toPoint());
+    }
+    #endif
 }
 
 void GWebContentViewWidget::setZoomFactor(qreal zoom)
@@ -341,7 +348,6 @@
       #if QT_VERSION < 0x040600
 		  page()->setFixedContentsSize(QSize(m_viewportWidth, m_viewportHeight/zoom));
 	  #else
-          if(!m_webContentView->currentPageIsSuperPage()) 
             page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight/zoom));
 	  #endif
   }
@@ -649,14 +655,9 @@
 /*!
  * Provides the default values - used when opening a new blank window
  */
-ZoomMetaData GWebContentViewWidget::defaultZoomData()
+const WebPageData& GWebContentViewWidget::defaultZoomData()
 {
-    ZoomMetaData data;
-
-    data.maxScale = KDefaultMaxScale;
-    data.minScale =  KDefaultMinScale;
-    data.userScalable = false;
-    data.zoomValue = KInitialZoomFactorValue;
+    static const WebPageData data(KDefaultMaxScale,KDefaultMinScale,false, KInitialZoomFactorValue);
 
     return data;
 }
@@ -708,9 +709,6 @@
 		page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight));
 	#endif
 #endif //NO_RESIZE_ON_LOAD
-   if((m_webContentView->currentPageIsSuperPage())){
-        page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight));
-   }
 #ifndef NO_RESIZE_ON_LOAD
   qreal zoomF = 0.0;
   QString str;
@@ -730,7 +728,7 @@
   // Let the page save the data. Even though it is part of the frame, it is easier to
   // save the info in the page to avoid parsing the meta data again.
   WrtBrowserContainer* pg = static_cast<WrtBrowserContainer*>(page());
-  pg->setPageZoomMetaData(pageZoomMetaData());
+  //WTF pg->setPageZoomMetaData(pageZoomMetaData());
   
 
 }
@@ -841,7 +839,7 @@
     return m_maximumScale;
 }
 
-ZoomMetaData GWebContentViewWidget::pageZoomMetaData() {
+/* WTF ZoomMetaData GWebContentViewWidget::pageZoomMetaData() {
 
     ZoomMetaData data;
 
@@ -860,6 +858,7 @@
     m_userScalable = data.userScalable;
     view()->setSavedZoomValueInView(data.zoomValue);
 }
+*/
 
 QWebPage* GWebContentViewWidget::page() const
 {
--- a/ginebra2/ContentViews/GWebContentViewWidget.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/GWebContentViewWidget.h	Fri Oct 15 17:30:59 2010 -0400
@@ -28,17 +28,13 @@
 #include <QGraphicsWebView>
 #include <QWebFrame>
 #include <QTime>
+#include "webpagedata.h"
 
 #include "WebViewEventContext.h"
-#include "ZoomMetaData.h"
 
 class QGraphicsSceneContextMenuEvent;
 
 namespace GVA {
-#ifndef NO_QSTM_GESTURE
-class WebTouchNavigation;
-#endif
-
 class GWebContentView;
 
 class GWebContentViewWidget : public QGraphicsWebView
@@ -105,9 +101,9 @@
     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) ;
     void setPageZoomFactor(qreal zoom);
 
-    ZoomMetaData pageZoomMetaData();
-    void setPageZoomMetaData(ZoomMetaData params);
-    ZoomMetaData defaultZoomData();
+    WebPageData pageZoomMetaData();
+    void setPageZoomMetaData(const WebPageData& params);
+    const WebPageData& defaultZoomData();
     void setCheckeredPixmap();
 
     void onLoadStarted();
@@ -146,7 +142,9 @@
     void contextEvent(::WebViewEventContext *context);
     void BlockFocusChanged(QPoint element);
 
-    void pageZoomMetaDataChange(QWebFrame* frame, ZoomMetaData data);protected:
+//    void pageZoomMetaDataChange(QWebFrame* frame, WebPageData data);
+
+protected:
     void paintEvent(QPaintEvent *event);
     void longPressEvent(::WebViewEventContext *context);
 
@@ -189,9 +187,6 @@
 
     bool        m_inLoading;
     QTime       m_loadingTime;
-#ifndef NO_QSTM_GESTURE
-    WebTouchNavigation* m_touchNavigation;
-#endif
 };
 
 }
--- a/ginebra2/ContentViews/ScrollableWebContentView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/ScrollableWebContentView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -20,63 +20,133 @@
 */
 
 #include "ScrollableWebContentView.h"
-
-#include "Gestures/GestureRecognizer.h"
 #include "Kinetics/KineticScroller.h"
 #include "ScrollableViewBase.h"
 #include "ViewportMetaDataParser.h"
-#include "WebContentAnimationItem.h"
+#include "WebView.h"
+#include "qstmgestureevent.h"
+#include "qstmfilelogger.h"
+#include "bedrockprovisioning.h"
+#include "ScrollHelper.h"
 
 #include <QApplication>
 #include <QGraphicsScene>
 #include <QGraphicsSceneMouseEvent>
 #include <QGraphicsWebView>
+#include <QStyleOptionGraphicsItem>
 #include <QWebElement>
 #include <QWebHitTestResult>
+#include <QWebPage>
+#include <QWebHistory>
+#include <QInputContext>
 
+#include "Gestures/GestureRecognizer.h"
+#ifdef ORBIT_UI
+#include <hbinputmethod.h>
+#endif // ORBIT_UI
+
+namespace GVA {
 //Kinetic scroll constants
 static const int ScrollsPerSecond = 30;
 static const int MinimumScrollVelocity = 10;
 static const qreal AxisLockThreshold = .8;
 
-
 //Zooming constants
-static const int ZoomAnimationDuration = 300;   //ms. Zooming transition duration
+const int ZoomAnimationDuration = 600;   //ms. Zooming transition duration
+const int MaxZoomAnimationDuration = 2000;   //ms. Zooming transition duration
 static const qreal ZoomStep = .5;               //Incremental zoom step
-const int TileUpdateEnableDelay = 500;         //Wait duration before tiling updates are enabled.
+#ifdef Q_WS_MAEMO_5
+const int TileUpdateEnableDelay = 10;         //Wait duration before tiling updates are enabled.
+#else
+const int TileUpdateEnableDelay = 150;         //Wait duration before tiling updates are enabled.
+#endif
+static const int MinDoubleClickZoomTargetWidth = 100;     //Target block width for applying double tap zoom
+static const int ZoomCommitDuration = 60;                //Timeout before commiting zoom
+static const qreal ZoomableContentMinWidth = 300.;
 
-namespace GVA {
+static const qreal InvalidCoord = 1e10;
+static const int TouchDownTimeout = 200;
+static const int HoverTimeout = 100;
 
-ScrollableWebContentView::ScrollableWebContentView(WebContentAnimationItem* webAnimationItem, QGraphicsItem* parent)
+#undef USE_KINETIC_SCROLLER
+using namespace qstmGesture;
+
+ScrollableWebContentView::ScrollableWebContentView(WebView* scrolledWidget, QGraphicsItem* parent)
     : ScrollableViewBase(parent)
     , m_gestureRecognizer(this)
+    , m_isInputOn(false)
+    , m_ignoreNextRelease(false)
 {
     m_viewportMetaData = new ViewportMetaData();
 
+    scrolledWidget->installEventFilter(this);
+    
     //Kinetic scroller settings
     //Sets the number of scrolls (frames) per second to sps.
     m_kineticScroller->setScrollsPerSecond(ScrollsPerSecond);
     //For elastic scroll in page edges
     m_kineticScroller->setOvershootPolicy(KineticScroller::OvershootWhenScrollable);
 
+    setWidget(scrolledWidget);
+
+    m_tileUpdateEnableTimer.setSingleShot(true);
+    connect(&m_tileUpdateEnableTimer, SIGNAL(timeout()), this, SLOT(enableContentUpdates()));
+    m_zoomCommitTimer.setSingleShot(true);
+    connect(&m_zoomCommitTimer, SIGNAL(timeout()),this,SLOT(commitZoom()));
+
+    //Setup zooming animator
+    m_zoomAnimator = new QPropertyAnimation(this, "viewableRect");
+    //m_zoomAnimator->setDuration(ZoomAnimationDuration);
+    connect(m_zoomAnimator, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), 
+            this, SLOT(zoomAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+    
+    m_isSuperPage = false;
+    m_gesturesEnabled = true;
+    m_isLoading = false;
+    m_touchDownTimer = UiTimer::New();
+    m_touchDownTimer->setTimerCallback((char*)"touchDownCallback");
+    
+    m_hoverTimer = UiTimer::New();
+    m_hoverTimer->setTimerCallback((char*)"hoverCallback");
+        
+    m_touchDownTimer->setPriority(150);
+    m_pinchFinishTime = QTime::currentTime();
+    // ScrollHelper
+    m_scrollHelper = new ScrollHelper(this);
+    initScrollHelper();
+        
     //Gesture settings
     //For detecting scroll direction
     m_gestureRecognizer.setAxisLockThreshold(AxisLockThreshold);
     //To enable touch and drag scrolling
     m_gestureRecognizer.setMinimumVelocity(MinimumScrollVelocity);
 
-    setWidget(webAnimationItem);
-    //FIX ME : Revisit this code. Duplicate info sharing!
-    webAnimationItem->setViewportMetaData(m_viewportMetaData);
+    grabGesture(QStm_Gesture::assignedType());
+    connect(this, SIGNAL(viewScrolled(QPoint&, QPoint&)), scrolledWidget, SLOT(viewScrolled(QPoint&, QPoint&)));
+    installEventFilter(this);
+}
 
+void ScrollableWebContentView::initScrollHelper()
+{
+    qreal decel = BedrockSettings->value("KineticDeceleration").toDouble();
+    m_scrollHelper->setDeceleration(decel);
 
-    m_tileUpdateEnableTimer.setSingleShot(true);
-    connect(&m_tileUpdateEnableTimer, SIGNAL(timeout()), webAnimationItem, SLOT(enableContentUpdates()));
+    qreal maxFlickKoef = BedrockSettings->value("MaxFlickInViewportUnits").toDouble();
+    qreal minFlickKoef = BedrockSettings->value("MinFlickInViewportUnits").toDouble();
+    qreal midFlickKoef = BedrockSettings->value("MidFlickInViewportUnits").toDouble();
+    m_scrollHelper->setFlickLimits(minFlickKoef, midFlickKoef, maxFlickKoef);
 
-    //Setup zooming animator
-    m_zoomAnimator = new QPropertyAnimation(webAnimationItem, "geometry");
-    m_zoomAnimator->setDuration(ZoomAnimationDuration);
-    connect(m_zoomAnimator, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), this, SLOT(zoomAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+    qreal maxFlickSpeed = BedrockSettings->value("MaxFlickSpeed").toDouble();
+    qreal minFlickSpeed = BedrockSettings->value("MinFlickSpeed").toDouble();
+    qreal midFlickSpeed = BedrockSettings->value("MidFlickSpeed").toDouble();
+    m_scrollHelper->setFlickSpeedLimits(minFlickSpeed, midFlickSpeed, maxFlickSpeed);
+
+    int maxFlickDuration = BedrockSettings->value("MaxFlickDuration").toInt();
+    int minFlickDuration = BedrockSettings->value("MinFlickDuration").toInt();
+    int midFlickDuration = BedrockSettings->value("MidFlickDuration").toInt();
+    m_scrollHelper->setFlickDurationLimits(minFlickDuration, midFlickDuration, maxFlickDuration);
+    
+    connect(m_scrollHelper, SIGNAL(scrollFinished()), this, SLOT(stopScrolling()));
     
     m_gesturesEnabled = true;
 }
@@ -84,116 +154,277 @@
 ScrollableWebContentView::~ScrollableWebContentView()
 {
     delete m_viewportMetaData;
-    delete m_kineticScroller;
-
     if(m_zoomAnimator) {
         m_zoomAnimator->stop();
         delete m_zoomAnimator;
     }
+    
+    m_touchDownTimer->stop();
+    delete m_touchDownTimer;
+    
+    m_hoverTimer->stop();
+    delete m_hoverTimer;
+
 }
 
-WebContentAnimationItem* ScrollableWebContentView::viewportWidget() const
-{
-    return qobject_cast<WebContentAnimationItem*>(scrollWidget());
-}
-
-void ScrollableWebContentView::zoomToScreenCenter(bool zoomIn)
+void ScrollableWebContentView::stepZoom(bool zoomIn)
 {
     //If viewport metadata has user scalable false.
     //Do not zoom.
     if (!m_viewportMetaData->m_userScalable)
         return;
 
+    if (isZooming()) {
+        stopZoomAnimation();
+        return;
+    }
+    
     qreal scale = 1;
     scale += ZoomStep;
 
     if (!zoomIn)
         scale = 1/scale;
 
-    qreal curScale =  viewportWidget()->zoomScale();
+    qreal curScale =  scrollWidget()->scale();
+    qreal destScale = curScale * scale;
 
-    if (zoomIn && (curScale * scale > m_viewportMetaData->m_maximumScale))
-        scale = m_viewportMetaData->m_maximumScale / curScale;
-    else if (!zoomIn && (curScale * scale < m_viewportMetaData->m_minimumScale))
-        scale = m_viewportMetaData->m_minimumScale / curScale;
+    if (zoomIn && (destScale > m_viewportMetaData->m_maximumScale))
+        destScale = m_viewportMetaData->m_maximumScale;
+    else if (!zoomIn && (destScale < m_viewportMetaData->m_minimumScale))
+        destScale = m_viewportMetaData->m_minimumScale;
 
-    if(scale == 1.)
+    if(destScale == curScale)
         return;
 
     //Screen center
-    QPointF scrCenter(size().width()/2, size().height()/2);
-    //Map screen center to document
-    QPointF docPoint(viewportWidget()->mapFromScene(scrCenter));
-    //Maintain that spot in the same point on the viewport
-    QPointF docPointInScr(viewportWidget()->mapToParent(docPoint));
-    startZoomAnimToItemHotspot(docPoint, docPointInScr, scale);
+    //QPointF zoomHotSpot(size().width()/2, size().height()/2); //center zoom looks ugly in some cases
+    QPointF zoomHotSpot(0, 0);
+    
+    startZoomAnimationToHotSpot(zoomHotSpot, destScale);
+}
+
+
+int ScrollableWebContentView::zoomAnimationTime(bool zoomIn, qreal targetScale)
+{
+    qreal curScale = zoomScale(); 
+    qreal scaleRatio = zoomIn ? (targetScale / curScale) :
+                            1.2 * (curScale / targetScale);
+    qreal fullScaleRatio = (m_viewportMetaData->m_maximumScale / m_viewportMetaData->m_minimumScale);
+    return MaxZoomAnimationDuration * scaleRatio / fullScaleRatio;
+}
+
+void ScrollableWebContentView::toggleZoom(bool zoomIn)
+{
+    m_scrollHelper->stopScrollNoSignal();
+    if (isZooming()) {
+        stopZoomAnimation();
+        commitZoom();
+        return;
+    }
+    qreal scale = zoomIn ? m_viewportMetaData->m_maximumScale : m_viewportMetaData->m_minimumScale;
+    int t = zoomAnimationTime(zoomIn, scale);
+    QPointF zoomHotSpot(0, 0);
+    startZoomAnimationToHotSpot(zoomHotSpot, scale, t);
+}
+
+QRectF ScrollableWebContentView::viewportRectInPageCoord(const QPointF& viewportHotSpot, 
+                                                         const qreal destScale)
+{
+    QSizeF vpSize = size();
+    QSizeF contentSize = webView()->size();
+    QSizeF scaleVpSize(vpSize.width() / destScale, vpSize.height() / destScale);
+    QPointF contentHotSpot = webView()->mapFromParent(viewportHotSpot);
+    QPointF scaledHotSpot = viewportHotSpot / destScale; 
+    QRectF destViewRect( contentHotSpot - scaledHotSpot, scaleVpSize);
+    return destViewRect;
 }
 
-ZoomMetaData ScrollableWebContentView::currentPageInfo()
+void ScrollableWebContentView::startZoomAnimationToHotSpot(const QPointF& viewportHotSpot, 
+                                                           const qreal destScale, int animTime)
 {
-    ZoomMetaData data;
+    QRectF destViewRect = viewportRectInPageCoord(viewportHotSpot, destScale);
+    startZoomAnimation(destViewRect, animTime);
+}
 
-    data.initialScale = m_viewportMetaData->m_initialScale;
-    data.minScale = m_viewportMetaData->m_minimumScale;
-    data.maxScale = m_viewportMetaData->m_maximumScale;
-    data.userScalable = m_viewportMetaData->m_userScalable;
-    data.m_specifiedWidth = m_viewportMetaData->m_specifiedData.m_width;
-    data.m_specifiedHeight= m_viewportMetaData->m_specifiedData.m_height;
-
-    data.rect = viewportWidget()->geometry();
-    data.scale = viewportWidget()->zoomScale();
-    data.webViewSize = viewportWidget()->webView()->geometry();
-    data.viewportSize = size();
-
-    return data;
+void ScrollableWebContentView::zoomToHotSpot(const QPointF& viewportHotSpot, const qreal destScale)
+{
+    QRectF destViewRect = viewportRectInPageCoord(viewportHotSpot, destScale);
+    destViewRect = validateViewportRect(destViewRect);
+    setViewableRect(destViewRect);
 }
 
-void ScrollableWebContentView::setCurrentPageInfo(ZoomMetaData data)
+WebPageData ScrollableWebContentView::pageDataFromViewportInfo()
 {
+    if(!m_viewportMetaData->m_isValid) return WebPageData();
+
+    // No viewport data saving or restoring for superpages
+    if(isSuperPage()) return WebPageData();
+
+    // invalidate viewport meta data after saving to history
+    // cannot do it earlier because loadStarted event comes earlier than save to history
+    if(m_isLoading)
+        m_viewportMetaData->m_isValid = false;
+
+    bool fitToScreen = qFuzzyCompare(m_viewportMetaData->m_width / webView()->size().width(), zoomScale());
+
+    return WebPageData(m_viewportMetaData->m_maximumScale, m_viewportMetaData->m_minimumScale,
+                       m_viewportMetaData->m_userScalable, m_viewportMetaData->m_initialScale,
+                       geometry(), webView()->geometry(), scrollWidget()->scale(), size(),
+                       m_viewportMetaData->m_specifiedData.m_width, m_viewportMetaData->m_specifiedData.m_height,
+                       fitToScreen);
+}
+
+QSizeF ScrollableWebContentView::parentSize() const
+{
+    return static_cast<QGraphicsWidget*>(parentItem())->size();
+}
+
+void ScrollableWebContentView::setPageDataToViewportInfo(const WebPageData& data)
+{
+    if(!data.isValid()) return;
+
+    // No viewport data saving or restoring for superpages
+    if(isSuperPage()) return;
+
     m_viewportMetaData->m_initialScale = data.initialScale;
     m_viewportMetaData->m_minimumScale = data.minScale;
     m_viewportMetaData->m_maximumScale = data.maxScale;
     m_viewportMetaData->m_userScalable = data.userScalable;
-    m_viewportMetaData->m_specifiedData.m_width = data.m_specifiedWidth;
-    m_viewportMetaData->m_specifiedData.m_height = data.m_specifiedHeight;
+    m_viewportMetaData->m_specifiedData.m_width = data.specifiedWidth;
+    m_viewportMetaData->m_specifiedData.m_height = data.specifiedHeight;
     m_viewportMetaData->m_isValid = true;
+    m_viewportMetaData->m_width = data.viewportSize.width();
+    m_viewportMetaData->m_height = data.viewportSize.height();
 
-    m_viewportMetaData->m_width = data.webViewSize.width();
-    m_viewportMetaData->m_height = data.webViewSize.height();
+
+    if(m_viewportMetaData->m_width < 0 ||
+       m_viewportMetaData->m_width < 0) {
+        m_viewportMetaData->m_isValid = false;
+        reset();
+        return;
+    }
+
+    QSizeF newSize = parentSize();
+    if(newSize.isEmpty())
+        newSize = data.viewportSize;
+
+    disableContentUpdates();
+    //    updateViewportMetaDataFromPageTag();
+
+
+    QSizeF vpSz(m_viewportMetaData->m_width, m_viewportMetaData->m_height);
+    if(vpSz.isEmpty())
+        vpSz = newSize;
+
+    // sometimes on load from history webpage doesn't resize webView
+    // set correct size of webView here
+    webView()->setGeometry(QRectF( QPointF(0, 0),
+                                   QSizeF(webView()->page()->mainFrame()->contentsSize())));
+
+    qreal sc = data.scale; //qBound(m_viewportMetaData->m_minimumScale,data.scale,m_viewportMetaData->m_maximumScale);
+    webView()->setScale(sc);
 
-    viewportWidget()->webView()->setGeometry(data.webViewSize);
-    viewportWidget()->setZoomScale(data.scale, true);
-    viewportWidget()->setGeometry(data.rect);
+//    qreal fitToScreenScale = data.viewportSize.width() / webView()->size().width();
+//    bool isFitToScreen = qFuzzyCompare(zoomScale(), fitToScreenScale);
+    adjustViewportSize(data.viewportSize, newSize);
+    m_viewportMetaData->adjustZoomValues(webView()->size());
+    if(data.fitToScreen && newSize.width() != vpSz.width()) {
+        qreal fitToScreenScale = size().width() / webView()->size().width();
+        fitToScreenScale = qBound(m_viewportMetaData->m_minimumScale,
+                                  fitToScreenScale,m_viewportMetaData->m_minimumScale);
+        webView()->setScale(fitToScreenScale);
+    }
+//    else
+//       updatePreferredContentSize();
+
+    if (newSize.width() != m_viewportMetaData->m_width ||
+        newSize.height() != m_viewportMetaData->m_height) {
+        //setGeometry(0, 0, m_viewportMetaData->m_width, m_viewportMetaData->m_height);
+        m_scrollHelper->setViewportSize(size());
+    }
+
 
-    if (data.viewportSize.width() != size().width())
-        adjustViewportSize(data.viewportSize, size());
+    if (data.webViewRect.isValid()) {
+        QPointF webViewPos = data.webViewRect.topLeft();
+        qreal newSc = webView()->scale(); // might be adjust by fitToScreen
+        webViewPos = webViewPos / sc * newSc; // recalc pos if scale changed by fitToScreen
+        QSizeF ss = webView()->size() * newSc;
+        if(!ss.isEmpty()) {
+            webViewPos.setX(qBound((qreal)m_viewportMetaData->m_width - (qreal)ss.width(), (qreal)webViewPos.x(), (qreal)0.0));
+            webViewPos.setY(qBound((qreal)m_viewportMetaData->m_height - (qreal)ss.height(), (qreal)webViewPos.y(), (qreal)0.0));
+            if(ss.width() < m_viewportMetaData->m_width) webViewPos.setX(0);
+            if(ss.height() < m_viewportMetaData->m_height) webViewPos.setY(0);
+        }
+        setScrollWidgetPos(webViewPos);
+    }
+    enableContentUpdates();
+//    updatePreferredContentSize();
+    
+
+    // emit scrolled event to hide/show url bar
+
+    QPoint p(0, 0);
+    if(!m_isLoading) {
+        p = scrollPosition();
+    }
+    QPoint d(0, 0);
+    emit viewScrolled(p, d);
+
 }
 
-ZoomMetaData ScrollableWebContentView::defaultZoomData()
+WebPageData ScrollableWebContentView::defaultZoomData()
 {
-    ZoomMetaData data;
+    WebPageData data;
 
+    data.magic = 0;
     data.initialScale = m_viewportMetaData->m_initialScale;
     data.minScale = m_viewportMetaData->m_minimumScale;
     data.maxScale = m_viewportMetaData->m_maximumScale;
     data.userScalable = m_viewportMetaData->m_userScalable;
 
     data.scale = 1.0;
-    data.rect = QRectF();
-    data.webViewSize = QRectF();
-    data.viewportSize = QSizeF();
+    data.rect = rect();
+    data.webViewRect = webView()->rect();
+    data.viewportSize = QSizeF(m_viewportMetaData->m_width, m_viewportMetaData->m_height);
 
     return data;
 }
 
 void ScrollableWebContentView::updatePreferredContentSize()
 {
-    viewportWidget()->updatePreferredContentSize(QSize(m_viewportMetaData->m_width
-                                                       , m_viewportMetaData->m_height));
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    // Don't call updatePreferredContentSize() if we've over-ridden user-scalable because it
+    // resets the content size and zoom factor.
+    if(m_viewportMetaData->m_userScalableOverRidden)
+        return;
+#endif
+    QSize s = m_viewportMetaData->getSpecifiedSize();
+/*    if (!isSuperPage()) {
+        prefferedHeight = qMax(m_viewportMetaData->m_width, m_viewportMetaData->m_height);
+        prefferedWidth = m_viewportMetaData->m_width;        
+        if(m_viewportMetaData->m_width * 1.5 < prefferedHeight) {
+            // If the screen sides ratio is less than 3:2, than vertical width is
+            // too narrow for normal page layout, but setting preffered width to the biggest side
+            // makes page too scaled. Because of this set the page to the average of 2 viewport sides.
+            prefferedWidth = (m_viewportMetaData->m_width + prefferedHeight) / 2;
+        }
+    }
+
+//    if(m_viewportMetaData->m_specifiedData.)
+*/
+    webView()->page()->setPreferredContentsSize(s);
+}
+                                                                                                                                                                                                                                                                
+void ScrollableWebContentView::setPage(QWebPage* page)
+{
+    m_isSuperPage = false;
+    m_gesturesEnabled = true;
+    webView()->setPage(page);
 }
 
 void ScrollableWebContentView::setSuperPage()
 {
+    m_isSuperPage = true;
     m_viewportMetaData->m_initialScale = 1.;
     m_viewportMetaData->m_minimumScale = 1.;
     m_viewportMetaData->m_maximumScale = 1.;
@@ -201,17 +432,41 @@
     m_viewportMetaData->m_specifiedData.m_height = "device-height";
     m_viewportMetaData->m_userScalable = false;
 
-    QSize contentSize = viewportWidget()->contentsSize();
-    QRect webViewRect(0, 0, size().width(), contentSize.height());
-    viewportWidget()->webView()->setGeometry(webViewRect);
-    viewportWidget()->setZoomScale(1., true);
-    viewportWidget()->setGeometry(webViewRect);
+    disableContentUpdates();
+    webView()->setScale(1.);
+    //QSize contentSize = (webView()->size() * zoomScale()).toSize();
+    //QRect webViewRect(0, 0, size().width(), contentSize.height());
+    //webView()->setGeometry(webViewRect);
+    setScrollWidgetPos(QPointF(0, 0));
 
     m_viewportMetaData->m_width = size().width();
     m_viewportMetaData->m_height = size().height();
     m_viewportMetaData->m_isValid = true;
+    enableContentUpdates();
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    updatePreferredContentSize();
+    //viewportWidget()->updatePreferredContentSize(QSize(m_viewportMetaData->m_width
+     //                                                  , m_viewportMetaData->m_height));
+#else
+    updatePreferredContentSize();
+#endif
+}
 
-    updatePreferredContentSize();
+void ScrollableWebContentView::updateViewportMetaDataFromPageTag()
+{
+    QWebPage* page = webView()->page();
+    if (!page)
+        return;
+
+    QWebFrame* frame = page->mainFrame();
+    QMap<QString, QString> metaData = frame->metaData();
+    QString viewportTag = metaData.value("viewport");
+
+    QRect clientRect = geometry().toAlignedRect();
+    ViewportMetaDataParser parser(clientRect);
+    parser.parse(viewportTag, *m_viewportMetaData);
+
+    m_viewportMetaData->adjustZoomValues(webView()->size());
 }
 
 void ScrollableWebContentView::reset()
@@ -222,65 +477,902 @@
     // page->mainFrame() to get the metaData so that we use the meta data of the corresponding
     // frame
 
-    QWebPage* page = viewportWidget()->webView()->page();
+    QWebPage* page = webView()->page();
     if (!page)
         return;
+//    if(m_viewportMetaData->m_isValid) return;
 
     //Initialize viewport metadata
     m_viewportMetaData->reset();
 
-    QWebFrame* frame = page->mainFrame();
-    QMap<QString, QString> metaData = frame->metaData();
-    QString viewportTag = metaData.value("viewport");
+    disableContentUpdates();
+
+    webView()->setScale(1);
+
+    // sometimes on load from history webpage doesn't resize webView
+    // set correct size of webView here
+    webView()->setGeometry(QRectF( QPointF(0, 0),
+                                   QSizeF(webView()->page()->mainFrame()->contentsSize())));
+
+    updateViewportMetaDataFromPageTag();
+
+    //setViewportWidgetGeometry(QRectF(QPointF(),
+    //                                 QSize(m_viewportMetaData->m_width, m_viewportMetaData->m_height)));
 
-    QRect clientRect = geometry().toAlignedRect();
-    ViewportMetaDataParser parser(clientRect);
-    *m_viewportMetaData = parser.parse(viewportTag);
+    static const QPoint nullP(0,0);
+    setScrollPosition(nullP,nullP);
+
+    QSizeF sz(m_viewportMetaData->m_width, m_viewportMetaData->m_height);
+    adjustViewportSize(sz, size());
 
-    updatePreferredContentSize();
-    setViewportWidgetGeometry(QRectF(QPointF(),
-                                     QSize(m_viewportMetaData->m_width, m_viewportMetaData->m_height)
-                                     * m_viewportMetaData->m_initialScale));
+    qreal initScale = m_viewportMetaData->m_initialScale > 0 ? m_viewportMetaData->m_initialScale :
+                      m_viewportMetaData->m_width / webView()->size().width();
+    // m_viewportMetaData->m_initialScale = m_viewportMetaData->m_width / webView()->size().width();
+    webView()->setScale(initScale);
+
+    enableContentUpdates();
+
+    m_scrollHelper->setViewportSize(size());
+
+    // Update corrected viewport data back to webpage metadata
+    emit viewPortChanged();
 }
 
 void ScrollableWebContentView::contentsSizeChanged(const QSize& newContentSize)
 {
-    QRect clientRect = geometry().toAlignedRect();
-    m_viewportMetaData->updateViewportData(newContentSize, clientRect);
-    viewportWidget()->resize(QSize(m_viewportMetaData->m_width, m_viewportMetaData->m_height)
-                             * m_viewportMetaData->m_initialScale);
+    m_viewportMetaData->adjustZoomValues(newContentSize);
+    qreal sc = zoomScale();
+    sc = qBound(m_viewportMetaData->m_minimumScale, sc, m_viewportMetaData->m_maximumScale);
+    if(!qFuzzyCompare(sc, zoomScale()))
+        webView()->setScale(sc);
+    emit viewPortChanged();
+}
+
+void ScrollableWebContentView::pageLoadStarted()
+{
+    m_isLoading = true;
+//    m_viewportMetaData->m_isValid = false;
+}
+
+void ScrollableWebContentView::pageLoadProgress(int progress)
+{
 }
 
 void ScrollableWebContentView::pageLoadFinished(bool ok)
 {
     Q_UNUSED(ok);
-    QSize contentSize = viewportWidget()->contentsSize();
-    QRect clientRect = geometry().toAlignedRect();
-    m_viewportMetaData->updateViewportData(contentSize, clientRect);
+    m_isLoading = false;
+    if(!m_viewportMetaData->m_isValid)
+        m_viewportMetadataResetTimer.singleShot(0,this,SLOT(reset()));
+    else {
+        QSize contentSize = scrollWidget()->size().toSize();
+        m_viewportMetaData->adjustZoomValues(contentSize);
+    }
+
+    // report scroll position to hide url bar if necessary
+    QPoint p = scrollPosition();
+    QPoint d(0, 0);
+    emit viewScrolled(p, d);
+    
+    webView()->update(); // invalidate the view to force tiles update
+}
+
+
+void ScrollableWebContentView::zoomAtPoint(QPointF touchPoint)
+{
+    QRectF target;
+
+    //Get the focusable element rect from current touch position
+    if(isZoomedIn()) {
+        startZoomAnimationToHotSpot(touchPoint,size().width() / webView()->size().width());
+        return;
+    }
+
+    //Pass all events to recognizer
+    QRectF zoomRect = findZoomableRectForPoint(touchPoint);
+
+    if (!zoomRect.isValid()) {
+        //FIX ME: Add an event ignore animation
+        return;
+    }
+
+    startZoomAnimation(zoomRect);
+}
+
+
+void ScrollableWebContentView::setViewportWidgetGeometry(const QRectF& r)
+{
+    if(r != geometry()) {
+        setGeometry(r);
+        emit viewPortChanged();
+    }
+}
+
+
+bool ScrollableWebContentView::isZoomedIn() const
+{
+    qreal vpWidth = size().width();
+    qreal scaledContentWidth = scrollWidget()->size().width() * zoomScale(); 
+    qreal diff = scaledContentWidth - vpWidth; 
+    return  diff > 0.01f;
+}
+
+void ScrollableWebContentView::stateChanged(KineticScrollable::State oldState,
+                                            KineticScrollable::State newState)
+{
+    ScrollableViewBase::stateChanged(oldState, newState);
+
+    switch(newState) {
+        case KineticScrollable::Pushing :
+        case KineticScrollable::AutoScrolling :
+            m_tileUpdateEnableTimer.stop();
+            //disableContentUpdates();
+        break;
+        case KineticScrollable::Inactive :
+            m_tileUpdateEnableTimer.start(TileUpdateEnableDelay);
+        break;
+    }
+}
+
+QRectF ScrollableWebContentView::validateViewportRect(const QRectF& rect)
+{
+    QRectF ret(rect);
+
+    if(ret.right() > webView()->size().width())
+        ret.moveLeft(webView()->size().width() - ret.width());
+    if(ret.bottom() > webView()->size().height())
+        ret.moveTop(webView()->size().height() - ret.height());
+    if(ret.x() < 0) ret.moveLeft(0);
+    if(ret.y() < 0) ret.moveTop(0);
+//    if(ret.width() > webView()->size().width()) ret.setWidth(webView()->size().width());
+    if(ret.width() > webView()->size().width())
+        ret.moveLeft(0); // do not center! ret.moveLeft(webView()->size().width() / 2 - ret.width() / 2);
+    if(ret.height() > webView()->size().height())
+        ret.moveTop(0); // do not center! ret.moveTop(webView()->size().height() / 2 - ret.height() / 2);
+
+    return ret;
+}
+
+QRectF ScrollableWebContentView::viewableRect()
+{
+    return webView()->mapRectFromParent(geometry());
+}
+
+void ScrollableWebContentView::setViewableRect(const QRectF& rect)
+{
+    qreal scale = size().width() / rect.width(); 
+    qstmDebug() << "setViewableRect: rect: " << rect << ", scale: " << scale << "\n";
+    setZoomScale(scale, false);
+    m_isScrolling = true;
+    scrollPageTo(rect.topLeft());
+    m_isScrolling = false;
+}
+
+void ScrollableWebContentView::startZoomAnimation(const QRectF& destViewRect, int animTime)
+{
+    if (webView()->geometry().isValid()) {
+        m_zoomAnimator->setDuration(animTime);
+        m_zoomAnimator->setStartValue(webView()->mapRectFromParent(geometry()));
+        m_animationEndRect = validateViewportRect(destViewRect);
+        m_zoomAnimator->setEndValue(m_animationEndRect);
+        m_zoomAnimator->start();
+    }
+}
+
+void ScrollableWebContentView::stopZoomAnimation()
+{
+    m_zoomAnimator->stop();
+}
+
+void ScrollableWebContentView::zoomAnimationStateChanged(QAbstractAnimation::State newState,QAbstractAnimation::State)
+{
+    switch (newState) {
+    case QAbstractAnimation::Stopped:
+        commitZoom();
+        break;
+    case QAbstractAnimation::Running:
+        disableContentUpdates();
+        break;
+    default:
+        break;
+    }
+}
+
+void ScrollableWebContentView::resizeEvent(QGraphicsSceneResizeEvent* event)
+{
+    //Ignore resize when chrome is being still setup
+    if (event->oldSize().width()) {
+
+        qreal fitToScreenScale = event->oldSize().width() / webView()->size().width();
+        bool isFitToScreen = qFuzzyCompare(zoomScale(), fitToScreenScale);
+        QGraphicsWidget::resizeEvent(event);
+        adjustViewportSize(event->oldSize(), event->newSize());
+        if (isFitToScreen && !isSuperPage()) {
+            QPointF docViewTopLeft(webView()->mapFromParent(QPointF(0,0)));
+            fitToScreenScale = size().width() / webView()->size().width();
+            zoomToHotSpot(docViewTopLeft, fitToScreenScale);
+            m_zoomCommitTimer.start(ZoomCommitDuration);
+        } else {
+            QRectF viewRect = mapRectToItem(webView(), QRectF(QPointF(0,0), size()));
+            QRectF validRect = validateViewportRect(viewRect);
+            if(validRect != viewRect)
+                setViewableRect(validRect);
+        }
+        m_scrollHelper->setViewportSize(size());
+    }
+
+#ifdef OWN_BACKING_STORE
+    webView()->viewportUpdated();
+#endif // OWN_BACKING_STORE
+}
+
+bool  ScrollableWebContentView::isChangedToPortrait(QSizeF oldSize, QSizeF newSize)
+{
+    return (oldSize.width() > oldSize.height()) && 
+           (newSize.width() < newSize.height());
+}
+
+bool  ScrollableWebContentView::isChangedToLandscape(QSizeF oldSize, QSizeF newSize)
+{
+    return (oldSize.width() < oldSize.height()) && 
+           (newSize.width() > newSize.height());
+    emit mouseEvent(QEvent::GraphicsSceneMouseRelease);
+}
+
+bool ScrollableWebContentView::isOrientationChanged(QSizeF oldSize, QSizeF newSize)
+{
+    return isChangedToPortrait(oldSize, newSize) || 
+           isChangedToLandscape(oldSize, newSize);
+}
+
+
+void ScrollableWebContentView::adjustViewportSize(QSizeF oldSize, QSizeF newSize)
+{
+    if(newSize.isNull()) return;
+
+    if (isOrientationChanged(oldSize, newSize)) {
+        m_viewportMetaData->orientationChanged(oldSize);
+    }
+    m_viewportMetaData->adjustViewportData(newSize);
+    updatePreferredContentSize();
+    return;    
+}
+
+void ScrollableWebContentView::sendEventToWebKit(QEvent::Type type, const QPointF& scenePos, bool select)
+{
+    QGraphicsSceneMouseEvent event(type);
+    qstmSetGraphicsSceneMouseEvent(scenePos, webView(), event, select);
+    webView()->page()->event(&event);
+}
+
+void ScrollableWebContentView::disableContentUpdates()
+{
+    if (m_zoomCommitTimer.isActive()) {
+        m_zoomCommitTimer.stop();
+    }
+    webView()->setTiledBackingStoreFrozen(true);
+}
+
+void ScrollableWebContentView::enableContentUpdates()
+{
+    webView()->setTiledBackingStoreFrozen(false);
+}
+
+void ScrollableWebContentView::commitZoom()
+{         
+    m_zoomCommitTimer.stop();
+    notifyZoomActions(zoomScale());
+    enableContentUpdates();
+    emit scaleChanged(zoomScale());
+}
+
+WebView* ScrollableWebContentView::webView() const
+{
+    return static_cast<WebView*>(scrollWidget());
+}
+
+void ScrollableWebContentView::setZoomScale(qreal value, bool immediateCommit)
+{
+    value = qBound(m_viewportMetaData->m_minimumScale, value, m_viewportMetaData->m_maximumScale);
+    qreal curZoomScale = zoomScale();
+
+    if (qFuzzyCompare(value, curZoomScale)) {
+        notifyZoomActions(curZoomScale);
+        return;
+    }
+
+    if (!immediateCommit)
+        disableContentUpdates();
+
+    webView()->setScale(value);
+
+    if (immediateCommit)
+        commitZoom();
+//    else
+//        m_zoomCommitTimer.start(ZoomCommitDuration);
+}
+
+qreal ScrollableWebContentView::zoomScale() const
+{
+    if (!webView())
+        return 1.;
+
+    return webView()->scale();
+}
+
+QRectF ScrollableWebContentView::findZoomableRectForPoint(const QPointF& point)
+{
+    QPointF zoomPoint = webView()->mapFromParent(point);
+
+    QWebHitTestResult hitResult = webView()->page()->mainFrame()->hitTestContent(zoomPoint.toPoint());
+    QWebElement targetElement = hitResult.enclosingBlockElement();
+
+    while (!targetElement.isNull() && targetElement.geometry().width() < MinDoubleClickZoomTargetWidth)
+        targetElement = targetElement.parent();
+
+    if (!targetElement.isNull()) {
+        QRectF elementRect = targetElement.geometry();
+        qreal overMinWidth = elementRect.width() - ZoomableContentMinWidth;
+        if (overMinWidth < 0)
+            elementRect.adjust(overMinWidth / 2, 0, -overMinWidth / 2, 0);
+        qreal destScale = size().width() / elementRect.width();
+        QPointF rectPoint(elementRect.x(),zoomPoint.y() - point.y() / destScale);
+        return QRectF(rectPoint, elementRect.size());
+    }
+    return QRectF();
+}
+
+void ScrollableWebContentView::notifyZoomActions(qreal newScale)
+{
+    bool enableZoomIn = false;
+    bool enableZoomOut = false;
+
+    if (m_viewportMetaData->m_userScalable) {
+
+        if (newScale > m_viewportMetaData->m_minimumScale)
+            enableZoomOut = true;
+        else
+            enableZoomOut = false;
+
+        if (newScale < m_viewportMetaData->m_maximumScale)
+            enableZoomIn = true;
+        else
+            enableZoomIn = false;
+    }
+
+    emit updateZoomActions(enableZoomIn, enableZoomOut);
+}
+
+
+
+bool ScrollableWebContentView::eventFilter(QObject* o, QEvent* e)
+{
+    if (o != scrollWidget()) return false;
+    bool ret = false;
+
+    if (m_gesturesEnabled) {
+            ret = QStm_GestureEventFilter::instance()->eventFilter(o, e);
+        }
+
+    // Superpages should never receive contextmenu events
+    if (isSuperPage() && (e->type() == QEvent::GraphicsSceneContextMenu || e->type() == QEvent::ContextMenu))
+        ret = true;
+    
+    return ret;
+}
+
+bool ScrollableWebContentView::event(QEvent * e) 
+{
+    if (e->type() == QEvent::Gesture && m_gesturesEnabled) {
+          QStm_Gesture* gesture = getQStmGesture(e);
+          if (gesture) {
+              bool ret = handleQStmGesture(gesture);
+              if (gesture->getGestureStmType() == QStmTouchGestureType)
+                  e->accept();
+              return ret;
+          }
+    }
+    return QGraphicsWidget::event(e);
+}
+
+
+
+bool  ScrollableWebContentView::handleQStmGesture(QStm_Gesture* gesture)
+{
+#ifdef OWN_BACKING_STORE
+    // Signal tiling to minimize tile update activity while user does something
+    webView()->userActivity();
+#endif
+    QStm_GestureType type = gesture->getGestureStmType();
+    bool ret = false;
+    switch (type) {
+        case QStmTapGestureType:
+        {
+            ret = doTap(gesture);
+            break;
+        }
+
+        case QStmMaybeTapGestureType:
+        {
+            ret = doMaybeTap(gesture);
+            break;
+        }
 
-    viewportWidget()->resize(QSize(m_viewportMetaData->m_width, m_viewportMetaData->m_height)
-                             * m_viewportMetaData->m_initialScale);
-    viewportWidget()->setZoomScale(m_viewportMetaData->m_initialScale, true);
+        case QStmReleaseGestureType:
+        {
+            ret = doRelease(gesture);
+            break;
+        }
+        case QStmLeftRightGestureType:
+        {
+            ret = doLeftRight(gesture);
+            break;
+        }
+        case QStmUpDownGestureType:
+        {
+            ret = doUpDown(gesture);
+            break;
+        }
+        case QStmPanGestureType:
+        {
+            ret = doPan(gesture);
+            break;
+        }
+        case QStmFlickGestureType:
+        {
+            ret = doFlick(gesture);
+            break;
+        }
+        case QStmDoubleTapGestureType:
+        {
+            ret = doDoubleTap(gesture);
+            break;
+        }
+        case QStmTouchGestureType:
+        {
+            ret = doTouch(gesture);
+            break;
+        }
+        case QStmPinchGestureType:
+        {
+            ret = doPinch(gesture);  
+            break;
+        }
+        case QStmLongPressGestureType:
+        {
+            ret = doLongPress(gesture);
+            break;
+        }
+        
+        default: 
+        {
+            ret = true;
+        }
+    }
+    
+    return ret;
+}
+
+QWebHitTestResult  ScrollableWebContentView::hitTest(const QPointF& scenePos)
+{
+    QPointF contextPt = webView()->mapFromScene(scenePos);
+    QWebPage* page = webView()->page();
+    return page->currentFrame()->hitTestContent(contextPt.toPoint()); 
+}
+
+
+
+bool ScrollableWebContentView::toggleVkb()
+{
+    bool inputEnabled = false;
+    QInputContext *ic = qApp->inputContext();
+    if (m_hitTest.isContentEditable()) {
+        QEvent sipe(QEvent::RequestSoftwareInputPanel);
+        ic->filterEvent(&sipe);
+        inputEnabled = true;
+    }
+    else {
+        QEvent sipe(QEvent::CloseSoftwareInputPanel);
+        ic->filterEvent(&sipe);
+
+    }
+    m_isInputOn = inputEnabled;
+    return inputEnabled;
+}
+
+bool  ScrollableWebContentView::toggleInputMethod(bool on)
+{
+    QGraphicsView* gv = qstmGetGraphicsView(webView());
+    bool oldInputEnabled = false;
+    if (gv != NULL) {
+        gv->testAttribute(Qt::WA_InputMethodEnabled);
+        gv->setAttribute(Qt::WA_InputMethodEnabled, on);
+    }
+    m_isInputOn = on;
+    return oldInputEnabled;
+}
+
+bool  ScrollableWebContentView::inputMethodEnabled()
+{
+#ifdef ORBIT_UI
+    HbInputMethod* im = HbInputMethod::activeInputMethod();
+    
+    QGraphicsView* gv = qstmGetGraphicsView(webView());
+    bool enabled = false;
+    if (gv) {
+        enabled = gv->testAttribute(Qt::WA_InputMethodEnabled);
+    }
+    return enabled; 
+#else
+    return false;
+#endif // ORBIT_UI
+}
+
+bool  ScrollableWebContentView::doLongPress(QStm_Gesture* gesture)
+{
+    bool willHandle = m_gesturesEnabled && !isSuperPage();
+    if (willHandle) {
+//        QWebPage* page = webView()->page();
+        QPoint gpos = gesture->position();
+        QPointF pos = qstmMapToScene(gpos, this);
+//        QPointF contextPt = webView()->mapFromScene(pos);
+        //QWebHitTestResult result = page->currentFrame()->hitTestContent(contextPt.toPoint());
+    //Notify context menu observers
+        emit contextEventObject(&m_hitTest, pos);
+        m_ignoreNextRelease = true;
+    }
+    return willHandle;
+}
+
+
+
+bool ScrollableWebContentView::doTouch(QStm_Gesture* gesture)
+{
+    bool willHandle = m_gesturesEnabled;
+    m_scrollHelper->stopScrollNoSignal();
+    m_touchDownPos = gesture->scenePosition(this);
+    if (!isSuperPage()) {
+        m_hitTest = hitTest(m_touchDownPos);
+        //toggleInputMethod(false);
+        qreal scale = zoomScale();
+
+        m_hoverTimer->stop();
+        m_hoverTimer->setSingleShot(true);
+        
+        m_touchDownTimer->stop();
+        m_touchDownTimer->setSingleShot(true);
+                
+        m_touchDownTimer->start(TouchDownTimeout, this);
+        m_hoverTimer->start(HoverTimeout, this);
+    }
+    else {
+        sendEventToWebKit(QEvent::GraphicsSceneMousePress, m_touchDownPos);
+    }
+    return willHandle;
+}
+
+void ScrollableWebContentView::touchDownCallback()
+{
+    m_touchDownTimer->stop();
+    if (m_gesturesEnabled) {
+        sendEventToWebKit(QEvent::GraphicsSceneMousePress, m_touchDownPos);
+    }
+}
+
+void ScrollableWebContentView::hoverCallback()
+{
+    m_hoverTimer->stop();
+    if (m_gesturesEnabled && !isSuperPage()) {
+        sendEventToWebKit(QEvent::GraphicsSceneMouseMove, m_touchDownPos);
+    }
+}
+
+
+bool ScrollableWebContentView::doTap(QStm_Gesture* gesture)
+{
+    bool willHandle = m_gesturesEnabled;
+    if (willHandle && !isSuperPage()) {
+        QPointF pos = gesture->scenePosition(this);
+        bool hasInputMethod = toggleVkb();
+        sendEventToWebKit(QEvent::GraphicsSceneMouseRelease, pos);
+        emit contentViewMouseEvent(QEvent::GraphicsSceneMouseRelease);
+    }
+    return willHandle;
+}
+
+bool ScrollableWebContentView::doMaybeTap(QStm_Gesture* gesture)
+{
+    bool willHandle = m_gesturesEnabled;
+    if (willHandle && isSuperPage()) {
+        QPointF pos = gesture->scenePosition(this);
+        sendEventToWebKit(QEvent::GraphicsSceneMouseRelease, pos);
+    }
+    return willHandle;
+}
+
+#ifdef USE_KINETIC_SCROLLER
+bool ScrollableWebContentView::doPan(QStm_Gesture* gesture)
+{
+    if (m_touchDownTimer->isActive()) {
+        m_touchDownTimer->stop();
+    }
+    
+    QStm_GestureType type = gesture->getGestureStmType();
+    bool willHandle = m_gesturesEnabled;
+    
+    if (willHandle) {
+        QPoint scrollPos = ScrollableViewBase::scrollPosition();
+        QPoint delta = gesture->getLengthAndDirection();
+        delta.ry() = -delta.y();
+        m_kineticScroller->doPan(delta);
+    }
+    return willHandle;
+}
+#else
+
+
+bool ScrollableWebContentView::doLeftRight(QStm_Gesture* gesture)
+{
+    bool ret = true;
+    if (m_hitTest.isContentEditable() && m_isInputOn) {
+        QPointF pos = gesture->scenePosition(this);
+        sendEventToWebKit(QEvent::GraphicsSceneMouseMove, pos, true);
+    }
+    else {
+        ret = doPan(gesture);
+    }
+    return ret;
 }
 
+
+bool ScrollableWebContentView::doUpDown(QStm_Gesture* gesture)
+{
+    bool ret = true;
+    if (m_hitTest.isContentEditable() && m_isInputOn) {
+        QPointF pos = gesture->scenePosition(this);
+        sendEventToWebKit(QEvent::GraphicsSceneMouseMove, pos, true);
+    }
+    else {
+        ret = doPan(gesture);
+    }
+    return ret;
+}
+
+
+
+bool ScrollableWebContentView::doPan(QStm_Gesture* gesture)
+{
+    bool willHandle = m_gesturesEnabled;
+    if (m_hitTest.isContentEditable() && m_isInputOn) {
+        QPointF pos = gesture->scenePosition(this);
+        sendEventToWebKit(QEvent::GraphicsSceneMouseMove, pos, true);
+    }
+    else {
+        dehighlightWebElement();
+        if (willHandle) {
+            if (gesture->gestureState() != Qt::GestureFinished) {
+                QPointF delta = gesture->sceneLengthAndDirection(this);
+
+                if (isSuperPage()) {
+                    delta.rx() = 0.0;
+                }
+                else {
+                    //delta.rx() = -delta.x();
+                }
+            
+                //disableContentUpdates();
+                qstmDebug() << "doPan: gesture timestamp: " << gesture->timestamp().toString("hh:mm:ss.zzz") <<
+                        ", delta: " << delta << "\n";
+
+                m_scrollHelper->scroll(delta);
+            }
+        }
+    }
+    return willHandle;
+}
+#endif //USE_KINETIC_SCROLLER
+
+
+bool ScrollableWebContentView::doRelease(QStm_Gesture* gesture)
+{
+    bool willHandle = m_gesturesEnabled;
+    if (willHandle) {
+        if (m_ignoreNextRelease) {
+            m_ignoreNextRelease = false;
+        }
+        else if (m_scrollHelper->isScrolling()) {
+            m_scrollHelper->panFromOvershoot();
+//            enableContentUpdates();
+        }
+        else {
+            /*
+             * on tap we send mouseRelease
+             * assumption here is that we can get
+             * either tap or release gesture but not both.
+             */
+            doTap(gesture);
+        }
+    }
+    return willHandle;
+}
+
+#ifdef USE_KINETIC_SCROLLER
+bool ScrollableWebContentView::doFlick(QStm_Gesture* gesture)
+{
+    int direction = gesture->getDirection();
+    QStm_GestureType type = gesture->getGestureStmType();
+    bool willHandle = m_gesturesEnabled;
+    if (willHandle ) {          
+        m_kineticScroller->doFlick(90 * gesture->getSpeedVec());
+    }
+}
+
+#else
+bool ScrollableWebContentView::doFlick(QStm_Gesture* gesture)
+{    
+    bool willHandle = m_gesturesEnabled;
+    int afterPinch = m_pinchFinishTime.elapsed();
+    if (willHandle && afterPinch > 100 && m_scrollHelper->isScrolling()) {
+        dehighlightWebElement();
+        int direction = gesture->sceneDirection(this);
+        QPointF v = gesture->sceneSpeedVec(this);
+        QPointF vOrig = v;
+        qstmDebug() << "doFlick: timestamp: " << gesture->timestamp().toString("hh:mm:ss.zzz") <<
+                ", v: " << v << "\n";
+        if (v.x() != 0.0 || v.y() != 0.0) {
+            if (direction == EEast || direction == EWest) {
+                v.ry() = 0.0;
+            }
+            if (direction == ENorth || direction == ESouth) {
+                v.rx() = 0.0;
+            }
+            m_scrollHelper->kineticScroll(v);
+            //enableContentUpdates();
+            //m_tileUpdateEnableTimer.start(TileUpdateEnableDelay);
+        }
+        else if (afterPinch <= 500) {
+            qstmDebug() << "doFlick: Flick is too soon after pinch\n";
+        }
+    }
+    return willHandle;
+}
+#endif //USE_KINETIC_SCROLLER
+
+bool ScrollableWebContentView::doDoubleTap(QStm_Gesture* gesture)
+{
+    if (!m_gesturesEnabled || !m_viewportMetaData->m_userScalable) {
+        m_touchDownTimer->stop();
+        m_hoverTimer->stop();
+        return m_gesturesEnabled;    
+    }
+    dehighlightWebElement();
+    QPointF pos = gesture->scenePosition(this);
+    pos = mapFromScene(pos);
+    qstmDebug() << "doDoubleTap: zoom at pos: " << pos << "\n";
+    zoomAtPoint(pos);
+    
+    return m_gesturesEnabled;
+}
+
+#define square(x) (x)*(x)
+
+qreal ScrollableWebContentView::calcScale(int origDistance, QPointF p1, QPointF p2)
+{
+    qreal d1f = origDistance;
+    qreal dist = calcDistance(p1, p2);
+    return (dist/ d1f);
+}
+
+qreal ScrollableWebContentView::calcDistance(QPointF pt1, QPointF pt2)
+{
+    return (sqrt((double)square(pt2.x() - pt1.x()) + square(pt2.y() - pt1.y())));
+}
+
+QPointF ScrollableWebContentView::calcCenter(QPointF pt1, QPointF pt2)
+{
+    return((pt1 + pt2) / 2);
+}
+
+bool ScrollableWebContentView::doPinch(QStm_Gesture* gesture)
+{
+    m_scrollHelper->stopScrollNoSignal();
+    dehighlightWebElement();
+    m_pinchFinishTime.restart();
+    if (!m_gesturesEnabled || !m_viewportMetaData->m_userScalable)
+        return m_gesturesEnabled;
+
+    // Normally, "details" contains the distance between the two touched points
+    // It's null when the pinch starts (which in effect is zero)
+    // When we start pinch, we don't zoom because there is no delta
+    QPointF p1 = gesture->scenePosition(this);
+    QPointF p2 = gesture->scenePosition2(this);
+    if (gesture->gestureState() == Qt::GestureFinished) {
+        commitZoom();        
+        return m_gesturesEnabled;
+    }
+
+    if (!gesture->getDetails()) {
+        m_pinchStartDistance = calcDistance(p1, p2);
+        m_pinchStartScale = zoomScale();
+    }
+    else {
+        qreal scale = calcScale(m_pinchStartDistance, p1, p2);
+        qreal newScale = qBound(m_viewportMetaData->m_minimumScale, 
+                                scale * m_pinchStartScale,
+                                m_viewportMetaData->m_maximumScale);
+        // Don't allow zooming beyond the min/max but still call the zoom animation (coz the hotspot could be moving and we want to pan with it)
+        //zoomToHotSpot(calcCenter(p1, p2), newScale);
+        if (!qFuzzyCompare(zoomScale(), newScale)) {
+            startZoomAnimationToHotSpot(calcCenter(p1, p2), newScale, ZoomAnimationDuration);
+        }
+    }
+    return m_gesturesEnabled;
+}
+
+bool ScrollableWebContentView::isZooming()
+{
+    return m_zoomAnimator->state() == QAbstractAnimation::Running;     
+}
+
+void ScrollableWebContentView::setGesturesEnabled(bool value) 
+{ 
+    if (!value && m_touchDownTimer->isActive()) {
+        m_touchDownTimer->stop();
+    }
+
+    m_gesturesEnabled = value;
+}
+
+bool ScrollableWebContentView::gesturesEnabled() 
+{ 
+    return m_gesturesEnabled; 
+}
+
+
+void ScrollableWebContentView::dehighlightWebElement()
+{
+    m_touchDownTimer->stop();
+    m_hoverTimer->stop();
+    
+    QSizeF contentSize = webView()->size();
+    QPointF dummyPosF(-contentSize.width() - 2.0, -contentSize.height( ) - 2.0);
+    QPoint dummyPos(-1, -1);
+    QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease);
+    event.setScenePos(dummyPos);
+    event.setPos(dummyPos);
+    event.setButton(Qt::LeftButton);
+
+    bool hasInputMethod = toggleInputMethod(false);
+    webView()->page()->event(&event);
+    toggleInputMethod(hasInputMethod);
+    //sendEventToWebKit(QEvent::GraphicsSceneMouseRelease, dummyPos);    
+}
+
+
+void ScrollableWebContentView::stopScrolling()
+{
+    m_isScrolling = false;
+    //enableContentUpdates();
+}
+
+
+
 bool ScrollableWebContentView::sceneEventFilter(QGraphicsItem* item, QEvent* event)
 {
     Q_UNUSED(item);
 
     bool handled = false;
-    
-    if (!isVisible() || !m_gesturesEnabled) {
-        if (event->type() == QEvent::GraphicsSceneContextMenu)
-            return true;
-        else
-            return handled;
-    }
+#ifdef USE_KINETIC_SCROLLER    
+    if (!isVisible())
+        return handled;
 
     //Pass all events to recognizer
     handled  = m_gestureRecognizer.mouseEventFilter(static_cast<QGraphicsSceneMouseEvent *>(event));
+#endif
     return handled;
 }
 
+
 void ScrollableWebContentView::handleGesture(GestureEvent* gestureEvent)
 {
     switch (gestureEvent->type()) {
@@ -317,12 +1409,9 @@
 
 void ScrollableWebContentView::handleRelease(GestureEvent* gestureEvent)
 {
-    //FIX ME:
-    emit mouseEvent(QEvent::GraphicsSceneMousePress);
     //Cache release event to send on release
     QPointF pos = gestureEvent->position();
     sendEventToWebKit(QEvent::GraphicsSceneMouseRelease, pos);
-    emit mouseEvent(QEvent::GraphicsSceneMouseRelease);
 }
 
 void ScrollableWebContentView::handleDoubleTap(GestureEvent* gestureEvent)
@@ -331,35 +1420,29 @@
         return;
 
     QRectF target;
-    WebContentAnimationItem* webViewProxy = viewportWidget();
-
-    // Contentview center is the focus hotspot
-    QPointF viewTargetHotspot(size().width() / 2, size().height() / 2);
 
     //Get the focussable element rect from current touch position
-    QPointF touchPoint = webViewProxy->mapFromScene(gestureEvent->position());
-    QRectF zoomRect = webViewProxy->findZoomableRectForPoint(touchPoint);
+    QPointF touchPoint = mapFromScene(gestureEvent->position());
+
+    if(isZoomedIn()) {
+        startZoomAnimationToHotSpot(touchPoint,size().width() / webView()->size().width());
+            return;
+    }
+
+    QRectF zoomRect = findZoomableRectForPoint(touchPoint);
 
     if (!zoomRect.isValid()) {
         //FIX ME: Add an event ignore animation
         return;
     }
 
-    // target is the center of the identified rect x-wise
-    // y-wise it's the place user touched
-    QPointF hotspot(zoomRect.center().x(), touchPoint.y());
-    qreal scale = size().width() / zoomRect.size().width();
-    startZoomAnimToItemHotspot(hotspot, viewTargetHotspot, scale, zoomRect);
+    startZoomAnimation(zoomRect);
 }
 
 void ScrollableWebContentView::handlePan(GestureEvent* gestureEvent)
 {
     QPoint scrollPos = ScrollableViewBase::scrollPosition();
     m_kineticScroller->doPan(gestureEvent->delta());
-    QPoint delta;
-    delta.setX(-gestureEvent->delta().x());
-    delta.setY(-gestureEvent->delta().y());
-    emit viewScrolled(scrollPos, delta);
 }
 
 void ScrollableWebContentView::handleFlick(GestureEvent* gestureEvent)
@@ -370,158 +1453,21 @@
 
 void ScrollableWebContentView::handleLongTap(GestureEvent* gestureEvent)
 {
-    QWebPage* page = viewportWidget()->webView()->page();
-    QPointF contextPt = viewportWidget()->webView()->mapFromScene(gestureEvent->position());
+    QWebPage* page = webView()->page();
+    QPointF contextPt = webView()->mapFromScene(gestureEvent->position());
     QWebHitTestResult result = page->currentFrame()->hitTestContent(contextPt.toPoint());
-
+    
     //Notify context menu observers
-    emit contextEventObject(&result);
-}
-
-void ScrollableWebContentView::setViewportWidgetGeometry(const QRectF& r)
-{
-    ScrollableViewBase::setScrollWidgetGeometry(r);
-}
-
-void ScrollableWebContentView::startZoomAnimToItemHotspot(const QPointF& hotspot, const QPointF& viewTargetHotspot, qreal scale,  QRectF target)
-{
-    WebContentAnimationItem* animWidget = viewportWidget();
-
-    QPointF newHotspot = hotspot * scale;
-    QPointF newViewportOrigon = newHotspot - viewTargetHotspot;
-    QRectF zoomedRect(-newViewportOrigon, animWidget->size() * scale);
-
-    QRectF temp = adjustScrollWidgetRect(zoomedRect);
-    qreal diff = qAbs(scrollWidget()->geometry().y() - temp.y());
-
-    //FIX ME : Seperate the logic for centerzoom and block-focus zoom
-    if (qFuzzyCompare(scrollWidget()->geometry().topLeft().x(), temp.topLeft().x())
-        && qFuzzyCompare(scrollWidget()->geometry().width(), temp.width())
-        && qFuzzyCompare(scrollWidget()->geometry().height(), temp.height())
-        && !target.isEmpty() && (diff <= target.height())) {
-
-            scale = size().width() / animWidget->size().width();
-            newHotspot = QPointF(0, -animWidget->pos().y()) * scale;
-            newViewportOrigon = newHotspot - viewTargetHotspot;
-            zoomedRect = QRectF(-newViewportOrigon, animWidget->size() * scale);
-    }
-
-    startZoomAnimation(zoomedRect);
-}
-
-bool ScrollableWebContentView::isZoomedIn() const
-{
-    return size().width() < viewportWidget()->size().width();
-}
-
-void ScrollableWebContentView::stateChanged(KineticScrollable::State oldState
-                                            , KineticScrollable::State newState)
-{
-    ScrollableViewBase::stateChanged(oldState, newState);
-
-    if (newState == KineticScrollable::Pushing) {
-        m_tileUpdateEnableTimer.stop();
-        viewportWidget()->disableContentUpdates();
-    }
-    else if (newState == KineticScrollable::AutoScrolling) {
-        m_tileUpdateEnableTimer.stop();
-        viewportWidget()->disableContentUpdates();
-    }
-    else if (newState == KineticScrollable::Inactive) {
-        m_tileUpdateEnableTimer.start(TileUpdateEnableDelay);
-    }
-}
-
-void ScrollableWebContentView::startZoomAnimation(const QRectF& destRect)
-{
-    QAbstractAnimation::State animState = m_zoomAnimator->state();
-    if (animState == QAbstractAnimation::Running)
-        return;
-
-    m_zoomAnimator->setStartValue(scrollWidget()->geometry());
-    m_animationEndRect = adjustScrollWidgetRect(destRect);
-    m_zoomAnimator->setEndValue(m_animationEndRect);
-    m_zoomAnimator->start();
+    emit contextEventObject(&result, gestureEvent->position());
 }
 
-void ScrollableWebContentView::stopZoomAnimation()
-{
-    m_animationEndRect = QRectF();
-    m_zoomAnimator->stop();
-}
-
-void ScrollableWebContentView::updateZoomEndRect()
-{
-    if (m_animationEndRect.isValid())
-        scrollWidget()->setGeometry(m_animationEndRect);
-}
-
-void ScrollableWebContentView::zoomAnimationStateChanged(QAbstractAnimation::State newState,QAbstractAnimation::State)
+void ScrollableWebContentView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 {
-    switch (newState) {
-    case QAbstractAnimation::Stopped:
-        updateZoomEndRect();
-        break;
-    default:
-        break;
-    }
-}
 
-void ScrollableWebContentView::resizeEvent(QGraphicsSceneResizeEvent* event)
-{
-    QGraphicsWidget::resizeEvent(event);
+    QRectF fillRect = option ? option->exposedRect : QRectF(QPoint(0, 0), size());
 
-    //Ignore resize when chrome is being still setup
-    if (!event->oldSize().width())
-        return;
-
-    adjustViewportSize(event->oldSize(), event->newSize());
+    painter->fillRect(fillRect, Qt::white);
 }
 
-void ScrollableWebContentView::adjustViewportSize(QSizeF oldSize, QSizeF newSize)
-{
-    //FIX ME : Check this
-    if (m_viewportMetaData->m_isValid) {
-
-        QRect clientRect = geometry().toAlignedRect();
-        if (m_viewportMetaData->isLayoutNeeded())  {
-            m_viewportMetaData->orientationChanged(clientRect);
-            updatePreferredContentSize();
-            return;
-        } else
-            m_viewportMetaData->updateViewportData(viewportWidget()->contentsSize(), clientRect);
-    }
-
-    qreal scale = newSize.width() / oldSize.width();
-    QPointF middleLeft(0, oldSize.height()/2);
-    QPointF docPoint(viewportWidget()->mapFromScene(middleLeft));
-
-    QPointF resizedMiddleLeft(0, newSize.height()/2);
-    QPointF resizedDocPoint(viewportWidget()->mapFromScene(resizedMiddleLeft));
-    QPointF docPointInScr(viewportWidget()->mapToParent(resizedDocPoint));
-
-    //FIX ME : Should be handled with only following function call
-    //Since its not working, work-around is added. Plz fix it
-    //startZoomAnimToItemHotspot(docPoint, docPointInScr, scale);
-
-    QPointF newHotspot = docPoint * scale;
-    QPointF newViewportOrigon = newHotspot - docPointInScr;
-    QRectF zoomedRect(-newViewportOrigon,  viewportWidget()->size() * scale);
-    QRectF adjustRect = adjustScrollWidgetRect(zoomedRect);
-
-    setScrollWidgetGeometry(zoomedRect);
-}
-
-void ScrollableWebContentView::sendEventToWebKit(QEvent::Type type, QPointF& scenPos)
-{
-    //Setup event and send it to webkit
-    QGraphicsSceneMouseEvent event(type);
-    event.setScenePos(scenPos);
-    event.setPos(viewportWidget()->webView()->mapFromScene(event.scenePos()));
-    event.setButton(Qt::LeftButton);
-    event.setButtons(Qt::LeftButton);
-    event.setModifiers(Qt::NoModifier);
-    viewportWidget()->webView()->page()->event(&event);
-}
 
 } //namespace GVA
--- a/ginebra2/ContentViews/ScrollableWebContentView.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/ScrollableWebContentView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -26,47 +26,90 @@
 #include "Gestures/GestureListener.h"
 #include "Gestures/GestureRecognizer.h"
 #include "ScrollableViewBase.h"
-#include "ZoomMetaData.h"
-
+#include "webpagedata.h"
 #include <QPropertyAnimation>
 #include <QTimer>
+#include <QWebHitTestResult>
+#include "uitimer.h"
 
-class QWebHitTestResult;
+class QStm_Gesture;
+class QWebPage;
 
 namespace GVA {
 
+
+#define ZOOM_ANIM_TIME    300
+
 class ViewportMetaData;
-class WebContentAnimationItem;
+class WebView;
+class ScrollHelper;
 
 class ScrollableWebContentView : public ScrollableViewBase, protected GestureListener {
     Q_OBJECT
 public:
-    ScrollableWebContentView(WebContentAnimationItem* viewportProxyWidget, QGraphicsItem* parent = 0);
+    ScrollableWebContentView(WebView* scrolledWidget, QGraphicsItem* parent = 0);
     ~ScrollableWebContentView();
 
-    WebContentAnimationItem* viewportWidget() const;
-    void zoomToScreenCenter(bool zoomIn);
-
-    ZoomMetaData currentPageInfo();
-    void setCurrentPageInfo(ZoomMetaData data);
-    ZoomMetaData defaultZoomData();
+    WebView* webView() const;
+    void stepZoom(bool zoomIn);
+    void toggleZoom(bool zoomIn);
+    WebPageData pageDataFromViewportInfo();
+    void setPageDataToViewportInfo(const WebPageData& data);
+    WebPageData defaultZoomData();
     void updatePreferredContentSize();
     void setSuperPage();
-    void setGesturesEnabled(bool value) { m_gesturesEnabled = value; } 
-    bool gesturesEnabled() { return m_gesturesEnabled; }
+    bool isOrientationChanged(QSizeF oldSize, QSizeF newSize);
+    bool isChangedToLandscape(QSizeF oldSize, QSizeF newSize);
+    bool isChangedToPortrait(QSizeF oldSize, QSizeF newSize);
+    qreal zoomScale() const;
+    void setZoomScale(qreal value, bool immediateCommit = false);
+    Q_PROPERTY(qreal zoom READ zoomScale WRITE setZoomScale)
+
+    // viewableRect is in page coordinates
+    QRectF viewableRect();
+    void setViewableRect(const QRectF& rect);
+    Q_PROPERTY(QRectF viewableRect READ viewableRect WRITE setViewableRect)
 
+    // page scroll position in page coordiantes
+    void scrollPageTo(const QPointF& pos) { if(m_isScrolling) setScrollPosition((pos * zoomScale()).toPoint()) ; }
+    QPointF pageScrollPos() const { return scrollPosition() / zoomScale(); }
+    Q_PROPERTY(QPointF pageScrollPosition READ pageScrollPos WRITE scrollPageTo)
+
+    Q_PROPERTY(QPoint widgetScrollPosition READ scrollPosition WRITE setScrollPosition)
+    Q_PROPERTY(QPoint maxScrollPosition READ maximumScrollPosition);
+
+    bool event(QEvent * e);
+    bool eventFilter(QObject* o, QEvent* e);
+    bool isSuperPage() { return m_isSuperPage; }
+    void setPage(QWebPage* page);
+    
+    void setGesturesEnabled(bool value); 
+    bool gesturesEnabled();
+    
+    // fill empty areas with white
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+    
 Q_SIGNALS:
-    void contextEventObject(QWebHitTestResult* eventTarget);
-    void viewScrolled(QPoint& scrollPos, QPoint& delta);
+    void contextEventObject(QWebHitTestResult* hitTest, QPointF position);
+    void updateZoomActions(bool enableZoomIn, bool enableZoomOut);
+    void scaleChanged(qreal scale);
+    void viewPortChanged();
     void mouseEvent(QEvent::Type type);
+    void contentViewMouseEvent(QEvent::Type type);
 
 public Q_SLOTS:
     void reset();
     void contentsSizeChanged(const QSize&);
+    void pageLoadStarted();
+    void pageLoadProgress(int);
     void pageLoadFinished(bool);
-
+    void touchDownCallback();
+    void hoverCallback();
+    
 protected:
     bool sceneEventFilter(QGraphicsItem*, QEvent*);
+    void updateViewportMetaDataFromPageTag();
+    QSizeF parentSize() const;
 
     //From GestureListener
     void handleGesture(GestureEvent*);
@@ -80,29 +123,86 @@
     void handleLongTap(GestureEvent*);
 
     void setViewportWidgetGeometry(const QRectF& r);
-    void startZoomAnimToItemHotspot(const QPointF& hotspot, const QPointF& viewTargetHotspot, qreal scale, QRectF target = QRectF());
+    QRectF validateViewportRect(const QRectF& rect); // rect in page coordinates
+
+//    void startZoomAnimToItemHotspot(const QPointF& hotspot, const QPointF& viewTargetHotspot, qreal scale, QRectF target = QRectF()); // OBS
     bool isZoomedIn() const;
+    bool isZooming();
 
     //To handle kinetic scroller state changes
     void stateChanged(KineticScrollable::State oldState, KineticScrollable::State newState);
-
-    void startZoomAnimation(const QRectF& zoomedRect);
+    void zoomToHotSpot(const QPointF& viewportHotSpot, const qreal destScale);
+    void startZoomAnimationToHotSpot(const QPointF& viewportHotSpot, const qreal destScale, int animTime = ZOOM_ANIM_TIME);
+    void startZoomAnimation(const QRectF& destViewRect, int animTime = ZOOM_ANIM_TIME); // destViewRect in page coordinates
     void stopZoomAnimation();
     void updateZoomEndRect();
     void resizeEvent(QGraphicsSceneResizeEvent* event);
     void adjustViewportSize(QSizeF oldSize, QSizeF newSize);
-    void sendEventToWebKit(QEvent::Type type, QPointF& scenPos);
+    void sendEventToWebKit(QEvent::Type type, const QPointF& scenePos, bool select = false);
+    QRectF findZoomableRectForPoint(const QPointF& point); // point in view coordinates, returns rect in page coordinates
+    void notifyZoomActions(qreal newScale);
+    void startScrollAnimation(QPointF& scrollPos, QPointF& targetPos, 
+                              int duration, QEasingCurve::Type& easingCurveType);
+
    
 protected Q_SLOTS:
     void zoomAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State);
+    void enableContentUpdates();
+    void disableContentUpdates();
+    void commitZoom();
+    void stopScrolling();
 
 private:
-    GestureRecognizer m_gestureRecognizer;
+    void zoomAtPoint(QPointF touchPoint);
+    bool handleQStmGesture(QStm_Gesture* gesture);
+    bool doTouch(QStm_Gesture* gesture);
+    bool doTap(QStm_Gesture* gesture);
+    bool doMaybeTap(QStm_Gesture* gesture);
+    bool doPan(QStm_Gesture* gesture);
+    bool doFlick(QStm_Gesture* gesture);
+    bool doDoubleTap(QStm_Gesture* gesture);
+    bool doPinch(QStm_Gesture* gesture);
+    bool doLongPress(QStm_Gesture* gesture);
+    bool doRelease(QStm_Gesture* gesture);
+    bool doLeftRight(QStm_Gesture* gesture);
+    bool doUpDown(QStm_Gesture* gesture);
+    qreal calcScale(int origDistance, QPointF p1, QPointF p2);
+    qreal calcDistance(QPointF pt1, QPointF pt2);
+    QPointF calcCenter(QPointF pt1, QPointF pt2);
+    int zoomAnimationTime(bool zoomIn, qreal targetScale);
+    QRectF viewportRectInPageCoord(const QPointF& viewportHotSpot, 
+                                   const qreal destScale);
+    void dehighlightWebElement();
+    void initScrollHelper();
+    QWebHitTestResult  hitTest(const QPointF& scenePos);
+    bool toggleInputMethod(bool on);
+    bool toggleVkb();
+    bool inputMethodEnabled();
+    
+private:
     QRectF m_animationEndRect;
     QPropertyAnimation* m_zoomAnimator;          //Animates zooming transitions
     ViewportMetaData* m_viewportMetaData;
     QTimer m_tileUpdateEnableTimer;
-    bool m_gesturesEnabled;
+    QTimer m_zoomCommitTimer;
+    int m_pinchStartDistance;
+    qreal m_pinchStartScale;
+    bool m_isSuperPage;
+    bool m_gesturesEnabled;    // bookmarks and history need this
+    UiTimer* m_touchDownTimer;
+    UiTimer* m_hoverTimer;
+    QPointF  m_touchDownPos;
+    QTime    m_pinchFinishTime;
+    bool     m_isScrolling;
+    bool     m_isLoading;
+
+    ScrollHelper*   m_scrollHelper;
+    
+    GestureRecognizer m_gestureRecognizer;
+    QTimer            m_viewportMetadataResetTimer;
+    QWebHitTestResult m_hitTest;
+    bool              m_isInputOn;
+    bool              m_ignoreNextRelease;
 }; //ScrollableWebContentView
 
 } //namespace GVA
--- a/ginebra2/ContentViews/SuperPageView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/SuperPageView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -57,4 +57,7 @@
     m_contentView->webWidget()->page()->mainFrame()->evaluateJavaScript(script);
 }
 
+QString SuperPageView::title() const {
+    return m_contentView ? m_contentView->title() : QString::null;
 }
+}
--- a/ginebra2/ContentViews/SuperPageView.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/SuperPageView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -28,10 +28,13 @@
       virtual QList<QAction*> getContext();
       virtual void show();
       virtual void hide() {;}
+      virtual QString title() const;
   public slots:
       void addAction(const QString& action, const QString & script = QString());
   private slots:
       void invokeScriptAction();
+  signals:
+      void titleChanged(const QString & title);
   private:
       GWebContentView * m_contentView;
       QMap<QString, QAction*>  m_actions;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/TiledWebView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,1108 @@
+
+#include "TiledWebView.h"
+
+#include <QPainter>
+#include <QPixmap>
+#include <QStyleOptionGraphicsItem>
+#include <QWebFrame>
+#include <QApplication>
+#include <QGraphicsView>
+#include <QGraphicsSceneResizeEvent>
+
+
+
+const int cTileSize = 64;
+const qreal cBigSideTileOverHead = 2;
+const qreal cSmallSideTileOverHead = 2.5;
+const int cTileUpdateTimerTick = 50;
+const int cPaintIdleTimeout = cTileUpdateTimerTick * 2;
+const int cTileRectRecenterTimeout = 500;
+const int cTileScaleUpdateTimeout = 250;
+const int cIdleTileUpdateChunkSize = 4;
+const int cInPaintTileUpdateTimeout = 18;
+
+
+TiledWebView::TiledWebView(QGraphicsItem* parent) : QGraphicsWebView(parent)
+{
+    m_tilesPool.clear();
+    m_tilesField = 0;
+    m_inUpdate = false;
+    m_tilesRectCentered = false;
+    m_tilesFrozen = false;
+    m_needViewportTilesUpdate = false;
+    m_needScaleCommit = false;
+    m_needTilesFieldRebuild = false;
+    m_lastScrollDelta = QPoint(0, 0);
+#ifdef USE_ASSISTANT_ITEM
+    m_assistant = new TiledWebViewAssistant();
+    m_assistant->setParentItem(this);
+    m_assistant->m_master = this;
+
+    setFlag(QGraphicsItem::ItemHasNoContents, true);
+    setAttribute(Qt::WA_OpaquePaintEvent, true);
+#endif
+
+    connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateTimeout()));
+    connect(this, SIGNAL(scaleChanged()), this, SLOT(scheduleScaleUpdate()));
+    m_userPaintTS.start();
+
+}
+
+TiledWebView::~TiledWebView()
+{
+    delete[] m_tilesField;
+    m_tilesField = 0;
+    for(int i = 0; i < m_tilesPool.count(); i++) {
+        delete m_tilesPool[i];
+        m_tilesPool[i] = 0;
+    }
+}
+
+void TiledWebView::loadStarted()
+{
+//    resetTiles(QRect(QPoint(0, 0), m_tilesDim), false);
+    m_needViewportTilesUpdate = true;
+
+    startUpdateTimer();
+}
+
+void TiledWebView::setPage(QWebPage* page)
+{
+    bool doneOnce = false;
+    
+    if(!doneOnce) {
+        doneOnce = true;
+        page->setProperty("_q_RepaintThrottlingPreset", QVariant::fromValue(QString("Medium")));
+    }
+    
+    page->setProperty("_q_HTMLTokenizerChunkSize", 1024);
+    page->setProperty("_q_HTMLTokenizerTimeDelay", 0.750);
+    resetTiles(QRect(QPoint(0, 0), m_tilesDim), false);
+    m_needViewportTilesUpdate = true;
+
+    QGraphicsWebView::setPage(page);
+
+    QPalette pal = palette();
+    pal.setColor(QPalette::ButtonText,Qt::black);
+    pal.setBrush(QPalette::Base, Qt::white);
+    setPalette(pal);
+    page->setPalette(pal);
+
+    connect(page, SIGNAL(repaintRequested(QRect)), this, SLOT(repaintRequested(QRect)));
+    connect(page, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
+    m_needViewportTilesUpdate = true;
+    startUpdateTimer();
+}
+
+//#define TILEPOOL_DEBUG
+TiledWebView::Tile::Tile() : img(cTileSize,cTileSize), ready(0), used(0)
+{
+}
+
+TiledWebView::Tile* TiledWebView::tileAt(const QPoint& p) const
+{
+    Q_ASSERT(p.x() < m_tilesDim.width() && p.y() < m_tilesDim.height());
+    Q_ASSERT(m_tilesField);
+
+    return m_tilesField[m_tilesDim.width() * p.y() + p.x()];
+}
+
+void TiledWebView::setTileAt(const QPoint& p,Tile* t)
+{
+    m_tilesField[m_tilesDim.width() * p.y() + p.x()] = t;
+}
+
+static void boundPoint(const QPoint& min, QPoint& p, const QPoint &max)
+{
+    p.setX(qBound(min.x(),p.x(),max.x()));
+    p.setY(qBound(min.y(),p.y(),max.y()));
+}
+
+static QPoint topPoint(const QSize& s)
+{
+    return QPoint(s.width() - 1, s.height() - 1);
+}
+
+TiledWebView::Tile* TiledWebView::createTile(const QPoint& p)
+{
+    int i;
+    for(i = 0; i < m_tilesPool.count(); i++)
+        if(!m_tilesPool[i] || !m_tilesPool[i]->used)
+            break;
+
+    Tile* ret;
+    if(i < m_tilesPool.count()) {
+        if(!m_tilesPool[i]) {
+            m_tilesPool[i] = new Tile();
+        }
+        setTileAt(p, m_tilesPool[i]);
+        ret = m_tilesPool[i];
+    } else {
+        ret = new Tile();
+        m_tilesPool.append(ret);
+        setTileAt(p, ret);
+    }
+
+    ret->used = true;
+
+#ifdef TILEPOOL_DEBUG
+    checkTilesField();
+#endif
+    return ret;
+}
+
+QPoint TiledWebView::tileAtPoint(const QPointF& p) const
+{
+    QPointF tmp = mapToTileCoords(p - m_tilesRect.topLeft());
+    tmp /= cTileSize;
+    QPoint ret((int)tmp.x(),(int)tmp.y());
+    return ret;
+}
+
+QRectF TiledWebView::tileRect(const QPoint& t) const
+{
+    QRectF tRect = mapToTileCoords(m_tilesRect);
+    QRectF ret(tRect.topLeft() + t * cTileSize,QSizeF(cTileSize,cTileSize));
+
+    return ret;
+}
+
+static int calcD(const QPoint p1, QPoint p2)
+{
+    int d1 = p2.x() - p1.x();
+    int d2 = p2.y() - p1.y();
+    return d1 * d1 + d2 * d2;
+}
+QRectF TiledWebView::viewPortRect() const
+{
+    return mapRectFromParent(QRectF(QPointF(0, 0),static_cast<QGraphicsWidget*>(parentItem())->size()));
+}
+
+void TiledWebView::boundTile(QPoint& t) const
+{
+    boundPoint(QPoint(0,0),t,topPoint(m_tilesDim));
+}
+
+QPoint TiledWebView::findTile4Update(bool inView, bool addDirty) const
+{
+    QRectF vpRect = viewPortRect();
+    QRectF updateRect = m_tilesRect;
+    if(inView)
+        updateRect = updateRect.intersect(vpRect);
+    QPoint found(-1, -1);
+    if(updateRect.isEmpty()) return found;
+
+    QPoint topLeft = tileAtPoint(updateRect.topLeft());
+    QPoint bottomRight = tileAtPoint(updateRect.bottomRight());
+    QPoint center = tileAtPoint(vpRect.center());
+
+    bottomRight += QPoint(1, 1);
+    boundTile(topLeft);
+    boundTile(bottomRight);
+    boundPoint(topLeft,center,bottomRight);
+
+    int d = 1000000; // just big enough value;
+    int tmpD;
+    for(int j = topLeft.y(); j <= bottomRight.y(); j++)
+        for(int i = topLeft.x(); i <= bottomRight.x(); i++) {
+            QPoint p(i,j);
+            Tile* t = tileAt(p);
+            if(!t || !t->ready || (addDirty && !t->dirtyRect.isEmpty())) {
+                tmpD = calcD(center, p);
+                if(tmpD < d) {
+                    d = tmpD;
+                    found = p;
+                }
+            }
+        }
+
+    return found;
+}
+
+QList<QPoint> TiledWebView::findTileLine4Update(bool dirty, bool inView, bool useScrollDirection) const
+{
+    QRectF vpRect = viewPortRect();
+    QRectF updateRect = m_tilesRect;
+    if(inView)
+        updateRect = updateRect.intersect(vpRect);
+    QList<QPoint> ret;
+    if(updateRect.isEmpty()) return ret;
+
+    QPoint topLeft = tileAtPoint(updateRect.topLeft());
+    QPoint bottomRight = tileAtPoint(updateRect.bottomRight());
+    QPoint topVPLeft = tileAtPoint(vpRect.topLeft());
+    QPoint bottomVPRight = tileAtPoint(vpRect.bottomRight());
+    QPoint center = tileAtPoint(vpRect.center());
+
+    bottomRight += QPoint(1, 1);
+    bottomVPRight += QPoint(1, 1);
+    boundTile(topLeft);
+    boundTile(bottomRight);
+    boundTile(topVPLeft);
+    boundTile(bottomVPRight);
+    boundPoint(topLeft,center,bottomRight);
+
+    int maxCount = qAbs(topLeft.x() - center.x());
+    maxCount = qMax(maxCount, qAbs(topLeft.y() - center.y()));
+    maxCount = qMax(maxCount, qAbs(bottomRight.x() - center.x()));
+    maxCount = qMax(maxCount, qAbs(bottomRight.y() - center.y()));
+
+    for(int i = 0; i < maxCount; i++) {
+        int j;
+        if((m_lastScrollDelta.y() > 0 || !useScrollDirection) &&
+           center.y() + i <= bottomRight.y())
+            for(j = topVPLeft.x(); j <= bottomVPRight.x(); j++) {
+                QPoint p(j, center.y() + i);
+                Tile* t = tileAt(p);
+                if(!t || !t->ready || (dirty && !t->dirtyRect.isEmpty())) {
+                    ret += p;
+                }
+            }
+        if(!ret.isEmpty())
+            break;
+
+        if((m_lastScrollDelta.y() < 0 || !useScrollDirection) &&
+           center.y() - i >= topLeft.y())
+            for(j = topVPLeft.x(); j <= bottomVPRight.x(); j++) {
+                QPoint p(j, center.y() - i);
+                Tile* t = tileAt(p);
+                if(!t || !t->ready || (dirty && !t->dirtyRect.isEmpty())) {
+                    ret += p;
+                }
+            }
+            if(!ret.isEmpty())
+                break;
+
+            if((m_lastScrollDelta.x() > 0 || !useScrollDirection) &&
+               center.x() + i <= bottomRight.x())
+                for(j = topVPLeft.y(); j <= bottomVPRight.y(); j++) {
+                    QPoint p(center.x() + i, j);
+                    Tile* t = tileAt(p);
+                    if(!t || !t->ready || (dirty && !t->dirtyRect.isEmpty())) {
+                        ret += p;
+                    }
+                }
+            if(!ret.isEmpty())
+                break;
+
+            if((m_lastScrollDelta.x() < 0  || !useScrollDirection) &&
+               center.x() - i >= topLeft.x())
+                for(j = topVPLeft.y(); j <= bottomVPRight.y(); j++) {
+                    QPoint p(center.x() - i, j);
+                Tile* t = tileAt(p);
+                if(!t || !t->ready || (dirty && !t->dirtyRect.isEmpty())) {
+                    ret += p;
+                }
+            }
+            if(!ret.isEmpty())
+                break;
+    }
+
+    return ret;
+}
+
+QRectF TiledWebView::updateTile(const QPoint& t)
+{
+    m_inUpdate = true;
+    Tile* tile = tileAt(t);
+    if(!tile) tile = createTile(t);
+
+    QPainter p(&(tile->img));
+    QRectF tRect = mapFromTileCoords(tileRect(t));
+    QRectF tDirtyRect = mapFromTileCoords(tile->dirtyRect);
+    QRectF updateRect = !tile->ready || tDirtyRect.isEmpty() ? tRect : tDirtyRect;
+
+
+    //if(!tile->ready)
+    //    p.fillRect(0, 0, cTileSize, cTileSize, Qt::white);
+
+    tile->ready = true;
+    tile->dirtyRect = QRectF();
+
+    p.scale(m_tilesScale,m_tilesScale);
+
+    qreal adjust = 2 + m_tilesScale;
+
+    // adjust rect to cover rouding errors
+    updateRect.adjust(-adjust, -adjust, adjust, adjust);
+
+    QRegion clip(updateRect.toRect());
+    p.translate(-tRect.topLeft());
+    p.setClipRegion(clip);
+//    p.fillRect(clip.boundingRect(), Qt::white);
+
+//    p.setRenderHint(QPainter::SmoothPixmapTransform); // cause assert now
+//    p.setRenderHint(QPainter::Antialiasing);
+
+    page()->mainFrame()->render(&p, QWebFrame::ContentsLayer, clip);
+
+    m_inUpdate = false;
+    return updateRect;
+}
+
+void TiledWebView::repaintRequested(QRect r)
+{
+    if(!m_tilesField) return;
+
+    if(r.isEmpty())
+        r = m_tilesRect.adjusted(-1, -1, 1, 1).toRect();
+
+    QPoint topLeftTile = tileAtPoint(r.topLeft());
+    QPoint bottomRightTile = tileAtPoint(r.bottomRight());
+    boundTile(topLeftTile);
+    boundTile(bottomRightTile);
+    QRectF repaintClip = mapToTileCoords(r);
+    bool needUpdate = false;
+    QRectF vpRect = mapToTileCoords(viewPortRect());
+
+    for(int j = topLeftTile.y(); j <= bottomRightTile.y(); j++)
+        for(int i = topLeftTile.x(); i <= bottomRightTile.x(); i++) {
+            QPoint t(i, j);
+            QRectF clip = tileRect(t) & repaintClip;
+            if(!clip.isEmpty()) {
+
+                Tile* tile = tileAt(t);
+                if(tile && tile->ready) {
+                    if(!tile->dirtyRect.isEmpty())
+                        clip |= tile->dirtyRect;
+                    tile->dirtyRect = clip;
+//                    if(vpRect.intersects(tile->dirtyRect)) {
+//                        m_needViewportTilesUpdate = true;
+//                    }
+                }
+                needUpdate = true;
+            }
+        }
+
+    if(needUpdate)
+        startUpdateTimer();
+
+}
+
+QPixmap* TiledWebView::getUnprepPixmap()
+{
+    static const int squareMult = 1;
+    static const int cellSize = 16;
+    static QPixmap pixmap(squareMult * cellSize, squareMult * cellSize);
+    static bool init = false;
+
+    if(!init) {
+        init = true;
+        QPainter p(&pixmap);
+        p.fillRect(pixmap.rect(),Qt::lightGray);
+        // p.setPen(QColor(182,242,255));
+        // p.setPen(QColor(Qt::darkBlue));
+        p.setPen(Qt::darkGray);
+        for(int i = -1; i < squareMult + 1; i++) {
+            int xoffs = i * cellSize;
+            for(int j = -1; j < squareMult + 1; j++) {
+                int yoffs = j * cellSize;
+                p.drawLine(xoffs + 7, yoffs - 4, xoffs + 7, yoffs + 2);
+                p.drawLine(xoffs + 4, yoffs + 7, xoffs + 10, yoffs + 7);
+                p.drawLine(xoffs + 15, yoffs + 4, xoffs + 15, yoffs + 10);
+                p.drawLine(xoffs + 12, yoffs + 15, xoffs + 18, yoffs + 15);
+            }
+        }
+    }
+
+    return &pixmap;
+}
+
+QSize TiledWebView::getTileFieldDim()
+{
+    QSizeF vpSize = static_cast<QGraphicsWidget*>(parentItem())->size();
+    qreal heightMult = cBigSideTileOverHead;
+    qreal widthMult = cSmallSideTileOverHead;
+    if(vpSize.width() > vpSize.height())
+        qSwap(widthMult, heightMult);
+    return QSize((int)((vpSize.width() * widthMult + cTileSize) / cTileSize),
+                 (int)((vpSize.height() * heightMult + cTileSize) / cTileSize));
+}
+
+void TiledWebView::createTileField()
+{
+    QRectF vpRect = viewPortRect();
+
+    m_tilesDim = getTileFieldDim();
+    m_tilesPool.reserve(m_tilesDim.width() * m_tilesDim.height());
+
+
+    m_tilesField = new Tile*[m_tilesDim.width() * m_tilesDim.height()];
+    memset(m_tilesField, 0, sizeof(Tile*) * m_tilesDim.width() * m_tilesDim.height());
+    m_tilesScale = scale();
+
+    adjustTilesToViewPort(true);// mapFromTileCoords(QRectF(QPointF(3, 5) * cTileSize, m_tilesDim * cTileSize));
+}
+
+QRectF TiledWebView::validateTileRect(const QRectF& rect, const QSize& dim) const
+{
+    QRectF ret(rect);
+    QRectF vpRect = viewPortRect();
+    qreal tileSize = cTileSize / m_tilesScale;
+
+    if(ret.bottom() > size().height() + tileSize)
+        ret.moveBottom(size().height() + tileSize);
+    if(ret.top() < 0)
+        ret.moveTop(0);
+
+    if(ret.right() > size().width() + tileSize)
+        ret.moveRight(size().width() + tileSize);
+    if(ret.left() < 0)
+        ret.moveLeft(0);
+
+    if(ret.width() < vpRect.width())
+        ret.setLeft(0);
+
+    if(ret.height() < vpRect.height())
+        ret.setTop(0);
+
+    QPointF p = mapToTileCoords(ret.topLeft());
+    // allign coordinates to tile boundary
+    QPoint pp = (p / cTileSize).toPoint();
+    p = QPointF(pp) * cTileSize;
+
+    return mapFromTileCoords(QRectF(p, dim * cTileSize));
+}
+
+QRectF TiledWebView::adjustedTileRect(const QSize& dim) const
+{
+    QRectF ret(m_tilesRect);
+    if(ret.isEmpty())
+        ret = QRectF(QPoint(0,0),mapFromTileCoords(dim * cTileSize));
+    // no repositioning and scaling and tile dropping during scaling
+    if(!qFuzzyCompare(m_tilesScale,scale()))
+        return ret;
+
+    QRectF vpRect = viewPortRect();
+    qreal tileSize = cTileSize / m_tilesScale;
+    if(vpRect.bottom() > ret.bottom())
+        ret.moveTop(vpRect.top() - tileSize);
+    else if(vpRect.top() < ret.top())
+        ret.moveBottom(vpRect.bottom() + tileSize);
+
+    if(vpRect.right() > ret.right())
+        ret.moveLeft(vpRect.left() - tileSize);
+    else if(vpRect.left() < ret.left())
+        ret.moveRight(vpRect.right() + tileSize);
+
+    return validateTileRect(ret, dim);
+}
+
+QRectF TiledWebView::centeredTileRect(const QSize& dim) const
+{
+    QRectF vpRect = viewPortRect();
+    QSizeF tilesSize = mapFromTileCoords(dim * cTileSize);
+    QPoint centerOffset(tilesSize.width() / 2, tilesSize.height() / 2);
+    QRectF centeredRect(vpRect.center() - centerOffset,tilesSize);
+
+    return validateTileRect(centeredRect, dim);
+}
+
+void TiledWebView::adjustTilesToViewPort(bool center)
+{
+    QRectF newTilesRect = center ? centeredTileRect(m_tilesDim) :
+                                   adjustedTileRect(m_tilesDim);
+    m_tilesRectCentered = center;
+
+    moveTilesRect(newTilesRect);
+}
+
+void TiledWebView::moveTilesRect(const QRectF& newTilesRect)
+{
+    QRectF trNew = mapToTileCoords(newTilesRect);
+    QRectF trOld = mapToTileCoords(m_tilesRect);
+
+    if(trNew == trOld) return;
+
+    if(trNew.intersects(trOld)) {
+        QPoint trDiff = ((trNew.topLeft() - trOld.topLeft()) / cTileSize).toPoint();
+        scrollTileField(-trDiff);
+    } else {
+        resetTiles(QRect(QPoint(0,0), m_tilesDim), false);
+#ifdef TILEPOOL_DEBUG
+        checkTilesField();
+#endif
+    }
+    m_tilesRect = newTilesRect;
+}
+
+void TiledWebView::resetTiles(const QRect& r, bool remove)
+{
+    for(int j = r.top(); j <= r.bottom(); j++)
+        for(int i = r.left(); i <= r.right(); i++) {
+            QPoint t(i, j);
+            Tile* tile = tileAt(t);
+            if(tile) {
+                tile->ready = false;
+                tile->dirtyRect = QRect();
+                if(remove) {
+                    tile->used = false;
+                    setTileAt(t, 0);
+                }
+            }
+        }
+}
+
+void TiledWebView::scrollTileField(const QPoint& diff)
+{
+#ifdef TILEPOOL_DEBUG
+    checkTilesField();
+#endif
+    if(qAbs(diff.x()) > m_tilesDim.width() || qAbs(diff.y()) > m_tilesDim.height())
+        return;
+
+    if(diff.x() > 0) {
+        resetTiles(QRect(QPoint(m_tilesDim.width() - diff.x(),0),
+                         QSize(diff.x(), m_tilesDim.height())), true);
+
+        for(int i = m_tilesDim.width() - diff.x() - 1; i >= 0; i--) {
+            int dstNum = i + diff.x();
+
+            for(int j = 0; j < m_tilesDim.height(); j++) {
+                setTileAt(dstNum, j, tileAt(i, j));
+                setTileAt(i, j, 0);
+            }
+        }
+    } else if(diff.x() < 0) {
+        resetTiles(QRect(QPoint(0,0),
+                         QSize(-diff.x(), m_tilesDim.height())), true);
+
+        for(int i = -diff.x(); i < m_tilesDim.width(); i++) {
+            int dstNum = i + diff.x();
+
+            for(int j = 0; j < m_tilesDim.height(); j++) {
+                setTileAt(dstNum, j, tileAt(i, j));
+                setTileAt(i, j, 0);
+            }
+        }
+    }
+
+    if(diff.y() > 0) {
+        resetTiles(QRect(QPoint(0, m_tilesDim.height() - diff.y()),
+                         QSize(m_tilesDim.width(), diff.y())), true);
+
+        for(int i = m_tilesDim.height() - diff.y() - 1; i >= 0; i--) {
+            int dstNum = i + diff.y();
+            Tile **srcLine = m_tilesField + m_tilesDim.width() * i;
+            Tile **dstLine = m_tilesField + m_tilesDim.width() * dstNum;
+            memcpy(dstLine, srcLine, m_tilesDim.width() * sizeof(Tile*));
+            memset(srcLine, 0, m_tilesDim.width() * sizeof(Tile*));
+        }
+    } else if(diff.y() < 0) {
+        resetTiles(QRect(QPoint(0, 0),
+                         QSize(m_tilesDim.width(), -diff.y())), true);
+
+        for(int i = -diff.y(); i < m_tilesDim.height(); i++) {
+            int dstNum = i + diff.y();
+            Tile **srcLine = m_tilesField + m_tilesDim.width() * i;
+            Tile **dstLine = m_tilesField + m_tilesDim.width() * dstNum;
+            memcpy(dstLine, srcLine, m_tilesDim.width() * sizeof(Tile*));
+            memset(srcLine, 0, m_tilesDim.width() * sizeof(Tile*));
+        }
+    }
+#ifdef TILEPOOL_DEBUG
+    checkTilesField();
+#endif
+}
+
+QList<QRectF> TiledWebView::updateViewportTiles(QList<TileSet> *updatedTiles)
+{
+    QList<QRectF> ret;
+    // update all visible tiles
+    QRectF vpRect = viewPortRect();
+
+    QPoint topLeft = tileAtPoint(vpRect.topLeft());
+    QPoint bottomRight = tileAtPoint(vpRect.bottomRight());
+
+    bottomRight += QPoint(1, 1);
+    boundTile(topLeft);
+    boundTile(bottomRight);
+    for(int j = topLeft.y(); j <= bottomRight.y(); j++)
+        for(int i = topLeft.x(); i <= bottomRight.x(); i++) {
+            QPoint t(i, j);
+            Tile *tile = tileAt(t);
+            if(!tile || !tile->ready || !tile->dirtyRect.isEmpty()) {
+                QRectF r = updateTile(t);
+                ret += r;
+                if(updatedTiles)
+                    *updatedTiles += TileSet(t, r);
+            }
+        }
+
+    m_needViewportTilesUpdate = false;
+    return ret;
+}
+
+void TiledWebView::doScaleCommit()
+{
+    m_needScaleCommit = false;
+    if(qFuzzyCompare(m_tilesScale, scale()))
+        return;
+
+    resetTiles(QRect(QPoint(0,0), m_tilesDim), true);
+#ifdef TILEPOOL_DEBUG
+   checkTilesField();
+#endif
+    m_tilesScale = scale();
+    adjustTilesToViewPort(true);
+    m_needViewportTilesUpdate = true;
+}
+
+void TiledWebView::commitZoom()
+{
+    m_needScaleCommit = true;
+
+    startUpdateTimer();
+}
+
+QList<QRectF> TiledWebView::updateScrollAreaTilesChunk(QList<TileSet> *updatedTiles, bool inPaint)
+{
+    QList<QRectF> dirtyRects;
+    QList<QPoint> lst = findTileLine4Update(false, true);
+    if(lst.isEmpty())
+        lst = findTileLine4Update(false, false);
+    if(lst.isEmpty())
+        lst = findTileLine4Update(false, true, false);
+//    if(!inPaint) {
+    {
+        if(lst.isEmpty())
+            lst = findTileLine4Update(true, true);
+        if(lst.isEmpty())
+            lst = findTileLine4Update(true, false);
+        if(lst.isEmpty())
+            lst = findTileLine4Update(true, false, false);
+    }
+
+    QTime ts;
+    ts.start();
+    foreach(QPoint t, lst) {
+        QRectF r = updateTile(t);
+        dirtyRects += r;
+        if(updatedTiles)
+            *updatedTiles += TileSet(t, r);
+        if(inPaint && ts.elapsed() > cInPaintTileUpdateTimeout)
+            break;
+    }
+
+    return dirtyRects;
+}
+
+
+void TiledWebView::updateTimeout()
+{
+    if(m_tilesFrozen) return;
+    if(m_inUpdate) return;
+
+    int elapsed = m_userPaintTS.elapsed();
+    QList<QRectF> dirtyTiles;
+
+    if(m_needTilesFieldRebuild) {
+        doTilesFieldRebuild();
+    } else if(m_needScaleCommit) {
+        doScaleCommit();
+    } else if(m_needViewportTilesUpdate) {
+/*  just do nothing, because it will update tiles below
+        dirtyTiles += updateViewportTiles(); */
+    } else if(elapsed < cPaintIdleTimeout) {
+//        updateSceneRects(updateScrollAreaTilesChunk);
+
+/*        QList<QRectF> rects = updateViewportTiles();
+        foreach(QRectF r, rects)
+            update(r); */
+        return;
+    }
+
+    if(elapsed > cTileScaleUpdateTimeout && !qFuzzyCompare(m_tilesScale, scale())) {
+         doScaleCommit();
+    }
+//    else if(elapsed > cTileRectRecenterTimeout && !m_tilesRectCentered)
+//        adjustTilesToViewPort(true);
+
+    dirtyTiles += updateViewportTiles();
+    if(dirtyTiles.isEmpty())
+        dirtyTiles = updateScrollAreaTilesChunk();
+
+    if(dirtyTiles.isEmpty())
+        for(int i = 0; i < cIdleTileUpdateChunkSize; i++) {
+            // 1st try to paint not ready tiles in view
+            QPoint oneDirtyTile = findTile4Update(true);
+            // 2nd update dirty tiles in view
+            if(oneDirtyTile.x() < 0) oneDirtyTile = findTile4Update(true, true);
+            // 3rd try to paint not ready tiles everywhere else
+            if(oneDirtyTile.x() < 0) oneDirtyTile = findTile4Update(false);
+            // 4th update all other dirty tiles
+            if(oneDirtyTile.x() < 0) oneDirtyTile = findTile4Update(false, true);
+            if(oneDirtyTile.x() >= 0)
+                dirtyTiles += updateTile(oneDirtyTile);
+            else if(/*m_tilesRectCentered && */qFuzzyCompare(m_tilesScale, scale())) {
+                stopUpdateTimer();
+                break;
+            }
+        }
+
+    m_inUpdate = true;
+
+    updateSceneRects(dirtyTiles);
+
+    m_inUpdate = false;
+    
+    // restart timer if some of update flags was set during recursive calls from webkit render
+    if(m_needTilesFieldRebuild || m_needScaleCommit || m_needViewportTilesUpdate)
+        startUpdateTimer();
+}
+
+void TiledWebView::updateSceneRects(const QList<QRectF>& dirtyTiles)
+{
+    QGraphicsScene* s = scene();
+    QList<QGraphicsView*> gvList = s->views();
+
+    QRectF vpRect = viewPortRect();
+
+    foreach(QGraphicsView* v, gvList) {
+        QRegion reg;
+        foreach(QRectF r, dirtyTiles) {
+            r = r.intersected(vpRect);
+            update(r);
+            r = mapRectToScene(r);
+            r = v->mapFromScene(r).boundingRect();
+            reg += r.toRect();
+        }
+//        v->repaint(reg);
+    }
+}
+
+void TiledWebView::scheduleScaleUpdate()
+{
+    if(!m_tilesField) return;
+
+    startUpdateTimer();
+}
+
+void TiledWebView::checkTilesField()
+{
+    int usedCount1 = 0;
+    for(int j = 0; j < m_tilesDim.height(); j++)
+        for(int i = 0; i < m_tilesDim.width(); i++) {
+            Tile* t = tileAt(i, j);
+            if(t) {
+                Q_ASSERT(t->used);
+                usedCount1++;
+            }
+        }
+
+    int usedCount2 = 0;
+    for(int i = 0; i < m_tilesPool.count(); i++)
+        if(m_tilesPool[i] && m_tilesPool[i]->used)
+            usedCount2++;
+
+    Q_ASSERT(usedCount1 == usedCount2);
+}
+
+void TiledWebView::doTilesFieldRebuild()
+{
+    QSize oldDim = m_tilesDim;
+    QSize newDim = getTileFieldDim();
+    
+    if(!qFuzzyCompare(m_tilesScale, scale())) {
+        resetTiles(QRect(QPoint(0,0), m_tilesDim), true);
+        m_tilesScale = scale();
+        
+        QRectF newRect = adjustedTileRect(newDim);
+            
+        Tile** newField = new Tile*[newDim.width() * newDim.height()];
+        memset(newField, 0, sizeof(Tile*) * newDim.width() * newDim.height());
+        delete[] m_tilesField;
+        m_tilesField = newField;
+        m_tilesDim = newDim;
+        m_tilesRect = newRect;
+
+        m_needViewportTilesUpdate = true;
+
+    } else { 
+        Tile** oldField = m_tilesField;
+        QRectF newRect = adjustedTileRect(newDim);
+        
+        QRectF trNew = mapToTileCoords(newRect);
+        QRectF trOld = mapToTileCoords(m_tilesRect);
+    
+        if(trNew != trOld) {
+    
+            Tile** newField = new Tile*[newDim.width() * newDim.height()];
+            memset(newField, 0, sizeof(Tile*) * newDim.width() * newDim.height());
+            QRectF trCommon = trNew.intersect(trOld);
+    
+            if(!trCommon.isEmpty()) {
+                QSize copySize = (trCommon.size() / cTileSize).toSize();
+                QPoint oldOffs = ((trCommon.topLeft() - trOld.topLeft()) / cTileSize).toPoint();
+                QPoint newOffs = ((trCommon.topLeft() - trNew.topLeft()) / cTileSize).toPoint();
+                if(trNew.size().width() - newOffs.x() < copySize.width())
+                    copySize.setWidth(trNew.size().width() - newOffs.x());
+                if(trNew.size().height() - newOffs.y() < copySize.height())
+                    copySize.setHeight(trNew.size().height() - newOffs.y());
+                if(trOld.size().width() - oldOffs.x() < copySize.width())
+                    copySize.setWidth(trOld.size().width() - oldOffs.x());
+                if(trOld.size().height() - oldOffs.y() < copySize.height())
+                    copySize.setHeight(trOld.size().height() - oldOffs.y());
+    
+                for(int j = 0; j < copySize.height(); j++)
+                    for(int i = 0; i < copySize.width(); i++) {
+                    QPoint cPoint(i, j);
+                    QPoint oldPos = cPoint + oldOffs;
+                    Tile *tile = tileAt(oldPos);
+                    setTileAt(oldPos, 0);
+                    QPoint newPos = cPoint + newOffs;
+                    Q_ASSERT(newPos.x() >= 0 && newPos.y() >=0 &&
+                             newPos.x() < newDim.width() && newPos.y() < newDim.height());
+                    *(newField + newPos.y() * newDim.width() + newPos.x()) = tile;
+                }
+            }
+    
+            // release remaining tiles in old field
+            resetTiles(QRect(QPoint(0,0), m_tilesDim), true);
+    
+            delete[] m_tilesField;
+            m_tilesField = newField;
+            m_tilesDim = newDim;
+            m_tilesRect = newRect;
+    
+            int newTileCount = m_tilesDim.height() * m_tilesDim.width();
+            while(m_tilesPool.count() > newTileCount) {
+                bool deleted = false;
+                for(int i = m_tilesPool.count() - 1; i >= 0; i--) {
+                    Tile* tile = m_tilesPool[i];
+                    if(!tile->used) {
+                        deleted = true;
+                        if(tile) delete tile;
+                        m_tilesPool.remove(i);
+                        break;
+                    }
+                }
+                Q_ASSERT(deleted);
+            }
+
+            m_needViewportTilesUpdate = true;
+        }
+    }
+
+    m_needTilesFieldRebuild = false;
+}
+
+void TiledWebView::viewportUpdated()
+{
+    if(!m_tilesField) {
+        createTileField();
+        commitZoom();
+    }
+    else {
+        m_needTilesFieldRebuild = true;
+        startUpdateTimer();
+    }
+}
+
+// #define DRAW_TILE_BOUNDS
+void TiledWebView::paintTile(QPainter* painter, const QPoint& t, const QRectF& clipRect, QRegion& dirtyRegion)
+{
+    QRectF tRectOrig = tileRect(t);
+    qreal adjust = 1; // + m_tilesScale;
+    QRectF tRect = tRectOrig.adjusted(-adjust, -adjust, adjust, adjust);
+    QRectF drawRect = clipRect.intersected(tRect);
+    //painter->drawPixmap(tRectOrig,tileAt(t)->img, tRectOrig.translated(-tRectOrig.topLeft()));
+    painter->drawPixmap(tRectOrig.topLeft(),tileAt(t)->img);
+#ifdef DRAW_TILE_BOUNDS
+    painter->setPen(Qt::red);
+    painter->drawRect(tileRect(t));
+#endif // DRAW_TILE_BOUNDS
+    dirtyRegion = dirtyRegion.subtract(QRegion(mapFromTileCoords(drawRect).toRect()));
+}
+
+void TiledWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget* widget)
+{
+
+    if(!m_tilesField) {
+        QGraphicsWebView::paint(painter, options, widget );
+        return;
+    }
+
+    painter->save();
+    QRectF clipRect = viewPortRect().adjusted(-1, -1, 1, 1);
+    if(options && !options->exposedRect.isEmpty())
+        clipRect &= options->exposedRect;
+
+    QList<QRectF> updatedTileRects;
+    QList<TileSet> updatedTiles;
+    if(!m_inUpdate && !m_tilesFrozen) {
+        QList<QRectF> lst;
+        if(m_userPaintTS.elapsed() > cPaintIdleTimeout || m_needViewportTilesUpdate) {
+            lst = updateViewportTiles(&updatedTiles);
+            m_needViewportTilesUpdate = false;
+        } else
+            lst = updateScrollAreaTilesChunk(&updatedTiles, true);
+        QRectF vpRect =  viewPortRect().adjusted(-1, -1, 1, 1);
+        foreach(QRectF r, lst) {
+            r = r.intersected(vpRect);
+            if(!r.isEmpty()) {
+                if(clipRect.contains(r)) {
+                    // do nothing, it will be updated in any case
+                } else if(r.contains(clipRect)) {
+                    clipRect = r;
+                } else if(clipRect.intersects(r)) {
+                    clipRect = clipRect.unite(r);
+                } else {
+                    updatedTileRects += r;
+                }
+            }
+        }
+    }
+
+    painter->setBackgroundMode(Qt::OpaqueMode);
+
+    painter->setClipRect(clipRect, Qt::IntersectClip);
+
+    QRectF tileClipRect = mapToTileCoords(clipRect);
+    QRegion dirtyRgn(clipRect.toRect());
+    QPoint topLeftTile = tileAtPoint(clipRect.topLeft());
+    QPoint rightBottomTile = tileAtPoint(clipRect.bottomRight());
+
+    boundPoint(QPoint(0,0),topLeftTile,topPoint(m_tilesDim));
+    boundPoint(QPoint(0,0),rightBottomTile,topPoint(m_tilesDim));
+
+    qreal sc = scale();
+    QPointF p = pos() / sc;
+
+    QRectF scr(clipRect.topLeft() + p, clipRect.size() * sc);
+
+    QRegion notReadyClip(scr.toRect()); //.adjusted(-2, -2, 2, 2).toRect());
+    for(int j = topLeftTile.y(); j <= rightBottomTile.y(); j++)
+        for(int i = topLeftTile.x(); i <= rightBottomTile.x(); i++) {
+            QPoint t(i,j);
+            if(tileAt(t) && tileAt(t)->ready) {
+                QRectF r = mapFromTileCoords(tileRect(t));
+                r = QRectF(r.topLeft() * sc, r.size() * sc);
+                r.translate(pos());
+                notReadyClip = notReadyClip.subtract(r.toRect());
+//               painter->setPen(Qt::red);
+//                painter->drawRect(r);
+            }
+        }
+
+//    painter->setPen(Qt::red);
+//    painter->drawRect(scr.adjusted(10,10,-10,-10));
+
+    QVector<QRect> rList = notReadyClip.rects();
+    if(!rList.isEmpty()) {
+        painter->save();
+        painter->translate(-p);
+        painter->scale(1/sc, 1/sc);
+        foreach(QRect r, rList) {
+            painter->fillRect(r, QBrush(*getUnprepPixmap()));
+            //        painter->setPen(Qt::red);
+            //        painter->drawRect(r.adjusted(10, 10, -10, -10));
+        }
+        painter->restore();
+    }
+
+    painter->scale(1 / m_tilesScale, 1 / m_tilesScale);
+
+    for(int j = topLeftTile.y(); j <= rightBottomTile.y(); j++)
+        for(int i = topLeftTile.x(); i <= rightBottomTile.x(); i++) {
+            QPoint t(i,j);
+            if(tileAt(t) && tileAt(t)->ready)
+                paintTile(painter, t, tileClipRect, dirtyRgn);
+        }
+    QRect clippedRectTiles(topLeftTile,rightBottomTile);
+    foreach(TileSet ts, updatedTiles)
+        if(!clippedRectTiles.contains(ts.t))
+            paintTile(painter, ts.t, ts.r, dirtyRgn);
+
+//    if(!m_inUpdate)
+//        m_userPaintTS.start();
+
+    if(!m_tilesFrozen && !m_tilesRect.contains(viewPortRect()) && qFuzzyCompare(scale(),m_tilesScale)) {
+        adjustTilesToViewPort();
+        startUpdateTimer();
+    }
+/*    painter->setPen(Qt::red);
+    painter->drawLine(0, 0, 100, 100);
+*/
+    painter->restore();
+}
+
+void TiledWebView::setTiledBackingStoreFrozen(bool frozen)
+{
+    m_tilesFrozen = frozen;
+    if(frozen) {
+        if(m_updateTimer.isActive())
+            stopUpdateTimer();
+    } else {
+        if(!qFuzzyCompare(scale(),m_tilesScale))
+            commitZoom();
+        else {
+            // m_needViewportTilesUpdate = true;
+            m_tilesRectCentered = false;
+        }
+
+        startUpdateTimer();
+    }
+}
+
+void TiledWebView::startUpdateTimer()
+{
+    if(!m_updateTimer.isActive() && !m_tilesFrozen) {
+        m_updateTimer.start(cTileUpdateTimerTick);
+    }
+}
+
+void TiledWebView::stopUpdateTimer()
+{
+    m_updateTimer.stop();
+}
+
+void TiledWebView::userActivity()
+{
+    m_userPaintTS.start();
+}
+
+void TiledWebView::viewScrolled(QPoint& scrollPos, QPoint& delta)
+{
+    m_lastScrollDelta = delta;
+
+    userActivity();
+    if(!m_tilesField) return;
+
+    QRectF ret(m_tilesRect);
+    if(ret.isEmpty())
+        ret = QRectF(QPoint(0,0),mapFromTileCoords(m_tilesDim * cTileSize));
+    // no repositioning and scaling and tile dropping during scaling
+    if(!qFuzzyCompare(m_tilesScale,scale()))
+        return;
+
+    QRectF vpRect = viewPortRect();
+    qreal tileSize = cTileSize / m_tilesScale;
+    vpRect.adjust(-tileSize, -tileSize, tileSize, tileSize);
+    if(vpRect.bottom() > ret.bottom() && delta.y() > 0)
+        ret.moveTop(vpRect.top() - tileSize);
+    else if(vpRect.top() < ret.top() && delta.y() < 0)
+        ret.moveBottom(vpRect.bottom() + tileSize);
+
+    if(vpRect.right() > ret.right() && delta.x() > 0)
+        ret.moveLeft(vpRect.left() - tileSize);
+    else if(vpRect.left() < ret.left() & delta.x() < 0)
+        ret.moveRight(vpRect.right() + tileSize);
+
+    ret = validateTileRect(ret, m_tilesDim);
+
+    moveTilesRect(ret);
+}
+
+#ifdef USE_ASSISTANT_ITEM
+
+void TiledWebView::resizeEvent(QGraphicsSceneResizeEvent *event)
+{
+    m_assistant->setGeometry(QRectF(QPoint(0,0), event->newSize()));
+}
+
+void TiledWebViewAssistant::paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget* widget)
+{
+    m_master->paint(painter, options, widget);
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/TiledWebView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,132 @@
+#ifndef TILEDWEBVIEW_H
+#define TILEDWEBVIEW_H
+
+#include <QGraphicsWebView>
+
+#include <QTime>
+#include <QTimer>
+
+#ifdef USE_OWN_TILED_CACHE
+#define USE_TILED_CACHE
+#endif
+
+//#define USE_ASSISTANT_ITEM
+
+#ifdef USE_ASSISTANT_ITEM
+class TiledWebView;
+class TiledWebViewAssistant : public QGraphicsWidget {
+public:
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget* widget);
+    TiledWebView* m_master;
+};
+#endif
+
+class TiledWebView : public QGraphicsWebView
+{
+    Q_OBJECT
+protected:
+    TiledWebView(QGraphicsItem* parent = 0);
+    virtual ~TiledWebView();
+
+    struct Tile {
+        Tile();
+        QPixmap img;
+        QRectF dirtyRect; // in tile coordinates
+        bool ready;
+        bool used;
+    };
+
+    struct TileSet {
+        TileSet(QPoint aT, QRectF aR) { t = aT; r = aR; }
+        TileSet(const TileSet &o) { t = o.t; r = o.r; }
+        QPoint t;
+        QRectF r;
+    };
+
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget* widget);
+
+    Tile* createTile(const QPoint& p);
+    Tile* tileAt(const QPoint& p) const;
+    Tile* tileAt(int x, int y) const { return tileAt(QPoint(x, y)); }
+    void setTileAt(const QPoint& p,Tile* t);
+    void setTileAt(int x, int y,Tile* t) { setTileAt(QPoint(x, y), t); }
+    QPoint tileAtPoint(const QPointF& p) const;
+    QRectF tileRect(const QPoint& t) const; // return is in tile coords
+    QRectF mapToTileCoords(const QRectF& rect) const
+        { return QRectF(mapToTileCoords(rect.topLeft()),mapToTileCoords(rect.size())); }
+
+    QPointF mapToTileCoords(const QPointF& p) const     { return p * m_tilesScale; }
+    QSizeF mapToTileCoords(const QSizeF& s) const     { return s * m_tilesScale; }
+
+    QRectF mapFromTileCoords(const QRectF& rect) const
+        { return QRectF(mapFromTileCoords(rect.topLeft()),mapFromTileCoords(rect.size())); }
+
+    QPointF mapFromTileCoords(const QPointF& p) const     { return p / m_tilesScale; }
+    QSizeF mapFromTileCoords(const QSizeF& s) const     { return s / m_tilesScale; }
+
+    QRectF viewPortRect() const;
+    QPoint findTile4Update(bool inView, bool addDirty = false) const;
+    QList<QPoint> findTileLine4Update(bool dirty, bool inView, bool useScrollDirection = true) const;
+    void boundTile(QPoint& t) const;
+    QRectF updateTile(const QPoint& t);
+    void paintTile(QPainter* painter, const QPoint& t, const QRectF& dirtyRect, QRegion& dirtyRegion);
+    void createTileField();
+
+
+    QRectF validateTileRect(const QRectF& rect, const QSize& dim) const;
+    QRectF adjustedTileRect(const QSize& dim) const;
+    QRectF centeredTileRect(const QSize& dim) const;
+    void adjustTilesToViewPort(bool center = false);
+    void moveTilesRect(const QRectF& newTilesRect);
+    void resetTiles(const QRect& r, bool remove);
+    void scrollTileField(const QPoint& diff);
+    static QPixmap* getUnprepPixmap();
+    void checkTilesField();
+    void setPage(QWebPage* page);
+    QList<QRectF> updateViewportTiles(QList<TileSet> *updatedTiles = 0);
+    QList<QRectF> updateScrollAreaTilesChunk(QList<TileSet> *updatedTiles = 0, bool inPaint = 0);
+    void doScaleCommit();
+    void doTilesFieldRebuild();
+    void updateSceneRects(const QList<QRectF>& dirtyTiles);
+#ifdef USE_ASSISTANT_ITEM
+    void resizeEvent(QGraphicsSceneResizeEvent *event);
+#endif
+    QSize getTileFieldDim();
+
+    QVector<Tile*> m_tilesPool;
+    Tile** m_tilesField;
+    QSize  m_tilesDim;
+    QRectF m_tilesRect;
+    qreal  m_tilesScale;
+    bool   m_inUpdate;
+    bool   m_tilesRectCentered;
+    QTime  m_userPaintTS;
+    QTimer m_updateTimer;
+    bool   m_tilesFrozen;
+    bool   m_needViewportTilesUpdate;
+    bool   m_needScaleCommit;
+    bool   m_needTilesFieldRebuild;
+    QPoint m_lastScrollDelta;
+#ifdef USE_ASSISTANT_ITEM
+    TiledWebViewAssistant* m_assistant;
+#endif // USE_ASSISTANT_ITEM
+
+private slots:
+    void repaintRequested(QRect);
+    void updateTimeout();
+    void scheduleScaleUpdate();
+    void startUpdateTimer();
+    void stopUpdateTimer();
+    void loadStarted();
+
+public slots:
+    void viewportUpdated();
+    void commitZoom();
+    void setTiledBackingStoreFrozen(bool frozen);
+    void userActivity();
+    void viewScrolled(QPoint& scrollPos, QPoint& delta);
+
+  friend class TiledWebViewAssistant;
+};
+
+#endif // TILEDWEBVIEW_H
--- a/ginebra2/ContentViews/ViewportMetaData.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/ViewportMetaData.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -20,20 +20,33 @@
 */
 
 #include "ViewportMetaData.h"
+#include <QApplication>
+#include <QDesktopWidget>
+#include "WebGestureHelper.h"
 
-static const int DefaultViewportWidth = 640;
-static const int DefaultViewportHeight = 640;
+
 static const int MinViewportWidth = 200;
 static const int MaxViewportWidth = 10000;
 static const int MinViewportHeight = 200;
 static const int MaxViewportHeight = 10000;
 static const qreal DefaultMinScale = 0.2;
-static const qreal DefaultMaxScale = 5.;
+static const qreal DefaultMaxScale = 3.;
+static const qreal DefaultPageLayoutScale = 0.667;
 
 namespace GVA {
 
 ViewportMetaData::ViewportMetaData()
 {
+    #ifndef Q_WS_MAEMO_5
+    QRect screenGeom = browserApp->mainWindow()->geometry();
+    m_defaultViewportWidth = screenGeom.width();
+    m_defaultViewportHeight = screenGeom.height();
+    #else
+    m_defaultViewportWidth = 700;
+    m_defaultViewportHeight = 400;
+    #endif
+    m_maxViewportWidth = m_defaultViewportWidth;
+    m_maxViewportHeight = m_defaultViewportHeight;
     initialize();
 }
 
@@ -50,6 +63,9 @@
     m_specifiedData.m_width = other.m_specifiedData.m_width;
     m_specifiedData.m_height = other.m_specifiedData.m_height;
     m_specifiedData.m_minScale = other.m_specifiedData.m_minScale;
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    m_userScalableOverRidden = other.m_userScalableOverRidden;
+#endif
 }
 
 ViewportMetaData& ViewportMetaData::operator=(const ViewportMetaData& other)
@@ -65,6 +81,9 @@
     m_specifiedData.m_width = other.m_specifiedData.m_width;
     m_specifiedData.m_height = other.m_specifiedData.m_height;
     m_specifiedData.m_minScale = other.m_specifiedData.m_minScale;
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    m_userScalableOverRidden = other.m_userScalableOverRidden;
+#endif
 
     return *this;
 }
@@ -72,50 +91,74 @@
 ViewportMetaData::~ViewportMetaData()
 {}
 
-void ViewportMetaData::adjustViewportData(const QRect& clientRect)
+QSize ViewportMetaData::getSpecifiedSize() const
+{
+    QSize ret(m_maxViewportWidth / DefaultPageLayoutScale,
+              m_maxViewportHeight / DefaultPageLayoutScale);
+    if(m_initialScale > 0)
+        ret = QSize(m_maxViewportWidth / m_initialScale,
+                    m_maxViewportHeight / m_initialScale);
+
+    // assign specified data and swap if necessary
+    if(!m_specifiedData.m_width.isEmpty() && m_specifiedData.m_width != "device-width") {
+
+        if(m_specifiedData.m_width == "device-height")
+            ret.setWidth(m_maxViewportHeight);
+        else
+            ret.setWidth(m_specifiedData.m_width.toInt());
+    }
+
+    if(!m_specifiedData.m_height.isEmpty() && m_specifiedData.m_height != "device-height") {
+        if(m_specifiedData.m_height == "device-width")
+            ret.setHeight(m_maxViewportWidth);
+        else
+            ret.setHeight(m_specifiedData.m_height.toInt());
+    }
+
+    return ret;
+}
+
+void ViewportMetaData::adjustViewportData(const QSizeF& clientRect)
 {
     //Data updated from viewport tag
     m_isValid = true;
 
+    m_maxViewportWidth = clientRect.width();
+    m_maxViewportHeight = clientRect.height();
+
+    QSize s = getSpecifiedSize();
+
+//    if((m_maxViewportWidth > m_maxViewportHeight && m_width < m_height) ||
+//       (m_maxViewportWidth < m_maxViewportHeight && m_width > m_height))
+//        qSwap(m_width,m_height);
+
+/*
     //Adjust viewport dimensions
-    m_width = qBound(MinViewportWidth, m_width, MaxViewportWidth);
-    m_height = qBound(MinViewportHeight, m_height, MaxViewportHeight);
+    m_width = qBound(MinViewportWidth, m_width, m_maxViewportWidth);
+    m_height = qBound(MinViewportHeight, m_height, m_maxViewportHeight);
 
     //Aspect ratio
     qreal aspectRation = (qreal)clientRect.width() / clientRect.height();
 
-    if (m_width != DefaultViewportWidth && m_height == DefaultViewportHeight) {
+    if (m_width != m_maxViewportWidth && m_height == m_maxViewportHeight) {
         //Width has been specified. Adjust height, min scale and max scale
         m_height = m_width * (1 / aspectRation);
-    } else if (m_width == DefaultViewportWidth && m_height != DefaultViewportHeight) {
+    } else if (m_width == m_maxViewportWidth && m_height != m_maxViewportHeight) {
         //Height has been specified. Adjust width, min scale and max scale
         m_width = m_height * aspectRation;
     } else {
         //Putting below code under seperate 'else' to make it readable!
         m_height = m_width * (1 / aspectRation);
     }
-
-    //Adjust zoom limits
-    adjustZoomValues(clientRect);
+*/
+    m_width = qBound(MinViewportWidth, s.width(), m_maxViewportWidth);
+    m_height = qBound(MinViewportHeight, s.height(), m_maxViewportHeight);
 }
 
-void ViewportMetaData::updateViewportData(const QSize& newContentSize, const QRect& clientRect)
+
+void ViewportMetaData::orientationChanged(const QSizeF& newClientRect)
 {
-    //If still viewport tag has not been parsed
-    //Do not update values.
-    if(!m_isValid)
-        return;
-
-    //Update with viewport dimensions
-    m_width = qBound(MinViewportWidth, newContentSize.width(), MaxViewportWidth);
-    m_height = qBound(MinViewportHeight, newContentSize.height(), MaxViewportHeight);
-
-    //Adjust zoom limits
-    adjustZoomValues(clientRect);
-}
-
-void ViewportMetaData::orientationChanged(const QRect& newClientRect)
-{
+    /*
     //If still viewport tag has not been parsed
     //Do not update values.
     if(!m_isValid)
@@ -145,8 +188,14 @@
     }
 
     //Update with bounds
-    m_width = qBound(MinViewportWidth, m_width, MaxViewportWidth);
-    m_height = qBound(MinViewportHeight, m_height, MaxViewportHeight);
+    //m_width = qBound(MinViewportWidth, m_width, m_maxViewportWidth);
+    //m_height = qBound(MinViewportHeight, m_height, m_maxViewportHeight);
+     
+     */
+
+    m_width = newClientRect.height();
+    m_height = newClientRect.width();
+
 }
 
 bool ViewportMetaData::isLayoutNeeded()
@@ -160,25 +209,29 @@
     m_initialScale = ValueUndefined;
     m_minimumScale = DefaultMinScale;
     m_maximumScale = DefaultMaxScale;
-    m_width = DefaultViewportWidth;
-    m_height = DefaultViewportHeight;
+    m_width = m_maxViewportWidth; //m_defaultViewportWidth;
+    m_height = m_maxViewportHeight; //m_defaultViewportHeight;
     m_userScalable = true;
     m_isValid = false;
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    m_userScalableOverRidden = false;
+#endif
 
     //Clear user defined scales
     setFlag(UserDefinedMinumumScale, false);
     setFlag(UserDefinedMaximumScale, false);
     setFlag(UserDefinedInitialScale, false);
+    m_specifiedData.m_minScale = -1;
 }
 
-void ViewportMetaData::adjustZoomValues(const QRect& clientRect)
+void ViewportMetaData::adjustZoomValues(const QSizeF& contentSize)
 {
-    qreal fitToWidthZoom = (qreal)clientRect.width() / m_width;
+    qreal fitToWidthZoom = m_width / (qreal)contentSize.width();
     fitToWidthZoom = qBound(DefaultMinScale, fitToWidthZoom, DefaultMaxScale);
 
     m_maximumScale = qBound(fitToWidthZoom, m_maximumScale, DefaultMaxScale);
 
-    //Adjust minimum-sclae
+    //Adjust minimum-scale
     if (getFlag(UserDefinedMinumumScale)) {
         m_minimumScale = m_specifiedData.m_minScale;
         m_minimumScale = qBound(fitToWidthZoom, m_minimumScale, m_maximumScale);
@@ -187,14 +240,25 @@
         m_minimumScale = fitToWidthZoom;
 
     //Adjust initial-scale
-    if (getFlag(UserDefinedInitialScale))
-        m_initialScale = qBound(m_minimumScale, m_initialScale, m_maximumScale);
-    else
-        m_initialScale = m_minimumScale;
+//    if (getFlag(UserDefinedInitialScale))
+//        m_initialScale = qBound(m_minimumScale, m_initialScale, m_maximumScale);
+//    else
+//        m_initialScale = m_minimumScale;
 
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    if (m_minimumScale == m_maximumScale) {
+        m_minimumScale = DefaultMinScale;
+        m_maximumScale = DefaultMaxScale;
+        if(!m_userScalable) {
+            m_userScalable = true;
+            m_userScalableOverRidden = true;
+        }
+    }
+#else
     //Turn off zooming if min and max zoom are same
     if (m_minimumScale == m_maximumScale)
         m_userScalable = false;
+#endif
 }
 
 
--- a/ginebra2/ContentViews/ViewportMetaData.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/ViewportMetaData.h	Fri Oct 15 17:30:59 2010 -0400
@@ -26,6 +26,13 @@
 #include <QObject>
 #include <QRect>
 
+// Define VIEWPORT_ALWAYS_ALLOW_ZOOMING to force all content (particularly mobile content that
+// has UserScalable turned off) to be scalable.  This makes such content more usable since our
+// default font is so small.  If we switch to a larger default font this can be removed.
+#ifdef Q_WS_MAEMO_5
+#define VIEWPORT_ALWAYS_ALLOW_ZOOMING
+#endif
+
 namespace GVA {
 
 struct ParsedViewportData{
@@ -52,9 +59,10 @@
     ViewportMetaData& operator=(const ViewportMetaData&);
     ~ViewportMetaData();
 
-    void adjustViewportData(const QRect& clientRect);
-    void updateViewportData(const QSize& size, const QRect& clientRect);
-    void orientationChanged(const QRect& newClientRect);
+    void adjustViewportData(const QSizeF& clientRect);
+    QSize getSpecifiedSize() const;
+    void adjustZoomValues(const QSizeF& contentSize);
+    void orientationChanged(const QSizeF& newClientRect);
     bool isLayoutNeeded();
     void reset() {initialize();}
 
@@ -73,7 +81,7 @@
 
 protected:
     void initialize();
-    void adjustZoomValues(const QRect& clientRect);
+
     bool isUserSpecifiedWidth();
     bool isUserSpecifiedHeight();
 
@@ -84,9 +92,18 @@
     int m_width;
     int m_height;
     bool m_userScalable;
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    /// True indicates that "user-scalable=no" has been overridden.
+    bool m_userScalableOverRidden;
+#endif
     ScaleLimits m_scaleLimits;
     bool m_isValid;
     ParsedViewportData m_specifiedData;
+    int m_defaultViewportWidth;
+    int m_defaultViewportHeight;
+    int m_maxViewportWidth;
+    int m_maxViewportHeight;
+    
 };//ViewportMetaData
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(ViewportMetaData::ScaleLimits)
--- a/ginebra2/ContentViews/ViewportMetaDataParser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/ViewportMetaDataParser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -30,11 +30,11 @@
 ViewportMetaDataParser::~ViewportMetaDataParser()
 {}
 
-ViewportMetaData ViewportMetaDataParser::parse(const QString& viewportParams)
+void ViewportMetaDataParser::parse(const QString& viewportParams, ViewportMetaData& viewportMetaData)
 {
-    ViewportMetaData viewportMetaData = processArguments(viewportParams);
-    viewportMetaData.adjustViewportData(m_clientRect);
-    return viewportMetaData;
+    processArguments(viewportParams, viewportMetaData);
+    //viewportMetaData.adjustViewportData(m_clientRect);
+    return;
 }
 
 
@@ -55,12 +55,10 @@
             || c == ';';
 }
 
-ViewportMetaData ViewportMetaDataParser::processArguments(const QString& features)
+void ViewportMetaDataParser::processArguments(const QString& features, ViewportMetaData& viewportMetaData)
 {
     int keyBegin, keyEnd;
     int valueBegin, valueEnd;
-    ViewportMetaData viewportMetaData;
-
     int i = 0;
     int length = features.length();
     QString buffer = features.toLower();
@@ -104,7 +102,16 @@
         QString valueString = buffer.mid(valueBegin, valueEnd - valueBegin);
         setViewportFeature(keyString, valueString, viewportMetaData);
     }
-    return viewportMetaData;
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+    // Hacks to always allow zooming. !!!
+    if(viewportMetaData.m_minimumScale == viewportMetaData.m_maximumScale) {
+        viewportMetaData.m_minimumScale = 0.2;
+        viewportMetaData.m_maximumScale = 5.0;
+        viewportMetaData.m_userScalable = true;
+        viewportMetaData.m_userScalableOverRidden = true;
+    }
+#endif
+    return;
 }
 
 void ViewportMetaDataParser::setViewportFeature(const QString& keyString, const QString& valueString, ViewportMetaData& viewportMetaData)
@@ -140,8 +147,14 @@
     else if (keyString == "user-scalable") {
         if (QString::compare(valueString, "yes", Qt::CaseInsensitive) == 0)
             viewportMetaData.m_userScalable = true;
-        else
+        else {
+#ifdef VIEWPORT_ALWAYS_ALLOW_ZOOMING
+            viewportMetaData.m_userScalable = true;
+            viewportMetaData.m_userScalableOverRidden = true;
+#else
             viewportMetaData.m_userScalable = false;
+#endif
+        }
     }
     else if (keyString == "width") {
         viewportMetaData.m_width = value;
--- a/ginebra2/ContentViews/ViewportMetaDataParser.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/ViewportMetaDataParser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -31,12 +31,12 @@
     ViewportMetaDataParser(const QRect& clientRect);
     ~ViewportMetaDataParser();
 
-    ViewportMetaData parse(const QString&);
+    void parse(const QString& viewportParams, ViewportMetaData& viewportMetaData);
 
 private:
     void adjustViewportData(ViewportMetaData& viewportMetaData);
     bool isSeparator(QChar c);
-    ViewportMetaData processArguments(const QString& features);
+    void processArguments(const QString& features, ViewportMetaData& viewportMetaData);
     void setViewportFeature(const QString& keyString, const QString& valueString, ViewportMetaData& viewportMetaData);
 
     QRect m_clientRect;
--- a/ginebra2/ContentViews/WebContentAnimationItem.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not,
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-#include "WebContentAnimationItem.h"
-
-#include <QGraphicsWebView>
-#include <QtGlobal>
-#include <QWebElement>
-#include <QWebFrame>
-
-static const int MinDoubleClickZoomTargetWidth = 100;     //Target block width for applying double tap zoom
-static const int ZoomCommitDuration = 50;                 //Timeout before commiting zoom
-static const qreal ZoomableContentMinWidth = 300.;
-
-namespace GVA {
-
-WebContentAnimationItem::WebContentAnimationItem(QGraphicsWidget* parent, Qt::WindowFlags wFlags)
-    : QGraphicsWidget(parent, wFlags)
-    , m_zoomCommitTimer(this)
-    , m_viewportMetaData(0)
-{
-    setFlag(QGraphicsItem::ItemHasNoContents, true);
-    setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
-    setFlag(QGraphicsItem::ItemClipsToShape, true);
-
-    setFiltersChildEvents(true);
-
-    connect(&m_zoomCommitTimer, SIGNAL(timeout()), this, SLOT(commitZoom()));
-    m_zoomCommitTimer.setSingleShot(true);
-}
-
-WebContentAnimationItem::~WebContentAnimationItem()
-{}
-
-void WebContentAnimationItem::setWebView(QGraphicsWebView* webView)
-{
-    Q_ASSERT(m_webView);
-    m_webView = webView;
-
-    //Enabling resize to contents avoids scrollbars in mainframe
-    m_webView->setResizesToContents(true);
-    m_webView->setParentItem(this);
-    m_webView->setAttribute(Qt::WA_OpaquePaintEvent, true);
-}
-
-void WebContentAnimationItem::updatePreferredContentSize(const QSize& size)
-{
-    // FIXME: we have bug in QtWebKit API when tileCacheEnabled is true.
-    // this causes viewport not to reset between the page loads.
-    // Thus, we need to update viewport manually until we have fix for this.
-
-    m_webView->page()->setPreferredContentsSize(size);
-    resize(contentsSize());
-}
-
-QSize WebContentAnimationItem::contentsSize() const
-{
-    return m_webView->page()->mainFrame()->contentsSize();
-}
-
-void WebContentAnimationItem::setZoomScale(qreal value, bool immediateCommit)
-{
-    value = qBound(m_viewportMetaData->m_minimumScale, value, m_viewportMetaData->m_maximumScale);
-    qreal curZoomScale = zoomScale();
-
-    if (qFuzzyCompare(value, curZoomScale)) {
-        notifyZoomActions(curZoomScale);
-        return;
-    }
-
-    if (!immediateCommit)
-        disableContentUpdates();
-
-    m_webView->setScale(value);
-
-    if (immediateCommit)
-        commitZoom();
-    else
-        m_zoomCommitTimer.start(ZoomCommitDuration);
-}
-
-qreal WebContentAnimationItem::zoomScale() const
-{
-    if (!m_webView)
-        return 1.;
-
-    return m_webView->scale();
-}
-
-QRectF WebContentAnimationItem::findZoomableRectForPoint(const QPointF& point)
-{
-    QPointF zoomPoint = m_webView->mapFromParent(point);
-
-    QWebHitTestResult hitResult = m_webView->page()->mainFrame()->hitTestContent(zoomPoint.toPoint());
-    QWebElement targetElement = hitResult.enclosingBlockElement();
-
-    while (!targetElement.isNull() && targetElement.geometry().width() < MinDoubleClickZoomTargetWidth)
-        targetElement = targetElement.parent();
-
-    if (!targetElement.isNull()) {
-        QRectF elementRect = targetElement.geometry();
-        qreal overMinWidth = elementRect.width() - ZoomableContentMinWidth;
-        if (overMinWidth < 0)
-            elementRect.adjust(overMinWidth / 2, 0, -overMinWidth / 2, 0);
-        zoomPoint.setX(elementRect.x());
-        QRectF resultRect(zoomPoint, elementRect.size());
-        return QRectF(m_webView->mapToParent(resultRect.topLeft()),
-                      m_webView->mapToParent(resultRect.bottomRight()));
-    }
-    return QRectF();
-}
-
-void WebContentAnimationItem::disableContentUpdates()
-{
-    //Disable tiling updates
-    m_webView->setTiledBackingStoreFrozen(true);
-}
-
-void WebContentAnimationItem::enableContentUpdates()
-{
-    //Enable tiling updates
-    m_webView->setTiledBackingStoreFrozen(false);
-}
-
-void WebContentAnimationItem::commitZoom()
-{
-    m_zoomCommitTimer.stop();
-    notifyZoomActions(zoomScale());
-    enableContentUpdates();
-}
-
-void WebContentAnimationItem::resizeEvent(QGraphicsSceneResizeEvent* event)
-{
-    QGraphicsWidget::resizeEvent(event);
-    setZoomScale(size().width() / contentsSize().width());
-}
-
-void WebContentAnimationItem::notifyZoomActions(qreal newScale)
-{
-    bool enableZoomIn = false;
-    bool enableZoomOut = false;
-
-    if (m_viewportMetaData->m_userScalable) {
-
-        if (newScale > m_viewportMetaData->m_minimumScale)
-            enableZoomOut = true;
-        else
-            enableZoomOut = false;
-
-        if (newScale < m_viewportMetaData->m_maximumScale)
-            enableZoomIn = true;
-        else
-            enableZoomIn = false;
-	} 
-
-    emit updateZoomActions(enableZoomIn, enableZoomOut);
-}
-
-} //namespace GVA
--- a/ginebra2/ContentViews/WebContentAnimationItem.h	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program.  If not,
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-#ifndef WebContentAnimationItem_h
-#define WebContentAnimationItem_h
-
-#include "ViewportMetaDataParser.h"
-
-#include <QGraphicsWidget>
-#include <QTimer>
-
-class QGraphicsWebView;
-
-namespace GVA {
-
-class WebContentAnimationItem : public QGraphicsWidget {
-    Q_OBJECT
-    Q_PROPERTY(qreal zoomScale READ zoomScale WRITE setZoomScale)
-
-public:
-    WebContentAnimationItem(QGraphicsWidget* parent = 0, Qt::WindowFlags wFlags = 0);
-    ~WebContentAnimationItem();
-
-    void setWebView(QGraphicsWebView* webView);
-    QGraphicsWebView* webView() const { return m_webView; }
-
-    void updatePreferredContentSize(const QSize& size);
-    QSize contentsSize() const;
-
-    void setZoomScale(qreal, bool immediateCommit = false);
-    qreal zoomScale() const;
-
-    QRectF findZoomableRectForPoint(const QPointF& point);
-
-    void setViewportMetaData(ViewportMetaData* viewportMetaData) { m_viewportMetaData = viewportMetaData; }
-
-public Q_SLOTS:
-    void enableContentUpdates();
-    void disableContentUpdates();
-    void commitZoom();
-
-protected:
-    void resizeEvent(QGraphicsSceneResizeEvent* event);
-	void notifyZoomActions(qreal newScale);
-
-Q_SIGNALS:
-    void updateZoomActions(bool enableZoomIn, bool enableZoomOut);
-
-private:
-    QGraphicsWebView* m_webView;
-    QTimer m_zoomCommitTimer;
-    ViewportMetaData* m_viewportMetaData; //Not owned!
-}; //WebContentAnimationItem
-
-} //namespace GVA
-
-#endif //WebContentAnimationItem_h
-
--- a/ginebra2/ContentViews/WebContentViewWidget.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/WebContentViewWidget.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -22,34 +22,36 @@
 #include "WebContentViewWidget.h"
 
 #include "ScrollableWebContentView.h"
-#include "WebContentAnimationItem.h"
 #include "webpagecontroller.h"
 #include "WebView.h"
 #include "wrtbrowsercontainer.h"
-#include "ZoomMetaData.h"
+#include "webpagedata.h"
+
+#ifdef Q_WS_MAEMO_5
+#include "ContentViewContextMenu.h"
+#endif
+#include "GWebContentView.h"
 
 #include <QGraphicsLinearLayout>
 #include <QStyleOptionGraphicsItem>
 #include <QWebFrame>
+#include "QWebHistoryItem"
 
 namespace GVA {
 
-WebContentViewWidget::WebContentViewWidget(QObject* parent, QWebPage* page)
-    : m_webViewportProxy(new WebContentAnimationItem())
+WebContentViewWidget::WebContentViewWidget(QObject* parent, GWebContentView* view, QWebPage* page): 
+	m_webContentView(view)
 {
     setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
     setParent(parent);
 
-    m_webViewport = new ScrollableWebContentView(m_webViewportProxy, this);
-
     m_webView = new WebView();
+    m_webViewport = new ScrollableWebContentView(m_webView, this);
 
     if (page)
         setPage(page);
 
-    m_webViewportProxy->setWebView(m_webView);
-    updatePreferredContentSize();
-    m_webViewportProxy->setPos(QPointF(0,0));
+    //updatePreferredContentSize();
 
     //FIX ME : Should we have to delete layout??
     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical, this);
@@ -57,41 +59,88 @@
     layout->setSpacing(0.);
     layout->addItem(m_webViewport);
 
-    connect(m_webViewportProxy
+    connect(m_webViewport
             , SIGNAL(updateZoomActions(bool,bool))
             , this
             , SIGNAL(updateZoomActions(bool,bool)));
+    #ifdef Q_WS_MAEMO_5
     connect(m_webViewport
-            , SIGNAL(contextEventObject(QWebHitTestResult*))
+            , SIGNAL(contextEventObject(QWebHitTestResult*, QPointF))
             , this
-            , SIGNAL(contextEventObject(QWebHitTestResult*)));
-
+            , SLOT(onContextEventObject(QWebHitTestResult*, QPointF)));
+    #else
+    connect(m_webViewport
+            , SIGNAL(contextEventObject(QWebHitTestResult*, QPointF))
+            , this
+            , SIGNAL(contextEventObject(QWebHitTestResult*, QPointF)));
+    #endif
     connect(m_webViewport
             , SIGNAL(viewScrolled(QPoint&, QPoint&))
             , this
             , SIGNAL(viewScrolled(QPoint&, QPoint&)));
 
     connect(m_webViewport
-            , SIGNAL(mouseEvent(QEvent::Type))
+            , SIGNAL(contentViewMouseEvent(QEvent::Type))
             , this
             , SIGNAL(mouseEvent(QEvent::Type)));
+
+    //To speed up painting.
+    setFlag(QGraphicsItem::ItemHasNoContents, true);
+    setAttribute(Qt::WA_OpaquePaintEvent, true);
 }
 
 WebContentViewWidget::~WebContentViewWidget()
 {
     delete m_webView;
-    delete m_webViewportProxy;
     delete m_webViewport;
 }
 
+
+bool WebContentViewWidget::event(QEvent * e) 
+{
+    if (e->type() == QEvent::Gesture) {
+        return  m_webViewport->event(e);
+    }
+    return QGraphicsWidget::event(e);
+}
+
 void WebContentViewWidget::resizeEvent(QGraphicsSceneResizeEvent* event)
 {
     QGraphicsWidget::resizeEvent(event);
 
-    setGeometry(QRectF(pos(), size()));
+    // WTF? setGeometry(QRectF(pos(), size()));
     setPreferredSize(size());
+    QSizeF vpSize = m_webViewport->size();
+    if(vpSize.width() > size().width()) vpSize.setWidth(size().height());
+    if(vpSize.height() > size().height()) vpSize.setHeight(size().height());
+
+    QPointF vpPos = m_webViewport->pos();
+    if(vpPos.x() + vpSize.width() > geometry().right())
+        vpPos.setX(geometry().right() - vpSize.width());
+    if(vpPos.y() + vpSize.height() > geometry().bottom())
+        vpPos.setY(geometry().bottom() - vpSize.height());
+
+    QRectF vpGeom(vpPos,vpSize);
+    if(vpGeom != m_webViewport->geometry()) {
+        // Should we center it here?
+        m_webViewport->setGeometry(vpGeom);
+    }
 }
 
+#ifdef Q_WS_MAEMO_5
+void WebContentViewWidget::onContextEventObject(QWebHitTestResult* hitTest, QPointF position) {
+    if(m_webContentView->currentPageIsSuperPage()) {
+        // Let the superpage handle the event.
+        ::WebViewEventContext *context = new ::WebViewEventContext(view()->type(), *hitTest);
+        m_webContentView->currentSuperPage()->onContextEvent(context);
+    }
+    else {
+        ContentViewContextMenu menu(hitTest, 0);
+        menu.exec(position.toPoint());
+    }
+}
+#endif
+
 QWebPage* WebContentViewWidget::page()
 {
     return m_webView->page();
@@ -99,29 +148,49 @@
 
 void WebContentViewWidget::setPage(QWebPage* page)
 {
-    m_webView->setPage(page);
+    QWebPage* oldPage = this->page(); 
+    if(oldPage) {
+        disconnect(this->page()->mainFrame(), SIGNAL(initialLayoutCompleted()), m_webViewport, SLOT(reset()));
+        disconnect(this->page(), SIGNAL(restoreFrameStateRequested(QWebFrame*)), this, SLOT(restoreViewportFromHistory(QWebFrame*)));
+        disconnect(this->page(), SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)), this, SLOT(saveViewportToHistory(QWebFrame*,QWebHistoryItem*)));
+        disconnect(this->page()->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), m_webViewport, SLOT(contentsSizeChanged(const QSize&)));
+        disconnect(this->page(), SIGNAL(loadStarted()), m_webViewport, SLOT(pageLoadStarted()));
+        disconnect(this->page(), SIGNAL(loadProgress(int)), m_webViewport, SLOT(pageLoadProgress(int)));
+        disconnect(this->page(), SIGNAL(loadFinished(bool)), m_webViewport, SLOT(pageLoadFinished(bool)));
+    }
+    
+    m_webViewport->setPage(page);
 
     connect(this->page()->mainFrame(), SIGNAL(initialLayoutCompleted()), m_webViewport, SLOT(reset()));
+    connect(this->page(), SIGNAL(restoreFrameStateRequested(QWebFrame*)), this, SLOT(restoreViewportFromHistory(QWebFrame*)));
+    connect(this->page(), SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)), this, SLOT(saveViewportToHistory(QWebFrame*,QWebHistoryItem*)));
     connect(this->page()->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), m_webViewport, SLOT(contentsSizeChanged(const QSize&)));
-    connect(this->page()->mainFrame(), SIGNAL(loadFinished(bool)), m_webViewport, SLOT(pageLoadFinished(bool)));
+    connect(this->page(), SIGNAL(loadStarted()), m_webViewport, SLOT(pageLoadStarted()));
+    connect(this->page(), SIGNAL(loadProgress(int)), m_webViewport, SLOT(pageLoadProgress(int)));
+    connect(this->page(), SIGNAL(loadFinished(bool)), m_webViewport, SLOT(pageLoadFinished(bool)));
 }
 
-QGraphicsWebView* WebContentViewWidget::webView()
+QGraphicsWebView* WebContentViewWidget::webView() const
 {
     return m_webView;
 }
 
-ZoomMetaData WebContentViewWidget::currentPageInfo()
+QGraphicsWidget* WebContentViewWidget::viewPort() const
 {
-    return m_webViewport->currentPageInfo();
+    return m_webViewport;
 }
 
-void WebContentViewWidget::setCurrentPageInfo(ZoomMetaData data)
+WebPageData WebContentViewWidget::pageDataFromViewportInfo()
 {
-    m_webViewport->setCurrentPageInfo(data);
+    return m_webViewport->pageDataFromViewportInfo();
 }
 
-ZoomMetaData WebContentViewWidget::defaultZoomData()
+void WebContentViewWidget::setPageDataToViewportInfo(const WebPageData& data)
+{
+    m_webViewport->setPageDataToViewportInfo(data);
+}
+
+WebPageData WebContentViewWidget::defaultZoomData()
 {
     return m_webViewport->defaultZoomData();
 }
@@ -129,7 +198,7 @@
 void WebContentViewWidget::setPageZoom(bool zoomIn)
 {
     Q_ASSERT(m_webViewport);
-    m_webViewport->zoomToScreenCenter(zoomIn);
+    m_webViewport->toggleZoom(zoomIn);
 }
 
 void WebContentViewWidget::showPage(bool isSuperPage)
@@ -148,6 +217,7 @@
     m_webViewport->updatePreferredContentSize();
 }
 
+
 void WebContentViewWidget::setGesturesEnabled(bool value)
 {
     m_webViewport->setGesturesEnabled(value);
@@ -158,4 +228,23 @@
     return m_webViewport->gesturesEnabled();
 }
 
+void WebContentViewWidget::restoreViewportFromHistory(QWebFrame* frame)
+{
+    WRT::WrtBrowserContainer* wbc = WebPageController::getSingleton()->currentPage();
+    if(wbc->pageZoomMetaData()->isValid() && wbc->mainFrame() == frame) {
+        WebPageData* d = wbc->pageZoomMetaData();
+        m_webViewport->setPageDataToViewportInfo(*d);
+    }
+}
+
+void WebContentViewWidget::saveViewportToHistory(QWebFrame* frame, QWebHistoryItem* item)
+{
+    WRT::WrtBrowserContainer* wbc = WebPageController::getSingleton()->currentPage();
+    if(wbc->mainFrame() == frame) {
+        WebPageData d = m_webViewport->pageDataFromViewportInfo();
+        if(d.isValid())
+            item->setUserData(QVariant::fromValue(d));
+    }
+}
+
 } // namespace GVA
--- a/ginebra2/ContentViews/WebContentViewWidget.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/WebContentViewWidget.h	Fri Oct 15 17:30:59 2010 -0400
@@ -23,24 +23,26 @@
 #define WebContentViewWidget_h
 
 #include <QGraphicsWidget>
+#include "webpagedata.h"
 
 class QGraphicsWebView;
 class QWebPage;
 class QWebHitTestResult;
-struct ZoomMetaData;
+class QWebFrame;
+class QWebHistoryItem;
 
 namespace GVA {
 
 class ScrollableWebContentView;
-class WebContentAnimationItem;
 class WebView;
+class GWebContentView;
 
 class WebContentViewWidget : public QGraphicsWidget {
     Q_OBJECT
     Q_PROPERTY(QWebPage* page READ page WRITE setPage)
 
 public:
-    WebContentViewWidget(QObject* parent, QWebPage* page = 0);
+    WebContentViewWidget(QObject* parent, GWebContentView* view, QWebPage* page = 0);
     ~WebContentViewWidget();
 
     void resizeEvent(QGraphicsSceneResizeEvent* event);
@@ -48,27 +50,41 @@
     QWebPage* page();
     void setPage(QWebPage* page);
 
-    QGraphicsWebView* webView();
+    QGraphicsWebView* webView() const;
+    QGraphicsWidget* viewPort() const;
+    GWebContentView* view() const { return m_webContentView; }
     void setPageZoom(bool zoomIn);
 
-    ZoomMetaData currentPageInfo();
-    void setCurrentPageInfo(ZoomMetaData);
-    ZoomMetaData defaultZoomData();
+    WebPageData pageDataFromViewportInfo();
+    void setPageDataToViewportInfo(const WebPageData&);
+    WebPageData defaultZoomData();
     void showPage(bool isSuperPage);
     void updatePreferredContentSize();
     void setGesturesEnabled(bool value);
     bool gesturesEnabled();
-
+    bool event(QEvent * e);
+    
 Q_SIGNALS:
     void updateZoomActions(bool enableZoomIn, bool enableZoomOut);
-    void contextEventObject(QWebHitTestResult* eventTarget);
-    void viewScrolled(QPoint& scrollPos, QPoint& delta);
+    
+    void contextEventObject(QWebHitTestResult* eventTarget, QPointF position);
+    
+    void viewScrolled(QPoint& scrollPos,QPoint& delta);
     void mouseEvent(QEvent::Type type);
 
+#ifdef Q_WS_MAEMO_5
+protected slots:
+    void onContextEventObject(QWebHitTestResult* hitTest, QPointF position);
+#endif
+
+public slots:
+    void restoreViewportFromHistory(QWebFrame*);
+    void saveViewportToHistory(QWebFrame*, QWebHistoryItem*);
+
 private:
+    GWebContentView* m_webContentView;
     WebView* m_webView;
     ScrollableWebContentView* m_webViewport;
-    WebContentAnimationItem* m_webViewportProxy;
 };
 
 }// namespace GVA
--- a/ginebra2/ContentViews/WebView.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/WebView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -25,13 +25,21 @@
 
 #include <QWebFrame>
 #include <QWebPage>
+#include "qstmgestureevent.h"
+#include "qstmfilelogger.h"
 
 namespace GVA {
 
 WebView::WebView()
-    : QGraphicsWebView()
+    : WebViewParent()
     , m_webPage(0)
-{}
+{
+    setAttribute(Qt::WA_OpaquePaintEvent, true);
+    setResizesToContents(true);
+    setObjectName("WebView");
+    setAcceptHoverEvents(false);   
+    installEventFilter(this);
+}
 
 WebView::~WebView()
 {}
@@ -56,7 +64,9 @@
     if (!m_webPage)
         m_webPage = createWebPage();
 
-    QGraphicsWebView::setPage(m_webPage);
+    WebViewParent::setPage(m_webPage);
+
+    setGeometry(QRectF(pos(), m_webPage->mainFrame()->contentsSize()));
 
     emit titleChanged(title());
     emit urlChanged(url());
@@ -67,4 +77,31 @@
     return reinterpret_cast<QWebPage*>(BrowserPageFactory::openBrowserPage());
 }
 
+
+bool WebView::sceneEvent(QEvent* event)
+{
+    if (!WebViewParent::eventFilter(this, event)) {
+        return WebViewParent::sceneEvent(event);
+    }
+    return false;
+}
+
+bool WebView::eventFilter(QObject* o, QEvent* e)
+{
+    return WebViewParent::eventFilter(o, e);
+}
+
+
+bool WebView::event(QEvent * e) 
+{
+    if (e->type() == QEvent::Gesture) {
+          QStm_Gesture* gesture = getQStmGesture(e);
+          if (gesture) {
+              QGraphicsObject* go = this->parentItem()->toGraphicsObject();
+              return go->event(e);
+          }
+    }
+    return WebViewParent::event(e);
+}
+
 }//namespace GVA
--- a/ginebra2/ContentViews/WebView.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ContentViews/WebView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -24,11 +24,21 @@
 
 #include <QGraphicsWebView>
 
+#ifdef OWN_BACKING_STORE
+#include "TiledWebView.h"
+#endif // OWN_BACKING_STORE
+
 class QWebPage;
 
 namespace GVA {
 
-class WebView :public QGraphicsWebView {
+#ifdef OWN_BACKING_STORE
+typedef TiledWebView WebViewParent;
+#else
+typedef QGraphicsWebView WebViewParent;
+#endif // OWN_BACKING_STORE
+
+class WebView :public WebViewParent {
     Q_OBJECT
     Q_PROPERTY(QWebPage* page READ page WRITE setPage)
 public:
@@ -37,7 +47,10 @@
 
     QWebPage* page()const;
     void setPage(QWebPage* page);
-
+    bool event(QEvent * e);
+    bool eventFilter(QObject* o, QEvent* e);
+    bool sceneEvent(QEvent* event);
+    
 protected:
     QWebPage* createWebPage();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/WindowsView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,137 @@
+#include "WindowsView.h"
+#include "BrowserWindow.h"
+#include "GWebContentView.h"
+#include "ViewStack.h"
+
+//For page created signal
+#include "wrtbrowsercontainer.h"
+#include "webpagecontroller.h"
+
+//For shared chrome object
+#include "ChromeWidget.h"
+#include "ChromeView.h"
+
+#include <QDebug>
+
+namespace GVA {
+
+  WindowsView::WindowsView(ChromeWidget * chrome, QObject * parent, const QString & objectName)
+    : ControllableViewBase(parent),
+      m_current(0),
+      m_chrome(chrome),
+      m_menu(0)
+{
+  setObjectName(objectName);
+}
+
+WindowsView::~WindowsView()
+{
+  foreach (QMainWindow * window, m_windows){
+    delete window;
+  }   
+}
+
+void WindowsView::activate(BrowserWindow * window)
+{
+
+  ViewStack * viewStack = ViewStack::getSingleton();
+  GWebContentView* webView = contentView();
+  if(webView) {
+    if(contentView()->currentPageIsSuperPage()){
+      webView->showNormalPage();
+      webView->setGesturesEnabled(true);
+      window->setView("WebView"); 
+      viewStack->switchView(window->view(), viewStack->getViewController()->currentViewName());
+    }
+    else {
+      viewStack->getViewController()->currentView()->deactivate();
+    }
+    window->setTitle(viewStack->getViewController()->currentView()->title());
+  }
+  // Let the chrome take focus, or whatever it wants to do.
+  m_chrome->activate();
+}
+
+void WindowsView::deactivate(BrowserWindow * window)
+{
+  ViewStack * viewStack = ViewStack::getSingleton();
+  /*
+  if(m_current != window){
+    m_current = window;
+    viewStack->switchView(window->view(), viewStack->getViewController()->currentViewName());
+  } 
+  else */
+  //#ifndef BEDROCK_TILED_BACKING_STORE
+  if(viewStack->getViewController()->currentView())
+    viewStack->getViewController()->currentView()->activate();
+  //#endif
+}
+
+
+void WindowsView::setMenu(QMenu * menu)
+{
+  m_menu = menu;
+  if(m_menu){
+    m_menu->addAction("New Window", this, SLOT(onWindowAction()));
+  }
+}
+
+void WindowsView::setMenuEnabled(bool enabled)
+{
+  m_menu->setEnabled(enabled);
+  m_current->setMenuEnabled(enabled);
+}
+
+bool WindowsView::isMenuEnabled() const {
+    return m_menu->isEnabled();
+}
+
+void WindowsView::handlePageEvents(bool handleEvents){
+
+  if(handleEvents){
+    connect(WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer *)),
+	  this, SLOT(onPageCreated(WRT::WrtBrowserContainer *)));
+  }else{
+    disconnect(WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer *)),
+	  this, SLOT(onPageCreated(WRT::WrtBrowserContainer *)));
+  }
+}
+
+BrowserWindow * WindowsView::addWindow(WRT::WrtBrowserContainer * page)
+{
+  BrowserWindow * window = new BrowserWindow(m_chrome, this);
+  window->setPage(page);
+  window->menuBar()->addMenu(m_menu);
+  m_windows[page] = window;
+  m_current = window;
+  m_current->show();
+  deactivate(window);
+  return window;
+}
+
+GWebContentView * WindowsView::contentView()
+{
+  return static_cast<GWebContentView*>(ViewStack::getSingleton()->getViewController()->view("WebView"));
+}
+
+void WindowsView::onWindowAction() 
+{
+  //Tell the page controller to create a new QWebPage. 
+  //The controller emits pageCreated when this happens
+  //The onPageCreated slot actually creates the window
+  WebPageController::getSingleton()->openPage();
+}
+  
+void WindowsView::onPageCreated(WRT::WrtBrowserContainer * page)
+{
+  addWindow(page);
+  //WebPageController::getSingleton()->loadFromHistory();
+}
+
+void WindowsView::onPageDeleted(WRT::WrtBrowserContainer * page)
+{
+  assert(m_windows.contains(page));
+  delete m_windows.take(page);
+}
+
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContentViews/WindowsView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,60 @@
+/*
+ * WindowsView.h
+ *
+ *  Created on: Jun 11, 2010
+ *      Author: lewontin
+ */
+
+#ifndef WINDOWSVIEW_H
+#define WINDOWSVIEW_H_
+
+#include "controllableviewimpl.h"
+#include <QMenu>
+
+namespace WRT {
+  class WrtBrowserContainer;
+}
+
+namespace GVA {
+
+class BrowserWindow;
+class ChromeWidget;
+class GWebContentView;
+
+class WindowsView : public ControllableViewBase
+{
+  Q_OBJECT
+      
+  public:
+    WindowsView(ChromeWidget * chrome, QObject * parent = 0, const QString &objectName = QString::null);
+    virtual ~WindowsView();
+    //Reimplement ControllableViewBase methods
+    static QString Type() { return "windowView"; }
+    virtual QString type() const { return Type(); }
+    QGraphicsWidget* widget() const { return 0; }
+    virtual QList<QAction*> getContext(){ return QList<QAction*>(); }
+    virtual void show(){;}
+    virtual void hide(){;}
+    virtual void activate(BrowserWindow * window);
+    virtual void deactivate(BrowserWindow * window);
+    //WindowView methods
+    BrowserWindow * addWindow(WRT::WrtBrowserContainer * page);
+    BrowserWindow * currentWindow(){ return m_current; }
+    void addPage();
+    void handlePageEvents(bool handle);
+    void setMenu(QMenu * menu);
+    void setMenuEnabled(bool enabled);
+    bool isMenuEnabled() const;
+    GWebContentView * contentView();
+  public slots:
+    void onPageCreated(WRT::WrtBrowserContainer * page);
+    void onPageDeleted(WRT::WrtBrowserContainer * page);
+    void onWindowAction(); //Handle menu add window action
+  private:
+    QMap<WRT::WrtBrowserContainer*, BrowserWindow*>  m_windows;
+    BrowserWindow * m_current;
+    ChromeWidget * m_chrome;
+    QMenu * m_menu; //Shared menu, not owned
+};
+}
+#endif /* WINDOWSVIEW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ContextMenu.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,25 @@
+#ifndef CONTEXTMENU_H
+#define CONTEXTMENU_H
+
+#include <QGraphicsWidget>
+
+class QWebHitTestResult;
+
+namespace GVA {
+
+/*!
+ * Abstract base class for context menus.
+ */
+class ContextMenu : public QObject
+{
+    Q_OBJECT
+public:
+    ContextMenu(QObject *parent = 0) : QObject(parent) {}
+    virtual void addAction(QAction *action) = 0;
+    virtual void addAction(const QString text, const QObject * receiver, const char * member, const QKeySequence & shortcut = 0) = 0;
+    virtual void exec(const QPoint & p) = 0;
+};
+
+}  // GVA namespace
+
+#endif // CONTEXTMENU_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/CopyCutPasteSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 2.1 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not,
+ * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+ *
+ * Description:
+ *
+ */
+
+#include "CopyCutPasteSnippet.h"
+
+#define BUTTON_WIDTH 85
+#define BUTTON_HEIGHT 50
+#define BUTTON_PADDING 0
+#define TOP_PADDING 5
+#define FIRST_BUTTON_OFFSET 0
+#define SECOND_BUTTON_OFFSET BUTTON_WIDTH+BUTTON_PADDING
+#define THIRD_BUTTON_OFFSET SECOND_BUTTON_OFFSET+SECOND_BUTTON_OFFSET
+#ifdef BROWSER_LAYOUT_TENONE
+  #define URLSEARCH_CHROME_ID "TitleUrlId"
+#else
+  #define URLSEARCH_CHROME_ID "UrlSearchChromeId"
+#endif
+#define MENU_DISPLAY_DURATION 5000
+#define BACKGROUND_COLOR "#FFFFDD"
+
+namespace GVA {
+
+    CopyCutPasteButton::CopyCutPasteButton(const QString & text, QWidget * parent)
+        : QObject(parent) 
+        , m_text(text)
+        , m_mousePressed(false)
+        , m_size(QSize())
+        , m_disabled(false)
+    {
+        
+    }
+    
+    void CopyCutPasteButton::mousePressEvent(QGraphicsSceneMouseEvent * event)
+    {
+        Q_UNUSED(event);
+        m_mousePressed = true;
+    }
+    
+    void CopyCutPasteButton::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
+    {
+        Q_UNUSED(event);
+        if (m_mousePressed)
+            emit clicked();
+        m_mousePressed = false; 
+    }
+
+    void CopyCutPasteButton::render(QPainter * painter, const QPoint & targetOffset)
+    {
+       painter->save();
+       QFont textFont = painter->font();
+       textFont.setPixelSize(30);
+       textFont.setBold(true);
+       painter->setFont(textFont);
+       if (m_mousePressed) {
+           painter->setPen(Qt::white);
+           painter->setBrush(Qt::black);
+           painter->drawRoundedRect(QRect(targetOffset.x(), TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT), 10,10);
+           painter->setPen(QColor(BACKGROUND_COLOR));
+       } else {
+           if (m_disabled)
+               painter->setPen(Qt::lightGray);
+           else
+               painter->setPen(Qt::black);
+       } 
+
+       painter->drawText(QRect(targetOffset.x(), TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT), Qt::AlignCenter, m_text);
+       painter->restore();
+    }
+
+    CopyCutPasteItem::CopyCutPasteItem(ChromeSnippet * snippet, ChromeWidget * chrome, QGraphicsItem * parent)
+      : NativeChromeItem(snippet, parent)
+      , m_editorSnippet(NULL)
+    {
+        Q_UNUSED(chrome);
+        m_cutButton = new CopyCutPasteButton(QString("cut"));//(qtTrId("txt_browser_content_view_menu_cut"));
+        m_copyButton = new CopyCutPasteButton(QString("copy"));//(qtTrId("txt_browser_content_view_menu_copy"));
+        m_pasteButton = new CopyCutPasteButton(QString("paste"));//(qtTrId("txt_browser_content_view_menu_paste"));
+
+        m_cutButton->setFixedSize(BUTTON_WIDTH, BUTTON_HEIGHT);
+        m_copyButton->setFixedSize(BUTTON_WIDTH, BUTTON_HEIGHT);
+        m_pasteButton->setFixedSize(BUTTON_WIDTH, BUTTON_HEIGHT);
+        
+        connect(m_cutButton, SIGNAL(clicked()), this, SLOT(cut()));
+        connect(m_copyButton, SIGNAL(clicked()), this, SLOT(copy()));
+        connect(m_pasteButton, SIGNAL(clicked()), this, SLOT(paste()));
+    }
+
+    CopyCutPasteItem::~CopyCutPasteItem() 
+    {
+        delete m_cutButton;
+        delete m_copyButton;
+        delete m_pasteButton;
+    }
+
+    void CopyCutPasteItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
+    {
+        NativeChromeItem::paint(painter, option, widget);
+        painter->save();
+
+        painter->setPen(Qt::black);
+        painter->setBrush(QColor(BACKGROUND_COLOR));
+
+        painter->drawRoundedRect(QRect(FIRST_BUTTON_OFFSET, TOP_PADDING, THIRD_BUTTON_OFFSET + BUTTON_WIDTH, BUTTON_HEIGHT), 10,10);
+
+        // draw split
+        painter->setOpacity(0.3);
+        painter->setPen(Qt::black);
+        painter->drawLine(BUTTON_WIDTH, TOP_PADDING + 10, BUTTON_WIDTH, TOP_PADDING + BUTTON_HEIGHT - 10);
+        painter->drawLine(SECOND_BUTTON_OFFSET + BUTTON_WIDTH, TOP_PADDING + 10, SECOND_BUTTON_OFFSET + BUTTON_WIDTH, TOP_PADDING + BUTTON_HEIGHT - 10);
+        painter->setOpacity(1);
+        
+        // draw buttons
+        m_copyButton->render(painter, QPoint(FIRST_BUTTON_OFFSET,TOP_PADDING));
+        m_cutButton->render(painter, QPoint(SECOND_BUTTON_OFFSET,TOP_PADDING));
+        m_pasteButton->render(painter, QPoint(THIRD_BUTTON_OFFSET,TOP_PADDING));
+
+        painter->restore();
+    }
+
+    void CopyCutPasteItem::reset()
+    {
+        m_copyButton->setDisabled(true);
+        m_cutButton->setDisabled(true);
+        m_pasteButton->setDisabled(true);
+        m_copyButton->setMousePressed(false);
+        m_cutButton->setMousePressed(false);
+        m_pasteButton->setMousePressed(false);
+        m_editorSnippet = NULL;
+    }
+
+    void CopyCutPasteItem::cut() 
+    {
+        if (m_editorSnippet)
+            m_editorSnippet->cut();
+        m_snippet->setVisible(false);
+        // set the focus back
+        m_editorSnippet->grabFocus();
+    }
+
+    void CopyCutPasteItem::copy() 
+    {
+        if (m_editorSnippet)
+            m_editorSnippet->copy();
+        m_snippet->setVisible(false);
+        // set the focus back
+        m_editorSnippet->grabFocus();
+    }
+
+    void CopyCutPasteItem::paste() 
+    {
+        if (m_editorSnippet)
+            m_editorSnippet->paste();
+        m_snippet->setVisible(false);
+        // set the focus back
+        m_editorSnippet->grabFocus();
+    }
+
+    void CopyCutPasteItem::buildMenu(bool isContentSelected)
+    {
+        reset();
+        
+        m_copyButton->setDisabled(!isContentSelected);
+        m_cutButton->setDisabled(!isContentSelected);
+
+        bool canPaste = false;
+        const QClipboard *clipboard = QApplication::clipboard();
+        if (clipboard) {
+            const QMimeData *mimeData = clipboard->mimeData();
+            if (mimeData)
+                canPaste = mimeData->hasText();
+        }
+        m_pasteButton->setDisabled(!canPaste);
+    }
+
+    void CopyCutPasteItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
+    {
+        int x = event->pos().x();
+        if (x > 0 && x < SECOND_BUTTON_OFFSET && m_copyButton->isEnabled())
+            m_copyButton->mousePressEvent(event);
+        else if (x >= SECOND_BUTTON_OFFSET && x < THIRD_BUTTON_OFFSET && m_cutButton->isEnabled())
+            m_cutButton->mousePressEvent(event);
+        else if (x >= THIRD_BUTTON_OFFSET && m_pasteButton->isEnabled())
+            m_pasteButton->mousePressEvent(event);
+        update();
+    }
+
+    void CopyCutPasteItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
+    {
+        int x = event->pos().x();
+        if (x > 0 && x < SECOND_BUTTON_OFFSET && m_copyButton->isEnabled())
+            m_copyButton->mouseReleaseEvent(event);
+        else if (x >= SECOND_BUTTON_OFFSET && x < THIRD_BUTTON_OFFSET && m_cutButton->isEnabled())
+            m_cutButton->mouseReleaseEvent(event);
+        else if (x >= THIRD_BUTTON_OFFSET && m_pasteButton->isEnabled())
+            m_pasteButton->mouseReleaseEvent(event);
+        // reset all the mouse
+        m_copyButton->setMousePressed(false);
+        m_cutButton->setMousePressed(false);
+        m_pasteButton->setMousePressed(false);
+        update();
+    }
+
+    CopyCutPasteSnippet::CopyCutPasteSnippet( const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element )
+    : ChromeSnippet( elementId, chrome, widget, element )
+    , m_timer(new QTimer(this))
+    , m_externalEventCharm(NULL)
+    {
+        connectAll();
+    }
+
+    void CopyCutPasteSnippet::setChromeWidget(QGraphicsWidget * widget)
+    {
+        ChromeSnippet::setChromeWidget(widget);
+    }
+
+    CopyCutPasteSnippet * CopyCutPasteSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element)
+    {
+        CopyCutPasteSnippet* that = new CopyCutPasteSnippet(elementId, chrome, 0, element);
+        CopyCutPasteItem * item = new CopyCutPasteItem(that, chrome);
+        that->setChromeWidget(item);
+        return that;
+    }
+
+    void CopyCutPasteSnippet::connectAll()
+    {
+        connect(m_chrome, SIGNAL(chromeComplete()), this, SLOT(onChromeComplete()));
+        connect(m_chrome, SIGNAL(aspectChanged(int)), this, SLOT(onAspectChanged(int)));
+        connect(m_timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
+    }
+
+    void CopyCutPasteSnippet::onChromeComplete()
+    {
+        ChromeSnippet* urlSnippet = m_chrome->getSnippet(URLSEARCH_CHROME_ID);
+        if (urlSnippet)
+            connect(urlSnippet, SIGNAL(contextEvent(bool, QString)), this, SLOT(onContextEvent(bool, QString)));
+
+         m_externalEventCharm = new ExternalEventCharm(copyCutPasteItem());
+
+         connect(m_externalEventCharm,
+                    SIGNAL(externalMouseEvent(QEvent *, const QString &, const QString &)),
+                    this,
+                    SLOT(onExternalMouseEvent(QEvent *, const QString &, const QString &)));
+    }
+    
+    void CopyCutPasteSnippet::onAspectChanged(int aspect)
+    {
+        Q_UNUSED(aspect);
+        if (isVisible()) {
+            ChromeSnippet* editorSnippet = copyCutPasteItem()->editorSnippet();
+            if (!editorSnippet)
+                return;
+            int x = (m_chrome->viewSize().width() - (BUTTON_WIDTH + THIRD_BUTTON_OFFSET)) / 2;
+            int y = editorSnippet->widget()->size().height() + 1;
+            anchorTo(URLSEARCH_CHROME_ID, x, y);
+            copyCutPasteItem()->update();
+        }
+    }
+
+    void CopyCutPasteSnippet::onContextEvent(bool isContentSelected, QString snippetId)
+    {
+        ChromeSnippet* editorSnippet = m_chrome->getSnippet(snippetId);
+        if (!editorSnippet)
+            return;
+        int x = (m_chrome->viewSize().width() - (BUTTON_WIDTH + THIRD_BUTTON_OFFSET)) / 2;
+        int y = editorSnippet->widget()->size().height() + 1;
+        anchorTo(URLSEARCH_CHROME_ID, x, y);
+        copyCutPasteItem()->buildMenu(isContentSelected);
+        copyCutPasteItem()->setEditorSnippet(editorSnippet);
+        copyCutPasteItem()->update();
+        setVisible(true);
+        m_timer->start(MENU_DISPLAY_DURATION);
+    }
+
+    void CopyCutPasteSnippet::onTimeout()
+    {
+        setVisible(false);
+    }
+
+    void  CopyCutPasteSnippet::onExternalMouseEvent(QEvent * ev, const QString & name, const QString & description)
+    {
+        Q_UNUSED(ev);
+        Q_UNUSED(description);
+        if (name == "MouseClick")
+            setVisible(false);
+    }
+
+    void CopyCutPasteSnippet::setVisible(bool visiblity, bool animate)
+    {
+        // let snippet know menu shows or hides
+        if (copyCutPasteItem()->editorSnippet())
+            copyCutPasteItem()->editorSnippet()->setContextMenuStatus(visiblity); 
+        ChromeSnippet::setVisible(visiblity, animate);
+    }
+
+    CopyCutPasteItem * CopyCutPasteSnippet::copyCutPasteItem()
+    {
+        return qobject_cast<CopyCutPasteItem*>(m_widget);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/CopyCutPasteSnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+
+#ifndef __COPY_CUT_PASTE_SNIPPET_H__
+#define __COPY_CUT_PASTE_SNIPPET_H__
+
+#include "ChromeSnippet.h"
+#include "ChromeWidget.h"
+#include "NativeChromeItem.h"
+#include "ExternalEventCharm.h"
+
+#include <QPushButton>
+
+namespace GVA {
+
+    class CopyCutPasteButton :  public QObject
+    {
+        Q_OBJECT
+
+    public:
+        CopyCutPasteButton(const QString & text, QWidget * parent = 0);
+        virtual ~CopyCutPasteButton() {}
+
+        void render(QPainter * painter, const QPoint & targetOffset = QPoint());
+        void setMousePressed(bool pressed) { m_mousePressed = pressed; }
+        QString text() const { return m_text; }
+        void setText(QString & text) { m_text = text; }
+        QSize size() const { return m_size; }
+        void setFixedSize(int w, int h) { m_size = QSize(w, h); }
+        void setDisabled(bool disabled) { m_disabled = disabled; }
+        bool isEnabled() const { return !m_disabled; }
+        
+        void mousePressEvent(QGraphicsSceneMouseEvent * event);
+        void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
+
+    signals:
+        void clicked();
+
+    private:
+        QString m_text;
+        bool m_mousePressed;
+        QSize m_size;
+        bool m_disabled;
+    };
+
+    class CopyCutPasteItem : public NativeChromeItem
+    {
+        Q_OBJECT
+
+    public:
+        CopyCutPasteItem(ChromeSnippet * snippet, ChromeWidget * chrome, QGraphicsItem * parent = 0);
+        virtual ~CopyCutPasteItem();
+        void buildMenu(bool isContentSelected);
+        void setEditorSnippet(ChromeSnippet * snippet) { m_editorSnippet = snippet; }
+        ChromeSnippet * editorSnippet() { return m_editorSnippet; }
+
+    private slots:
+        void cut();
+        void copy();
+        void paste();
+
+    protected:
+        virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
+        virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+        virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
+
+    private:
+        void reset();
+
+    private:
+        CopyCutPasteButton * m_cutButton;
+        CopyCutPasteButton * m_copyButton;
+        CopyCutPasteButton * m_pasteButton;
+        ChromeSnippet * m_editorSnippet;
+    };
+
+  class CopyCutPasteSnippet : public ChromeSnippet
+  {
+    Q_OBJECT
+    public:
+       CopyCutPasteSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
+       virtual ~CopyCutPasteSnippet() { if (m_externalEventCharm) delete m_externalEventCharm ;}
+       static CopyCutPasteSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element);
+       virtual void setChromeWidget(QGraphicsWidget * widget);
+
+    public slots:
+        virtual void setVisible(bool visiblity, bool animate = true);
+
+    private:
+       void connectAll();
+       CopyCutPasteItem *copyCutPasteItem();
+       
+    private slots:
+       void onTimeout();
+       void onChromeComplete();
+       void onContextEvent(bool isContentSelected, QString snippetId);
+       void onExternalMouseEvent(QEvent *, const QString &, const QString &);
+       void onAspectChanged(int aspect);
+
+    private:
+       QTimer * m_timer;
+       ExternalEventCharm * m_externalEventCharm;
+  };
+}
+
+#endif
--- a/ginebra2/EditorSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/EditorSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -37,7 +37,18 @@
   EditorSnippet * EditorSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element)
   {
       EditorSnippet* that = new EditorSnippet(elementId, chrome, 0, element);
-      that->setChromeWidget( new TextEditItem( that, chrome ) );
+      TextEditItem * textEditItem = new TextEditItem(that, chrome);
+     that->setChromeWidget(textEditItem);
+     connect(textEditItem, SIGNAL(contextEvent(bool)), that, SLOT(sendContextMenuEvent(bool)));
+	  
+#ifdef BROWSER_LAYOUT_TENONE
+      QFont textFont;
+      //textFont = QFont(QApplication::font());
+      textFont = QFont("Series 60 Sans");
+      //textFont.setPointSize(7);
+      that->setTextFont(textFont);
+#endif
+	  
       return that;
   }
   
@@ -47,10 +58,19 @@
       connect(editor, SIGNAL(textMayChanged()), this, SIGNAL(textChanged()));
       connect(editor, SIGNAL(activated()), this, SIGNAL(activated()));
       connect(editor, SIGNAL(focusChanged(bool)), this, SLOT(onFocusChanged(bool)));
-      connect(editor, SIGNAL(tapped(QPointF&)), this, SLOT(onTapped(QPointF&)));
     }
   }
 
+  TextEditItem * EditorSnippet::textEditItem()
+  {
+    return qobject_cast<TextEditItem*>(m_widget);
+  }
+
+  void EditorSnippet::sendContextMenuEvent(bool isContentSelected)
+  {
+      emit contextEvent(isContentSelected, elementId());
+  }
+
   void EditorSnippet::onFocusChanged(bool in)
   {
     if(in)
@@ -59,46 +79,75 @@
       emit lostFocus();
   }
 
-  void EditorSnippet::onTapped(QPointF& /*pos*/){
-    emit gainedFocus();
+#ifdef BROWSER_LAYOUT_TENONE
+  void EditorSnippet::setTextFont( QFont & font )
+  {
+    textEditItem()->setTextFont(font);
   }
+#endif
 
   void EditorSnippet::setText( const QString & text )
   {
-    static_cast<TextEditItem*>(m_widget)->setText(text);
+    textEditItem()->setText(text);
   }
 
   QString EditorSnippet::text()
   {
-    return static_cast<TextEditItem*>(m_widget)->text();
+    return textEditItem()->text();
   }
 
   void EditorSnippet::setCursorPosition(int pos)
   {
-    static_cast<TextEditItem*>(m_widget)->setCursorPosition(pos);
+    textEditItem()->setCursorPosition(pos);
   }
 
-  int EditorSnippet::charCount(){
-    return static_cast<TextEditItem*>(m_widget)->characterCount();
+  int EditorSnippet::charCount()
+  {
+    return textEditItem()->characterCount();
   }
 
-  void EditorSnippet::selectAll(){
-    return static_cast<TextEditItem*>(m_widget)->selectAll();
+  void EditorSnippet::selectAll()
+  {
+    return textEditItem()->selectAll();
   }
 
-  void EditorSnippet::unselect(){
-    return static_cast<TextEditItem*>(m_widget)->unselect();
+  void EditorSnippet::unselect()
+  {
+    return textEditItem()->unselect();
   }
   
-  int EditorSnippet::getTextOptions(){
-    return (int) static_cast<TextEditItem*>(m_widget)->getTextOptions(); 
+  int EditorSnippet::getTextOptions()
+  {
+    return (int) textEditItem()->getTextOptions(); 
   }
   
-  void EditorSnippet::setTextOptions(int flag){
-    return static_cast<TextEditItem*>(m_widget)->setTextOptions(flag);
+  void EditorSnippet::setTextOptions(int flag)
+  {
+    return textEditItem()->setTextOptions(flag);
+  }
+
+  void EditorSnippet::setMaxTextLength(int length)
+  {
+    return textEditItem()->setMaxTextLength(length);
+  }
+
+  void EditorSnippet::cut()
+  {
+    textEditItem()->cut();
   }
 
-  void EditorSnippet::setMaxTextLength(int length){
-    return static_cast<TextEditItem*>(m_widget)->setMaxTextLength(length);
+  void EditorSnippet::copy()
+  {
+    textEditItem()->copy();
+  }
+ 
+  void EditorSnippet::paste()
+  {
+    textEditItem()->paste();
+  }
+
+  void EditorSnippet::setContextMenuStatus(bool on)
+  { 
+    textEditItem()->setContextMenuStatus(on);
   }
 }
--- a/ginebra2/EditorSnippet.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/EditorSnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -40,24 +40,33 @@
        Q_PROPERTY( QString text READ text WRITE setText)
        void setText( const QString & text );
        QString text();
+#ifdef BROWSER_LAYOUT_TENONE
+       void setTextFont(QFont & font);
+#endif
     public slots:
        int charCount();
        void setCursorPosition(int pos);
        void selectAll();
        void unselect();
        void onFocusChanged(bool in);
-       void onTapped(QPointF& pos);
        int getTextOptions();
        // Calling this function will overwrite the existing options
-       void setTextOptions(int flag);
-       void setMaxTextLength(int length);
+       void setTextOptions(int flag);       void setMaxTextLength(int length);
+       bool editable() { return true; }
+       void cut();
+       void copy();
+       void paste();
+       void sendContextMenuEvent(bool isContentSelected);
+       void setContextMenuStatus(bool on);
     signals:
        void activated();
        void lostFocus();
        void gainedFocus();
        void textChanged();
+       void contextEvent(bool isContentSelected, QString snippetId);
     private:
        void connectAll();
+       TextEditItem *textEditItem();
   };
 }
 
--- a/ginebra2/EditorWidget.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/EditorWidget.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -31,6 +31,9 @@
 #include "EditorWidget.h"
 #include "Utilities.h"
 #include "ChromeEffect.h"
+#include "qstmgestureevent.h"
+
+
 
 // FIXME ;;; Must address the following issues:
 //
@@ -50,19 +53,28 @@
   , m_maxTextLength(0)
   , m_hints(Qt::ImhNoPredictiveText) // disable the predictive text
   , m_setSpecificBtn(false)
+  , m_isContextMenuOn(false)
   {
     // Disable wrapping, force text to be stored and displayed
     // as a single line.
     QTextOption textOption = document()->defaultTextOption();
     textOption.setWrapMode(QTextOption::NoWrap);
     document()->setDefaultTextOption(textOption);
+    // Set default font size
+    QFont textFont = font();
+    textFont.setPointSize(11);
+    setFont(textFont);
     // Enable cursor keys.
     setTextInteractionFlags(Qt::TextEditorInteraction);
     // This is needed to initialize m_textLine.
     setText("");
     setAcceptDrops(false);
     m_defaultStartDragDistance = QApplication::startDragDistance();
-  }
+
+    grabGesture(QStm_Gesture::assignedType());
+    installEventFilter(this);
+
+}
 
   GTextLineItem::~GTextLineItem()
   {
@@ -115,6 +127,7 @@
 
   void GTextLineItem::specificBtnTriggered(bool checked)
   {
+    Q_UNUSED(checked);
 #ifdef ORBIT_UI
     QInputContext *ic = qApp->inputContext();
     QInputMethodEvent *imEvent = new QInputMethodEvent();
@@ -156,6 +169,8 @@
 
   void GTextLineItem::unselect()
   {
+    if (contextMenuOn())
+      return;
     QTextCursor tc = textCursor();
     tc.setPosition(tc.position());
     setTextCursor(tc);
@@ -191,18 +206,22 @@
 
   void GTextLineItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
   {
+    event->setPos(QPointF(event->pos().x(), boundingRect().center().y())); // make selecting easily by using a fixed y position
     QGraphicsTextItem::mouseMoveEvent(event);
     emit cursorXChanged(cursorX());
   }
 
   void GTextLineItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
   {
+    event->setPos(QPointF(event->pos().x(), boundingRect().center().y())); // make selecting easily by using a fixed y position
     QGraphicsTextItem::mousePressEvent(event);
   }
 
   void GTextLineItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
   {
-
+    if (contextMenuOn())
+      return;
+    event->setPos(QPointF(event->pos().x(), boundingRect().center().y())); // make selecting easily by using a fixed y position
     QGraphicsTextItem::mouseReleaseEvent(event);
     QPointF pos = event->pos();
     emit tapped(pos);
@@ -236,9 +255,11 @@
 
 #ifndef ORBIT_UI
     QWidget* fw = QApplication::focusWidget();
-    Qt::InputMethodHints hints = fw->inputMethodHints();
-    if (hints != m_hints)
-      fw->setInputMethodHints(m_hints);
+    if (fw != NULL) {
+      Qt::InputMethodHints hints = fw->inputMethodHints();
+      if (hints != m_hints)
+        fw->setInputMethodHints(m_hints);
+    }
 #endif
 
     if (event->reason() != Qt::PopupFocusReason) // to fix the special char issue on VKB
@@ -251,7 +272,7 @@
     // restore the drag & drop for other components
     QApplication::setStartDragDistance(m_defaultStartDragDistance);
     QGraphicsTextItem::focusOutEvent(event);
-    if (event->reason() != Qt::PopupFocusReason && event->reason() != Qt::ActiveWindowFocusReason) // to fix the special char issue on VKB
+    if (event->reason() != Qt::PopupFocusReason && event->reason() != Qt::ActiveWindowFocusReason && !contextMenuOn()) // to fix the special char issue on VKB
       emit focusChanged(false);
   }
 
@@ -266,6 +287,59 @@
     m_hints = hints;
     m_hints |= Qt::ImhNoPredictiveText;  // disable the predictive text
   }
+  
+  bool GTextLineItem::eventFilter(QObject* o, QEvent* e)
+  { 
+    if (e->type() == QEvent::GraphicsSceneMouseMove)
+        return false;
+  	return QStm_GestureEventFilter::instance()->eventFilter(o, e);
+  } 
+
+  bool GTextLineItem::event(QEvent* event)
+  {
+    bool ret = false;
+    if (event->type() == QEvent::Gesture) {
+        QStm_Gesture* gesture = getQStmGesture(event);
+        if (gesture) {              
+            return  handleQStmGesture(gesture);
+        }
+    }
+    ret = QGraphicsTextItem::event(event);
+    return ret;
+  }
+
+  bool GTextLineItem::handleQStmGesture(QStm_Gesture* gesture)
+  {
+    QStm_GestureType type = gesture->getGestureStmType();
+    
+    if (type == QStmLongPressGestureType) {
+        emit contextEvent(hasSelection());
+    }
+    else {
+        QEvent::Type mouseEventType = gesture->gestureType2GraphicsSceneMouseType();
+        
+        if (mouseEventType == QEvent::GraphicsSceneMousePress || 
+            mouseEventType == QEvent::GraphicsSceneMouseRelease) {
+            QGraphicsSceneMouseEvent gsme(mouseEventType);
+            QPointF pos = gesture->scenePosition(this);
+            qstmSetGraphicsSceneMouseEvent(pos, this, gsme);
+            switch (mouseEventType) {
+                case QEvent::GraphicsSceneMousePress:
+                    mousePressEvent(&gsme);
+                    break;
+                case QEvent::GraphicsSceneMouseRelease:
+                    mouseReleaseEvent(&gsme);
+                    break;
+                case QEvent::GraphicsSceneMouseMove:
+                    mouseMoveEvent(&gsme);
+                    break;            
+            }
+        }
+    }
+
+	return true;
+}
+
 
   void  GTextLineItem::launchVKB() {
 
@@ -305,6 +379,24 @@
     }
   }
 
+  void GTextLineItem::cut() {
+    QTextCursor tc = textCursor();
+    QApplication::clipboard()->setText(tc.selectedText());
+    tc.insertText("");
+    setTextCursor(tc);
+  }
+  
+  void GTextLineItem::copy() {
+    QTextCursor tc = textCursor();
+    QApplication::clipboard()->setText(tc.selectedText());
+  }
+  
+  void GTextLineItem::paste() {
+    QTextCursor tc = textCursor();
+    tc.insertText(QApplication::clipboard()->text(QClipboard::Clipboard));
+    setTextCursor(tc);
+  }
+
   // Methods for class GLineEditor
   // GLineEditor is a QGraphicsWidget that wraps a GTextLineItem to implement scrolling, 
   // draw a background and set padding 
@@ -324,11 +416,13 @@
     // The viewport clips the editor when text overflows
     // viewport size will be set in resize()
     m_viewPort = new QGraphicsWidget(this);
+    m_viewPort->setObjectName("ViewPort");
     m_viewPort->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
 
     // The actual text editor item
     //m_textColor = QColor(Qt::black);
     m_editor = new GTextLineItem(m_viewPort);
+    m_editor->setObjectName("LineItem");
 #ifndef BROWSER_LAYOUT_TENONE
     m_editor->setDefaultTextColor(m_textColor);
 #endif
@@ -337,6 +431,7 @@
 #ifdef BROWSER_LAYOUT_TENONE
     m_titleColor = QColor(Qt::white);
     m_title = new GTitleItem(m_viewPort);
+    m_title->setObjectName("TitleItem");
     m_title->setDefaultTextColor(m_titleColor);
     m_title->hide();
     safe_connect(m_title, SIGNAL(tapped(QPointF& )),
@@ -359,6 +454,9 @@
     safe_connect(m_editor, SIGNAL(tapped(QPointF&)),
                  this, SIGNAL(tapped(QPointF&)));
 
+    safe_connect(m_editor, SIGNAL(contextEvent(bool)),
+                 this, SIGNAL(contextEvent(bool)));
+
     setAcceptDrops(false);
   }
 
@@ -375,16 +473,18 @@
   }
 
 #ifdef BROWSER_LAYOUT_TENONE
-  void GLineEditor::setTitleColor(QColor & color)
-  {
+  void GLineEditor::setTitleColor(QColor & color) {
     m_titleColor = color;
     m_title->setDefaultTextColor(m_titleColor);
   }
   
-  void GLineEditor::setTitleFont(QFont & font)
-  {
+  void GLineEditor::setTitleFont(QFont & font) {
     m_title->setFont(font);
   }
+
+  void GLineEditor::setTextFont(QFont & font) {
+    m_editor->setFont(font);
+  }
 #endif
   
   void GLineEditor::setPadding(qreal padding)
@@ -415,7 +515,12 @@
     // First, fill rectangle with background color.
     painter->fillRect(boundingRect(), m_backgroundColor);
     painter->restore();
+#ifdef BROWSER_LAYOUT_TENONE
+    if(!isEnabled() && !m_title->isVisible()) {
+#else
     if(!isEnabled()) {
+#endif
+
         ChromeEffect::paintDisabledRect(painter, option->exposedRect);
     }
     // Make sure any required horizontal scrolling happens
@@ -427,7 +532,7 @@
   void GLineEditor::resizeEvent(QGraphicsSceneResizeEvent * event)
   {
     QSizeF size = event->newSize();
-    qreal height = size.height() - m_padding * 2;
+    qreal height = size.height();
     qreal width;
 
     width = m_viewPortWidth  = size.width() - m_rightTextMargin  - m_padding * 2;
@@ -442,7 +547,7 @@
 #endif
     m_viewPort->setGeometry(
                             m_padding,
-                            (size.height() - m_editor->boundingRect().height()) / 2,
+                            0,
                             width,
                             height);
 
@@ -680,7 +785,11 @@
     painter->fillRect(progressRect, m_progressColor);
     paintBorder(painter);
     painter->restore();
+#ifdef BROWSER_LAYOUT_TENONE
+    if(!isEnabled() && !m_title->isVisible()) {
+#else
     if(!isEnabled()) {
+#endif
         ChromeEffect::paintDisabledRect(painter, option->exposedRect);
     }
   }
@@ -722,9 +831,10 @@
 
   TextEditItem::TextEditItem(ChromeSnippet * snippet, ChromeWidget * chrome, QGraphicsItem * parent)
     : NativeChromeItem(snippet, parent)
-	, m_justFocusIn(false)
+    , m_justFocusIn(false)
   {
     m_textEditor = new GTextEditor(snippet, chrome, this);
+    m_textEditor->setObjectName("Editor");
   
     //Style via CSS
     QWebElement we = m_snippet->element();
@@ -751,33 +861,31 @@
     QString cssPadding = we.styleProperty("padding-top", QWebElement::ComputedStyle);
     m_textEditor->setPadding(cssPadding.remove("px").toInt());
 
-	safe_connect(m_textEditor, SIGNAL(focusChanged(bool)),this, SLOT(focusChanged(bool)));
+    safe_connect(m_textEditor, SIGNAL(focusChanged(bool)),this, SLOT(focusChanged(bool)));
     safe_connect(m_textEditor, SIGNAL(tapped(QPointF&)),this, SLOT(tapped(QPointF&)));
-}
+    safe_connect(m_textEditor, SIGNAL(contextEvent(bool)), this, SIGNAL(contextEvent(bool)));
+  }
   
   void TextEditItem::tapped(QPointF& pos)
-{
+  {
     bool hitText = m_textEditor->tappedOnText(pos.x());
-    if (!m_justFocusIn && !hitText)
-        m_textEditor->unselect();
-
     if (m_justFocusIn) {
-        m_justFocusIn = false;
-        if (hitText && !m_textEditor->hasSelection())
-            m_textEditor->selectAll();
+      m_justFocusIn = false;
+      if (hitText && !m_textEditor->hasSelection())
+        m_textEditor->selectAll();
     }
-}
+  }
 
-void TextEditItem::focusChanged(bool focusIn)
-{
+  void TextEditItem::focusChanged(bool focusIn)
+  {
     if (focusIn)
-        m_justFocusIn = true;
+      m_justFocusIn = true;
     else {
-        m_justFocusIn = false;
-        m_textEditor->unselect();
-        m_textEditor->shiftToLeftEnd();
+      m_justFocusIn = false;
+      m_textEditor->unselect();
+      m_textEditor->shiftToLeftEnd();
     }
-}
+  }
 
   TextEditItem::~TextEditItem()
   {
--- a/ginebra2/EditorWidget.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/EditorWidget.h	Fri Oct 15 17:30:59 2010 -0400
@@ -30,6 +30,7 @@
 #include <QGraphicsWidget>
 #include <QtGui>
 
+class QStm_Gesture;
 namespace GVA {
 
   class ChromeSnippet;
@@ -52,12 +53,19 @@
     void unselect();
     qreal textWidth();
     void setCursorPosition(int pos);
+    bool event(QEvent* event);
     bool hasSelection() { return (cursorX()!= anchorX()); }
     Qt::InputMethodHints inputMethodHints() const { return m_hints; }
     void setInputMethodHints(Qt::InputMethodHints hints);
     void setSpecificButton(QString& commitString, QString& buttonIconPath);
     void launchVKB();
-    void  sendInputPanelEvent(QEvent::Type type);
+    void sendInputPanelEvent(QEvent::Type type);
+    void cut();
+    void copy();
+    void paste();
+    void setContextMenuStatus(bool on) { m_isContextMenuOn = on; }
+    bool contextMenuOn() { return m_isContextMenuOn; }
+    bool eventFilter(QObject* o, QEvent* e);
 
   protected:
     virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
@@ -69,6 +77,7 @@
     virtual void focusInEvent(QFocusEvent * event);
     virtual void focusOutEvent(QFocusEvent * event);
     virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+    bool handleQStmGesture(QStm_Gesture* gesture);
 
   private slots:
     void contentsChange(int position, int charsRemoved, int charsAdded);
@@ -79,6 +88,7 @@
     void textMayChanged();
     void focusChanged(bool focusIn);
     void tapped(QPointF& pos);
+    void contextEvent(bool isContentSelected);
 
   private:
     QTextLine m_textLine;
@@ -88,6 +98,7 @@
     bool m_setSpecificBtn;
     QString m_spBtnCommitString;
     QString m_spBtnIconPath;
+    bool m_isContextMenuOn; // don't unselect text or change cursor position when context menu is showing
   };
 
   class GLineEditor : public QGraphicsWidget
@@ -119,16 +130,21 @@
     // Calling this function will overwrite the existing hints
     void setInputMethodHints(Qt::InputMethodHints hints) { m_editor->setInputMethodHints(hints); }
     void setMaxTextLength(int length) { m_editor->setMaxTextLength(length);}
+    void setContextMenuStatus(bool on) { m_editor->setContextMenuStatus(on); }
+    void setFocusForEditor() { m_editor->setFocus(); }
 #ifdef BROWSER_LAYOUT_TENONE
     void changeEditorMode(bool edit);
     void setTitle(const QString & text);
     void setTitleColor(QColor & color);
     void setTitleFont(QFont & font);
-
+    void setTextFont(QFont & font);
 #endif
     void setSpecificButton(QString commitString, QString buttonIcon) { m_editor->setSpecificButton(commitString, buttonIcon);}
     void closeVKB();
     void openVKB();
+    void cut() { m_editor->cut();}
+    void copy() { m_editor->copy(); }
+    void paste() { m_editor->paste(); }
 
   protected:
     virtual bool eventFilter(QObject * object, QEvent * event);
@@ -142,6 +158,7 @@
     void focusChanged(bool focusIn);
     void tapped(QPointF& pos);
     void titleMouseEvent(QPointF& pos);
+    void contextEvent(bool isContentSelected);
 
   private slots:
     void makeVisible(qreal cursorX);
@@ -226,6 +243,9 @@
     GTextEditor * editor() { return m_textEditor; } 
     QString text() { return m_textEditor->text(); }
     void setText(const QString & text){ m_textEditor->setText(text); }
+#ifdef BROWSER_LAYOUT_TENONE
+    void setTextFont(QFont & font){ m_textEditor->setTextFont(font); }
+#endif
     int characterCount() { return m_textEditor->characterCount(); }
     void setCursorPosition(int pos) { m_textEditor->setCursorPosition(pos); }
     void selectAll() { m_textEditor->selectAll(); }
@@ -234,7 +254,14 @@
     // Calling this function will overwrite the existing options
     void setTextOptions (int flag);
     void setMaxTextLength(int length) { m_textEditor->setMaxTextLength(length); }
- 
+    void cut() { m_textEditor->cut(); }
+    void copy() { m_textEditor->copy(); }
+    void paste() { m_textEditor->paste(); }
+    void setContextMenuStatus(bool on) { m_textEditor->setContextMenuStatus(on); }
+
+  Q_SIGNALS:
+    void contextEvent(bool);
+
   private slots:	
 	void tapped(QPointF&);
 	void focusChanged(bool focusIn);
@@ -243,7 +270,7 @@
     virtual void resizeEvent(QGraphicsSceneResizeEvent * ev);
   private:
     GTextEditor * m_textEditor;
-	 bool m_justFocusIn;
+    bool m_justFocusIn;
   };
 
 } // namespace GVA
--- a/ginebra2/GWebTouchNavigation.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/GWebTouchNavigation.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -31,7 +31,7 @@
 #include <qmath.h>
 #include <QDebug>
 #include <QGraphicsView>
-
+#include <QInputContext>
 
 namespace GVA {
 
@@ -57,7 +57,7 @@
 static const int KStartPanDistance = 50;
 static const int KWaitForClickTimeoutMS = 200;
 static const int KLongPressDuration = 1000;
-static const int KLongPressThreshold = 30;
+static const int KLongPressThreshold = 18;
 //The amount of pixels to try to pan before pan mode unlocks
 static const int KPanModeChangeDelta = 100;
 
@@ -189,7 +189,12 @@
             return true;
         case QEvent::GraphicsSceneContextMenu:
             contextMenuEvent();
+// for orbit fw app, long press triggers context menu event which selects closest word
+#ifdef ORBIT_UI
+            return true;
+#else
             break;
+#endif
         default:
             break;
     }
@@ -606,7 +611,11 @@
     if (m_pressEvent){
         QPoint diff2 = m_pressEvent->pos() - pos;
         if (qAbs(diff2.x()) < KTouchThresholdX && qAbs(diff2.y()) < KTouchThresholdY) {
-            return;
+            if (!m_frame)
+                return;
+            QWebHitTestResult htr = m_frame->hitTestContent(m_touchPosition);
+            if (!htr.isContentEditable())
+                return;
         }
     }
 
@@ -633,6 +642,11 @@
                 m_webPage->event(&moveEvt);
                 m_textSelected = true;
             }
+        } else { // FIXME add following lines to enable the auto-scroll while selecting text
+            if (m_textSelected) {
+                QMouseEvent moveEvt(QEvent::MouseMove, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+                m_webPage->event(&moveEvt);
+            }
         }
     }
     if (!m_textSelected)
@@ -728,7 +742,7 @@
     } else {
         // we don't want to automatically display the SIP (Software input panel) by qtwebkit
         bool sipEnabled = qApp->autoSipEnabled();
-        qApp->setAutoSipEnabled(false);
+        //qApp->setAutoSipEnabled(false);
         QMouseEvent iev = m_ishighlighted ?
         QMouseEvent(ev->type(), m_higlightedPos, ev->button(), ev->buttons(), getEventModifier(m_higlightedPos)) :
         QMouseEvent(QEvent::MouseButtonRelease, m_touchPosition, ev->button(), ev->buttons(), getEventModifier(m_touchPosition));
@@ -738,13 +752,15 @@
 // FIXME Remove this, it will be fixed Qt 4.6.3 ?
         if (ev->button() == Qt::LeftButton) {
             QWebHitTestResult htr = m_frame->hitTestContent(ev->pos());
-            if (htr.isContentEditable()) {
-                QEvent vkbEvent(QEvent::RequestSoftwareInputPanel);
-                QList<QGraphicsView*> views = m_view->scene()->views();
-                QWidget* view = qobject_cast<QWidget*>(views.value(0));
-                if (view)
-                    QApplication::sendEvent(view, &vkbEvent);
-            }
+            QEvent* vkbEvent; 
+            QInputContext *ic = qApp->inputContext();
+            if (htr.isContentEditable()) 
+            	vkbEvent = new QEvent(QEvent::RequestSoftwareInputPanel);
+            else
+            	vkbEvent = new QEvent(QEvent::CloseSoftwareInputPanel);
+            if (ic) 
+            	ic->filterEvent(vkbEvent);
+        delete vkbEvent;
         }
 #endif
     }
@@ -752,7 +768,6 @@
 
 void GWebTouchNavigation::mouseDoubleClickEvent(const QPoint& pos)
 {
-
     if (m_doubleClickTimer && !m_doubleClickTimer->isActive())
         return;
     else if (m_doubleClickTimer)
@@ -1374,15 +1389,20 @@
     Q_UNUSED(ok)
     m_isLoading = false;
 }
-void GWebTouchNavigation::setPage( QWebPage * page)
+void GWebTouchNavigation::setPage( QWebPage * page, bool aWantSlideView)
 {
-    if (m_webPage) {
+    // Need to listen to the load signals to determine whethter slideView should
+    // be called when scrolling. This is called only when m_wantSlideViewCalls is set and hence,
+    // there is no need to disconnect and connect to these signals if m_wantSlideViewCalls/ new value
+    // of m_wantSlideViewCalls is false
+    if (m_webPage && m_wantSlideViewCalls) {
         disconnect(m_webPage, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
         disconnect(m_webPage, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
         //disconnect(m_webPage->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), this, SLOT(onContentsSizeChanged(const QSize &)));
     }
     m_webPage = page;
-    if (m_webPage) {
+    m_wantSlideViewCalls = aWantSlideView;
+    if (m_webPage && m_wantSlideViewCalls) {
         connect(m_webPage, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
         connect(m_webPage, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
         //connect(m_webPage->mainFrame(), SIGNAL(contentsSizeChanged(const QSize &)), this, SLOT(onContentsSizeChanged(const QSize &)));
@@ -1403,4 +1423,5 @@
 {
     m_doubleClickEnabled = aValue;
 }
-}
+
+}
\ No newline at end of file
--- a/ginebra2/GWebTouchNavigation.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/GWebTouchNavigation.h	Fri Oct 15 17:30:59 2010 -0400
@@ -81,10 +81,10 @@
         virtual ~GWebTouchNavigation();
         void install();
         void uninstall();
-        void setPage( QWebPage * page);
+        void setPage( QWebPage * page, bool wantSlideView=true);
         bool enabled() const { return m_enabled; }
         void setEnabled(bool value) { m_enabled = value; }
-        void setWantSlideViewCalls(bool value) { m_wantSlideViewCalls = value; }
+        void setLoadingFlag(bool loading) { m_isLoading = loading;}
 
     signals:
         void longPressEvent(QPoint pos);// mouse long press signal
--- a/ginebra2/Gestures/GestureEvent.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/Gestures/GestureEvent.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -36,7 +36,7 @@
     , m_velocity(QPointF(0,0))
 {}
 
-GestureEvent::GestureEvent(const GestureEvent& gesture)
+GestureEvent::GestureEvent(const GestureEvent& gesture) : QObject()
 {
     m_type = gesture.m_type;
     m_pos = gesture.m_pos;
--- a/ginebra2/Gestures/GestureRecognizer.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/Gestures/GestureRecognizer.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -67,7 +67,7 @@
     case QEvent::GraphicsSceneMouseRelease:
         handled = d->mouseReleaseEvent(event);
         break;
-    case QEvent::GraphicsSceneContextMenu:
+    case QEvent::GraphicsSceneContextMenu:    	
         //Swallow context menu event.
         //Since we have own way of handling it
         handled = true;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/GridView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,74 @@
+#include "GridView.h"
+
+#include <QDebug>
+#include <QStyleOptionGraphicsItem>
+#include <QPainter>
+
+namespace GVA {
+
+GridView::GridView(QGraphicsItem *parent) :
+    QGraphicsWidget(parent),
+    m_gridLayout(new QGraphicsGridLayout(this)),
+    m_columnCount(2),
+    m_rowCount(2)
+{
+    #ifdef Q_WS_MAEMO_5
+    m_gridLayout->setSpacing(16);
+    m_gridLayout->setContentsMargins(0, 0, 0 ,0);
+    #endif
+    
+    setLayout(m_gridLayout);
+    palette().setColor(QPalette::Normal, QPalette::Window, QColor(0, 44, 0));
+}
+
+GridView::~GridView() {
+    clear();
+}
+
+void GridView::setColumnRowCounts(int columns, int rows) {
+    m_columnCount = columns;
+    m_rowCount = rows;
+    
+    #ifndef Q_WS_MAEMO_5  
+    if (m_columnCount == 2) // potrait mode
+    {
+    	m_gridLayout->setVerticalSpacing(49);
+    	m_gridLayout->setHorizontalSpacing(14);
+  	}
+  	else
+  	{
+  		m_gridLayout->setVerticalSpacing(13);
+    	m_gridLayout->setHorizontalSpacing(42);
+  	}
+    m_gridLayout->setContentsMargins(0, 0, 0 ,0);
+    #endif
+    
+}
+
+void GridView::rebuildLayout() {
+    int column = 0;
+    int row = 0;
+    foreach(QGraphicsLayoutItem *item, m_items) {
+        if(column == m_columnCount) {
+            row++;
+            column = 0;
+        }
+        //qDebug() << __PRETTY_FUNCTION__ << column << row;
+        m_gridLayout->addItem(item, row, column);
+        column++;
+    }
+    m_gridLayout->activate();
+}
+
+void GridView::addItem(QGraphicsLayoutItem *item) {
+    m_items.append(item);
+}
+
+void GridView::clear() {
+    while (!m_items.isEmpty())
+        delete m_items.takeFirst();
+}
+
+
+}  // namespace
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/GridView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,43 @@
+#ifndef GRIDVIEW_H
+#define GRIDVIEW_H
+
+#include <QGraphicsWidget>
+#include <QGraphicsGridLayout>
+
+
+namespace GVA {
+
+class GridView : public QGraphicsWidget
+{
+public:
+    explicit GridView(QGraphicsItem *parent = 0);
+    ~GridView();
+
+    void addItem(QGraphicsLayoutItem *item);
+
+    enum LayoutMode{
+        Normal,
+        Vertical
+    };
+
+    void setMode(LayoutMode mode);
+    LayoutMode mode() const { return m_mode; }
+
+    void setColumnRowCounts(int columns, int rows);
+    int columnCount() const { return m_columnCount; }
+    int rowCount() const { return m_rowCount; }
+
+    void clear();
+    void rebuildLayout();
+
+protected:
+    QGraphicsGridLayout *m_gridLayout;
+    LayoutMode m_mode;
+    QList<QGraphicsLayoutItem *> m_items;
+    int m_columnCount;
+    int m_rowCount;
+};
+
+}  // namespace
+
+#endif // GRIDVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/MostVisitedView.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,229 @@
+#include "MostVisitedView.h"
+#include "GridView.h"
+#include "webpagecontroller.h"
+#include "mostvisitedpagestore.h"
+#include "wrtbrowsercontainer.h"
+#include "ScaleThreePainter.h"
+#include "qstmgestureevent.h"
+
+#include <QGraphicsPixmapItem>
+#include <QGraphicsScene>
+#include <QGraphicsSceneResizeEvent>
+#include <QPainter>
+#include <QStyleOptionGraphicsItem>
+#include <QGraphicsLinearLayout>
+#include <QGraphicsSimpleTextItem>
+
+namespace GVA {
+
+
+// -----------------------------------------------------------
+// MostVisitedViewItem
+// -----------------------------------------------------------
+
+MostVisitedViewItem::MostVisitedViewItem(::MostVisitedPage *mostVisitedPage, QGraphicsItem *parent)
+    : QGraphicsWidget(parent),
+      m_mostVisitedPage(mostVisitedPage)
+{
+    grabGesture(QStm_Gesture::assignedType());
+    installEventFilter(this);
+}
+
+void MostVisitedViewItem::activate() {
+    WRT::WrtBrowserContainer * activePage = WebPageController::getSingleton()->currentPage();
+
+    if (activePage) {
+      activePage->mainFrame()->load(m_mostVisitedPage->m_url);
+    }
+    close();
+    emit activated();
+}
+
+void MostVisitedViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+    if(m_mostVisitedPage->m_pageThumbnail) {
+        QPixmap pixmap(QPixmap::fromImage(*m_mostVisitedPage->m_pageThumbnail).scaled(size().toSize()));
+        painter->drawPixmap(option->exposedRect, pixmap, option->exposedRect);
+        
+        QPen pen;
+        int x, y, w, h;
+        const int itemBorderWidth = 2;
+        const QColor itemBorderColor = QColor("black");
+
+        pen.setWidth(itemBorderWidth);
+        pen.setBrush(itemBorderColor);
+        pen.setJoinStyle(Qt::MiterJoin);
+        
+        painter->setPen(pen);
+        option->exposedRect.toRect().getRect(&x, &y, &w, &h);
+        painter->drawRect(x + itemBorderWidth / 2, y + itemBorderWidth / 2, w - itemBorderWidth, h - itemBorderWidth);
+    }
+}
+
+bool MostVisitedViewItem::eventFilter(QObject* o, QEvent* e)
+ { 
+   if (o != this) 
+      return false;
+   return QStm_GestureEventFilter::instance()->eventFilter(o, e);
+ } 
+
+bool MostVisitedViewItem::event(QEvent* event)
+ { 
+   if (event->type() == QEvent::Gesture) {
+       QStm_Gesture* gesture = getQStmGesture(event);
+       if (gesture) {  
+           handleQStmGesture(gesture);
+           event->accept();
+           return true;
+       }
+   }
+   return false;
+ }
+
+bool MostVisitedViewItem::handleQStmGesture(QStm_Gesture* gesture)
+ {
+   QStm_GestureType type = gesture->getGestureStmType();
+   
+   if (type == QStmTapGestureType) {
+       activate();
+   }
+   return true;
+ }
+
+
+// -----------------------------------------------------------
+// MostVisitedView
+// -----------------------------------------------------------
+
+MostVisitedView::MostVisitedView(const QString &title, QGraphicsItem *parent)
+    : QGraphicsWidget(parent),
+      m_layout(new QGraphicsLinearLayout(Qt::Vertical, this)),
+      m_title(0),
+      m_gridView(new GridView(this)),
+      m_backgroundPixmap(0),
+      m_backgroundDirty(true),
+      m_titleWrapper(new QGraphicsWidget(this))
+      
+{
+    m_titleWrapper->resize(50, 10);
+    m_title = new QGraphicsSimpleTextItem("  " + title, m_titleWrapper);
+    m_title->setBrush(QColor(Qt::white));
+    QFont textFont = m_title->font();
+    #ifdef Q_WS_MAEMO_5
+    textFont.setPointSize(16);
+    #else
+    textFont.setPointSize(6);
+    #endif
+    textFont.setWeight(QFont::Bold);
+    m_title->setFont(textFont);
+    #ifdef Q_WS_MAEMO_5
+    m_titleWrapper->setContentsMargins(16, 0, 0, 0);
+    #endif
+
+    setLayout(m_layout);
+    m_layout->setSpacing(0);
+    
+    #ifdef Q_WS_MAEMO_5
+    m_layout->setContentsMargins(16, 4, 16, 16);    
+    m_layout->addItem(m_titleWrapper);
+    #else
+    
+    m_layout->addItem(m_titleWrapper); 
+    #endif
+    m_layout->addItem(m_gridView);
+
+		#ifdef Q_WS_MAEMO_5
+    m_gridView->setColumnRowCounts(3, 2);    
+    #endif
+
+    m_backgroundPainter = new ScaleThreePainter(
+            ":/mostvisited/most_visited_bac_left.png",
+            ":/mostvisited/most_visited_bac_middle.png",
+            ":/mostvisited/most_visited_bac_right.png"
+            );   
+}
+
+MostVisitedView::~MostVisitedView() {
+    delete m_backgroundPainter;
+    delete m_backgroundPixmap;
+}
+
+void MostVisitedView::update(QString mode) {
+	  
+    MostVisitedPageList pageList = MostVisitedPageStoreSingleton::Instance().pageList();
+    m_gridView->clear();
+    foreach(MostVisitedPage *page, pageList) {
+        MostVisitedViewItem *item = new MostVisitedViewItem(page, this);
+        //qDebug() << __PRETTY_FUNCTION__ << " url=" << page->m_url << page->m_pageThumbnail;
+        m_gridView->addItem(item);
+        safe_connect(item, SIGNAL(activated()), this, SLOT(onItemActivated()));
+    }
+    
+    m_displayMode = mode;       
+    m_gridView->rebuildLayout();
+}
+
+void MostVisitedView::resizeEvent(QGraphicsSceneResizeEvent * event) {
+	  
+    m_gridView->resize(event->newSize());  
+    // Force background update on next paint().
+    m_backgroundDirty = true;
+}
+
+void MostVisitedView::closeEvent(QCloseEvent *event) {
+    Q_UNUSED(event)
+    emit closeComplete();
+}
+
+void MostVisitedView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+    // Update the background pixmap if needed.
+    
+    #ifndef Q_WS_MAEMO_5
+    if (m_displayMode == "portrait")
+    {
+    	m_gridView->setColumnRowCounts(2, 3);
+    	m_titleWrapper->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+    	m_layout->setContentsMargins(16, 4, 16, 16);  
+    	setMinimumSize(346, 523);    
+    	setMaximumSize(346, 523);    
+    }
+    else
+    {
+    	m_gridView->setColumnRowCounts(3, 2);
+    	m_titleWrapper->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+    	m_layout->setContentsMargins(36, 4, 0, 0);   
+    	setMinimumSize(610, 260);
+    	setMaximumSize(610, 260);
+    }
+    m_gridView->rebuildLayout();
+    #endif
+    
+    #ifndef Q_WS_MAEMO_5   
+    updateBackgroundPixmap(geometry().size().toSize(), widget);    	
+    m_backgroundPainter->unloadPixmaps();
+    #else
+    if(m_backgroundDirty) {    	
+     	updateBackgroundPixmap(geometry().size().toSize(), widget);    	
+      m_backgroundPainter->unloadPixmaps();
+    }
+    #endif
+
+    // Paint the background.
+    painter->drawPixmap(option->exposedRect, *m_backgroundPixmap, option->exposedRect);
+}
+
+void MostVisitedView::updateBackgroundPixmap(const QSize &size, QWidget* widget) {
+    delete m_backgroundPixmap;
+    m_backgroundPixmap = new QPixmap(size);
+    m_backgroundPixmap->fill(QColor(0xff, 0xff, 0xff, 0));
+    QPainter painter(m_backgroundPixmap);
+    m_backgroundPainter->paint(&painter, QRect(0, 0, size.width(), size.height()), widget);
+    m_backgroundDirty = false;
+}
+
+void MostVisitedView::onItemActivated() {
+    close();
+    emit activated();
+}
+
+}  // namespace
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/MostVisitedView.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,86 @@
+#ifndef MOSTVISITEDVIEW_H
+#define MOSTVISITEDVIEW_H
+
+#include <QObject>
+#include <QGraphicsWidget>
+
+#include "GridView.h"
+#include "Utilities.h"
+
+class MostVisitedPage;
+class QGraphicsLinearLayout;
+class QGraphicsSimpleTextItem;
+class QEvent;
+
+class QStm_Gesture;
+
+namespace GVA {
+
+class ScaleThreePainter;
+
+class MostVisitedViewItem : public QGraphicsWidget {
+    Q_OBJECT
+public:
+    MostVisitedViewItem(::MostVisitedPage *mostVisitedPage, QGraphicsItem *parent);
+
+    void activate();
+    bool event(QEvent* event);
+    bool eventFilter(QObject* o, QEvent* e);
+    
+protected:
+    bool handleQStmGesture(QStm_Gesture* gesture);
+
+signals:
+    void activated();
+
+private:
+    virtual QSizeF sizeHint ( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const  {
+        Q_UNUSED(which)
+        Q_UNUSED(constraint)
+        #ifdef Q_WS_MAEMO_5
+        return QSizeF(238, 126);
+        #else
+        return QSizeF(150, 105);
+        #endif
+    }
+    virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);   
+private:
+    MostVisitedPage *m_mostVisitedPage;
+};
+
+// --------------------------------------------
+
+class MostVisitedView : public QGraphicsWidget {
+    Q_OBJECT
+public:
+    MostVisitedView(const QString &title = QString::null, QGraphicsItem *parent = 0);
+    virtual ~MostVisitedView();
+    void update(QString mode);
+signals:
+    void closeComplete();
+    void activated();
+
+private slots:
+    void onItemActivated();
+
+private:
+    virtual void resizeEvent(QGraphicsSceneResizeEvent * event);
+    virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
+    virtual void closeEvent(QCloseEvent * event);
+
+    void updateBackgroundPixmap(const QSize &size, QWidget* widget);
+
+private:
+    QGraphicsLinearLayout *m_layout;
+    QGraphicsSimpleTextItem *m_title;
+    GridView *m_gridView;
+    ScaleThreePainter *m_backgroundPainter;
+    QPixmap *m_backgroundPixmap;
+    bool m_backgroundDirty;
+    QString m_displayMode;
+    QGraphicsWidget *m_titleWrapper;
+};
+
+}  // namespace
+
+#endif // MOSTVISITEDVIEW_H
--- a/ginebra2/PopupWebChromeItem.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/PopupWebChromeItem.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -23,6 +23,7 @@
 #include "ChromeWidget.h"
 #include "WebChromeSnippet.h"
 #include "ExternalEventCharm.h"
+#include "qstmgestureevent.h"
 
 namespace GVA {
 
@@ -60,14 +61,30 @@
     switch (e->type()) {
       case QEvent::Show:
         if(snippet() && m_modal) {
+            QStm_Gesture::setGestureGrabberItem(this);
             chrome()->emitPopupShown(snippet()->objectName());
         }
         break;
       case QEvent::Hide:
         if(snippet() && m_modal) {
+            QStm_Gesture::setGestureGrabberItem(NULL);
             chrome()->emitPopupHidden(snippet()->objectName());
         }
         break;
+
+        case QEvent::Gesture:
+            if(snippet() && m_modal) {
+                QStm_Gesture* gesture = getQStmGesture(e);
+                if (gesture) {
+                    QPointF pos = gesture->scenePosition(this);
+                    if (gesture->isGestureEnded() || this->sceneBoundingRect().contains(pos)) {
+                        WebChromeItem::event(e);
+                    }
+                }
+                return true;
+            }
+        break;
+
       default: break;
     }
 
--- a/ginebra2/RecentUrlToolbarSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/RecentUrlToolbarSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -56,22 +56,23 @@
     }
     
     void RecentUrlToolbarSnippet::addChild(ChromeSnippet * child) {
+    	
         WebChromeContainerSnippet * s =  dynamic_cast<WebChromeContainerSnippet* >(child);
         if (!s) {
             ToolbarActions_t* t = new ToolbarActions_t();
             if (child->elementId() == "RecentBackButton" ) {
                 t->actionId = RECENTURL_VIEW_ACTION_BACK;
                 t->actionName = RECENTURL_TOOLBAR_BACK;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png";
+                t->normalImg = ":/toolbar/icon_back_bg.png";
                 t->disabledImg = "";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png";
+                t->activeImg = ":/toolbar/icon_back_bg_pressed.png";
             }
             else if (child->elementId() == "RecentClearallButton" ) {
                 t->actionId = RECENTURL_VIEW_ACTION_CLEARALL;
                 t->actionName = RECENTURL_TOOLBAR_CLEARALL;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall.png";
-                t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall_disabled.png";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall_pressed.png";
+                t->normalImg = ":/toolbar/icon_clearall.png";
+                t->disabledImg = ":/toolbar/icon_clearall_disabled.png";
+                t->activeImg = ":/toolbar/icon_clearall_pressed.png";
             }
             t->id = child->elementId();
             m_actionInfo.append(t);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ScaleNinePainter.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,145 @@
+#include "ScaleNinePainter.h"
+#include <QtGui>
+
+namespace GVA {
+
+ScaleNinePainter::ScaleNinePainter(
+      const QString &topLeftFilename,
+      const QString &topMiddleFilename,
+      const QString &topRightFilename,
+      const QString &middleLeftFilename,
+      const QString &middleMiddleFilename,
+      const QString &middleRightFilename,
+      const QString &bottomLeftFilename,
+      const QString &bottomMiddleFilename,
+      const QString &bottomRightFilename)
+        : m_topLeftFilename(topLeftFilename),
+          m_topMiddleFilename(topMiddleFilename),
+          m_topRightFilename(topRightFilename),
+          m_middleLeftFilename(middleLeftFilename),
+          m_middleMiddleFilename(middleMiddleFilename),
+          m_middleRightFilename(middleRightFilename),
+          m_bottomLeftFilename(bottomLeftFilename),
+          m_bottomMiddleFilename(bottomMiddleFilename),
+          m_bottomRightFilename(bottomRightFilename),
+          m_topLeftPixmap(0),
+          m_topMiddlePixmap(0),
+          m_topRightPixmap(0),
+          m_middleLeftPixmap(0),
+          m_middleMiddlePixmap(0),
+          m_middleRightPixmap(0),
+          m_bottomLeftPixmap(0),
+          m_bottomMiddlePixmap(0),
+          m_bottomRightPixmap(0),
+          m_pixmapsLoaded(false)
+{
+}
+
+ScaleNinePainter::~ScaleNinePainter() {
+    unloadPixmaps();
+}
+
+void ScaleNinePainter::loadPixmaps() {
+    Q_ASSERT(!m_pixmapsLoaded);
+    m_topLeftPixmap = new QPixmap(m_topLeftFilename);
+    m_topMiddlePixmap = new QPixmap(m_topMiddleFilename);
+    m_topRightPixmap = new QPixmap(m_topRightFilename);
+    m_middleLeftPixmap = new QPixmap(m_middleLeftFilename);
+    m_middleMiddlePixmap = new QPixmap(m_middleMiddleFilename);
+    m_middleRightPixmap = new QPixmap(m_middleRightFilename);
+    m_bottomLeftPixmap = new QPixmap(m_bottomLeftFilename);
+    m_bottomMiddlePixmap = new QPixmap(m_bottomMiddleFilename);
+    m_bottomRightPixmap = new QPixmap(m_bottomRightFilename);
+    m_pixmapsLoaded = true;
+}
+
+void ScaleNinePainter::unloadPixmaps() {
+    delete m_topLeftPixmap; m_topLeftPixmap = 0;
+    delete m_topMiddlePixmap; m_topMiddlePixmap = 0;
+    delete m_topRightPixmap; m_topRightPixmap = 0;
+    delete m_middleLeftPixmap; m_middleLeftPixmap = 0;
+    delete m_middleMiddlePixmap; m_middleMiddlePixmap = 0;
+    delete m_middleRightPixmap; m_middleRightPixmap = 0;
+    delete m_bottomLeftPixmap; m_bottomLeftPixmap = 0;
+    delete m_bottomMiddlePixmap; m_bottomMiddlePixmap = 0;
+    delete m_bottomRightPixmap; m_bottomRightPixmap = 0;
+    m_pixmapsLoaded = false;
+}
+
+void ScaleNinePainter::paint(QPainter* painter, const QRect &rect, QWidget* widget) {
+    Q_UNUSED(widget)
+
+    if(!m_pixmapsLoaded)
+        loadPixmaps();
+
+    painter->save();
+
+    // Draw top left.
+    if(m_topLeftPixmap->height() > rect.height())
+        painter->drawPixmap(0, 0, m_topLeftPixmap->width(), rect.height(), *m_topLeftPixmap);
+    else
+        painter->drawPixmap(0, 0, *m_topLeftPixmap);
+
+    // Draw top middle.
+    if(!m_topMiddlePixmap->isNull()) {
+        painter->drawTiledPixmap(m_topLeftPixmap->width(),
+                                 0,
+                                 rect.width() - (m_topLeftPixmap->width() + m_topRightPixmap->width()),
+                                 qMin(m_topMiddlePixmap->height(), rect.height()),
+                                 *m_topMiddlePixmap);
+    }
+
+    // Draw top right.
+    painter->drawPixmap(rect.right() - m_topRightPixmap->width() + 1, 0, *m_topRightPixmap);
+
+    // Draw left border.
+    if(!m_middleLeftPixmap->isNull()) {
+        painter->drawTiledPixmap(0,
+                                 m_topLeftPixmap->height(),
+                                 m_middleMiddlePixmap->width(),
+                                 rect.height() - (m_topLeftPixmap->height() + m_bottomLeftPixmap->height()),
+                                 *m_middleLeftPixmap);
+    }
+
+    // Draw middle.
+    if(!m_middleMiddlePixmap->isNull()) {
+        QRect middleRect; 
+        middleRect.setLeft(m_middleLeftPixmap->isNull() ? m_topLeftPixmap->width() : m_topLeftPixmap->width());
+        middleRect.setRight(rect.width() - (m_middleRightPixmap->isNull() ? m_topRightPixmap->width() : m_topRightPixmap->width()) - 1);
+        middleRect.setTop(m_topMiddlePixmap->isNull() ? m_topLeftPixmap->height() : m_topMiddlePixmap->height());
+        middleRect.setBottom(rect.height() - (m_bottomMiddlePixmap->isNull() ? m_bottomLeftPixmap->height() : m_bottomMiddlePixmap->height()) - 1);
+        painter->drawTiledPixmap(middleRect, *m_middleMiddlePixmap);
+    }
+
+    // Draw right border.
+    if(!m_middleRightPixmap->isNull()) {
+        painter->drawTiledPixmap(rect.width() - m_middleRightPixmap->width(),
+                                 m_topRightPixmap->height(),
+                                 m_middleRightPixmap->width(),
+                                 rect.height() - (m_topRightPixmap->height() + m_bottomRightPixmap->height()),
+                                 *m_middleRightPixmap);
+    }
+
+    // Draw bottom row.
+    if(!m_bottomLeftPixmap->isNull()) {
+        painter->drawPixmap(0,
+                            rect.bottom() - m_bottomLeftPixmap->height() + 1,
+                            *m_bottomLeftPixmap);
+    }
+    if(!m_bottomMiddlePixmap->isNull()) {
+        QRect bottomRect;
+        bottomRect.setLeft(m_bottomLeftPixmap->width());
+        bottomRect.setRight(rect.width() - m_bottomRightPixmap->width() - 1);
+        bottomRect.setTop(rect.bottom() - m_bottomMiddlePixmap->height() + 1);
+        bottomRect.setBottom(rect.bottom());
+        painter->drawTiledPixmap(bottomRect, *m_bottomMiddlePixmap);
+    }
+    if(!m_bottomRightPixmap->isNull()) {
+        painter->drawPixmap(rect.right() - m_bottomLeftPixmap->width() + 1,
+                            rect.bottom() - m_bottomRightPixmap->height() + 1,
+                            *m_bottomRightPixmap);
+    }
+    painter->restore();
+}
+
+}  // GVA namespace
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ScaleNinePainter.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,61 @@
+#ifndef SCALENINEPAINTER_H
+#define SCALENINEPAINTER_H
+
+#include <QPixmap>
+
+class QPainter;
+class QString;
+class QStyleOptionGraphicsItem;
+class QWidget;
+
+namespace GVA {
+
+/*!
+ * This class paints a resizable window background using separate images for its' four corners,
+ * four edges and middle area.
+ */
+class ScaleNinePainter
+{
+public:
+    ScaleNinePainter(const QString &topLeftFilename,
+                     const QString &topMiddleFilename,
+                     const QString &topRightFilename,
+                     const QString &middleLeftFilename = QString::null,
+                     const QString &middleMiddleFilename = QString::null,
+                     const QString &middleRightFilename = QString::null,
+                     const QString &bottomLeftFilename = QString::null,
+                     const QString &bottomMiddleFilename = QString::null,
+                     const QString &bottomRightFilename = QString::null
+                     );
+    ~ScaleNinePainter();
+    void paint(QPainter* painter, const QRect &rect, QWidget* widget);
+    void unloadPixmaps();
+
+private:
+    void loadPixmaps();
+
+private:
+    QString m_topLeftFilename;
+    QString m_topMiddleFilename;
+    QString m_topRightFilename;
+    QString m_middleLeftFilename;
+    QString m_middleMiddleFilename;
+    QString m_middleRightFilename;
+    QString m_bottomLeftFilename;
+    QString m_bottomMiddleFilename;
+    QString m_bottomRightFilename;
+    QPixmap *m_topLeftPixmap;
+    QPixmap *m_topMiddlePixmap;
+    QPixmap *m_topRightPixmap;
+    QPixmap *m_middleLeftPixmap;
+    QPixmap *m_middleMiddlePixmap;
+    QPixmap *m_middleRightPixmap;
+    QPixmap *m_bottomLeftPixmap;
+    QPixmap *m_bottomMiddlePixmap;
+    QPixmap *m_bottomRightPixmap;
+    bool m_pixmapsLoaded;
+};
+
+}  // GVA namespace
+
+#endif // SCALENINEPAINTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ScaleThreePainter.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,74 @@
+#include "ScaleThreePainter.h"
+#include <QtGui>
+
+namespace GVA {
+
+ScaleThreePainter::ScaleThreePainter(
+      const QString &leftFilename,
+      const QString &middleFilename,
+      const QString &rightFilename)
+        : m_leftFilename(leftFilename),
+          m_middleFilename(middleFilename),
+          m_rightFilename(rightFilename),
+          m_leftPixmap(0),
+          m_middlePixmap(0),
+          m_rightPixmap(0),
+          m_pixmapsLoaded(false)
+{
+}
+
+ScaleThreePainter::~ScaleThreePainter() {
+    unloadPixmaps();
+}
+
+void ScaleThreePainter::loadPixmaps() {
+    Q_ASSERT(!m_pixmapsLoaded);
+    m_leftPixmap = new QPixmap(m_leftFilename);
+    m_middlePixmap = new QPixmap(m_middleFilename);
+    m_rightPixmap = new QPixmap(m_rightFilename);
+    m_pixmapsLoaded = true;
+}
+
+void ScaleThreePainter::unloadPixmaps() {
+    delete m_leftPixmap; m_leftPixmap = 0;
+    delete m_middlePixmap; m_middlePixmap = 0;
+    delete m_rightPixmap; m_rightPixmap = 0;
+    m_pixmapsLoaded = false;
+}
+
+void ScaleThreePainter::paint(QPainter* painter, const QRect &rect, QWidget* widget) {
+    Q_UNUSED(widget)
+
+    if(!m_pixmapsLoaded)
+        loadPixmaps();
+
+    //    qDebug() << "ScaleThreePainter::paint: " << rect << qMin(m_middlePixmap->height(), rect.height());
+
+    painter->save();
+
+    // Draw left.
+    if(m_leftPixmap->height() > rect.height())
+        painter->drawPixmap(0, 0, m_leftPixmap->width(), rect.height(), *m_leftPixmap);
+    else
+        painter->drawPixmap(0, 0, *m_leftPixmap);
+
+    // Draw top middle -- fills in the space is between the left and right pixmaps.
+    if(!m_middlePixmap->isNull()) {
+        painter->drawTiledPixmap(m_leftPixmap->width(),
+                                 0,
+                                 rect.width() - (m_leftPixmap->width() + m_rightPixmap->width()),
+                                 rect.height(),
+                                 m_middlePixmap->scaledToHeight(rect.height()));
+    }
+
+    // Draw right.
+    if(m_rightPixmap->height() > rect.height())
+        painter->drawPixmap(rect.right() - m_rightPixmap->width() + 1, 0, m_rightPixmap->width(), rect.height(), *m_rightPixmap);
+    else
+        painter->drawPixmap(rect.right() - m_rightPixmap->width() + 1, 0, *m_rightPixmap);
+
+    painter->restore();
+}
+
+
+}  // GVA namespace
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ScaleThreePainter.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,43 @@
+#ifndef ScaleThreePainter_H
+#define ScaleThreePainter_H
+
+#include <QPixmap>
+
+class QPainter;
+class QString;
+class QStyleOptionGraphicsItem;
+class QWidget;
+
+namespace GVA {
+
+/*!
+ * This class paints a resizable window background using separate images for its' left, middle and right areas.
+ */
+class ScaleThreePainter
+{
+public:
+    ScaleThreePainter(const QString &leftFilename,
+                      const QString &middleFilename,
+                      const QString &rightFilename
+                     );
+    ~ScaleThreePainter();
+
+    void paint(QPainter* painter, const QRect &rect, QWidget* widget);
+    void unloadPixmaps();
+
+private:
+    void loadPixmaps();
+
+private:
+    QString m_leftFilename;
+    QString m_middleFilename;
+    QString m_rightFilename;
+    QPixmap *m_leftPixmap;
+    QPixmap *m_middlePixmap;
+    QPixmap *m_rightPixmap;
+    bool m_pixmapsLoaded;
+};
+
+}  // GVA namespace
+
+#endif // ScaleThreePainter_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ScrollHelper.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,404 @@
+#include <QtCore>
+#include "ScrollHelper.h"
+#include "qstmfilelogger.h"
+
+
+#define SCROLL_TIMEOUT   16
+
+namespace GVA
+{
+static const int MaxFlickDurartion = 1500;
+static const int MidFlickDurartion = 800;
+static const int MinFlickDurartion = 500;
+static const qreal MaxFlickSpeed = 2.0;
+static const qreal MidFlickSpeed = 1.2;
+static const qreal MinFlickSpeed = 0.5;
+static const qreal MaxFlickInViewportUnits = 1.0;
+static const qreal MidFlickInViewportUnits = 0.8;
+static const qreal MinFlickInViewportUnits = 0.2;
+static const qreal DefaultDecel = 0.005;
+
+ScrollHelper::ScrollHelper(QObject* scrolledWidget) : QObject(),
+                                  m_scrolledWidget(scrolledWidget),
+                                  m_minFlickDuration(MinFlickDurartion),
+                                  m_maxFlickDuration(MaxFlickDurartion),
+                                  m_midFlickDuration(MidFlickDurartion),
+                                  m_scrollDelta(QPointF()),
+                                  m_minFlickSpeed(MinFlickSpeed),
+                                  m_maxFlickSpeed(MaxFlickSpeed),
+                                  m_midFlickSpeed(MidFlickSpeed),
+                                  m_maxFlickInViewportUnits(MaxFlickInViewportUnits),
+                                  m_minFlickInViewportUnits(MinFlickInViewportUnits),
+                                  m_midFlickInViewportUnits(MidFlickInViewportUnits),
+                                  m_viewportSize(QSize()),
+                                  m_lockToY(false),
+                                  m_lockToX(false),
+                                  m_decel(DefaultDecel)
+                                  
+{
+    m_scrollAnimation = new QPropertyAnimation(scrolledWidget, "widgetScrollPosition");
+    connect(m_scrollAnimation, SIGNAL(finished()), this, SLOT(stopScroll()));
+    connect(m_scrollAnimation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)),
+            this, SLOT(scrollAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+    m_scrollTimer = UiTimer::New();    
+    m_scrollTimer->setPriority(50);   
+    m_scrollTimer->setTimerCallback("scrollTimerCallback");
+    m_easingCurve = new QEasingCurve(QEasingCurve::OutCubic);
+    m_easingCurveOvershoot= new QEasingCurve(QEasingCurve::OutBack);
+
+}
+
+ScrollHelper::~ScrollHelper()
+{
+    m_scrollTimer->stop();
+    delete m_scrollTimer;
+    delete m_easingCurve;
+    delete m_easingCurveOvershoot;
+}
+
+
+void ScrollHelper::setFlickDurationLimits(int minDuration, int midDuration, int maxDuration)
+{
+    m_minFlickDuration = minDuration;
+    m_midFlickDuration = midDuration;
+    m_maxFlickDuration = maxDuration;
+}
+
+void ScrollHelper::setFlickSpeedLimits(qreal minSpeed, qreal midSpeed, qreal maxSpeed)
+{
+    m_minFlickSpeed = minSpeed;
+    m_midFlickSpeed = midSpeed;
+    m_maxFlickSpeed = maxSpeed;
+}
+
+void ScrollHelper::setFlickLimits(qreal minFlick, qreal midFlick, qreal maxFlick)
+{
+    m_minFlickInViewportUnits = minFlick;
+    m_midFlickInViewportUnits = midFlick;
+    m_maxFlickInViewportUnits = maxFlick;
+}
+
+
+void ScrollHelper::setDeceleration(qreal decel)
+{
+    m_decel = decel;
+}
+
+qreal ScrollHelper::getDeceleration()
+{
+    return m_decel;
+}
+
+
+void ScrollHelper::scrollTimerCallback()
+{
+    m_scrollTimer->stop();
+    if (m_scrollState != ScrollHelper::ActiveState) {
+        return;
+    }
+    qstmDebug() << "ScrollHelper::scrollTimerCallback. m_scrollDelta: " << m_scrollDelta <<
+            ", m_scrollMode: " << m_scrollMode << "\n";
+    
+    QPointF speed = m_kineticSpeed;
+    if (m_scrollMode == ScrollHelper::KineticScrollMode) {
+        m_scrollDuration += SCROLL_TIMEOUT;
+        qreal progress = (qreal)m_scrollDuration / m_scrollTotalDuration;
+        if (progress > 0.0 && progress < 1.0) {
+            qreal val = m_curEasingCurve->valueForProgress(progress);
+            QPointF tp = m_startScrollPos + val * (m_targetScrollPos - m_startScrollPos);
+            m_curScrollPos = tp;
+            setScrollPos(tp);
+            m_scrollTimer->start(SCROLL_TIMEOUT, this);
+        }
+        else {
+            stopScroll();
+        }
+    }
+    else if (m_scrollMode == ScrollHelper::PanScrollMode) {
+        doScroll(m_scrollDelta);
+        m_scrollDelta = QPointF();
+        m_scrollTimer->start(SCROLL_TIMEOUT, this);
+    }
+}
+
+
+QPointF ScrollHelper::speedForNextInterval(const QPointF& initSpeed, long timeInterval, const QPointF& decel)
+{
+    QPointF speed = initSpeed;
+    if (speed.y() < 0) {
+        speed.ry() += (decel.y() * timeInterval);
+        speed.ry() = qMin(qreal(0.0), speed.y());
+    }
+    else if (speed.y() > 0) {
+        speed.ry() -= (decel.y() * timeInterval);
+        speed.ry() = qMax(qreal(0.0), speed.y());
+    }
+    if (speed.x() < 0) {
+        speed.rx() += (decel.x() * timeInterval);
+        speed.rx() = qMin(qreal(0.0), speed.x());
+    }
+    else if (speed.x() > 0) {
+        speed.rx() -= (decel.x() * timeInterval);
+        speed.rx() = qMax(qreal(0.0), speed.x());
+    }
+    return speed;
+}
+
+
+void ScrollHelper::scroll(QPointF& delta)
+{
+    if ( delta.x() == 0 && delta.y() == 0)  return;
+
+    if (m_scrollState == ScrollHelper::IdleState) {
+        //m_lockToX = (delta.y() == 0);
+        //m_lockToY = (delta.x() == 0);
+
+        doScroll(delta);
+        m_scrollDelta = QPointF();
+        m_scrollTimer->setSingleShot(true);
+        m_scrollTimer->start(SCROLL_TIMEOUT, this);
+    }
+    else {
+        if (m_lockToX) {
+            delta.ry() = 0.0;
+        }
+        if (m_lockToY) {
+            delta.rx() = 0.0;
+        }
+        m_scrollDelta += delta;
+    }
+    m_scrollMode = ScrollHelper::PanScrollMode;
+    m_scrollState = ScrollHelper::ActiveState;
+}
+
+bool ScrollHelper::isScrolling()
+{
+    return m_scrollState == ScrollHelper::ActiveState;
+}
+
+void ScrollHelper::doScroll(QPointF& delta)
+{
+    QPointF scrollPos = getScrollPos();
+    QPointF targetPos;
+    targetPos = scrollPos + delta;
+    setScrollPos(targetPos);
+}
+
+QPointF ScrollHelper::getScrollPos()
+{
+    return m_scrolledWidget->property("widgetScrollPosition").toPointF();
+}
+
+void  ScrollHelper::setScrollPos(QPointF& pos)
+{
+     m_scrolledWidget->setProperty("widgetScrollPosition", pos.toPoint());
+}
+
+QPointF ScrollHelper::getMaxScrollPos()
+{
+    return m_scrolledWidget->property("maxScrollPosition").toPointF();
+}
+
+
+QSizeF ScrollHelper::viewportSize()
+{
+    return m_viewportSize;
+}
+
+void ScrollHelper::setViewportSize(const QSizeF& size)
+{
+    m_viewportSize = size;
+}
+
+void ScrollHelper::stopScrollNoSignal()
+{
+    m_scrollTimer->stop();
+    reset();    
+}
+
+void ScrollHelper::stopScroll()
+{     
+    stopScrollNoSignal();
+    emit scrollFinished();
+}
+
+
+void ScrollHelper::reset()
+{
+    m_scrollState = ScrollHelper::IdleState;
+    m_scrollMode = ScrollHelper::ReadyMode;
+    m_scrollDelta = QPointF();
+    m_lockToY = false;
+    m_lockToX = false;
+}
+
+void ScrollHelper::panFromOvershoot()
+{
+    stopScroll();
+    QPointF scrollPos = getScrollPos();
+    QPointF targetScrollPos = scrollPos;
+    QEasingCurve::Type easingCurveType = QEasingCurve::OutCubic;
+    if (clampScrollPosition(targetScrollPos)) {
+        easingCurveType = QEasingCurve::OutBack;
+        m_scrollMode = ScrollHelper::PanScrollMode;
+        startScrollAnimation(scrollPos, targetScrollPos, 300, easingCurveType);
+    }
+}
+
+bool ScrollHelper::clampScrollPosition(QPointF& scrollPos)
+{
+    QPointF maxScrollPos = getMaxScrollPos();
+    QPointF origPos = scrollPos;
+    scrollPos.ry() = qBound(qreal(0.0), origPos.y(), maxScrollPos.y());
+    scrollPos.rx() = qBound(qreal(0.0), origPos.x(), maxScrollPos.x());
+    bool clampY = (scrollPos.y() != origPos.y()) &&
+                  (scrollPos.y() == qreal(0.0) || scrollPos.y() == maxScrollPos.y());
+
+    bool clampX = (scrollPos.x() != origPos.x()) &&
+                   (scrollPos.x() == qreal(0.0) || scrollPos.x() == maxScrollPos.x());
+    return (clampX || clampY);
+}
+
+
+void ScrollHelper::startScrollAnimation(QPointF& scrollPos, QPointF& targetPos,
+                                        int duration, QEasingCurve::Type& easingCurveType)
+{
+    if (scrollPos != targetPos) {
+        m_scrollAnimation->setStartValue(scrollPos);
+        m_scrollAnimation->setEndValue(targetPos);
+        m_scrollAnimation->setDuration(duration);
+        m_scrollAnimation->setEasingCurve(easingCurveType);
+        m_scrollAnimation->start();
+        m_scrollState = ScrollHelper::ActiveState;
+    }
+}
+
+void ScrollHelper::scrollAnimationStateChanged(QAbstractAnimation::State newState,
+                                               QAbstractAnimation::State)
+{
+    switch (newState) {
+        case QAbstractAnimation::Stopped:
+            reset();
+            break;
+        case QAbstractAnimation::Running:
+            break;
+        default:
+            break;
+    }
+}
+
+
+int ScrollHelper::calcScrollDuration(const QPointF& speed, const QPointF& delta)
+{
+    QPointF v1 = speed;
+    int flickDuration = sqrt(delta.x() * delta.x() + delta.y() * delta.y()) /
+                        sqrt(v1.x() * v1.x() + v1.y() * v1.y());
+    flickDuration = qBound(m_minFlickDuration, flickDuration, m_maxFlickDuration);
+    return flickDuration;
+}
+
+
+int ScrollHelper::calcScrollDuration(qreal motionFactor)
+{
+    int duration = m_midFlickDuration;
+    if (motionFactor == m_maxFlickInViewportUnits) {
+         duration = m_maxFlickDuration;
+    }
+    else if (motionFactor == m_minFlickInViewportUnits) {
+        duration = m_minFlickDuration;
+    }
+    return duration;
+}
+
+void ScrollHelper::kineticScroll(QPointF& speed)
+{
+    if (m_lockToY) {
+        speed.rx() = 0.0;
+    }
+    if (m_lockToX) {
+        speed.ry() = 0.0;
+    }
+    
+    //doScroll(m_scrollDelta);
+    //stopScroll();
+    
+    QEasingCurve::Type easingCurveType = QEasingCurve::InOutCubic;
+    
+    QPointF scrollPos = getScrollPos() + m_scrollDelta;
+    int flickDuration = 0;
+    QPointF targetPos = calcTargetScrollPosAndDuration(speed, scrollPos, flickDuration);
+    QPointF delta = targetPos - scrollPos;
+
+    m_curEasingCurve = m_easingCurve;
+    if (clampScrollPosition(targetPos)) {
+        easingCurveType = QEasingCurve::OutBack;
+        m_curEasingCurve = m_easingCurveOvershoot;
+    }
+    m_scrollMode = ScrollHelper::KineticScrollMode;
+    qstmDebug() << "ScrollHelper::kineticScroll. initial speed: " << speed <<
+            ", delta: " << delta <<
+            ", flickDuration: " << flickDuration <<
+            ", m_scrollDelta: " << m_scrollDelta << "\n";
+    
+    m_targetScrollPos = targetPos;
+    m_kineticSpeed = speed;
+    m_curScrollPos = scrollPos;
+    m_startScrollPos = scrollPos;
+    m_scrollTotalDuration = flickDuration;
+    m_scrollDuration = 0; 
+    m_lockToX = false;
+    m_lockToY = false;
+    //m_decelVec = calcTargetScrollPosAndDuration(speed, delta, flickDuration);
+
+    //startScrollAnimation(scrollPos, targetPos, flickDuration, easingCurveType);
+}
+
+QPointF ScrollHelper::calcDeceleration(const QPointF& initSpeed, const QPointF& distance, long time)
+{
+    return 2 * (initSpeed * time - distance) / (time * time);
+}
+
+QPointF ScrollHelper::calcTargetScrollPosAndDuration(const QPointF& speed, const QPointF& scrollPos, int& duration)
+{
+    QSizeF  vpSize = viewportSize();
+    QPointF targetPos = scrollPos;
+    if (vpSize.isValid()) {
+        qreal kX = 0.0;
+        qreal kY = 0.0;
+        if (speed.x() != 0.0) {
+            kX = calcMotionFactor(speed.x());
+        }
+
+        if (speed.y() != 0.0) {
+            kY = calcMotionFactor(speed.y());
+        }
+
+        targetPos.rx() -= kX * vpSize.width();
+        targetPos.ry() -= kY * vpSize.height();
+        duration = calcScrollDuration(qMax(qAbs(kX), qAbs(kY)));
+    }
+    return targetPos;
+}
+
+
+qreal ScrollHelper::calcMotionFactor(const qreal speed)
+{
+    qreal k = 0.0;
+    qreal absSpeed = qAbs(speed);
+    if (absSpeed >= m_maxFlickSpeed) {
+        k = m_maxFlickInViewportUnits;
+    }
+    else if (absSpeed < m_maxFlickSpeed && absSpeed >= m_midFlickSpeed) {
+        k = m_midFlickInViewportUnits;
+    }
+    else {
+        k = m_minFlickInViewportUnits;
+    }
+    if (speed < 0) {
+        k = -k;
+    }
+    return k;
+}
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ScrollHelper.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,109 @@
+
+#ifndef SCROLLHELPER_H_
+#define SCROLLHELPER_H_
+
+#include <QPropertyAnimation>
+#include <QRectF>
+#include <QPoint>
+#include <QTime>
+#include <QTimer>
+#include "uitimer.h"
+
+namespace GVA {
+class ScrollHelper: public QObject
+{
+    Q_OBJECT
+    
+public:
+    enum ScrollMode {
+        ReadyMode = 0,
+        PanScrollMode,
+        KineticScrollMode
+    };
+    
+    enum ScrollState {
+        IdleState = 0,   // no scrolling
+        ActiveState, // scroll poins added
+        WaitState    // no new scroll points
+    };
+    
+    enum ScrollProperty {
+        Geometry,
+        Position,
+        Velocity
+    };
+    
+    ScrollHelper(QObject* scrolledWidget);
+    ~ScrollHelper();
+    void scroll(QPointF& delta);
+    
+    bool isScrolling();
+    void panFromOvershoot();
+    void setFlickDurationLimits(int minDuration, int midDuration, int maxDuration);
+    void setFlickSpeedLimits(qreal minSpeed, qreal midSpeed, qreal maxSpeed);
+    void setDeceleration(qreal decel);
+    qreal getDeceleration();
+    void kineticScroll(QPointF& speed);
+    QSizeF viewportSize();
+    void setViewportSize(const QSizeF& size);
+    void setFlickLimits(qreal minFlick, qreal midFlick, qreal maxFlick);
+    void stopScrollNoSignal();
+
+public slots:
+    void stopScroll();    
+    void scrollTimerCallback();
+    void scrollAnimationStateChanged(QAbstractAnimation::State newState,
+                                     QAbstractAnimation::State);
+signals:
+    void scrollFinished();
+
+private:
+    void reset();
+    void doScroll(QPointF& delta);
+    QPointF getScrollPos();
+    QPointF getMaxScrollPos();
+    void setScrollPos(QPointF& pos);
+    bool clampScrollPosition(QPointF& scrollPos);
+    void startScrollAnimation(QPointF& scrollPos, QPointF& targetPos,
+                              int duration, QEasingCurve::Type& easingCurveType);
+    int calcScrollDuration(const QPointF& speed, const QPointF& delta);
+    int calcScrollDuration(qreal motionFactor);
+    QPointF calcTargetScrollPosAndDuration(const QPointF& speed,
+                                           const QPointF& scrollPos, int& duration);
+    qreal calcMotionFactor(const qreal speed);
+    QPointF calcDeceleration(const QPointF& initSpeed, const QPointF& distance, long time);
+    QPointF speedForNextInterval(const QPointF& initSpeed, long timeInterval, const QPointF& decel);
+private:
+    ScrollMode          m_scrollMode;
+    ScrollState         m_scrollState;
+    QPointF             m_scrollDelta;
+    QPointF             m_curScrollPos;
+    QPropertyAnimation* m_scrollAnimation;
+    UiTimer*            m_scrollTimer;
+    QObject*            m_scrolledWidget;
+    int                 m_minFlickDuration;
+    int                 m_maxFlickDuration;
+    int                 m_midFlickDuration;
+    qreal               m_minFlickSpeed;
+    qreal               m_maxFlickSpeed;
+    qreal               m_midFlickSpeed;
+    qreal               m_decel;
+    QPointF             m_decelVec;
+    QSizeF              m_viewportSize;
+    qreal               m_maxFlickInViewportUnits;
+    qreal               m_minFlickInViewportUnits;
+    qreal               m_midFlickInViewportUnits;
+    bool                m_lockToY;
+    bool                m_lockToX;
+    QPointF             m_targetScrollPos;
+    QPointF             m_startScrollPos;
+    QPointF             m_kineticSpeed;
+    long                m_scrollTotalDuration;
+    long                m_scrollDuration;
+    QEasingCurve::Type  m_easingCurveType;
+    QEasingCurve*       m_easingCurve;
+    QEasingCurve*       m_easingCurveOvershoot;
+    QEasingCurve*       m_curEasingCurve;
+};
+}
+#endif /* SCROLLHELPER_H_ */
--- a/ginebra2/ScrollableViewBase.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ScrollableViewBase.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -27,7 +27,7 @@
 #include <QGraphicsScene>
 #include <QGraphicsSceneMouseEvent>
 #include <QPointF>
-
+#include <QApplication>
 namespace GVA {
 
 ScrollableViewBase::ScrollableViewBase(QGraphicsItem* parent, Qt::WindowFlags wFlags)
@@ -41,7 +41,7 @@
     setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
 
     //To speed up painting.
-    setFlag(QGraphicsItem::ItemHasNoContents, true);
+    //setFlag(QGraphicsItem::ItemHasNoContents, true);
     setAttribute(Qt::WA_OpaquePaintEvent, true);
 
     m_kineticScroller = new KineticScroller(this);
@@ -76,7 +76,7 @@
 
 QPoint ScrollableViewBase::maximumScrollPosition() const
 {
-    QSizeF contentsSize = m_scrollWidget->size();
+    QSizeF contentsSize = m_scrollWidget->size() * m_scrollWidget->scale();;
     QSizeF viewportSize = size();
     QSize maxScrollSize = (contentsSize - viewportSize).toSize();
 
@@ -90,8 +90,14 @@
 
 void ScrollableViewBase::setScrollPosition(const QPoint& pos, const QPoint& overShoot)
 {
+    QPoint p = scrollPosition();
+    QPoint d = pos - p;
+
     m_overShoot = overShoot;
-    setScrollWidgetPos(-pos);
+    setScrollWidgetPos(-pos + m_overShoot);
+    //QApplication::sendPostedEvents();
+    
+    emit viewScrolled(p, d);
 }
 
 void ScrollableViewBase::stateChanged(KineticScrollable::State oldState
@@ -100,7 +106,7 @@
     Q_UNUSED(oldState);
     Q_UNUSED(newState);
 }
-
+/*
 void ScrollableViewBase::setScrollWidgetGeometry(const QRectF& geom)
 {
     scrollWidget()->setGeometry(adjustScrollWidgetRect(geom));
@@ -144,10 +150,10 @@
     newRect.translate(m_overShoot);
     return newRect;
 }
-
+*/
 void ScrollableViewBase::setScrollWidgetPos(const QPointF& pos)
 {
-    setScrollWidgetGeometry(QRectF(pos, scrollWidget()->size()));
+    scrollWidget()->setPos(pos);
 }
 
 QPointF ScrollableViewBase::scrollWidgetPos() const
--- a/ginebra2/ScrollableViewBase.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ScrollableViewBase.h	Fri Oct 15 17:30:59 2010 -0400
@@ -31,27 +31,31 @@
 class KineticScroller;
 
 class ScrollableViewBase : public QGraphicsWidget, public KineticScrollable {
+    Q_OBJECT
 public:
     ScrollableViewBase(QGraphicsItem* parent = 0, Qt::WindowFlags wFlags = 0);
     ~ScrollableViewBase();
 
     void setWidget(QGraphicsWidget*);
 
+Q_SIGNALS:
+    void viewScrolled(QPoint& scrollPos, QPoint& delta);
+
 protected:
 
     //KineticScrollable pure virtuals
     QSize viewportSize() const;
     QPoint maximumScrollPosition() const ;
     QPoint scrollPosition() const;
-    void setScrollPosition(const QPoint& pos, const QPoint& overshootDelta);
+    void setScrollPosition(const QPoint& pos, const QPoint& overshootDelta = QPoint(0,0));
     void stateChanged(KineticScrollable::State oldState, KineticScrollable::State newState);
 
     QGraphicsWidget* scrollWidget() const { return m_scrollWidget; }
-    virtual void setScrollWidgetGeometry(const QRectF& r);
-    QRectF adjustScrollWidgetRect(const QRectF&);
+//    virtual void setScrollWidgetGeometry(const QRectF& r);
+//    QRectF adjustScrollWidgetRect(const QRectF&);
 
     //Helpers for adjusting scroll pos
-    void setScrollWidgetPos(const QPointF& pos);
+    virtual void setScrollWidgetPos(const QPointF& pos);
     QPointF scrollWidgetPos() const;
 
 protected:
--- a/ginebra2/SettingsToolbarSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/SettingsToolbarSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -57,23 +57,24 @@
         return that;
     }
     
-    void SettingsToolbarSnippet::addChild(ChromeSnippet * child) {
+void SettingsToolbarSnippet::addChild(ChromeSnippet * child) {
+    	
         WebChromeContainerSnippet * s =  dynamic_cast<WebChromeContainerSnippet* >(child);
         if (!s) {
             ToolbarActions_t* t = new ToolbarActions_t();
             if (child->elementId() == "SettingsBackButton" ) {
                 t->actionId = SETTINGS_VIEW_ACTION_BACK;
                 t->actionName = SETTINGS_TOOLBAR_BACK;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png";
+                t->normalImg = ":/toolbar/icon_back_bg.png";
                 t->disabledImg = "";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png";
+                t->activeImg = ":/toolbar/icon_back_bg_pressed.png";
             }
             else if (child->elementId() == "SettingsFeedbackButton" ) {
                 t->actionId = SETTINGS_VIEW_ACTION_FEEDBACK;
                 t->actionName = SETTINGS_TOOLBAR_FEEDBACK;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_feedback.png";
+                t->normalImg = ":/toolbar/icon_feedback.png";
                 t->disabledImg = "";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_feedback_pressed.png";
+                t->activeImg = ":/toolbar/icon_feedback_pressed.png";
             }
             t->id = child->elementId();
             m_actionInfo.append(t);
--- a/ginebra2/SlidingWidget.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/SlidingWidget.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -33,8 +33,8 @@
       m_top(0),
       m_window(0),
       m_bottom(0),
+      m_slidePos(0),
       m_slideMax(0),
-      m_slidePos(0),
       m_shrinked(0),
       m_shrinkMax(0),
       m_windowSize(QSizeF())
@@ -85,26 +85,25 @@
 
   qreal SlidingWidget::slide(qreal delta)
   {
+      return setSlide(m_slideMax - m_slidePos - delta);
+  }
 
-    qreal newPos = m_slidePos + delta;
-
-    //qDebug() << "SlidingWidget::slide: delta: " << delta << " m_slidePos: " << m_slidePos << " newPos: " << newPos;
+  qreal SlidingWidget::setSlide(qreal scrollPos)
+  {
 
-    if (newPos < 0) {
-      if (m_slidePos == 0)
-    return 0;
-      delta = -m_slidePos;
-      m_slidePos = 0;
+    qreal pos = m_slideMax - scrollPos;
+
+    if(pos < 0) {
+        pos = 0;
+    } else if (pos > m_slideMax){
+        pos = m_slideMax;
     }
 
-    else if (newPos > m_slideMax){
-      if (m_slidePos == m_slideMax)
+    if(pos == m_slidePos)
     return 0;
-      delta = m_slideMax - m_slidePos;
-      m_slidePos = m_slideMax;
-    }
 
-    else m_slidePos = newPos;
+    qreal delta = pos - m_slidePos;
+    m_slidePos = pos;
 
     //qDebug() << "calculated delta: " << delta << " new m_slidePos: " << m_slidePos;
 
@@ -161,6 +160,14 @@
       m_window->setPos(0,0);
   }
 
+  QSize SlidingWidget::viewPortSize(bool withoutTop ) {
+
+      QSize sz =  m_windowSize.toSize();
+      if (m_top && withoutTop) {
+          sz.setHeight(m_windowSize.height() - m_top->geometry().height()); 
+      }
+      return sz;
+  }
 
 } // end of namespace GVA
 
--- a/ginebra2/SlidingWidget.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/SlidingWidget.h	Fri Oct 15 17:30:59 2010 -0400
@@ -33,11 +33,13 @@
     SlidingWidget(QGraphicsItem* parent = 0);
     virtual ~SlidingWidget();
     void setWindow(QGraphicsWidget* window);
+    qreal setSlide(qreal scrollPos);
     qreal slide(qreal delta);
     qreal shrink(qreal delta);
     void setShrinkMax(qreal value) {m_shrinkMax = value;}
     void attachItem(QGraphicsWidget * item);
     void detachItem(QGraphicsWidget * item);
+    QSize viewPortSize(bool );
   protected:
     virtual void resizeEvent(QGraphicsSceneResizeEvent *ev);
   private:
--- a/ginebra2/TitleItem.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/TitleItem.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -79,10 +79,13 @@
 
   void GTitleItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
   {
-    QGraphicsTextItem::mousePressEvent(event);
+    Q_UNUSED(event);
+  }
+
+  void GTitleItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
+  {
     QPointF pos = event->pos();
-    //qDebug() << "GTitleItem: received mouse press" << pos;
+    //qDebug() << "GTitleItem: received mouse release" << pos;
     emit tapped(pos);
   }
-
 } // namespace GVA
--- a/ginebra2/TitleItem.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/TitleItem.h	Fri Oct 15 17:30:59 2010 -0400
@@ -43,6 +43,7 @@
 
       protected:
         virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+        virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
 
       public Q_SLOTS:
         void setText(const QString & text);
--- a/ginebra2/TitleUrlContainerSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/TitleUrlContainerSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -34,8 +34,8 @@
 
 #include "ChromeEffect.h"
 
-#define BACKGROUND_GRADIENT_START "#232323"
-#define BACKGROUND_GRADIENT_END "#000000"
+#define BACKGROUND_GRADIENT_START "#000000"
+#define BACKGROUND_GRADIENT_END "#333333"
 
 #include <QDebug>
 
@@ -49,6 +49,7 @@
 : NativeChromeItem(snippet, parent)
 , m_chrome(chrome)
 {
+    setObjectName("TitleUrl");
     setProperties();    
     // Create the view port widget
     m_viewPort = new QGraphicsWidget(this);
@@ -58,21 +59,24 @@
     m_urlTileWidget = new GUrlSearchItem(snippet, chrome, m_viewPort); 
 
     QPixmap dividerPixmap;
-    dividerPixmap.load(":/chrome/bedrockchrome/urlsearch.snippet/icons/URL_search_divider.png", "PNG");
+    dividerPixmap.load(":/urlsearch/URL_search_divider.png", "PNG");
     m_dividerImage = new QGraphicsPixmapItem(dividerPixmap, m_viewPort);
 
     QAction * backAction = new QAction(this);
     connect(backAction, SIGNAL(triggered()), m_chrome, SIGNAL(goToBackground()));
+	backAction->setObjectName("BackAction");
 
-    m_backStepButton = new ActionButton(snippet, m_viewPort);
+    m_backStepButton = new ActionButton(snippet, "BackStep", m_viewPort);
     m_backStepButton->setAction(backAction);
     m_backStepButton->setActiveOnPress(true);
-    m_backStepButton->addIcon(":/chrome/bedrockchrome/urlsearch.snippet/icons/backstep.png", QIcon::Normal);
-    m_backStepButton->addIcon(":/chrome/bedrockchrome/urlsearch.snippet/icons/backstep_pressed.png", QIcon::Active);
+    //m_backStepButton->addIcon(":/urlsearch/backstep.png", QIcon::Normal);
+    m_backStepButton->addIcon(":/urlsearch/backstep_no_bg.png", QIcon::Normal);
+    m_backStepButton->addIcon(":/urlsearch/backstep_pressed.png", QIcon::Active);
 
     // Monitor resize events.
     safe_connect(m_chrome->renderer(), SIGNAL(chromeResized()), this, SLOT(onChromeResize()));
     safe_connect(m_urlTileWidget, SIGNAL(changeEditMode(bool)), this, SLOT(changeLayout(bool)));
+    safe_connect(m_urlTileWidget, SIGNAL(contextEvent(bool)), this, SIGNAL(contextEvent(bool)));
 }
 
 TitleUrlContainerItem::~TitleUrlContainerItem()
@@ -80,49 +84,66 @@
 
 }
 
-void TitleUrlContainerItem::setProperties() {
+void TitleUrlContainerItem::cut()
+{
+    m_urlTileWidget->cut();
+}
+
+void TitleUrlContainerItem::copy()
+{
+    m_urlTileWidget->copy();
+}
 
-  m_pen.setWidth(1);
-  m_pen.setBrush(QBrush(QColor(Qt::black)));
+void TitleUrlContainerItem::paste()
+{
+    m_urlTileWidget->paste();
+}
 
+void TitleUrlContainerItem::setContextMenuStatus(bool on)
+{ 
+    m_urlTileWidget->setContextMenuStatus(on);
+}
+
+void TitleUrlContainerItem::setProperties() {
   m_grad.setColorAt(0, BACKGROUND_GRADIENT_START);
   m_grad.setColorAt(1, BACKGROUND_GRADIENT_END);
 }
 
-void TitleUrlContainerItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
-{
+void TitleUrlContainerItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget){
   Q_UNUSED(option)
   Q_UNUSED(widget)
 
   painter->save();
- 
+
+  qreal bounding_x = boundingRect().x();
+  qreal bounding_y = boundingRect().y();
+  qreal bounding_width = boundingRect().width();
+  qreal bounding_height = boundingRect().height();
+
+
+  // background
   painter->setRenderHint(QPainter::Antialiasing);
-  painter->setPen(m_pen);
-  if (snippet()->enabled()) {
-      painter->fillRect(boundingRect(), QBrush(m_grad));
-  }
-  else {
-      painter->fillRect(boundingRect(), QColor(Qt::gray));
-      painter->setOpacity(ChromeEffect::disabledOpacity);
-      painter->fillRect(boundingRect(), ChromeEffect::disabledColor);
-  }
-  
+  painter->setPen(Qt::NoPen);
+  m_grad.setStart(bounding_x, bounding_y + bounding_height);
+  m_grad.setFinalStop(bounding_x, bounding_y);
+  painter->fillRect(boundingRect(), QBrush(m_grad));
   // top border
   painter->setPen(QPen(QColor(53,53,53)));
-  painter->drawLine(boundingRect().x(), boundingRect().y(), boundingRect().x() + boundingRect().width(), boundingRect().y());
+  painter->drawLine(bounding_x, bounding_y, bounding_x + bounding_width, bounding_y);
   // bottom border
   painter->setPen(QPen(QColor(76,76,78)));
-  painter->drawLine(boundingRect().x(), boundingRect().y() + boundingRect().height(), boundingRect().x() + boundingRect().width(), boundingRect().y() + boundingRect().height());
+  painter->drawLine(bounding_x, bounding_y + bounding_height, bounding_x + bounding_width, bounding_y + bounding_height);
   // right border
   painter->setPen(QPen(QColor(0,0,0)));
-  painter->drawLine(boundingRect().x() + boundingRect().width(), boundingRect().y(), boundingRect().x() + boundingRect().width(), boundingRect().y() + boundingRect().height());
+  painter->drawLine(bounding_x + bounding_width, bounding_y, bounding_x + bounding_width, bounding_y + bounding_height);
   // left border
-  painter->setPen(m_pen);
-  QLinearGradient grad = QLinearGradient();
+  painter->setPen(Qt::NoPen);
+  QLinearGradient grad = QLinearGradient(bounding_x, bounding_y, bounding_x, bounding_y + bounding_height);
   grad.setColorAt(0, QColor(41,41,41));
   grad.setColorAt(0.5, QColor(83,83,84));
   grad.setColorAt(1, QColor(2,2,2));
-  painter->fillRect(QRect(boundingRect().x(), boundingRect().y(), 1, boundingRect().height()), QBrush(grad));
+  painter->setBrush(QBrush(grad));
+  painter->drawLine(bounding_x, bounding_y, bounding_x, bounding_y + bounding_height);
   
   painter->restore();
   
@@ -136,8 +157,7 @@
     QGraphicsWidget::resize(g.width(), g.height());
 }
 
-void TitleUrlContainerItem::resizeEvent(QGraphicsSceneResizeEvent * event)
-{
+void TitleUrlContainerItem::resizeEvent(QGraphicsSceneResizeEvent * event){
     QSizeF size = event->newSize();
 
     qreal width = size.width();
@@ -151,9 +171,9 @@
 
     m_backStepButton->setGeometry(
                 width - ICONWIDTH, 
-                (height - ICONHEIGHT)/2,
+                0,
                 ICONWIDTH,
-                ICONHEIGHT);
+                height);
 
     // When we first get resize event, the widget is not yet set to visible by
     // Ginebra. If the widget is not visible and for later resize events, if back-step
@@ -215,8 +235,9 @@
 TitleUrlContainerSnippet * TitleUrlContainerSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element)
 {
     TitleUrlContainerSnippet * that = new TitleUrlContainerSnippet( elementId, chrome, 0, element );
-    that->setChromeWidget( new TitleUrlContainerItem(that, chrome));
-
+    TitleUrlContainerItem * titleUrlContainerItem = new TitleUrlContainerItem(that, chrome);
+    safe_connect(titleUrlContainerItem, SIGNAL(contextEvent(bool)), that, SLOT(sendContextMenuEvent(bool)));
+    that->setChromeWidget(titleUrlContainerItem);
     return that;
 }
 
@@ -228,6 +249,11 @@
     return urlContainer->url();
 }
 
+void TitleUrlContainerSnippet::sendContextMenuEvent(bool isContentSelected)
+{
+    emit contextEvent(isContentSelected, elementId());     
+}
+
 } // end of namespace GVA
 
 
--- a/ginebra2/TitleUrlContainerSnippet.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/TitleUrlContainerSnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -24,6 +24,7 @@
 #include <QtGui>
 #include "ChromeSnippet.h"
 #include "NativeChromeItem.h"
+#include "UrlSearchSnippet.h"
 
 namespace GVA {
 
@@ -45,6 +46,11 @@
         
         /// The URL of the web page.
         QString url() const;
+        void cut();
+        void copy();
+        void paste();
+        void setContextMenuStatus(bool on);
+        void setFocusForEditor() { m_urlTileWidget->setFocusForEditor(); }
 
     protected:
         virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
@@ -53,6 +59,9 @@
     private Q_SLOTS:
         void onChromeResize();
         void changeLayout(bool editMode);
+        
+    Q_SIGNALS:
+        void contextEvent(bool);
 
     private:
         void setProperties();
@@ -64,7 +73,6 @@
         GUrlSearchItem * m_urlTileWidget;
         QGraphicsPixmapItem * m_dividerImage;
         // painting support
-        QPen m_pen;
         QLinearGradient m_grad;
 };
 
@@ -86,6 +94,22 @@
         /// The URL of the web page.
         QString url() const;
         Q_PROPERTY(QString url READ url)
+
+    Q_SIGNALS:
+          void contextEvent(bool isContentSelected, QString snippetId);
+
+    public slots:
+        void cut() { titleUrlContainerItem()->cut(); }
+        void copy() { titleUrlContainerItem()->copy(); }
+        void paste(){ titleUrlContainerItem()->paste(); }
+        bool editable() { return true; }
+        bool useNativeCopyPasteMenu() { return true; }
+        void sendContextMenuEvent(bool isContentSelected);
+        void setContextMenuStatus(bool on) { titleUrlContainerItem()->setContextMenuStatus(on); }
+        void grabFocus() { titleUrlContainerItem()->setFocusForEditor(); }
+
+    private:
+        TitleUrlContainerItem * titleUrlContainerItem() { return qobject_cast<TitleUrlContainerItem*> (widget());} 
 };
 
 } // end of namespace GVA
--- a/ginebra2/Toolbar.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/Toolbar.h	Fri Oct 15 17:30:59 2010 -0400
@@ -41,6 +41,8 @@
 
       CONTENT_VIEW_ACTION_BACK,
       CONTENT_VIEW_ACTION_ZOOM,
+      CONTENT_VIEW_ACTION_ZOOM_IN,
+      CONTENT_VIEW_ACTION_ZOOM_OUT,
       CONTENT_VIEW_ACTION_MOSTVISITED,
       CONTENT_VIEW_ACTION_MENU,
       CONTENT_VIEW_ACTION_TOGGLETB,
@@ -82,11 +84,10 @@
        QString id;
   };
 
-#define TOOLBAR_BUTTON_PATH ":/chrome/bedrockchrome/toolbar.snippet/icons/"
-#define TOOLBAR_FULL_TB_TOGGLE_ICON  TOOLBAR_BUTTON_PATH  "icon_toggle_fullTB.png"
-#define TOOLBAR_FULL_TB_SELECTED_TOGGLE_ICON TOOLBAR_BUTTON_PATH  "icon_toggle_fullTB_pressed.png"
-#define TOOLBAR_PARTIAL_TB_TOGGLE_ICON  TOOLBAR_BUTTON_PATH "icon_toggle_partialTB.png"
-#define TOOLBAR_PARTIAL_TB_SELECTED_TOGGLE_ICON  TOOLBAR_BUTTON_PATH "icon_toggle_partialTB_pressed.png"
+#define TOOLBAR_FULL_TB_TOGGLE_ICON  ":/toolbar/icon_toggle_fullTB.png"
+#define TOOLBAR_FULL_TB_SELECTED_TOGGLE_ICON  ":/toolbar/icon_toggle_fullTB_pressed.png"
+#define TOOLBAR_PARTIAL_TB_TOGGLE_ICON  ":/toolbar/icon_toggle_partialTB.png"
+#define TOOLBAR_PARTIAL_TB_SELECTED_TOGGLE_ICON  ":/toolbar/icon_toggle_partialTB_pressed.png"
 
 
 
@@ -108,11 +109,13 @@
 #define SETTINGS_TOOLBAR_FEEDBACK "giveFeedback"
 
 #define CONTENT_TOOLBAR_NUM_BUTTONS 3
-#define CONTENT_TOTOLBAR_BACK "Back"
-#define CONTENT_TOTOLBAR_ZOOM "zoom"
-#define CONTENT_TOTOLBAR_MENU "menu"
-#define CONTENT_TOTOLBAR_MOSTVISITED "mostvisited"
-#define CONTENT_TOTOLBAR_TOGGLETB "toggletb"
+#define CONTENT_TOOLBAR_BACK "Back"
+#define CONTENT_TOOLBAR_ZOOM "zoom"
+#define CONTENT_TOOLBAR_ZOOM_IN "zoomin"
+#define CONTENT_TOOLBAR_ZOOM_OUT "zoomout"
+#define CONTENT_TOOLBAR_MENU "menu"
+#define CONTENT_TOOLBAR_MOSTVISITED "mostvisited"
+#define CONTENT_TOOLBAR_TOGGLETB "toggletb"
 
 #define TOOLBAR_WEB_VIEW  "WebView"
 #define TOOLBAR_WINDOWS_VIEW  "WindowView"
--- a/ginebra2/ToolbarChromeItem.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ToolbarChromeItem.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -27,38 +27,52 @@
 
 #include <QDebug>
 
-#define TOOLBAR_BG_OPACITY 0.75
+#if !defined(Q_WS_MAEMO_5) && !defined(BROWSER_LAYOUT_TENONE)
 #define TOOLBAR_GRADIENT_START "#2E3B57"
 #define TOOLBAR_GRADIENT_END "#44587D"
+#endif
+
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+#define TOOLBAR_BG_OPACITY 1
+#else
+#define TOOLBAR_BG_OPACITY 0.75
+#endif
 #define TOOLBAR_LEFTCORNER_ITEM 0
 
 namespace GVA {
 
   ToolbarChromeItem::ToolbarChromeItem(ChromeSnippet* snippet, QGraphicsItem* parent)
     : ChromeItem(NULL, parent),
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+      m_cornerBackgroundPixmap(""),
+#else
       m_partialbg(NULL),
+#endif
       m_opacity(TOOLBAR_BG_OPACITY)
   {
       setSnippet(snippet);
   }
 
-  ToolbarChromeItem::~ToolbarChromeItem()
-  {
+  ToolbarChromeItem::~ToolbarChromeItem() {
+
+#if !defined(Q_WS_MAEMO_5) && !defined(BROWSER_LAYOUT_TENONE)
     if (m_partialbg) {
       delete m_partialbg;
     }
+#endif
   }
 
-  void ToolbarChromeItem::resizeEvent(QGraphicsSceneResizeEvent * ev)
-  {
+  void ToolbarChromeItem::resizeEvent(QGraphicsSceneResizeEvent * ev) {
+
     Q_UNUSED(ev)
 
+#if !defined(Q_WS_MAEMO_5) && !defined(BROWSER_LAYOUT_TENONE)
     addPartialbg();
-
+#endif
   }
 
-  void ToolbarChromeItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget)
-  {
+  void ToolbarChromeItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget) {
+
     Q_UNUSED(opt)
     Q_UNUSED(widget)
 
@@ -69,17 +83,21 @@
     painter->setPen(m_pen);
     painter->setOpacity(m_opacity);
 
+    //qDebug() << __PRETTY_FUNCTION__ << boundingRect();
 
-//    qDebug() << __PRETTY_FUNCTION__ << boundingRect();
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+    paintCornerBackgrounds(painter);
+#else
     painter->fillPath(*m_partialbg, QBrush(m_grad));
     painter->drawPath(*m_partialbg);
+#endif
 
     // restore painter
     painter->restore();
 
     if(!isEnabled()) {
         // Disabled, apply whitewash.
-        ChromeEffect::paintDisabledRect(painter, opt->exposedRect);
+        //ChromeEffect::paintDisabledRect(painter, opt->exposedRect);
     }
   }
 
@@ -88,11 +106,35 @@
     m_pen.setWidth(m_borderWidth);
     m_pen.setBrush(QBrush(m_borderColor));
 
+#if !defined(Q_WS_MAEMO_5) && !defined(BROWSER_LAYOUT_TENONE)
     m_grad.setColorAt(0, TOOLBAR_GRADIENT_START);
     m_grad.setColorAt(1, TOOLBAR_GRADIENT_END);
+#endif
+  }
+
+#if defined(Q_WS_MAEMO_5) || defined(BROWSER_LAYOUT_TENONE)
+  void ToolbarChromeItem::paintCornerBackgrounds(QPainter *painter) {
+
+    WebChromeContainerSnippet * s = static_cast<WebChromeContainerSnippet*>(m_snippet);
+    if(!s->layout()->itemAt(TOOLBAR_LEFTCORNER_ITEM))
+        return;
+    QRectF rc = s->layout()->itemAt(TOOLBAR_LEFTCORNER_ITEM)->geometry();
+
+    // Left corner background
+    painter->drawPixmap(0, 0, m_cornerBackgroundPixmap);
+
+    // Right Corner background
+    qreal x = boundingRect().width()- m_cornerBackgroundPixmap.width();
+
+    painter->drawPixmap(x, 0, m_cornerBackgroundPixmap);
+  }
+
+  void ToolbarChromeItem::addCornerBackground(){
+      
+      m_cornerBackgroundPixmap = QPixmap(":/toolbar/circle_bg.png");
 
   }
-
+#else
   void ToolbarChromeItem::addPartialbg() {
 
     WebChromeContainerSnippet * s = static_cast<WebChromeContainerSnippet*>(m_snippet);
@@ -115,6 +157,7 @@
 
     m_partialbg->addEllipse(r);
   }
+#endif
 
   void ToolbarChromeItem::setSnippet(ChromeSnippet* snippet) {
 
--- a/ginebra2/ToolbarChromeItem.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ToolbarChromeItem.h	Fri Oct 15 17:30:59 2010 -0400
@@ -28,7 +28,7 @@
 
 namespace GVA {
 
-
+#ifndef  Q_WS_MAEMO_5
   class ToolbarChromeItem : public ChromeItem
   {
     Q_OBJECT
@@ -38,12 +38,18 @@
     virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget);
     virtual void setSnippet(ChromeSnippet* snippet);
     QPen pen() { return m_pen;}
+#ifdef BROWSER_LAYOUT_TENONE
+    void paintCornerBackgrounds(QPainter *painter);
+    void addCornerBackground();
+    void removeCornerBackground() { m_cornerBackgroundPixmap = QPixmap("");}
+#else
     QLinearGradient grad() { return m_grad;}
-    qreal opacity() { return m_opacity;}
-    void setOpacity(qreal opacity) {m_opacity = opacity;}
     QPainterPath* partialbg() { return m_partialbg;}
     void removePartialbg() { delete m_partialbg; m_partialbg = NULL;}
     void addPartialbg() ;
+#endif
+    qreal opacity() { return m_opacity;}
+    void setOpacity(qreal opacity) {m_opacity = opacity;}
 
   protected:
     virtual void resizeEvent(QGraphicsSceneResizeEvent * ev);
@@ -51,16 +57,50 @@
   private:
     void setProperties();
 
+#ifdef BROWSER_LAYOUT_TENONE
+    QPixmap m_cornerBackgroundPixmap;
+#else
     QPainterPath* m_partialbg;
+    QLinearGradient m_grad;
+#endif
+
     QPen m_pen;
-    QLinearGradient m_grad;
     qreal m_opacity;
     QColor m_borderColor;
     int m_padding;
     int m_borderWidth;
 
   };
+#else  
+  class ToolbarChromeItem : public ChromeItem
+  {
+    Q_OBJECT
+  public:
+    ToolbarChromeItem(ChromeSnippet* snippet, QGraphicsItem* parent = 0);
+    virtual ~ToolbarChromeItem();
+    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget);
+    virtual void setSnippet(ChromeSnippet* snippet);
+    QPen pen() { return m_pen;}
+    qreal opacity() { return m_opacity;}
+    void setOpacity(qreal opacity) {m_opacity = opacity;}
+    void paintCornerBackgrounds(QPainter *painter);
+    void addCornerBackground();
 
+  protected:
+    virtual void resizeEvent(QGraphicsSceneResizeEvent * ev);
+
+  private:
+    void setProperties();
+
+    QPen m_pen;
+    QPixmap m_cornerBackgroundPixmap;
+    qreal m_opacity;
+    QColor m_borderColor;
+    int m_padding;
+    int m_borderWidth;
+
+  };
+#endif
 } // end of namespace GVA
 
 #endif // __GINEBRA_TOOLBARCHROMEITEM_H
--- a/ginebra2/UrlSearchSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/UrlSearchSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -21,7 +21,7 @@
 
 #include "UrlSearchSnippet.h"
 #include "Utilities.h"
-
+#include "UiUtil.h"
 #include "ChromeRenderer.h"
 #include "ChromeLayout.h"
 #include "ChromeWidget.h"
@@ -33,19 +33,26 @@
 #include "webpagecontroller.h"
 #include "GWebContentView.h"
 #include "WindowFlowView.h"
+#ifdef BROWSER_LAYOUT_TENONE
+#include "secureuicontroller.h"
+#endif
 
 
 #include <QWebHistoryItem>
 
 namespace GVA {
 
-#define GO_BUTTON_ICON ":/chrome/bedrockchrome/urlsearch.snippet/icons/go_btn.png"
-#define STOP_BUTTON_ICON ":/chrome/bedrockchrome/urlsearch.snippet/icons/stop_btn.png"
-#define REFRESH_BUTTON_ICON ":/chrome/bedrockchrome/urlsearch.snippet/icons/refresh_btn.png"
-#define SPECIFIC_BUTTON_ICON ":/chrome/bedrockchrome/urlsearch.snippet/icons/com.svg"
+#define GO_BUTTON_ICON ":/urlsearch/go_btn.png"
+#define STOP_BUTTON_ICON ":/urlsearch/stop_btn.png"
+#define SPECIFIC_BUTTON_ICON ":/urlsearch/com.svg"
 #define SPECIFIC_BUTTON_STRING ".com"
 #define BETWEEN_ENTRY_AND_BUTTON_SPACE 4
 
+#ifdef BROWSER_LAYOUT_TENONE
+#define URL_TITLE_IND_BUTTON_ICON ":/urlsearch/url_title_ind_btn.png"
+#define URL_TITLE_IND_SECURE_BUTTON_ICON ":/urlsearch/url_title_ind_btn_secure.png"
+#endif
+
 static const QString KBookmarkHistoryViewName = "BookmarkHistoryView";
 static const QString KBookmarkTreeViewName = "BookmarkTreeView";
 static const QString KWindowViewName = "WindowView";
@@ -74,43 +81,6 @@
 
 
     QWebElement we = m_snippet->element();
-
-    QColor textColor;
-
-    QColor backgroundColor;
-    QColor progressColor;
-
-#ifndef BROWSER_LAYOUT_TENONE
-
-    NativeChromeItem::CSSToQColor(
-            we.styleProperty("color", QWebElement::ComputedStyle),
-            textColor);
-
-    NativeChromeItem::CSSToQColor(
-            we.styleProperty("background-color", QWebElement::ComputedStyle),
-            backgroundColor);
-
-    NativeChromeItem::CSSToQColor(
-            we.styleProperty("border-top-color", QWebElement::ComputedStyle),
-            m_borderColor);
-#endif
-
-    NativeChromeItem::CSSToQColor(
-            we.styleProperty("border-bottom-color", QWebElement::ComputedStyle),
-            progressColor);
-            
-#ifdef BROWSER_LAYOUT_TENONE
-    QFont titleFont;
-    QColor titleColor;
-    textColor = QColor(Qt::black);
-    titleColor = QColor(Qt::white);
-    m_borderColor = QColor(Qt::transparent);
-    backgroundColor = QColor(Qt::transparent);
-    
-    titleFont = QFont(QApplication::font());
-    titleFont.setPointSize(9);
-    titleFont.setWeight(QFont::Bold);
-#endif
  
     QString cssPadding = we.styleProperty("padding-top", QWebElement::ComputedStyle);
     m_padding = cssPadding.remove("px").toInt();
@@ -121,47 +91,10 @@
     // Create the view port widget
     m_viewPort = new QGraphicsWidget(this);
     m_viewPort->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
-
-    // Create the url search editor
-    m_urlSearchEditor = new GProgressEditor(snippet, chrome, m_viewPort);
-    m_urlSearchEditor->setTextColor(textColor);
- #ifdef BROWSER_LAYOUT_TENONE
-    m_urlSearchEditor->setTitleFont(titleFont);
-    m_urlSearchEditor->setTitleColor(titleColor);
- #endif
-    m_urlSearchEditor->setBackgroundColor(backgroundColor);
-    m_urlSearchEditor->setProgressColor(progressColor);
-    m_urlSearchEditor->setBorderColor(m_borderColor);
-    m_urlSearchEditor->setPadding(0.1); // draw the Rounded Rect
-    m_urlSearchEditor->setInputMethodHints(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
-    m_urlSearchEditor->setSpecificButton(SPECIFIC_BUTTON_STRING, SPECIFIC_BUTTON_ICON);
-    safe_connect(m_urlSearchEditor, SIGNAL(contentsChange(int, int, int)), 
-        this, SLOT(updateLoadStateAndSuggest(int, int, int)));
-    safe_connect(m_urlSearchEditor, SIGNAL(activated()),this, SLOT(urlSearchActivatedByEnterKey()));
-    safe_connect(m_urlSearchEditor, SIGNAL(focusChanged(bool)),this, SLOT(focusChanged(bool)));
-    safe_connect(m_urlSearchEditor, SIGNAL(tapped(QPointF&)),this, SLOT(tapped(QPointF&)));
-#ifdef BROWSER_LAYOUT_TENONE
-    safe_connect(m_urlSearchEditor, SIGNAL(titleMouseEvent(QPointF&)),this, SLOT(changeToUrl(QPointF&)));
-#endif
-
-    // Create the url search button
-    m_urlSearchBtn = new ActionButton(snippet, m_viewPort);
-    QAction* urlSearchBtnAction = new QAction(this);
-    m_urlSearchBtn->setAction(urlSearchBtnAction); // FIXME: should use diff QActions
-
-    m_urlSearchBtn->setActiveOnPress(false);
-    safe_connect(urlSearchBtnAction, SIGNAL(triggered()), this, SLOT(urlSearchActivated()));
-
-    // Get the icon size
-    QIcon btnIcon(GO_BUTTON_ICON);
-    QSize defaultSize(50, 50);
-    QSize actualSize = btnIcon.actualSize(defaultSize);
-    m_iconWidth = actualSize.width();
-    m_iconHeight = actualSize.height();
     
-    // Set the right text margin to accomodate the icon inside the editor
-    m_urlSearchEditor->setRightTextMargin(m_iconWidth + BETWEEN_ENTRY_AND_BUTTON_SPACE);
-
+    createEditor();
+    createIcons();
+    
     // Update state as soon as chrome completes loading.
     safe_connect(m_chrome, SIGNAL(chromeComplete()),
             this, SLOT(onChromeComplete()));
@@ -174,7 +107,6 @@
 
  /*   safe_connect(ViewStack::getSingleton(), SIGNAL(currentViewChanged()),
             this, SLOT(viewChanged()));*/
-
 }
 
 GUrlSearchItem::~GUrlSearchItem()
@@ -182,7 +114,6 @@
 
 }
 
-//TODO: Shouldn't have to explicitly set the viewport sizes here
 
 void GUrlSearchItem::resizeEvent(QGraphicsSceneResizeEvent * event)
 {
@@ -191,26 +122,88 @@
     m_viewPortWidth  = size.width()  - m_padding * 2;
     m_viewPortHeight = size.height() - m_padding * 2;
     
-   
     m_viewPort->setGeometry(
             m_padding,
             m_padding,
             m_viewPortWidth,
             m_viewPortHeight);
+    
+    changeLayout(m_urlSearchBtn->isVisible());
+}
 
-    qreal w = m_iconWidth;
-    qreal h = m_iconHeight;
+//TODO: Shouldn't have to explicitly set the viewport sizes here
+void GUrlSearchItem::changeLayout(const bool isSearch)
+{
+    
+#ifdef BROWSER_LAYOUT_TENONE
+    qreal searchBtnWidth = (isSearch) ? m_buttonIconWidth : 0;
+    qreal titleIndBtnWidth = (m_urlTitleIndBtn->isVisible() || m_urlTitleIndSecureBtn->isVisible()) ? m_buttonIconWidth : 0;
+    
+    m_urlTitleIndBtn->setGeometry(0,
+        (m_viewPortHeight - m_buttonIconHeight)/2,
+        titleIndBtnWidth,
+        m_buttonIconHeight);
+    
+    m_urlTitleIndSecureBtn->setGeometry(0,
+        (m_viewPortHeight - m_buttonIconHeight)/2,
+        titleIndBtnWidth,
+        m_buttonIconHeight);
+    
+    // NOTE: removed padding for the x coordinate since too much separation was introduced
+    m_urlSearchBtn->setGeometry(
+        m_viewPortWidth - searchBtnWidth,
+        (m_viewPortHeight - m_buttonIconHeight)/2,
+        searchBtnWidth,
+        m_buttonIconHeight);
+
+    m_urlSearchEditor->setRightTextMargin(m_buttonIconWidth);
+    m_urlSearchEditor->setGeometry(titleIndBtnWidth,
+            0,
+            m_viewPortWidth - titleIndBtnWidth,
+            m_viewPortHeight);
+    
+#else
+    qreal searchBtnWidth = m_buttonIconWidth;
 
     m_urlSearchBtn->setGeometry(
-	    m_viewPortWidth - w - m_padding/2,
-	    (m_viewPortHeight - h)/2,
-	    w,
-	    h);
-
+        m_viewPortWidth - searchBtnWidth - m_padding/2,
+        (m_viewPortHeight - m_buttonIconHeight)/2,
+        searchBtnWidth,
+        m_buttonIconHeight);
+    
     m_urlSearchEditor->setGeometry(0,
             0,
             m_viewPortWidth,
             m_viewPortHeight);
+    
+#endif
+    
+}
+
+void GUrlSearchItem::onContextEvent(bool isContentSelected)
+{
+    // dismiss suggest snippet
+    PageSnippet * suggestSnippet = qobject_cast<PageSnippet*>(m_chrome->getSnippet("SuggestsChromeId"));
+    if (suggestSnippet) {
+        QString cmd = "searchSuggests.hideSuggests();";
+        suggestSnippet->evaluateJavaScript(cmd);
+    }
+    emit contextEvent(isContentSelected);
+}
+
+#ifdef BROWSER_LAYOUT_TENONE
+void GUrlSearchItem::layoutToEditMode(const bool editMode)
+{
+    m_urlSearchBtn->setVisible(editMode);
+    m_urlSearchEditor->changeEditorMode(editMode);
+    changeLayout(editMode);
+}
+#endif
+
+void GUrlSearchItem::urlSearchActivatedByEnterKey()
+{
+    m_urlSearchEditor->removeFocus();
+    urlSearchActivated();
 }
 
 void GUrlSearchItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
@@ -246,7 +239,9 @@
     }
 
     painter->restore();
+#ifndef BROWSER_LAYOUT_TENONE
     NativeChromeItem::paint(painter, option, widget);
+#endif
 
 }
 
@@ -254,25 +249,21 @@
 void GUrlSearchItem::changeToUrl(QPointF& pos)
 {
     ViewController * viewController = m_chrome->viewController();
-	ControllableViewBase* curView = viewController->currentView();
+    ControllableViewBase* curView = viewController->currentView();
 
-	if( curView && curView->type() == "webView" ) {
+    if( curView && curView->type() == "webView" ) {
         emit changeEditMode(true);
-        //qDebug() << "GUrlSearchItem::changeToUrl";
-        m_urlSearchEditor->changeEditorMode(true);
-        m_urlSearchBtn->show();
+        layoutToEditMode(true);
         m_urlSearchEditor->grabFocus();
         tapped(pos);
         m_urlSearchEditor->openVKB();
-	}
-
+    }
 }
 
 void GUrlSearchItem::changeToTitle()
 {
     emit changeEditMode(false);
-    m_urlSearchEditor->changeEditorMode(false);
-    m_urlSearchBtn->hide();
+    layoutToEditMode(false);
 }
 
 #endif
@@ -325,26 +316,29 @@
     safe_connect(pageController, SIGNAL(pageLoadFailed()),
             this, SLOT(setPageFailed()));
 #ifdef BROWSER_LAYOUT_TENONE
-	safe_connect(pageController, SIGNAL(titleChanged(const QString&)),
-		    this, SLOT(onTitleChange(const QString&)));
+    safe_connect(pageController, SIGNAL(titleChanged(const QString&)), this, SLOT(onTitleChange(const QString&)));
+    
+    // Check for secure URL state change to change between the url and lock indicator icons in the url title indicator button
+    safe_connect(pageController, SIGNAL(showSecureIcon(bool)),
+            this, SLOT(showSecureIcon(bool)));
 #endif
+			
     // Monitor view changes.
 
     ViewController * viewController = m_chrome->viewController();
-
-    safe_connect(viewController, SIGNAL(currentViewChanged()),
-            this, SLOT(viewChanged()));
-
+    
+    safe_connect(viewController, SIGNAL(currentViewChanged(ControllableViewBase *)),
+            this, SLOT(viewChanged(ControllableViewBase *)));
 
     GWebContentView* webView = static_cast<GWebContentView*> (m_chrome->getView("WebView"));
     safe_connect(webView, SIGNAL(contentViewMouseEvent(QEvent::Type )), this, SLOT(onContentMouseEvent(QEvent::Type )));
 
 
     setStarted();
-
+#ifndef Q_WS_MAEMO_5
     WRT::WindowFlowView* windowView = static_cast<WRT::WindowFlowView *>(m_chrome->viewController()->view("WindowView"));
     safe_connect(windowView, SIGNAL(newWindowTransitionComplete()), this, SLOT(onNewWindowTransitionComplete()));
-
+#endif
     PageSnippet * suggestSnippet = qobject_cast<PageSnippet*>(m_chrome->getSnippet("SuggestsChromeId"));
 
     // instantiate items needed to display suggest page snippet
@@ -359,9 +353,9 @@
     ViewController * viewController = m_chrome->viewController();
 
 #ifdef BROWSER_LAYOUT_TENONE
+    showSecureIcon(false);
     emit changeEditMode(false);
-    m_urlSearchBtn->show();
-    m_urlSearchEditor->changeEditorMode(true);
+    layoutToEditMode(true);
 #endif
 
     QString url = pageController->currentRequestedUrl();
@@ -393,10 +387,10 @@
 
 void GUrlSearchItem::setProgress(int percent)
 {
-	ViewController * viewController = m_chrome->viewController();
-	ControllableViewBase* curView = viewController->currentView();
-	if ( curView && curView->type() == "webView" )
-		m_urlSearchEditor->setProgress(percent);
+    ViewController * viewController = m_chrome->viewController();
+    ControllableViewBase* curView = viewController->currentView();
+    if ( curView && curView->type() == "webView" && m_urlSearchEditor )
+      m_urlSearchEditor->setProgress(percent);
 }
 
 // Wait a half-second before actually clearing the progress bar.
@@ -427,7 +421,7 @@
 {
     WebPageController * pageController = WebPageController::getSingleton();
     ViewController * viewController = m_chrome->viewController();
-	  ControllableViewBase* curView = viewController->currentView();
+    ControllableViewBase* curView = viewController->currentView();
     //qDebug() << "GUrlSearchItem::setFinished" << pageController->loadState();
     
     if (pageController->loadState() != WRT::LoadController::GotoModeEditing) {
@@ -456,20 +450,27 @@
 void GUrlSearchItem::setPageFailed()
 {
     WebPageController * pageController = WebPageController::getSingleton();
-   	LoadController * loadController = pageController->currentPage()->loadController();
+    LoadController * loadController = pageController->currentPage()->loadController();
     if( loadController->loadCanceled() && !loadController->pointOfNoReturn() )
     {     
-       setUrlText(loadController->urlText());
+        setUrlText(loadController->urlText());
     }
     else
     {
-   	   setUrlText(formattedUrl());
-   	}
+        setUrlText(formattedUrl());
+    }
+    #ifdef BROWSER_LAYOUT_TENONE
+     m_urlSearchEditor->setTitle(currentTitle());
+    #endif
 }
+
 void GUrlSearchItem::setPageCreated()
 {
     // remove slideview(100) since the new transition for the code-driven window
     //m_chrome->layout()->slideView(100);
+    #ifdef Q_WS_MAEMO_5
+     setProgress(0); // no progress bar in new window shall be left from previous windows
+    #endif
 }
 
 void GUrlSearchItem::setPageChanged()
@@ -487,7 +488,7 @@
         title = getWindowsViewTitle();
     }
     else {
-   	    title = currentTitle();
+        title = currentTitle();
     }
 
     m_urlSearchEditor->setTitle(title);
@@ -522,23 +523,40 @@
 #endif
 }
 
-void GUrlSearchItem::viewChanged()
+
+void GUrlSearchItem::viewChanged(ControllableViewBase *newView)
 {
     ViewController * viewController = m_chrome->viewController();
-    WebPageController * pageController = WebPageController::getSingleton();
+    WebPageController * pageController = WebPageController::getSingleton(); 
 
     ControllableViewBase* curView = viewController->currentView();
     GWebContentView * gView = qobject_cast<GWebContentView*> (curView);
     bool isSuperPage = gView ? gView->currentPageIsSuperPage() : false;
 
-
+#ifdef BROWSER_LAYOUT_TENONE
+    QColor bgColor;
+    QColor textColor;
+    QColor titleColor;
+#endif
+    
     // view changes to web content view
     if (curView && curView->type() == "webView" && !isSuperPage) {
         
-     
 #ifdef BROWSER_LAYOUT_TENONE
 
+        bgColor = Qt::transparent;
+        textColor = Qt::black;
+        titleColor = Qt::white;
+
+        // when going to a web page view, set the correct icon for the url title indicator button state
+        if (pageController->secureState() == 0){
+            showSecureIcon(false);
+        } else {
+            showSecureIcon(true);
+        }
+
         if (pageController->isPageLoading()) {
+
             m_urlSearchEditor->changeEditorMode(true);
             m_urlSearchBtn->show();
 #endif
@@ -572,6 +590,15 @@
         m_backFromNewWinTrans = false;
     } else {
 
+#ifdef BROWSER_LAYOUT_TENONE
+     bgColor = Qt::transparent;
+     textColor = Qt::black;
+     titleColor = Qt::white;
+
+     // when going to a view other than a web page, set the non-secure icon for the url title indicator button
+     hideIndicatorButton();
+#endif
+     
      pageController->urlTextChanged(m_urlSearchEditor->text());
      // Remove progress bar
      // incorrect values are not seen before we can update when we come back
@@ -597,19 +624,23 @@
      m_chrome->layout()->slideView(-100);
 #endif 
     }
-
+    
+#ifdef BROWSER_LAYOUT_TENONE
+    m_urlSearchEditor->setBackgroundColor(bgColor);
+    m_urlSearchEditor->setTextColor(textColor);
+    // reset the layout for secure icon
+    changeLayout(m_urlSearchBtn->isVisible());
+#endif
 }
 
 #ifdef BROWSER_LAYOUT_TENONE
 void GUrlSearchItem::onTitleChange(const QString& text)
 {
-	ViewController * viewController = m_chrome->viewController();
-	ControllableViewBase* curView = viewController->currentView();
-  if ( curView && curView->type() == "webView" ){
-
-    m_urlSearchEditor->setTitle(text);
-
-  }
+    ViewController * viewController = m_chrome->viewController();
+    ControllableViewBase* curView = viewController->currentView();
+    if ( curView && curView->type() == "webView" ){
+         m_urlSearchEditor->setTitle(text);
+    }
 }
 
 QString GUrlSearchItem::getWindowsViewTitle() {
@@ -626,41 +657,61 @@
     }
     return title;
 }
-#endif
 
-void GUrlSearchItem::urlSearchActivatedByEnterKey()
+void GUrlSearchItem::showSecureIcon(bool show)
 {
-    m_urlSearchEditor->removeFocus();
-    urlSearchActivated();
+    m_urlTitleIndBtn->setVisible(!show);
+    m_urlTitleIndSecureBtn->setVisible(show);
 }
 
+void GUrlSearchItem::hideIndicatorButton()
+{
+    m_urlTitleIndBtn->hide();
+    m_urlTitleIndSecureBtn->hide();
+}
+
+#endif
+
 void GUrlSearchItem::urlSearchActivated()
 {
     WebPageController * pageController = WebPageController::getSingleton();
-	switch (pageController->loadState()) {
-		case WRT::LoadController::GotoModeLoading:
-			pageController->currentStop();
-			++m_pendingClearCalls;
-			QTimer::singleShot(500, this, SLOT(clearProgress()));
-		break;
-		case WRT::LoadController::GotoModeEditing:
-			loadToMainWindow();
-		break;
-		case WRT::LoadController::GotoModeReloadable:
-			if (pageController->currentDocUrl() == m_urlSearchEditor->text())
-				pageController->currentReload();
-			else
-				loadToMainWindow();
-		break;
-		default:
-			qDebug() << "GUrlSearchItem::urlSearchActivated() Incorrect state";
-		break;
-	}
-	updateUrlSearchBtn();
+    switch (pageController->loadState()) {
+        case WRT::LoadController::GotoModeLoading:
+            pageController->currentStop();
+            ++m_pendingClearCalls;
+            QTimer::singleShot(500, this, SLOT(clearProgress()));
+#ifdef BROWSER_LAYOUT_TENONE
+            layoutToEditMode(false);
+#endif
+            break;
+        case WRT::LoadController::GotoModeEditing:
+            loadToMainWindow();
+            break;
+        case WRT::LoadController::GotoModeReloadable:
+            if (pageController->currentDocUrl() == m_urlSearchEditor->text())
+                pageController->currentReload();
+            else
+                loadToMainWindow();
+            break;
+        default:
+            qDebug() << "GUrlSearchItem::urlSearchActivated() Incorrect state";
+            break;
+    }
+    updateUrlSearchBtn();
 }
 
+#ifdef BROWSER_LAYOUT_TENONE
+void GUrlSearchItem::urlTitleIndBtnActivated()
+{
+    // When the url title indicator button is pressed, focus into the url text area
+    QPointF pos(0, 0);
+    changeToUrl(pos);
+}
+#endif
+
 void GUrlSearchItem::updateUrlSearchBtn()
 {
+    
     WebPageController * pageController = WebPageController::getSingleton();
     switch (pageController->loadState()) {
         case WRT::LoadController::GotoModeLoading:
@@ -671,11 +722,7 @@
             m_urlSearchBtn->addIcon(GO_BUTTON_ICON);
             break;
         case WRT::LoadController::GotoModeReloadable:
-#ifdef BROWSER_LAYOUT_TENONE
             m_urlSearchBtn->addIcon(GO_BUTTON_ICON);
-#else
-            m_urlSearchBtn->addIcon(REFRESH_BUTTON_ICON);
-#endif
             break;
         default:
             qDebug() << "GUrlSearchItem::updateUrlSearchBtn Incorrect state";
@@ -691,6 +738,109 @@
     }
 }
 
+void GUrlSearchItem::createEditor()
+{
+    QColor textColor;
+    QColor backgroundColor;
+    QColor progressColor;
+    
+    QWebElement we = m_snippet->element();
+    NativeChromeItem::CSSToQColor(
+            we.styleProperty("border-bottom-color", QWebElement::ComputedStyle),
+            progressColor);
+    
+#ifdef BROWSER_LAYOUT_TENONE
+    QFont titleFont;
+    QColor titleColor;
+    textColor = QColor(Qt::black);
+    titleColor = QColor(Qt::white);
+    m_borderColor = QColor(Qt::transparent);
+    backgroundColor = QColor(Qt::transparent);
+    
+    titleFont = QFont(QApplication::font());
+    titleFont.setPointSize(9);
+    titleFont.setWeight(QFont::Bold);
+#endif
+#ifndef BROWSER_LAYOUT_TENONE
+    NativeChromeItem::CSSToQColor(
+            we.styleProperty("color", QWebElement::ComputedStyle),
+            textColor);
+
+    NativeChromeItem::CSSToQColor(
+            we.styleProperty("background-color", QWebElement::ComputedStyle),
+            backgroundColor);
+
+    NativeChromeItem::CSSToQColor(
+            we.styleProperty("border-top-color", QWebElement::ComputedStyle),
+            m_borderColor);
+#endif
+    
+    // Create the url search editor
+    m_urlSearchEditor = new GProgressEditor(m_snippet, m_chrome, m_viewPort);
+    m_urlSearchEditor->setObjectName("UrlEditor");
+    m_urlSearchEditor->setTextColor(textColor);
+ #ifdef BROWSER_LAYOUT_TENONE
+    m_urlSearchEditor->setTitleFont(titleFont);
+    m_urlSearchEditor->setTitleColor(titleColor);
+ #endif
+    m_urlSearchEditor->setBackgroundColor(backgroundColor);
+    m_urlSearchEditor->setProgressColor(progressColor);
+    m_urlSearchEditor->setBorderColor(m_borderColor);
+    m_urlSearchEditor->setPadding(0.1); // draw the Rounded Rect
+    m_urlSearchEditor->setInputMethodHints(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
+    m_urlSearchEditor->setSpecificButton(SPECIFIC_BUTTON_STRING, SPECIFIC_BUTTON_ICON);
+    safe_connect(m_urlSearchEditor, SIGNAL(contentsChange(int, int, int)), 
+        this, SLOT(updateLoadStateAndSuggest(int, int, int)));
+    safe_connect(m_urlSearchEditor, SIGNAL(activated()),this, SLOT(urlSearchActivatedByEnterKey()));
+    safe_connect(m_urlSearchEditor, SIGNAL(focusChanged(bool)),this, SLOT(focusChanged(bool)));
+#ifndef BROWSER_LAYOUT_TENONE
+    safe_connect(m_urlSearchEditor, SIGNAL(tapped(QPointF&)),this, SLOT(tapped(QPointF&)));
+#endif    
+    safe_connect(m_urlSearchEditor, SIGNAL(contextEvent(bool)), this, SIGNAL(contextEvent(bool)));
+#ifdef BROWSER_LAYOUT_TENONE
+    safe_connect(m_urlSearchEditor, SIGNAL(titleMouseEvent(QPointF&)),this, SLOT(changeToUrl(QPointF&)));
+#endif
+}
+
+void GUrlSearchItem::createIcons()
+{
+    // Create the url search button
+    m_urlSearchBtn = new ActionButton(m_snippet, "UrlSearchButton", m_viewPort);
+    QAction* urlSearchBtnAction = new QAction(this);
+    m_urlSearchBtn->setAction(urlSearchBtnAction); // FIXME: should use diff QActions
+    m_urlSearchBtn->setActiveOnPress(false);
+    safe_connect(urlSearchBtnAction, SIGNAL(triggered()), this, SLOT(urlSearchActivated()));
+    
+#ifdef BROWSER_LAYOUT_TENONE
+    // Create the url title indicator button (NOTE: QAction created but not hooked up)
+    m_urlTitleIndBtn = new ActionButton(m_snippet, "UrlSearchIndButton", m_viewPort);
+    QAction* urlTitleIndBtnAction = new QAction(this);
+    m_urlTitleIndBtn->setAction(urlTitleIndBtnAction);
+    m_urlTitleIndBtn->addIcon(URL_TITLE_IND_BUTTON_ICON);
+    m_urlTitleIndBtn->setActiveOnPress(false);
+    safe_connect(urlTitleIndBtnAction, SIGNAL(triggered()), this, SLOT(urlTitleIndBtnActivated()));
+    
+    m_urlTitleIndSecureBtn = new ActionButton(m_snippet, "UrlSearchSecureButton", m_viewPort);
+    QAction* urlTitleIndSecureBtnAction = new QAction(this);
+    m_urlTitleIndSecureBtn->setAction(urlTitleIndSecureBtnAction);
+    m_urlTitleIndSecureBtn->addIcon(URL_TITLE_IND_SECURE_BUTTON_ICON);
+    m_urlTitleIndSecureBtn->setActiveOnPress(false);
+    safe_connect(urlTitleIndSecureBtnAction, SIGNAL(triggered()), this, SLOT(urlTitleIndBtnActivated()));
+
+#endif
+    
+    QIcon btnIcon(GO_BUTTON_ICON);
+    QSize actualSize = btnIcon.availableSizes()[0];
+    m_buttonIconWidth = actualSize.width();
+    m_buttonIconHeight = actualSize.height();
+
+#ifndef BROWSER_LAYOUT_TENONE
+    m_urlSearchEditor->setRightTextMargin(m_buttonIconWidth + BETWEEN_ENTRY_AND_BUTTON_SPACE);
+
+#endif
+
+}
+
 void GUrlSearchItem::loadToMainWindow()
 {
     QString url = m_urlSearchEditor->text();
@@ -711,7 +861,12 @@
 void GUrlSearchItem::updateLoadStateAndSuggest(int /*position*/, int charsRemoved, int charsAdded)
 {
     WebPageController * pageController = WebPageController::getSingleton();
-
+    if (url().contains('\n'))
+    {
+        urlSearchActivatedByEnterKey();
+        return;
+    }
+    
     // will get contentsChanged() signal on programmatic changes and sometimes 
     // position changes but we are only interested in user input
     if ((charsRemoved || charsAdded) && pageController->editMode()) {
@@ -721,6 +876,7 @@
             suggestSnippet->evaluateJavaScript(cmd);
         }
     }
+
 }
 
 
@@ -762,7 +918,6 @@
     }
     else {
         m_justFocusIn = false;
-
     }
 }
 
@@ -794,12 +949,15 @@
     return url.replace(" ","+");
 }
 
+
 void GUrlSearchItem::setUrlText(const QString & str) 
 {
 	ViewController * viewController = m_chrome->viewController();
 	ControllableViewBase* curView = viewController->currentView();
-  if ( curView && curView->type() == "webView" )
-	   m_urlSearchEditor->setText(WebPageController::getSingleton()->removeScheme(str));
+	if ( curView && curView->type() == "webView" ) {
+        QUrl url(str);
+	    m_urlSearchEditor->setText(WRT::UiUtil::encodeQueryItems(url, true).toString());
+	}
 }
 
 QString GUrlSearchItem::urlToBeDisplayed() 
@@ -821,10 +979,15 @@
     QString title  = pageController->currentDocTitle();
     if (title.isEmpty() ){ 
         title = pageController->currentPartialUrl();
+        if (title.isEmpty() ) {
+             // New Window, so set title as such
+            title = qtTrId("txt_browser_windows_new_window");
+        }
     }
     return title;
 }
 
+
 // GUrlSearchSnippet class
 
 
@@ -837,18 +1000,25 @@
 GUrlSearchSnippet * GUrlSearchSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element)
 {
     GUrlSearchSnippet* that = new GUrlSearchSnippet(elementId, chrome, 0, element);
-    that->setChromeWidget( new GUrlSearchItem( that, chrome ) );
+    GUrlSearchItem* urlSearchItem = new GUrlSearchItem(that, chrome);
+    safe_connect(urlSearchItem, SIGNAL(contextEvent(bool)), that, SLOT(sendContextMenuEvent(bool)));
+    that->setChromeWidget(urlSearchItem);
     return that;
 }
 
-inline GUrlSearchItem* GUrlSearchSnippet::urlSearchItem()
+void GUrlSearchSnippet::sendContextMenuEvent(bool isContentSelected)
 {
-    return static_cast<GUrlSearchItem *>(widget());
+    emit contextEvent(isContentSelected, elementId());
 }
 
-inline GUrlSearchItem const * GUrlSearchSnippet::constUrlSearchItem() const
+GUrlSearchItem* GUrlSearchSnippet::urlSearchItem()
 {
-    return static_cast<GUrlSearchItem const *>(constWidget());
+    return qobject_cast<GUrlSearchItem *>(widget());
+}
+
+GUrlSearchItem const * GUrlSearchSnippet::constUrlSearchItem() const
+{
+    return qobject_cast<GUrlSearchItem const *>(constWidget());
 }
 
 QString GUrlSearchSnippet::url() const
@@ -861,4 +1031,19 @@
     urlSearchItem()->setUrl(url);
 }
 
+void GUrlSearchSnippet::cut()
+{
+    urlSearchItem()->cut();
+}
+
+void GUrlSearchSnippet::copy()
+{
+    urlSearchItem()->copy();
+}
+
+void GUrlSearchSnippet::paste()
+{
+    urlSearchItem()->paste();
+}
+
 } // namespace GVA
--- a/ginebra2/UrlSearchSnippet.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/UrlSearchSnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -39,32 +39,43 @@
     QString url() const { return m_urlSearchEditor->text();}
     void setUrl(const QString &url) {m_urlSearchEditor->setText(url);}
 
+    void cut() { m_urlSearchEditor->cut(); }
+    void copy() { m_urlSearchEditor->copy(); }
+    void paste() { m_urlSearchEditor->paste(); }
+    void setContextMenuStatus(bool on) { m_urlSearchEditor->setContextMenuStatus(on); }
+    void setFocusForEditor() { m_urlSearchEditor->setFocusForEditor(); }
+
 Q_SIGNALS:
     void changeEditMode(bool);
+    void contextEvent(bool);
+
+private slots:
+    void onContextEvent(bool isContentSelected);
 
 protected:
     virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
     virtual void resizeEvent(QGraphicsSceneResizeEvent * event);
 
 private:
+    void createEditor();
+    void createIcons();
     void loadToMainWindow();
     void updateUrlSearchBtn();
     QString formattedUrl() const; 
+    void changeLoadState(bool editing=true);
+    QString urlToBeDisplayed();
+    QString currentTitle();
+    void changeLayout(const bool isSearch);
 #ifdef BROWSER_LAYOUT_TENONE
     void changeToTitle();
     QString getWindowsViewTitle();
+    void layoutToEditMode(const bool editMode);
+    void hideIndicatorButton();
 #endif
-    void changeLoadState(bool editing=true);
-    QString urlToBeDisplayed();
-    QString currentTitle();
 
 private slots:
 
     void onContentMouseEvent(QEvent::Type type);
-#ifdef BROWSER_LAYOUT_TENONE
-    void changeToUrl(QPointF&);
-    void onTitleChange(const QString&);
-#endif
     void setUrlText(const QString &);
     void onChromeComplete();
     void setStarted();
@@ -74,7 +85,7 @@
     void setPageChanged();
 	void setPageFailed();
     void clearProgress();
-    void viewChanged();
+    void viewChanged(ControllableViewBase *newView);
     void urlSearchActivatedByEnterKey();
     void urlSearchActivated();
     void focusChanged(bool focusIn);
@@ -82,6 +93,13 @@
     void updateLoadStateAndSuggest(int /*position*/, int charsRemoved, int charsAdded);
     void onNewWindowTransitionComplete();
     void tapped(QPointF&);
+    
+#ifdef BROWSER_LAYOUT_TENONE
+    void changeToUrl(QPointF&);
+    void onTitleChange(const QString&);
+    void showSecureIcon(bool show);
+    void urlTitleIndBtnActivated();
+#endif
 
 
 private:
@@ -97,13 +115,17 @@
     // ui components
     QGraphicsWidget * m_viewPort;
     ActionButton * m_urlSearchBtn;
+#ifdef BROWSER_LAYOUT_TENONE
+    ActionButton * m_urlTitleIndBtn;
+    ActionButton * m_urlTitleIndSecureBtn;
+#endif
     GProgressEditor * m_urlSearchEditor;
     
 
     // variables
     int m_pendingClearCalls;
-    qreal m_iconWidth;
-    qreal m_iconHeight;
+    qreal m_buttonIconWidth;
+    qreal m_buttonIconHeight;
     bool m_backFromNewWinTrans;
     bool m_justFocusIn;
 };
@@ -121,7 +143,18 @@
   void setUrl(const QString &url);
   Q_PROPERTY(QString url READ url WRITE setUrl)
 
-//public slots:
+Q_SIGNALS:
+  void contextEvent(bool isContentSelected, QString snippetId);
+
+public slots:
+  void cut();
+  void copy();
+  void paste();
+  bool editable() { return true; }
+  bool useNativeCopyPasteMenu() { return true; }
+  void sendContextMenuEvent(bool isContentSelected);
+  void setContextMenuStatus(bool on) { urlSearchItem()->setContextMenuStatus(on); }
+  void grabFocus() { urlSearchItem()->setFocusForEditor(); }
 
 private:
   GUrlSearchItem *urlSearchItem();
--- a/ginebra2/ViewController.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ViewController.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -86,7 +86,7 @@
 		view->deactivate();
               }
           }
-          emit currentViewChanged();
+          emit currentViewChanged(currentView);
       }
   }
 
@@ -119,16 +119,18 @@
     }
   }
 
-  void ViewController::viewChanged() {
-      emit currentViewChanged();
-  }
-
+  
   ControllableViewBase* ViewController::currentView() {
       if (!m_viewMap.isEmpty())
           return m_current.value();
       else
           return NULL;
   }
-
+  const QString & ViewController::currentViewName() {
+     if (!m_viewMap.isEmpty())
+       return m_current.key();
+     else
+       return QString();
+   }
 }
 
--- a/ginebra2/ViewController.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ViewController.h	Fri Oct 15 17:30:59 2010 -0400
@@ -57,8 +57,7 @@
     ControllableViewBase *view(const QString &name) { return m_viewMap[name]; }
 
     ControllableViewBase *currentView();
-
-    void viewChanged();
+    const QString & currentViewName();
 
   public slots:
     // Returns the currently visible view as a javascript-usable object.
@@ -85,7 +84,8 @@
     void currentViewChanging();
 
     // Sent when the current view has changed.
-    void currentViewChanged();
+    void currentViewChanged(ControllableViewBase *newView);
+    
 
     // Not for javascript use.
     void javaScriptWindowObjectCleared(QWebPage *);
--- a/ginebra2/ViewStack.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ViewStack.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -24,7 +24,6 @@
 #include "ViewStack.h"
 #include "ViewController.h"
 #include "webpagecontroller.h"
-#include "HistoryFlowView.h"
 #include "WindowFlowView.h"
 #include "ChromeSnippet.h"
 
@@ -34,7 +33,6 @@
 static const QString KBookmarkTreeViewName = "BookmarkTreeView";
 static const QString KWebViewName = "WebView";
 static const QString KWindowViewName = "WindowView";
-static const QString KHistoryViewName = "HistoryView";
 static const QString KSettingsViewName = "SettingsView";
 
 
@@ -116,13 +114,15 @@
 
 void ViewStack::toWindowView()
 {
+    WRT::WindowFlowView* windowView = static_cast<WRT::WindowFlowView *>(m_viewController->view(KWindowViewName));
+    // Set the window size before windows view is activated
+    windowView->setSize( m_chrome->viewSize());
     emit(activateWindowView());
 
     ChromeSnippet* tbSnippet = m_chrome->getSnippet("WindowViewToolbarId");
     if (tbSnippet)
         tbSnippet->show();
 
-    WRT::WindowFlowView* windowView = static_cast<WRT::WindowFlowView *>(m_viewController->view(KWindowViewName));
 
     safe_connect(windowView, SIGNAL(ok(WrtBrowserContainer*)), this, SLOT(goBackFromWindowView()));
     safe_connect(windowView, SIGNAL(addPageComplete()), this, SLOT(goBackFromWindowView()));
@@ -167,6 +167,7 @@
 
     //qDebug() << "VIEW STACK:: Received creating Page" << page;
 
+#ifndef Q_WS_MAEMO_5
     if (m_viewController->currentView()->type() == "webView" ) {
         //qDebug() << "ViewStack::page: " << page << "Created In " << m_viewController->currentView()->type() ;
 
@@ -175,7 +176,7 @@
         windowView->onPageCreated(page);
         ViewStack::getSingleton()->switchView(KWindowViewName, KWebViewName);
     }
-
+#endif
 }
 
 void ViewStack::switchView(const QString &to, const QString &from) {
@@ -186,7 +187,10 @@
     if (!m_viewController) {
         return;
     }
-
+    // set required data before switching to windows view
+    if (to == KWindowViewName) {
+        toWindowView();
+    }
     if (from == KWindowViewName) {
         fromWindowView(to);
     }
@@ -203,10 +207,7 @@
         fromSettingsView(to);
     }
 
-    if (to == KWindowViewName) {
-        toWindowView();
-    }
-    else if (to == KWebViewName) {
+    if (to == KWebViewName) {
         toWebView();
     }
     else if (to == KBookmarkHistoryViewName) {
@@ -220,23 +221,6 @@
     }
 }
 
-
-void ViewStack::loadHistoryItem(int item) {
-
-    if (!m_viewController) {
-        return;
-    }
-    WRT::HistoryFlowView* historyView = static_cast<WRT::HistoryFlowView*>(m_viewController->view(KHistoryViewName));
-    //var myIndex = window.viewManager.historyView.currentHistIndex;
-    int myIndex = historyView->currentIndex();
-
-    if (myIndex != item ) {
-        //window.chrome.alert("loadFromHistory");
-        WebPageController::getSingleton()->currentSetFromHistory(item);
-        safe_connect(m_viewController,SIGNAL(loadProgess(const int)), this, SLOT(showContentView(const int)));
-    }
-}
-
 void ViewStack::goBackFromWindowView() {
     switchView(KWebViewName, KWindowViewName);
 }
--- a/ginebra2/ViewStack.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ViewStack.h	Fri Oct 15 17:30:59 2010 -0400
@@ -68,7 +68,6 @@
     void toSettingsView();
 
 private slots:
-    void loadHistoryItem(int item);
     void goBackFromWindowView();
     void goBackFromRecentUrlView();
     void goBackFromBookmarkView();
--- a/ginebra2/WebChromeItem.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/WebChromeItem.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -24,9 +24,6 @@
 #include "ChromeRenderer.h"
 #include "ChromeDOM.h"
 #include "WebChromeSnippet.h"
-#ifndef NO_QSTM_GESTURE
-#include "qstmgestureevent.h"
-#endif
 #include <QSizePolicy>
 #include <QWebHitTestResult>
 #include <QWebFrame>
@@ -35,9 +32,6 @@
 
 namespace GVA
 {
-#ifndef NO_QSTM_GESTURE
-using namespace qstmGesture;
-#endif
 WebChromeItem::WebChromeItem(ChromeWidget *chrome, const QWebElement & element, QGraphicsItem* parent) :
     ChromeItem(NULL, parent)
     , m_chrome(chrome)
@@ -47,9 +41,6 @@
     setFlags(QGraphicsItem::ItemIsFocusable);
     //Adjust the element size to match the element rectangle
     updateSizes();
-#ifndef NO_QSTM_GESTURE
-    grabGesture(QStm_Gesture::assignedType());
-#endif
     //Use QGraphicsScene cached rendering NB: This might degrade rendering quality for some animation transforms
     setCacheMode(QGraphicsItem::ItemCoordinateCache);
 }
@@ -207,21 +198,4 @@
  }
  */
 
-bool WebChromeItem::event(QEvent* event)
-{
-#ifndef NO_QSTM_GESTURE
-    if (event->type() == QEvent::Gesture) {
-        QStm_Gesture* gesture = getQStmGesture(event);
-        if (gesture) {
-            QStm_GestureType gtype = gesture->getGestureStmType();
-            if (gtype == QStmTouchGestureType || gtype == QStmReleaseGestureType) {
-                gesture->sendMouseEvents();
-                return true;
-            }
-        }
-    }
-#endif
-    return QGraphicsWidget::event(event);
-}
-
 } // endof namespace GVA
--- a/ginebra2/WebChromeItem.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/WebChromeItem.h	Fri Oct 15 17:30:59 2010 -0400
@@ -48,7 +48,6 @@
     QGraphicsScene * scene();
     ChromeRenderer * renderer();
     void grabFocus();
-    bool event(QEvent* event);
     ChromeWidget * chrome() { return m_chrome; }
     inline bool isPainting() { return m_painting; }
   public slots:
--- a/ginebra2/WebGestureHelper.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/WebGestureHelper.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -26,6 +26,20 @@
 #include "qstmgestureevent.h"
 #include "qstmfilelogger.h"
 #include "qstmuievent_if.h"
+#include "qstmgestureapi.h"
+#include "qstmstatemachine.h"
+#include "bedrockprovisioning.h"
+
+#include "wrtperftracer.h"
+#if defined(ORBIT_UI)
+#include <hbapplication.h>
+#endif
+
+
+#ifdef Q_OS_SYMBIAN
+#include <w32std.h>
+#include <coecntrl.h>
+#endif
 
 using namespace qstmGesture;
 using namespace qstmUiEventEngine;
@@ -33,28 +47,6 @@
 #define ENABLE_GESTURE_LIB 1
 
 
-WebGestureHelperEventFilter* WebGestureHelperEventFilter::m_instance = 0;
-
-WebGestureHelperEventFilter* WebGestureHelperEventFilter::instance()
-{
-    if (!m_instance) {
-        m_instance = new WebGestureHelperEventFilter();
-    }
-    return m_instance;
-}
-
-bool WebGestureHelperEventFilter::eventFilter(QObject* receiver, QEvent* event)
-{
-    QStm_Gesture* g = getQStmGesture(event);
-    if (g) {
-        g->sendMouseEvents(receiver);
-        return true;
-    }
-    return false;
-}
-
-
-
 WebGestureHelper::WebGestureHelper(QWidget* ctrl) :
                              m_ctrl(ctrl)
 {
@@ -69,7 +61,7 @@
     m_gestures = NULL;
     delete m_gestureEngine;
     QGestureRecognizer::unregisterRecognizer(m_qstmGestureType);
-    delete m_dummyRecognizer;
+    //delete m_dummyRecognizer;
 
 }
 
@@ -77,123 +69,235 @@
 void WebGestureHelper::setupGestureEngine(QWidget* ctrl)
 {
     m_gestures = m_gestureEngine->createContext(qptrdiff(ctrl));
-#if defined(_DEBUG)
-    m_gestures->setLogging(0);
-#endif
     QStm_GestureParameters& param = m_gestures->config();
-    param.setEnabled(qstmGesture::EGestureUidTap, true);
-    param[qstmGesture::EDoubleTapTimeout] = 300;
+
+    // Get settings from provisioning
+    BEDROCK_PROVISIONING::BedrockProvisioning * settings =
+        BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning();
 
-    param.setEnabled(qstmGesture::EGestureUidPan, true);
-    param[qstmGesture::EPanSpeedLow] = 0;
-    param[qstmGesture::EPanSpeedHigh] = 100;
-    param[qstmGesture::EPanDisabledWhileHovering] = false;
-    param[qstmGesture::EMoveTolerance] = 2;
+    int logEnabled = settings->valueAsInt("GesturesEnableLogging");
+    qstmEnableDebug((logEnabled != 0));
+    m_gestures->setLogging(logEnabled);
 
-    param.setEnabled(qstmGesture::EGestureUidHover, false);
-    param[qstmGesture::EHoverSpeed] = 0;
-    param[qstmGesture::EHoverDisabledWhilePanning] = false;
+    param.setEnabled(qstmGesture::EGestureUidTap, settings->valueAsInt("GesturesEnableTap") != 0);
+    param[qstmGesture::EDoubleTapTimeout] = settings->valueAsInt("GesturesDoubleTapTimeout"); // 300 7x = 400
+
+    param.setEnabled(qstmGesture::EGestureUidPan, settings->valueAsInt("GesturesEnablePan") != 0);
+    param[qstmGesture::EPanSpeedLow] = settings->valueAsInt("GesturesPanSpeedLow");
+    param[qstmGesture::EPanSpeedHigh] = settings->valueAsInt("GesturesPanSpeedHigh"); // 100 7x = 400
+    param[qstmGesture::EPanDisabledWhileHovering] = settings->valueAsInt("GesturesPanDisabledWhileHovering") != 0; // !7x
+    param[qstmGesture::EMoveTolerance] = settings->valueAsInt("GesturesMoveTolerance"); // !7x
 
-    param.setEnabled(qstmGesture::EGestureUidLeftRight,  false);
-    param.setEnabled(qstmGesture::EGestureUidUpDown,     false);
+    param.setEnabled(qstmGesture::EGestureUidHover, settings->valueAsInt("GesturesEnableHover") != 0);
+    param[qstmGesture::EHoverSpeed] = settings->valueAsInt("GesturesHoverSpeed"); // !7x
+    param[qstmGesture::EHoverDisabledWhilePanning] = settings->valueAsInt("GesturesHoverDisabledWhilePanning") != 0; // !7x
 
-    param.setEnabled(qstmGesture::EGestureUidFlick,      true);
-    param[qstmGesture::EFlickSpeed] = 25; /*param[stmGesture::EPanSpeedHigh];*/
-
-    param.setEnabled(qstmGesture::EGestureUidRelease,    true);
-    param.setEnabled(qstmGesture::EGestureUidTouch,      true);
+    param.setEnabled(qstmGesture::EGestureUidLeftRight,  settings->valueAsInt("GesturesEnableLeftRight") != 0);
+    param.setEnabled(qstmGesture::EGestureUidUpDown,     settings->valueAsInt("GesturesEnableUpDown") != 0);
+    param[qstmGesture::EAxisLockThreshold] = (int)(100 * settings->value("GesturesAxisLockThreshold").toDouble());
+    
+    param.setEnabled(qstmGesture::EGestureUidFlick,      settings->valueAsInt("GesturesEnableFlick") != 0);
+    param[qstmGesture::EFlickSpeed] = settings->valueAsInt("GesturesFlickSpeed", 25); /*param[stmGesture::EPanSpeedHigh];*/ // !7x
 
-    param.setEnabled(qstmGesture::EGestureUidEdgeScroll, false);
-    param[qstmGesture::EEdgeScrollRange] = 20;
+    param.setEnabled(qstmGesture::EGestureUidRelease,    settings->valueAsInt("GesturesEnableRelease") != 0);
+    param.setEnabled(qstmGesture::EGestureUidTouch,      settings->valueAsInt("GesturesEnableTouch") != 0);
 
-    param.setEnabled(qstmGesture::EGestureUidCornerZoom, false);
-    param[qstmGesture::EZoomCornerSize] = 7;
+    param.setEnabled(qstmGesture::EGestureUidEdgeScroll, settings->valueAsInt("GesturesEnableEdgeScroll") != 0);
+    param[qstmGesture::EEdgeScrollRange] = settings->valueAsInt("GesturesEdgeScrollRange"); // !7x
 
-    param.setEnabled(qstmGesture::EGestureUidPinch, true);
-    param.setEnabled(qstmGesture::EGestureUidLongPress, true);
+    param.setEnabled(qstmGesture::EGestureUidCornerZoom, settings->valueAsInt("GesturesEnableCornerZoom") != 0);
+    param[qstmGesture::EZoomCornerSize] = settings->valueAsInt("GesturesZoomCornerSize"); // 7 !7x
 
-    param.setEnabled(qstmGesture::EGestureUidUnknown, true);
+    param.setEnabled(qstmGesture::EGestureUidPinch, settings->valueAsInt("GesturesEnablePinch") != 0);
+    param.setEnabled(qstmGesture::EGestureUidLongPress, settings->valueAsInt("GesturesEnableLongPress") != 0);
 
+    param.setEnabled(qstmGesture::EGestureUidUnknown, settings->valueAsInt("GesturesEnableUnknown") != 0);
+    
     QStm_GestureArea& touchArea = *param.area(qstmGesture::ETouchArea);
     QStm_GestureArea& tTimeArea = *param.area(qstmGesture::ETouchTimeArea);
     QStm_GestureArea& holdArea  = *param.area(qstmGesture::EHoldArea);
 
-    touchArea.m_shape    = QStm_GestureArea::QStm_Shape(1);
-    touchArea.m_timeout  = 150;
-    touchArea.m_size     = QSize(7, 0);
+    touchArea.m_shape    = QStm_GestureArea::QStm_Shape(settings->valueAsInt("GesturesTouchAreaShape"));
+    touchArea.m_timeout  = settings->valueAsInt("GesturesTouchAreaTimeout"); // 150 7x = 0
+    touchArea.m_size     = QSize(settings->valueAsInt("GesturesTouchAreaWidth"), 
+                                 settings->valueAsInt("GesturesTouchAreaHeight")); // 7 7x = 4
 
-    tTimeArea.m_shape    = QStm_GestureArea::QStm_Shape(1);
-    tTimeArea.m_timeout  = 150;
-    tTimeArea.m_size     = QSize(7, 0);
+    tTimeArea.m_shape    = QStm_GestureArea::QStm_Shape(settings->valueAsInt("GesturesTimeAreaShape"));
+    tTimeArea.m_timeout  = settings->valueAsInt("GesturesTimeAreaTimeout"); // 150 7x = 200
+    tTimeArea.m_size     = QSize(settings->valueAsInt("GesturesTimeAreaWidth"),
+                                 settings->valueAsInt("GesturesTimeAreaHeight")); // 7 7x = 4
 
-    holdArea.m_shape    = QStm_GestureArea::QStm_Shape(1);
-    holdArea.m_timeout  = 1500;
-    holdArea.m_size     = QSize(7, 0);
+    holdArea.m_shape    = QStm_GestureArea::QStm_Shape(settings->valueAsInt("GesturesHoldAreaShape"));
+    holdArea.m_timeout  = settings->valueAsInt("GesturesHoldAreaTimeout"); // 7x = 1500
+    holdArea.m_size     = QSize(settings->valueAsInt("GesturesHoldAreaWidth"), 
+                                settings->valueAsInt("GesturesHoldAreaHeight")); // 7 7x = 4
 
-    param[ qstmGesture::ESuppressTimeout     ] = 0;
-    param[ qstmGesture::EMoveSuppressTimeout ] = 0;
-    param[ qstmGesture::ECapacitiveUpUsed    ] = false;
-    param[ qstmGesture::EAdjustYPos          ] = false;
-    param[ qstmGesture::EEnableFiltering     ] = 1;
-    param[ qstmGesture::EWServMessageInterception ] = false;
-
+    param[ qstmGesture::ESuppressTimeout     ] = settings->valueAsInt("GesturesSuppressTimeout");
+    param[ qstmGesture::EMoveSuppressTimeout ] = settings->valueAsInt("GesturesMoveSuppressTimeout");
+    param[ qstmGesture::ECapacitiveUpUsed    ] = settings->valueAsInt("GesturesCapacitiveUpUsed") != 0;
+    param[ qstmGesture::EAdjustYPos          ] = settings->valueAsInt("GesturesAdjustYPos") != 0; // 7x = true ifndef WINSCW
+    param[ qstmGesture::EEnableFiltering     ] = settings->valueAsInt("GesturesEnableFiltering") != 0; // 7x = true
+    param[ qstmGesture::EWServMessageInterception ] = (settings->valueAsInt("GesturesWServMessageInterception") != 0);
+    // Wonder Twin powers, Activate!  Form of an ice "pan"!  Shape of a "pinch"-nose pug! 
     m_gestures->activate(ctrl);
 
     /*
      * Only one instance of dummy recognizer is needed.
      * First context will have none-null pointer to it.
      */
-    if (QStm_Gesture::assignedType() == Qt::CustomGesture) {
+    //if (QStm_Gesture::assignedType() == Qt::CustomGesture) {
         m_dummyRecognizer = new QStm_QtDummyGestureRecognizer(m_gestures);
         m_gestures->addListener(m_dummyRecognizer);
         m_qstmGestureType = QGestureRecognizer::registerRecognizer(m_dummyRecognizer);
         QStm_Gesture::setAssignedGestureType(m_qstmGestureType);
+    //}
+    //QObject::connect(m_gestures, SIGNAL(uiEvent(const qstmUiEventEngine::QStm_UiEventIf&)), 
+    //        m_dummyRecognizer, SLOT(handleQStmUiEvent(const qstmUiEventEngine::QStm_UiEventIf&)));
+    
+    // HACK!!! Disable this if you need Double Tap gesture. !!!
+    //m_gestures->enableDblClick(true);
     }
+
+
+bool WebGestureHelper::shouldHandleGesture()
+{
+    bool shouldHandle = (BedrockSettings->value("EnableGestures").toInt() != 0);
+#ifdef Q_OS_SYMBIAN    
+    shouldHandle = !CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog();
+#endif    
+
+    QWidget* modal = QApplication::activeModalWidget();
+    shouldHandle =  shouldHandle && (modal == NULL);
+    return shouldHandle;
 }
 
 
+
 bool  WebGestureHelper::symbianEventFilter(const QSymbianEvent *event)
 {
     return m_gestures->handleSymbianPlatformEvent(event);
 
 }
 
-
 bool WebGestureHelper::x11EventFilter (XEvent* event)
 {
     return m_gestures->handleX11PlatformEvent(event);
 }
 
+bool WebGestureHelper::winEventFilter(void* event)
+{
+    return m_gestures->handleWinPlatformEvent(event);
+}
 
-BrowserApp::BrowserApp(int argc, char** argv) : QApplication(argc, argv)
+bool WebGestureHelper::isFilteredByGestureEngine()
 {
+    bool wasFiltered = false;
+    
+    QStm_GestureEngineApi* gestEng = gestureEngine();
+    if (gestEng) {
+        qstmUiEventEngine::QStm_StateMachine* sm = gestEng->getStateMachine();
+        if (sm) {
+            //for (int i = 0; i < qstmUiEventEngine::KMaxNumberOfPointers && !wasFiltered; i++) {
+                wasFiltered = sm->wasLastMessageFiltered();
+            //}
+        }
+    }
+    return wasFiltered; 
+}
+
+
+#if defined(ORBIT_UI)
+BrowserApp::BrowserApp(QS60MainApplicationFactory appfactory, int & argc, char** argv) : ParentApp(appfactory, argc, argv)
+{
+    m_gestureHelper = 0;
+    m_mainWindow = 0;
+    m_gestureEngine = new QStm_GestureEngineApi();
+}
+#endif // ORBIT_UI
+
+BrowserApp::BrowserApp(int & argc, char** argv) : ParentApp(argc, argv)
+{
+    m_gestureHelper = 0;
+    m_mainWindow = 0;
     m_gestureEngine = new QStm_GestureEngineApi();
 }
 
 void BrowserApp::setGestureHelper(WebGestureHelper* gh)
 {
     m_gestureHelper = gh;
+/*    if (mainWindow()) {
+        qDebug() << __PRETTY_FUNCTION__ << " - grabbing gestures";
+        mainWindow()->ungrabGesture(Qt::PanGesture);
+        mainWindow()->ungrabGesture(Qt::TapGesture);
+        mainWindow()->ungrabGesture(Qt::TapAndHoldGesture);
+        mainWindow()->ungrabGesture(Qt::PinchGesture);
+        mainWindow()->ungrabGesture(Qt::SwipeGesture);
+        mainWindow()->grabGesture(QStm_Gesture::assignedType());
+    }
+*/ 
 }
 
+
 bool BrowserApp::symbianEventFilter(const QSymbianEvent *event)
 {
 #if(ENABLE_GESTURE_LIB)
-    return m_gestureHelper->symbianEventFilter(event);
-#else
+    bool wasFiltered = false;
+    if (m_gestureHelper && m_gestureHelper->shouldHandleGesture()) {
+        m_gestureHelper->symbianEventFilter(event);
+        wasFiltered = m_gestureHelper->isFilteredByGestureEngine();
+    }
     return false;
 #endif
+    return false;
 }
 
 
 bool BrowserApp::x11EventFilter ( XEvent* event )
 {
 #if (ENABLE_GESTURE_LIB)
-    return m_gestureHelper->x11EventFilter(event);
-#else
+    bool wasFiltered = false;
+    if (m_gestureHelper && m_gestureHelper->shouldHandleGesture()) {
+        wasFiltered = m_gestureHelper->isFilteredByGestureEngine();
+        m_gestureHelper->x11EventFilter(event);
+    }
+    return false;
+#endif
+    return false;
+}
+
+bool BrowserApp::winEventFilter(MSG* message, long* result)
+{
+#if (ENABLE_GESTURE_LIB)
+    bool wasFiltered = false;
+    if (m_gestureHelper && m_gestureHelper->shouldHandleGesture()) {
+        if(m_gestureHelper->winEventFilter(message))
+            wasFiltered = m_gestureHelper->isFilteredByGestureEngine();
+        if(wasFiltered) *result = 0;
+    }
     return false;
 #endif
+    return false;
 }
 
+/*
+// For now, treat gesture touch / release as mouse events
+bool BrowserApp::event(QEvent* event)
+{
+    if (event->type() == QEvent::Gesture) {
+        qDebug() << __PRETTY_FUNCTION__ << " - got a gesture";
+        QStm_Gesture* gesture = getQStmGesture(event);
+        if (gesture) {
+//            QStm_GestureType gtype = gesture->getGestureStmType();
+//            if (gtype == QStmTouchGestureType || gtype == QStmReleaseGestureType) {
+                qDebug() << __PRETTY_FUNCTION__ << " - sending mouse events";
+                gesture->sendMouseEvents();
+                return true;
+//            }
+        }
+    }
+    return QApplication::event(event);
+}
+*/
 QStm_QtDummyGestureRecognizer::QStm_QtDummyGestureRecognizer(QStm_GestureContext* ctx) :
                                       QGestureRecognizer(),
                                       m_context(ctx),
@@ -219,8 +323,14 @@
     if (event->type() == QStm_GestureEvent::stmGestureEventType()) {
         QStm_Gesture* gesture = static_cast<QStm_Gesture*>(state);
         *gesture = *m_currentGesture;
-        ret = (m_currentGesture->gestureState() == Qt::GestureFinished) ? QGestureRecognizer::FinishGesture :
-                                                                   QGestureRecognizer::TriggerGesture;
+        if (m_currentGesture->gestureState() == Qt::GestureFinished ||
+            m_currentGesture->isGestureEnded()) {
+            ret = QGestureRecognizer::FinishGesture;
+    }
+        else {
+            ret = QGestureRecognizer::TriggerGesture;
+        }
+        event->accept();
     }
     return ret;
 }
@@ -232,122 +342,60 @@
 
 
 
+void QStm_QtDummyGestureRecognizer::handleQStmUiEvent(const qstmUiEventEngine::QStm_UiEventIf& uiEvent)
+{
+}
+
+
 QStm_GestureListenerApiIf::QStm_ProcessingResult QStm_QtDummyGestureRecognizer::handleGestureEvent(
                                               QStm_GestureUid uid, QStm_GestureIf* gesture)
 {
     if (!m_currentGesture) {
-        Q_ASSERT(gesture);
+        Q_ASSERT(gesture);        
         m_currentGesture = new QStm_Gesture();
     }
 
     int stmGestType = gesture ? gesture->getType() : -1;
 
-    switch (uid) {
-        case EGestureUidTap:
-        {
-            QStm_TapType type = qstmGesture::QStm_TapType(stmGestType);
-            if (type == qstmGesture::ETapTypeDouble) {
-                m_currentGesture->setGestureStmType(QStmDoubleTapGestureType);
-            }
-            else  {
-                m_currentGesture->setGestureStmType(QStmTapGestureType);
-            }
-            break;
-        }
-
-        case EGestureUidTouch:
-        {
-            m_currentGesture->setGestureStmType(QStmTouchGestureType);
-            break;
-        }
-
-        case EGestureUidRelease:
-        {
-            m_currentGesture->setGestureStmType(QStmReleaseGestureType);
-            break;
-        }
-
-        case EGestureUidFlick:
-        {
-            m_currentGesture->setGestureStmType(QStmFlickGestureType);
-            break;
-        }
-
-        case EGestureUidLeftRight:
-        {
-            m_currentGesture->setGestureStmType(QStmLeftRightGestureType);
-            break;
-        }
-
-        case EGestureUidUpDown:
-        {
-            m_currentGesture->setGestureStmType(QStmUpDownGestureType);
-            break;
-        }
-
-        case EGestureUidPan:
-        {
-            m_currentGesture->setGestureStmType(QStmPanGestureType);
-            break;
-        }
-
-        case EGestureUidHover:
-        {
-            m_currentGesture->setGestureStmType(QStmHoverGestureType);
-            break;
-        }
-
-        case EGestureUidLongPress:
-        {
-            m_currentGesture->setGestureStmType(QStmLongPressGestureType);
-            break;
-        }
-
-        case EGestureUidEdgeScroll:
-        {
-            m_currentGesture->setGestureStmType(QStmEdgeScrollGestureType);
-            break;
-        }
-
-        case EGestureUidCornerZoom:
-        {
-            m_currentGesture->setGestureStmType(QStmCornerZoomGestureType);
-            break;
-        }
-
-        case EGestureUidPinch:
-        {
-            m_currentGesture->setGestureStmType(QStmPinchGestureType);
-            break;
-        }
-        case EGestureUidUnknown:
-        {
-            m_currentGesture->setGestureStmType(QStmUknownGestureType);
-            break;
-        }
-    }
-
+    m_currentGesture->setGestureStmType(m_currentGesture->gestureUidToStmType(uid, stmGestType));
+    
     if (gesture) { //gesture enter
         m_currentGesture->setGestureSubType(gesture->getType());
         m_currentGesture->setDirection(gesture->getDirection());
         QPoint vec = gesture->getLengthAndDirection();
+        switch (m_currentGesture->getGestureStmType()) {
+            case QStmLeftRightGestureType:
+                vec.ry() = 0;
+                m_currentGesture->setGestureStmType(QStmPanGestureType);
+            break;
+            case QStmUpDownGestureType:
+                vec.rx() = 0;
+            m_currentGesture->setGestureStmType(QStmPanGestureType);
+            break;
+        }
+        
         m_currentGesture->setLengthAndDirection(vec);
         m_currentGesture->setSpeed(gesture->getSpeed());
         QPoint pos = gesture->getLocation();
         m_currentGesture->setPosition(pos);
+        QPoint pos2 = gesture->getLocation2();
+        m_currentGesture->setPosition2(pos2);
         m_currentGesture->setDetails(gesture->getDetails());
         m_currentGesture->setSpeedVec(gesture->getSpeedVec());
         QWidget* w = static_cast<QWidget*>(gesture->target());
         m_currentGesture->setTarget(w);
         m_currentGesture->setGestureState(Qt::NoGesture);
+        m_currentGesture->setTimestamp(gesture->timestamp());
+        m_currentGesture->setHotSpot(pos);
+
+        QStm_GestureEvent dummy;
+        m_currentGesture->sendEvent(&dummy);
+        
     }
     else {
         m_currentGesture->setGestureState(Qt::GestureFinished);
     }
 
-    QStm_GestureEvent dummy;
-    m_currentGesture->sendEvent(&dummy);
-
     return QStm_GestureListenerApiIf::EContinue;
 }
 
--- a/ginebra2/WebGestureHelper.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/WebGestureHelper.h	Fri Oct 15 17:30:59 2010 -0400
@@ -25,6 +25,9 @@
 #include "qstmgestureevent.h"
 #include <QApplication>
 //#include "BWFGlobal.h"
+#if defined(ORBIT_UI)
+#include <hbapplication.h>
+#endif
 
 #if !defined(Q_WS_X11)
 #define XEvent void
@@ -34,7 +37,7 @@
 class QStm_QtDummyGestureRecognizer;
 
 class WebGestureHelper
-{
+{    
 public:
     WebGestureHelper(QWidget* ctrl);
 
@@ -44,8 +47,10 @@
     QStm_GestureContext*   gestureContext(){ return m_gestures; }
     bool symbianEventFilter(const QSymbianEvent *event);
     bool x11EventFilter (XEvent* event);
+    bool winEventFilter(void* event);
     void setupGestureEngine(QWidget* ctrl);
-
+    bool shouldHandleGesture();
+    bool isFilteredByGestureEngine();
 private:
     QStm_GestureEngineApi* m_gestureEngine;
     QStm_GestureContext* m_gestures;
@@ -61,19 +66,36 @@
 
 #define browserApp   (static_cast<BrowserApp*>(QApplication::instance()))
 
-class BrowserApp : public QApplication
+
+#if defined(ORBIT_UI)
+#define ParentApp  HbApplication
+#else
+#define ParentApp  QApplication
+#endif
+
+#ifndef Q_OS_WIN
+typedef void* MSG;
+#endif
+
+class BrowserApp : public ParentApp
 {
     Q_OBJECT
 public:
-    BrowserApp(int argc, char** argv);
+    
+#if defined(ORBIT_UI)
+    BrowserApp(QS60MainApplicationFactory appfactory, int & argc, char** argv);
+#endif
+    BrowserApp(int & argc, char** argv);
     virtual bool symbianEventFilter(const QSymbianEvent *event);
     virtual bool x11EventFilter (XEvent* event);
+    virtual bool winEventFilter(MSG* message, long* result);
     void  setGestureHelper(WebGestureHelper* gh);
     WebGestureHelper* gestureHelper() { return m_gestureHelper; }
 
     void setMainWindow(QWidget* mw) { m_mainWindow = mw; }
     QWidget* mainWindow() { return m_mainWindow; }
     QStm_GestureEngineApi* gestureEngine() { return m_gestureEngine; }
+//    bool event(QEvent* event);
 
 private:
     WebGestureHelper*        m_gestureHelper;
@@ -83,22 +105,13 @@
 
 
 
-class WebGestureHelperEventFilter : public QObject
-{
-public:
-    WebGestureHelperEventFilter() {}
-    virtual ~WebGestureHelperEventFilter() {}
-    static  WebGestureHelperEventFilter* instance();
-    bool eventFilter(QObject* receiver, QEvent* event);
-
-private:
-    static WebGestureHelperEventFilter* m_instance;
-};
 
 
-class QStm_QtDummyGestureRecognizer : public QGestureRecognizer,
+class QStm_QtDummyGestureRecognizer : public QObject,
+                                      public QGestureRecognizer,
                                       public QStm_GestureListenerApiIf
 {
+    Q_OBJECT
 public:
     QStm_QtDummyGestureRecognizer(QStm_GestureContext* ctx);
     ~QStm_QtDummyGestureRecognizer();
@@ -111,6 +124,9 @@
     //from QStm_GestureListenerApiIf
     QStm_ProcessingResult handleGestureEvent(qstmGesture::QStm_GestureUid uid, qstmGesture::QStm_GestureIf* gesture);
 
+public slots:
+    void handleQStmUiEvent(const qstmUiEventEngine::QStm_UiEventIf&);
+
 private:
     QStm_GestureContext* m_context;
     QStm_Gesture* m_currentGesture;
--- a/ginebra2/WebTouchNavigation.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/WebTouchNavigation.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -25,156 +25,187 @@
 #include <QWebFrame>
 #include <QGraphicsScene>
 #include <QGraphicsView>
+#include <QGraphicsSceneContextMenuEvent>
+#include <QApplication>
 
 #include "WebTouchNavigation.h"
-#include "KineticHelper.h"
+#include "GWebContentViewWidget.h"
+#include "GWebContentView.h"
+#include "wrtperftracer.h"
 
+#ifndef NO_QSTM_GESTURE
+#include "qstmutils.h"
+#include "qstmgestureevent.h"
+#include "qstmfilelogger.h"
+#endif
 #define SCROLL_TIMEOUT   40
 
 namespace GVA {
+#ifndef NO_QSTM_GESTURE
 using namespace qstmGesture;
-
-
-
-
-DecelEdit::DecelEdit(WebTouchNavigation* nav) : QLineEdit(), m_nav(nav)
-{
-    setMaxLength(6);
-    connect(this, SIGNAL(editingFinished()), this, SLOT(setDecel()));
-//    connect(this, SIGNAL(returnPressed ()), this, SLOT(setDecel()));
-}
-
-void DecelEdit::setDecel()
-{
-    QString txt = text();
-    bool ok = false;
-    int decel = txt.toInt(&ok);
-    m_nav->m_kinetic->setDeceleration((qreal)decel);
-    hide();
-}
+#endif
 
 
 WebTouchNavigation::WebTouchNavigation(QGraphicsWebView* view) :
          m_view(view),
-         m_scrollTimer(0)
+         m_scrollHelper(0),
+         m_frame(0)
 
 {
     m_webPage = m_view->page();
-    m_kinetic = new KineticHelper(this);
-    m_decelEdit = new DecelEdit(this);
 }
 
 WebTouchNavigation::~WebTouchNavigation()
 {
-    disconnect(m_scrollTimer, SIGNAL(timeout()),this,SLOT(pan()));
-    delete m_scrollTimer;
-
-    delete m_kinetic;
 }
 
 
+bool WebTouchNavigation::eventFilter(QObject* obj, QEvent* event)
+{
+    if (obj != m_view) return false;
+#ifndef NO_QSTM_GESTURE    
+    if (event->type() == QEvent::Gesture) {
+        QStm_Gesture* gesture = getQStmGesture(event);
+        if (gesture) {
+            handleQStmGesture(gesture);
+            return true;
+        }
+    }
+#endif
+    return false;
+}
+
+#ifndef NO_QSTM_GESTURE
 void WebTouchNavigation::handleQStmGesture(QStm_Gesture* gesture)
 {
     QStm_GestureType type = gesture->getGestureStmType();
-
+    qstmDebug() << " WTN::handleQStmGesture - type=" << type << "\n";
+    
     switch (type) {
         case QStmTapGestureType:
         {
             doTap(gesture);
+            //gesture->sendMouseEvents();
+            break;
+        }
+        case QStmLeftRightGestureType:
+        {
+            qstmDebug() << " handleQStmGesture LEFTRIGHT_begin: pos: " << gesture->position() << "\n";
+            //gesture->sendMouseEvents();
+            doPan(gesture);
+            qstmDebug() << " handleQStmGesture LEFTRIGHT_end" << "\n";
+            break;    
+        }
+        case QStmUpDownGestureType:
+        {
+            qstmDebug() << " handleQStmGesture UPDOWN_begin pos: " << gesture->position() << "\n";
+            //gesture->sendMouseEvents();
+            doPan(gesture);
+            qstmDebug() << " handleQStmGesture UPDOWN_end"<< "\n";
             break;
         }
         case QStmPanGestureType:
         {
+            //
+            qstmDebug() << " handleQStmGesture PAN_begin pos: " << gesture->position() << "\n";
+            //gesture->sendMouseEvents();
             doPan(gesture);
+            qstmDebug() << " handleQStmGesture PAN_end" << "\n";
             break;
         }
         case QStmFlickGestureType:
         {
+            qstmDebug() << " handleQStmGesture FLICK_begin pos: " << gesture->position() << ", speed: " << gesture->getSpeedVec() << "\n";
             doFlick(gesture);
+            //gesture->sendMouseEvents();
+            qstmDebug() << " handleQStmGesture FLICK_end" << "\n";
             break;
         }
         case QStmDoubleTapGestureType:
         {
-            m_decelEdit->show();
+            //qstmDebug() << "WTN::handleQStmGesture doubletap";
+            //m_decelEdit->show();
+            //gesture->sendMouseEvents();
             break;
         }
         case QStmTouchGestureType:
         {
-            doTouch(gesture);
+            qstmDebug() << " handleQStmGesture TOUCH_begin pos: " << gesture->position() << "\n";
+            //doTouch(gesture);
+            //gesture->sendMouseEvents(m_view);
+            qstmDebug() << " handleQStmGesture TOUCH_end" << "\n";
+            break;
+        }
+        case QStmReleaseGestureType:
+        {
+            qstmDebug() << " handleQStmGesture RELEASE_begin pos: " << gesture->position() << "\n";
+            //gesture->sendMouseEvents(m_view);
+            m_scrollHelper->stopScroll();
+            qstmDebug() << " handleQStmGesture RELEASE_end" << "\n" << "\n";
+            break;
+    }
+        case QStmPinchGestureType:
+        {
+            qstmDebug() << " handleQStmGesture PINCH_begin" << "\n";
+            qstmDebug() << " handleQStmGesture PINCH_end" << "\n";    
             break;
         }
+        case QStmLongPressGestureType:
+        {
+            qstmDebug() << " handleQStmGesture LONGPRESS_begin pos: " << gesture->position() << "\n";
+            QPoint gpos = gesture->position();
+            QPoint pos = mapFromGlobal(gpos).toPoint();
+            //QContextMenuEvent cmEvent(QContextMenuEvent::Mouse, pos, gpos);
+
+            QGraphicsSceneContextMenuEvent cmEvent(QEvent::GraphicsSceneContextMenu);
+            cmEvent.setPos(pos);
+            cmEvent.setScenePos(gpos);
+            cmEvent.setReason(QGraphicsSceneContextMenuEvent::Mouse);
+            
+            QApplication::sendEvent(m_view, &cmEvent);
+            qstmDebug() << " handleQStmGesture LONGPRESS_end" << "\n";
+        }
+        
+        default: 
+        {
+//            gesture->sendMouseEvents();
+        }
     }
 }
 
 void WebTouchNavigation::doTouch(QStm_Gesture* gesture)
 {
+    qstmDebug() << "WTN::doTouch IN";
     stopScrolling();
-    if (m_kinetic->isScrolling()) {
-        m_kinetic->stopScrolling();
     }
-}
 
 void WebTouchNavigation::stopScrolling()
 {
-    if (m_scrollTimer && m_scrollTimer->isActive()) {
-        m_scrollTimer->stop();
-        m_scrollDelta = QPoint(0,0);
-    }
 }
 
 
 void WebTouchNavigation::doFlick(QStm_Gesture* gesture)
 {
-
-    QPointF pos = mapFromGlobal(gesture->position());
     m_kineticSpeed = gesture->getSpeedVec();
-    QStm_GestureDirection direction = static_cast<QStm_GestureDirection>(gesture->getDirection());
-
-    if (direction == ENorth || direction == ESouth) {
-        m_kineticSpeed.setY(0.0);
-    }
-    else if (direction == EEast || direction == EWest) {
-        m_kineticSpeed.setX(0.0);
-    }
-
-    m_kineticSpeed *= -1.0;
-    m_frame = m_webPage->frameAt(pos.toPoint());
-    m_kinetic->startScrolling();
+    m_scrollHelper->kineticScroll(m_kineticSpeed);
 }
 
 void WebTouchNavigation::doPan(QStm_Gesture* gesture)
-{
-    if (gesture->gestureState() == Qt::GestureFinished) {
-        stopScrolling();
-    }
-    else {
-      m_scrollDelta += gesture->getLengthAndDirection();
-      Q_ASSERT(m_scrollDelta.x() != 0 || m_scrollDelta.y() != 0);
-      QPointF pos = mapFromGlobal(gesture->position());
-      m_frame = m_webPage->frameAt(pos.toPoint());
-      if (!m_scrollTimer) {
-          m_scrollTimer = new QTimer(this);
-          m_scrollTimer->setSingleShot(false);
-          QObject::connect(m_scrollTimer, SIGNAL(timeout()), this, SLOT(pan()));
-      }
-
-      if (!m_scrollTimer->isActive()) {
-          m_scrollTimer->stop();
-          m_scrollTimer->start(SCROLL_TIMEOUT);
-      }
-    }
+{   
+    m_scrollDelta = gesture->getLengthAndDirection();
+#ifdef BEDROCK_TILED_BACKING_STORE
+    m_scrollDelta.setY(-1 * m_scrollDelta.y());
+#endif
+    QPointF p = QPointF(gesture->position());
+//    if (m_scrollDelta.x() != 0 || m_scrollDelta.y() != 0) {
+        m_scrollHelper->scroll(m_scrollDelta, p);
+//    }
 }
 
-void WebTouchNavigation::pan()
-{
-    if (m_scrollDelta.x() != 0 || m_scrollDelta.y() != 0) {
-        m_frame->scroll(-m_scrollDelta.x(), m_scrollDelta.y());
-        m_scrollDelta = QPoint(0,0);
-    }
-}
 
 void WebTouchNavigation::doTap(QStm_Gesture* gesture)
 {
+    qstmDebug() << "WTN::doTap IN";
     QPoint gpos = gesture->position();
     QPoint pos = mapFromGlobal(gpos).toPoint();
     Qt::MouseButtons buttons = Qt::LeftButton;
@@ -190,6 +221,32 @@
 }
 
 
+#endif
+
+QPoint WebTouchNavigation::scrollPosition()
+{
+    if (!m_frame) {
+        m_frame = m_webPage->mainFrame();
+    }
+    return m_frame->scrollPosition();
+}
+
+
+void WebTouchNavigation::setScrollPosition(QPoint pos)
+{
+    if (!m_frame) {
+        m_frame = m_webPage->mainFrame();
+    }
+    m_frame->setScrollPosition(pos);
+}
+
+void WebTouchNavigation::pan()
+{
+    if (m_scrollDelta.x() != 0 || m_scrollDelta.y() != 0) {
+        m_frame->scroll(-m_scrollDelta.x(), m_scrollDelta.y());
+        m_scrollDelta = QPoint(0,0);
+    }
+}
 
 
 QPointF WebTouchNavigation::mapFromGlobal(const QPointF& gpos)
@@ -208,29 +265,5 @@
     return QPointF(0.0, 0.0);
 }
 
-
-void WebTouchNavigation::scrollTo(QPoint& pos)
-{
-    m_frame->setScrollPosition(pos);
-}
-
-
-QPoint WebTouchNavigation::getScrollPosition()
-{
-    return m_frame->scrollPosition();
 }
 
-QPoint WebTouchNavigation::getInitialPosition()
-{
-    return m_frame->scrollPosition();
-}
-
-QPointF WebTouchNavigation::getInitialSpeed()
-{
-    return m_kineticSpeed;
-}
-
-
-
-}
-
--- a/ginebra2/WebTouchNavigation.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/WebTouchNavigation.h	Fri Oct 15 17:30:59 2010 -0400
@@ -22,48 +22,32 @@
 #ifndef __WEBTOUCHNAVIGATION_H__
 #define __WEBTOUCHNAVIGATION_H__
 
-#include "qstmgestureevent.h"
-#include "KineticHelper.h"
-#include <QLineEdit>
+
+#define square(x) (x)*(x)
+
+#include "ScrollHelper.h"
 
 class QGraphicsWebView;
 class QWebPage;
 class QWebFrame;
+class QStm_Gesture;
 
 namespace GVA {
 
-class WebTouchNavigation;
-
-class DecelEdit : public QLineEdit
-{
-    Q_OBJECT
-public:
-    DecelEdit(WebTouchNavigation* nav);
-    ~DecelEdit() {};
-public slots:
-    void setDecel();
-private:
-    WebTouchNavigation* m_nav;
-
-};
 
 
-
-class WebTouchNavigation : public QObject,
-                           public KineticScrollable
+class WebTouchNavigation : public QObject
 {
     Q_OBJECT
 public:
     WebTouchNavigation(QGraphicsWebView* view);
     virtual ~WebTouchNavigation();
     void handleQStmGesture(QStm_Gesture* gesture);
-
-    //from KineticScrollable
-    void scrollTo(QPoint& pos);
-    QPoint getScrollPosition();
-    QPoint getInitialPosition();
-    QPointF getInitialSpeed();
-
+    virtual bool eventFilter(QObject* obj, QEvent* event);
+    void setScrollHelper(ScrollHelper* helper) { m_scrollHelper = helper; }
+    ScrollHelper*  scrollHelper() { return m_scrollHelper; }
+    QPoint scrollPosition();
+    void setScrollPosition(QPoint pos);
 private:
     void doTap(QStm_Gesture* gesture);
     void doPan(QStm_Gesture* gesture);
@@ -73,22 +57,21 @@
 
     QPointF mapFromGlobal(const QPointF& gpos);
 
+signals:
+    void scroll(QPoint& pos);
+    
 public slots:
     void pan();
 
 private:
     QTimer* m_scrollTimer;
-    QPoint  m_scrollDelta;
+    QPointF  m_scrollDelta;
     bool    m_scrolling;
     QPointF m_kineticSpeed;
     QGraphicsWebView* m_view;
     QWebPage*         m_webPage;
     QWebFrame* m_frame;
-    KineticHelper* m_kinetic;
-    DecelEdit*   m_decelEdit;
-
-
-    friend class DecelEdit;
+    ScrollHelper* m_scrollHelper;
 };
 
 }
--- a/ginebra2/WindowToolbarSnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/WindowToolbarSnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -54,23 +54,29 @@
     
     void WindowToolbarSnippet::addChild(ChromeSnippet * child) {
 
+ #ifdef  Q_WS_MAEMO_5
+    QString iconPath = ":/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/";
+  #else
+    QString iconPath = ":/chrome/bedrockchrome/toolbar.snippet/icons/";
+  #endif 
+
         WebChromeContainerSnippet * s =  dynamic_cast<WebChromeContainerSnippet* >(child);
         if (!s) {
             ToolbarActions_t* t = new ToolbarActions_t();
             if (child->elementId() == "WinBackButton" ) {
                 t->actionId = WINDOW_VIEW_ACTION_BACK;
                 t->actionName = WINDOW_TOOLBAR_BACK;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png";
-                t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_disabled.png";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png";
+                t->normalImg = ":/toolbar/icon_back_bg.png";
+                t->disabledImg = ":/toolbar/icon_back_bg_disabled.png";
+                t->activeImg = ":/toolbar/icon_back_bg_pressed.png";
 
             }
             else if (child->elementId() == "WinAddWindow" ) {
                 t->actionId = WINDOW_VIEW_ACTION_ADD;
                 t->actionName = WINDOW_TOOLBAR_ADD;
-                t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png";
-                t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_disabled.png";
-                t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png";
+                t->normalImg = ":/toolbar/icon_add.png";
+                t->disabledImg = ":/toolbar/icon_add_disabled.png";
+                t->activeImg = ":/toolbar/icon_add_pressed.png";
             }
             t->id = child->elementId();
             m_actionInfo.append(t);
--- a/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/BookmarkView.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/BookmarkView.html	Fri Oct 15 17:30:59 2010 -0400
@@ -1,67 +1,69 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-EN">
 <head>
-    <script src="../../js/3rdparty/jquery-1.4.2.min.js" type="text/javascript"></script>
-    <script src="../../js/3rdparty/jquery-ui/ui.core.js" type="text/javascript"></script>
-    <script src="../../js/3rdparty/jquery-ui/ui.sortable.js" type="text/javascript"></script>
-  <script src="../../js/LongPress.js" type="text/javascript"></script>
-  <script src="../../js/Bind.js" type="text/javascript"></script>
-  <script src="bookmarkview.js" type="text/javascript"></script>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-  <link rel="stylesheet" id="CSSLink" type="text/css" href="bookmarkview.css"/>
-  <meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
-    <title>Bookmark View</title>
+	<script src="/chrome/jquery-1.4.2.min.js" type="text/javascript"></script>
+	<script src="/chrome/ui.core.js" type="text/javascript"></script>
+	<script src="/chrome/ui.sortable.js" type="text/javascript"></script>
+	<script src="/chrome/LongPress.js" type="text/javascript"></script>
+	<script src="/chrome/Bind.js" type="text/javascript"></script>
+	<script src="/bookmarkview/bookmarkview.js" type="text/javascript"></script>
 
-  <script type="text/javascript">
-  		function scrollToTop()
-  		{
-				  if(__prevOpenedBookmarkControl)
-				  	_bookmarkHideControl(__prevOpenedBookmarkControl);
-  			
-		    	$('html, body').attr({scrollTop: 0});
-					
-					_updateBookmarkViewGoemetry(0);
-  		}
-  		
-      function updateBookmakrView()
-      {
-    		window.views.WebView.BookmarkTreeView.shown.connect(scrollToTop);
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/bookmarkview/bookmarkview.css"/>
+	
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+	<meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
+
+    <title>Bookmarks</title>
+
+    <script type="text/javascript">
+        function scrollToTop() {
         
-        launchBookmarkView();
+            if(__prevOpenedBookmarkControl)
+                _bookmarkHideControl(__prevOpenedBookmarkControl);
 
+            $('html, body').attr({scrollTop: 0});
 
-      //set the Width & Height
-          if (!window.views.WebView.bedrockTiledBackingStoreEnabled()) 
-              $("#bookmarkListId").css({"width": window.innerWidth+"px", "height": window.innerHeight+"px"});
-      
-      }
+            _updateBookmarkViewGoemetry(0);
+        }
 
-    var __sortingEnabled = false;
-    var __sortEleOffsetTop = 0;
-    window.onresize = function(){
+        function updateBookmakrView() {
+
+            window.views.WebView.BookmarkTreeView.shown.connect(scrollToTop);
+   
+            launchBookmarkView();
 
+            //set the Width & Height
+            if ( !window.views.WebView.bedrockTiledBackingStoreEnabled() ) 
+                $("#bookmarkListId").css({"width": window.innerWidth+"px", "height": window.innerHeight+"px"});
+        }
 
-        if (!window.views.WebView.bedrockTiledBackingStoreEnabled())
-            $("#bookmarkListId").css({"width": window.innerWidth+"px", "height": window.innerHeight+"px"});
+        var __sortingEnabled = false;
+        var __sortEleOffsetTop = 0;
+
+        window.onresize = function() {
 
-        if (__sortingEnabled)
-        {
-            $('html, body').animate({
-                                scrollTop: parseInt(__sortEleOffsetTop)}, 1000);
+            if ( !window.views.WebView.bedrockTiledBackingStoreEnabled() )
+                $("#bookmarkListId").css({"width": window.innerWidth+"px", "height": window.innerHeight+"px"});
+
+            if (__sortingEnabled)
+            {
+                $('html, body').animate(
+                    {scrollTop: parseInt(__sortEleOffsetTop)},
+                     1000);
+            }
         }
-    }
-
-  </script>
-
+    </script>
 </head>
 
 <body onload=updateBookmakrView()>
-<div id="bookmarkListId" class="bookmarkList">
-        <ul id="bookmarkListTree"></ul>
-        <div id="BottomPad"></div>
-    </div>
 
-<div class="hiddenLoadImages"></div>
-
+	<div id="bookmarkListId" class="bookmarkList">
+		<ul id="bookmarkListTree"></ul>
+		<div id="BottomPad"></div>
+	</div>
+	
+	<!--
+	<div class="hiddenLoadImages"></div>
+	-->
 </body>
 </html>
--- a/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,112 +1,218 @@
+/******* css for bookmark dialog *******/
+
 /*TBD: This should be cleaned up to use a set of common dialog classes */
 
+#BookmarkDialogId {
+  /*dimensions*/
+  width: 327px;
+  background: -webkit-gradient(linear, left top, left bottom, from(#6780a1), to(#4c607d));
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  border-radius: 9px;
+  border: 3px solid #003159;
+  }
+
+@media (device-width:800px){
 #BookmarkDialogId
 {
-   width: 302px;
+   width: 450px;
+}
 }
 
+#BookmarkDialogTitleId {
+  /*dimensions*/
+  width: 307px;
+  height: 32px;
+  /*margins & paddings*/
+  margin-top: 20px;
+  padding: 2px;
+  border-radius: 3px;
+  /*decorations*/
+  background-color:white;
+  border-color:#c8c8c8;}
+
+@media (device-width:800px){
 #BookmarkDialogTitleId 
 {
-    width: 256;
-    height:32px;
-    background-color:white;
-    padding:2px;
-    border-radius: 3px;
-    border-color:#c8c8c8
+    width: 410;
+    height:54px;
+    font-size: 35px;
+    margin-top: 8px;
+    margin-bottom: 8px;
+    margin-right: 16px;
+}
 }
 
+#BookmarkDialogUrlId {
+  /*dimensions*/
+  width:307px;
+  height:32px;
+  /*margins & paddings*/
+  padding:2px;
+  margin-bottom: 10px;
+  margin-top: 20px;
+  border-radius: 3px;
+  /*decorations*/
+  background-color:white;
+  border-color:#c8c8c8;}
+
+@media (device-width:800px){
 #BookmarkDialogUrlId 
 {
-    width:256px;
-    height:32px;
-    background-color:white;
-    border-color:#c8c8c8;
-    border-radius: 3px;
-    padding:2px;
-    margin-top: 15px;
+    width:410px;
+    height:54px;
+    font-size: 35px;
+    margin-top: 8px;
+    margin-bottom: 8px;
+    margin-right: 16px;
+    margin-top: 0px;
+}
 }
 
-div.bookmarkTextLabel{
-    background-image: url(icons/menu_icon_bookmarks.png);
-    background-repeat: no-repeat;
-    font-size: 22px;
-    height: 21px;
-    padding-left: 40px;
-    color: #fff;
-    margin-bottom: 15px;
+div.bookmarkTextLabelContainer {
+  /*dimensions*/
+  height: 21px;
+  /*margins & paddings*/
+  margin-bottom: 8px;
+  padding-left: 40px;
+  /*decorations*/
+  color: #fff;
+  background-image: url(/bookmarkview/menu_icon_bookmarks.png);
+  background-repeat: no-repeat;
+  /*font specification*/
+  font-size: 22px;}
+
+@media (device-width:800px){
+div.bookmarkTextLabelContainer{
+    background-image: url(iconsMaemo/menu_icon_bookmarks.png);
+    font-size: 25px;
+    height: 35px;
+    margin-bottom: 0px;
+    vertical-align:text-top;
+}
 }
 
-#BookmarkDialogId div.top{
-    background-image: url(icons/dialog_top.png);
-    background-repeat: no-repeat;
-    height:11px;
+#BookmarkDialogId div.top {
+  /*dimensions*/
+  height: 10px;
 }
 
-#BookmarkDialogId div.body{
-    background-image: url(icons/dialog_center.png);
-    padding-left:20px;
-    padding-top: 5px;
-    padding-bottom:7px;
-    background-repeat: repeat-y;
+@media (device-width:800px){
+#BookmarkDialogId div.top{
+    background-image: url(iconsMaemo/dialog_top.png);
+}
 }
 
-#BookmarkDialogId div.bottom{
-    background-image: url(icons/dialog_bottom.png);
-    background-repeat: no-repeat;
-    height:10px;
-    background-position:left bottom;
+#BookmarkDialogId div.body {
+  /*margins & paddings*/
+  padding-left: 8px;
+  padding-top: 2px;
 }
 
-div.controls{
-  height: 54px;
-  margin: auto;
-  width: 230px;
+@media (device-width:800px){
+#BookmarkDialogId div.body{
+    background-image: url(iconsMaemo/dialog_center.png);
+}
+}
+
+#BookmarkDialogId div.bottom {
+  /*dimensions*/
+  height: 10px;
+  /*decorations*/
 }
 
-div.bookmarkDoneButton{
-    width: 100px;
-    height: 54px;
-    background-image: url(icons/dialog_buttons_tick.png);
-    background-repeat: no-repeat;
-    background-repeat: center center;
-    border: none;
-    margin-right:10px;
-    float: left;
-    
+@media (device-width:800px){
+#BookmarkDialogId div.bottom{
+    background-image: url(iconsMaemo/dialog_bottom.png);
+    height:11px;
+}
 }
 
-div.bookmarkDoneButton:active{
-    background-image: url(icons/dialog_buttons_tick_pressed.png);
+div.controls {
+  /*dimensions*/
+  height: 54px;
+  width: 230px;
+  /*margins & paddings*/
+  margin: auto;}
+
+@media (device-width:800px){
+div.controls{
+  height: 70px;
+  width: 290px;
+}
 }
 
+div.bookmarkDoneButton {
+  /*dimensions*/
+  width: 100px;
+  height: 54px;
+  /*margins & paddings*/
+  margin-right: 10px;
+  border: none;
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_tick.png);
+  background-repeat: no-repeat;
+  background-repeat: center center;
+  float: left;}
 
-div.bookmarkCancelButton{
-    width: 100px;
-    height: 54px;
-    background-image: url(icons/dialog_buttons_cross.png);
-    background-repeat: no-repeat;
-    background-repeat: center center;
-    border: none;
-    margin:none;
-    float: left;
+@media (device-width:800px){
+div.bookmarkDoneButton{
+    width: 70px;
+    height: 70px;
+    background-image: url(iconsMaemo/dialog_buttons_tick.png);
+    margin-right:138px;
+}
 }
 
-div.bookmarkCancelButton:active{
-    background-image: url(icons/dialog_buttons_cross_pressed.png);
+div.bookmarkDoneButton:active {
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_tick_pressed.png);}
+
+@media (device-width:800px){
+div.bookmarkDoneButton:active{
+    background-image: url(iconsMaemo/dialog_buttons_tick_pressed.png);
+}
 }
 
+div.bookmarkCancelButton {
+  /*dimensions*/
+  width: 100px;
+  height: 54px;
+  /*margins & paddings*/
+  margin: none;
+  border: none;
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_cross.png);
+  background-repeat: no-repeat;
+  background-repeat: center center;
+  float: left;}
+
+div.bookmarkCancelButton:active {
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_cross_pressed.png);}
+
+@media (device-width:800px){
+div.bookmarkCancelButton{
+    width: 70px;
+    height: 70px;
+    background-image: url(iconsMaemo/dialog_buttons_cross.png);
+}
+}
+
+@media (device-width:800px){
+div.bookmarkCancelButton:active{
+    background-image: url(iconsMaemo/dialog_buttons_cross_pressed.png);
+}
+}
 div.bookmarkCheckboxTextLabel {
-    font-size:20px;
-    height:20px;
-    color:#fff;
-    display: none;
-}
+  /*decorations*/
+  color: #fff;
+  /*font specification*/
+  font-size: 20px;
+  /*misc*/
+  display: none;}
 
 #bookmarkCheckboxId {
-    width:20px;
-    height:20px;
-    background-color:white;
-    border-color:#c8c8c8;
-    border-radius:3px;
-    margin-top:15px;
-}
+  /*margins & paddings*/
+  border: none;
+ }
--- a/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.js	Fri Oct 15 17:30:59 2010 -0400
@@ -1,5 +1,7 @@
-var _dailogFlag = 0;
+var _dialogFlag = 0;
 var _OriginalTitle = 0;
+var selected_src = "/bookmarkview/yes_selected.png";
+var deselected_src = "/bookmarkview/yes_deselected.png";
 
 document.getElementsByClassName = function(class_name) {
     var docList = this.all || this.getElementsByTagName('*');
@@ -23,11 +25,20 @@
     // do setup
     this.write();
 
-    if (app.serviceFramework() == "mobility_service_framework")
-    {
-        document.getElementsByClassName("bookmarkCheckboxTextLabel")[0].style.display = "inline";
+    if (app.serviceFramework() == "mobility_service_framework") {
+        $("bookmarkCheckboxTextLabelContainer").css("display", "inline");
     }
-    
+
+    chrome.chromeComplete.connect(createDelegate(this,
+        function() {
+            var snippet = window.snippets["BookmarkDialogId"];
+            chrome.aspectChanged.connect(createDelegate(this,
+                    function(a) {
+                        centerBookmarkDialog();
+                    })
+            );
+        })
+    );
 }
 
 function writeBookmarkDialog()
@@ -38,15 +49,39 @@
                    '<div class="bookmarkTextLabel" id="bookmarkDialogTitle">Add Bookmark</div>'+
                    '<div class="GinebraSnippet" id="BookmarkDialogTitleId" data-GinebraNativeClass="TextEditSnippet" data-GinebraVisible="true"></div>'+ 
                    '<div class="GinebraSnippet" id="BookmarkDialogUrlId" data-GinebraNativeClass="TextEditSnippet" data-GinebraVisible="true"></div>'+
-                   '<div class="bookmarkCheckboxTextLabel"><input type="checkbox" id="bookmarkCheckboxId"/>Add shortcut to home screen</div>'+
-                   '<div><input type="hidden" id="BookmarkDialogBookmarkId" name="BookmarkDialogBookmarkId" value=""/></div>'+
+                   '<div class="bookmarkCheckboxTextLabelContainer">' +
+                   '	<input style="vertical-align:middle;" type="image" src="' + deselected_src + '" id="bookmarkCheckboxId" />' +
+                   '	<label id="bookmarkCheckboxTextLabel">Add shortcut to home screen</label>' +
+                   '</div>'+
+                   '<div>' + 
+                   '<input type="hidden" id="BookmarkDialogBookmarkId" name="BookmarkDialogBookmarkId" value=""/></div>'+
                    '<div class="controls">' +
-                      '<div type="button"  onmouseup="bookmarkOperation();" class="bookmarkDoneButton"></div>'+     
-                       '<div type="button" onmouseup="bookmarkDialogIdHide();" class="bookmarkCancelButton"></div>'+  
-                    '</div>'+ /*controls*/
+                   '	<div type="button"  onmouseup="bookmarkOperation();" class="bookmarkDoneButton"></div>'+     
+                   '	<div type="button" onmouseup="bookmarkDialogIdHide();" class="bookmarkCancelButton"></div>'+  
+                   '</div>'+ /*controls*/
                 '</div>'+  /*body*/
                 '<div class="bottom"></div>';
-  document.write(html);
+    document.write(html);
+    $('#bookmarkCheckboxId').click(function() {
+    	toggleCheckbox($(this));
+    });
+   
+    $('#bookmarkCheckboxTextLabel').click(function() {
+    	toggleCheckbox($('#bookmarkCheckboxId'));
+    });
+}
+
+function toggleCheckbox(elem) {
+    img_src = elem.getAttribute('src');
+    if ( img_src == deselected_src ) {
+
+        elem.src = selected_src;
+
+    } else {
+
+        elem.src = deselected_src;
+
+    }
 }
 
 function bookmarkDialogIdHide(){
@@ -56,9 +91,13 @@
     
     if (app.serviceFramework() == "mobility_service_framework") 
     {
-        if (document.getElementById("bookmarkCheckboxId").checked)
+        elem = $("#bookmarkCheckboxId");
+        if (elem)
         {
-            document.getElementById("bookmarkCheckboxId").checked = false;
+            if ( elem.src == selected_src )
+            {
+                elem.src = deselected_src;
+            }
         }
     }    
 }
@@ -67,25 +106,25 @@
 {
     try{
         snippets.BookmarkViewToolbarId.enabled = false;
+        snippets.BookmarkDialogId.zValue = 100;
         snippets.WebViewToolbarId.enabled = false;
 
         if (dialogFlag == 0) {
-            if (app.serviceFramework() == "mobility_service_framework")
-            {
-                document.getElementsByClassName("bookmarkCheckboxTextLabel")[0].style.display = "inline"; 
+            if (app.serviceFramework() == "mobility_service_framework") {
+                $(".bookmarkCheckboxTextLabelContainer").css("display", "inline"); 
             }
-            var dlgTitle = document.getElementById("bookmarkDialogTitle");
-            dlgTitle.firstChild.nodeValue= window.localeDelegate.translateText("txt_browser_input_dial_add_bm");
-            var chkboxTitle = document.getElementsByClassName("bookmarkCheckboxTextLabel")[0];
-            chkboxTitle.firstChild.nodeValue= window.localeDelegate.translateText("txt_browser_bookmarks_also_add_to_home_screen");
+            var dlgTitle = $("#bookmarkDialogTitle");
+            dlgTitle.text(window.localeDelegate.translateText("txt_browser_input_dial_add_bm"));
+            var chkboxTitle = $("#bookmarkCheckboxTextLabel");
+            chkboxTitle.val(window.localeDelegate.translateText("txt_browser_bookmarks_also_add_to_home_screen"));
         }
         else if (dialogFlag == 1) {
-             document.getElementsByClassName("bookmarkCheckboxTextLabel")[0].style.display = "none";
-             var dlgTitle = document.getElementById("bookmarkDialogTitle");
-             dlgTitle.firstChild.nodeValue= window.localeDelegate.translateText("txt_browser_input_dial_edit_bm");
+             $("bookmarkCheckboxTextLabelContainer").css("display", "none");
+             var dlgTitle = $("#bookmarkDialogTitle");
+             dlgTitle.text(window.localeDelegate.translateText("txt_browser_input_dial_edit_bm"));
         }
        
-        _dailogFlag = dialogFlag;
+        _dialogFlag = dialogFlag;
         _OriginalTitle = bmtitle;
         window.snippets.BookmarkDialogTitleId.lostFocus.connect(titleFieldLostFocus);
         window.snippets.BookmarkDialogUrlId.lostFocus.connect(urlFieldLostFocus);
@@ -107,14 +146,26 @@
            window.snippets.BookmarkDialogUrlId.text = bmurl;
         document.getElementById('BookmarkDialogBookmarkId').value = bmid;
 
-        window.snippets.BookmarkDialogId.show(false);
+        centerBookmarkDialog();
 
-        window.snippets.BookmarkDialogTitleId.selectAll();
+        window.snippets.BookmarkDialogId.show(false);
         
        }catch(e){ alert(e); }
 
 }
 
+function centerBookmarkDialog() {
+        
+        var statusBarHeight = window.snippets.StatusBarChromeId.visible ? window.snippets.StatusBarChromeId.geometry.height : 0;
+        
+        var snippet = window.snippets["BookmarkDialogId"];
+        var x = (window.chrome.displaySize.width - snippet.geometry.width) / 2;
+        
+        // Center the menu in the space between status bar and tool bar
+        var y = (window.chrome.displaySize.height - statusBarHeight - window.snippets.WebViewToolbarId.geometry.height - document.getElementById("BookmarkDialogId").offsetHeight)/2;
+        snippet.setPosition(x, (y+statusBarHeight));
+}
+
 function bookmarkOperation()
 {
     snippets.BookmarkViewToolbarId.enabled = true;
@@ -127,7 +178,7 @@
     //Update the database
     var errCode = 0;
 
-    if (_dailogFlag == 0) {
+    if (_dialogFlag == 0) {
         var bmid = window.bookmarksController.addBookmark(bmtitle,bmurl);
         if (bmid < 0) {
             alert("Unknown error adding bookmark");
@@ -135,14 +186,18 @@
         }
         if (app.serviceFramework() == "mobility_service_framework") 
         {
-            if (document.getElementById("bookmarkCheckboxId").checked)
+            elem = document.getElementById("bookmarkCheckboxId");
+            if (elem)
             {
-                errCode = window.hsBookmarkPublishClient.addWidget(bmtitle, bmurl);
-                document.getElementById("bookmarkCheckboxId").checked = false;
+                if ( elem.src == selected_src )
+                {
+                    errCode = window.hsBookmarkPublishClient.addWidget(bmtitle, bmurl);
+                    elem.src = deselected_src;
+                }
             }
         } 
     }
-    else if (_dailogFlag == 1) {
+    else if (_dialogFlag == 1) {
         var bmid = document.getElementById('BookmarkDialogBookmarkId').value;
         errCode = window.bookmarksController.modifyBookmark(bmid,bmtitle,bmurl);
     }
@@ -176,12 +231,12 @@
 
 function titleFieldGainedFocus()
 {
-    window.snippets.BookmarkDialogUrlId.unselect();
+    //window.snippets.BookmarkDialogUrlId.unselect();
 }
 
 function urlFieldGainedFocus()
 {
-    window.snippets.BookmarkDialogTitleId.unselect();
+    //window.snippets.BookmarkDialogTitleId.unselect();
 }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialogTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,219 @@
+/******* css for bookmark dialog *******/
+
+/*TBD: This should be cleaned up to use a set of common dialog classes */
+
+#BookmarkDialogId {
+  /*dimensions*/
+  width: 327px;
+  background: -webkit-gradient(linear, left top, left bottom, from(#060808), to(#777779));
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  border-radius: 9px;
+  border: 2px solid #aaaaab;
+  }
+
+@media (device-width:800px){
+#BookmarkDialogId
+{
+   width: 450px;
+}
+}
+
+#BookmarkDialogTitleId {
+  /*dimensions*/
+  width: 307px;
+  height: 32px;
+  /*margins & paddings*/
+  margin-top: 20px;
+  padding: 2px;
+  border-radius: 3px;
+  /*decorations*/
+  background-color:white;
+  border-color:#c8c8c8;}
+
+@media (device-width:800px){
+#BookmarkDialogTitleId 
+{
+    width: 410;
+    height:54px;
+    font-size: 35px;
+    margin-top: 8px;
+    margin-bottom: 8px;
+    margin-right: 16px;
+}
+}
+
+#BookmarkDialogUrlId {
+  /*dimensions*/
+  width:307px;
+  height:32px;
+  /*margins & paddings*/
+  padding:2px;
+  margin-bottom: 10px;
+  margin-top: 20px;
+  border-radius: 3px;
+  /*decorations*/
+  background-color:white;
+  border-color:#c8c8c8;}
+
+@media (device-width:800px){
+#BookmarkDialogUrlId 
+{
+    width:410px;
+    height:54px;
+    font-size: 35px;
+    margin-top: 8px;
+    margin-bottom: 8px;
+    margin-right: 16px;
+    margin-top: 0px;
+}
+}
+
+div.bookmarkTextLabel {
+  /*dimensions*/
+  height: 21px;
+  /*margins & paddings*/
+  margin-bottom: 8px;
+  padding-left: 40px;
+  /*decorations*/
+  color: #fff;
+  background-image: url(/bookmarkview/menu_icon_bookmarks.png);
+  background-repeat: no-repeat;
+  /*font specification*/
+  font-size: 22px;}
+
+@media (device-width:800px){
+div.bookmarkTextLabel{
+    background-image: url(iconsMaemo/menu_icon_bookmarks.png);
+    font-size: 25px;
+    height: 35px;
+    margin-bottom: 0px;
+    vertical-align:text-top;
+}
+}
+
+#BookmarkDialogId div.top {
+  /*dimensions*/
+  height: 10px;
+}
+
+@media (device-width:800px){
+#BookmarkDialogId div.top{
+    background-image: url(iconsMaemo/dialog_top.png);
+}
+}
+
+#BookmarkDialogId div.body {
+  /*margins & paddings*/
+  padding-left: 8px;
+  padding-right: 8px;
+}
+
+@media (device-width:800px){
+#BookmarkDialogId div.body{
+    background-image: url(iconsMaemo/dialog_center.png);
+}
+}
+
+#BookmarkDialogId div.bottom {
+  /*dimensions*/
+  height: 10px;
+}
+
+@media (device-width:800px){
+#BookmarkDialogId div.bottom{
+    background-image: url(iconsMaemo/dialog_bottom.png);
+    height:11px;
+}
+}
+
+div.controls {
+  /*dimensions*/
+  height: 54px;
+  width: 230px;
+  /*margins & paddings*/
+  margin: auto;
+  padding-top:10px;
+}
+
+@media (device-width:800px){
+div.controls{
+  height: 70px;
+  width: 290px;
+}
+}
+
+div.bookmarkDoneButton {
+  /*dimensions*/
+  width: 100px;
+  height: 54px;
+  /*margins & paddings*/
+  margin-right: 10px;
+  border: none;
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_tick.png);
+  background-repeat: no-repeat;
+  background-repeat: center center;
+  float: left;}
+
+@media (device-width:800px){
+div.bookmarkDoneButton{
+    width: 70px;
+    height: 70px;
+    background-image: url(iconsMaemo/dialog_buttons_tick.png);
+    margin-right:138px;
+}
+}
+
+div.bookmarkDoneButton:active {
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_tick_pressed.png);}
+
+@media (device-width:800px){
+div.bookmarkDoneButton:active{
+    background-image: url(iconsMaemo/dialog_buttons_tick_pressed.png);
+}
+}
+
+div.bookmarkCancelButton {
+  /*dimensions*/
+  width: 100px;
+  height: 54px;
+  /*margins & paddings*/
+  margin-top: none;
+  border: none;
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_cross.png);
+  background-repeat: no-repeat;
+  background-repeat: center center;
+  float: left;}
+
+div.bookmarkCancelButton:active {
+  /*decorations*/
+  background-image: url(/bookmarkview/dialog_buttons_cross_pressed.png);}
+
+@media (device-width:800px){
+div.bookmarkCancelButton{
+    width: 70px;
+    height: 70px;
+    background-image: url(iconsMaemo/dialog_buttons_cross.png);
+}
+}
+
+@media (device-width:800px){
+div.bookmarkCancelButton:active{
+    background-image: url(iconsMaemo/dialog_buttons_cross_pressed.png);
+}
+}
+div.bookmarkCheckboxTextLabel {
+  /*decorations*/
+  color: #fff;
+  /*font specification*/
+  font-size: 20px;
+  /*misc*/
+  display: none;}
+
+#bookmarkCheckboxId {
+  /*margins & paddings*/
+  border: none;
+}
--- a/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.css	Fri Oct 15 17:30:59 2010 -0400
@@ -3,6 +3,8 @@
     margin : 0px;
     height:100%;
     background-color: #889cbf;
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
 }
 
 #BottomPad {
@@ -11,7 +13,7 @@
 }
 
 .bookmarkList li.selected {
-    background-image: url(icons/list_itembg_pressed.png);
+    background-image: url(/bookmarkview/list_itembg_pressed.png);
     font-weight: bold;
 }
 
@@ -20,7 +22,7 @@
     height: 70px;
     background-repeat: no-repeat;
     float: left;
-    background-image: url(icons/dogear_open.png);
+    background-image: url(/bookmarkview/dogear_open.png);
     width: 67px;
 }
 
@@ -28,21 +30,21 @@
 .bookmarkList .dogEarBox {
     height: 70px;
     background-repeat: repeat-x;
-    background-image: url(icons/dogear_open_bg.png);
+    background-image: url(/bookmarkview/dogear_open_bg.png);
     float:right;
     z-index:30;
 }
 
 .bookmarkList .dogEar.selected {
-    background-image: url(icons/dogear_pressed.png);
+    background-image: url(/bookmarkview/dogear_pressed.png);
 }
 
 .bookmarkList .dogEarBox.selected {
-    background-image: url(icons/dogear_open_bg_pressed.png);
+    background-image: url(/bookmarkview/dogear_open_bg_pressed.png);
 }
 
 .bookmarkList .dogEar.closed {
-    background-image: url(icons/dogear.png);
+    background-image: url(/bookmarkview/dogear.png);
     width: 51px;
 }
 
@@ -60,7 +62,7 @@
 
 .bookmarkList li {
     height: 70px;
-    background-image: url(icons/list_itembg.png);
+    background-image: url(/bookmarkview/list_itembg.png);
     background-repeat: repeat-x;
     overflow: hidden;
   -webkit-user-select: none;
@@ -95,6 +97,6 @@
 }
 
 .hiddenLoadImages { 
-    background-image: url(icons/dogear_open.png);
+    background-image: url(/bookmarkview/dogear_open.png);
     visibility: hidden;
 }
--- a/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.js	Fri Oct 15 17:30:59 2010 -0400
@@ -11,17 +11,33 @@
 var __currentLongPress;
 var __cancelLinkOpening = false;
 
+function _displayError(text) {
+    var el = document.getElementById("errorText");
+    el.style.visibility = "visible";
+    el.style.width = "100%";
+    el.style.height = "100%";
+    el.innerHTML = "<p>" + text;
+}
+
+function _clearError(text) {
+    var el = document.getElementById("errorText");
+    el.style.visibility = "hidden";
+    el.style.width = "0";
+    el.style.height = "0";
+    el.innerHTML = "";
+}
+
 function _enableSorting(ele) {
     // This is messy, why do we even need to do this sort/no-sort stuff???
     $(ele).removeClass('no-sort');
     $(ele).addClass('sort');
-		
-	var evt = document.createEvent("MouseEvents");
-	evt.initMouseEvent("mousedown", true, true, window,
-	  0, 0, 0, gInitialX, gInitialY, false, false, false, false, 0, null);
-	var canceled = !ele.dispatchEvent(evt);
+        
+    var evt = document.createEvent("MouseEvents");
+    evt.initMouseEvent("mousedown", true, true, window,
+      0, 0, 0, gInitialX, gInitialY, false, false, false, false, 0, null);
+    var canceled = !ele.dispatchEvent(evt);
     
-  	views.WebView.gesturesEnabled = false;
+    views.WebView.gesturesEnabled = false;
 
     $(ele).find(".dogEarBox").addClass('selected');
     $(ele).find(".dogEar").addClass('selected');
@@ -100,8 +116,8 @@
   }
 
   if(__prevOpenedBookmarkControl)
-  	_bookmarkHideControl(__prevOpenedBookmarkControl);
-  	
+    _bookmarkHideControl(__prevOpenedBookmarkControl);
+    
     if(!__dogearSelected)
      _enableSorting(ele);
 }
@@ -130,8 +146,11 @@
 
 function _handlePanStarted(type)
 {
-		__cancelLinkOpening = true;
-		
+   if(app.ui() != "maemo5_ui") // workaround for Maemo Issue
+   {
+            __cancelLinkOpening = true;
+     }
+        
     // Scrolling started, cancel the LongPress.
       if (__currentLongPress != undefined) {
         __currentLongPress.cancel();
@@ -151,8 +170,8 @@
     try {
         if(__timerId != "")
         {
-        	window.clearTimeout(__timerId);
-        	__timerId = "";
+            window.clearTimeout(__timerId);
+            __timerId = "";
         }
         if (__sortingEnabled && ele.parentNode.parentNode!=__previousSortEle)
         {
@@ -201,8 +220,8 @@
         window.clearTimeout(__timerId);
         __timerId = "";
     }
-	if(__prevOpenedBookmarkControl)
-  		_bookmarkHideControl(__prevOpenedBookmarkControl);
+    if(__prevOpenedBookmarkControl)
+        _bookmarkHideControl(__prevOpenedBookmarkControl);
 
     if(__previousSortEle    != null)
         _disableSorting(__previousSortEle)
@@ -213,8 +232,8 @@
     var dbgTitle = bmtitle.replace(/'/g, "&#39");
     dbgTitle = dbgTitle.replace(/"/g, "&#34");
     var li = _createBookmarkElement(dbgTitle,bmurl,bmid);
-	$(li).addClass('no-sort');
-	ul.insertBefore(li, ul.firstChild);
+    $(li).addClass('no-sort');
+    ul.insertBefore(li, ul.firstChild);
     ul.childNodes[ul.childNodes.length-1].focus();
     
     if (!window.views.WebView.bedrockTiledBackingStoreEnabled())
@@ -240,7 +259,7 @@
 
 function _launchEditBookmark(r,bmtitle,bmurl,id)
 {
-		// bookmark title/url may have been altered by the controller's edit method, so reload it
+        // bookmark title/url may have been altered by the controller's edit method, so reload it
     var bm = window.bookmarksController.findBookmark(id);
     window.bookmarksController.showBookmarkEditDialog(bm.title,bm.url,id);
 }
@@ -275,8 +294,8 @@
     }
     else if(__cancelLinkOpening)
     {
-    	__cancelLinkOpening = false;
-    	return false;
+        __cancelLinkOpening = false;
+        return false;
     }
 
     window.views.WebView.showNormalPage();
@@ -298,12 +317,12 @@
 
 function _setDogear()
 {
-	__dogearSelected = true;
+    __dogearSelected = true;
 }
 
 function _unsetDogear()
 {
-	__dogearSelected = false;
+    __dogearSelected = false;
 }
 
 function _createBookmarkElement(bmtitle,bmfullurl,idValue)
@@ -315,8 +334,8 @@
         li.innerHTML =
         '<div class="dogEarBox closed">'+ // bookmarkBox
           '<div class="dogEar closed"></div>'+
-          '<img class="bookmarkEditBtn" src="icons/edit_btn.png" width="56" height="56" vspace="7" hspace="5">'+
-          '<img class="bookmarkDeleteBtn" src="icons/delete_btn.png" width="56" height="56" vspace="7" hspace="5" >'+
+          '<img class="bookmarkEditBtn" src="/bookmarkview/edit_btn.png" width="56" height="56" vspace="7" hspace="5">'+
+          '<img class="bookmarkDeleteBtn" src="/bookmarkview/delete_btn.png" width="56" height="56" vspace="7" hspace="5" >'+
         '</div>'+
         '<div class="bookmarkItem" style="width:'+_width+'px;">'+
           '<span class="aTitle">'+bmtitle+'</span>'+
@@ -361,10 +380,13 @@
                     new LongPress(li.id, _longPress, _longPressStarted, 250);
                 else
                     new LongPress(li.id, _longPress, _longPressStarted, 550);
-                		
+                        
                 __bookmarkCount++;
             }
-        } catch(E) { alert(E); }
+        } catch(E) {
+              _displayError("Bookmarks unavailable");  // Localize!
+            app.debug("bookmarkView.js:_createBookmarkView: " + E); 
+        }
 
         _dragInit();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,110 @@
+body {
+    padding : 0px;
+    margin : 0px;
+    height:100%;
+  /*decorations*/
+  color: #cccccc;
+  background-color: black;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;}
+
+#BottomPad {
+ padding: 8px 10px 8px 10px;
+ height: 54px;
+}
+
+.bookmarkList li.selected {
+  /*background-image: url(/bookmarkview/list_itembg_pressed.png);*/
+    font-weight: bold;
+}
+
+/* DogEar open, unselected */
+.bookmarkList .dogEar {
+    height: 70px;
+    background-repeat: no-repeat;
+    float: left;
+  background-image: url(/bookmarkview/dogear_open.png);
+    width: 67px;
+}
+
+/* DogEarBox open, unselected */
+.bookmarkList .dogEarBox {
+    height: 70px;
+    background-repeat: repeat-x;
+  background-image: url(/bookmarkview/dogear_open_bg.png);
+    float:right;
+    z-index:30;
+}
+
+.bookmarkList .dogEar.selected {
+  background-image: url(/bookmarkview/dogear_pressed.png);
+}
+
+.bookmarkList .dogEarBox.selected {
+  /*background-image: url(/bookmarkview/dogear_open_bg_pressed.png);*/
+}
+
+.bookmarkList .dogEar.closed {
+  /*background-image: url(/bookmarkview/dogear.png);*/
+    width: 51px;
+}
+
+.bookmarkList .dogEarBox.closed {
+    width: 51px;
+}
+
+div.bookmarkList ul{
+    list-style-type: none;
+    margin: 0px;
+    padding: 0px;
+    overflow: hidden;
+}
+
+.bookmarkList li {
+    height: 70px;
+  /*background-image: url(/bookmarkview/list_itembg.png);*/
+    background-repeat: repeat-x;
+    overflow: hidden;
+  -webkit-user-select: none;
+}
+
+.bookmarkList li:active {
+  /*background-image: url(/bookmarkview/list_itembg_pressed.png);*/
+}
+
+div.bookmarkItem {
+    margin-top: 15px;
+    float:left;
+    z-index:28;
+    /*background-repeat: no-repeat;
+    background-position: 10px 15px;*/
+    padding-left: 10px;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+
+}
+.bookmarkList div.bookmarkItem:active {
+    font-weight: bold;
+}
+
+span.aTitle{
+  /*decorations*/
+  color: white;
+  /*font specification*/
+  font-size: 24px;
+  font-style: bold;
+}
+
+span.aUrl{
+  /*decorations*/
+  color: #cccccc;
+  /*font specification*/
+  font-size: 20px;
+  font-style: bold;
+}
+
+.hiddenLoadImages { 
+  background-image: url(/bookmarkview/dogear_open.png);
+    visibility: hidden;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewTenone.js	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,468 @@
+var __prevOpenedBookmarkControl = null;
+var __previousSortEle = null;
+var __bookmarkCount= 0;
+var __dragendFlag = false;
+var __dogearSelected = false;
+var __timerValueLeft = 0;
+var __timerId = "";
+var __longPressEvent = false;
+// Set to the LongPress object that is currently waiting for activation,
+// ie. it has gotten a mouse-down event and has its timer running.
+var __currentLongPress;
+var __cancelLinkOpening = false;
+
+var __closed = true;
+
+function _displayError(text) {
+    var el = document.getElementById("errorText");
+    el.style.visibility = "visible";
+    el.style.width = "100%";
+    el.style.height = "100%";
+    el.innerHTML = "<p>" + text;
+}
+
+function _clearError(text) {
+    var el = document.getElementById("errorText");
+    el.style.visibility = "hidden";
+    el.style.width = "0";
+    el.style.height = "0";
+    el.innerHTML = "";
+}
+
+function _enableSorting(ele) {
+    // This is messy, why do we even need to do this sort/no-sort stuff???
+    $(ele).removeClass('no-sort');
+    $(ele).addClass('sort');
+		
+	var evt = document.createEvent("MouseEvents");
+	evt.initMouseEvent("mousedown", true, true, window,
+	  0, 0, 0, gInitialX, gInitialY, false, false, false, false, 0, null);
+	var canceled = !ele.dispatchEvent(evt);
+    
+  	views.WebView.gesturesEnabled = false;
+
+    $(ele).find(".dogEarBox").addClass('selected');
+    $(ele).find(".dogEar").addClass('selected');
+
+  __sortingEnabled = true;
+  __sortEleOffsetTop = ele.offsetTop;
+  __previousSortEle = ele;
+    $(ele).toggleClass('highlight');
+
+  }
+
+function _disableSorting(ele) {
+//    app.debug('disablesorting:'); printProp(ele);
+
+    views.WebView.gesturesEnabled = true;
+    
+    $(ele).removeClass('sort');
+    $(ele).addClass('no-sort');
+    $(ele).find('.dogEarBox').removeClass('selected').addClass('closed');
+    $(ele).find('.dogEar').removeClass('selected').addClass('closed');
+
+    __sortingEnabled = false;
+    __sortEleOffsetTop = 0;
+    __previousSortEle = null;
+}
+
+function _dragInit()
+{
+    $("#bookmarkListTree").sortable({
+        placeholder: 'ui-state-highlight',
+        axis:'y',
+        cancel : 'li.no-sort',
+        scrollSensitivity : 40,
+        scrollSpeed : 40,
+        start: function(event, ui) {
+            __dragendFlag = true;
+        },
+        update: function(event, ui) {
+                var sortedBookmark = ui.item[0];
+                _disableSorting(sortedBookmark); // Unselect it
+                // If there's only one bookmark in the list, do nothing
+                if ($('#bookmarkListTree').children().length == 0)
+                    return;
+                var nextBookmark = $(sortedBookmark).next()[0];
+                var bm = window.bookmarksController.findBookmark(sortedBookmark.id);
+                // If it wasn't moved to the end, change the sortIndex to the next bookmark's sortIndex and the rest will propagate down
+                if (nextBookmark) {
+                    var nextbm = window.bookmarksController.findBookmark(nextBookmark.id);
+                    window.bookmarksController.reorderBookmark(sortedBookmark.id, nextbm.sortIndex);
+                }
+                // It was moved to the end, so change the sortIndex to the prev bookmark's sortIndex + 1
+                else {
+                    var prevBookmark = $(sortedBookmark).prev()[0];
+                    var prevbm = window.bookmarksController.findBookmark(prevBookmark.id);
+                    window.bookmarksController.reorderBookmark(sortedBookmark.id, prevbm.sortIndex+1);
+                }
+        }
+
+    });
+
+    $("#bookmarkListTree").sortable('enable');
+    $("#bookmarkListTree").disableSelection();
+}
+
+function _longPress(ele) {
+
+	__longPressEvent = true;
+	if(__timerId != "")
+	{
+		window.clearTimeout(__timerId);
+		__timerId = "";
+	}
+	if (__sortingEnabled)
+	{
+		_disableSorting(__previousSortEle)
+		return false;
+	}
+
+    if ( $(ele).find('.dogEarBox').hasClass('closed') ) {
+        if ( __closed ) {
+            //_bookmarkHideControl(__prevOpenedBookmarkControl, true );
+        } else {
+            _bookmarkHideControl(__prevOpenedBookmarkControl, true );
+        }
+    } else {
+        if (ele.parentNode)
+        {
+            _bookmarkHideControl(ele, false );
+            __closed = true;
+        }
+    }
+
+	if(!__dogearSelected)
+ 		_enableSorting(ele);
+}
+
+function _timeLeft() {
+
+	__timerValueLeft = 1;
+}
+function _longPressStarted(lp)
+{
+    __timerValueLeft = 0;
+    __longPressEvent = false;
+    if(!window.views.WebView.bedrockTiledBackingStoreEnabled())
+    {
+        __timerId = window.setTimeout("_timeLeft()",250);
+    }
+    else
+    {
+        __timerId = window.setTimeout("_timeLeft()",550);
+    }
+    // Remember the current LongPress object so we can cancel it if scrolling
+    // starts.
+    __currentLongPress = lp;
+    __cancelLinkOpening = false;
+
+}
+
+function _handlePanStarted(type)
+{
+   if(app.ui() != "maemo5_ui") // workaround for Maemo Issue
+   {
+			__cancelLinkOpening = true;
+	 }
+		
+    // Scrolling started, cancel the LongPress.
+      if (__currentLongPress != undefined) {
+        __currentLongPress.cancel();
+        __currentLongPress = undefined;
+    }
+}
+
+
+function _bookmarkHideControl(ele, is_forward){
+    var dogEarBox = $(ele).find('.dogEarBox');
+    var dogEar = $(ele).find('.dogEar');
+     
+    dogEarBox.addClass('closed');
+    dogEar.addClass('closed');
+    $(ele).find('.bookmarkItem').css('width', (parseInt(window.innerWidth)-70)+"px");
+    
+    if ( is_forward )
+        dogEar.css('background-image', 'url(/bookmarkview/dogear.png)');
+    else
+        dogEar.css('background-image', 'url(/bookmarkview/dogear_pressed.png)');
+}
+
+function _bookmarkToggleControls(event){
+    var ele = event.target;
+    try {
+        if(__timerId != "")
+        {
+        	window.clearTimeout(__timerId);
+        	__timerId = "";
+        }
+        if (__sortingEnabled && ele.parentNode.parentNode!=__previousSortEle)
+        {
+            _disableSorting(__previousSortEle)
+            return false;
+        }
+        else if (__sortingEnabled && (ele.parentNode.parentNode==__previousSortEle))
+        {
+            return false;
+        }
+        if(__timerValueLeft == 1 || __longPressEvent == true)
+        {
+            __timerValueLeft = 0;
+            __longPressEvent = false;
+            return false;
+        }
+        __timerValueLeft = 0;
+
+        var li = $(ele).parents('li');
+        var dogEarBox = li.find('.dogEarBox');
+        dogEarBox.toggleClass('closed');
+        dogEarBox.find('.dogEar').toggleClass('closed');
+        // It's too bad we can't do this via margin-right because then we could just do it in the .css file coz it would be a static value
+        if (dogEarBox.hasClass('closed')) {
+            li.find('.bookmarkItem').css('width', (parseInt(window.innerWidth)-70)+"px");
+            dogEarBox.find('.dogEar').css('background-image', 'url(/bookmarkview/dogear_pressed.png)');
+            __closed = true;
+        }
+        else {
+            li.find('.bookmarkItem').css('width', (parseInt(window.innerWidth)-220)+"px");
+            dogEarBox.find('.dogEar').css('background-image', 'url(/bookmarkview/dogear_open_pressed.png)');
+            __closed = false;
+        }
+        if (__prevOpenedBookmarkControl != null && __prevOpenedBookmarkControl != ele.parentNode.parentNode)
+            _bookmarkHideControl(__prevOpenedBookmarkControl, true);
+
+    }catch(e) { alert(e); }
+
+    __prevOpenedBookmarkControl = ele.parentNode.parentNode;
+}
+
+function _addNewBookmark(bmtitle,bmurl,bmid)
+{
+    // bookmark title/url may have been altered by the controller's add method (i.e. to include http://) so reload it
+    var bm = window.bookmarksController.findBookmark(bmid);
+    bmtitle = bm.title;
+    bmurl = bm.url;
+    if(__timerId != "")
+    {
+        window.clearTimeout(__timerId);
+        __timerId = "";
+    }
+	if(__prevOpenedBookmarkControl)
+  		_bookmarkHideControl(__prevOpenedBookmarkControl);
+
+    if(__previousSortEle    != null)
+        _disableSorting(__previousSortEle)
+
+    __bookmarkCount += 1;
+    //create element and add it to bookmark view
+    var ul=document.getElementById('bookmarkListTree');
+    var dbgTitle = bmtitle.replace(/'/g, "&#39");
+    dbgTitle = dbgTitle.replace(/"/g, "&#34");
+    var li = _createBookmarkElement(dbgTitle,bmurl,bmid);
+	$(li).addClass('no-sort');
+	ul.insertBefore(li, ul.firstChild);
+    ul.childNodes[ul.childNodes.length-1].focus();
+    
+    if (!window.views.WebView.bedrockTiledBackingStoreEnabled())
+        new LongPress(li.id, _longPress, _longPressStarted, 250);
+    else
+        new LongPress(li.id, _longPress, _longPressStarted, 550);
+
+    $('html, body').animate({
+                        scrollTop: 0}, 1000);
+}
+
+function _editBookmark(bmtitle,bmurl,bmid)
+{
+    if(__prevOpenedBookmarkControl)
+        _bookmarkHideControl(__prevOpenedBookmarkControl);
+
+    // bookmark title/url may have been altered by the controller's edit method (i.e. to include http://) so reload it
+    var bm = window.bookmarksController.findBookmark(bmid);
+
+    $('#'+bmid).find('.aTitle').text(bm.title);
+    $('#'+bmid).find('.aUrl').text(bm.url);
+}
+
+function _launchEditBookmark(r,bmtitle,bmurl,id)
+{
+		// bookmark title/url may have been altered by the controller's edit method, so reload it
+    var bm = window.bookmarksController.findBookmark(id);
+    window.bookmarksController.showBookmarkEditDialog(bm.title,bm.url,id);
+}
+
+function _deleteBookmark(r,bmid)
+{ 
+  window.bookmarksController.deleteBookmark(bmid);
+  $('#'+bmid).remove();
+}
+
+function _openUrl(ele, bmid) {
+    if(__timerId != "")
+    {
+       window.clearTimeout(__timerId);
+        __timerId = "";
+    }
+    // DragStart & DragEnd listeners are defined at bottom
+    if (__sortingEnabled && (ele.parentNode!=__previousSortEle))
+    {
+        _disableSorting(__previousSortEle)
+        return false;
+    }
+    else if (__sortingEnabled && (ele.parentNode==__previousSortEle))
+        {
+            return false;
+        }
+    else if (__dragendFlag)
+    {
+        __dragendFlag = false;
+        return false;
+    }
+    else if(__cancelLinkOpening)
+    {
+    	__cancelLinkOpening = false;
+    	return false;
+    }
+
+    window.views.WebView.showNormalPage();
+    window.ViewStack.switchView( "WebView","BookmarkTreeView");
+
+    // Laod a page to chrome view
+    // bookmark title/url may have been altered by the controller's edit method, so reload it
+    var bm = window.bookmarksController.findBookmark(bmid);
+    window.views.WebView.loadUrlToCurrentPage(bm.url);
+    views.WebView.gesturesEnabled = true;
+}
+
+function _updateBookmarkViewGoemetry(displayMode)
+{
+    // It's too bad we couldn't use margin-right instead of width coz then we could just put a static value in the .css file and not even need to do anything
+    $('.dogEarBox.closed').next('.bookmarkItem').css('width', (parseInt(window.innerWidth)-70)+"px");
+    $('.dogEarBox').not('.closed').next('.bookmarkItem').css('width', (parseInt(window.innerWidth)-220)+"px");
+}
+
+function _setDogear()
+{
+	__dogearSelected = true;
+}
+
+function _unsetDogear()
+{
+	__dogearSelected = false;
+}
+
+function _changeDogearBackground(ele, bmid, img, img1) {
+
+    $('#'+bmid).css('background-image', img1);
+
+    $('#'+bmid).find('.dogEar').css('background-image', img);
+   	
+}
+
+function _changeBookmarkItemBackground(ele, bmid, img, img1, img2) {
+
+    $('#'+bmid).css('background-image', img);
+
+    if (img1 != '' && img2 != '')
+    {
+        var dogEarBox =  $('#'+bmid).find('.dogEarBox');
+     	if (dogEarBox.hasClass('closed')) {
+            $('#'+bmid).find('.dogEar.closed').css('background-image', img1);
+        } else {
+            $('#'+bmid).find('.dogEar').not('.closed').css('background-image', img2);
+        }
+    }
+
+}
+
+function _createBookmarkElement(bmtitle,bmfullurl,idValue)
+{
+        var _width = parseInt(window.innerWidth)-70;
+        var escapedTitle = bmtitle.replace(/&#39/g, "\\'"); 
+        var li=document.createElement('li');
+        li.id = idValue;
+        li.innerHTML =
+        '<div class="dogEarBox closed">'+ // bookmarkBox
+          '<div class="dogEar closed"></div>'+
+          '<img class="bookmarkEditBtn" src="/bookmarkview/edit_btn.png" width="56" height="56" vspace="7" hspace="5">'+
+          '<img class="bookmarkDeleteBtn" src="/bookmarkview/delete_btn.png" width="56" height="56" vspace="7" hspace="5" >'+
+        '</div>'+
+        '<div class="bookmarkItem" style="width:'+_width+'px;">'+
+          '<span class="aTitle">'+bmtitle+'</span>'+
+          '<br/>'+
+          '<span class="aUrl">'+bmfullurl+'</span>'+
+        '</div>';
+        $(li).find('.dogEar.closed').css('background-image', 'url(/bookmarkview/dogear.png)');
+        $(li).css('background-image', 'url(/bookmarkview/list_itembg.png)');
+        $(li).find(".dogEar")
+               .click(_bookmarkToggleControls)
+               .mouseover(function (event) {_changeBookmarkItemBackground(event.target, idValue, 'url(/bookmarkview/list_itembg_pressed.png)', 'url(/bookmarkview/dogear_pressed.png)', 'url(/bookmarkview/dogear_open_pressed.png)'); _setDogear();})
+               .mouseout(function (event) {_changeBookmarkItemBackground(event.target, idValue, 'url(/bookmarkview/list_itembg.png)', 'url(/bookmarkview/dogear.png)', 'url(/bookmarkview/dogear_open.png)'); _unsetDogear(); __prevOpenedBookmarkControl = event.target.parentNode.parentNode;});
+        $(li).find(".bookmarkItem").
+               click(function (event) {_openUrl(event.target, idValue);});
+        $(li).find(".bookmarkEditBtn").
+               click(function (event) {_launchEditBookmark(event.target, bmtitle, bmfullurl, idValue);});
+        $(li).find(".bookmarkDeleteBtn").
+               click(function (event) {_deleteBookmark(event.target, idValue);});
+
+        $(li).find(".bookmarkItem").
+               mouseover(function (event) {_changeDogearBackground(event.target, idValue, 'url(/bookmarkview/dogear_pressed.png)', 'url(/bookmarkview/list_itembg_pressed.png)');});
+        $(li).find(".bookmarkItem").
+               mouseout(function (event) {_changeDogearBackground(event.target, idValue, 'url(/bookmarkview/dogear.png)', 'url(/bookmarkview/list_itembg.png)'); __prevOpenedBookmarkControl = event.target.parentNode.parentNode;});
+
+        return li;
+}
+
+function _createBookmarkView()
+{
+        try
+        {
+            __currentLongPress = undefined;
+            //Get bookmarks data from database
+            window.bookmarksController.findAllBookmarks();
+            var ul=document.getElementById('bookmarkListTree');
+            while (window.bookmarksController.hasMoreBookmarks())
+            {
+                var bm = window.bookmarksController.nextBookmark();
+                var bmurl = bm.url;
+                var bmtitle = bm.title;
+                var id = bm.id;
+
+                //create element and add it to bookmark view
+                var li = _createBookmarkElement(bmtitle,bmurl,id);
+                $(li).addClass('no-sort');
+                ul.appendChild(li);
+                ul.childNodes[0].focus();
+                if (!window.views.WebView.bedrockTiledBackingStoreEnabled())
+                    new LongPress(li.id, _longPress, _longPressStarted, 250);
+                else
+                    new LongPress(li.id, _longPress, _longPressStarted, 550);
+                		
+                __bookmarkCount++;
+            }
+        } catch(E) {
+        	  _displayError("Bookmarks unavailable");  // Localize!
+            app.debug("bookmarkView.js:_createBookmarkView: " + E); 
+        }
+
+        _dragInit();
+}
+
+function launchBookmarkView()
+{
+     __closed = true;
+    try{
+        window.chrome.aspectChanged.connect(_updateBookmarkViewGoemetry);
+        window.bookmarksController.bookmarkAdded.connect(_addNewBookmark);
+        window.bookmarksController.bookmarkModified.connect(_editBookmark);
+
+        // Get Bookmarks from the database
+        _createBookmarkView();
+
+        // Watch for the start of scrolling in the view so we can cancel the
+        // long presses to prevent them from interfere with scrolling.  Otherwise
+        // the long press callback will fire and trigger sortable mode.
+        views.WebView.startingPanGesture.connect(_handlePanStarted);
+
+    }catch(e){ alert(e); }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewmaemo.js	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,419 @@
+var __prevOpenedBookmarkControl = null;
+var __previousSortEle = null;
+var __bookmarkCount= 0;
+var __dragendFlag = false;
+var __dogearSelected = false;
+var __timerValueLeft = 0;
+var __timerId = "";
+var __longPressEvent = false;
+// Set to the LongPress object that is currently waiting for activation,
+// ie. it has gotten a mouse-down event and has its timer running.
+var __currentLongPress;
+var __cancelLinkOpening = false;
+
+
+function _displayError(text) {
+    var el = document.getElementById("errorText");
+    el.style.visibility = "visible";
+    el.style.width = "100%";
+    el.style.height = "100%";
+    el.innerHTML = "<p>" + text;
+}
+
+function _clearError(text) {
+    var el = document.getElementById("errorText");
+    el.style.visibility = "hidden";
+    el.style.width = "0";
+    el.style.height = "0";
+    el.innerHTML = "";
+}
+
+function _enableSorting(ele) {
+    // This is messy, why do we even need to do this sort/no-sort stuff???
+    $(ele).removeClass('no-sort');
+    $(ele).addClass('sort');
+		
+	var evt = document.createEvent("MouseEvents");
+	evt.initMouseEvent("mousedown", true, true, window,
+	  0, 0, 0, gInitialX, gInitialY, false, false, false, false, 0, null);
+	var canceled = !ele.dispatchEvent(evt);
+    
+  	views.WebView.gesturesEnabled = false;
+
+    $(ele).find(".dogEarBox").addClass('selected');
+    $(ele).find(".dogEar").addClass('selected');
+
+  __sortingEnabled = true;
+  __sortEleOffsetTop = ele.offsetTop;
+  __previousSortEle = ele;
+    $(ele).toggleClass('highlight');
+
+  }
+
+function _disableSorting(ele) {
+//    app.debug('disablesorting:'); printProp(ele);
+
+    views.WebView.gesturesEnabled = true;
+    
+    $(ele).removeClass('sort');
+    $(ele).addClass('no-sort');
+    $(ele).find('.dogEarBox').removeClass('selected').addClass('closed');
+    $(ele).find('.dogEar').removeClass('selected').addClass('closed');
+
+    __sortingEnabled = false;
+    __sortEleOffsetTop = 0;
+    __previousSortEle = null;
+}
+
+function _dragInit()
+{
+    $("#bookmarkListTree").sortable({
+        placeholder: 'ui-state-highlight',
+        axis:'y',
+      cancel : 'li.no-sort',
+      scrollSensitivity : 40,
+      scrollSpeed : 40,
+        start: function(event, ui) {
+            __dragendFlag = true;
+            },
+      update: function(event, ui) {
+                var sortedBookmark = ui.item[0];
+                _disableSorting(sortedBookmark); // Unselect it
+                // If there's only one bookmark in the list, do nothing
+                if ($('#bookmarkListTree').children().length == 0)
+                    return;
+                var nextBookmark = $(sortedBookmark).next()[0];
+                var bm = window.bookmarksController.findBookmark(sortedBookmark.id);
+                // If it wasn't moved to the end, change the sortIndex to the next bookmark's sortIndex and the rest will propagate down
+                if (nextBookmark) {
+                    var nextbm = window.bookmarksController.findBookmark(nextBookmark.id);
+                    window.bookmarksController.reorderBookmark(sortedBookmark.id, nextbm.sortIndex);
+                }
+                // It was moved to the end, so change the sortIndex to the prev bookmark's sortIndex + 1
+                else {
+                    var prevBookmark = $(sortedBookmark).prev()[0];
+                    var prevbm = window.bookmarksController.findBookmark(prevBookmark.id);
+                    window.bookmarksController.reorderBookmark(sortedBookmark.id, prevbm.sortIndex+1);
+                }
+            }
+    });
+
+    $("#bookmarkListTree").sortable('enable');
+    $("#bookmarkListTree").disableSelection();
+}
+
+function _longPress(ele)
+{
+   __longPressEvent = true;
+   if(__timerId != "")
+   {
+       window.clearTimeout(__timerId);
+       __timerId = "";
+   }
+  if (__sortingEnabled)
+  {
+            _disableSorting(__previousSortEle)
+            return false;
+  }
+
+  if(__prevOpenedBookmarkControl)
+  	_bookmarkHideControl(__prevOpenedBookmarkControl);
+  	
+    if(!__dogearSelected)
+     _enableSorting(ele);
+}
+
+function _timeLeft()
+{
+   __timerValueLeft = 1;
+}
+function _longPressStarted(lp)
+{
+    __timerValueLeft = 0;
+    __longPressEvent = false;
+    if(!window.views.WebView.bedrockTiledBackingStoreEnabled())
+    {
+        __timerId = window.setTimeout("_timeLeft()",250);
+    }
+    else
+    {
+        __timerId = window.setTimeout("_timeLeft()",550);
+    }
+    // Remember the current LongPress object so we can cancel it if scrolling
+    // starts.
+    __currentLongPress = lp;
+    __cancelLinkOpening = false;
+}
+
+function _handlePanStarted(type)
+{
+   if(app.ui() != "maemo5_ui") // workaround for Maemo Issue
+   {
+			__cancelLinkOpening = true;
+	 }
+		
+    // Scrolling started, cancel the LongPress.
+      if (__currentLongPress != undefined) {
+        __currentLongPress.cancel();
+        __currentLongPress = undefined;
+    }
+}
+
+
+function _bookmarkHideControl(ele){
+    $(ele).find('.dogEarBox').addClass('closed');
+    $(ele).find('.dogEar').addClass('closed');
+    $(ele).find('.bookmarkItem').css('width', (parseInt(window.innerWidth)-70)+"px");
+}
+
+function _bookmarkToggleControls(event){
+    var ele = event.target;
+    try {
+        if(__timerId != "")
+        {
+        	window.clearTimeout(__timerId);
+        	__timerId = "";
+        }
+        if (__sortingEnabled && ele.parentNode.parentNode!=__previousSortEle)
+        {
+            _disableSorting(__previousSortEle)
+            return false;
+        }
+        else if (__sortingEnabled && (ele.parentNode.parentNode==__previousSortEle))
+        {
+            return false;
+        }
+        if(__timerValueLeft == 1 || __longPressEvent == true)
+        {
+            __timerValueLeft = 0;
+            __longPressEvent = false;
+            return false;
+        }
+        __timerValueLeft = 0;
+
+        var li = $(ele).parents('li');
+        var dogEarBox = li.find('.dogEarBox');
+        dogEarBox.toggleClass('closed');
+        dogEarBox.find('.dogEar').toggleClass('closed');
+        // It's too bad we can't do this via margin-right because then we could just do it in the .css file coz it would be a static value
+        if (dogEarBox.hasClass('closed')) {
+            li.find('.bookmarkItem').css('width', (parseInt(window.innerWidth)-70)+"px");
+        }
+        else {
+            li.find('.bookmarkItem').css('width', (parseInt(window.innerWidth)-220)+"px");
+        }
+        if (__prevOpenedBookmarkControl != null && __prevOpenedBookmarkControl != ele.parentNode.parentNode)
+            _bookmarkHideControl(__prevOpenedBookmarkControl);
+
+    }catch(e) { alert(e); }
+
+    __prevOpenedBookmarkControl = ele.parentNode.parentNode;
+}
+
+function _addNewBookmark(bmtitle,bmurl,bmid)
+{
+    // bookmark title/url may have been altered by the controller's add method (i.e. to include http://) so reload it
+    var bm = window.bookmarksController.findBookmark(bmid);
+    bmtitle = bm.title;
+    bmurl = bm.url;
+    if(__timerId != "")
+    {
+        window.clearTimeout(__timerId);
+        __timerId = "";
+    }
+	if(__prevOpenedBookmarkControl)
+  		_bookmarkHideControl(__prevOpenedBookmarkControl);
+
+    if(__previousSortEle    != null)
+        _disableSorting(__previousSortEle)
+
+    __bookmarkCount += 1;
+    //create element and add it to bookmark view
+    var ul=document.getElementById('bookmarkListTree');
+    var dbgTitle = bmtitle.replace(/'/g, "&#39");
+    dbgTitle = dbgTitle.replace(/"/g, "&#34");
+    var li = _createBookmarkElement(dbgTitle,bmurl,bmid);
+	$(li).addClass('no-sort');
+	ul.appendChild(li);
+    ul.childNodes[ul.childNodes.length-1].focus();
+    
+    if (!window.views.WebView.bedrockTiledBackingStoreEnabled())
+        new LongPress(li.id, _longPress, _longPressStarted, 250);
+    else
+        new LongPress(li.id, _longPress, _longPressStarted, 550);
+
+    $('html, body').animate({
+                        scrollTop: 0}, 1000);
+}
+
+function _editBookmark(bmtitle,bmurl,bmid)
+{
+    if(__prevOpenedBookmarkControl)
+        _bookmarkHideControl(__prevOpenedBookmarkControl);
+
+    // bookmark title/url may have been altered by the controller's edit method (i.e. to include http://) so reload it
+    var bm = window.bookmarksController.findBookmark(bmid);
+
+    $('#'+bmid).find('.aTitle').text(bm.title);
+    $('#'+bmid).find('.aUrl').text(bm.url);
+}
+
+function _launchEditBookmark(r,bmtitle,bmurl,id)
+{
+    window.bookmarksController.showBookmarkEditDialog(bmtitle,bmurl,id);
+}
+
+function _deleteBookmark(r,bmid)
+{ 
+  window.bookmarksController.deleteBookmark(bmid);
+  $('#'+bmid).remove();
+}
+
+
+function _openUrl(ele, newUrl) {
+    if(__timerId != "")
+    {
+       window.clearTimeout(__timerId);
+        __timerId = "";
+    }
+    // DragStart & DragEnd listeners are defined at bottom
+    if (__sortingEnabled && (ele.parentNode!=__previousSortEle))
+    {
+        _disableSorting(__previousSortEle)
+        return false;
+    }
+    else if (__sortingEnabled && (ele.parentNode==__previousSortEle))
+        {
+            return false;
+        }
+    else if (__dragendFlag)
+    {
+        __dragendFlag = false;
+        return false;
+    }
+    else if(__cancelLinkOpening)
+    {
+    	__cancelLinkOpening = false;
+    	return false;
+    }
+
+    window.views.WebView.showNormalPage();
+    window.ViewStack.switchView( "WebView","BookmarkTreeView");
+
+    // Laod a page to chrome view
+    window.views.WebView.loadUrlToCurrentPage(newUrl);
+    views.WebView.gesturesEnabled = true;
+}
+
+function _updateBookmarkViewGoemetry(displayMode)
+{
+    // It's too bad we couldn't use margin-right instead of width coz then we could just put a static value in the .css file and not even need to do anything
+    $('.dogEarBox.closed').next('.bookmarkItem').css('width', (parseInt(window.innerWidth)-70)+"px");
+    $('.dogEarBox').not('.closed').next('.bookmarkItem').css('width', (parseInt(window.innerWidth)-220)+"px");
+}
+
+function _setDogear()
+{
+	__dogearSelected = true;
+}
+
+function _unsetDogear()
+{
+	__dogearSelected = false;
+}
+
+function _createBookmarkElement(bmtitle,bmfullurl,idValue)
+{
+        var dogEar;
+        var _width = parseInt(window.innerWidth)-70;
+        var escapedTitle = bmtitle.replace(/&#39/g, "\\'"); 
+        var li=document.createElement('li');
+        li.id = idValue;
+        if (app.ui() == "maemo5_ui"){
+        dogEar = 
+        '<div class="dogEarBox closed">'+ // bookmarkBox
+          '<div class="dogEar closed"></div>'+
+          '<img class="bookmarkEditBtn" src="iconsMaemo/edit_btn.png" width="56" height="56" vspace="7" hspace="5">'+
+          '<img class="bookmarkDeleteBtn" src="iconsMaemo/delete_btn.png" width="56" height="56" vspace="7" hspace="5" >'+
+        '</div>';
+        } else {
+        dogEar = 
+        '<div class="dogEarBox closed">'+ // bookmarkBox
+          '<div class="dogEar closed"></div>'+
+          '<img class="bookmarkEditBtn" src="icons/edit_btn.png" width="56" height="56" vspace="7" hspace="5">'+
+          '<img class="bookmarkDeleteBtn" src="icons/delete_btn.png" width="56" height="56" vspace="7" hspace="5" >'+
+        '</div>';
+        }
+        var bookmark = 
+        '<div class="bookmarkItem" style="width:'+_width+'px;">'+
+          '<span class="aTitle">'+bmtitle+'</span>'+
+          '<br/>'+
+          '<span class="aUrl">'+bmfullurl+'</span>'+
+        '</div>';
+        li.innerHTML = dogEar + bookmark;
+        $(li).find(".dogEar")
+               .click(_bookmarkToggleControls)
+               .mouseover(_setDogear)
+               .mouseout(_unsetDogear);
+        $(li).find(".bookmarkItem").
+               click(function (event) {_openUrl(event.target, bmfullurl);});
+        $(li).find(".bookmarkEditBtn").
+               click(function (event) {_launchEditBookmark(event.target, bmtitle, bmfullurl, idValue);});
+        $(li).find(".bookmarkDeleteBtn").
+               click(function (event) {_deleteBookmark(event.target, idValue);});
+
+        return li;
+}
+
+function _createBookmarkView()
+{
+        try
+        {
+            __currentLongPress = undefined;
+            //Get bookmarks data from database
+            window.bookmarksController.findAllBookmarks();
+            var ul=document.getElementById('bookmarkListTree');
+            while (window.bookmarksController.hasMoreBookmarks())
+            {
+                var bm = window.bookmarksController.nextBookmark();
+                var bmurl = bm.url;
+                var bmtitle = bm.title;
+                var id = bm.id;
+
+                //create element and add it to bookmark view
+                var li = _createBookmarkElement(bmtitle,bmurl,id);
+                $(li).addClass('no-sort');
+                ul.appendChild(li);
+                ul.childNodes[0].focus();
+                if (!window.views.WebView.bedrockTiledBackingStoreEnabled())
+                    new LongPress(li.id, _longPress, _longPressStarted, 250);
+                else
+                    new LongPress(li.id, _longPress, _longPressStarted, 550);
+                		
+                __bookmarkCount++;
+            }
+        } catch(E) {
+        	  _displayError("Bookmarks unavailable");  // Localize!
+            app.debug("bookmarkView.js:_createBookmarkView: " + E); 
+        }
+
+        _dragInit();
+}
+
+function launchBookmarkView()
+{
+    try{
+        window.chrome.aspectChanged.connect(_updateBookmarkViewGoemetry);
+        window.bookmarksController.bookmarkAdded.connect(_addNewBookmark);
+        window.bookmarksController.bookmarkModified.connect(_editBookmark);
+
+        // Get Bookmarks from the database
+        _createBookmarkView();
+
+        // Watch for the start of scrolling in the view so we can cancel the
+        // long presses to prevent them from interfere with scrolling.  Otherwise
+        // the long press callback will fire and trigger sortable mode.
+        views.WebView.startingPanGesture.connect(_handlePanStarted);
+
+    }catch(e){ alert(e); }
+}
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/circle_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/delete_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_cross.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_cross_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_tick.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_tick_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/edit_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/icon_add.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/icon_add_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/icon_add_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/list_itembg.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/list_itembg_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/menu_icon_bookmarks.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/yes_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/yes_selected.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/yes_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/icons/yes_selected.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/add_bookmark_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/cc0d0d-hatch.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/delete_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_bottom.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_center.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_top.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/edit_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/menu_icon_bookmarks.png has changed
--- a/ginebra2/chrome/bedrockchrome/chrome.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/chrome.css	Fri Oct 15 17:30:59 2010 -0400
@@ -2,70 +2,73 @@
 
 /* Make chrome items appear to be non-selectable */
 ::selection {
+  /*decorations*/
   background: transparent;
-  color: inherit;
-}
+  color: inherit;}
 
 body {
-  margin:0px;
-  -webkit-user-select:none;
-}
+  /*margins & paddings*/
+  margin: 0px;
+  /*webkit*/
+  -webkit-user-select: none;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;}
 
 #StatusBarChromeId {
- height: 26px;
-}
+  /*dimensions*/
+  height: 26px;}
 
-#UrlSearchChromeId, #TitleUrlId {
-  height: 44px;
-  padding-top: 5px; 
+#UrlSearchChromeId, 
+#TitleUrlId {
+  /*dimensions*/
+  height: 46px;
+  padding-top: 3px; 
   border-top-width: 0px; 
+  /*decorations*/
   border-top-color: #646f85;
+  border-bottom-color: #b0c4de;
   color:black; 
-  background-color: white; 
-  border-bottom-color: #b0c4de;
-}
-
-/*
-#ToolbarChromeId {
-  height: 50px;
-}
-*/
+  background-color: white;}
 
 #WindowCountBarId {
-  height: 26px;
-}
+  /*dimensions*/
+  height: 26px;}
 
 /* White-washed overlay. */
 #ShadingOverlayId {
-    background-color: #fff;
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    overflow:hidden;
-    left: 0;
-    right: 0;
-    top: 0;
-    opacity: 0.7;
-    z-index:-10;
-    display: block;
-}
+  /*dimensions*/
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  /*margins & paddings*/
+  left: 0;
+  right: 0;
+  top: 0;
+  /*decorations*/
+  background-color: #fff;
+  opacity: 0.7;
+  /*misc*/
+  overflow: hidden;
+  z-index: -10;
+  display: block;}
 
 /* Toolbar CSS */
-
-#WebViewToolbarId, #WindowViewToolbarId, #RecentUrlViewToolbarId, #BookmarkViewToolbarId, #SettingsViewToolbarId {
-  height:58px;
-  width:100%;
-
-  /* Need to specify border-style for width to have effect*/
-  border-style:solid;
-  border-top-color:#2A3447;
-  border-top-width:3px;
-
-  padding-top:4px;
-}
+#WebViewToolbarId, 
+#WindowViewToolbarId, 
+#RecentUrlViewToolbarId, 
+#BookmarkViewToolbarId, 
+#SettingsViewToolbarId {
+  /*dimensions*/
+  height: 58px;
+  width: 100%;
+  /*margins & paddings*/
+  padding-top: 4px;
+  border-top-width: 3px;
+  /*decorations*/
+  border-style: solid; /* Need to specify border-style for width to have effect*/
+  border-top-color: #2A3447;}
 
 .ButtonSnippet {
+  /*dimensions*/
   height: 58px;
-  width:58px;
-
-}
+  width: 58px;}
--- a/ginebra2/chrome/bedrockchrome/chrome.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/chrome.html	Fri Oct 15 17:30:59 2010 -0400
@@ -1,33 +1,41 @@
 <html>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="chrome.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="zoombar.snippet/zoombar.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="download.snippet/download.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="contextmenu.snippet/ContextMenu.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="bookmarkview.superpage/bookmarkDialog.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="historyview.superpage/clearhistorydialog.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="windowcount.snippet/windowcount.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="networkstatus.snippet/networkstatus.css">
- <link rel="stylesheet" id="CSSLink" type="text/css" href="outofmemory.snippet/outofmemorydialog.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="prompt.snippet/prompt.css">
 
 <head>
-  <script src="../js/Bind.js" type="text/javascript"></script>
-  <script src="../js/SimpleButton.js" type="text/javascript"></script>
-  <script src="statusbar.snippet/statusbar.js" type="text/javascript"></script>
-  <script src="networkstatus.snippet/networkstatus.js" type="text/javascript"></script>
-  <script src="prompt.snippet/prompt.js" type="text/javascript"></script>
-  <script src="zoombar.snippet/zoombar.js" type="text/javascript"></script>
-  <script src="download.snippet/download.js" type="text/javascript"></script>
-  <script src="windowcount.snippet/windowcount.js" type="text/javascript"></script>
-  <script src="bookmarkview.superpage/bookmarkDialog.js" type="text/javascript"></script>
-  <script src="historyview.superpage/clearhistorydialog.js" type="text/javascript"></script>
-  <script src="chrome.js" type="text/javascript"></script>
-  <script src="contextmenu.snippet/ContextMenu.js" type="text/javascript"></script>
-  <script src="contextmenu.snippet/ViewContextMenu.js" type="text/javascript"></script>
-  <script src="outofmemory.snippet/outofmemorydialog.js" type="text/javascript"></script>
-  <script type="text/javascript">
-     window.chrome.chromeComplete.connect(onChromeComplete);
-  </script>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/chrome/chrome.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/zoombar/zoombar.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/download/download.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/contextmenu/ContextMenu.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/bookmarkview/bookmarkDialog.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/historyview/clearhistorydialog.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/windowcount/windowcount.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/suggests/suggests.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/networkstatus/networkstatus.css">
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/outofmemory/outofmemorydialog.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/prompt/prompt.css">
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/settingsview/encodingdialog.css">
+ 
+ 	<script src="/chrome/jquery-1.4.2.min.js" type="text/javascript"></script>
+ 	<script src="/chrome/effects.core.js" type="text/javascript"></script>
+ 	<script src="/chrome/ui.core.js" type="text/javascript"></script>
+	<script src="/chrome/Bind.js" type="text/javascript"></script>
+	<script src="/chrome/SimpleButton.js" type="text/javascript"></script>
+	<script src="/chrome/chrome.js" type="text/javascript"></script>
+	<script src="/statusbar/statusbar.js" type="text/javascript"></script>
+	<script src="/networkstatus/networkstatus.js" type="text/javascript"></script>
+	<script src="/prompt/prompt.js" type="text/javascript"></script>
+	<script src="/zoombar/zoombar.js" type="text/javascript"></script>
+	<script src="/download/download.js" type="text/javascript"></script>
+	<script src="/windowcount/windowcount.js" type="text/javascript"></script>
+	<script src="/suggests/suggests.js" type="text/javascript"></script>
+	<script src="/bookmarkview/bookmarkDialog.js" type="text/javascript"></script>
+	<script src="/historyview/clearhistorydialog.js" type="text/javascript"></script>
+	<script src="/contextmenu/ContextMenu.js" type="text/javascript"></script>
+	<script src="/contextmenu/ViewContextMenu.js" type="text/javascript"></script>
+	<script src="/outofmemory/outofmemorydialog.js" type="text/javascript"></script>
+	<script src="/settingsview/encodingdialog.js" type="text/javascript"></script>
+	<script type="text/javascript">
+		window.chrome.chromeComplete.connect(onChromeComplete);
+	</script>
 </head>
 
 
@@ -40,17 +48,22 @@
   </div>
 
   <div class = "GinebraSnippet" id="StatusBarChromeId" name="statusbar" data-GinebraAnchor="AnchorTop" data-GinebraVisible="true">
-    <link rel="stylesheet" id="CSSLink" type="text/css" href="statusbar.snippet/statusbar.css"/>
+    <link rel="stylesheet" id="CSSLink" type="text/css" href="/statusbar/statusbar.css"/>
     <script type="text/javascript">
       var statusbar = new StatusBar();
     </script>
   </div>
-
-
+  
   <!-- Native UrlSearch -->
 
   <div class="GinebraSnippet" id="UrlSearchChromeId" name="urlsearch" data-GinebraNativeClass="UrlSearchSnippet" data-GinebraVisible="true">
   </div>
+  
+  <!-- Copy-Cut-Paste Menu -->
+  <div class = "GinebraSnippet" id="CopyCutPasteChromeId" name="copycutpaste" 
+    data-GinebraNativeClass="CopyCutPasteSnippet"
+    style="width: 245px; height: 62px">
+  </div>
 
   <div class = "GinebraSnippet" id="NetworkStatusChromeId" name="networkstatus" 
     data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter"
@@ -85,6 +98,13 @@
     data-GinebraNativeClass="PageSnippet"
     data-GinebraHidesContent="true"
     data-GinebraVisible="false">
+    <script type='text/javascript'>
+    	try {
+    		var searchSuggests = new Suggests();
+    	} catch(e) {
+    		app.debug(e);
+    	}
+    </script>
   </div>
 
   <div class = "GinebraSnippet" id="ZoomBarId" 
@@ -192,7 +212,8 @@
    </div>
  
  
- <div class="GinebraSnippet" id="BookmarkDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter">
+<!-- <div class="GinebraSnippet" id="BookmarkDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter"> -->
+ <div class="GinebraSnippet" id="BookmarkDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false">
   	<script type="text/javascript">
         addDialog = new bookmarkDialog();
     </script>    
--- a/ginebra2/chrome/bedrockchrome/chrome.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/chrome.js	Fri Oct 15 17:30:59 2010 -0400
@@ -1,4 +1,25 @@
+var BOOKMARKVIEW_PAGE = ":/bookmarkview/BookmarkView.html";
+var SETTINGSVIEW_PAGE = ":/settingsview/SettingsView.html";
+var HISTORYVIEW_PAGE = ":/historyview/historyView.html";
+var SUGGESTS_PAGE = "qrc:///suggests/suggests.html";
+
 var preLoadBookmarksDone=0;
+
+document.getElementsByClassName = function(class_name) {
+    var docList = this.all || this.getElementsByTagName('*');
+    var matchArray = new Array();
+
+    /*Create a regular expression object for class*/
+    var re = new RegExp("(?:^|\\s)"+class_name+"(?:\\s|$)");
+    for (var i = 0; i < docList.length; i++) {
+        if (re.test(docList[i].className) ) {
+            matchArray[matchArray.length] = docList[i];
+        }
+    }
+
+	return matchArray;
+}
+
 function calcToolbarPopAnchorOffset(anchoredSnippet,
                                     anchorToSnippet,
                                     xCenterOffset,
@@ -24,39 +45,67 @@
     return([xOffset,yOffset]);
 }
 
+function hidePopups(){
+	
+	  if (window.snippets.MostVisitedViewId.isVisible())
+          window.snippets.MostVisitedViewId.hide();
+           
+    if (window.snippets.SuggestsChromeId.isVisible()) {
+            window.snippets.SuggestsChromeId.hide(false);
+            views.WebView.enabled = true;
+            views.WebView.unfreeze();
+    }
+    
+    if(app.ui() != "maemo5_ui") 
+	    return;
+	        
+    snippets.BookmarkDialogId.hide();
+}
+
 // Display the super-page with the given name and path.
 function showSuperPage(pageName, path) {
 
     if (window.views.WebView[pageName] == undefined) {
         window.views.WebView.createSuperPage(pageName, true);
-    		window.views.WebView[pageName].load(chrome.baseDirectory + path);
+    		window.views.WebView[pageName].load(/*chrome.baseDirectory +*/ path);
     }
+    else {
+    	// FIXME: this is a workaround temporary solution
+    	// this is used to render CSS styles for super pages 
+    	// instead of just popping them up from ViewStack which somehow prevent proper CSS styling on page display
+    	window.views.WebView[pageName].load(path);
+ 	}
+ 
     if (!window.views.WebView.bedrockTiledBackingStoreEnabled()){
         window.views.WebView.setSavedZoomValueInView(window.views.WebView.zoomFactor);
 		window.views.WebView.zoomFactor = 1.0;
     }
     //window.views.WebView.showSuperPage(pageName);
     window.ViewStack.switchView(pageName, "WebView");
+
     if (!window.views.WebView.bedrockTiledBackingStoreEnabled())
         window.views.WebView.touchNav.doubleClickEnabled = false;
+        
+    hidePopups();
 }
 
 function chrome_showBookmarksView() {
-    showSuperPage("BookmarkTreeView", "bookmarkview.superpage/BookmarkView.html");
+    showSuperPage("BookmarkTreeView", BOOKMARKVIEW_PAGE);
 }
 
 function chrome_showHistoryView() {
-    showSuperPage("BookmarkHistoryView", "historyview.superpage/historyView.html");
+    showSuperPage("BookmarkHistoryView", HISTORYVIEW_PAGE);
 }
 
 function chrome_showWindowsView() {
-    window.snippets.ZoomBarId.hide(); // hide Zoom Bar while showing windows view
+		if(app.ui() != "maemo5_ui") 
+    	window.snippets.ZoomBarId.hide(); // hide Zoom Bar while showing windows view
     window.snippets.MostVisitedViewId.hide();
     window.ViewStack.switchView("WindowView", "WebView");
 }
 
 function chrome_showSettingsView() {
-    showSuperPage("SettingsView", "settingsview.superpage/SettingsView.html");
+    showSuperPage("SettingsView", SETTINGSVIEW_PAGE);
 }
 
 function chrome_showBasicMenu() {
@@ -92,23 +141,27 @@
 }
 
 function onActivateBookmarkView() {
+	  snippets.BookmarkViewToolbarId.enabled = true;
+	  try {
     window.bookmarksController.launchBookmarkEditDailog.connect(showBookmarkEditDialog);
+  	}
+  	catch (e){;} // just in case bookmarksHistoryManager is not ready yet
+  
 }
 function preLoad()
 {   
-    preloadSuperPage("BookmarkTreeView", "bookmarkview.superpage/BookmarkView.html");
-    preloadSuperPage("SettingsView", "settingsview.superpage/SettingsView.html"); 
+    preloadSuperPage("BookmarkTreeView", BOOKMARKVIEW_PAGE);
+    preloadSuperPage("SettingsView", SETTINGSVIEW_PAGE); 
     preLoadBookmarksDone=1;
 }
 function _updateHistory()
 {
-	preloadSuperPage("BookmarkHistoryView", "historyview.superpage/historyView.html");
-
+	preloadSuperPage("BookmarkHistoryView", HISTORYVIEW_PAGE);
 }
 
 function _updateBookmarks()
 {
-    preloadSuperPage("BookmarkTreeView", "bookmarkview.superpage/BookmarkView.html");
+    preloadSuperPage("BookmarkTreeView", BOOKMARKVIEW_PAGE);
 }
 
 // chrome_popupShownCount keeps a count of how many popups are currently being shown so that
@@ -160,16 +213,122 @@
     if (window.views.WebView[pageName] == undefined) {
         window.views.WebView.createSuperPage(pageName, true);
     }
-    window.views.WebView[pageName].load(chrome.baseDirectory + path);
+    window.views.WebView[pageName].load(/*chrome.baseDirectory +*/ path);
+}
+
+//var chrome_blockPopupsAction;
+
+// Handle Block/Allow Popups action.
+function chrome_toggleBlockPopups() {
+    hidePopups();
+    pageController.savePopupSettings(!pageController.getPopupSettings());
+    chrome_blockPopupsAction.text = chrome_getBlockPopupsActionText();
+}
+
+// Returns the text for the Block/Allow Popups action based on the the current setting in the page controller.
+function chrome_getBlockPopupsActionText() {
+    return window.localeDelegate.translateText(pageController.getPopupSettings()
+                                               ? "txt_browser_content_view_menu_page_allow_popups"
+                                               : "txt_browser_content_view_menu_page_block_popups");
+}
+
+function chrome_setZoomButtonActions() {
+    snippets.ZoomInButtonSnippet.connectAction("zoomIn", "WebView", true, true);
+    snippets.ZoomOutButtonSnippet.connectAction("zoomOut", "WebView",  true, true);
 }
 
-function onChromeComplete(){
+// Create an action and add it to the Maemo menu bar.
+function chrome_addMaemoMenuBarAction(text, callback) {
+    var action = app.createAction(text);
+    action.triggered.connect(callback);
+    app.addMenuBarAction(action);
+    return action;
+}
+function chrome_updateMaemoMenuBarItems() { 
+  app.setMenuBarEnabled(!views.WebView.currentPageIsSuperPage()); 
+}
+
+// Create actions that appear in the Maemo system menu at the top of the screen.
+function chrome_createMaemoMenuBarItems() {
+    // Global menu items.
+    chrome_addMaemoMenuBarAction(window.localeDelegate.translateText("txt_browser_content_view_menu_nav_bookmarks"),
+                                 chrome_showBookmarksView);
+    chrome_addMaemoMenuBarAction(window.localeDelegate.translateText("txt_browser_content_view_menu_page_add_bookmark"),
+                                 function() { hidePopups(); launchBookmarkDialog(pageController.currentDocTitle, pageController.currentDocUrl,-1,0); } );
+    chrome_addMaemoMenuBarAction(window.localeDelegate.translateText("txt_browser_content_view_menu_nav_history"),
+                                 chrome_showHistoryView);
+    chrome_blockPopupsAction = chrome_addMaemoMenuBarAction(chrome_getBlockPopupsActionText(),
+                                                            chrome_toggleBlockPopups);
+    chrome_addMaemoMenuBarAction(window.localeDelegate.translateText("txt_browser_content_view_menu_page_share"),
+                                 function() { hidePopups(); pageController.share(pageController.currentDocUrl); } );
+    chrome_addMaemoMenuBarAction(window.localeDelegate.translateText("txt_browser_content_view_menu_nav_settings"),
+                                 chrome_showSettingsView);
+}
+function onChromeActivated() {
+	
+	snippets.SuggestsChromeId.hide(false);
+	
+  if(!views.WebView.currentPageIsSuperPage()) {
+      views.WebView.enabled = true;
+      views.WebView.unfreeze();
+  }
+  snippets.MostVisitedViewId.hide();
+    
+	if(app.ui() == "maemo5_ui") {
+    snippets.UrlSearchChromeId.grabFocus();            
+  }
+}
+
+function onChromeComplete() {
+
     if (app.ui() == "orbit_ui") {
         snippets.StatusBarChromeId.hide();
     }
     if (app.layoutType() == "tenone") {
         window.snippets.TitleUrlId.anchorToView("top");
+        
+        // Disable content view while Most Visited view is shown.
+    		snippets.MostVisitedViewId.shown.connect(
+        	function() {
+           	views.WebView.enabled = false;
+           	views.WebView.unfreeze(); 
+        	}
+    		);
 
+    		// Enable content view when Most Visited view is hidden.
+    		snippets.MostVisitedViewId.hidden.connect(
+        	function() {
+            views.WebView.enabled = true;
+        	}
+    		);  
+
+    }
+    else if(app.ui() == "maemo5_ui") {
+        
+        chrome_createMaemoMenuBarItems();
+
+        // Update the menu items when the page type changes.
+        views.WebView.normalPageShown.connect(chrome_updateMaemoMenuBarItems);
+        views.WebView.superPageShown.connect(chrome_updateMaemoMenuBarItems);
+        window.snippets.UrlSearchChromeId.anchorToView("top");
+        chrome_setZoomButtonActions();   
+        
+        // Disable content view while Most Visited view is shown.
+    		snippets.MostVisitedViewId.shown.connect(
+        	function() {
+           	views.WebView.enabled = false;
+           	snippets.UrlSearchChromeId.enabled = false;
+        	}
+    		);
+
+    		// Enable content view when Most Visited view is hidden.
+    		snippets.MostVisitedViewId.hidden.connect(
+        	function() {
+            views.WebView.enabled = true;
+            snippets.UrlSearchChromeId.enabled = true;
+        	}
+    		);   
+        
     }
     else {
         window.snippets.UrlSearchChromeId.anchorToView("top");
@@ -179,24 +338,40 @@
     window.snippets.BookmarkViewToolbarId.addBookmarkSelected.connect(chrome_addBookmark);
     window.snippets.WebViewToolbarId.menuButtonCanceled.connect(chrome_cancelMenu);
 
+		// Dismiss Most Visited view when it gets an external click event.
+    	snippets.MostVisitedViewId.externalMouseEvent.connect(
+        function(type, name, description) {
+             if(name == "MouseClick") {
+                // Use timer here to hide the view even when the Most Visited page button is clicked,
+                // otherwise the button re-displays the view.
+                setTimeout('snippets.MostVisitedViewId.hide()', 100);
+             }
+        });
+
     //window.snippets.ButtonContainer.setVisibilityAnimator("G_VISIBILITY_FADE_ANIMATOR");
-
+  if(app.ui() != "maemo5_ui"){
     result = new Array;
     result = calcToolbarPopAnchorOffset(window.snippets.ZoomBarId,
                                         window.snippets.ZoomButtonSnippet,
                                         0,10);
     window.snippets.ZoomBarId.anchorTo("ZoomButtonSnippet",result[0],result[1]);
+  }
 
-    snippets.SuggestsChromeId.url = chrome.baseDirectory + "suggests.snippet/suggests.html";
+    snippets.SuggestsChromeId.url = /*chrome.baseDirectory +*/ SUGGESTS_PAGE;
     
     window.ViewStack.activateBookmark.connect(onActivateBookmarkView);
 
     chrome.popupShown.connect(onPopupShown);
     chrome.popupHidden.connect(onPopupHidden);
+    
+    if(app.ui() == "maemo5_ui")
+    	chrome.chromeActivated.connect(onChromeActivated);
+    
     window.pageController.loadFinished.connect(_updateHistory);
     window.pageController.loadFinishedForBackgroundWindow.connect(_updateHistory);
     window.bookmarksController.bookmarksCleared.connect(_updateBookmarks);
     window.historyManager.historyCleared.connect(_updateHistory);
+    
 }
 
 // For debugging: prints all properties and functions attached to a given object.
@@ -207,3 +382,4 @@
     }
     app.debug(str);
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/chrome_maemo.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,47 @@
+/* place overall style hooks here */
+
+/* Make chrome items appear to be non-selectable */
+::selection {
+  background: transparent;
+  color: inherit;
+}
+
+body {
+  margin:0px;
+  -webkit-user-select:none;
+}
+
+#StatusBarChromeId {
+ height: 26px;
+}
+
+#UrlSearchChromeId, #TitleUrlId {
+  height: 44px;
+  padding-top: 5px; 
+  border-top-width: 0px; 
+  border-top-color: #646f85;
+  color:black; 
+  background-color: white; 
+  border-bottom-color: #b0c4de;
+}
+
+
+/* Toolbar CSS */
+
+#WebViewToolbarId, #WindowViewToolbarId, #RecentUrlViewToolbarId, #BookmarkViewToolbarId, #SettingsViewToolbarId {
+  height:70px;
+  width:100%;
+
+  /* Need to specify border-style for width to have effect*/
+  border-style:solid;
+  border-top-color:#2A3447;
+  border-top-width:3px;
+
+  padding-top:4px;
+}
+
+.ButtonSnippet {
+  height: 70px;
+  width:120px;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/chrome_maemo.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,198 @@
+<html>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/chrome/chrome.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/zoombar/zoombar.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/download/download.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/contextmenu/ContextMenu.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/bookmarkview/bookmarkDialog.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/historyview/clearhistorydialog.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/networkstatus/networkstatus.css">
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/outofmemory/outofmemorydialog.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/prompt/prompt.css">
+
+<head>
+  <script src="/chrome/Bind.js" type="text/javascript"></script>
+  <script src="/chrome/SimpleButton.js" type="text/javascript"></script>
+  <script src="/statusbar/statusbar.js" type="text/javascript"></script>
+  <script src="/networkstatus/networkstatus.js" type="text/javascript"></script>
+  <script src="/prompt/prompt.js" type="text/javascript"></script>
+  <script src="/download/download.js" type="text/javascript"></script>
+  <script src="/bookmarkview/bookmarkDialog.js" type="text/javascript"></script>
+  <script src="/historyview/clearhistorydialog.js" type="text/javascript"></script>
+  <script src="/chrome/chrome.js" type="text/javascript"></script>
+  <script src="/outofmemory/outofmemorydialog.js" type="text/javascript"></script>
+  <script type="text/javascript">
+     window.chrome.chromeComplete.connect(onChromeComplete);
+  </script>
+</head>
+
+
+<body leftmargin="0" topmargin="0">
+
+ <!--
+  <div class = "GinebraSnippet" id="StatusBarChromeId" name="statusbar" data-GinebraAnchor="AnchorTop" data-GinebraVisible="true">
+    <link rel="stylesheet" id="CSSLink" type="text/css" href="statusbar.snippet/statusbar.css"/>
+    <script type="text/javascript">
+      var statusbar = new StatusBar();
+    </script>
+  </div>
+-->
+
+  <!-- Native UrlSearch -->
+
+  <div class="GinebraSnippet" id="UrlSearchChromeId" name="urlsearch" data-GinebraNativeClass="UrlSearchSnippet" data-GinebraVisible="true">
+  </div>
+
+  <div class = "GinebraSnippet" id="NetworkStatusChromeId" name="networkstatus" 
+    data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter"
+    style="width: 310px; height: 200px">
+    <script type="text/javascript">
+      var networkstatus = new NetworkStatusDialog();
+    </script>
+  </div>
+  
+  <div class = "GinebraSnippet" id="PromptChromeId" name="prompt" 
+    data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter"
+    style="width: 310px; height: 200px">
+    <script type="text/javascript">
+      var prompts = new promptDialog();
+    </script>
+  </div>
+
+    <!--  Most Visited Pages-->
+    <div class = "GinebraSnippet" id="MostVisitedViewId" data-GinebraVisible="false" data-GinebraHidesContent="true" data-GinebraNativeClass="MostVisitedPagesWidget"  data-GinebraItemLinkedTo="MostVisitedButtonSnippet" style="width:1%; height:1px; color:red; opacity:0.5">
+    </div>
+
+  
+  <!-- URL Suggestions page snippet (search, bookmarks, and history) -->
+  <div class = "GinebraSnippet"
+    id="SuggestsChromeId"
+    name="pagesnippet"
+    style="width:320; height: 200px;"
+    data-GinebraNativeClass="PageSnippet"
+    data-GinebraHidesContent="true"
+    data-GinebraVisible="false">
+  </div>
+
+  
+  <!-- ContextMenu -->
+   <!--
+  <div style="height: 1000px;">
+      <div class = "GinebraSnippet ContextMenu"
+          id="ContextMenuId"
+          data-GinebraItemType="popup"
+          data-GinebraHidesContent="true"
+          data-GinebraVisible="false"
+          style="width:320;">
+          <script type="text/javascript">
+              new ContextMenu("ContextMenuId");
+          </script>
+      </div>
+  </div>
+  -->
+
+
+<!-- Native Window View Toolbar -->
+  <div class="GinebraSnippet" id="WindowViewToolbarId" data-GinebraVisible="false" data-GinebraHidesContent="true" data-GinebraAnchor="AnchorBottom" data-GinebraNativeClass="WindowToolbar" >
+
+  <div class = "GinebraSnippet ButtonSnippet" id="WinBackButton" data-GinebraVisible="true" data-GinebraHidesContent="true"   data-GinebraNativeClass="ActionButton">
+  </div>
+
+  <div class = "GinebraSnippet ButtonSnippet" id="WinAddWindow" data-GinebraVisible="true" data-GinebraHidesContent="true"  data-GinebraNativeClass="ActionButton" >
+  </div>
+
+  </div>
+
+<!-- Native Bookmarks Toolbar -->
+  <div class="GinebraSnippet" id="BookmarkViewToolbarId" data-GinebraVisible="false" data-GinebraHidesContent="true" data-GinebraAnchor="AnchorBottom" data-GinebraNativeClass="BookmarksToolbar" >
+
+    <div class = "GinebraSnippet ButtonSnippet" id="BookmarksBackButton" data-GinebraVisible="true" data-GinebraHidesContent="true"   data-GinebraNativeClass="ActionButton">
+    </div>
+
+    <div class = "GinebraSnippet ButtonSnippet" id="BookmarksAddButton" data-GinebraVisible="true" data-GinebraHidesContent="true"  data-GinebraNativeClass="ActionButton" >
+    </div>
+
+  </div>
+
+<!-- Native Recent URL Toolbar -->
+  <div class="GinebraSnippet" id="RecentUrlViewToolbarId" data-GinebraVisible="false" data-GinebraHidesContent="true" data-GinebraAnchor="AnchorBottom" data-GinebraNativeClass="RecentUrlToolbar" >
+
+    <div class = "GinebraSnippet ButtonSnippet" id="RecentBackButton" data-GinebraVisible="true" data-GinebraHidesContent="true"   data-GinebraNativeClass="ActionButton">
+    </div>
+
+    <div class = "GinebraSnippet ButtonSnippet" id="RecentClearallButton" data-GinebraVisible="true" data-GinebraHidesContent="true"  data-GinebraNativeClass="ActionButton" >
+    </div>
+
+  </div>
+
+<!-- Settings View Toolbar -->
+  <div class="GinebraSnippet" id="SettingsViewToolbarId" data-GinebraVisible="false" data-GinebraHidesContent="true" data-GinebraAnchor="AnchorBottom"  data-GinebraNativeClass="SettingsToolbar" >
+
+    <div class = "GinebraSnippet ButtonSnippet" id="SettingsBackButton" data-GinebraVisible="true" data-GinebraHidesContent="true"   data-GinebraNativeClass="ActionButton">
+    </div>
+
+    <div class = "GinebraSnippet ButtonSnippet" id="SettingsFeedbackButton" data-GinebraVisible="true" data-GinebraHidesContent="true"  data-GinebraNativeClass="ActionButton" >
+    </div>
+
+  </div>
+
+<!-- MAIN Toolbar -->
+  <div class="GinebraSnippet" id="WebViewToolbarId" data-GinebraVisible="true" data-GinebraHidesContent="true" data-GinebraAnchor="AnchorBottom" data-GinebraNativeClass="ContentToolbar" >
+
+  <div class = "GinebraSnippet ButtonSnippet" id="BackButtonSnippet" data-GinebraVisible="true" data-GinebraHidesContent="true"   data-GinebraNativeClass="ActionButton">
+  </div>
+
+  <div class="GinebraSnippet" id="ButtonContainer" data-GinebraVisible="true" data-GinebraHidesContent="true" data-GinebraContainer="true">
+
+
+    <div class="GinebraSnippet ButtonSnippet" id="MostVisitedButtonSnippet" data-GinebraVisible="true"   data-GinebraNativeClass="ActionButton" >
+    </div>
+
+    <div class="GinebraSnippet ButtonSnippet" id="ZoomInButtonSnippet" data-GinebraVisible="true"  data-GinebraNativeClass="ActionButton" >
+    </div>
+
+    <div class="GinebraSnippet ButtonSnippet" id="ZoomOutButtonSnippet" data-GinebraVisible="true"  data-GinebraNativeClass="ActionButton" >
+    </div>
+
+  </div>
+
+  <div class = "GinebraSnippet ButtonSnippet" id="ToggleTBButtonSnippet" data-GinebraVisible="true" data-GinebraHidesContent="true"  data-GinebraNativeClass="ActionButton" >
+  </div>
+
+  </div>
+
+  <--Inline the bookmark dialog. Use the native text edit snippet for text input-->
+ 
+<div class="GinebraSnippet" id="ClearHistoryDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter">
+  	<script type="text/javascript">
+        addDialog = new clearHistoryDialog();
+    </script>    
+   </div>
+ 
+ 
+ <div class="GinebraSnippet" id="BookmarkDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter">
+  	<script type="text/javascript">
+        addDialog = new bookmarkDialog();
+    </script>    
+   </div>
+   
+  
+  
+  <div class="GinebraSnippet" id="DownloadDialogId"
+    data-GinebraItemType="popup"
+    data-GinebraHidesContent="true"
+    data-GinebraVisible="false"
+    style="width:310px; height:87px">
+    <script type="text/javascript">
+      writeDownloadDialog();
+    </script>
+  </div>
+
+
+  <div class="GinebraSnippet" id="OutOfMemoryDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter">
+    <script type="text/javascript">
+      addDialog = new outOfMemoryDialog();
+    </script>    
+  </div>
+
+</body>
+</html>
--- a/ginebra2/chrome/bedrockchrome/chrome_tenone.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/chrome_tenone.html	Fri Oct 15 17:30:59 2010 -0400
@@ -1,38 +1,46 @@
 <html>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="chrome.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="zoombar.snippet/zoombar.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="download.snippet/download.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="contextmenu.snippet/ContextMenu.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="bookmarkview.superpage/bookmarkDialog.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="historyview.superpage/clearhistorydialog.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="networkstatus.snippet/networkstatus.css">
- <link rel="stylesheet" id="CSSLink" type="text/css" href="outofmemory.snippet/outofmemorydialog.css"/>
- <link rel="stylesheet" id="CSSLink" type="text/css" href="prompt.snippet/prompt.css">
-
 <head>
-  <script src="../js/Bind.js" type="text/javascript"></script>
-  <script src="../js/SimpleButton.js" type="text/javascript"></script>
-  <script src="statusbar.snippet/statusbar.js" type="text/javascript"></script>
-  <script src="networkstatus.snippet/networkstatus.js" type="text/javascript"></script>
-  <script src="prompt.snippet/prompt.js" type="text/javascript"></script>
-  <script src="zoombar.snippet/zoombar.js" type="text/javascript"></script>
-  <script src="download.snippet/download.js" type="text/javascript"></script>
-  <script src="bookmarkview.superpage/bookmarkDialog.js" type="text/javascript"></script>
-  <script src="historyview.superpage/clearhistorydialog.js" type="text/javascript"></script>
-  <script src="chrome.js" type="text/javascript"></script>
-  <script src="contextmenu.snippet/ContextMenu.js" type="text/javascript"></script>
-  <script src="contextmenu.snippet/ViewContextMenu.js" type="text/javascript"></script>
-  <script src="outofmemory.snippet/outofmemorydialog.js" type="text/javascript"></script>
-  <script type="text/javascript">
-     window.chrome.chromeComplete.connect(onChromeComplete);
-  </script>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/chrome/chrome.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/zoombar/zoombar.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/download/download.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/contextmenu/ContextMenu.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/bookmarkview/bookmarkDialog.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/historyview/clearhistorydialog.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/suggests/suggests.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/networkstatus/networkstatus.css">
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/outofmemory/outofmemorydialog.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/prompt/prompt.css"/>
+ <link rel="stylesheet" id="CSSLink" type="text/css" href="/geolocation/geolocationDialog.css"/>
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/settingsview/encodingdialog.css">
+
+ 	<script src="/chrome/jquery-1.4.2.min.js" type="text/javascript"></script>
+ 	<script src="/chrome/effects.core.js" type="text/javascript"></script>
+ 	<script src="/chrome/ui.core.js" type="text/javascript"></script>
+	<script src="/chrome/chrome.js" type="text/javascript"></script>
+	<script src="/chrome/Bind.js" type="text/javascript"></script>
+	<script src="/chrome/SimpleButton.js" type="text/javascript"></script>
+	<script src="/statusbar/statusbar.js" type="text/javascript"></script>
+	<script src="/networkstatus/networkstatus.js" type="text/javascript"></script>
+	<script src="/prompt/prompt.js" type="text/javascript"></script>
+	<script src="/zoombar/zoombar.js" type="text/javascript"></script>
+	<script src="/download/download.js" type="text/javascript"></script>
+	<script src="/bookmarkview/bookmarkDialog.js" type="text/javascript"></script>
+	<script src="/suggests/suggests.js" type="text/javascript"></script>
+	<script src="/historyview/clearhistorydialog.js" type="text/javascript"></script>
+	<script src="/contextmenu/ContextMenu.js" type="text/javascript"></script>
+	<script src="/contextmenu/ViewContextMenu.js" type="text/javascript"></script>
+	<script src="/outofmemory/outofmemorydialog.js" type="text/javascript"></script>
+  <script src="/geolocation/geolocationDialog.js" type="text/javascript"></script>
+	<script type="text/javascript">
+		window.chrome.chromeComplete.connect(onChromeComplete);
+	</script>
 </head>
 
 
 <body leftmargin="0" topmargin="0">
 
   <div class = "GinebraSnippet" id="StatusBarChromeId" name="statusbar" data-GinebraAnchor="AnchorTop" data-GinebraVisible="false">
-    <link rel="stylesheet" id="CSSLink" type="text/css" href="statusbar.snippet/statusbar.css"/>
+    <link rel="stylesheet" id="CSSLink" type="text/css" href="/statusbar/statusbar.css"/>
     <script type="text/javascript">
       var statusbar = new StatusBar();
     </script>
@@ -44,6 +52,11 @@
 <div class="GinebraSnippet" id="TitleUrlId" name="titleurl" data-GinebraVisible="true" data-GinebraHidesContent="false" data-GinebraNativeClass="TitleUrlContainerSnippet">
 </div>
 
+  <!-- Copy-Cut-Paste Menu -->
+  <div class = "GinebraSnippet" id="CopyCutPasteChromeId" name="copycutpaste" 
+    data-GinebraNativeClass="CopyCutPasteSnippet"
+    style="width: 260px; height: 62px">
+  </div>
 
   <div class = "GinebraSnippet" id="NetworkStatusChromeId" name="networkstatus" 
     data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter"
@@ -52,7 +65,7 @@
       var networkstatus = new NetworkStatusDialog();
     </script>
   </div>
-  
+
   <div class = "GinebraSnippet" id="PromptChromeId" name="prompt" 
     data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter"
     style="width: 310px; height: 200px">
@@ -73,11 +86,14 @@
   <!-- URL Suggestions page snippet (search, bookmarks, and history) -->
   <div class = "GinebraSnippet"
     id="SuggestsChromeId"
-    name="pagesnippet"
+    name="searchSuggests"
     style="width:320; height: 200px;"
-    data-GinebraNativeClass="PageSnippet"
+   	data-GinebraItemType="popup"
     data-GinebraHidesContent="true"
     data-GinebraVisible="false">
+	<script type='text/javascript'>
+    	var searchSuggests = new Suggests();
+    </script>
   </div>
 
   <div class = "GinebraSnippet" id="ZoomBarId" 
@@ -185,13 +201,24 @@
    </div>
  
  
- <div class="GinebraSnippet" id="BookmarkDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter">
+ <div class="GinebraSnippet" id="BookmarkDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" data-GinebraVisible="false">
   	<script type="text/javascript">
         addDialog = new bookmarkDialog();
     </script>    
    </div>
    
-  
+<div class="GinebraSnippet" id="GeolocationDialogId" data-GinebraItemType="popup" data-GinebraHidesContent="true" 
+  data-GinebraVisible="false" data-GinebraAnchor="AnchorCenter">
+  <script type="text/javascript">
+  	try{  
+  		if(app.geolocation()) {
+  			geolocationDialog = new GeolocationDialog();
+  		}
+  	} catch(e) {
+  		app.debug(e);
+  	}
+  </script>    
+</div> 
   
   <div class="GinebraSnippet" id="DownloadDialogId"
     data-GinebraItemType="popup"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/contextmenu.snippet/ContextMenuTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,228 @@
+
+/* The entire snippet. */
+.ContextMenu
+{
+  color: white;
+  -webkit-user-select: none;
+  margin: 0px;
+  padding: 0px;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  font-weight:bold;
+  font-size: large;
+}
+
+/* The main wrapper div. */
+.ContextMenuDiv
+{
+  color: white;
+  margin: 0px;
+  padding: 0px;
+  position: relative;
+  border: none; 
+}
+
+.TabsDiv
+{
+  margin-right: 1px;
+}
+
+.TabsUl
+{
+  margin-top: 0px;
+  margin-left: 0px;
+  padding: 0px;
+}
+
+.MenuDiv
+{
+  margin-left: -40px;
+  margin-right: 3px;
+  margin-top: -16px;
+  padding: 0px;
+}
+
+.MenuUl
+{
+  margin-bottom: 0px;
+}
+
+/* All list items, tabs and menu items. */
+.ContextMenu li
+{
+    list-style-type: none;
+}
+
+/*
+.ContextMenu li:hover
+{
+  background: -webkit-gradient(linear, left top, left bottom, from(#677fa8), to(#7692c2), color-stop(0.0, #aab));
+}
+*/
+
+/* Tab items. */
+.ContextMenu .TabsDiv ul li
+{
+  display: inline-block;
+  color: white;
+  padding-top: 10px;
+  padding-bottom: 10px;
+  padding-left: 20px;
+  padding-right: 16px;
+  border-top: solid 3px #808080;
+  border-left: solid 3px #808080;
+  border-bottom: solid 3px #808080;
+  margin-bottom: -2px;
+}
+
+/* The first tab item. */
+.ContextMenu .TabsDiv ul li:first-child
+{
+  -webkit-border-top-left-radius: 7px;
+}
+
+/* The last tab item. */
+.ContextMenu .TabsDiv ul li:last-child
+{
+  -webkit-border-top-right-radius: 7px;
+  border-right: solid 3px #808080;
+}
+
+/* Normal tabs, ie. not highlighted. */
+.ViewContext_NormalTab {
+  background: -webkit-gradient(linear, left top, left bottom, from(#000000), to(#a8a8a8), color-stop(0.5, #5e5e5e));
+}
+
+/* Hide the text in normal tabs. */
+.ViewContext_NormalTab * a {
+  display: none;
+}
+
+.ViewContext_NormalTab div {
+  margin-top: 0px;
+}
+
+/* Highlighted tab. */
+.ViewContext_HighlightedTab {
+  background: -webkit-gradient(linear, left top, left bottom, from(#a8a8a8), to(#000000), color-stop(0.5, #5e5e5e));
+  -webkit-border-top-left-radius: 7px;
+  -webkit-border-top-right-radius: 7px;
+}
+
+/* Make the highlighted tab slightly taller. */
+.ViewContext_HighlightedTab div {
+  margin-top: 6px;
+}
+
+/* Show text in higlighted tab. */
+.ViewContext_HighlightedTab div * a {
+  display: block;
+}
+
+.ViewContext_DisabledTab {
+  color: #ddd;
+}
+
+/* Menu items. */
+.ContextMenu .MenuDiv ul li
+{
+  border-color: #808080;
+  border-bottom: 1px solid #808080;
+  background-image: url(/contextmenu/list_contextmenu.png);
+}
+
+/* Special case for regular menu Li (not row) */
+.ContextMenu .MenuDiv ul li.RegularMenuLi
+{ 
+  padding: 10px;
+}
+
+/* Special case for top-level menu Li (not row Li) */
+.ContextMenu .MenuDiv ul li.MenuLi
+{ 
+  border-right: 3px solid #808080;
+  border-left: 3px solid #808080;
+}
+
+.ViewContext_DisabledMenuItem 
+{
+  color: #888;
+}
+
+/* If menu item has a row */
+.ContextMenu .MenuDiv ul li ul.MenuRowUl
+{ 
+  padding: 0px;
+  margin: 0px;
+  background: #808080;
+  list-style-type: none;
+  display: table;
+  width: 100%;
+  border: none;
+}
+
+.ContextMenu .MenuDiv ul li ul li.MenuRowLi
+{ 
+  border: none;
+  border-left: 1px solid #808080;
+  padding: 10px;
+  margin: 0px;
+  display: table-cell;
+}
+
+/* Last top-level menu item. */
+.ContextMenu .MenuDiv ul li.MenuLi:last-child
+{
+  -webkit-border-bottom-right-radius: 7px;
+  -webkit-border-bottom-left-radius: 7px;
+  border-bottom: 3px solid #808080;
+}
+
+/* Menu item during mouse over. */
+.ContextMenu .MenuDiv ul li.MouseOverItem
+{
+  background-image: url(/contextmenu/list_contextmenu_pressed.png);
+}
+
+/* Item icons. */
+.ContextMenu ul li img
+{
+  vertical-align: middle;
+}
+
+/* Item text. */
+.ContextMenu ul li a
+{
+  vertical-align: middle;
+  margin-left: 10px;
+}
+
+.ContextMenu .MenuDiv ul li.SpMenuLi
+{ 
+  border-right: 3px solid;
+  border-left: 3px solid;
+  border-color: #808080;
+  background-color: #FFFFDD
+}
+
+.ContextMenu .MenuDiv ul li.SpMenuLi:first-child
+{ 
+  border-right: 3px solid;
+  border-left: 3px solid;
+  border-top: 3px solid;
+  -webkit-border-top-right-radius: 7px;
+  -webkit-border-top-left-radius: 7px;
+  border-color: #808080;
+}
+
+.ContextMenu .MenuDiv ul li.SpMenuLi:last-child
+{
+  -webkit-border-bottom-right-radius: 7px;
+  -webkit-border-bottom-left-radius: 7px;
+  border-bottom: 3px solid #808080;
+}
+
+.hiddenLoadImages { 
+  background-image: url(/contextmenu/list_contextmenu_pressed.png);
+  visibility: hidden;
+}
--- a/ginebra2/chrome/bedrockchrome/contextmenu.snippet/ViewContextMenu.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/contextmenu.snippet/ViewContextMenu.js	Fri Oct 15 17:30:59 2010 -0400
@@ -50,13 +50,29 @@
 }
 
 function viewMenu_getLinkItems(linkUrl) {
-              var matchFound = false;            
-              var errorUrl= "javascript:"
-             
-              if(linkUrl.substring(0,errorUrl.length) == errorUrl) {
-              matchFound=true;
-              }
     const maxWindowCount = 5;
+    var browserSchemeFound = true;
+    // schemes other than http(s) and file may be handled by other app
+    var browserSchemePattern = /^(http|https|file):/i;
+    var matchFound = false;
+    var errorUrl= "javascript:"
+    var disableLink = false;
+    
+    if (linkUrl.substring(0,errorUrl.length) == errorUrl) {
+        matchFound = true;
+    }
+    
+    if (!browserSchemePattern.test(linkUrl)) {
+        // scheme not directly handled by browser and therefore not displayed 
+        // in browser window
+        browserSchemeFound = false;
+    }
+    
+    if ((pageController.pageCount() >= maxWindowCount)
+        || matchFound || !browserSchemeFound) {
+        disableLink = true;
+    }
+    
     var items = new Array();
     items =
         [
@@ -65,7 +81,7 @@
             "onclick": function() {
             pageController.LoadInNewWindow(linkUrl);
           },
-         "disabled": (pageController.pageCount() >= maxWindowCount || matchFound) ? "true" : "false",
+         "disabled": disableLink ? "true" : "false",
          },
         ]
     ;
@@ -75,8 +91,8 @@
 function viewMenu_getNavMenuData(current) {
     return {
          "text": window.localeDelegate.translateText("txt_browser_content_view_menu_tab_navigation"), // "Navigation",
-         "iconHighlighted": "contextmenu.snippet/icons/nav_selected.png",
-         "icon": "contextmenu.snippet/icons/nav_deselected.png",
+         "iconHighlighted": "/contextmenu/nav_selected.png",
+         "icon": "/contextmenu/nav_deselected.png",
          "current": current ? "true" : "false",
          "menuItems":
              [
@@ -104,14 +120,49 @@
     };
 }
 
+function viewMenu_getTextEditMenuData(isContentSelected) {
+
+    var items = new Array();
+    items = [
+         {
+            "text": "copy",
+            "disabled" : isContentSelected ? "false" : "true",
+            "onclick": function() {
+                pageController.copy();
+            },
+         },
+         {
+             "text": "cut",
+             "disabled" : isContentSelected ? "false" : "true",
+             "onclick": function() {
+                 pageController.cut();
+             },
+         },
+        ];
+
+    items = items.concat( [ {
+                 "text": "paste",
+                 "disabled": pageController.hasTextOnClipBoard() ? "false" : "true",
+                 "onclick": function() {
+                     pageController.paste();
+                   },
+               },]);
+
+    return {
+         "text": "",
+         "current": "true",
+         "menuItems": items,
+    };
+}
+
 function viewMenu_getPageMenuData(current) {
 
     var popupsBlocked =  pageController.getPopupSettings();
     var tempUrl = pageController.currentDocUrl;
     return {
          "text": window.localeDelegate.translateText("txt_browser_content_view_menu_tab_page"), // "Page",
-         "iconHighlighted": "contextmenu.snippet/icons/page_selected.png",
-         "icon": "contextmenu.snippet/icons/page_deselected.png",
+         "iconHighlighted": "/contextmenu/page_selected.png",
+         "icon": "/contextmenu/page_deselected.png",
          "current": current ? "true" : "false",
          "menuItems":
              [
@@ -149,6 +200,16 @@
     var isLink = linkUrl != "";
     var isImage = imageUrl != "";
     var isLinkOrImage = isLink || isImage;
+    var isContentEditable = contextEvent != undefined ? contextEvent.isContentEditable : false;
+    var isContentSelected = contextEvent != undefined ? contextEvent.isContentSelected : false;
+
+    if (isContentEditable) {
+         var menuList = new Array;
+         menuList = menuList.concat(viewMenu_getTextEditMenuData(isContentSelected));
+         return {
+             "menus": menuList
+         };
+    }
 
     // Build Navigation tab and its menu.
     if (contextEvent == undefined)
@@ -194,8 +255,8 @@
             : (isLink
                ? window.localeDelegate.translateText("txt_browser_content_view_menu_tab_link") // "Link"
                : window.localeDelegate.translateText("txt_browser_content_view_menu_tab_image")), // "image"
-         "icon": "contextmenu.snippet/icons/links_deselected.png",
-         "iconHighlighted": "contextmenu.snippet/icons/links_selected.png",
+         "icon": "/contextmenu/links_deselected.png",
+         "iconHighlighted": "/contextmenu/links_selected.png",
          "current": isLinkOrImage ? "true" : "false",
          "disabled": isLinkOrImage ? "false" : "true",
          "menuItems": linkMenuItems,
@@ -213,15 +274,75 @@
     };
 }
 
+// Return a data structure representing the context menu for the edit widget
+function viewMenu_getEditWidgetContextMenuData(isContentSelected, snippetId) {
+    var menuItems = new Array();
+    menuItems = [
+         {
+            "text": "copy",
+            "disabled" : isContentSelected ? "false" : "true",
+            "onclick": function() {
+                window.snippets[snippetId].copy();
+            },
+         },
+         {
+             "text": "cut",
+             "disabled" : isContentSelected ? "false" : "true",
+             "onclick": function() {
+                 window.snippets[snippetId].cut();
+             },
+         },
+        ];
+
+    menuItems = menuItems.concat( [ {
+                 "text": "paste",
+                 "disabled": pageController.hasTextOnClipBoard() ? "false" : "true",
+                 "onclick": function() {
+                     window.snippets[snippetId].paste();
+                 },
+               },]);
+
+    return {
+        "menus": [
+                   { "text": "",
+                     "current": "true",
+                     "menuItems": menuItems,
+                   },
+                 ]
+    };
+}
+
 // Initialize the WebView's context menu.
 function viewMenu_initWebViewContextMenu() {
     // Connect to the view's contextEvent signal.
     views.WebView.contextEvent.connect(
         function(contextEvent) {
             //printProp(contextEvent);
-            cm_TheContextMenu.show(viewMenu_getWebViewContextMenuData(contextEvent));
+            var menuData = viewMenu_getWebViewContextMenuData(contextEvent);
+            if (menuData.menus != undefined && menuData.menus[0].menuItems.length == 0)
+                return;
+            cm_TheContextMenu.editingSnippet = undefined;
+            cm_TheContextMenu.show(menuData);
         }
     );
+
+    // Connect to the snippets' contextEvent signal
+    for(var i = 0; i < chrome.snippets.length; i++) {
+        var snippet = chrome.snippets[i];
+        if (snippet.editable() && !snippet.useNativeCopyPasteMenu()) {
+            //alert(snippet);
+            snippet.contextEvent.connect(
+                function(isContentSelected, snippetId) {
+                    var menuData = viewMenu_getEditWidgetContextMenuData(isContentSelected, snippetId);
+                    if (menuData.menus != undefined && menuData.menus[0].menuItems.length == 0)
+                        return;
+                    cm_TheContextMenu.editingSnippet = window.snippets[snippetId];
+                    cm_TheContextMenu.show(menuData);
+                }
+            );
+        }
+    }
+
 }
 
 chrome.chromeComplete.connect(viewMenu_initWebViewContextMenu);
--- a/ginebra2/chrome/bedrockchrome/contextmenu.snippet/contextmenu.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/contextmenu.snippet/contextmenu.css	Fri Oct 15 17:30:59 2010 -0400
@@ -6,6 +6,8 @@
   -webkit-user-select: none;
   margin: 0px;
   padding: 0px;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
   font-weight:bold;
   font-size: large;
 }
@@ -143,7 +145,8 @@
   border-left: 3px solid;
 }
 
-.ViewContext_DisabledMenuItem {
+.ViewContext_DisabledMenuItem 
+{
   color: #888;
 }
 
@@ -194,3 +197,28 @@
   vertical-align: middle;
   margin-left: 10px;
 }
+
+.ContextMenu .MenuDiv ul li.SpMenuLi
+{ 
+  border-right: 3px solid;
+  border-left: 3px solid;
+  border-color: #374358;
+  background-color: #FFFFDD
+}
+
+.ContextMenu .MenuDiv ul li.SpMenuLi:first-child
+{ 
+  border-right: 3px solid;
+  border-left: 3px solid;
+  border-top: 3px solid;
+  -webkit-border-top-right-radius: 7px;
+  -webkit-border-top-left-radius: 7px;
+  border-color: #374358;
+}
+
+.ContextMenu .MenuDiv ul li.SpMenuLi:last-child
+{
+  -webkit-border-bottom-right-radius: 7px;
+  -webkit-border-bottom-left-radius: 7px;
+  border-bottom: 3px solid #374358;
+}
--- a/ginebra2/chrome/bedrockchrome/contextmenu.snippet/contextmenu.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/contextmenu.snippet/contextmenu.js	Fri Oct 15 17:30:59 2010 -0400
@@ -19,12 +19,15 @@
     this.tailEl = undefined;
     this.contentView = contentView;
     this.showTimeoutId = 0;
+    this.editingSnippet = undefined;
     // Width of a tab with no text, just the icon.  Icons must all be the same width.
     // Update this if icon size or tab border width etc. changes -- or better yet, determine it dynamically.
     this.normalTabWidth = 64;
     // Height of the menu is the max possible height to be used when positioning the snippet
     this.menuHeight = 272;
-
+    this.snippetWidth = 0;
+    // Width of the menu when it has no tab 
+    this.menuWidth = 130;
     // ContextMenu is a singleton to avoid problems with scope-chaining in some of the
     // callbacks that it uses.  See handleTabActivate.
     if (cm_TheContextMenu != undefined) app.debug("ERROR: cm_TheContextMenu must be a singleton");
@@ -50,6 +53,13 @@
         tabsDiv.appendChild(tabsUl);
 
         var currentTabFound = false;
+        if (data.tabs == undefined) {
+            var menuEl = this.createMenuElement(data.menus[0], true);
+            menuDiv.appendChild(menuEl);
+            document.getElementById(this.snippetId).style.width = this.menuWidth;
+            this.mainDiv.appendChild(menuDiv);
+            return this.mainDiv;
+        }
 
         // Iterate through the list of tabs.
         for (var i=0; i < data.tabs.length; i++) {
@@ -144,7 +154,7 @@
 //        this.tailEl = document.createElement("img");
 //        this.mainDiv.appendChild(this.tailEl);
 //        this.tailEl.setAttribute("id", "cm_tailId");
-//        this.tailEl.setAttribute("src", "contextmenu.snippet/icons/menu_tail.png");
+//        this.tailEl.setAttribute("src", "/contextmenu/menu_tail.png");
 
         this.mainDiv.appendChild(tabsDiv);
         this.mainDiv.appendChild(menuDiv);
@@ -152,7 +162,7 @@
     }
 
     // Create a single menu based on the given data structure.
-    this.createMenuElement = function(data) {
+    this.createMenuElement = function(data, noTab) {
         // Create menu list.
         var menuUl = document.createElement("ul");
         menuUl.setAttribute("class", "MenuUl");
@@ -162,7 +172,10 @@
 
             // Create the item.
             var itemLi = document.createElement("li");
-            itemLi.setAttribute("class", "MenuLi");
+            if(noTab == true)
+                itemLi.setAttribute("class", "SpMenuLi");
+            else
+                itemLi.setAttribute("class", "MenuLi");
             var itemSpan = document.createElement("div");
 
             // Is it a row if items? enumerate that as a ul inside of this outer li
@@ -198,7 +211,10 @@
                 itemLi.className += " RegularMenuLi";
                 if (menuItem.disabled == "true" || data.disabled == "true") {
                     // Disabled item.
-                    itemLi.className += " ViewContext_DisabledMenuItem";
+                    if (noTab == "true")
+                        itemLi.setAttribute("color", "#888");
+                    else
+                        itemLi.className += " ViewContext_DisabledMenuItem";
                 }
                 else {
                     // Enabled item.  Set up the onmouseup handler.
@@ -356,6 +372,7 @@
         var snippetEl = document.getElementById(this.snippetId);
         var el = this.createTabsElement(menuData);
         snippetEl.appendChild(el);
+        snippetEl.insertAdjacentHTML('beforeEnd', '<div class="hiddenLoadImages"></div>');
     }
 
     // Show the content menu.  The menuData must contain an object tree describing the structure of the
@@ -415,6 +432,8 @@
     // Hide this window.
     this.hide = function() {
         snippets[cm_TheContextMenu.snippetId].hide();
+        if (this.editingSnippet != undefined)
+            this.editingSnippet.setContextMenuStatus(false);
     }
 
     this.onHide = function() {
@@ -422,10 +441,14 @@
     }
 
     this.show = function(menuData) {
+        if (this.editingSnippet != undefined)
+            this.editingSnippet.setContextMenuStatus(true);
+
+        document.getElementById(this.snippetId).style.width = this.snippetWidth;
         this.cleanUp();
         this.create(menuData);
-
-        cm_TheContextMenu.updateTabSizes();
+        if (menuData.tabs != undefined)
+            cm_TheContextMenu.updateTabSizes();
         // Use a timer to actually show the window to allow the page re-layout
         // to finish.  We don't know when this really happens but 50ms seems to
         // be enough on the N97.  Without this delay the bottom of the window
@@ -452,7 +475,7 @@
     this.centerSnippet = function() {
 
         
-        var statusBarHeight = snippets.StatusBarChromeId.geometry.height;
+        var statusBarHeight = snippets.StatusBarChromeId.visible ? snippets.StatusBarChromeId.geometry.height : 0;
         
         var snippet = snippets[cm_TheContextMenu.snippetId];
         var x = (chrome.displaySize.width - snippet.geometry.width) / 2;
@@ -465,7 +488,7 @@
     chrome.chromeComplete.connect(createDelegate(this,
         function() {
             var snippet = snippets[cm_TheContextMenu.snippetId];
-
+            this.snippetWidth = document.getElementById(cm_TheContextMenu.snippetId).style.width;
             chrome.aspectChanged.connect(createDelegate(this,
                     function(a) {
                         this.centerSnippet();
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/links_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/links_selected.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/list_contextmenu.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/list_contextmenu_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/menu_tail.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/nav_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/nav_selected.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/page_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/page_selected.png has changed
--- a/ginebra2/chrome/bedrockchrome/download.snippet/download.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/download.snippet/download.css	Fri Oct 15 17:30:59 2010 -0400
@@ -33,7 +33,8 @@
 
     color: #ffffff;
 
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
     font-size: 16px;
-    font-family: Verdana;
     font-weight: bold;
 }
--- a/ginebra2/chrome/bedrockchrome/download.snippet/download.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/download.snippet/download.js	Fri Oct 15 17:30:59 2010 -0400
@@ -2,7 +2,7 @@
 
 function writeDownloadDialog()
 {
-    var image = 'download.snippet/icons/download_dialog_icon.png';
+    var image = '/download/download_dialog_icon.png';
 
     var html =
         '<div class="downloadDialogBox">' +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/download.snippet/downloadTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,37 @@
+/* css for download dialogs */
+
+#downloadDialogId {
+	height: 50px;
+}
+
+.downloadDialogBox {
+    /*opacity: 0.9;*/
+
+    height: 50px;
+
+    -webkit-user-select: none;
+
+    padding: 15px;
+
+    border-radius: 15px;
+    border: 3px solid #aaaaab;
+    background: -webkit-gradient(linear, left top, left bottom, from(#060808), to(#a8a8a8), color-stop(0.5, #777779));
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+}
+
+.downloadDialogIcon {
+    vertical-align: middle;
+
+    height: 24px;
+    width:  24px;
+}
+
+.downloadDialogText {
+    vertical-align: middle;
+
+    color: white;
+
+    font-size: 16px;
+    font-weight: bold;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/geolocation.snippet/geolocationDialog.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,125 @@
+/******* css for geolocation dialog *******/
+
+/*TBD: This should be cleaned up to use a set of common dialog classes */
+
+#GeolocationDialogId
+{
+  /*dimensions*/
+  width: 327px;
+  background: -webkit-gradient(linear, left top, left bottom, from(#060808), to(#777779));
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  border-radius: 9px;
+  border: 2px solid #aaaaab;
+}
+
+div.geolocationTextLabel{
+	/*dimensions*/
+  height: 22px;
+  /*margins & paddings*/
+  margin-top: 20px;
+  margin-bottom: 10px;
+  margin-left: 10px;
+  padding-left: 40px;
+  /*decorations*/
+  color: #fff;
+  background-image: url(/geolocation/icon_dialog_error.png);
+  background-repeat: no-repeat;
+  /*font specification*/
+  font-size: 22px;}
+}
+
+#GeolocationDialogId div.top{
+	/*dimensions*/
+  height: 20px;
+}
+
+#GeolocationDialogId div.body{
+  /*margins & paddings*/
+  padding-left: 8px;
+  padding-right: 8px;
+}
+
+#GeolocationDialogId div.bottom{
+  /*dimensions*/
+  height: 10px; 
+}
+
+div.controls{
+  /*dimensions*/
+  height: 54px;
+  width: 230px;
+  /*margins & paddings*/
+  margin: auto;
+  padding-top: 10px;
+}
+
+div.geolocationAcceptButton{
+	/*dimensions*/
+  width: 100px;
+  height: 54px;
+  /*margins & paddings*/
+  margin-right: 10px;
+  border: none;
+  /*decorations*/
+  background-image: url(/geolocation/dialog_buttons_tick.png);
+  background-repeat: no-repeat;
+  background-repeat: center center;
+  float: left; 
+}
+
+div.geolocationAcceptButton:active{
+	/*decorations*/
+  background-image: url(/geolocation/dialog_buttons_tick_pressed.png);
+}
+
+div.geolocationRejectButton{
+	/*dimensions*/
+  width: 100px;
+  height: 54px;
+  /*margins & paddings*/
+  margin-top: none;
+  border: none;
+  /*decorations*/
+  background-image: url(/geolocation/dialog_buttons_cross.png);
+  background-repeat: no-repeat;
+  background-repeat: center center;
+  float: left;
+}
+
+div.geolocationRejectButton:active{
+	/*decorations*/
+  background-image: url(/geolocation/dialog_buttons_cross_pressed.png);
+}
+
+div.geolocationCheckboxTextLabel{
+	/*dimensions*/
+	height: 22px;
+	/*font specification*/
+  font-size:22px;
+  /*decorations*/
+  color:#fff;
+  /*margins & paddings*/
+  margin-top: 10px
+}
+
+#geolocationCheckboxId{
+	/*dimensions*/
+	width: 25px;
+  height: 25px;
+	/*margins & paddings*/
+  border: none;
+}
+
+div.geolocationWarningLabel{
+	/*dimensions*/
+	height: 44px;
+  /*font specification*/
+  font-size: 22px;
+  /*decorations*/
+  color:#fff;
+  /*margins & paddings*/
+  margin-top: 10px
+  margin-bottom: 20px;
+  margin-left: 10px;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/geolocation.snippet/geolocationDialog.js	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,97 @@
+/*!
+  \file geolocationDialog.js This module contains GeolocationDialog class which
+  prompts user for accepting/rejection geolocation request.
+*/
+function GeolocationDialog() {
+	  var _frame;
+	  var _page;
+	
+    var onChromeComplete = function()
+    {
+        // Watch for geolocation permission request. ".bind(this)" is used to resolve amibiguous this pointer.
+        window.pageController.requestGeolocationPermission.connect(
+            function(frame, page, domain) {
+       
+        	      _frame = frame;
+        	      _page = page;
+        	      
+        	      this.showDialog(domain);
+        	      
+            }.bind(this)
+        );
+    }
+    
+    //! Create the html/DOM elements for the Dialog.
+    this.setupPage = function() {
+        var html =
+            '<div class="top"></div>' +
+              '<div class="body">' +
+                '<div class="geolocationTextLabel" id="geolocationDialogTitle">Location Permissions</div>' +
+                '<div class="geolocationWarningLabel" id="geolocationDialogWarning"></div>' +
+                '<div class="geolocationCheckboxTextLabel"><input type="checkbox" id="geolocationCheckboxId"/>' +
+                '<label id="geolocationCheckboxTextLabelId" onmouseup="GeolocationDialog.toggleCheckbox();"> Save This Setting</label></div>' +
+                '<div class="controls">' +
+                  '<div type="button" onmouseup="GeolocationDialog.permissionGranted();" class="geolocationAcceptButton"></div>' + 
+                  '<div type="button" onmouseup="GeolocationDialog.permissionDenied();" class="geolocationRejectButton"></div>' +
+                '</div>' + /*controls*/
+              '</div>' + /*body*/
+            '<div class="bottom"></div>';
+        document.write(html);
+    }
+    
+    //! Show the Dialog to display the request domain and ask user for permission.
+    this.showDialog = function(domain) {
+    	  snippets.BookmarkViewToolbarId.enabled = false;
+        snippets.WebViewToolbarId.enabled = false;
+        
+        // Translate these texts
+        var dialogTitle = document.getElementById("geolocationDialogTitle");
+        dialogTitle.firstChild.nodeValue = window.localeDelegate.translateText("txt_browser_location_dialog_location_permissions");
+               
+    	  var dialogWarning = document.getElementById("geolocationDialogWarning");
+    	  dialogWarning.innerHTML = "Allow " + domain + " to Use Your Location?";
+	      dialogWarning.firstChild.nodeValue = window.localeDelegate.translateText("txt_browser_location_dialog_allow");
+	      
+	      var checkboxTitle = document.getElementById("geolocationCheckboxTextLabelId");
+        checkboxTitle.firstChild.nodeValue= window.localeDelegate.translateText("txt_browser_location_dialog_save_setting");
+	      
+        window.snippets.GeolocationDialogId.show(false);
+    }
+    
+    //! Hide the Dialog.
+    this.hideDialog = function() {
+        window.snippets.GeolocationDialogId.hide();
+        
+        snippets.BookmarkViewToolbarId.enabled = true;
+        snippets.WebViewToolbarId.enabled = true;
+    }
+    
+    //! Allow the text label for the checkbox to toggle the checkbox
+    GeolocationDialog.toggleCheckbox = function() {
+        document.getElementById("geolocationCheckboxId").checked = !document.getElementById("geolocationCheckboxId").checked;
+    }.bind(this)
+    
+    //! Grant the permission.
+    GeolocationDialog.permissionGranted = function() {
+	      window.pageController.setGeolocationPermission(_frame, _page, true,
+	          document.getElementById("geolocationCheckboxId").checked);
+	          
+	      document.getElementById("geolocationCheckboxId").checked = false;
+	      
+	      this.hideDialog();
+    }.bind(this)
+
+    //! Deny the permission.
+    GeolocationDialog.permissionDenied = function() {
+	      window.pageController.setGeolocationPermission(_frame, _page, false,
+	          document.getElementById("geolocationCheckboxId").checked);
+	          
+	      document.getElementById("geolocationCheckboxId").checked = false;
+	      
+	      this.hideDialog();
+    }.bind(this)
+    
+    this.setupPage();
+    
+    chrome.chromeComplete.connect(onChromeComplete.bind(this));
+}
Binary file ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_cross.png has changed
Binary file ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_cross_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_tick.png has changed
Binary file ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_tick_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/geolocation.snippet/icons/icon_dialog_error.png has changed
--- a/ginebra2/chrome/bedrockchrome/historyview.superpage/clearhistorydialog.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/historyview.superpage/clearhistorydialog.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,59 +1,71 @@
-/* ClearHistory dialog */
+/******* css for clear history dialog *******/
 
-#ClearHistoryDialogId
-{
+#ClearHistoryDialogId {
+  /*dimensions*/
   width: 275px;
-  background: -webkit-gradient(linear, left top, left bottom, from(#556c90), to(#3c4d6a));
+  /*margins & paddings*/
+  padding: 20px;
+  /*decorations*/
   border: 3px solid #002447;
-  padding: 20px;
+  background: -webkit-gradient(linear, left top, left bottom, from(#556c90), to(#3c4d6a));
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  /*webkit*/
   -webkit-border-top-left-radius: 10px;
   -webkit-border-top-right-radius: 10px;
   -webkit-border-bottom-left-radius: 10px;
-  -webkit-border-bottom-right-radius: 10px;
-}
+  -webkit-border-bottom-right-radius: 10px;}
 
-#ClearHistoryDialogId div.textLabel{
-  text-align: center;
-  font-size: 22px;
+#ClearHistoryDialogId div.textLabel {
+  /*margins & paddings*/
+  margin-bottom: 20px;
+  /*decorations*/
   color: #fff;
-  margin-bottom: 20px;
-}
+  /*font specification*/
+  font-size: 22px;
+  /*misc*/
+  text-align: center;}
 
-#ClearHistoryDialogId div.controls{
+#ClearHistoryDialogId div.controls {
+  /*dimensions*/
   height: 50px;
-  text-align: center;
-}
+  /*misc*/
+  text-align: center;}
 
 #ClearHistoryDialogId div.historyDialogButton { 
+  /*dimensions*/
   width: 100px;
   height: 54px;
-  display: inline-block;
+  /*decorations*/
   background-repeat: no-repeat;
   background-repeat: center center;
- }
+  /*misc*/
+  display: inline-block;}
 
 #ClearHistoryDialogId div.clearDoneButton {
-  background-image: url(icons/button_dialog_history_clear_ok_wait.png);
-}
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_ok_wait.png);}
 
 #ClearHistoryDialogId  div.clearDoneButton:active {
-  background-image: url(icons/button_dialog_history_clear_ok_press.png);
-}
-
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_ok_press.png);}
 
 #ClearHistoryDialogId  div.clearCancelButton {
-  background-image: url(icons/button_dialog_history_clear_cancel_wait.png);
-}
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_cancel_wait.png);}
 
 #ClearHistoryDialogId  div.clearCancelButton:active {
-  background-image: url(icons/button_dialog_history_clear_cancel_press.png);
-}
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_cancel_press.png);}
 
 #hiddenDialogOK {
-  visibility: hidden;
-  background-image: url(icons/button_dialog_history_clear_ok_press.png);
-}
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_ok_press.png);
+  /*misc*/
+  visibility: hidden;}
+
 #hiddenDialogCancel {
-  visibility: hidden;
-  background-image: url(icons/button_dialog_history_clear_cancel_press.png);	
-}
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_cancel_press.png);	
+  /*misc*/
+  visibility: hidden;}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/historyview.superpage/clearhistorydialogTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,71 @@
+/******* css for clear history dialog *******/
+
+#ClearHistoryDialogId {
+  /*dimensions*/
+  width: 275px;
+  /*margins & paddings*/
+  padding: 20px;
+  /*decorations*/
+  border: 3px solid #aaaaab;
+  background: -webkit-gradient(linear, left top, left bottom, from(#060808), to(#a8a8a8), color-stop(0.5, #777779));
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  /*webkit*/
+  -webkit-border-top-left-radius: 10px;
+  -webkit-border-top-right-radius: 10px;
+  -webkit-border-bottom-left-radius: 10px;
+  -webkit-border-bottom-right-radius: 10px;}
+
+#ClearHistoryDialogId div.textLabel {
+  /*margins & paddings*/
+  margin-bottom: 20px;
+  /*decorations*/
+  color: white;
+  /*font specification*/
+  font-size: 22px;
+  /*misc*/
+  text-align: center;}
+
+#ClearHistoryDialogId div.controls {
+  /*dimensions*/
+  height: 50px;
+  /*misc*/
+  text-align: center;}
+
+#ClearHistoryDialogId div.historyDialogButton { 
+  /*dimensions*/
+  width: 100px;
+  height: 54px;
+  /*decorations*/
+  background-repeat: no-repeat;
+  background-repeat: center center;
+  /*misc*/
+  display: inline-block;}
+
+#ClearHistoryDialogId div.clearDoneButton {
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_ok_wait.png);}
+
+#ClearHistoryDialogId  div.clearDoneButton:active {
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_ok_press.png);}
+
+#ClearHistoryDialogId  div.clearCancelButton {
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_cancel_wait.png);}
+
+#ClearHistoryDialogId  div.clearCancelButton:active {
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_cancel_press.png);}
+
+#hiddenDialogOK {
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_ok_press.png);
+  /*misc*/
+  visibility: hidden;}
+
+#hiddenDialogCancel {
+  /*decorations*/
+  background-image: url(/historyview/button_dialog_history_clear_cancel_press.png);	
+  /*misc*/
+  visibility: hidden;}
--- a/ginebra2/chrome/bedrockchrome/historyview.superpage/historyView.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/historyview.superpage/historyView.html	Fri Oct 15 17:30:59 2010 -0400
@@ -1,47 +1,44 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-EN">
+<head>
+	<script src="/chrome/jquery-1.4.2.min.js" type="text/javascript"></script>
+	<script src="/chrome/ui.core.js" type="text/javascript"></script>
+	<script src="/chrome/effects.core.js" type="text/javascript"></script>
+	<script src="/chrome/effects.blind.js" type="text/javascript"></script>
+	<script src="/historyview/historyview.js" type="text/javascript"></script>
+   
+	<link rel="stylesheet" id="CSSLink" type="text/css" href="/historyview/historyview.css"/>
 
-<head>
-   <script src="../../js/3rdparty/jquery-1.4.2.min.js" type="text/javascript"></script>
-   <script src="../../js/3rdparty/jquery-ui/ui.core.js" type="text/javascript"></script>
-   <script src="../../js/3rdparty/jquery-ui/effects.core.js" type="text/javascript"></script>
-   <script src="../../js/3rdparty/jquery-ui/effects.blind.js" type="text/javascript"></script>
-   <link rel="stylesheet" id="CSSLink" type="text/css" href="historyview.css"/>
-   <meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
+	<meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
 
-   <title>History  View</title>
-   <script src="historyview.js" type="text/javascript"></script>
-
-  <script type="text/javascript">
+	<title>History</title>
+	<script type="text/javascript">
   
 		var _prevExpandedUL = null;
 		var _prevExpandedATag = null;
 
-  	function scrollToTop()
-  		{
-	    	$('html, body').attr({scrollTop: 0});
+		function scrollToTop() {
+		
+			$('html, body').attr({scrollTop: 0});
 
-        var todayFolder = document.getElementById("aTagId_"+0);
-        var todaySubUl = document.getElementById("subUlId_"+0);
-        if(_prevExpandedUL != null && _prevExpandedATag.className == 'opened')
-        	toggleHistoryFolder(_prevExpandedATag,_prevExpandedUL);
-        _prevExpandedATag = todayFolder;
-        _prevExpandedUL = todaySubUl;
-        toggleHistoryFolder(todayFolder,todaySubUl);
-
-			}
+			var todayFolder = document.getElementById("aTagId_"+0);
+			var todaySubUl = document.getElementById("subUlId_"+0);
+			if(_prevExpandedUL != null && _prevExpandedATag.className == 'opened')
+				toggleHistoryFolder(_prevExpandedATag,_prevExpandedUL);
+			_prevExpandedATag = todayFolder;
+			_prevExpandedUL = todaySubUl;
+			toggleHistoryFolder(todayFolder,todaySubUl);
+		}
 		
 		function update() {
-      updateHistoryList();
-    	
-			window.views.WebView.BookmarkHistoryView.shown.connect(scrollToTop);          
-      }
-  </script>
 
+			updateHistoryList();
+			window.views.WebView.BookmarkHistoryView.shown.connect(scrollToTop);          
+		}
+	</script>
 </head>
+
 <body onload="update()">
-<!-- <input type="button" value="test" onClick="alert(1);">-->
- <div class = "HistoryView" id="HistoryViewId">
-  </div>
+	<div class = "HistoryView" id="HistoryViewId"></div>
 </body>
 </html>
--- a/ginebra2/chrome/bedrockchrome/historyview.superpage/historyview.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/historyview.superpage/historyview.css	Fri Oct 15 17:30:59 2010 -0400
@@ -2,6 +2,8 @@
   padding: 0px;
   margin: 0px;
   background-color: #889cbf;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
 }
 
 .HistoryView{
@@ -38,11 +40,11 @@
 }
 
 ul#folderMenu li>a.opened {
-  background-image:url(icons/list_headerbg_open.png);
+  background-image:url(/historyview/list_headerbg_open.png);
 }
 
 ul#folderMenu li>a.closed {
-  background-image:url(icons/list_headerbg_closed.png);
+  background-image:url(/historyview/list_headerbg_closed.png);
 }
 
 
@@ -85,11 +87,11 @@
 }
 
 ul#folderMenu li>a.opened>div{
-  background-image:url(icons/list_headerarrow_open.png);
+  background-image:url(/historyview/list_headerarrow_open.png);
 }
 
 ul#folderMenu li>a.closed>div{
-  background-image:url(icons/list_headerarrow_closed.png);
+  background-image:url(/historyview/list_headerarrow_closed.png);
 }
 
 ul#folderMenu li>ul>li>a {
@@ -97,7 +99,7 @@
   padding: 8px 10px 8px 10px;
   height: 54px;
   display: block;
-  background-image:url(icons/list_itembg.png);
+  background-image:url(/historyview/list_itembg.png);
   background-repeat:repeat-x;
   overflow: hidden;
   white-space:pre;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/historyview.superpage/historyviewTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,208 @@
+body{
+  padding: 0px;
+  margin: 0px;
+  background-color: black;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;}
+
+@media (device-width:800px){
+body{
+  background-color: black;
+}
+}
+
+.HistoryView{
+  overflow-y:hidden;
+  height:100%;
+}
+
+#BottomPad {
+ padding: 8px 10px 8px 10px;
+ height: 54px;
+}
+
+ul#folderMenu, ul#folderMenu ul {
+  list-style-type:none;
+  margin: 0;
+  padding: 0;
+}
+
+ul#folderMenu a {
+  display: block;
+  text-decoration: none;
+}
+
+ul#folderMenu li {
+}
+
+ul#folderMenu>li>a {
+  color: #000;
+  padding: 8px 10px;
+  height: 37px;
+  display: block;
+  background-repeat:repeat-x;
+  /*font specification*/
+  font-style: bold;
+  font-size: 24px;}
+@media (device-width:800px){
+ul#folderMenu>li>a {
+  font-size: 28px;
+  color:#c3e1ff;
+}
+}
+
+ul#folderMenu li>a.opened {
+  /*dimensions*/
+  left: 10px;
+  /*decorations*/
+  background-image: url(/historyview/list_headerbg_open.png);
+  color: white;
+}
+@media (device-width:800px){
+ul#folderMenu li>a.opened {
+  background-image:url(iconsMaemo/list_headerbg_open.png);
+}
+}
+
+ul#folderMenu li>a.closed {
+  /*dimensions*/
+  left: 10px;
+  /*decorations*/
+  background-image: url(/historyview/list_headerbg_closed.png);
+  color: #cccccc;
+}
+@media (device-width:800px){
+ul#folderMenu li>a.closed {
+  background-image:url(iconsMaemo/list_headerbg_closed.png);
+}
+}
+
+span.aTitle{
+  /*dimensions*/
+  left: 30px; 
+  /*decorations*/
+  color: white;
+  /*font specification*/
+  font-size: 24px;
+  font-style: bold;
+}
+@media (device-width:800px){
+span.aTitle{
+  font-size: 24px;
+}
+}
+
+.HistoryView div.HitsoryElement:active {
+  font-weight: bold;
+}
+
+
+.HistoryView div.HitsoryElement {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+
+span.aUrl{
+  /*dimensions*/
+  left: 30px; 
+  /*decorations*/
+  color: #cccccc;
+  /*font specification*/
+  font-size: 20px;
+  font-style: bold;
+}
+@media (device-width:800px){
+span.aUrl{
+  font-style:bold;
+  font-size:20px;
+  color:#c3e1ff;
+  white-space:nowrap;
+  left:30px;
+}
+}
+
+span.aTime{
+  /*dimensions*/
+  line-height: 18px;
+  /*margins & paddings*/
+  margin-top: 20px;
+  margin-left: 20px;
+  /*decorations*/
+  float:right;
+  color: #cccccc;
+  /*font specification*/
+  font-size: 16px;
+  font-style: bold;
+  /*misc*/
+  text-align: right;
+}
+
+@media (device-width:800px){
+span.aTime{
+  margin-left:10px;
+  font-style:bold;
+  font-size:16px;
+  color:#c3e1ff;
+  white-space:nowrap;
+  text-align:right;
+  line-height:18px;
+  left:715px;
+}
+}
+
+ul#folderMenu li>a.opened>div, ul#folderMenu li>a.closed>div{
+  float: right;
+  width:40px;
+  height:53px;
+  margin-top:-10px;
+}
+
+ul#folderMenu li>a.opened>div{
+  background-image: url(/historyview/list_headerarrow_open.png);
+}
+@media (device-width:800px){
+ul#folderMenu li>a.opened>div{
+  background-image:url(iconsMaemo/list_headerarrow_open.png);
+}
+}
+
+ul#folderMenu li>a.closed>div{
+  background-image: url(/historyview/list_headerarrow_closed.png);
+}
+@media (device-width:800px){
+ul#folderMenu li>a.closed>div{
+  background-image:url(iconsMaemo/list_headerarrow_closed.png);
+}
+}
+ul#folderMenu li>ul>li>a {
+  color: #cccccc;
+  padding: 8px 10px 8px 10px;
+  height: 54px;
+  display: block;
+  background-image: url(/historyview/list_itembg.png);
+  background-repeat:repeat-x;
+  overflow: hidden;
+  white-space:pre;
+  -webkit-user-select: none;
+}
+@media (device-width:800px){
+ul#folderMenu li>ul>li>a {
+  color: white;
+  background-image:url(iconsMaemo/list_itembg.png);
+}
+}
+
+ul#folderMenu li>ul>li>a:active {
+  /*decorations*/
+  color: #cccccc;
+  background-image: url(/historyview/list_itembg_pressed.png);
+  background-repeat: repeat-x;}
+
+
+ul#folderMenu li>ul>li>a>img{
+  margin: 10px 10px 30px 0px;
+  float: left;
+ }
+
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_cancel_press.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_cancel_wait.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_ok_press.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_ok_wait.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/clear_history_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerarrow_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerarrow_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerbg_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerbg_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_itembg.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_itembg_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_press.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_wait.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_press.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_wait.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/clear_history_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_itembg.png has changed
Binary file ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_left.png has changed
Binary file ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_left_tenone.png has changed
Binary file ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_middle.png has changed
Binary file ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_middle_tenone.png has changed
Binary file ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_right.png has changed
Binary file ginebra2/chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_right_tenone.png has changed
Binary file ginebra2/chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/button_dialog_ok_press.png has changed
Binary file ginebra2/chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/button_dialog_ok_wait.png has changed
Binary file ginebra2/chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/icon_dialog_error.png has changed
--- a/ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatus.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatus.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,7 +1,23 @@
 /* Network status (error) dialog styles. */
 
 .networkStatusBox {
-    background: -webkit-gradient(linear, left top, left bottom, from(#546b8f), to(#3b4c69), color-stop(0.0, #aab));
+    background: -webkit-gradient(linear, left top, left bottom, from(#546b8f), to(#3b4c69), color-stop(0.0, #aab));   
+    -webkit-user-select: none;
+
+    padding: 10px;
+    color: #fff;
+
+    border-radius: 7px;
+
+    border-style: solid;
+    border-width: 4px;
+    border-color: #243447;
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+}
+
+.networkStatusBoxMaemo {
+    background: black;
     -webkit-user-select: none;
 
     padding: 10px;
--- a/ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatus.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatus.js	Fri Oct 15 17:30:59 2010 -0400
@@ -91,8 +91,9 @@
 
     //! Create the DOM elements for the dialog.
     this.setupPage = function(){    
-        var html =
-            '<div class="networkStatusBox">' +
+    	 if(app.ui() == "maemo5_ui") {
+    	 	 var html =
+            '<div class="networkStatusBoxMaemo">' +
                 '<ul>' +
                     '<li>' +
                         '<img src="networkstatus.snippet/icons/icon_dialog_error.png"/>&nbsp;&nbsp;' +
@@ -112,10 +113,34 @@
                     '</li>' +
                 '</ul>' +
             '</div>';
+    	 }
+    	 else {
+        var html =
+            '<div class="networkStatusBox">' +
+                '<ul>' +
+                    '<li>' +
+                        '<img src="/networkstatus/icon_dialog_error.png"/>&nbsp;&nbsp;' +
+                        '<span class="networkStatusText">' +
+                            window.localeDelegate.translateText("txt_browser_error_page_load_failed") +
+                        '</span>' +
+                    '</li>' +
+                    '<li id="networkStatusTextUrlParent">' +
+                        '<span class="networkStatusText" id="networkStatusTextUrl1Id"></span><br/>' +
+                        '<div class="networkStatusText2" id="networkStatusTextUrl2Id"></div>' +
+                    '</li>' +
+                    '<li>' +
+                        '<p class="networkErrorMessage" id="networkStatusTextMsgId"/>' +
+                    '</li>' +
+                    '<li>' +
+                        '<center><img id="networkStatus_okId" class="networkStatusOkButton"/></center>' +
+                    '</li>' +
+                '</ul>' +
+            '</div>';
+        }
         document.write(html);
         new SimpleButton("networkStatus_okId",
-                         "networkstatus.snippet/icons/button_dialog_ok_wait.png",
-                         "networkstatus.snippet/icons/button_dialog_ok_press.png",
+                         "/networkstatus/button_dialog_ok_wait.png",
+                         "/networkstatus/button_dialog_ok_press.png",
                          "",
                          this.onOkPressed.bind(this));
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/networkstatus.snippet/networkstatusTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,73 @@
+/* Network status (error) dialog styles. */
+
+.networkStatusBox {
+    -webkit-user-select: none;
+
+    padding: 10px;
+    color: white;
+
+    border-radius: 7px;
+
+    border: 3px solid #aaaaab;
+    background: -webkit-gradient(linear, left top, left bottom, from(#060808), to(#a8a8a8), color-stop(0.5, #777779));
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+}
+
+.networkStatusBoxMaemo {
+    background: black;
+    -webkit-user-select: none;
+
+    padding: 10px;
+    color: #fff;
+
+    border-radius: 7px;
+
+    border-style: solid;
+    border-width: 4px;
+    border-color: #243447;
+}
+
+.networkStatusBox img {
+    vertical-align: middle;
+    padding: 0px;
+}
+
+.networkStatusBox ul {
+	margin: 0px; 
+    padding: 0px;
+}
+
+.networkStatusBox li {
+    list-style-type: none;
+    margin-top: 20px;
+}
+
+.networkStatusBox li:first-child {
+    margin-top: 0px;
+}
+
+.networkStatusBox li:last-child {
+    margin-top: 4px;
+	margin-bottom: 0px;
+}
+
+.networkStatusText {
+    vertical-align: middle;
+    white-space: nowrap;  
+    overflow: hidden;
+    //border: solid 1px #f00;  
+}
+
+.networkErrorMessage {
+    vertical-align: middle;
+}
+
+/* Second line of URL text, truncate the text and append an ellipsis. */
+.networkStatusText2 {  
+    vertical-align: middle;
+    white-space: nowrap;
+    overflow: hidden;  
+    text-overflow: ellipsis;
+} 
+
Binary file ginebra2/chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/button_dialog_out_of_memory_ok_press.png has changed
Binary file ginebra2/chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/button_dialog_out_of_memory_ok_wait.png has changed
Binary file ginebra2/chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/icon_dialog_error.png has changed
--- a/ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,47 +1,59 @@
-/* OutOfMemory dialog */
+/******* css for out-of-memory dialog *******/
 
-#OutOfMemoryDialogId
-{
+#OutOfMemoryDialogId {
+  /*dimensions*/
   width: 275px;
-  background: -webkit-gradient(linear, left top, left bottom, from(#556c90), to(#3c4d6a));
+  /*margins & paddings*/
+  padding: 20px;
   border: 3px solid #002447;
-  padding: 20px;
+  /*decorations*/
+  background: -webkit-gradient(linear, left top, left bottom, from(#556c90), to(#3c4d6a));
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  /*webkit*/
   -webkit-border-top-left-radius: 10px;
   -webkit-border-top-right-radius: 10px;
   -webkit-border-bottom-left-radius: 10px;
-  -webkit-border-bottom-right-radius: 10px;
-}
+  -webkit-border-bottom-right-radius: 10px;}
 
 #OutOfMemoryDialogId span.title {
-  font-size: 22px;
+  /*margins & paddings*/
+  margin-left: 20px;
+  /*decorations*/
   color: #fff;
-  margin-left: 20px;
-}
+  /*font specification*/
+  font-size: 22px;}
 
 #OutOfMemoryDialogId div.textLabel {
-  text-align: left;
-  font-size: 22px;
+  /*margins & paddings*/
+  margin-top: 20px;
+  /*decorations*/
   color: #fff;
-  margin-top: 20px;
-}
+  /*font specification*/
+  font-size: 22px;
+  /*misc*/
+  text-align: left;}
 
 #OutOfMemoryDialogId div.controls {
+  /*margins & paddings*/
   height: 40px;
-  text-align: center;
-}
+  /*misc*/
+  text-align: center;}
 
 #OutOfMemoryDialogId div.outOfMemoryDialogButton { 
+  /*dimensions*/
   width: 100px;
   height: 40px;
-  display: inline-block;
+  /*decorations*/
   background-repeat: no-repeat;
-  background-repeat: center center;
- }
+  background-position: center center;
+  /*misc*/
+  display: inline-block;}
 
 #OutOfMemoryDialogId div.outOfMemoryDoneButton {
-  background-image: url(icons/button_dialog_out_of_memory_ok_wait.png);
-}
+  /*decorations*/
+  background-image: url(/outofmemory/button_dialog_out_of_memory_ok_wait.png);}
 
 #OutOfMemoryDialogId div.outOfMemoryDoneButton:active {
-  background-image: url(icons/button_dialog_out_of_memory_ok_press.png);
-}
+  /*decorations*/
+  background-image: url(/outofmemory/button_dialog_out_of_memory_ok_press.png);}
--- a/ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.js	Fri Oct 15 17:30:59 2010 -0400
@@ -1,7 +1,7 @@
 //outofmemorydialog.js
 
-function outOfMemoryDialog()
-{
+function outOfMemoryDialog() {
+
 	window.pageController.lowMemory.connect(showOutOfMemoryDialog);
 	window.pageController.outOfMemory.connect(showOutOfMemoryDialog);
 	  
@@ -11,12 +11,12 @@
     
 }
 
-function writeOutOfMemoryDialog()
-{
+function writeOutOfMemoryDialog() {
+
     var title = window.localeDelegate.translateText("txt_browser_error_dialog_device_low");
     var message = window.localeDelegate.translateText("txt_browser_error_dialog_close_some");
     var html =
-        '<div><img src="outofmemory.snippet/icons/icon_dialog_error.png"/>&nbsp;&nbsp;<span class="title">' + title + '</span></div>' +
+        '<div><img src="/outofmemory/icon_dialog_error.png"/>&nbsp;&nbsp;<span class="title">' + title + '</span></div>' +
         '<div class="textLabel">' + message +'</div>' +
         '<div class="controls">' +
             '<div type="button" onmouseup="hideOutOfMemoryDialog();" class="outOfMemoryDialogButton outOfMemoryDoneButton"></div>'+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/outofmemory.snippet/outofmemorydialogTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,59 @@
+/******* css for out-of-memory dialog *******/
+
+#OutOfMemoryDialogId {
+  /*dimensions*/
+  width: 275px;
+  /*margins & paddings*/
+  padding: 20px;
+  border: 3px solid #aaaaab;
+  /*decorations*/
+  background: -webkit-gradient(linear, left top, left bottom, from(#060808), to(#a8a8a8), color-stop(0.5, #777779));
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+  /*webkit*/
+  -webkit-border-top-left-radius: 10px;
+  -webkit-border-top-right-radius: 10px;
+  -webkit-border-bottom-left-radius: 10px;
+  -webkit-border-bottom-right-radius: 10px;}
+
+#OutOfMemoryDialogId span.title {
+  /*margins & paddings*/
+  margin-left: 20px;
+  /*decorations*/
+  color: white;
+  /*font specification*/
+  font-size: 22px;}
+
+#OutOfMemoryDialogId div.textLabel {
+  /*margins & paddings*/
+  margin-top: 20px;
+  /*decorations*/
+  color: white;
+  /*font specification*/
+  font-size: 22px;
+  /*misc*/
+  text-align: left;}
+
+#OutOfMemoryDialogId div.controls {
+  /*margins & paddings*/
+  height: 40px;
+  /*misc*/
+  text-align: center;}
+
+#OutOfMemoryDialogId div.outOfMemoryDialogButton { 
+  /*dimensions*/
+  width: 100px;
+  height: 40px;
+  /*decorations*/
+  background-repeat: no-repeat;
+  background-position: center center;
+  /*misc*/
+  display: inline-block;}
+
+#OutOfMemoryDialogId div.outOfMemoryDoneButton {
+  /*decorations*/
+  background-image: url(/outofmemory/button_dialog_out_of_memory_ok_wait.png);}
+
+#OutOfMemoryDialogId div.outOfMemoryDoneButton:active {
+  /*decorations*/
+  background-image: url(/outofmemory/button_dialog_out_of_memory_ok_press.png);}
Binary file ginebra2/chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/button_dialog_ok_press.png has changed
Binary file ginebra2/chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/button_dialog_ok_wait.png has changed
Binary file ginebra2/chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/icon_dialog_error.png has changed
--- a/ginebra2/chrome/bedrockchrome/prompt.snippet/prompt.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/prompt.snippet/prompt.css	Fri Oct 15 17:30:59 2010 -0400
@@ -12,6 +12,8 @@
     border-style: solid;
     border-width: 4px;
     border-color: #243447;
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
 }
 
 .promptBox img {
--- a/ginebra2/chrome/bedrockchrome/prompt.snippet/prompt.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/prompt.snippet/prompt.js	Fri Oct 15 17:30:59 2010 -0400
@@ -90,7 +90,7 @@
             '<div class="promptBox">' +
                 '<ul>' +
                     '<li>' +
-                        '<img src="prompt.snippet/icons/icon_dialog_error.png"/>&nbsp;&nbsp;' +
+                        '<img src="/prompt/icon_dialog_error.png"/>&nbsp;&nbsp;' +
                         '<span class="promptText">' +
                             window.localeDelegate.translateText("txt_browser_error_database_quota") +
                         '</span>' +
@@ -109,8 +109,8 @@
             '</div>';
         document.write(html);
         new SimpleButton("prompt_okId",
-                         "prompt.snippet/icons/button_dialog_ok_wait.png",
-                         "prompt.snippet/icons/button_dialog_ok_press.png",
+                         "/prompt/button_dialog_ok_wait.png",
+                         "/prompt/button_dialog_ok_press.png",
                          "",
                          this.onOkPressed.bind(this));
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/prompt.snippet/promptTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,55 @@
+/* Network status (error) dialog styles. */
+
+.promptBox {
+    -webkit-user-select: none;
+
+    padding: 10px;
+    color: white;
+
+    border-radius: 7px;
+
+    border: 3px solid #aaaaab;
+    background: -webkit-gradient(linear, left top, left bottom, from(#060808), to(#a8a8a8), color-stop(0.5, #777779));
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+}
+
+.promptBox img {
+    vertical-align: middle;
+    padding: 0px;
+}
+
+.promptBox ul {
+	margin: 0px; 
+    padding: 0px;
+}
+
+.promptBox li {
+    list-style-type: none;
+    margin-top: 20px;
+}
+
+.promptBox li:first-child {
+    margin-top: 0px;
+}
+
+.promptBox li:last-child {
+    margin-top: 4px;
+	margin-bottom: 0px;
+}
+
+.promptText {
+    vertical-align: middle;
+    white-space: nowrap;  
+    overflow: hidden;
+    //border: solid 1px #f00;  
+}
+
+/* Second line of URL text, truncate the text and append an ellipsis. */
+.promptText2 {  
+    vertical-align: middle;
+    white-space: nowrap;
+    overflow: hidden;  
+    text-overflow: ellipsis;
+} 
+
--- a/ginebra2/chrome/bedrockchrome/settingsview.superpage/LegalNotice.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/LegalNotice.html	Fri Oct 15 17:30:59 2010 -0400
@@ -1,4 +1,6 @@
 <html>
+<body>
+<p>
 Nokia and Nokia Connecting People are trademarks or registered trademarks of Nokia Corporation.<br/>
 Copyright 2010 Nokia. All rights reserved.<br/>
 <br/>
@@ -13,4 +15,6 @@
 P.O. BOX 407<br/>
 FI-00045 Nokia Group<br/>
 Finland<br/>
+</p>
+</body>
 </html>	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/LegalNoticeMaemo.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,19 @@
+<html>
+Nokia and Nokia Connecting People are trademarks or registered trademarks of Nokia Corporation.<br/>
+Copyright 2010 Nokia. All rights reserved.<br/>
+<br/>
+Nokia Browser 8 Alpha for Maemo/N900<br/>
+Update version 805-1<br/>
+<br/>
+This product is designed to run on Nokia Maemo 5 OS.<br/>
+<br/>
+Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc.<br/>
+<br/>
+This product includes certain open source software. The exact terms of the licenses, disclaimers, acknowledgements and notices are provided below. Nokia offers to provide you with the source code as defined in the applicable license. Please send an e-mail to <b>sourcecode.request@nokia.com</b> or written request to:<br/>
+<br/>									
+Source Code Requests<br/>
+Nokia Corporation<br/>
+P.O. BOX 407<br/>
+FI-00045 Nokia Group<br/>
+Finland<br/>
+</html>	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/LegalNoticeTenone.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,20 @@
+<html>
+<body>
+<p style="color:white;font-size:18px">
+Nokia and Nokia Connecting People are trademarks or registered trademarks of Nokia Corporation.<br/>
+Copyright 2010 Nokia. All rights reserved.<br/>
+<br/>
+This product is based on Symbian OS S60 5th Edition software.<br/>
+<br/>
+Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc.<br/>
+<br/>
+This product includes certain open source software. The exact terms of the licenses, disclaimers, acknowledgements and notices are provided below. Nokia offers to provide you with the source code as defined in the applicable license. Please send an e-mail to <b>sourcecode.request@nokia.com</b> or written request to:<br/>
+<br/>									
+Source Code Requests<br/>
+Nokia Corporation<br/>
+P.O. BOX 407<br/>
+FI-00045 Nokia Group<br/>
+Finland<br/>
+</p>
+</body>
+</html>	
\ No newline at end of file
--- a/ginebra2/chrome/bedrockchrome/settingsview.superpage/SettingsView.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/SettingsView.html	Fri Oct 15 17:30:59 2010 -0400
@@ -1,372 +1,111 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-
-  <script src="../../js/3rdparty/jquery-1.4.2.min.js" type="text/javascript"></script>
-  <script src="../../js/3rdparty/jquery-ui/ui.core.js" type="text/javascript"></script>
-  <script src="../../js/3rdparty/jquery-ui/effects.core.js" type="text/javascript"></script>
-  <script src="../../js/3rdparty/jquery-ui/effects.blind.js" type="text/javascript"></script>
-  <script src="../../js/3rdparty/jquery-ui/dima.js" type="text/javascript"></script>
-  <link rel="stylesheet" id="CSSLink" type="text/css" href="settingsview.css"/>
-  <meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
-
-
-  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
-  <title>Settings</title>
-  <script src="settingsview.js" type="text/javascript"></script>
-
-
-  <script language="JavaScript">
-
-  </script>
-
-  <script>
-
-
-
-
-
- $(document).ready(function() {
-
-    //HIDE THE DIVS ON PAGE LOAD
-    var settingsLoaded = window.pageController.getSettingsLoaded();
-    var image1;
-    var image2;
-    var image3;   
-    var imagesrc1;
-    var imagesrc2;
-    var imagesrc3;    
-    
-    if(settingsLoaded == 0)
-    {
-    	$("div.accordionContent").hide();
-    	image1 = document.getElementById("im1");   
-	   	image1.setAttribute("src", "icons/list_headerarrow_closed.png")	
-	   	imagesrc1 = "icons/list_headerarrow_closed.png";
-    	
-  	    image2 = document.getElementById("im2");   
-   		image2.setAttribute("src", "icons/list_headerarrow_closed.png");  
-   		imagesrc2 = "icons/list_headerarrow_closed.png";
-
-  	    image3 = document.getElementById("im3");   
-   		image3.setAttribute("src", "icons/list_headerarrow_closed.png");  
-   		imagesrc3 = "icons/list_headerarrow_closed.png";
-
-    }
-    else if(settingsLoaded == 1){
-      $('div.accordionButtonGS').next().show();
-      
-        image1 = document.getElementById("im1");   
-	   	image1.setAttribute("src", "icons/list_headerarrow_open.png")	
-	   	imagesrc1 = "icons/list_headerarrow_open.png";
-    	
-  	    image2 = document.getElementById("im2");   
-   		image2.setAttribute("src", "icons/list_headerarrow_closed.png");  
-   		imagesrc2 = "icons/list_headerarrow_closed.png";
-   		
-   	    image3 = document.getElementById("im3");   
-   		image3.setAttribute("src", "icons/list_headerarrow_closed.png");  
-   		imagesrc3 = "icons/list_headerarrow_closed.png";   		
-    }  
-    else if(settingsLoaded == 2)
-    {	
-      $('div.accordionButtonCD').next().show();
-      
-       image1 = document.getElementById("im1");   
-	   image1.setAttribute("src", "icons/list_headerarrow_closed.png");	
-	   imagesrc1 = "icons/list_headerarrow_closed.png";
-    	
-  	   image2 = document.getElementById("im2");   
-   	   image2.setAttribute("src", "icons/list_headerarrow_open.png");  
-   	   imagesrc2 = "icons/list_headerarrow_open.png";
-   		 
-   	   image3 = document.getElementById("im3");   
-   	   image3.setAttribute("src", "icons/list_headerarrow_closed.png");  
-       imagesrc3 = "icons/list_headerarrow_closed.png";
-
-   	}	
-    else if(settingsLoaded == 3)
-    {	
-      $('div.accordionButtonABT').next().show();
-      
-       image1 = document.getElementById("im1");   
-	   image1.setAttribute("src", "icons/list_headerarrow_closed.png");	
-	   imagesrc1 = "icons/list_headerarrow_closed.png";
-    	
-  	   image2 = document.getElementById("im2");   
-   	   image2.setAttribute("src", "icons/list_headerarrow_closed.png");  
-   	   imagesrc2 = "icons/list_headerarrow_closed.png";
-   		 
-  	   image3 = document.getElementById("im3");   
-   	   image3.setAttribute("src", "icons/list_headerarrow_open.png");  
-   	   imagesrc3 = "icons/list_headerarrow_open.png";
-   	}	  
-  
-    //ACCORDION BUTTON ACTION
-    $('div.accordionButtonGS').click(function() {
-        //$('div.accordionContent').slideUp('normal');
-        //$(this).next().slideDown('normal');
-
-        $(this).next().toggle();
-        $('div.accordionButtonCD').next().hide();  
-        $('div.accordionButtonABT').next().hide();  
-                
-        image1 = document.getElementById("im1");   
-        image2 = document.getElementById("im2");  
-        image3 = document.getElementById("im3");  
-                
-        if(imagesrc1 == "icons/list_headerarrow_closed.png") // current state
-        {
-        	imagesrc1 = "icons/list_headerarrow_open.png";
-        	imagesrc2 = "icons/list_headerarrow_closed.png";        	
-        	imagesrc3 = "icons/list_headerarrow_closed.png";        		
-        }       
-        else // imagesrc1 == "icons/list_headerarrow_open.png"
-        {
-        	imagesrc1 = "icons/list_headerarrow_closed.png";
-        }       
-        image1.setAttribute("src", imagesrc1);
-        image2.setAttribute("src", imagesrc2);  
-        image3.setAttribute("src", imagesrc3);  
-
-    });
-
-    $('div.accordionButtonCD').click(function() {
-
-        $(this).next().toggle();
-        $('div.accordionButtonGS').next().hide();
-        $('div.accordionButtonABT').next().hide();
-        
-        image1 = document.getElementById("im1");   
-        image2 = document.getElementById("im2");  
-        image3 = document.getElementById("im3");  
-                
-        if(imagesrc2 == "icons/list_headerarrow_closed.png") // current state
-        {
-        	imagesrc2 = "icons/list_headerarrow_open.png";
-        	imagesrc1 = "icons/list_headerarrow_closed.png"; 
-        	imagesrc3 = "icons/list_headerarrow_closed.png";       	
-        		
-        }       
-        else // imagesrc2 == "icons/list_headerarrow_open.png"
-        {
-        	imagesrc2 = "icons/list_headerarrow_closed.png";
-        }       
-        image1.setAttribute("src", imagesrc1);
-        image2.setAttribute("src", imagesrc2);
-        image3.setAttribute("src", imagesrc3);       
-
-    });
-
-    $('div.accordionButtonABT').click(function() {
-
-        $(this).next().toggle();
-        $('div.accordionButtonGS').next().hide();
-        $('div.accordionButtonCD').next().hide();
-                
-        image1 = document.getElementById("im1");   
-        image2 = document.getElementById("im2");  
-        image3 = document.getElementById("im3");  
-        
-        if(imagesrc3 == "icons/list_headerarrow_closed.png") // current state
-        {
-        	imagesrc3 = "icons/list_headerarrow_open.png";
-        	imagesrc1 = "icons/list_headerarrow_closed.png";        	
-        	imagesrc2 = "icons/list_headerarrow_closed.png";        		
-        }       
-        else // imagesrc3 == "icons/list_headerarrow_open.png"
-        {
-        	imagesrc3 = "icons/list_headerarrow_closed.png";
-        }       
-        image1.setAttribute("src", imagesrc1);
-        image2.setAttribute("src", imagesrc2);       
-     image3.setAttribute("src", imagesrc3);          
-
-    });
-   
-     
-    
-
-});
-
-  </script>
-
+    <meta name="generator" content=
+    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org" />
+    <script src="/chrome/jquery-1.4.2.min.js" type="text/javascript"></script>
+    <script src="/chrome/ui.core.js" type="text/javascript"></script>
+    <script src="/chrome/effects.core.js" type="text/javascript"></script>
+    <script src="/chrome/effects.blind.js" type="text/javascript"></script>
+    <script src="/chrome/dima.js" type="text/javascript"></script>
+    <link rel="stylesheet" id="CSSLink" type="text/css" href="/settingsview/settingsview.css" />
+    <meta name="viewport" content="width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no" />
+    <meta content="text/html; charset=us-ascii" http-equiv="content-type" />
+    <title>
+        Settings
+    </title>
+    <script src="/settingsview/settingsview.js" type="text/javascript">
+</script>
 </head>
-
-
 <body>
-
-<div id="wrapper">
-       
-       <div class="accordionButtonGS">&nbsp;&nbsp;&nbsp;&nbsp;<span id="txt_browser_settings_general_settings"></span>   <img id="im1" align="right" style="padding-right: 20px; vertical-align: middle; " ></div>                
-        
-        <div class="accordionContent"><br />
-
-            <form name="encoding" ><span id="txt_browser_settings_general_settings_character_encoding"></span> <br> 
-            	
-            <table width="100%" cellspacing="0">
-         	 <tr>
-           <td style="text-align: center;">
-           	<select onChange="setValue(this.selectedIndex)" name="formbutton">
-            <option value="Automatic">Automatic            
-            <option value="Big5">Big5                
-						<option value="Big5-HKSCS">Big5-HKSCS
-						<option value="CP949">CP949 
-						<option value="EUC-JP">EUC-JP 
-						<option value="EUC-KR">EUC-KR 
-						<option value="GB18030-0">GB18030-0 
-						<option value="IBM-850">IBM-850 
-						<option value="IBM-866">IBM-866 
-						<option value="IBM-874">IBM-874
-						<option value="ISO-2022-JP">ISO-2022-JP 
-						<option value="ISO-8859-1">ISO-8859-1  
-						<option value="ISO-8859-2">ISO-8859-2
-						<option value="ISO-8859-3">ISO-8859-3
-						<option value="ISO-8859-4">ISO-8859-4
-						<option value="ISO-8859-5">ISO-8859-5
-						<option value="ISO-8859-6">ISO-8859-6
-						<option value="ISO-8859-7">ISO-8859-7
-						<option value="ISO-8859-8">ISO-8859-8
-						<option value="ISO-8859-9">ISO-8859-9
-						<option value="ISO-8859-10">ISO-8859-10
-						<option value="ISO-8859-13">ISO-8859-13
-						<option value="ISO-8859-14">ISO-8859-14
-						<option value="ISO-8859-15">ISO-8859-15
-						<option value="ISO-8859-16">ISO-8859-16
-						<option value="KOI8-R">KOI8-R 
-						<option value="KOI8-U">KOI8-U
-						<option value="MuleLao-1">MuleLao-1 
-						<option value="ROMAN8">ROMAN8 
-						<option value="Shift-JIS">Shift-JIS 
-						<option value="TIS-620">TIS-620 
-						<option value="TSCII">TSCII
-						<option value="UTF-8">UTF-8 
-						<option value="UTF-16">UTF-16 
-						<option value="UTF-16BE">UTF-16BE 
-						<option value="UTF-16LE">UTF-16LE 
-						<option value="UTF-32">UTF-32 
-						<option value="UTF-32BE">UTF-32BE 
-						<option value="UTF-32LE">UTF-32LE 
-						<option value="Windows-1250">Windows-1250 
-						<option value="Windows-1251">Windows-1251
-						<option value="Windows-1252">Windows-1252
-						<option value="Windows-1253">Windows-1253
-						<option value="Windows-1254">Windows-1254
-						<option value="Windows-1255">Windows-1255
-						<option value="Windows-1256">Windows-1256
-						<option value="Windows-1257">Windows-1257
-						<option value="Windows-1258">Windows-1258           	
-            </select>
-               </td> 
-           </tr>
-         </table>
-            	
-            	
-           
-            </form> 
-           
-           
-         <table width="100%" cellspacing="0">
-         	 <tr>
-            <td class="settingstext" style="border-top: solid 1px #E0E0E0;"><span id="txt_browser_settings_general_settings_save_browser_history"></span></td>
-            <td style="border-top: solid 1px #E0E0E0;"><input id="saverestore1" onclick="saveSR('yes')"    type="image" STYLE="vertical-align: middle; padding:5px" >
-                <input id="saverestore2" onclick="saveSR('no')"     type="image" STYLE="vertical-align: middle; padding:5px" ></td> 
-           </tr>
-           
-           <!--
-           <tr> 
-            <td class="settingstext" style="border-top: solid 1px #E0E0E0;">Save Form/Passwords</td>
-            <td style="border-top: solid 1px #E0E0E0;"><input id="formpwd1" onclick="saveFP('yes')" type="image" STYLE="vertical-align: middle; padding:5px" >
-                																			 <input id="formpwd2" onclick="saveFP('no')"  type="image" STYLE="vertical-align: middle; padding:5px" ></td>
-           </tr> -->
-            
-         </table>         
-           
-
+    <!--MENU: start-->
+    <!--SECTION: General Settings-->
+    <div class="accordionButtonGS">
+        &nbsp;&nbsp; <span id="txt_browser_settings_general_settings"></span> 
+        <img id="im1"alt="" />
+    </div>
+    <!--items-->
+    <div class="accordionContent">
+        <!--ITEM: Character encoding-->
+        <div>
+            <div class="accordionContentCharacterEncodingItem">
+                <div class="settingstext" id="selected_encoding_option">
+                    <span class="encoding_state" id="txt_browser_settings_general_settings_character_encoding">
+                    </span><br />
+                    <span class="encoding_state" id="character_encoding_value"></span><br />
+                </div>
+            </div>
+            <div class="accordionContentCharacterEncodingItem">
+                <div class="encoding_options">
+                </div>
+            </div><!--ITEM: Save history-->
+            <div class="accordionContentCharacterEncodingItem" id="saverestore_container">
+                <div class="settingstext">
+                    <span id="txt_browser_settings_general_settings_save_browser_history">
+                    </span>
+                </div><input id="saverestore" type="image" />
+            </div>
         </div>
-
-
-        <div class="accordionButtonCD">&nbsp;&nbsp;&nbsp;&nbsp;<span id="txt_browser_settings_clear_data"></span> <img id="im2" align="right" style="padding-right: 20px; vertical-align: middle; "></div>
-        <div class="accordionContent"><br />
-             <form name="deleteform">
-
-                  <table width="100%" cellspacing="0">
-
-
-								  <tr>
-								    <td class="settingstext"><span id="txt_browser_settings_clear_data_cache"></span>&nbsp;&nbsp;</td>
-								    <td style="text-align: right;  white-space: nowrap;"><img id="id1" onclick="clearSelected('cache')"     type="image" STYLE="vertical-align: middle;"></td>
-								  </tr>
-								  <tr>
-								    <td class="settingstext" style="border-top: solid 1px #E0E0E0;"><span id="txt_browser_settings_clear_data_cookies"></span>&nbsp;&nbsp;</td>
-								    <td style="text-align: right; border-top: solid 1px #E0E0E0; white-space: nowrap;"><img id="id2" onclick="clearSelected('cookies')"   type="image" STYLE="vertical-align: middle;" ></td>
-								  </tr>
-								  <tr>
-								    <td class="settingstext" style="border-top: solid 1px #E0E0E0;"><span id="txt_browser_settings_clear_data_history"></span>&nbsp;&nbsp;</td>
-								    <td style="text-align: right; border-top: solid 1px #E0E0E0;  white-space: nowrap;"><img id="id3" onclick="clearSelected('history')"   type="image" STYLE="vertical-align: middle;" ></td>
-								  </tr>
-								  <tr>
-								    <td class="settingstext" style="border-top: solid 1px #E0E0E0;"><span id="txt_browser_settings_clear_data_bookmarks"></span>&nbsp;&nbsp;</td>
-								    <td style="text-align: right; border-top: solid 1px #E0E0E0;  white-space: nowrap;"><img id="id4" onclick="clearSelected('bookmarks')"   type="image" STYLE="vertical-align: middle;" ></td>
-								  </tr>
-								  
-								  <tr>
-								    <td class="settingstext" style="border-top: solid 1px #E0E0E0;"><span id="txt_browser_settings_clear_data_all"></span>&nbsp;&nbsp;</td>
-								    <td style="text-align: right; border-top: solid 1px #E0E0E0; white-space: nowrap;"><img id="id6" onclick="clearSelected('all')"   type="image" STYLE="vertical-align: middle;" ></td>
-								  </tr>
-								</table>
-                  
-            </form>
+    </div>
+    <!--SECTION: Clear data-->
+    <div class="accordionButtonCD">
+        &nbsp;&nbsp; <span id="txt_browser_settings_clear_data"></span>
+        <img id="im2" alt="" />
+    </div>
+    <!--items-->
+    <div class="accordionContent" id="cleardata">
+        <!--ITEM: Cache-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_cache"></span>
+            </div>
+            <img id="id1" alt=""/>
+        </div><!--ITEM: Cookies-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_cookies"></span>
+            </div>
+            <img id="id2" alt=""/>
+        </div><!--ITEM: History-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_history"></span>
+            </div>
+            <img id="id3" alt=""/>
+        </div><!--ITEM: Bookmarks-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_bookmarks"></span>
+            </div>
+            <img id="id4" alt=""/>
+        </div><!--ITEM: Location Permissions-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_location"></span>
+            </div>
+            <img id="id5" alt=""/>
+        </div><!--ITEM: Clear all-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_all"></span>
+            </div>
+            <img id="id6" alt=""/>
         </div>
-
-        <div class="accordionButtonABT">&nbsp;&nbsp;&nbsp;&nbsp;<span id="txt_browser_settings_general_settings_about"></span> <img id="im3" align="right" style="padding-right: 20px; vertical-align: middle; "></div>
-        <div class="accordionContent"><br />
-            <form name="aboutform">
-
-                  <table width="100%" cellspacing="0">
-								  <tr>
-								    <td class="settingstext">Nokia Browser&nbsp;&nbsp;</td>
-								  </tr>
-								  <tr>
-								    <td class="settingstext" style="border-top: solid 1px #E0E0E0;">
-								                <div id="release_version">
-	                				<script type="text/javascript">
-					                var UAString = navigator.userAgent;
-	            				    var brNameVer = "unknown";
-					                var UALen = 1;
-	            				    var nameStart = 1;	        
-					                UALen = UAString.length;
-	            				    nameStart = UAString.indexOf("NokiaBrowser");
-					                // test to see if "NokiaBrowser" is in the UA String at all
-	            				    if (nameStart < 0)
-					                    brNameVer = "NOT a NokiaBrowser Browser";
-	            				    else
-					                {
-	            				        // crop string starting at "NokiaBrowser"
-					                    brNameVer = UAString.substring(nameStart, UALen);
-	            				        // limit substring to "NokiaBrowser" and version only 
-					                    brNameVer = brNameVer.substr(0, brNameVer.indexOf(" "));
-	            				        // clean up string for presentation
-					                    brNameVer = brNameVer.replace("NokiaBrowser/", " Version: ");
-	            				    }
-					                document.write(brNameVer);
-									document.write("<br/>");
-					            </script>
-            					</div>	
-								</td> 
-								</tr>
-								    
-								<tr>
-							    <td class="settingstext" style="border-top: solid 1px #E0E0E0;">
-							    <iframe src = "LegalNotice.html" frameborder="0" scrolling="auto"> 
-								</iframe>						    	
-								</td>
-								</tr>
-								</table>                  
-            </form>
-        </div>
-
     </div>
-    <div id="BottomPad"></div>
+    <!--SECTION: About Browser-->
+    <div class="accordionButtonABT">
+        &nbsp;&nbsp; <span id="txt_browser_settings_general_settings_about"></span> 
+        <img id="im3" alt="" />
+    </div><!--items-->
+    <div class="accordionContentAboutItem">
+        <!--Nokia Browser About-->
+        <span id="release_label">Nokia Browser</span>
+        <span id="release_version"></span>
+        <iframe class="contenttext" src="LegalNotice.html" frameborder="0" scrolling="auto" ></iframe>
+    </div>
+<!--MENU: end--> 
+    <!--BOTTOM PAD: start-->
+    <div id="BottomPad"></div><!--BOTTOM PAD: end-->
 </body>
 </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/SettingsViewMaemo.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,387 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+    <script src="/chrome/jquery-1.4.2.min.js" type="text/javascript"></script>
+    <script src="/chrome/ui.core.js" type="text/javascript"></script>
+    <script src="/chrome/effects.core.js" type="text/javascript"></script>
+    <script src="/chrome/effects.blind.js" type="text/javascript"></script>
+    <script src="/chrome/dima.js" type="text/javascript"></script>
+
+    <link rel="stylesheet" id="CSSLink" type="text/css" href="/settingsview/settingsview.css"/>
+
+    <meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
+    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
+
+    <title>Settings</title>
+
+    <script src="/settingsview/settingsview.js" type="text/javascript"></script>
+
+    <script language="javascript">
+      // header arrow icons
+      var header_closed_src = "/settingsview/list_headerarrow_closed.png";
+      var header_open_src = "/settingsview/list_headerarrow_open.png";
+      // menu section backgrounds
+      var bg_closed_src = "/settingsview/list_headerbg_closed.png";
+      var bg_open_src = "/settingsview/list_headerbg_open.png";
+      // menu section item background
+      var bg_item_src = "/settingsview/list_itembg.png";
+      var bg_item_pressed_src = "/settingsview/list_itembg_pressed.png";
+
+      $(document).ready(function() {
+
+           //HIDE THE DIVS ON PAGE LOAD
+           var settingsLoaded = window.pageController.getSettingsLoaded();
+	 
+           if(settingsLoaded == 0) {
+
+               $("div.accordionContent").hide();
+
+               // set menu section items background
+               $("div.accordionContentItem").css("background-image", bg_item_src);
+               // set menu sections background
+               $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+               $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+               $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+               // set header arrow image
+               $("#im1").attr("src", header_closed_src);	
+               $("#im2").attr("src", header_closed_src);
+               $("#im3").attr("src", header_closed_src);
+
+           } else if(settingsLoaded == 1) {
+
+               $('div.accordionButtonGS').next().show();
+
+               // set menu sections background
+               $('div.accordionButtonGS').css("background-image", "url(" + bg_open_src + ")");
+               $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+               $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+               // set header arrow image
+               $("#im1").attr("src", header_open_src);
+               $("#im2").attr("src", header_closed_src);  
+               $("#im3").attr("src", header_closed_src);  
+
+           } else if(settingsLoaded == 2) {
+
+               $('div.accordionButtonCD').next().show();
+
+               // set menu sections background
+               $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+               $('div.accordionButtonCD').css("background-image", "url(" + bg_open_src + ")");
+               $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+               // set header arrow image
+               $("#im1").attr("src", header_closed_src);
+               $("#im2").attr("src", header_open_src);  
+               $("#im3").attr("src", header_closed_src);  
+
+          } else if(settingsLoaded == 3) {
+
+               $('div.accordionButtonABT').next().show();
+
+               // set menu sections background
+               $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+               $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+               $('div.accordionButtonABT').css("background-image", "url(" + bg_open_src + ")");
+
+               // set header arrow image
+               $("#im1").attr("src", header_closed_src);
+               $("#im1").attr("src", header_closed_src);  
+               $("#im1").attr("src", header_open_src);  
+
+         }	  
+  
+         //ACCORDION BUTTON ACTION
+         $('div.accordionButtonGS').click(function() {
+              //$('div.accordionContent').slideUp('normal');
+              //$(this).next().slideDown('normal');
+
+              alertf("11111111111");
+
+              $(this).next().toggle();
+              $('div.accordionButtonCD').next().hide();
+              $('div.accordionButtonABT').next().hide();
+                
+              if( $("#im1").attr("src") == header_closed_src ) { // current state
+
+                   // set menu sections background
+                   $('div.accordionButtonGS').css("background-image", "url(" + bg_open_src + ")");
+                   $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+                   $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+                   // change list headerarrow icon
+                   $("#im1").attr("src", header_open_src);
+                   $("#im2").attr("src", header_closed_src);
+                   $("#im3").attr("src", header_closed_src);
+
+              } else if( $("#im1").attr("src") == header_open_src ) {
+        
+                   // set menu sections background
+                   $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+                   // change list headerarrow icon
+                   $("#im1").attr("src", header_closed_src);
+
+              }       
+         });
+
+         $('div.accordionButtonCD').click(function() {
+
+              $(this).next().toggle();
+              $('div.accordionButtonGS').next().hide();
+              $('div.accordionButtonABT').next().hide();
+        
+              if( $("#im2").attr("src") == header_closed_src ) { // current state
+
+                   // set menu sections background
+                   $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+                   $('div.accordionButtonCD').css("background-image", "url(" + bg_open_src + ")");
+                   $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+                   // change list headerarrow icon
+                   $("#im1").attr("src", header_closed_src);
+                   $("#im2").attr("src", header_open_src);
+                   $("#im3").attr("src", header_closed_src);
+        		
+              } else if( $("#im2").attr("src") == header_open_src ) {
+        
+                   // set menu sections background
+                   $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+                   // change list headerarrow icon
+                   $("#im2").attr("src", header_closed_src);
+
+              }
+
+         });
+
+         $('div.accordionButtonABT').click(function() {
+
+              $(this).next().toggle();
+              $('div.accordionButtonGS').next().hide();
+              $('div.accordionButtonCD').next().hide();
+
+              if( $("#im3").attr("src") == header_closed_src ) { // current state
+
+                   // set menu sections background
+                   $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+                   $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+                   $('div.accordionButtonABT').css("background-image", "url(" + bg_open_src + ")");
+
+                   // change list headerarrow icon
+                   $("#im1").attr("src", header_closed_src);
+                   $("#im2").attr("src", header_closed_src);
+                   $("#im3").attr("src", header_open_src);
+        		
+              } else if( $("#im3").attr("src") == header_open_src ) {
+        
+                   // set menu sections background
+                   $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+                   // change list headerarrow icon
+                   $("#im3").attr("src", header_closed_src);
+
+              }
+                
+         });
+    
+      });
+    </script>
+</head>
+
+<body>
+    <!--MENU: start-->
+    <div id="wrapper">
+      <!--SECTION: General Settings-->
+      <div class="accordionButtonGS">&nbsp;&nbsp;
+	<span id="txt_browser_settings_general_settings"></span>
+	<img id="im1" align="right" style="padding-right:40px;vertical-align:middle;"/>
+      </div>
+      <!--items-->
+      <div class="accordionContent">
+	<!--ITEM: Character encoding-->
+	<table width="100%" cellspacing="0">
+	  <form name="encoding">
+	    <tr class="accordionContentItem">
+	      <td colspan=2 class="settingstext">
+		<span id="txt_browser_settings_general_settings_character_encoding"></span>
+		<br/>
+		<div align=right style="padding-right:10px;">
+		<select onChange="setValue(this.options[this.selectedIndex].value)" id="formbutton" name="formbutton">
+		  <option value="Automatic">Automatic</option>
+		  <option value="Big5">Big5</option>
+		  <option value="Big5-HKSCS">Big5-HKSCS</option>
+		  <option value="CP949">CP949</option> 
+		  <option value="EUC-JP">EUC-JP</option>
+		  <option value="EUC-KR">EUC-KR</option>
+		  <option value="GB18030-0">GB18030-0</option>
+		  <option value="IBM-850">IBM-850</option>
+		  <option value="IBM-866">IBM-866</option>
+		  <option value="IBM-874">IBM-874</option>
+		  <option value="ISO-2022-JP">ISO-2022-JP</option>
+		  <option value="ISO-8859-1">ISO-8859-1</option>
+		  <option value="ISO-8859-2">ISO-8859-2</option>
+		  <option value="ISO-8859-3">ISO-8859-3</option>
+		  <option value="ISO-8859-4">ISO-8859-4</option>
+		  <option value="ISO-8859-5">ISO-8859-5</option>
+		  <option value="ISO-8859-6">ISO-8859-6</option>
+		  <option value="ISO-8859-7">ISO-8859-7</option>
+		  <option value="ISO-8859-8">ISO-8859-8</option>
+		  <option value="ISO-8859-9">ISO-8859-9</option>
+		  <option value="ISO-8859-10">ISO-8859-10</option>
+		  <option value="ISO-8859-13">ISO-8859-13</option>
+		  <option value="ISO-8859-14">ISO-8859-14</option>
+		  <option value="ISO-8859-15">ISO-8859-15</option>
+		  <option value="ISO-8859-16">ISO-8859-16</option>
+		  <option value="KOI8-R">KOI8-R</option>
+		  <option value="KOI8-U">KOI8-U</option>
+		  <option value="MuleLao-1">MuleLao-1</option>
+		  <option value="ROMAN8">ROMAN8</option>
+		  <option value="Shift-JIS">Shift-JIS</option>
+		  <option value="TIS-620">TIS-620</option>
+		  <option value="TSCII">TSCII</option>
+		  <option value="UTF-8">UTF-8</option>
+		  <option value="UTF-16">UTF-16</option>
+		  <option value="UTF-16BE">UTF-16BE</option>
+		  <option value="UTF-16LE">UTF-16LE</option>
+		  <option value="UTF-32">UTF-32</option>
+		  <option value="UTF-32BE">UTF-32BE</option>
+		  <option value="UTF-32LE">UTF-32LE</option>
+		  <option value="Windows-1250">Windows-1250</option>
+		  <option value="Windows-1251">Windows-1251</option>
+		  <option value="Windows-1252">Windows-1252</option>
+		  <option value="Windows-1253">Windows-1253</option>
+		  <option value="Windows-1254">Windows-1254</option>
+		  <option value="Windows-1255">Windows-1255</option>
+		  <option value="Windows-1256">Windows-1256</option>
+		  <option value="Windows-1257">Windows-1257</option>
+		  <option value="Windows-1258">Windows-1258</option>
+		</select>
+		</div>
+	      </td> 
+	    </tr>
+	    <!--ITEM: Save history-->
+	    <tr class="accordionContentItem">
+	      <td class="settingstext">
+		<span id="txt_browser_settings_general_settings_save_browser_history"></span>
+	      </td>
+	      <td align=right>
+		<input id="saverestore" onclick="saveSR( $('#saverestore').attr('src') ); return false;" type="image" style="vertical-align:middle;padding-top:5px;padding-bottom:5px;"/>
+	      </td>
+	    </tr>
+	  </form>
+	</table>         
+      </div>
+
+      <!--SECTION: Clear data-->
+      <div class="accordionButtonCD">&nbsp;&nbsp;
+	<span id="txt_browser_settings_clear_data"></span>
+	<img id="im2" align="right" style="padding-right:40px;vertical-align:middle;"/>
+      </div>
+      <!--items-->
+      <div class="accordionContent">
+	<table width="100%" cellspacing="0">
+	  <form name="deleteform">
+	    <!--ITEM: Cache-->
+	    <tr class="accordionContentItem">
+	      <td class="settingstext">
+		<span id="txt_browser_settings_clear_data_cache"></span>
+	      </td>
+	      <td style="text-align:right;white-space:nowrap;">
+		<img id="id1" onclick="clearSelected('cache')" type="image" STYLE="vertical-align:middle;"/>
+	      </td>
+	    </tr>
+	    <!--ITEM: Cookies-->
+	    <tr class="accordionContentItem">
+	      <td class="settingstext">
+		<span id="txt_browser_settings_clear_data_cookies"></span>
+	      </td>
+	      <td style="text-align:right;white-space:nowrap;">
+		<img id="id2" onclick="clearSelected('cookies')" type="image" STYLE="vertical-align:middle;"/>
+	      </td>
+	    </tr>
+	    <!--ITEM: History-->
+	    <tr class="accordionContentItem">
+	      <td class="settingstext">
+		<span id="txt_browser_settings_clear_data_history"></span>
+	      </td>
+	      <td style="text-align:right;white-space:nowrap;">
+		<img id="id3" onclick="clearSelected('history')" type="image" STYLE="vertical-align: middle;"/>
+	      </td>
+	    </tr>
+	    <!--ITEM: Bookmarks-->
+	    <tr class="accordionContentItem">
+	      <td class="settingstext">
+		<span id="txt_browser_settings_clear_data_bookmarks"></span>
+	      </td>
+	      <td style="text-align:right;white-space:nowrap;">
+		<img id="id4" onclick="clearSelected('bookmarks')" type="image" STYLE="vertical-align: middle;"/>
+	      </td>
+	    </tr>
+	    <!--ITEM: Clear all-->
+	    <tr class="accordionContentItem">
+	      <td class="settingstext">
+		<span id="txt_browser_settings_clear_data_all"></span>
+	      </td>
+	      <td style="text-align:right;white-space:nowrap;">
+		<img id="id6" onclick="clearSelected('all')" type="image" STYLE="vertical-align: middle;"/>
+	      </td>
+	    </tr>
+	  </form>
+	</table>        
+      </div>
+
+      <!--SECTION: About Browser-->
+      <div class="accordionButtonABT">&nbsp;&nbsp;
+	<span id="txt_browser_settings_general_settings_about"></span>
+	<img id="im3" align="right" style="padding-right:40px;vertical-align:middle;"/>
+      </div>
+      <!--items-->
+      <div class="accordionContentAboutItem">
+	<!--Nokia Browser About-->
+	<table width="100%" cellspacing="0">
+	  <form name="aboutform">
+	    <tr>
+	      <td class="settingstext" style="padding-left:28px;">Nokia Browser</td>
+	    </tr>
+	    <tr>
+	      <td class="settingstext">
+		<div id="release_version">
+		  <script type="text/javascript">
+		      var UAString = navigator.userAgent;
+		      var brNameVer = "unknown";
+		      var UALen = 1;
+		      var nameStart = 1;	        
+		      UALen = UAString.length;
+		      nameStart = UAString.indexOf("NokiaBrowser");
+		      // test to see if "NokiaBrowser" is in the UA String at all
+		      if (nameStart < 0) {
+		         brNameVer = "NOT a NokiaBrowser Browser";
+		      } else {
+		         // crop string starting at "NokiaBrowser"
+		         brNameVer = UAString.substring(nameStart, UALen);
+		         // limit substring to "NokiaBrowser" and version only 
+		         brNameVer = brNameVer.substr(0, brNameVer.indexOf(" "));
+		         // clean up string for presentation
+		         brNameVer = brNameVer.replace("NokiaBrowser/", " Version: ");
+		      }
+		      document.write(brNameVer);
+		      document.write("<br/>");
+		  </script>
+		</div>	
+	      </td> 
+	    </tr>
+	    <tr>
+	      <td class="contenttext">
+		<iframe src="LegalNotice.html" frameborder="0" scrolling="auto" height=290px></iframe>
+	      </td>
+	    </tr>
+	  </form>
+	</table>                  
+      </div>
+    </div>
+    <!--MENU: end-->
+
+    <!--BOTTOM PAD: start-->
+    <div id="BottomPad"></div>
+    <!--BOTTOM PAD: end-->
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/SettingsViewTenone.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,111 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta name="generator" content=
+    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org" />
+    <script src="/chrome/jquery-1.4.2.min.js" type="text/javascript"></script>
+    <script src="/chrome/ui.core.js" type="text/javascript"></script>
+    <script src="/chrome/effects.core.js" type="text/javascript"></script>
+    <script src="/chrome/effects.blind.js" type="text/javascript"></script>
+    <script src="/chrome/dima.js" type="text/javascript"></script>
+    <link rel="stylesheet" id="CSSLink" type="text/css" href="/settingsview/settingsview.css" />
+    <meta name="viewport" content="width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no" />
+    <meta content="text/html; charset=us-ascii" http-equiv="content-type" />
+    <title>
+        Settings
+    </title>
+    <script src="/settingsview/settingsview.js" type="text/javascript">
+</script>
+</head>
+<body>
+    <!--MENU: start-->
+    <!--SECTION: General Settings-->
+    <div class="accordionButtonGS">
+        &nbsp;&nbsp; <span id="txt_browser_settings_general_settings"></span> 
+        <img id="im1"alt="" />
+    </div>
+    <!--items-->
+    <div class="accordionContent">
+        <!--ITEM: Character encoding-->
+        <div>
+            <div class="accordionContentCharacterEncodingItem">
+                <div class="settingstext" id="selected_encoding_option">
+                    <span class="encoding_state" id="txt_browser_settings_general_settings_character_encoding">
+                    </span><br />
+                    <span class="encoding_state" id="character_encoding_value"></span><br />
+                </div>
+            </div>
+            <div class="accordionContentCharacterEncodingItem">
+                <div class="encoding_options">
+                </div>
+            </div><!--ITEM: Save history-->
+            <div class="accordionContentCharacterEncodingItem" id="saverestore_container">
+                <div class="settingstext">
+                    <span id="txt_browser_settings_general_settings_save_browser_history">
+                    </span>
+                </div><input id="saverestore" type="image" />
+            </div>
+        </div>
+    </div>
+    <!--SECTION: Clear data-->
+    <div class="accordionButtonCD">
+        &nbsp;&nbsp; <span id="txt_browser_settings_clear_data"></span>
+        <img id="im2" alt="" />
+    </div>
+    <!--items-->
+    <div class="accordionContent" id="cleardata">
+        <!--ITEM: Cache-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_cache"></span>
+            </div>
+            <img id="id1" alt=""/>
+        </div><!--ITEM: Cookies-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_cookies"></span>
+            </div>
+            <img id="id2" alt=""/>
+        </div><!--ITEM: History-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_history"></span>
+            </div>
+            <img id="id3" alt=""/>
+        </div><!--ITEM: Bookmarks-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_bookmarks"></span>
+            </div>
+            <img id="id4" alt=""/>
+        </div><!--ITEM: Location Permissions-->
+        <div class="accordionContentItemCD" id="clearGeolocationContainer">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_location"></span>
+            </div>
+            <img id="id5" alt=""/>
+        </div><!--ITEM: Clear all-->
+        <div class="accordionContentItemCD">
+            <div class="settingstext">
+                <span id="txt_browser_settings_clear_data_all"></span>
+            </div>
+            <img id="id6" alt=""/>
+        </div>
+    </div>
+    <!--SECTION: About Browser-->
+    <div class="accordionButtonABT">
+        &nbsp;&nbsp; <span id="txt_browser_settings_general_settings_about"></span> 
+        <img id="im3" alt="" />
+    </div><!--items-->
+    <div class="accordionContentAboutItem">
+        <!--Nokia Browser About-->
+        <span id="release_label">Nokia Browser</span>
+        <span id="release_version"></span>
+        <iframe class="contenttext" src="LegalNotice.html" frameborder="0" scrolling="auto" ></iframe>
+    </div>
+<!--MENU: end--> 
+    <!--BOTTOM PAD: start-->
+    <div id="BottomPad"></div><!--BOTTOM PAD: end-->
+</body>
+</html>
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerarrow_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerarrow_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerbg_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerbg_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons.old/list_itembg.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/broom_sweep.gif has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/broom_sweep.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerarrow_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerarrow_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerbg_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerbg_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_about.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_general_ce.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_off.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_on.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/yes_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/yes_selected.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/radio_off.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/icons/radio_on.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/broom_sweep.gif has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/broom_sweep.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/delete_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/delete_btn_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerarrow_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerarrow_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_closed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_open.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/no_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/no_selected.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/radio_off.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/radio_on.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_btn_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_deselected.png has changed
Binary file ginebra2/chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_selected.png has changed
--- a/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsview.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsview.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,74 +1,296 @@
-body{
-  padding: 0px;
-  margin: 0px;  
-  font-size: 20px;
-  background-color: #889cbf;
+body {
+	padding: 0px;
+	margin: 0px;
+	font-size: 20px;
+	background-color: #889cbf;
+	/*font specification*/
+	font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+	overflow: none;
+}
+
+html {
+	background-color: transparent;
+}
+
+::-webkit-scrollbar {
+	width: 20px;
+	height: 10px;
 }
 
-#wrapper {
-    margin-left: auto;
-    margin-right: auto;
-    }
+::-webkit-scrollbar-track-piece {
+	background-color: #336;
+	-webkit-border-radius: 8px;
+	border-left-style: solid;
+	border-right-style: solid;
+	border-left-width: 1px;
+	border-right-width: 1px;
+	border-left-color: #99b;
+	border-right-color: #7c7c7c;
+}
+
+::-webkit-scrollbar-thumb:vertical {
+	height: 40px;
+	background-color: #667a9d;
+	border: 1px solid #669;
+	border-right-color: #225;
+	border-left-color: #99b;
+	-webkit-border-radius: 8px;
+}
 
 #BottomPad {
-    clear: both;
-    padding: 8px 10px 8px 10px;
-    height: 54px;
-    }
+	clear: both;
+	padding: 8px 10px 8px 10px;
+	height: 54px;
+}
+
+.settingstext { /*font specification*/
+	font-size: 20px;
+	/*decorations*/
+	background: #FFFFFF;
+	color: #283F52;
+	/*margins & paddings*/
+	margin: 0px;
+	padding: 0px;
+	padding-top: 2px;
+	padding-left: 32px;
+	max-width: 100%;
+	/*misc*/
+	z-index: 1;
+	text-align: left;
+	white-space: nowrap;
+	vertical-align: middle;
+}
 
 .accordionButton {
-    float: left;
-    background: #AAAAAA;
-    border-bottom: 1px solid #FFFFFF;
-    cursor: pointer;
-    }
+	float: left;
+	background: #AAAAAA;
+	border-bottom: 1px solid #FFFFFF;
+	cursor: pointer;
+}
+
 .accordionButtonGS {
-    font-size: 20px;
-    padding-top: 10px;
-    padding-bottom: 10px;
-    width: 100%;
-    float: left;
-    background: #E1F1FF;
-    color:#283F52;
-    border-bottom: 1px solid #FFFFFF;
-    cursor: pointer;
-    }
+	font-size: 20px;
+	padding-top: 10px;
+	padding-bottom: 10px;
+	width: 100%;
+	float: left;
+	background: #E1F1FF;
+	color: #283F52;
+	border-bottom: 1px solid #FFFFFF;
+	cursor: pointer;
+}
 
 .accordionButtonCD {
-    font-size: 20px;
-    width: 100%;
-    padding-top: 10px;
-    padding-bottom: 10px;
-    float: left;
-    color:#283F52;
-    background: #E1F1FF;
-    border-bottom: 1px solid #FFFFFF;
-    cursor: pointer;
-    }
+	font-size: 20px;
+	width: 100%;
+	padding-top: 10px;
+	padding-bottom: 10px;
+	float: left;
+	color: #283F52;
+	background: #E1F1FF;
+	border-bottom: 1px solid #FFFFFF;
+	cursor: pointer;
+}
 
 .accordionButtonABT {
-    font-size: 20px;
-    width: 100%;
-    padding-top: 10px;
-    padding-bottom: 10px;
-    float: left;
-    color:#283F52;
-    background: #E1F1FF;
-    border-bottom: 1px solid #FFFFFF;
-    cursor: pointer;
-    }
-    
+	font-size: 20px;
+	width: 100%;
+	padding-top: 10px;
+	padding-bottom: 10px;
+	float: left;
+	color: #283F52;
+	background: #E1F1FF;
+	border-bottom: 1px solid #FFFFFF;
+	cursor: pointer;
+}
+
 .accordionContent {
-    font-size: 20px;
-    padding-left: 20px;
-    float: left;
-    background: #FFFFFF;
-    color:#283F52;
-    display: none;
-    }
+	font-size: 20px;
+	float: left;
+	background: #FFFFFF;
+	color: #283F52;
+	display: none;
+}
+
+.accordionContentItemCD { 
+	/*decorations*/
+	vertical-align: middle;
+	width: 100%;
+	height: 64px;
+	margin: 0px;
+	padding: 0px;
+}
+
+.accordionContentCharacterEncodingItem {
+	float: left;
+	/*dimensions*/
+	width: 100%;
+	/*decorations*/
+}
+
+#selected_encoding_option {
+	display: block;
+	float: left;
+	/*dimensions*/
+	width: 100%;
+	height: 70px;
+	/*decorations*/
+	background-color: transparent;
+}
+
+#character_encoding_value {
+	font-size: 16pt;
+	color: navy;
+	padding-left: 6px;
+}
+
+.encoding_state {
+	width: 100%;
+	height: 24px;
+	margin: 0px;
+	margin-bottom: -1px;
+	padding-top: 10px;
+	display: block;
+	float: left;
+	vertical-align: middle;
+	background-color: transparent;
+}
+
+.encoding_options label {
+	display: inline;
+	float: left;
+	margin: 0px;
+	padding-top: 10px;
+	padding-left: 48px;
+	text-align: left;
+	width: 60%;
+	height: 40px;
+	font-size: 16pt;
+	font-style: bold;
+	overflow: hidden;
+}
+
+span.encoding_option {
+	display: block;
+	float: left;
+	width: 100%;
+	height: 50px;
+	margin: 0px;
+	margin-top: 0px;
+	padding: 0px;
+	padding-right: 40px;
+}
+
+div#saverestore_container {
+	width 100%;
+	height: 60px;
+}
+
+div#saverestore_container div {
+	padding-top: 18px;
+	margin-bottom: 2px;
+	float: left;
+	height: 98%;
+	width: 60%;
+}
 
-.settingstext {
-    font-size: 20px;
-    background: #FFFFFF;
-    color:#283F52;
-    }
+#saverestore {
+	float: right;
+	padding-right: 40px;
+	vertical-align: middle;
+	padding-top: 5px;
+	padding-bottom: 5px;
+}
+
+div.accordionButtonABT img,
+div.accordionButtonCD img,
+div.accordionButtonGS img {
+	padding-right: 5;
+	float: right;
+	vertical-align: middle;
+}
+
+span#txt_browser_settings_general_settings_save_browser_history {
+	height: 100%;
+	vertical-align: middle;
+}
+
+div.settingstext>span#txt_browser_settings_clear_data_cache,
+div.settingstext>span#txt_browser_settings_clear_data_cookies,
+div.settingstext>span#txt_browser_settings_clear_data_history,
+div.settingstext>span#txt_browser_settings_clear_data_bookmarks,
+div.settingstext>span#txt_browser_settings_clear_data_location,
+div.settingstext>span#txt_browser_settings_clear_data_all {
+	display: inline;
+	float: left;
+	overflow: hidden;
+	height: 100%;
+}
+
+span#txt_browser_settings_clear_data_cache,
+span#txt_browser_settings_clear_data_cookies,
+span#txt_browser_settings_clear_data_history,
+span#txt_browser_settings_clear_data_bookmarks,
+span#txt_browser_settings_clear_data_location,
+span#txt_browser_settings_clear_data_all {
+	display: inline;
+	padding-top: 16px;
+	float: left;
+	width: 74%;
+	margin-right: 2px;
+}
+
+img#id1,
+img#id2,
+img#id3,
+img#id4,
+img#id5,
+img#id6 { 
+	/*decorations*/
+	display: inline;
+	float: right;
+	margin: 0px;
+	margin-top: -1px;
+	padding: 0px;
+	padding-right: 16px;
+	white-space: nowrap;
+	text-align: right;
+	vertical-align: middle;
+	top: 0px;
+}
+
+.accordionContentAboutItem { /*decorations*/ /*misc*/
+	display: none;
+	height: 510px;
+	padding-left: 32px;
+	font-size: 18pt;
+	color: #283F52;	
+}
+
+#release_label {
+	padding-top: 6px;
+}
+
+.contenttext {
+	border: 1px solid #336;
+	border-radius: 9px;
+	/*dimensions*/
+	height: 360px;
+	/*margins & paddings*/
+	margin: 0px;
+	margin-right: 6px;
+	padding: 0px;
+	padding-right: 2px;
+	padding-top: 2px;
+	padding-bottom: 2px;
+	/*decorations*/
+	color: #283F52;
+	background-color: #E1F1FF;
+	/*font specification*/
+	font-size: 18px;
+	font-weight: normal;
+	/*misc*/
+	z-index: 1;
+	overflow: hidden;
+	text-overflow: hidden;
+}
\ No newline at end of file
--- a/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsview.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsview.js	Fri Oct 15 17:30:59 2010 -0400
@@ -1,317 +1,455 @@
+// header arrow icons
+var header_closed_src = "/settingsview/list_headerarrow_closed.png";
+var header_open_src = "/settingsview/list_headerarrow_open.png";
+
+// menu section backgrounds
+var bg_closed_src = "/settingsview/list_headerbg_closed.png";
+var bg_open_src = "/settingsview/list_headerbg_open.png";
+
+// menu section item background
+var bg_item_src = "/settingsview/list_itembg.png";
+var bg_item_pressed_src = "/settingsview/list_itembg_pressed.png";
+
+var icon_src = "/settingsview/broom_sweep.png";
+var icon_action_src = "/settingsview/broom_sweep.gif";
+
+var selected_src = "/settingsview/yes_selected.png";
+var deselected_src = "/settingsview/yes_deselected.png";
+
+var radio_on = "/settingsview/radio_on.png";
+var radio_off = "/settingsview/radio_off.png";
+
 var encodingArray = ['Automatic',         
-            				'Big5',                
-										'Big5-HKSCS',
-										'CP949',
-										'EUC-JP',
-										'EUC-KR',
-										'GB18030-0',
-										'IBM-850',
-										'IBM-866',
-										'IBM-874',
-										'ISO-2022-JP',
-										'ISO-8859-1',
-										'ISO-8859-2',
-										'ISO-8859-3',
-										'ISO-8859-4',
-										'ISO-8859-5',
-										'ISO-8859-6',
-										'ISO-8859-7',
-										'ISO-8859-8',
-										'ISO-8859-9',
-										'ISO-8859-10',
-										'ISO-8859-13',
-										'ISO-8859-14',
-										'ISO-8859-15',
-										'ISO-8859-16',
-										'KOI8-R',
-										'KOI8-U',
-										'MuleLao-1',
-										'ROMAN8',
-										'Shift-JIS',
-										'TIS-620',
-										'TSCII',
-										'UTF-8',
-										'UTF-16',
-										'UTF-16BE',
-										'UTF-16LE',
-										'UTF-32',
-										'UTF-32BE',
-										'UTF-32LE',
-										'Windows-1250',
-										'Windows-1251',
-										'Windows-1252',
-										'Windows-1253',
-										'Windows-1254',
-										'Windows-1255',
-										'Windows-1256',
-										'Windows-1257',
-										'Windows-1258'];
-										
-var lastIndex = 47; // change it while adding new encoding strings										
-										
+    				 'Big5',                
+					 'Big5-HKSCS',
+					 'CP949',
+					 'EUC-JP',
+					 'EUC-KR',
+					 'GB18030-0',
+					 'IBM-850',
+					 'IBM-866',
+					 'IBM-874',
+					 'ISO-2022-JP',
+					 'ISO-8859-1',
+					 'ISO-8859-2',
+					 'ISO-8859-3',
+					 'ISO-8859-4',
+					 'ISO-8859-5',
+					 'ISO-8859-6',
+					 'ISO-8859-7',
+					 'ISO-8859-8',
+					 'ISO-8859-9',
+				  	 'ISO-8859-10',
+					 'ISO-8859-13',
+					 'ISO-8859-14',
+					 'ISO-8859-15',
+					 'ISO-8859-16',
+					 'KOI8-R',
+					 'KOI8-U',
+					 'MuleLao-1',
+					 'ROMAN8',
+					 'Shift-JIS',
+					 'TIS-620',
+					 'TSCII',
+					 'UTF-8',
+					 'UTF-16',
+					 'UTF-16BE',
+					 'UTF-16LE',
+					 'UTF-32',
+					 'UTF-32BE',
+					 'UTF-32LE',
+					 'Windows-1250',
+					 'Windows-1251',
+					 'Windows-1252',
+					 'Windows-1253',
+					 'Windows-1254',
+					 'Windows-1255',
+					 'Windows-1256',
+					 'Windows-1257',
+					 'Windows-1258'];
 
-function saveSR(value)
-{
-	  var sr1 = document.getElementById("saverestore1");
-    var sr2 = document.getElementById("saverestore2");
-    if(value == "yes")
-    {
-    	sr1.setAttribute("src", "icons/yes_selected.png");
-    	sr2.setAttribute("src", "icons/no_deselected.png");
-    	window.pageController.saveSaverestoreSettings(1);
-    }
-    else
-    {
-    	sr1.setAttribute("src", "icons/yes_deselected.png");
-    	sr2.setAttribute("src", "icons/no_selected.png");
-    	window.pageController.saveSaverestoreSettings(0);
-    		
-    }
-    window.pageController.setSettingsLoaded(1);
-    
-    
-    
+var encodingOptionsInitialized = false;
+
+// sets localized text constant
+function localizeString(logicalString) {
+	$("#"+logicalString).html(window.localeDelegate.translateText(logicalString));
+}
+
+// get settings Browser history value
+function saverestoreState() {
+	return window.pageController.getSaverestoreSettings();
 }
 
+// settings view form initialization
+function initForms() {
 
-function saveFP(value)
-{
-		var fp1 = document.getElementById("formpwd1");
-    var fp2 = document.getElementById("formpwd2");
-    if(value == "yes")
-    {
-    	fp1.setAttribute("src", "icons/yes_selected.png");
-    	fp2.setAttribute("src", "icons/no_deselected.png");
-    }
-    else
-    {
-    	fp1.setAttribute("src", "icons/yes_deselected.png");
-    	fp2.setAttribute("src", "icons/no_selected.png");
-    		
-    }
-    window.pageController.setSettingsLoaded(1);
-        
+	$("span#character_encoding_value").text(encodingState());
+	
+	if (saverestoreState())
+		$("#saverestore").attr("src", selected_src);
+	else
+		$("#saverestore").attr("src", deselected_src);
+
+	$("#id1").attr("src", icon_src).click(function(){clearSelected("cache");});
+	$("#id2").attr("src", icon_src).click(function(){clearSelected("cookies");});
+	$("#id3").attr("src", icon_src).click(function(){clearSelected("history");});
+	$("#id4").attr("src", icon_src).click(function(){clearSelected("bookamrks");});
+	$("#id5").attr("src", icon_src).click(function(){clearSelected("geolocation");});
+	$("#id6").attr("src", icon_src).click(function(){clearSelected("all");});
+
+	$(".encoding_options").hide();
+		
+	localizeString("txt_browser_settings_general_settings");
+	localizeString("txt_browser_settings_general_settings_character_encoding");
+	localizeString("txt_browser_settings_general_settings_save_browser_history");
+	localizeString("txt_browser_settings_clear_data");
+	localizeString("txt_browser_settings_clear_data_cache");
+	localizeString("txt_browser_settings_clear_data_cookies");
+	localizeString("txt_browser_settings_clear_data_history");
+	localizeString("txt_browser_settings_clear_data_bookmarks");
+	localizeString("txt_browser_settings_clear_data_location");
+	// localizeString("txt_browser_settings_clear_data_form_data");
+	localizeString("txt_browser_settings_clear_data_all");
+	localizeString("txt_browser_settings_general_settings_about");
+
 }
 
-function localizeString(logicalString)
-{
-    document.getElementById(logicalString).innerHTML = window.localeDelegate.translateText(logicalString);
+// execute action according to setting value
+function clearSelected(field) {
+
+	window.pageController.setSettingsLoaded(2);
+
+	if (field == "cache") { // Cache
+
+		$("#id1").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.pageController.deleteCache();		
+		return;
+
+	} else if (field == "cookies") { // Cookies
+
+		$("#id2").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.pageController.deleteCookies();		
+		return;
+		
+	} else if (field == "history") { // History
+		
+		$("#id3").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);  
+		window.historyManager.clearHistory();		
+		return;    				        			 
+
+	} else if (field == "bookmarks") { // Bookmarks
+
+		$("#id4").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.bookmarksController.clearAll();		
+		return;
+
+	} else if (field == "geolocation") { // GeoLocation
+
+		$("#id5").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.geolocationManager.clearAllGeodata();
+		return;
+
+	} else if (field == "all") { // everything
+
+		$("#id6").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);  
+		deleteData();
+		return;
+
+	} else {
+
+		return;
+
+	}
+
+}
+
+// clear all data represented by settings
+function deleteData() {
+
+	window.pageController.deleteCache();
+	window.pageController.deleteCookies();
+	window.historyManager.clearHistory();
+	window.bookmarksController.clearAll();
+	window.geolocationManager.clearAllGeodata();
+	window.pageController.deleteDataFiles();
+}
+
+// save Browser history
+function saveSR(img_src) {
+
+	var flag;
+	if (img_src == deselected_src) {
+
+		$("#saverestore").attr("src", selected_src);
+		flag = 1;
+
+	} else {
+
+		$("#saverestore").attr("src", deselected_src);
+		flag = 0;
+
+	}
+	window.pageController.saveSaverestoreSettings(flag);
+	window.pageController.setSettingsLoaded(1);
+}
+
+//gets settings Character encoding value
+function encodingState() {
+	return window.pageController.getTextEncoding() || "Automatic"; 
+}
+
+function setEncodingState(value) {
+	window.pageController.setTextEncoding(value);
+	app.debug("Encoding State set to " + value);
 }
 
-function initForms()
-{
-    //var index1 = popupState();
-    //blockpopup.formbutton[index1].checked = true;
-  
-		var index1 = saverestoreState();
-    
-    var sr1 = document.getElementById("saverestore1");
-    var sr2 = document.getElementById("saverestore2");
-    if(index1 == 0)
-    {
-    	sr1.setAttribute("src", "icons/yes_selected.png");
-    	sr2.setAttribute("src", "icons/no_deselected.png");
-    }
-    else
-    {
-    	sr1.setAttribute("src", "icons/yes_deselected.png");
-    	sr2.setAttribute("src", "icons/no_selected.png");
-    		
-    }
-
-    /*var index2 = saveFormpasswordState();
-    
-    var fp1 = document.getElementById("formpwd1");
-    var fp2 = document.getElementById("formpwd2");
-    if(index2 == 0)
-    {
-    	fp1.setAttribute("src", "icons/yes_selected.png");
-    	fp2.setAttribute("src", "icons/no_deselected.png");
-    }
-    else
-    {
-    	fp1.setAttribute("src", "icons/yes_deselected.png");
-    	fp2.setAttribute("src", "icons/no_selected.png");
-    		
-    }*/
+function setupEncodingOptions() {
+	var encodingOptions = $(".encoding_options");
+	var prevOption = null;
+	var option = null;
+	var encState = encodingState();
+	for(index in encodingArray) {
+		option = $("<span class='encoding_option'>" +
+				"	<label>" + encodingArray[index]  + "</label>" +
+				"	<img class='contentCharacterEncodingItem' id='" + encodingArray[index]  + "' alt='' />" +
+				"</span><br />");
+		var img = option.find("img"); 
+		if(img.attr('id') == encState) {
+			img.attr("src", "url(" + radio_on + ")");
+		}
+		else { 
+			img.attr("src", "url(" + radio_off + ")");
+		}
+    	
+		if(prevOption)
+			option.insertAfter(prevOption);
+		else
+			encodingOptions.html(option);
 
-    var index3;
-    index3 = encodingState();    
-    //this.options[this.selectedIndex].value
-    encoding.formbutton[index3].selected = true;    
-    
-    
-    var cs1 = document.getElementById("id1");
-    var cs2 = document.getElementById("id2");
-    var cs3 = document.getElementById("id3");
-    var cs4 = document.getElementById("id4");
-    //var cs5 = document.getElementById("id5");
-    var cs6 = document.getElementById("id6");
-   
-   	cs1.setAttribute("src", "icons/broom_sweep.png");
-   	cs2.setAttribute("src", "icons/broom_sweep.png");
-   	cs3.setAttribute("src", "icons/broom_sweep.png");
-   	cs4.setAttribute("src", "icons/broom_sweep.png");
-   	//cs5.setAttribute("src", "icons/broom_sweep.png");
-   	cs6.setAttribute("src", "icons/broom_sweep.png");
-   	
-   	localizeString("txt_browser_settings_general_settings");
-   	localizeString("txt_browser_settings_general_settings_character_encoding");
-   	localizeString("txt_browser_settings_general_settings_save_browser_history");
-   	localizeString("txt_browser_settings_clear_data");
-   	localizeString("txt_browser_settings_clear_data_cache");
-   	localizeString("txt_browser_settings_clear_data_cookies");
-   	localizeString("txt_browser_settings_clear_data_history");
-   	localizeString("txt_browser_settings_clear_data_bookmarks");
-   	//localizeString("txt_browser_settings_clear_data_form_data");
-   	localizeString("txt_browser_settings_clear_data_all");
-   	localizeString("txt_browser_settings_general_settings_about");
-   	
-   	
-}
-
-window.onload = initForms;
-
-
-
-function popupState()
-{
-      if (window.pageController.getPopupSettings() == true)
-                return 0;
-        else
-                return 1;
-}
-
-function saverestoreState()
-{
-      if (window.pageController.getSaverestoreSettings() == true)
-      {
-          return 0;
-        }
-        else
-        {
-            return 1;
-      }
-}
-
-function encodingState()
-{
-    var  encString;
-    var index;
-    encString = window.pageController.getTextEncoding();    
-    index = findEncodingIndex(encString);
-    return index;
+		prevOption = option;
+	}
+	
+	$("span.encoding_option").click(function() {
+		$('.encoding_options').find("#" + encodingState()).attr("src", "url(" + radio_off + ")");
+		
+		$(this).find('img').attr("src", "url(" + radio_on + ")");
+		app.debug("option:" + $(this).find('img').attr('id') + " selected.");
+		setEncodingState($(this).find('img').attr('id'));
+		$('.encoding_options').slideUp();
+		$('span#character_encoding_value').text(encodingState());
+	});	
+	
+	encodingOptionsInitialized = true;
+	app.debug("Encoding Options Initialized");
 }
 
-function saveFormpasswordState()
-{
-    return 1;
-}
+$(document).ready(function() {
+	
+	initForms();
+	
+	// HIDE THE DIVS ON PAGE LOAD
+	var settingsLoaded = window.pageController.getSettingsLoaded();
+
+	$('.encoding_options').hide();
+	$('#selected_encoding_option').click(function() {
+		if(!encodingOptionsInitialized) 
+			setupEncodingOptions();
+ 		$('.encoding_options').slideToggle();
+	});
+
+	$('#saverestore').click(function() {
+		saveSR( $(this).attr('src') ); 
+		return false;
+	});
+	
+    if(settingsLoaded == 0) {
+
+        $("div.accordionContent").hide();
 
-function checkAll(field)
-{
-for (i = 0; i < field.length; i++)
-field[i].checked = true ;
-}
-function uncheckAll(field)
-{
-for (i = 0; i < field.length; i++)
-field[i].checked = false ;
-}
+        // set menu section items background
+        $("div.accordionContentItem").css("background-image", bg_item_src);
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "0px");
 
-function pausecomp(millis) 
-{
-	var date = new Date();
-	var curDate = null;
+        // set header arrow image
+        $("#im1").attr("src", header_closed_src);	
+        $("#im2").attr("src", header_closed_src);
+        $("#im3").attr("src", header_closed_src);
+
+    } else if(settingsLoaded == 1) {
 
-	do { curDate = new Date(); } 
-		while(curDate-date < millis);
-} 
+        $('div.accordionButtonGS').next().show();
+
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_open_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "1px");
 
-function clearSelected(field)
-{
-	  window.pageController.setSettingsLoaded(2);      
-            
-    if (field == "cache")
-    { 
-      window.pageController.deleteCache();
-      var cs1 = document.getElementById("id1");
-      cs1.setAttribute("src", "icons/broom_sweep.gif");
-      setTimeout("initForms()", 2000);
-      return;
-    }
-      
-    if (field == "cookies") // Cookies
-    {
-    	    var cs2 = document.getElementById("id2");
-         	cs2.setAttribute("src", "icons/broom_sweep.gif");
-      		window.pageController.deleteCookies();
-      		setTimeout("initForms()", 2000);	
-      		return;
-          
-  	}
+        // set header arrow image
+        $("#im1").attr("src", header_open_src);
+        $("#im2").attr("src", header_closed_src);  
+        $("#im3").attr("src", header_closed_src);  
+
+    } else if(settingsLoaded == 2) {
+
+        $('div.accordionButtonCD').next().show();
+
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_open_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "0px");
+
+        // set header arrow image
+        $("#im1").attr("src", header_closed_src);
+        $("#im2").attr("src", header_open_src);  
+        $("#im3").attr("src", header_closed_src);  
+
+   } else if(settingsLoaded == 3) {
+
+        $('div.accordionButtonABT').next().show();
 
-  if (field == "history") // History
-  {
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_open_src + ")");
+
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "0px");
+
+        // set header arrow image
+        $("#im1").attr("src", header_closed_src);
+        $("#im1").attr("src", header_closed_src);  
+        $("#im1").attr("src", header_open_src);  
+
+  }	  
+
+  //ACCORDION BUTTON ACTION
+  $('div.accordionButtonGS').click(function() {
+       //$('div.accordionContent').slideUp('normal');
+       //$(this).next().slideDown('normal');
+
+       $(this).next().toggle();
+       $('div.accordionButtonCD').next().hide();
+       $('div.accordionButtonABT').next().hide();
+         
+       if( $("#im1").attr("src") == header_closed_src ) { // current state
 
-              window.historyManager.clearHistory();
-              var cs3 = document.getElementById("id3");
-      				cs3.setAttribute("src", "icons/broom_sweep.gif");
-      				setTimeout("initForms()", 2000);  
-      				return;    				        			 
-         			 
-              //window.views.WebView.reload();
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_open_src + ")");
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+            // Fix margin between General and Clear Data accordion buttons
+            $('div.accordionButtonCD').css("margin-top", "0px");
+
+            // change list headerarrow icon
+            $("#im1").attr("src", header_open_src);
+            $("#im2").attr("src", header_closed_src);
+            $("#im3").attr("src", header_closed_src);
 
-  }
+       } else if( $("#im1").attr("src") == header_open_src ) {
+ 
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+            // change list headerarrow icon
+            $("#im1").attr("src", header_closed_src);
+       }       
+  });
+
+  $('div.accordionButtonCD').click(function() {
 
-  if (field == "bookmarks") // Bookmarks
-  {
+       $(this).next().toggle();
+       $('div.accordionButtonGS').next().hide();
+       $('div.accordionButtonABT').next().hide();
+ 
+       if( $("#im2").attr("src") == header_closed_src ) { // current state
+
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_open_src + ")");
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+            // Fix margin between General and Clear Data accordion buttons
+            $('div.accordionButtonCD').css("margin-top", "1px");
 
-              window.bookmarksController.clearAll();
-              var cs4 = document.getElementById("id4");
-      				cs4.setAttribute("src", "icons/broom_sweep.gif");
-      				setTimeout("initForms()", 2000);
-      				return;
-              //window.views.WebView.reload();
+            // change list headerarrow icon
+            $("#im1").attr("src", header_closed_src);
+            $("#im2").attr("src", header_open_src);
+            $("#im3").attr("src", header_closed_src);
+ 		
+       } else if( $("#im2").attr("src") == header_open_src ) {
+ 
+            // set menu sections background
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+            // change list headerarrow icon
+            $("#im2").attr("src", header_closed_src);
+       }
+
+  	});
 
-   }
+  	$('div.accordionButtonABT').click(function() {
+
+  		$(this).next().toggle();
+  		$('div.accordionButtonGS').next().hide();
+		$('div.accordionButtonCD').next().hide();
+    
+		if( $("#im3").attr("src") == header_closed_src ) { // current state
+
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_open_src + ")");
+
+            // Fix margin between General and Clear Data accordion buttons
+            $('div.accordionButtonCD').css("margin-top", "0px");
 
+            // change list headerarrow icon
+            $("#im1").attr("src", header_closed_src);
+            $("#im2").attr("src", header_closed_src);
+            $("#im3").attr("src", header_open_src);
+ 		
+		} else if( $("#im3").attr("src") == header_open_src ) {
  
-    if (field == "all") // everything
-    {
-    	var cs6 = document.getElementById("id6");
-      cs6.setAttribute("src", "icons/broom_sweep.gif");
-      setTimeout("initForms();deleteData()", 2000);  
-      return;
-     
+            // set menu sections background
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+            // change list headerarrow icon
+            $("#im3").attr("src", header_closed_src);
+
+		}
+  	});
+  
+    var UAString = navigator.userAgent;
+    var brNameVer = "unknown";
+    var UALen = 1;
+    var nameStart = 1;
+    UALen = UAString.length;
+    nameStart = UAString.indexOf("NokiaBrowser");
+    // test to see if "NokiaBrowser" is in the UA String at all
+    if (nameStart < 0) {
+        brNameVer = "NOT a NokiaBrowser Browser";
+    } else {
+        // crop string starting at "NokiaBrowser"
+    	brNameVer = UAString.substring(nameStart, UALen);
+    	// limit substring to "NokiaBrowser" and version only
+    	brNameVer = brNameVer.substr(0, brNameVer.indexOf(" "));
+    	// clean up string for presentation
+    	brNameVer = brNameVer.replace("NokiaBrowser/", " Version: ");
     }
-
-    
-}
-
-function deleteData()
-{
-    window.pageController.deleteCache();
-    window.pageController.deleteCookies();
-    window.historyManager.clearHistory();
-    window.bookmarksController.clearAll();
-    window.pageController.deleteDataFiles();
-}
-
-
-function setValue(selectedIndex)
-{
-	//alert(this.options[this.selectedIndex].value);
-	window.pageController.setSettingsLoaded(1);    
-	window.pageController.setTextEncoding(encodingArray[selectedIndex]);
-}
-
-function findEncodingIndex(encodingString)
-{
-  for(var index = 0; index <= lastIndex; index++)
-    if( encodingArray[index] == encodingString)
-    	return index;
-    	
-  return (0);
-}   	
-
+    $('#release_version').html(brNameVer + "<br />");
+});
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,337 @@
+/******* css for settings view *******/
+body { /*margins & paddings*/
+	position: absolute;
+	top: 0;
+	left: 0;
+	bottom: 0;
+	right: 0px;
+	padding: 0px;
+	margin: 0px;
+	/*decorations*/
+	background-color: black;
+	color: white;
+	/*font specification*/
+	font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
+	overflow:none;
+}
+
+html {
+	background-color: transparent;
+}
+
+::-webkit-scrollbar {
+	width: 20px;
+	height: 10px;
+}
+
+::-webkit-scrollbar-track-piece  {
+	background-color: #3b3b3b;
+	-webkit-border-radius: 8px;
+	border-left-style: solid;
+	border-right-style: solid;
+	border-left-width: 1px;
+	border-right-width: 1px;
+	border-left-color: #222222;
+	border-right-color: #7c7c7c;
+}
+
+::-webkit-scrollbar-thumb:vertical {
+	height: 40px;
+	background-color: #666;
+	border: 1px solid #999;
+	border-right-color: #555;
+	border-left-color:#bbb;
+	-webkit-border-radius: 8px;
+}
+
+#BottomPad { /*dimensions*/
+	height: 54px;
+	/*margins & paddings*/
+	padding: 8px 10px 8px 10px;
+	/*misc*/
+	clear: both;
+}
+
+.settingstext { 
+	
+	/*margins & paddings*/
+	margin: 0px;
+	padding: 0px;
+	padding-top: 2px;
+	padding-left: 32px;
+	max-width: 100%;
+	/*decorations*/
+	color: white;
+	/*font specification*/
+	font-size: 24px;
+	font-style: bold;
+	/*misc*/
+	z-index: 1;
+	text-align: left;
+	white-space: nowrap;
+	vertical-align: middle;
+}
+
+
+.accordionButton { /*decorations*/
+	float: left;
+	/*misc*/
+	cursor: pointer;
+}
+
+.accordionButtonGS { /*dimensions*/
+	width: 100%;
+	/*margins & paddings*/
+	padding-top: 10px;
+	padding-bottom: 10px;
+	/*decorations*/
+	color: #cccccc;
+	background-repeat: repeat-x;
+	float: left;
+	/*font specification*/
+	font-size: 24px;
+	font-style: bold;
+	/*misc*/
+	cursor: pointer;
+	vertical-align: middle;
+}
+
+.accordionButtonCD { /*dimensions*/
+	width: 100%;
+	/*margins & paddings*/
+	padding-top: 10px;
+	padding-bottom: 10px;
+	/*decorations*/
+	color: #cccccc;
+	background-repeat: repeat-x;
+	float: left;
+	/*font specification*/
+	font-size: 24px;
+	font-style: bold;
+	/*misc*/
+	cursor: pointer;
+	vertical-align: middle;
+}
+
+.accordionButtonABT { /*dimensions*/
+	width: 100%;
+	/*margins & paddings*/
+	padding-right: 5px; 
+	padding-top: 10px;
+	padding-bottom: 10px;
+	/*decorations*/
+	color: #cccccc;
+	background-repeat: repeat-x;
+	float: left;
+	/*font specification*/
+	font-size: 24px;
+	font-style: bold;
+	/*misc*/
+	cursor: pointer;
+	vertical-align: middle;
+}
+
+.accordionContent { /*decorations*/
+	color: white;
+	float: left;
+	width: 100%;
+	/*misc*/
+	display: none;
+}
+
+.accordionContentItemCD { /*decorations*/
+	background-image: url(/settingsview/list_itembg.png);
+	background-repeat: repeat-x;
+  	background-position: left top;
+  	vertical-align: middle;
+  	width: 100%;
+  	height: 64px;
+  	margin: 0px;
+  	padding: 0px;
+}
+
+.accordionContentCharacterEncodingItem {
+	float: left;
+	/*dimensions*/
+	width: 100%;
+  	/*decorations*/
+	background-image: url(/settingsview/list_itembg.png);
+	background-repeat: repeat-x;
+  	background-position: left top;
+}
+
+#selected_encoding_option {
+	display: block;
+	float: left;
+	/*dimensions*/
+	width: 100%;
+  	height: 70px;
+  	/*decorations*/
+  	background-color: transparent;
+}
+
+#character_encoding_value {
+	font-size:16pt;
+	color: cyan;
+	padding-left: 6px;
+}
+
+.encoding_state {
+	width: 100%;
+	height: 24px;
+	margin: 0px;
+	margin-bottom: -1px;
+	padding-top: 10px;
+	display: block;
+	float: left;
+	vertical-align: middle;
+	background-color: transparent;
+}
+
+.encoding_options label {
+	display: inline;
+	float: left;
+	margin: 0px;
+	padding-top: 10px;
+	padding-left: 48px;
+	text-align: left;
+	width:60%;
+	height:40px;
+	font-size: 16pt;
+	font-style: bold;
+	overflow: hidden;
+}
+
+span.encoding_option  {
+	display: block;
+	float:left;
+	width: 100%;
+	height: 50px;
+	margin: 0px;
+	margin-top: 0px;
+	padding: 0px;
+	padding-right: 40px;
+	background-image: url(/settingsview/list_headerbg_closed.png);
+	background-repeat: repeat-x;
+	background-position: left bottom;
+}
+
+span.encoding_option:pressed {
+	background-image: url(/settingsview/list_headerbg_open.png);
+	background-repeat: repeat-x;
+	background-position: left bottom;	
+}
+
+div#saverestore_container {
+	width 100%;
+	height: 60px;
+}
+
+div#saverestore_container div {
+	padding-top: 18px;
+	margin-bottom: 2px;
+	float: left;
+	height: 98%;
+	width: 60%;
+}
+
+#saverestore {
+	float: right;
+	padding-right: 40px;
+	vertical-align: middle; 
+	padding-top: 5px; 
+	padding-bottom: 5px;
+}
+
+div.accordionButtonABT img, 
+div.accordionButtonCD img,
+div.accordionButtonGS img {
+	padding-right: 5;
+	float: right;
+	vertical-align: middle;
+}
+
+span#txt_browser_settings_general_settings_save_browser_history {
+	height: 100%;
+	vertical-align: middle;
+}
+
+div.settingstext>span#txt_browser_settings_clear_data_cache,
+div.settingstext>span#txt_browser_settings_clear_data_cookies,
+div.settingstext>span#txt_browser_settings_clear_data_history,
+div.settingstext>span#txt_browser_settings_clear_data_bookmarks,
+div.settingstext>span#txt_browser_settings_clear_data_location,
+div.settingstext>span#txt_browser_settings_clear_data_all {
+	display: inline;
+	float: left;
+	overflow: hidden;
+	height: 100%;
+}
+
+span#txt_browser_settings_clear_data_cache,
+span#txt_browser_settings_clear_data_cookies,
+span#txt_browser_settings_clear_data_history,
+span#txt_browser_settings_clear_data_bookmarks,
+span#txt_browser_settings_clear_data_location,
+span#txt_browser_settings_clear_data_all {
+	display: inline;
+	padding-top: 16px;
+	float: left;
+	width: 74%;
+	margin-right: 2px;
+}
+
+img#id1, img#id2, img#id3, img#id4, img#id5, img#id6 { 
+	/*decorations*/
+	display: inline;
+	float: right;
+	margin: 0px;
+	margin-top: -1px;
+	padding: 0px;
+	padding-right: 5px;
+	white-space: nowrap;
+  	text-align: right;
+  	vertical-align: middle;
+  	top:0px;
+}
+
+.accordionContentAboutItem {
+	/*decorations*/
+	background-image: url(/settingsview/list_itembg_about.png);
+	background-repeat: repeat-x;
+	background-position: right bottom;
+	/*misc*/
+	display: none;
+	height: 510px;
+	padding-left: 32px;
+	font-size: 18pt;
+}
+
+#release_label {
+	padding-top: 6px;
+}
+
+.contenttext { 
+	background-color: black;
+	border: 1px solid #666;
+	border-radius: 9px;
+	/*dimensions*/
+	/*margins & paddings*/
+	margin:0px;
+	margin-right: 6px;
+	padding: 0px;
+	padding-right: 2px;
+	padding-top: 2px;
+	padding-bottom: 2px;
+	height: 280px;
+	/*decorations*/
+	color: white;
+	
+	/*font specification*/
+	font-size: 18px;
+	font-weight: normal;
+	/*misc*/
+	z-index: 1;
+	overflow:hidden;
+	text-overflow: hidden;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewTenone.js	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,457 @@
+// header arrow icons
+var header_closed_src = "/settingsview/list_headerarrow_closed.png";
+var header_open_src = "/settingsview/list_headerarrow_open.png";
+
+// menu section backgrounds
+var bg_closed_src = "/settingsview/list_headerbg_closed.png";
+var bg_open_src = "/settingsview/list_headerbg_open.png";
+
+// menu section item background
+var bg_item_src = "/settingsview/list_itembg.png";
+var bg_item_pressed_src = "/settingsview/list_itembg_pressed.png";
+
+var icon_src = "/settingsview/broom_sweep.png";
+var icon_action_src = "/settingsview/broom_sweep.gif";
+
+var selected_src = "/settingsview/yes_selected.png";
+var deselected_src = "/settingsview/yes_deselected.png";
+
+var radio_on = "/settingsview/radio_on.png";
+var radio_off = "/settingsview/radio_off.png";
+
+var encodingArray = ['Automatic',         
+    				 'Big5',                
+					 'Big5-HKSCS',
+					 'CP949',
+					 'EUC-JP',
+					 'EUC-KR',
+					 'GB18030-0',
+					 'IBM-850',
+					 'IBM-866',
+					 'IBM-874',
+					 'ISO-2022-JP',
+					 'ISO-8859-1',
+					 'ISO-8859-2',
+					 'ISO-8859-3',
+					 'ISO-8859-4',
+					 'ISO-8859-5',
+					 'ISO-8859-6',
+					 'ISO-8859-7',
+					 'ISO-8859-8',
+					 'ISO-8859-9',
+				  	 'ISO-8859-10',
+					 'ISO-8859-13',
+					 'ISO-8859-14',
+					 'ISO-8859-15',
+					 'ISO-8859-16',
+					 'KOI8-R',
+					 'KOI8-U',
+					 'MuleLao-1',
+					 'ROMAN8',
+					 'Shift-JIS',
+					 'TIS-620',
+					 'TSCII',
+					 'UTF-8',
+					 'UTF-16',
+					 'UTF-16BE',
+					 'UTF-16LE',
+					 'UTF-32',
+					 'UTF-32BE',
+					 'UTF-32LE',
+					 'Windows-1250',
+					 'Windows-1251',
+					 'Windows-1252',
+					 'Windows-1253',
+					 'Windows-1254',
+					 'Windows-1255',
+					 'Windows-1256',
+					 'Windows-1257',
+					 'Windows-1258'];
+
+var encodingOptionsInitialized = false;
+
+// sets localized text constant
+function localizeString(logicalString) {
+	$("#"+logicalString).html(window.localeDelegate.translateText(logicalString));
+}
+
+// get settings Browser history value
+function saverestoreState() {
+	return window.pageController.getSaverestoreSettings();
+}
+
+// settings view form initialization
+function initForms() {
+
+	$("span#character_encoding_value").text(encodingState());
+	
+	if (saverestoreState())
+		$("#saverestore").attr("src", selected_src);
+	else
+		$("#saverestore").attr("src", deselected_src);
+
+	$("#id1").attr("src", icon_src).click(function(){clearSelected("cache");});
+	$("#id2").attr("src", icon_src).click(function(){clearSelected("cookies");});
+	$("#id3").attr("src", icon_src).click(function(){clearSelected("history");});
+	$("#id4").attr("src", icon_src).click(function(){clearSelected("bookamrks");});
+	$("#id5").attr("src", icon_src).click(function(){clearSelected("geolocation");});
+	$("#id6").attr("src", icon_src).click(function(){clearSelected("all");});
+
+	$(".encoding_options").hide();
+		
+	localizeString("txt_browser_settings_general_settings");
+	localizeString("txt_browser_settings_general_settings_character_encoding");
+	localizeString("txt_browser_settings_general_settings_save_browser_history");
+	localizeString("txt_browser_settings_clear_data");
+	localizeString("txt_browser_settings_clear_data_cache");
+	localizeString("txt_browser_settings_clear_data_cookies");
+	localizeString("txt_browser_settings_clear_data_history");
+	localizeString("txt_browser_settings_clear_data_bookmarks");
+	localizeString("txt_browser_settings_clear_data_location");
+	// localizeString("txt_browser_settings_clear_data_form_data");
+	localizeString("txt_browser_settings_clear_data_all");
+	localizeString("txt_browser_settings_general_settings_about");
+
+  if (!app.geolocation())
+        $("#clearGeolocationContainer").css("display", "none");
+}
+
+// execute action according to setting value
+function clearSelected(field) {
+
+	window.pageController.setSettingsLoaded(2);
+
+	if (field == "cache") { // Cache
+
+		$("#id1").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.pageController.deleteCache();		
+		return;
+
+	} else if (field == "cookies") { // Cookies
+
+		$("#id2").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.pageController.deleteCookies();		
+		return;
+		
+	} else if (field == "history") { // History
+		
+		$("#id3").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);  
+		window.historyManager.clearHistory();		
+		return;    				        			 
+
+	} else if (field == "bookmarks") { // Bookmarks
+
+		$("#id4").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.bookmarksController.clearAll();		
+		return;
+
+	} else if (field == "geolocation") { // GeoLocation
+
+		$("#id5").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		window.geolocationManager.clearAllGeodata();
+		return;
+
+	} else if (field == "all") { // everything
+
+		$("#id6").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);  
+		deleteData();
+		return;
+
+	} else {
+
+		return;
+
+	}
+
+}
+
+// clear all data represented by settings
+function deleteData() {
+
+	window.pageController.deleteCache();
+	window.pageController.deleteCookies();
+	window.historyManager.clearHistory();
+	window.bookmarksController.clearAll();
+	window.geolocationManager.clearAllGeodata();
+	window.pageController.deleteDataFiles();
+}
+
+// save Browser history
+function saveSR(img_src) {
+
+	var flag;
+	if (img_src == deselected_src) {
+
+		$("#saverestore").attr("src", selected_src);
+		flag = 1;
+
+	} else {
+
+		$("#saverestore").attr("src", deselected_src);
+		flag = 0;
+
+	}
+	window.pageController.saveSaverestoreSettings(flag);
+	window.pageController.setSettingsLoaded(1);
+}
+
+//gets settings Character encoding value
+function encodingState() {
+	return window.pageController.getTextEncoding() || "Automatic"; 
+}
+
+function setEncodingState(value) {
+	window.pageController.setTextEncoding(value);
+	app.debug("Encoding State set to " + value);
+}
+
+function setupEncodingOptions() {
+	var encodingOptions = $(".encoding_options");
+	var prevOption = null;
+	var option = null;
+	var encState = encodingState();
+	for(index in encodingArray) {
+		option = $("<span class='encoding_option'>" +
+				"	<label>" + encodingArray[index]  + "</label>" +
+				"	<img class='contentCharacterEncodingItem' id='" + encodingArray[index]  + "' alt='' />" +
+				"</span><br />");
+		var img = option.find("img"); 
+		if(img.attr('id') == encState) {
+			img.attr("src", "url(" + radio_on + ")");
+		}
+		else { 
+			img.attr("src", "url(" + radio_off + ")");
+		}
+    	
+		if(prevOption)
+			option.insertAfter(prevOption);
+		else
+			encodingOptions.html(option);
+
+		prevOption = option;
+	}
+	
+	$("span.encoding_option").click(function() {
+		$('.encoding_options').find("#" + encodingState()).attr("src", "url(" + radio_off + ")");
+		
+		$(this).find('img').attr("src", "url(" + radio_on + ")");
+		app.debug("option:" + $(this).find('img').attr('id') + " selected.");
+		setEncodingState($(this).find('img').attr('id'));
+		$('.encoding_options').slideUp();
+		$('span#character_encoding_value').text(encodingState());
+	});	
+	
+	encodingOptionsInitialized = true;
+	app.debug("Encoding Options Initialized");
+}
+
+$(document).ready(function() {
+	
+	initForms();
+	
+	// HIDE THE DIVS ON PAGE LOAD
+	var settingsLoaded = window.pageController.getSettingsLoaded();
+
+	$('.encoding_options').hide();
+	$('#selected_encoding_option').click(function() {
+		if(!encodingOptionsInitialized) 
+			setupEncodingOptions();
+ 		$('.encoding_options').slideToggle();
+	});
+
+	$('#saverestore').click(function() {
+		saveSR( $(this).attr('src') ); 
+		return false;
+	});
+	
+    if(settingsLoaded == 0) {
+
+        $("div.accordionContent").hide();
+
+        // set menu section items background
+        $("div.accordionContentItem").css("background-image", bg_item_src);
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "0px");
+
+        // set header arrow image
+        $("#im1").attr("src", header_closed_src);	
+        $("#im2").attr("src", header_closed_src);
+        $("#im3").attr("src", header_closed_src);
+
+    } else if(settingsLoaded == 1) {
+
+        $('div.accordionButtonGS').next().show();
+
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_open_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "1px");
+
+        // set header arrow image
+        $("#im1").attr("src", header_open_src);
+        $("#im2").attr("src", header_closed_src);  
+        $("#im3").attr("src", header_closed_src);  
+
+    } else if(settingsLoaded == 2) {
+
+        $('div.accordionButtonCD').next().show();
+
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_open_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "0px");
+
+        // set header arrow image
+        $("#im1").attr("src", header_closed_src);
+        $("#im2").attr("src", header_open_src);  
+        $("#im3").attr("src", header_closed_src);  
+
+   } else if(settingsLoaded == 3) {
+
+        $('div.accordionButtonABT').next().show();
+
+        // set menu sections background
+        $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+        $('div.accordionButtonABT').css("background-image", "url(" + bg_open_src + ")");
+
+        // Fix margin between General and Clear Data accordion buttons
+        $('div.accordionButtonCD').css("margin-top", "0px");
+
+        // set header arrow image
+        $("#im1").attr("src", header_closed_src);
+        $("#im1").attr("src", header_closed_src);  
+        $("#im1").attr("src", header_open_src);  
+
+  }	  
+
+  //ACCORDION BUTTON ACTION
+  $('div.accordionButtonGS').click(function() {
+       //$('div.accordionContent').slideUp('normal');
+       //$(this).next().slideDown('normal');
+
+       $(this).next().toggle();
+       $('div.accordionButtonCD').next().hide();
+       $('div.accordionButtonABT').next().hide();
+         
+       if( $("#im1").attr("src") == header_closed_src ) { // current state
+
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_open_src + ")");
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+            // Fix margin between General and Clear Data accordion buttons
+            $('div.accordionButtonCD').css("margin-top", "0px");
+
+            // change list headerarrow icon
+            $("#im1").attr("src", header_open_src);
+            $("#im2").attr("src", header_closed_src);
+            $("#im3").attr("src", header_closed_src);
+
+       } else if( $("#im1").attr("src") == header_open_src ) {
+ 
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+            // change list headerarrow icon
+            $("#im1").attr("src", header_closed_src);
+       }       
+  });
+
+  $('div.accordionButtonCD').click(function() {
+
+       $(this).next().toggle();
+       $('div.accordionButtonGS').next().hide();
+       $('div.accordionButtonABT').next().hide();
+ 
+       if( $("#im2").attr("src") == header_closed_src ) { // current state
+
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_open_src + ")");
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+
+            // Fix margin between General and Clear Data accordion buttons
+            $('div.accordionButtonCD').css("margin-top", "1px");
+
+            // change list headerarrow icon
+            $("#im1").attr("src", header_closed_src);
+            $("#im2").attr("src", header_open_src);
+            $("#im3").attr("src", header_closed_src);
+ 		
+       } else if( $("#im2").attr("src") == header_open_src ) {
+ 
+            // set menu sections background
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+            // change list headerarrow icon
+            $("#im2").attr("src", header_closed_src);
+       }
+
+  	});
+
+  	$('div.accordionButtonABT').click(function() {
+
+  		$(this).next().toggle();
+  		$('div.accordionButtonGS').next().hide();
+		$('div.accordionButtonCD').next().hide();
+    
+		if( $("#im3").attr("src") == header_closed_src ) { // current state
+
+            // set menu sections background
+            $('div.accordionButtonGS').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonCD').css("background-image", "url(" + bg_closed_src + ")");
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_open_src + ")");
+
+            // Fix margin between General and Clear Data accordion buttons
+            $('div.accordionButtonCD').css("margin-top", "0px");
+
+            // change list headerarrow icon
+            $("#im1").attr("src", header_closed_src);
+            $("#im2").attr("src", header_closed_src);
+            $("#im3").attr("src", header_open_src);
+ 		
+		} else if( $("#im3").attr("src") == header_open_src ) {
+ 
+            // set menu sections background
+            $('div.accordionButtonABT').css("background-image", "url(" + bg_closed_src + ")");
+            // change list headerarrow icon
+            $("#im3").attr("src", header_closed_src);
+
+		}
+  	});
+  
+    var UAString = navigator.userAgent;
+    var brNameVer = "unknown";
+    var UALen = 1;
+    var nameStart = 1;
+    UALen = UAString.length;
+    nameStart = UAString.indexOf("NokiaBrowser");
+    // test to see if "NokiaBrowser" is in the UA String at all
+    if (nameStart < 0) {
+        brNameVer = "NOT a NokiaBrowser Browser";
+    } else {
+        // crop string starting at "NokiaBrowser"
+    	brNameVer = UAString.substring(nameStart, UALen);
+    	// limit substring to "NokiaBrowser" and version only
+    	brNameVer = brNameVer.substr(0, brNameVer.indexOf(" "));
+    	// clean up string for presentation
+    	brNameVer = brNameVer.replace("NokiaBrowser/", " Version: ");
+    }
+    $('#release_version').html(brNameVer + "<br />");
+});
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,94 @@
+body{
+  padding: 0px;
+  margin: 0px;  
+  font-size: 24px;
+  background-color: #000;
+}
+
+#wrapper {
+    margin-left: auto;
+    margin-right: auto;
+    }
+
+#BottomPad {
+    clear: both;
+    padding: 8px 10px 8px 10px;
+    height: 54px;
+    }
+
+.accordionButton {
+    float: left;
+    background: #AAAAAA;
+    border-bottom: 1px solid #FFFFFF;
+    cursor: pointer;
+    }
+.accordionButtonGS {
+    font-size: 24px;
+    padding-top: 10px;
+    padding-bottom: 3px;
+    width: 100%;
+    float: left;
+    color:#c3e1ff;
+    cursor: pointer;
+    }
+
+.accordionButtonCD {
+    font-size: 24px;
+    width: 100%;
+    margin-top: -5px;
+    float: left;
+    color:#c3e1ff;
+    line-height: 40px;
+    cursor: pointer;
+    }
+
+.accordionButtonABT {
+    font-size: 24px;
+    width: 100%;
+    margin-top: -2px;
+    float: left;
+    color:#c3e1ff;
+    line-height: 40px;
+    cursor: pointer;
+    }
+    
+.accordionContent {
+    font-size: 24px;
+    padding-left: 50px;
+    float: left;
+    background: -webkit-gradient(linear, center top, center bottom, from(#0174b8), color-stop(5%, #9fddf8), color-stop(100%, #9fddf8));
+    color:#000000;
+    display: none;
+    }
+    
+.accordionContentData {
+    font-size: 24px;
+    padding-left: 50px;
+    float: left;
+    background: -webkit-gradient(linear, center top, center bottom, from(#0174b8), color-stop(2%, #9fddf8), color-stop(100%, #9fddf8));
+    color:#000000;
+    display: none;
+    }
+    
+.accordionContentGeneral {
+    font-size: 24px;
+    padding-left: 50px;
+    float: left;
+    background: -webkit-gradient(linear, center top, center bottom, from(#0174b8), color-stop(1.5%, #9fddf8), color-stop(100%, #9fddf8));
+    color:#000000;
+    display: none;
+    }
+
+.settingstext {
+    font-size: 24px;
+    background: #9fddf8;
+    color:#000000;
+    border-top: solid 1px #009fff;
+    }
+
+/* Save/restore history checkbox. */
+.checkBoxSR {
+    position:absolute;
+    top: 140px;
+    right: 60px;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.js	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,166 @@
+var icon_src = "/settingsview/broom_sweep.png";
+var icon_action_src = "/settingsview/broom_sweep.gif";
+var selected_src = "/settingsview/yes_selected.png";
+var deselected_src = "/settingsview/yes_deselected.png";
+
+// sets localaized text constant
+function localizeString(logicalString) {
+
+    document.getElementById(logicalString).innerHTML = window.localeDelegate.translateText(logicalString);
+
+}
+
+// get settings Browser history value
+function saverestoreState() {
+
+    return window.pageController.getSaverestoreSettings();
+
+}
+
+// gets settings Character encoding value
+function enciodingState() {
+
+    return window.pageController.getTextEncoding();
+
+}
+
+// writes settings Character encoding value to pageController
+function setValue(selectedValue) {
+
+    window.pageController.setSettingsLoaded(1);    
+    window.pageController.setTextEncoding(selectedValue);
+
+}
+
+// sets settings Character encoding value
+function setEncodingState() {
+
+    var encString = enciodingState();
+
+    var list = document.getElementById("formbutton");
+    if (list) {
+    
+		for (var i = 0; i < list.length; i++ ) {
+
+		    if ( list.options[i].text == encString ) {
+
+				list.options[i].selected = true;
+				return i;
+
+	    	}
+		}
+    }
+
+    return 0;
+
+}
+
+// settings view form initialization
+function initForms() {
+
+    if ( saverestoreState() )
+		$("#saverestore").attr("src", selected_src);
+    else
+		$("#saverestore").attr("src", deselected_src);
+   
+    setEncodingState();
+
+    $("#id1").attr("src", icon_src);
+    $("#id2").attr("src", icon_src);
+    $("#id3").attr("src", icon_src);
+    $("#id4").attr("src", icon_src);
+    //$("#id5").attr("src", icon_src);
+    $("#id6").attr("src", icon_src);
+   
+    localizeString("txt_browser_settings_general_settings");
+    localizeString("txt_browser_settings_general_settings_character_encoding");
+    localizeString("txt_browser_settings_general_settings_save_browser_history");
+    localizeString("txt_browser_settings_clear_data");
+    localizeString("txt_browser_settings_clear_data_cache");
+    localizeString("txt_browser_settings_clear_data_cookies");
+    localizeString("txt_browser_settings_clear_data_history");
+    localizeString("txt_browser_settings_clear_data_bookmarks");
+    //localizeString("txt_browser_settings_clear_data_form_data");
+    localizeString("txt_browser_settings_clear_data_all");
+    localizeString("txt_browser_settings_general_settings_about");
+   	
+}
+
+window.onload = initForms;
+
+// execute action according to setting value
+function clearSelected(field) {
+
+    window.pageController.setSettingsLoaded(2);      
+            
+    if (field == "cache") { // Cache
+ 
+		window.pageController.deleteCache();
+		$("#id1").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		return;
+
+    } else if (field == "cookies") { // Cookies
+    
+		window.pageController.deleteCookies();
+		$("#id2").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);	
+		return;
+  
+    } else if (field == "history") { // History
+
+		window.historyManager.clearHistory();
+		$("#id3").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);  
+		return;    				        			 
+
+    } else if (field == "bookmarks") { // Bookmarks
+
+		window.bookmarksController.clearAll();
+		$("#id4").attr("src", icon_action_src);
+		setTimeout("initForms()", 2000);
+		return;
+
+    } else if (field == "all") { // everything
+
+		$("#id6").attr("src", icon_action_src);
+		setTimeout("initForms();deleteData()", 2000);  
+		return;
+
+    } else {
+
+		return;
+
+    }
+    
+}
+
+// clear all data represented by settings
+function deleteData() {
+
+    window.pageController.deleteCache();
+    window.pageController.deleteCookies();
+    window.historyManager.clearHistory();
+    window.bookmarksController.clearAll();
+    window.pageController.deleteDataFiles();
+}
+
+// save Browser history
+function saveSR(img_src) {
+
+    var flag;
+    if ( img_src == deselected_src ) {
+
+		$("#saverestore").attr("src", selected_src);
+		flag = 1;
+
+    } else {
+
+		$("#saverestore").attr("src", deselected_src);
+		flag = 0;
+
+    }
+    window.pageController.saveSaverestoreSettings(flag);
+    window.pageController.setSettingsLoaded(1);
+
+}
--- a/ginebra2/chrome/bedrockchrome/statusbar.snippet/statusbar.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/statusbar.snippet/statusbar.css	Fri Oct 15 17:30:59 2010 -0400
@@ -6,6 +6,8 @@
    overflow: hidden;
    padding-right: 3px;
    padding-left: 3px;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
 }
 
 #StatusBarChromeId table {
--- a/ginebra2/chrome/bedrockchrome/statusbar.snippet/statusbar.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/statusbar.snippet/statusbar.js	Fri Oct 15 17:30:59 2010 -0400
@@ -7,6 +7,27 @@
   should be created for the browser. This class is not designed to be code
   space efficient for creating multiple status bar objects.
 */
+
+var LOCK_ICON_SRC = "/statusbar/lock.png";
+
+var BATTERY10_SRC = "/statusbar/batt10.png";
+var BATTERY20_SRC = "/statusbar/batt20.png";
+var BATTERY30_SRC = "/statusbar/batt30.png";
+var BATTERY40_SRC = "/statusbar/batt40.png";
+var BATTERY50_SRC = "/statusbar/batt50.png";
+var BATTERY60_SRC = "/statusbar/batt60.png";
+var BATTERY70_SRC = "/statusbar/batt70.png";
+var BATTERY80_SRC = "/statusbar/batt80.png";
+var BATTERY90_SRC = "/statusbar/batt90.png";
+var BATTERY100_SRC = "/statusbar/batt100.png";
+var BATTERY100_CHARGING_SRC = "/statusbar/batt100_charging.png";
+
+var SIGNAL10_SRC = "/statusbar/signal0.png";
+var SIGNAL25_SRC = "/statusbar/signal25.png";
+var SIGNAL50_SRC = "/statusbar/signal50.png";
+var SIGNAL75_SRC = "/statusbar/signal75.png";
+var SIGNAL100_SRC = "/statusbar/signal100.png";
+
 function StatusBar()
 {
     // Private Classes
@@ -114,7 +135,7 @@
     function LockStatus()
     {
         // Private Member Variables
-        var secureIconSrc = "<img src=\"statusbar.snippet/icons/lock.png\">";
+        var secureIconSrc = "<img src='" + LOCK_ICON_SRC + "'>";
         var noIconSrc =  "&nbsp;";
 
         // Public Methods
@@ -123,7 +144,7 @@
         this.showLockIcon = function()
         {
             if (window.views.current().type == "webView") {
-                document.getElementById('lock').innerHTML = "<img src=\"statusbar.snippet/icons/lock.png\">";
+                document.getElementById('lock').innerHTML = "<img src='" + LOCK_ICON_SRC + "'>";
                 //window.snippets.StatusBarChromeId.repaint();
             }
         }
@@ -186,12 +207,13 @@
     {
         // Private Member Variables
         var networkIconSrc = new Array(
-            "<img src=\"statusbar.snippet/icons/signal/signal0.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/signal/signal0.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/signal/signal25.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/signal/signal50.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/signal/signal75.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/signal/signal100.png\" alt=\"\">");
+            "<img src='" + SIGNAL10_SRC + "' alt=''/>",
+            "<img src='" + SIGNAL10_SRC + "' alt=''/>",
+            "<img src='" + SIGNAL25_SRC + "' alt=''/>",
+            "<img src='" + SIGNAL50_SRC + "' alt=''/>",
+            "<img src='" + SIGNAL75_SRC + "' alt=''/>",
+            "<img src='" + SIGNAL100_SRC + "' alt=''/>");
+
         var enumNetworkStrengths = new Object();
         var currentState; // last known signal state - see enumNetworkStrengths
 
@@ -347,17 +369,17 @@
     {
         // Private Member Variables
         var batteryIconSrc = new Array(
-            "<img src=\"statusbar.snippet/icons/battery/batt10.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt20.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt30.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt40.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt50.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt60.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt70.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt80.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt90.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt100.png\" alt=\"\">",
-            "<img src=\"statusbar.snippet/icons/battery/batt100_charging.png\" alt=\"\">");
+            "<img src='" + BATTERY10_SRC + "' alt=''>",
+            "<img src='" + BATTERY20_SRC + "' alt=''>",
+            "<img src='" + BATTERY30_SRC + "' alt=''>",
+            "<img src='" + BATTERY40_SRC + "' alt=''>",
+            "<img src='" + BATTERY50_SRC + "' alt=''>",
+            "<img src='" + BATTERY60_SRC + "' alt=''>",
+            "<img src='" + BATTERY70_SRC + "' alt=''>",
+            "<img src='" + BATTERY80_SRC + "' alt=''>",
+            "<img src='" + BATTERY90_SRC + "' alt=''>",
+            "<img src='" + BATTERY100_SRC + "' alt=''>",
+            "<img src='" + BATTERY100_CHARGING_SRC + "' alt=''>");
         var enumBatteryLevels = new Object();
 
         enumBatteryLevels.state = {Level10:0, Level20:1, Level30:2, Level40:3,
@@ -425,7 +447,7 @@
     {
         function _enableDownloadIndicator()
         {
-            var src = 'statusbar.snippet/icons/download_statusbar_icon.png';
+            var src = '/statusbar/download_statusbar_icon.png';
             var tag = '<img id="downloadImage" src="' + src + '" alt="">';
             document.getElementById('download').innerHTML = tag;
             window.snippets.StatusBarChromeId.repaint();
@@ -501,10 +523,15 @@
         function(title) {sbTitle.handleTitleChange(title);});
     window.pageController.partialUrlChanged.connect(
         function(partialUrl) {sbTitle.handlePartialUrlChange(partialUrl);});
-    window.pageController.hideSecureIcon.connect(
-        function() {sbLockStatus.removeLockIcon();});
     window.pageController.showSecureIcon.connect(
-        function() {sbLockStatus.showLockIcon();});
+        function(show) {
+            if (show) {
+                sbLockStatus.showLockIcon();
+            } else {
+                sbLockStatus.removeLockIcon();
+            }
+        }
+    );
 
     // Connect view manager signals to slots.
     window.views.currentViewChanged.connect(
Binary file ginebra2/chrome/bedrockchrome/suggests.snippet/icons/iconsTenone/divider.png has changed
--- a/ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,114 +1,138 @@
+/******* css for suggestions dialog *******/
+
 body {
-    padding: 0px;
-    margin: 0px;
-}
+  /*margins & paddings*/
+  padding: 0px;
+  margin: 0px;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;}
 
 /* for fixed position images such as topshadow.png */
 img.floatImg {
-    position: fixed;
-    left: 0px;
-    width: 100%;
-}
+  /*dimensions*/
+  position: fixed;
+  left: 0px;
+  width: 100%;}
 
 /* the topshadow image goes at top of list behind the text */
 img#TopShadowImgId {
-    top: 0px;
-    height: 20px;
-    z-index: 0;
-}
+  /*dimensions*/
+  top: 0px;
+  height: 20px;
+  /*misc*/
+  z-index: 0;}
 
 #PageBorderId {
-    position: fixed;
-    top: 0px;
-    bottom: 0px;
-    left: 0px;
-    right: 0px;
-    background-color: white;
-    border-left: 2px #2a3447 solid;
-    border-right: 2px #2a3447 solid;
-    border-bottom: 2px #2a3447 solid;
-    -webkit-border-bottom-left-radius: 10px;
-    -webkit-border-bottom-right-radius: 10px;
-    -webkit-user-select: none;
-    z-index: -1;
-}
+  /*dimensions*/
+  position: fixed;
+  /*margins & paddings*/
+  top: 0px;
+  bottom: 0px;
+  left: 0px;
+  right: 0px;
+  border-left: 2px #000000 solid;
+  border-right: 2px #000000 solid;
+  border-bottom: 2px #000000 solid;
+  background-color: white;
+  /*misc*/
+  z-index: -1;
+  /*webkit*/
+  -webkit-border-bottom-left-radius: 10px;
+  -webkit-border-bottom-right-radius: 10px;
+  -webkit-user-select: none;}
 
 #PageBottomShadowId {
-    position: fixed;
-    left: 2px;
-    right: 2px;
-    bottom: 2px;
-    height: 23px;
-    background-image: url(icons/bottomshadow.png);
-    background-repeat: repeat-x;
-    -webkit-border-bottom-left-radius: 10px;
-    -webkit-border-bottom-right-radius: 10px;
-    z-index: -1;
-}
+  /*dimensions*/
+  position: fixed;
+  /*margins & paddings*/
+  left: 2px;
+  right: 2px;
+  bottom: 2px;
+  height: 23px;
+  background-image: url(/suggests/bottomshadow.png);
+  background-repeat: repeat-x;
+  /*misc*/
+  z-index: -1;
+  /*webkit*/
+  -webkit-border-bottom-left-radius: 10px;
+  -webkit-border-bottom-right-radius: 10px;}
 
 /* make sure content apears over images */
 #SuggestsId {
-    position: relative;
-    z-index: 2;
-}
+  /*dimensions*/
+  position: relative;
+  /*misc*/
+  z-index: 2;}
 
 .SuggestView {
-    overflow-y: hidden;
-    height: 100%;
-}
+  /*dimensions*/
+  height: 100%;
+  /*misc*/
+  overflow-y: hidden;}
 
 ul#suggestUlId {
-    list-style-type:none;
-    margin: 0;
-    padding: 0;
-}
+  /*margins & paddings*/
+  margin: 0;
+  padding: 0;
+  /*decorations*/
+  list-style-type: none;}
 
 ul#suggestUlId a {
-    display: block;
-    text-decoration: none;
-}
+  /*decorations*/
+  text-decoration: none;
+  /*misc*/
+  display: block;}
 
 span.aTitle {
-    color: blue;
-    font-size: 20px;
-}
+  /*decorations*/
+  color: black;
+  /*font specification*/
+  font-size: 20px;}
 
 span.aUrl {
-    color: #999999;
-    font-size: 16px;
-}
+  /*decorations*/
+  color: #666666;
+  /*font specification*/
+  font-size: 16px;}
 
 ul#suggestUlId li#searchLiId>a {
-    /* between padding and height, total height is 70px */
-    /* if total height changes, change elementHeight in _setMaxHeight() */
-    /* top, right, bottom, and left padding */
-    padding: 15px 10px 8px 10px;
-    height: 47px;
-    display: block;
-    overflow: hidden;
-    white-space: pre;
-    -webkit-user-select: none;
-    z-index: 3;
-}
+  /*dimensions*/
+  /* between padding and height, total height is 70px */
+  /* if total height changes, change elementHeight in _setMaxHeight() */
+  /* top, right, bottom, and left padding */
+  height: 47px;
+  /*margins & paddings*/
+  padding: 15px 10px 8px 10px;
+  /*misc*/
+  display: block;
+  overflow: hidden;
+  white-space: pre;
+  z-index: 3;
+  /*webkit*/
+  -webkit-user-select: none;}
 
 ul#suggestUlId li#suggestsLiId>a {
-    /* between padding and height, total height is 70px */
-    /* if total height changes, change elementHeight in _setMaxHeight() */
-    /* top, right, bottom, and left padding */
-    padding: 8px 10px 8px 10px;
-    height: 54px;
-    display: block;
-    background-image: url(icons/divider.png);
-    background-repeat: repeat-x;
-    overflow: hidden;
-    white-space: pre;
-    -webkit-user-select: none;
-    z-index: 3;
-}
+  /*dimensions*/
+  /* between padding and height, total height is 70px */
+  /* if total height changes, change elementHeight in _setMaxHeight() */
+  /* top, right, bottom, and left padding */
+  height: 54px;
+  /*margins & paddings*/
+  padding: 8px 10px 8px 10px;
+  /*decorations*/
+  background-image: url(/suggests/divider.png);
+  background-repeat: repeat-x;
+  /*misc*/
+  display: block;
+  overflow: hidden;
+  white-space: pre;
+  z-index: 3;
+  /*webkit*/
+  -webkit-user-select: none;}
 
 /* truncate long titles and URLs with ellipsis */
 .SuggestView div.SuggestElement {
-    white-space: nowrap;
-    overflow: hidden;
-    text-overflow: ellipsis;
-}
+  /*misc*/
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;}
--- a/ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.html	Fri Oct 15 17:30:59 2010 -0400
@@ -2,13 +2,16 @@
 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-EN">
 
 <head>
-   <link rel="stylesheet" id="CSSLink" type="text/css" href="suggests.css"/>
-   <script src="suggests.js" type="text/javascript"></script>
-   <script src="../../js/Bind.js" type="text/javascript"></script>
+   <link rel="stylesheet" id="CSSLink" type="text/css" href="/suggests/suggests.css"/>
+   <script src="/suggests/suggests.js" type="text/javascript"></script>
+   <script src="/chrome/Bind.js" type="text/javascript"></script>
+   <script type="text/javascript">
+     var searchSuggests;
+   </script>
 </head>
 
 <body onload="searchSuggests.loadComplete()">
-    <img src="icons/topshadow.png" alt="background image" class="floatImg" id="TopShadowImgId" />
+    <img src="/suggests/topshadow.png" alt="background image" class="floatImg" id="TopShadowImgId" />
 
     <!-- this div provides the background color and border -->
     <div id="PageBorderId">
@@ -20,7 +23,7 @@
 
     <div class = "SuggestView" id="SuggestsId">
         <script type="text/javascript">
-            var searchSuggests = new Suggests();
+             searchSuggests = new Suggests();
         </script>
     </div>
 </body>
--- a/ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/suggests.snippet/suggests.js	Fri Oct 15 17:30:59 2010 -0400
@@ -32,9 +32,9 @@
     function _setMaxHeight()
     {
         // Calculate height of available space for suggest list.
-        var statusbarSz = snippets.StatusBarChromeId.getGeometry();
+        var statusbarHeight = (snippets.StatusBarChromeId != undefined && snippets.StatusBarChromeId.visible) ? snippets.StatusBarChromeId.getGeometry().height : 0;       
         // The Orbit UI doesn't have a status bar.
-        var statusbarHeight = (app.ui() == "orbit_ui") ? 0 : statusbarSz.height;
+        var statusbarHeight = ((app.ui() == "orbit_ui") || (app.ui() == "maemo5_ui")) ? 0 : statusbarSz.height;
         var urlSearchSz = snippets[urlSnippetId].getGeometry();
         var toolbarSz = snippets.WebViewToolbarId.getGeometry();
         // leave some space between suggest and toolbar (~10% of display height)
@@ -94,8 +94,7 @@
     function _updateSuggestList(input)
     {
         var recenturl;
-        var recenttitle = window.localeDelegate.translateText(
-            "txt_browser_chrome_suggests_search_for");
+        var recenttitle = window.localeDelegate.translateText("txt_browser_chrome_suggests_search_for");
         var snippetId = document.getElementById('SuggestsId');
         var suggests = window.bookmarksController.suggestSimilar(input);
         var suggestUL = document.createElement('ul');
@@ -116,7 +115,7 @@
 
         // add each search suggestion to unordered list
         for (i=0; i < suggests.length; i++) {
-            recenturl = suggests[i].url1;
+           	recenturl = suggests[i].url1;
             recenttitle = suggests[i].title1;
             suggestLI = document.createElement('li');
             suggestLI.id = "suggestsLiId";
@@ -272,5 +271,11 @@
     {
         inputTimeoutDelay = to;
     }
+    
+    //! Hides suggests list and support items.
+    this.hideSuggests = function()
+    {
+        _hideSuggests();
+    }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/bedrockchrome/suggests.snippet/suggestsTenone.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,138 @@
+/******* css for suggestions dialog *******/
+
+body {
+  /*margins & paddings*/
+  padding: 0px;
+  margin: 0px;
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;}
+
+/* for fixed position images such as topshadow.png */
+img.floatImg {
+  /*dimensions*/
+  position: fixed;
+  left: 0px;
+  width: 100%;}
+
+/* the topshadow image goes at top of list behind the text */
+img#TopShadowImgId {
+  /*dimensions*/
+  top: 0px;
+  height: 20px;
+  /*misc*/
+  z-index: 0;}
+
+#PageBorderId {
+  /*dimensions*/
+  position: fixed;
+  /*margins & paddings*/
+  top: 0px;
+  bottom: 0px;
+  left: 0px;
+  right: 0px;
+  border-left: 2px #000000 solid;
+  border-right: 2px #000000 solid;
+  border-bottom: 2px #000000 solid;
+  background-color: white;
+  /*misc*/
+  z-index: -1;
+  /*webkit*/
+  -webkit-border-bottom-left-radius: 10px;
+  -webkit-border-bottom-right-radius: 10px;
+  -webkit-user-select: none;}
+
+#PageBottomShadowId {
+  /*dimensions*/
+  position: fixed;
+  /*margins & paddings*/
+  left: 2px;
+  right: 2px;
+  bottom: 2px;
+  height: 23px;
+  background-image: url(/suggests/bottomshadow.png);
+  background-repeat: repeat-x;
+  /*misc*/
+  z-index: -1;
+  /*webkit*/
+  -webkit-border-bottom-left-radius: 10px;
+  -webkit-border-bottom-right-radius: 10px;}
+
+/* make sure content apears over images */
+#SuggestsId {
+  /*dimensions*/
+  position: relative;
+  /*misc*/
+  z-index: 2;}
+
+.SuggestView {
+  /*dimensions*/
+  height: 100%;
+  /*misc*/
+  overflow-y: hidden;}
+
+ul#suggestUlId {
+  /*margins & paddings*/
+  margin: 0;
+  padding: 0;
+  /*decorations*/
+  list-style-type: none;}
+
+ul#suggestUlId a {
+  /*decorations*/
+  text-decoration: none;
+  /*misc*/
+  display: block;}
+
+span.aTitle {
+  /*decorations*/
+  color: black;
+  /*font specification*/
+  font-size: 20px;}
+
+span.aUrl {
+  /*decorations*/
+  color: #666666;
+  /*font specification*/
+  font-size: 16px;}
+
+ul#suggestUlId li#searchLiId>a {
+  /*dimensions*/
+  /* between padding and height, total height is 70px */
+  /* if total height changes, change elementHeight in _setMaxHeight() */
+  /* top, right, bottom, and left padding */
+  height: 47px;
+  /*margins & paddings*/
+  padding: 15px 10px 8px 10px;
+  /*misc*/
+  display: block;
+  overflow: hidden;
+  white-space: pre;
+  z-index: 3;
+  /*webkit*/
+  -webkit-user-select: none;}
+
+ul#suggestUlId li#suggestsLiId>a {
+  /*dimensions*/
+  /* between padding and height, total height is 70px */
+  /* if total height changes, change elementHeight in _setMaxHeight() */
+  /* top, right, bottom, and left padding */
+  height: 54px;
+  /*margins & paddings*/
+  padding: 8px 10px 8px 10px;
+  /*decorations*/
+  background-image: url(/suggests/divider.png);
+  background-repeat: repeat-x;
+  /*misc*/
+  display: block;
+  overflow: hidden;
+  white-space: pre;
+  z-index: 3;
+  /*webkit*/
+  -webkit-user-select: none;}
+
+/* truncate long titles and URLs with ellipsis */
+.SuggestView div.SuggestElement {
+  /*misc*/
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;}
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom+.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom+_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom+_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom-.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom-_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom-_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/circle_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_menu.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_menu_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_menu_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_mostvisited.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_mostvisited_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_fullTB.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_fullTB_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_partialTB.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_partialTB_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_zoom.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_zoom_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_zoom_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomLeft.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomMiddle.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomRight.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_middleMiddle.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topLeft.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topMiddle.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topRight.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/circle_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_bar_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomLeft.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomMiddle.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomRight.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_middleMiddle.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topLeft.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topMiddle.png has changed
Binary file ginebra2/chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topRight.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/go_btn_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/URL_search_divider.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep_no_bg.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/go_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/refresh_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/stop_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/url_title_ind_btn.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/url_title_ind_btn_secure.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/refresh_btn_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/urlsearch.snippet/icons/stop_btn_pressed.png has changed
--- a/ginebra2/chrome/bedrockchrome/windowcount.snippet/windowcount.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/windowcount.snippet/windowcount.css	Fri Oct 15 17:30:59 2010 -0400
@@ -2,6 +2,8 @@
 #WindowCountBarId {
     width:100%;
     background: transparent;
+    /*font specification*/
+    font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;
 }
 
 /* Table */
--- a/ginebra2/chrome/bedrockchrome/windowcount.snippet/windowcount.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/windowcount.snippet/windowcount.js	Fri Oct 15 17:30:59 2010 -0400
@@ -9,6 +9,9 @@
  * on the display mode.
  */
 
+var FILLED_SRC = "/windowcount/filledcircle.png";
+var EMPTY_SRC = "/windowcount/emptycircle.png";
+
 //
 // INIT the WindowCount snippet
 //
@@ -18,24 +21,24 @@
     this.id = id;
 
     this.begin =
-        '<table id="wcrow" align=center   >'+
+        '<table id="wcrow" align=center>'+
         '<tr>'+
         '<td id="wcfirst" style="background-color: transparent;">'+
         '</td>'+
         '<td  id="wccontent">';
 
     this.filledimg =
-        '<img class="wcicon" src="windowcount.snippet/icons/filledcircle.png" >' ;
+        '<img class="wcicon" src="' + FILLED_SRC + '" >';
 
     this.emptyimg =
-        '<img class="wcicon" src="windowcount.snippet/icons/emptycircle.png" >' ;
+        '<img class="wcicon" src="' + EMPTY_SRC + '" >';
 
     this.end =
         '</td>'+
         '<td id="wclast" style="background-color: transparent;">'+
         '</td>'+
         '</tr>'+
-        '</table>' ;
+        '</table>';
 
     this.InitWCBar = function()  {
         this.wcOneWindow();
@@ -105,12 +108,12 @@
     }
 
     this.wcTwoWindows = function() {
+
         var htmlText = '' +
                 this.begin + this.emptyimg + this.emptyimg + this.end;
 
         this.setHtmlText(htmlText)
 
-
     }
 
     this.wcThreeWindows = function() {
@@ -157,13 +160,14 @@
         }
 
         //app.debug("setCurrentIndex: View " + window.views.current().type  + " Index : " + index);
-        Icons[index].setAttribute('src', "windowcount.snippet/icons/filledcircle.png");
+        Icons[index].setAttribute('src', FILLED_SRC);
     }
 
 
     this.setSnippetPosition = function() {
 
         if (window.snippets.WindowCountBarId ) {
+
             mode = window.chrome.displayMode;
             if (mode == "portrait") {
                 window.snippets.WindowCountBarId.setPosition(0,27);
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom_disabled.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom_pressed.png has changed
Binary file ginebra2/chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/zoom_menu_bg.png has changed
--- a/ginebra2/chrome/bedrockchrome/zoombar.snippet/zoombar.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/zoombar.snippet/zoombar.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,23 +1,29 @@
+/******* css for zoom view *******/
+
 #ZoomBarId {
+  /*dimensions*/
   width: 145px;
   height: 85px;
-}
+  /*font specification*/
+  font-family: "Series 60 Sans", "Nokia Sans S60", sans-serif;}
 
 #zoomBarDiv {
-  background-image: url(icons/zoom_menu_bg.png);
-  background-repeat: no-repeat;
-  background-position: top left;
+  /*dimensions*/
   width: 143px;
   height: 83px;
-  -webkit-user-select: none;
-}
+  /*decorations*/
+  background-image: url(/zoombar/zoom_menu_bg.png);
+  background-repeat: no-repeat;
+  background-position: top left;
+  /*webkit*/
+  -webkit-user-select: none;}
 
 .zoomBarBtn {
+  /*dimensions*/
   height: 58px;
   width: 58px;
+  /*margins & paddings*/
   padding-left: 10px;
   padding-top: 5px;
-  float:left;
-}
-
-
+  /*decorations*/
+  float: left;}
--- a/ginebra2/chrome/bedrockchrome/zoombar.snippet/zoombar.js	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/bedrockchrome/zoombar.snippet/zoombar.js	Fri Oct 15 17:30:59 2010 -0400
@@ -26,14 +26,16 @@
 
     //! Create zoom in & out buttons.
     function _setActions() {
+    	// IMPORTANT: use QT qrc style for resource reference since this snippet is a QT mapped object
+    	// and resource processing is done in QT, not javascript
         snippets.zoomBarBtnIn.connectAction("zoomIn", "WebView", true, true);
         snippets.zoomBarBtnOut.connectAction("zoomOut", "WebView",  true, true);
-        snippets.zoomBarBtnIn.setIcon(":/chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+.png");
-        snippets.zoomBarBtnIn.setActiveIcon(":/chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_pressed.png");
-        snippets.zoomBarBtnIn.setDisabledIcon(":/chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_disabled.png");
-        snippets.zoomBarBtnOut.setIcon(":/chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-.png");
-        snippets.zoomBarBtnOut.setActiveIcon(":/chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_pressed.png");
-        snippets.zoomBarBtnOut.setDisabledIcon(":/chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_disabled.png");
+        snippets.zoomBarBtnIn.setIcon(":/zoombar/icon_zoom+.png");
+        snippets.zoomBarBtnIn.setActiveIcon(":/zoombar/icon_zoom+_pressed.png");
+        snippets.zoomBarBtnIn.setDisabledIcon(":/zoombar/icon_zoom+_disabled.png");
+        snippets.zoomBarBtnOut.setIcon(":/zoombar/icon_zoom-.png");
+        snippets.zoomBarBtnOut.setActiveIcon(":/zoombar/icon_zoom-_pressed.png");
+        snippets.zoomBarBtnOut.setDisabledIcon(":/zoombar/icon_zoom-_disabled.png");
 
         // Connect to each action's "changed" signal.
         window.views.WebView.actions.zoomIn.changed.connect(
@@ -73,7 +75,3 @@
 
     window.chrome.chromeComplete.connect(_chromeLoadComplete);
 }
-
-
-
-
Binary file ginebra2/chrome/localpages/bedrock.png has changed
Binary file ginebra2/chrome/localpages/mostvisitedpages.dat has changed
--- a/ginebra2/chrome/localpages/relnotes.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/localpages/relnotes.html	Fri Oct 15 17:30:59 2010 -0400
@@ -20,7 +20,6 @@
     }
   </script>
   <body onFocus="pressed(9)" >
-  <img id="bgimage" src="grad_tall.jpg" />
   <div id="rel_note_body">
     <center>
     <a href="startpage.html" onMouseDown="pressed(1)"><img id="back_button" class="button" src="button_back.png" /></a><br/><br/>
--- a/ginebra2/chrome/localpages/startpage.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/localpages/startpage.css	Fri Oct 15 17:30:59 2010 -0400
@@ -1,7 +1,7 @@
 html, body {
 	height: 100%;
 	margin: 0;
-	padding: 0;
+	padding: 20px;
 }
 img { 
 	border-style: none; 
@@ -17,14 +17,15 @@
 	height:100%;
 }
 img#nokia_logo {
-	height:15%;
+	height:100%;
 	display:block;
 	padding-top:20px;
 	margin-left:auto;
 	margin-right:auto;
 }
 img#browser_logo {
-	height:40%;
+	height:300px;
+	width:300px;
 	display:block;
 	margin-left:auto;
 	margin-right:auto;
@@ -34,10 +35,8 @@
 	height:60px;
 }
 #content {
-	position:relative;
-	z-index:1;
 	font-family: Arial, Helvetica, sans-serif;
-	text-align: left;
+	text-align: center;
 	margin: 0px;
 	font-size: 18px;
 	font-weight: normal;
@@ -55,7 +54,7 @@
 	color: #000000;
 }
 #row1_logos {
-	height:40%;
+	height:100%;
 }
 #buttons {
 	height:40%;
@@ -66,13 +65,6 @@
 #bottom_pad {
 	height:20%;
 }
-#jerry_sez {
-	text-align: center;
-	margin: auto;
-	display: none;
-	position: absolute;
-	left: 20%;
-}
 #release_version {
 	font-family: Arial, Helvetica, sans-serif;
 	font-size:16px;
--- a/ginebra2/chrome/localpages/startpage.html	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/chrome/localpages/startpage.html	Fri Oct 15 17:30:59 2010 -0400
@@ -4,81 +4,13 @@
 	  <meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
 	  <link rel="stylesheet" type="text/css" href="startpage.css"/>
   </head>
-  <script type="text/javascript">
-  	function pressed (num) {
-		butt1 = document.getElementById('relnote_button');
-		butt2 = document.getElementById('survey_button');
-
-		switch (num)
-		{
-			case 1: 
-				butt1.setAttribute('class', 'button_p');
-				break;
-			case 2: 
-				butt2.setAttribute('class', 'button_p');
-				alert ("No Survey Link");
-				break;
-			case 9: // reset on refocus
-				butt1.setAttribute('class', 'button');
-				butt2.setAttribute('class', 'button');
-				break;
-		}
-	}
-  
-  </script>
-  <body onFocus="pressed(9)" >
-  <img id="bgimage" src="grad_tall.jpg" />
+  <body>
   <div id="content">
     <div id="row1_logos">
-	    <img id="nokia_logo" src="nokia_logo.png" />
-	    <img id="browser_logo" src="bedrock.png" />
-        <div id="browser_version">
-            <div id="release_version">
-	            <script type="text/javascript">
-	                var UAString = navigator.userAgent;
-	                var brNameVer = "unknown";
-	                var UALen = 1;
-	                var nameStart = 1;
-	        
-					// options for Welcome Page browser version information
-		            //document.write("ALPHA <span id='roman_num'>III</span>");
-		            //document.write("BETA");
-		            document.write("TRUNK BUILD");
-
-					// Get, parse, display UA String
-	                UALen = UAString.length;
-	                // NOTE: if UA String changes browser name to 
-	                // something else we'll need to change the following line!
-	                nameStart = UAString.indexOf("NokiaBrowser");
-	                // test to see if "NokiaBrowser" is in the UA String at all
-	                if (nameStart < 0)
-						brNameVer = "UA = <br/>" + UAString;
-	                else
-	                {
-	                    // crop string starting at "NokiaBrowser"
-	                    brNameVer = UAString.substring(nameStart, UALen);
-	                    // limit substring to "NokiaBrowser" and version only
-	                    brNameVer = brNameVer.substr(0, brNameVer.indexOf(" "));
-	                    // clean up string for presentation
-	                    brNameVer = brNameVer.replace("/", " v");
-	                }
-					// comment OUT next two lines to remove build info...
-					document.write(" - ");
-	                document.write(brNameVer);
-					document.write("<br/>");
-	            </script>
-            </div>
-        </div>
-		<div id="jerry_sez">
-			<img src="button4.png" onMouseDown="pressed(25)"></img>
-		</div>
-		<div id="buttons">
-        	<a href="relnotes.html" onMouseDown="pressed(1)"><img id="relnote_button" class="button" src="button_rel_notes.png" /></a>
-        	<a href="startpage.html" onMouseDown="pressed(2)"><img id="survey_button" class="button" src="button_survey.png" /></a>
-        </div>
-		<div id="bottom_pad">
-		</div>
-    </div>
+		<a href="http://browser.nokia.com/testing"><img id="browser_logo" src="bedrock.png" /></a>
+		8.1<br/><br/>&copy; Nokia 2010
+    </div>	  
+  </div>
 </body>
 </html>
 
Binary file ginebra2/chrome/localpagesmaemo/back.png has changed
Binary file ginebra2/chrome/localpagesmaemo/bedrock.png has changed
Binary file ginebra2/chrome/localpagesmaemo/bedrock_splash.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button1.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button2.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button3.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button4.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button_back.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button_del.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button_rel_notes.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button_report_bug.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button_search_google.png has changed
Binary file ginebra2/chrome/localpagesmaemo/button_survey.png has changed
Binary file ginebra2/chrome/localpagesmaemo/google.png has changed
Binary file ginebra2/chrome/localpagesmaemo/grad_tall.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/localpagesmaemo/installnotes.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,73 @@
+<html>
+  <title>Bedrock Browser Release Notes</title>
+  <link rel="stylesheet" type="text/css" href="subpage.css"/>
+  <head>
+  </head>
+  <body>
+    <div id="sub_left"><a id="backbutt" href="startpage.html"><img src="back.png" height="80" /></a><img src="button3.png" width="200" /></div>
+    <div id="sub_right"><img src="nokia_logo.png" width="160" /></div>
+    <br/>
+    <div id="rel_notes">
+    <center><b>Release Notes for Bedrock Browser Alpha 1</b></center><br/>
+    <br/>Updated: 17-Dec-2009
+    <br/>
+    <br/>NOTE: These release notes were current as of the time the software was packaged for release. For up-to-date release notes, visit the Browser Team's Wiki pages.
+    <br/>
+    <h4>Overview of the Release:</h4>
+    The Bedrock Browser is Nokia's latest web browser based on the latest open-source WebKit
+    engine and built using the Qt application framework.<p/>
+    The Bedrock project's mission is to provide a fast, easy to use, web-standards based browser
+    that can compete alongside the best of the mobile browsers.<p/>
+    In addition to providing basic browser functionality, Bedrock allows for almost infinite extensiblity
+    by utilizing an HTML/CSS/JavaScript UI framework we call "Ginebra".<p/>
+    All of the UI components you see in the Bedrock Browser are rendered using Ginebra and can be modified
+    as easily as one can modify a web page.<p/>
+    This release of Bedrock is the Alpha 1 release. It has VERY limited functionality and less-than-acceptable performance at this time but is built upon
+    the extensible framework that will allow the Browser team to add new functionality quickly and with minimal native code changes<p/>
+    Please review the rest of the Release Notes and provide feedback on this release via the Survey Link on the start page.
+    <h4>Target Platforms/Devices:</h4>
+    <ul>
+    <li>Release is packaged as SISX that can only be installed on N97 CE (not R&D) devices.</li>
+    <li>Only devices whose IMEI number is registered with the browser team will be able to run this software.</li>
+    </ul>
+    <h4>Prerequisites:</h4>
+    <ul>
+    <li>Nokia N97 device, Consumer version (CE) (R&D phones will not run the software)</li>
+    <li>Latest platform software loaded/updated onto the device. This release has been tested with: N97 Software Version 12.0.024 dated 04/08/09</li>
+    <li>Sufficient free space (11-12 MB minimum) on C: drive.</li>
+    <li>NOTE: It is required for this release that you install ALL of the provided software packages on the C: drive.</li>
+    <li>Default network setup on the device. The N97 connection settings must contain a default Destination Network of "Internet" that contains the proper access points (APs). The browser will connect to the network via this "Internet" Destination Network. </li>
+    <li>IMPORTANT: Ensure that the default access point (as defined in the connection settings for the Destination Network) is available when running the Bedrock browser. There have been cases where an unavailable WLAN AP prevented loading of pages. </li>
+    </ul>
+    <h4>Functionality to Evaluate:</h4>
+    The following features are implemented and we encourage you to try them out!
+    <ul>
+    <li>URL Entry: Enter a new URL via the entry box at the top of the UI.</li>
+    <li>Page Load/Cancel/Refresh: Using the button to the right of the URL entry box.</li>
+    <li>Basic "Back": The "Back" button in the lower-left of the UI will go back one page.</li>
+    <li>Zooming: Basic incremental zoom-in/zoom-out is available via the two zoom buttons.</li>
+    <li>Visual History: A "coverflow" UI for navigation through your browser history is available from the "Go Anywhere" button in the lower-right of the UI.</li>
+    <li>Browser Exit: Looking for an Exit button/command? You won't find one. Press the red "call-end" key to exit the browser.</li>
+    <li>WLAN: Due to performance issues in general, it is recommended that you add a WLAN access point and use that by default.</li>
+    </ul>
+    <h4>Known Limitations:</h4>
+    <ul>
+    <li>WebKit Performance: There are a number of known issues with the Qt WebKit used in the release of Bedrock. Some have a major impact on performance of the engine. See our wiki page for more details.</li>
+    <li>Out of Memory Handling: Handling of low memory conditions is not yet optimized for browsing large web pages. In some case, loading large or image-intensive pages can cause the browser to lock-up or crash. Please report the sites/pages to us if you experience this.</li>
+    <li>We don't recommend running ACID3 or any browser stress testing on this release.</li>
+    <li>Bookmarking: There is no support for bookmarking a page at this time. We recommend using an online bookmark service.</li>
+    <li>Multiple Windows: There is a button the bottom toolbar that will (in a later release) bring up our Windows Manager UI. But this is not currently available.</li>
+    <li>Theme support: Please use the default theme of the device (named "NSeries 1") when running the browser. Other themes can be chosen, but there may be visual anomolies when doing so.</li>
+    <li>UI Performance: We are still evaluating and responding to performance issues. When using this Alpha release, please be patient when performing actions. Avoid repeating the same actions quickly in response to a lack of response. Once a button or link is pressed or a touch gesture is applied, it may take some time for the resulting action to be reflected in the UI.</li>
+    <li>The N97's 4-way / select navi-key is not yet fully integrated into the browser. The 4-way navi-key may scroll lists and move focus in some areas of the UI, but those keys have no effect in the content view of the browser. There is NO pointer in this Alpha release, so mouse events will be limited. Also, there is no way to navigate to and then select a link or other element in the content view.</li>
+    <li>Avoid changing the browser orientation from landscape to portrait and vice-versa. It is STRONGLY recommend that you launch the browser while the device is in LANDSCAPE orientation with the hardware keyboard deployed. Closing the keyboard should be avoided as this will switch the device to portrait mode. The browser UI "chrome" has been optimized for landscape orientation only for this release.</li>
+    <li>While loading secure pages (https://) is supported in this release, the browser UI will NOT give any indication that the loaded page is secure (no "lock" icon) and there are not warning messages displayed when moving from secure to un-secure pages or posting form data to un-secure servers. </li>
+    <li>HTTP authentication is supported but the masking of the characters as the password is entered is not yet enabled. </li>
+    <li>Form field input masking is not yet supported. This can cause some form entry use cases to fail if the data entered is not formatted correctly.</li>
+    <li>Text Prediction / T9 Issues: Please be sure that when entering any text into any edit field (especially the URL entry box!) that text prediction is turned OFF.</li>
+    </ul>
+    <h4>END OF RELEASE NOTES</h4>
+    </div>
+</body>
+</html>
+
Binary file ginebra2/chrome/localpagesmaemo/mostvisitedpages.dat has changed
Binary file ginebra2/chrome/localpagesmaemo/nokia_logo.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/localpagesmaemo/relnotes.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,64 @@
+<html>
+  <head>
+      <title>Nokia Browser 8 Alpha for Maemo/N900 Release Notes</title>
+      <meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
+      <link rel="stylesheet" type="text/css" href="startpage.css"/>
+  </head>
+  <body>
+  <div id="rel_note_body">
+    <center>
+    <a href="startpage.html">Back to Welcome Page</a><br/><br/>
+    <b>Release Notes for<br/>
+    Nokia Browser 8 Alpha for Maemo/N900</b>
+    <br/>Update Version 805-1
+    <br/>25-Aug-2010<br/>
+    </center>
+    <br/>NOTE: These release notes were current as of the time the software was packaged for release. For up-to-date release notes, visit the Browser Team's Wiki pages.
+    <br/>
+    <h4>Overview of the Release:</h4>
+    <p>The Nokia Browser 8 is Nokia's latest web browser based on the latest open-source WebKit engine and built using the Qt application framework.</p>
+    <p>The Nokia ASF Browser project's mission is to provide a fast, easy to use, web-standards based browser that can compete alongside the best of the mobile browsers. </p>
+    <p>This is an Alpha Release of the Nokia Browser for the Maemo platform. It is for internal Nokia evaluation ONLY. Do not distribute this application outside of Nokia!</p>
+	<h4>About this Update</h4>
+	<p>This version (805-1) is being released to address a number of issues that our users found in the first Alpha release.<P>
+	<p>We very much appreciate the quantity and quality of feedback we have received over these few short weeks since we posted the first Alpha. There where five change that we made for this release based on your feedback:
+	<ul>
+	<li><b>Volume Buttons (hardware) controls zoom in/out</b> You can now use the volume control buttons on the top of the phone to control the zoom level!<br/>Thanks to the user who posted the code snippet for this!</li>
+	<li><b>Full screen mode w/ improved scrolling</b> The browser will now enter "full-screen-mode" and remove the top status bar. This has the benefit of providing more space for the web page and also improves our scrolling performance.</li>
+	<li><b>New Most Visited Icon/Button</b> A visual change only, but an item we got a lot of feedback on.</li>
+	<li><b>Updated theme in bookmarks, history, and settings views</b> Another visual change, we updated the look and feel of the "sub-views" of the browser to better align with the N900's themes.</li>
+	<li><b>Zooming works even if a Viewport is set</b> You will now be able to zoom in or out on a page that is "fit-to-width" (think small pages like Google's homepage) or that use the Viewport meta tag to constrain zooming.</li> 
+	</ul>
+    <h4>Target Platforms/Devices:</h4>
+    <ul>
+    <li>This version of the Nokia Browser is released for Maemo 5 / N900 only. We highly recommend updating your Maemo base software to the latest firmware release before installation!</li>
+    </ul>
+    <h4>Prerequisites:</h4>
+    <ul>
+    <li>Nokia N900 device, consumer version (CE) required.</li>
+    <li>Latest platform software loaded/updated onto the device. This release has been tested with: N900 Software Version 10.2010.19-1.002.</li>
+    </ul>
+    <h4>Known Issues:</h4>
+    <ul>
+    <li><b>Flash Content is not supported: </b>Flash (and indeed all) plug-ins have been disabled for this release for performance reasons.</li>
+    <li><b>"X" button in sub-views: </b>You will notice that in the browser "sub-views" (History, Bookmarks, Settings), the "X" button in the upper-right hand corner is still visible / available. Pressing this WILL exit the browser (as in the main content view).</li>
+    <li><b>Default Text Size: </b>Due to the increated resolution of the display (compared to some previously supported devices), text size may appear too small on some pages.</li>
+    <li><b>Feedback Button in Settings View: </b>The feedback button in setting view will attempt to compose an email message using the device's messaging application. If you have not yet defined an email account, you may be prompted to at that time.</li>
+    <li><b>Feedback Button in Settings View: </b>Feedback is provided via email "in-the-clear". Therefore, do NOT use any references to or comment on any Nokia Company Confidential information! If you wish to discuss confidential topics, use the Backstage forums.</li>
+    <li><b>Default Browser: </b>Once installed, this Alpha release of Browser 8 will NOT become the device's default browser. There are utilities available that CAN change the default browser and you are welcome to try using them. But please not that this is NOT a tested configuration.</li>
+    <li><b>Zooming: </b>During our testing we have noticed cases where the zoom buttons on the toolbar do not have the correct "state". Sometimes the buttons may be grayed-out (diabled) even though the page may appear to be "zoomable". Also note that in some case, having the buttons disabled is normal. This will be the case for pages (like the Welcome Page) where a viewport is defined.</li>
+    <li><b>Most Visited (after clearing History): </b>The Most Visited feature uses your browsing history to display the 6 most visited pages. If you clear your history, the 6 "slots" for most visited pages will revert to 6 default URLs. However, the image thumbnails for those pages will be gone (they are deleted when you clear your history...). You should be able to access them, however.</li>
+    <li><b>Windows view & page thumbnails: </b>On the N900 you can view all open windows (browser and others) by using the button in the upper-left of the screen. There are cases when we have seen the page thumbnails in the browser windows sized incorrectly.</li>
+    <li><b>Lost URL Bar: </b>In some cases, when creating a new window, the new window may be created without a URL / Search Entry bar at the top. If this occurs, close that window, load a "simple" page, and try again.</li>
+    <li><b>Panning/Scrolling "jerky": </b>Depending on the size of the loaded page and the zoom level, the panning/scrolling may be a bit "jerky". We are working to improve this.</li>
+	</ul>
+    <h4>Features to Evaluate:</h4>
+    <ul>
+    <li><b>Auto Bookmark Import: </b>Upon first use, the Browser will attempt to import your bookmarks from the platform browser (MicroB). Please check to confirm that this has occured and leave us feedback about this feature.</li>
+    </ul>
+    <h4>END OF RELEASE NOTES</h4>
+	<h4>&nbsp;</h4>
+	<h4>&nbsp;</h4>
+  </div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/localpagesmaemo/startpage.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,116 @@
+html, body {
+	height: 100%;
+	margin: 0;
+	padding: 0;
+}
+img { 
+	border-style: none; 
+}
+a {
+	outline: none;
+}
+img#bgimage {
+	position:fixed;
+	top:0;
+	left:0;
+	width:100%;
+	height:100%;
+}
+img#nokia_logo {
+	height:15%;
+	display:block;
+	padding-top:20px;
+	margin-left:auto;
+	margin-right:auto;
+}
+img#browser_logo {
+	height:40%;
+	display:block;
+	margin-left:auto;
+	margin-right:auto;
+}
+img#back_button {
+	margin-top:10px;
+	height:60px;
+}
+#content {
+	position:relative;
+	z-index:1;
+	font-family: Arial, Helvetica, sans-serif;
+	text-align: left;
+	margin: 0px;
+	font-size: 18px;
+	font-weight: normal;
+	color: #000000;
+}
+#rel_note_body {
+	position:relative;
+	z-index:1;
+	font-family: Arial, Helvetica, sans-serif;
+	padding-left: 15px;
+	padding-right: 15px;
+	text-align: left;
+	font-size: 18px;
+	font-weight: normal;
+	color: #000000;
+}
+#row1_logos {
+	height:40%;
+}
+#buttons {
+	height:40%;
+	margin-left:auto;
+	margin-right:auto;
+	text-align:center;
+}
+#bottom_pad {
+	height:20%;
+}
+#jerry_sez {
+	text-align: center;
+	margin: auto;
+	display: none;
+	position: absolute;
+	left: 20%;
+}
+#release_version {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:16px;
+	font-weight:700;
+	text-align:center;
+	letter-spacing:0px;
+	color:#666666;
+}
+#browser_version {
+	font-family: Arial, Helvetica, sans-serif;
+	padding-top: 4px;
+	padding-bottom: 8px;
+	text-align:center;
+	font-size: 14px;
+	color: #666666;
+}
+#roman_num {
+	font-family:Georgia, "Times New Roman", Times, serif;
+	letter-spacing:0px;
+}
+img.button {
+	padding-top:4px;
+	padding-bottom:10px;
+	padding-right:10px;
+	padding-left:10px;
+}
+img.button_p {
+	padding-top:7px;
+	padding-bottom:7px;
+	padding-right:13px;
+	padding-left:7px;
+}
+li {
+	padding-top: 10px;
+	margin-right: 20px;
+}
+h4 {
+	font-family: sans-serif;
+	font-size: 24px;
+	font-weight: bold;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/localpagesmaemo/startpage.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,84 @@
+<html>
+  <head>
+	  <title>Welcome Page</title>
+	  <meta name = "viewport" content = "width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no">
+	  <link rel="stylesheet" type="text/css" href="startpage.css"/>
+  </head>
+  <script type="text/javascript">
+  	function pressed (num) {
+		butt1 = document.getElementById('relnote_button');
+		butt2 = document.getElementById('survey_button');
+
+		switch (num)
+		{
+			case 1: 
+				butt1.setAttribute('class', 'button_p');
+				break;
+			case 2: 
+				butt2.setAttribute('class', 'button_p');
+				alert ("No Survey Link");
+				break;
+			case 9: // reset on refocus
+				butt1.setAttribute('class', 'button');
+				butt2.setAttribute('class', 'button');
+				break;
+		}
+	}
+  
+  </script>
+  <body onFocus="pressed(9)" >
+  <img id="bgimage" src="grad_tall.jpg" />
+  <div id="content">
+    <div id="row1_logos">
+	    <img id="nokia_logo" src="nokia_logo.png" />
+	    <img id="browser_logo" src="bedrock.png" />
+        <div id="browser_version">
+            <div id="release_version">
+	            <script type="text/javascript">
+	                var UAString = navigator.userAgent;
+	                var brNameVer = "unknown";
+	                var UALen = 1;
+	                var nameStart = 1;
+	        
+					// options for Welcome Page browser version information
+		            //document.write("ALPHA <span id='roman_num'>III</span>");
+		            //document.write("BETA");
+		            document.write("TRUNK BUILD");
+
+					// Get, parse, display UA String
+	                UALen = UAString.length;
+	                // NOTE: if UA String changes browser name to 
+	                // something else we'll need to change the following line!
+	                nameStart = UAString.indexOf("NokiaBrowser");
+	                // test to see if "NokiaBrowser" is in the UA String at all
+	                if (nameStart < 0)
+						brNameVer = "UA = <br/>" + UAString;
+	                else
+	                {
+	                    // crop string starting at "NokiaBrowser"
+	                    brNameVer = UAString.substring(nameStart, UALen);
+	                    // limit substring to "NokiaBrowser" and version only
+	                    brNameVer = brNameVer.substr(0, brNameVer.indexOf(" "));
+	                    // clean up string for presentation
+	                    brNameVer = brNameVer.replace("/", " v");
+	                }
+					// comment OUT next two lines to remove build info...
+					document.write(" - ");
+	                document.write(brNameVer);
+					document.write("<br/>");
+	            </script>
+            </div>
+        </div>
+		<div id="jerry_sez">
+			<img src="button4.png" onMouseDown="pressed(25)"></img>
+		</div>
+		<div id="buttons">
+        	<a href="relnotes.html" onMouseDown="pressed(1)"><img id="relnote_button" class="button" src="button_rel_notes.png" /></a>
+        	<a href="startpage.html" onMouseDown="pressed(2)"><img id="survey_button" class="button" src="button_survey.png" /></a>
+        </div>
+		<div id="bottom_pad">
+		</div>
+    </div>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/localpagesmaemo/startpage_101.html	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,12 @@
+<html>
+<header><title>10.1 QA Index</title></header>
+<body>
+<p>10.1 QA testing index: </p>
+<p><a href="http://waplabdc.nokia-boston.com/browser/users/swkarna/BAT.html">Daily BAT Test cases</a></p>
+<p><a href="http://waplabdc.nokia-boston.com/browser/users/yankai/IDOBAT.html">IDO BAT Test cases</a></p>
+<p><a href="http://waplabdc.nokia-boston.com/browser/users/yankai/LWS.html">LWS cases</a></p>
+<p><a href="http://waplabdc.nokia-boston.com/browser/users/yankai/NFT.html">NFT Cases</a></p>
+<p><a href="http://waplabdc.nokia-boston.com/browser/users/yankai/index.html">Other test cases</a></p>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/chrome/localpagesmaemo/subpage.css	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,51 @@
+body {
+    margin:0px;
+    text-align: center;
+    font-family: sans-serif;
+    font-size: 16px;
+
+
+
+    #background-color: #006633;
+    background-color: #333333;
+}
+
+img { border-style: none; }
+
+li { padding-top: 10px; }
+
+h4 {
+    font-family: sans-serif;
+    font-size: 24px;
+    font-weight: bold;
+}
+
+#sub_left {
+    float: left;
+    padding-left: 20px;
+    padding-top: 10px;
+    width: 290px;
+}
+
+#sub_right {
+    float: right;
+    padding-right: 20px;
+    padding-top: 36px;
+    width: 200px;
+}
+
+#rel_notes {
+    float: clear;
+    text-align: left;
+    margin: 20px;
+    margin-top: 10px;
+    font-size: 18px;
+    font-weight: normal;
+    color: #FFFFFF;
+}
+
+#start_search {
+  height: 46px;
+  font-size: 20px;
+  color: #115D6E;
+}
--- a/ginebra2/data/backup_registration.xml	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/data/backup_registration.xml	Fri Oct 15 17:30:59 2010 -0400
@@ -1,7 +1,7 @@
 <?xml version="1.0" standalone="yes"?>
 <backup_registration>
   <passive_backup>
-    <include_file name="browserContent.db"/>
+    <include_file name="bookmarks.db"/>
   </passive_backup>
   <system_backup/>
   <restore requires_reboot = "no"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/deployment.pri	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,116 @@
+include($$PWD/../flags.pri)
+
+# localpages
+
+    !contains(br_layout, maemolayout) {
+    	localpages.sources =    ./chrome/localpages/*.htm* \
+                            ./chrome/localpages/*.js \
+                            ./chrome/localpages/*.css \
+                            ./chrome/localpages/*.jpg \
+                            ./chrome/localpages/*.png \
+                            ./chrome/localpages/*.dat
+    	localpages.path = ./localpages
+    	DEPLOYMENT += localpages
+	  }
+	  
+	  contains(br_layout, maemolayout) {
+	  	localpages.sources =    ./chrome/localpagesmaemo/*.htm* \
+                            ./chrome/localpagesmaemo/*.js \
+                            ./chrome/localpagesmaemo/*.css \
+                            ./chrome/localpagesmaemo/*.jpg \
+                            ./chrome/localpagesmaemo/*.png
+    	localpages.path = ./localpagesmaemo
+    	DEPLOYMENT += localpages
+	  }
+# mifs
+# FIXME : is this really needed
+    mifs.sources += /resource/apps/NokiaBrowser.mif
+    mifs.path = /resource/apps
+#    DEPLOYMENT += mifs
+             	  
+# backup restore file 
+    backuprestore.sources = ./data/backup_registration.xml 
+    backuprestore.path = ./
+    DEPLOYMENT += backuprestore 
+    
+# Gesture lib
+    qstmgesturelib.sources = qstmgesturelib.dll
+    qstmgesturelib.path = /sys/bin
+    DEPLOYMENT += qstmgesturelib
+
+# bedrockprovisioning
+    bedrockprovisioning.sources = BedrockProvisioning.dll
+    bedrockprovisioning.path = /sys/bin
+    DEPLOYMENT += bedrockprovisioning
+    provisioningtemplate.sources = ../bedrockProvisioning/template/200267EA.ini
+    provisioningtemplate.path = /data/.config/Nokia
+    DEPLOYMENT += provisioningtemplate
+
+# browsercore
+    browsercore.sources = BrowserCore.dll
+    browsecore.path = /sys/bin
+    DEPLOYMENT += browsercore
+
+contains(browser_addon, no) {
+# browserrfsplugin
+    browserrfsplugindll.sources = browserrfsplugin.dll
+    browserrfsplugindll.path = /sys/bin
+    browserrfs.sources = /resource/browserrfs.txt 
+    browserrfs.path = /resource
+    browserrfsplugin.sources = browserrfsplugin.rsc
+    browserrfsplugin.path = /resource/plugins
+#    DEPLOYMENT += browserrfsplugindll browserrfsplugin browserrfs
+
+# hsbookmarkwidgetplugin    
+    plugins.path = /private/20022F35/import/widgetregistry/200267BE
+    plugins.sources = hsbookmarkwidgetplugin.dll 
+    DEPLOYMENT += plugins
+    widgetResources.path    = /private/20022F35/import/widgetregistry/200267BE
+    widgetResources.sources += ../homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/hsbookmarkwidgetplugin.xml    
+    widgetResources.sources += ../homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/hsbookmarkwidgetplugin.manifest
+    widgetResources.sources += ../homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/nokiabrowser-bm-icon_70x70_ico.png
+    widgetResources.sources += ../homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/nokiabrowser-bm-icon_70x70_no_ico.png
+    widgetResources.sources += ../homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/nokiabrowser-bm-icon_50x50.png
+    DEPLOYMENT += widgetResources
+}
+
+contains(DEFINES, ENABLE_PERF_TRACE) {
+    brperftrace.sources = brperftrace.dll
+    brperftrace.path = /sys/bin
+    DEPLOYMENT += brperftrace
+}
+
+# from mw/browser
+    bookmarksapi.sources = bookmarksapi.dll
+    bookmarksapi.path = /sys/bin
+    DEPLOYMENT += bookmarksapi
+
+# bookmarks
+    bookmarks.sources += ../../../mw/browser/bookmarks/conf/bookmarks.xml"
+    bookmarks.path = ./
+    DEPLOYMENT += bookmarks
+
+# Not used
+#    BookMarksClientlibs.sources = BookMarksClient.dll
+#    BookMarksClientlibs.path = /sys/bin
+#    DEPLOYMENT += BookMarksClientlibs
+
+# browsercontentdll    
+    browsercontentdll.sources = browsercontentdll.dll
+    browsercontentdll.path = /sys/bin
+    DEPLOYMENT += browsercontentdll
+# end from mw/browser 
+
+contains(browser_addon, ninetwo) {
+    brserviceipcclient.sources = BrServiceIPCClient.dll
+    brserviceipcclient.path = /sys/bin
+    DEPLOYMENT += brserviceipcclient
+
+    brdownloadmgr.sources = BrDownloadMgr.dll
+    brdownloadmgr.path = /sys/bin
+    DEPLOYMENT += brdownloadmgr 
+    
+#    qtsystemInfo.sources = qtsystemInfo.dll
+#    qtsystemInfo.path = /sys/bin
+#    DEPLOYMENT += qtsystemInfo 
+}
--- a/ginebra2/emulator/browser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/emulator/browser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -20,17 +20,18 @@
 */
 
 #include "browser.h"
-#ifndef NO_QSTM_GESTURE
 #include "WebGestureHelper.h"
-#endif
 #include "../ChromeLayout.h"
 #include "../ChromeWidget.h"
 #include "../ChromeDOM.h"
-#include "HistoryFlowView.h"
+#include "../Application.h"
 #include "WindowFlowView.h"
 #include "webpagecontroller.h"
 #include "bedrockprovisioning.h"
+#include "Utilities.h"
+#include "mostvisitedpagestore.h"
 
+#include <QApplication>
 #include <QDebug>
 #ifdef _GVA_INSPECT_CHROME_
 #include <QWebInspector>
@@ -50,25 +51,36 @@
 #endif
 #endif
 
+#ifdef Q_WS_MAEMO_5
+#include "../ContentViews/WindowsView.h"
+#include "../ContentViews/BrowserWindow.h"
+#endif
+
 GinebraBrowser::GinebraBrowser(QObject * parent, QString *url)
   : QObject(parent)
     , m_scene(new QGraphicsScene())
+    , m_app(0)
 #ifdef Q_WS_MAEMO_5
     , m_mainWindow(0)
+    , m_menu(new QMenu(tr("Menu")))
     , m_splashScreenM5(0)
 #else
     , m_splashScreen(0)
 #endif
 {
+  //Create chrome widget
+  m_chrome = new GVA::ChromeWidget();
+
   platformSpecificInit();
 
   // The initial url to go to when the browser is called from another app
   if (url != 0) {
       m_initialUrl = *url;
   }
-  QString startUpChrome(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("StartUpChrome"));
+  QString startUpChrome = (BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("StartUpChrome"));
+
   m_install = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("ChromeBaseDirectory")
-      + startUpChrome.section('/', 0, -2) + "/";
+      + startUpChrome.section('/', 0, -2)/*+ "/"*/;
   m_chromeUrl = startUpChrome.section('/', -1);
   m_contentUrl = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("StartPage");
 
@@ -77,8 +89,20 @@
   //qDebug() << "GinebraBrowser::GinebraBrowser: " << m_install << " " << m_chromeUrl;
   //GVA::Settings * settings = GVA::Settings::instance();
   //settings->setInstallRoot(m_install);
-  // Create the chrome widget
-  m_chrome = new GVA::ChromeWidget();
+
+m_app = new GVA::GinebraApplication();
+
+// Instantiate Most Visited Page store.
+  MostVisitedPageStoreSingleton::Instance();
+
+#ifdef Q_WS_MAEMO_5
+   
+  safe_connect(m_app, SIGNAL(addMenuBarActionRequest(QAction *)),
+	       this, SLOT(addMenuBarAction(QAction *)));
+  safe_connect(m_app, SIGNAL(setMenuBarEnabledRequest(bool)),
+	       this, SLOT(setMenuBarEnabled(bool)));
+#endif
+  m_chrome->setApp(m_app);
 
   //removeFaviconDir();
 
@@ -99,26 +123,21 @@
   connect(m_chrome->page(), SIGNAL(webInspectorTriggered(QWebElement)), inspector, SLOT(show()));
 #endif
 
+#ifndef Q_WS_MAEMO_5
   //Create a view onto the chrome
-#ifdef Q_WS_MAEMO_5
-  m_view = new GVA::ChromeView(m_scene, m_chrome, m_mainWindow);
-  m_mainWindow->setCentralWidget(m_view);
-#else
   m_view = new GVA::ChromeView(m_scene, m_chrome);
-#endif
-
-#ifndef NO_QSTM_GESTURE
   WebGestureHelper* gh = new WebGestureHelper(m_view);
   browserApp->setGestureHelper(gh);
   browserApp->setMainWindow(m_view);
+
   m_view->grabGesture(QStm_Gesture::assignedType());
-#endif
-
-#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
+  //m_view->viewport()->grabGesture(QStm_Gesture::assignedType());
+#if defined(Q_OS_SYMBIAN)
   m_view->showFullScreen();
 #else
   m_view->setGeometry(0,0,360,640);
 #endif
+#endif  //End non-Maemo5 initialization
 
   showSplashScreen();
 
@@ -127,15 +146,15 @@
    //Load the chrome
   m_chrome->setChromeBaseDirectory(m_install);
   m_chrome->setChromeFile(m_chromeUrl);
+
 #ifdef CHROME_CONSOLE
   // Show the javascript console.
   ChromeConsole *console = new ChromeConsole(m_chrome);
   console->show();
-  console->move(m_view->geometry().topLeft() + QPoint(m_view->width()+6, 0));
+  //console->move(m_view->geometry().topLeft() + QPoint(m_view->width()+6, 0));
 #endif
 #else
   onChromeComplete();
-
 #endif
 
   // Handle openUrl signals
@@ -146,27 +165,25 @@
 {
   delete m_chrome;
   delete WebPageController::getSingleton();
+#ifndef Q_WS_MAEMO_5
   delete m_view;
+#endif
   destroySplashScreen();
+  delete m_app;
   delete m_scene;
 #ifdef Q_WS_MAEMO_5
-  delete m_mainWindow;
+  delete m_windows;
 #endif
 
-#ifndef NO_QSTM_GESTURE
   WebGestureHelper* gh = browserApp->gestureHelper();
   delete gh;
-#endif
 }
 
 void GinebraBrowser::platformSpecificInit() {
 #ifdef Q_WS_MAEMO_5
-    m_mainWindow = new QMainWindow();
-    m_mainWindow->show();
-
-    QMenu *menu = m_mainWindow->menuBar()->addMenu(tr("Menu"));
-    menu->addAction("Bookmarks", this, SLOT(onBookmarksAction()));
-    menu->addAction("History", this, SLOT(onHistoryAction()));
+   m_windows = new GVA::WindowsView(m_chrome);
+   m_windows->setMenu(m_menu);
+   m_windows->handlePageEvents(true);
 #else
 
     // Add initialization code for other platforms here...
@@ -201,52 +218,85 @@
 */
 void GinebraBrowser::show()
 {
+#ifndef Q_WS_MAEMO_5
   m_view->show();
+#endif
 }
 
 void GinebraBrowser::onChromeComplete()
 {
 #ifndef __gva_no_chrome__
+#ifndef Q_WS_MAEMO_5
   ControllableViewBase *windowView = WRT::WindowFlowView::createNew(m_chrome->layout());
   windowView->setObjectName("WindowView");
   m_chrome->addView(windowView);
 
-  ControllableViewBase *historyView = WRT::HistoryFlowView::createNew(m_chrome->layout());
-  historyView->setObjectName("HistoryView");
-  m_chrome->addView(historyView);
+#endif
+#endif
 
-#endif
   //Create a content window and add it to the chrome
   GVA::GWebContentView *content = new GVA::GWebContentView(m_chrome, 0, "WebView");
   //Load the initial content after the chrome loads. This makes sure that an initial bad
   //content page won't hang up rendering the chrome.
   m_chrome->addView(content);
+  
+  #ifdef Q_WS_MAEMO_5
+   safe_connect(content, SIGNAL(titleChanged(const QString &)),  this, SLOT(onTitleChanged(const QString &)));
+  #endif
 
-  QString chromeBaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("LocalPagesBaseDirectory");
-  QString startPage = chromeBaseDir + m_contentUrl;
+   bool enabled = (bool) BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("SaveSession");
 
-  bool enabled = (bool) BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("SaveSession");
+   QString localPagesBaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("LocalPagesBaseDirectory");
+   QString startPage = localPagesBaseDir + m_contentUrl;
 
-  // Load the previous page from history (if that option is enabled)
-  if (enabled) {
-    qDebug() << "GinebraBrowser::onChromeComplete: load from history";
-    WebPageController::getSingleton()->loadFromHistory();
-  }
-  
-  // If the browser was launched by some other app calling QDesktopServices.openUrl, go to that url
-  if (!m_initialUrl.isEmpty()) {
-  	 qDebug() << "GinebraBrowser::onChromeComplete: url=" << m_initialUrl;
-    openUrl(m_initialUrl);
-  }
-  // Otherwise, if load from history not enabled, load the start page
-  else if (!enabled) {
-    content->loadUrlToCurrentPage(startPage);
-  }
+   // Load the previous page from history (if that option is enabled)
+   if (enabled) {
+     qDebug() << "GinebraBrowser::onChromeComplete: load from history";
+     content->saveZoomDataAndRestoreAfterLoad();
+     WebPageController::getSingleton()->loadFromHistory();
+   }
+
+   // If the browser was launched by some other app calling QDesktopServices.openUrl, go to that url
+   if (!m_initialUrl.isEmpty()) {
+          qDebug() << "GinebraBrowser::onChromeComplete: url=" << m_initialUrl;
+     openUrl(m_initialUrl);
+   }
+   // Otherwise, if load from history not enabled, load the start page
+   else if (!enabled) {
+     content->loadUrlToCurrentPage(startPage);
+   }
 
   m_chrome->showView("WebView");
   destroySplashScreen();
 }
 
+#ifdef Q_WS_MAEMO_5
+void GinebraBrowser::addMenuBarAction(QAction *action) { 
+   m_menu->addAction(action);
+}
+void GinebraBrowser::setMenuBarEnabled(bool value) {
+   m_menu->setEnabled(value);
+}
+
+void GinebraBrowser::fixupWindowTitle() {
+  
+}
+
+void GinebraBrowser::onTitleChanged(const QString &title) {
+    // Update the title in the Maemo status bar.
+    if(m_mainWindow) {
+        if(title.isEmpty()) {
+            m_mainWindow->setWindowTitle(QApplication::applicationName());
+        }
+        else {
+            m_mainWindow->setWindowTitle(title);
+        }
+        fixupWindowTitle();
+    }
+}
+
+#endif
+
 void GinebraBrowser::queueOpenUrl(QString url)
 {
     emit openUrlRequested(url);
@@ -284,12 +334,14 @@
     // If no number then it's just a plain url
 #endif /* Q_OS_SYMBIAN */
     // Bring the browser to the front (QDesktopServices openurl is supposed to do this but doesn't)
+#ifndef Q_WS_MAEMO_5
     if (m_view) {
         m_view->activateWindow();
         m_view->raise();
     }
-    m_contentUrl = url;
-    WebPageController::getSingleton()->loadInitialUrlFromOtherApp(url);
+#endif
+    m_contentUrl = QDir::fromNativeSeparators(url);
+    WebPageController::getSingleton()->loadInitialUrlFromOtherApp(m_contentUrl);
 //    GVA::GWebContentView *webView = (GVA::GWebContentView *)m_chrome->getView("WebView");
 //    if (webView != 0) {
 //        m_contentUrl = url;
@@ -364,16 +416,3 @@
   QCoreApplication::setApplicationVersion(browserAppVersion);
 }
 
-#ifdef Q_WS_MAEMO_5
-void GinebraBrowser::onBookmarksAction() {
-    // Note: Need a way to open Bookmarks window natively?
-    if(m_chrome->dom())
-        m_chrome->dom()->evalInChromeContext("chrome_showBookmarksView()");
-}
-
-void GinebraBrowser::onHistoryAction() {
-    // Note: Need a way to open History window natively?
-    if(m_chrome->dom())
-        m_chrome->dom()->evalInChromeContext("chrome_showHistoryView()");
-}
-#endif
--- a/ginebra2/emulator/browser.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/emulator/browser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -28,6 +28,15 @@
 #include "../ChromeView.h"
 #include "GWebContentView.h"
 
+#ifdef Q_WS_MAEMO_5
+namespace GVA {
+   class WindowsView;
+   class BrowserWindow;
+}
+#endif
+
+class GinebraApplication;
+
 class GinebraBrowser : public QObject
 {
   Q_OBJECT
@@ -49,8 +58,12 @@
 
 #ifdef Q_WS_MAEMO_5
  private slots:
-  void onBookmarksAction();
-  void onHistoryAction();
+  void addMenuBarAction(QAction *action);
+  void setMenuBarEnabled(bool value = true);
+  void onTitleChanged(const QString &title);
+  
+ private:
+  void fixupWindowTitle();
 #endif
 
  private:
@@ -64,10 +77,13 @@
   GVA::ChromeWidget * m_chrome;
   GVA::ChromeView * m_view;
   QGraphicsScene *m_scene;
+  GVA::GinebraApplication *m_app;
   QString m_initialUrl;
 #ifdef Q_WS_MAEMO_5
-  QMainWindow *m_mainWindow;
+  GVA::BrowserWindow *m_mainWindow;
   QSplashScreen *m_splashScreenM5;
+  GVA::WindowsView *m_windows;
+  QMenu *m_menu;   // not owned
 #else
   QLabel *m_splashScreen;  // Owned
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/emulator/browsermaemo.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,366 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+
+#include "browser.h"
+#ifndef NO_QSTM_GESTURE
+#include "WebGestureHelper.h"
+#endif
+#include "../ChromeLayout.h"
+#include "../ChromeWidget.h"
+#include "../ChromeDOM.h"
+#include "../Application.h"
+#include "HistoryFlowView.h"
+#include "WindowFlowView.h"
+#include "webpagecontroller.h"
+#include "bedrockprovisioning.h"
+#include "Utilities.h"
+#include "mostvisitedpagestore.h"
+
+#include <QApplication>
+#include <QDebug>
+#ifdef _GVA_INSPECT_CHROME_
+#include <QWebInspector>
+#endif
+#include <QWebSettings>
+
+#ifndef Q_OS_SYMBIAN
+// Uncomment the next line to enable the javascript console dialog.
+//#define CHROME_CONSOLE 1
+#ifdef CHROME_CONSOLE
+#include "ChromeConsole.h"
+#endif
+#endif
+
+
+#ifdef Q_WS_MAEMO_5
+#include "../ContentViews/WindowsView.h"
+#include "../ContentViews/BrowserWindow.h"
+#endif
+
+GinebraBrowser::GinebraBrowser(QObject * parent, QString *url)
+  : QObject(parent)
+  , m_scene(new QGraphicsScene())
+  , m_app(0)
+#ifdef Q_WS_MAEMO_5
+  , m_mainWindow(0)
+  , m_menu(new QMenu(tr("Menu")))
+  , m_splashScreenM5(0)
+#else
+  , m_splashScreen(0)
+#endif
+{
+
+
+  // Create the chrome widget
+  m_chrome = new GVA::ChromeWidget();
+
+  platformSpecificInit();
+
+  // The initial url to go to when the browser is called from another app
+  if (url != 0) {
+      m_initialUrl = *url;
+  }
+  QString startUpChrome(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("StartUpChrome"));
+  m_install = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("ChromeBaseDirectory")
+      + startUpChrome.section('/', 0, -2) + "/";
+  m_chromeUrl = startUpChrome.section('/', -1);
+  m_contentUrl = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("StartPage");
+
+  setApplicationNameVersion();
+
+  m_app = new GVA::GinebraApplication();
+
+  // Instantiate Most Visited Page store.
+  MostVisitedPageStoreSingleton::Instance();
+
+#ifdef Q_WS_MAEMO_5
+  safe_connect(m_app, SIGNAL(addMenuBarActionRequest(QAction *)),
+	       this, SLOT(addMenuBarAction(QAction *)));
+  safe_connect(m_app, SIGNAL(setMenuBarEnabledRequest(bool)),
+	       this, SLOT(setMenuBarEnabled(bool)));
+#endif
+
+  m_chrome->setApp(m_app);
+
+#ifdef _GVA_INSPECT_CHROME_
+  QWebSettings * s = m_chrome->page()->settings();
+  s->setAttribute(QWebSettings::DeveloperExtrasEnabled, true );
+  QWebInspector *inspector = new QWebInspector;
+  inspector->setPage(m_chrome->page());
+  inspector->resize(400,600);
+  inspector->show();
+  connect(m_chrome->page(), SIGNAL(webInspectorTriggered(QWebElement)), inspector, SLOT(show()));
+#endif
+
+#ifndef Q_WS_MAEMO_5 //In maemo5 views, gesture handling are per window
+  //Create a view onto the chrome
+  m_view = new GVA::ChromeView(m_scene, m_chrome);
+#ifndef NO_QSTM_GESTURE
+  WebGestureHelper* gh = new WebGestureHelper(m_view);
+  browserApp->setGestureHelper(gh);
+  browserApp->setMainWindow(m_view);
+  m_view->grabGesture(QStm_Gesture::assignedType());
+#endif
+#if defined(Q_OS_SYMBIAN)
+  m_view->showFullScreen();
+#else
+  m_view->setGeometry(0,0,360,640);
+#endif
+#endif //End non-Maemo5 initialization
+
+  showSplashScreen();
+
+#ifndef __gva_no_chrome__
+  QObject::connect(m_chrome, SIGNAL(internalChromeComplete()), this, SLOT(onChromeComplete()));
+   //Load the chrome
+  m_chrome->setChromeBaseDirectory(m_install);
+  m_chrome->setChromeFile(m_chromeUrl);
+#ifdef CHROME_CONSOLE
+  // Show the javascript console.
+  ChromeConsole *console = new ChromeConsole(m_chrome);
+  console->show();
+  //console->move(m_view->geometry().topLeft() + QPoint(m_view->width()+6, 0));
+#endif
+#else
+  onChromeComplete();
+#endif
+
+  // Handle openUrl signals
+  connect(this, SIGNAL(openUrlRequested(QString)), this, SLOT(openUrl(QString)));
+}
+
+GinebraBrowser::~GinebraBrowser()
+{
+  delete m_chrome;
+  delete WebPageController::getSingleton();
+  //delete m_view;
+  destroySplashScreen();
+  delete m_scene;
+  delete m_app;
+#ifdef Q_WS_MAEMO_5
+  delete m_windows; 
+#endif
+
+#ifndef NO_QSTM_GESTURE
+  WebGestureHelper* gh = browserApp->gestureHelper();
+  delete gh;
+#endif
+}
+
+void GinebraBrowser::platformSpecificInit() {
+#ifdef Q_WS_MAEMO_5
+  m_windows = new GVA::WindowsView(m_chrome);
+  m_windows->setMenu(m_menu);
+  m_windows->handlePageEvents(true);
+#else
+  // Add initialization code for other platforms here...
+#endif
+}
+
+void GinebraBrowser::show()
+{
+  //m_view->show();
+}
+
+void GinebraBrowser::onChromeComplete()
+{
+#ifndef __gva_no_chrome__
+#ifndef Q_WS_MAEMO_5
+  ControllableViewBase *windowView = WRT::WindowFlowView::createNew(m_chrome->layout());
+  windowView->setObjectName("WindowView");
+  m_chrome->addView(windowView);
+  ControllableViewBase *historyView = WRT::HistoryFlowView::createNew(m_chrome->layout());
+  historyView->setObjectName("HistoryView");
+  m_chrome->addView(historyView);
+#endif
+#endif
+
+  //Create a content window and add it to the chrome
+
+  GVA::GWebContentView *content = new GVA::GWebContentView(m_chrome, 0, "WebView");
+  m_chrome->addView(content);
+
+#ifndef Q_WS_MAEMO_5
+  safe_connect(content, SIGNAL(titleChanged(const QString &)),
+               this, SLOT(onTitleChanged(const QString &)));
+#endif
+
+  QString chromeBaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("LocalPagesBaseDirectory");
+  QString startPage = chromeBaseDir + m_contentUrl;
+
+  bool enabled = (bool) BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("SaveSession");
+
+  // If the browser was launched by some other app calling QDesktopServices.openUrl, go to that url
+  if (!m_initialUrl.isEmpty()) {
+      openUrl(m_initialUrl);
+  }
+  // Otherwise, load the previous page from history (if that option is enabled)
+  else if (enabled && m_initialUrl.isEmpty()) {
+    WebPageController::getSingleton()->loadFromHistory();
+  }
+  // Otherwise, load the start page
+  else {
+    content->loadUrlToCurrentPage(startPage);
+  }
+  m_chrome->showView("WebView");
+  destroySplashScreen();
+ }
+
+#ifdef Q_WS_MAEMO_5
+
+void GinebraBrowser::addMenuBarAction(QAction *action) {
+    m_menu->addAction(action);
+}
+
+/// Hack to hide the menu bar arrow when the menu is disabled.
+void GinebraBrowser::fixupWindowTitle() {
+  /*    QString title = m_mainWindow->windowTitle();
+    title = title.trimmed();
+    if(m_menu && !m_menu->isEnabled()) {
+        // The menu is disabled, add some spaces to the title to push the down arrow out of view.
+        title += QString(60, ' ');
+    }
+    m_mainWindow->setWindowTitle(title);*/
+}
+
+void GinebraBrowser::setMenuBarEnabled(bool value) {
+  // m_menu->setEnabled(value);
+  m_windows->setMenuEnabled(value);
+  fixupWindowTitle();
+}
+
+void GinebraBrowser::onTitleChanged(const QString &title) {
+    // Update the title in the Maemo status bar.
+    if(m_mainWindow) {
+        if(title.isEmpty()) {
+            m_mainWindow->setWindowTitle(QApplication::applicationName());
+        }
+        else {
+            m_mainWindow->setWindowTitle(title);
+        }
+        fixupWindowTitle();
+    }
+}
+
+#endif
+
+void GinebraBrowser::queueOpenUrl(QString url)
+{
+    emit openUrlRequested(url);
+}
+
+void GinebraBrowser::openUrl(QString url)
+{
+#ifdef Q_OS_SYMBIAN
+    // Handle the url as per the old standard at
+    // http://wiki.forum.nokia.com/index.php/TSS000340_-_Launching_the_Web_browser_on_S60_3rd_Edition_to_open_a_specified_URL
+    QChar urlType = url.at(0);
+    // Bookmark (by uid) - not handled
+    if (urlType == '1') {
+        return;
+    }
+    // Saved deck (by uid) - not handled
+    else if (urlType == '2') {
+        return;
+    }
+    // Start page - not handled
+    else if (urlType == '5') {
+        return;
+    }
+    // Bookmark folder (by uid) - not handled
+    else if (urlType == '6') {
+        return;
+    }
+    // Url or Url + space + access point
+    else if (urlType == '4') {
+        url = url.mid(2); // Get the real url
+        if (url.contains(' ')) { // Chop off the access point if there is one because it's not currently handled
+            url = url.left(url.indexOf(' '));
+        }
+    }
+    // If no number then it's just a plain url
+#endif /* Q_OS_SYMBIAN */
+    // Bring the browser to the front (QDesktopServices openurl is supposed to do this but doesn't)
+    //if (m_view) {
+    //    m_view->activateWindow();
+    //    m_view->raise();
+    //}
+    m_contentUrl = url;
+    WebPageController::getSingleton()->loadInitialUrlFromOtherApp(url);
+//    GVA::GWebContentView *webView = (GVA::GWebContentView *)m_chrome->getView("WebView");
+//    if (webView != 0) {
+//        m_contentUrl = url;
+//        webView->loadUrlToCurrentPage(url);
+//    }
+}
+
+void GinebraBrowser::showSplashScreen() {
+  QString splashImage = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("SplashImage");
+  QString baseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("ChromeBaseDirectory");
+  QString imagePath =   baseDir + splashImage;
+
+#ifdef Q_WS_MAEMO_5
+  m_splashScreenM5 = new QSplashScreen(m_mainWindow, QPixmap(imagePath));
+  m_splashScreenM5->show();
+#else
+
+  if (!imagePath.isNull()) {
+    m_splashScreen = new QLabel(NULL);
+    m_splashScreen->setAlignment(Qt::AlignCenter);
+    m_splashScreen->setStyleSheet("background-color: #FFF");
+    m_splashScreen->setPixmap(QPixmap(imagePath));
+    if (m_splashScreen->pixmap()->isNull()) {
+        ;//qDebug() << "ChromeView::chromeLoaded: ERROR splashscreen creation failed. " << imagePath;
+    }
+    else {
+#ifdef Q_OS_SYMBIAN
+        m_splashScreen->showFullScreen();
+        m_view->showFullScreen();
+#else
+        m_splashScreen->setGeometry(0,0,360,640);
+        m_splashScreen->show();
+#endif
+    }
+  }
+#endif
+}
+
+void GinebraBrowser::destroySplashScreen()
+{
+#ifdef Q_WS_MAEMO_5
+    if(m_splashScreenM5) {
+        delete m_splashScreenM5;
+        m_splashScreenM5 = 0;
+    }
+#else
+    if (m_splashScreen) {
+        delete m_splashScreen;
+        m_splashScreen = NULL;
+    }
+#endif
+}
+
+void GinebraBrowser::setApplicationNameVersion()
+{
+  QCoreApplication::setApplicationName(BEDROCK_APPLICATION_NAME);
+  QString browserAppVersion = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("BedrockVersion");
+  QCoreApplication::setApplicationVersion(browserAppVersion);
+}
--- a/ginebra2/emulator/main.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/emulator/main.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -27,15 +27,18 @@
 #include <QLocale>
 #include <QWebSettings>
 #include <QGraphicsWebView>
-#ifndef NO_QSTM_GESTURE
 #include "WebGestureHelper.h"
-#endif
+
 
 #include <QNetworkProxyFactory>
 #include "browser.h"
 
 #include "bedrockprovisioning.h"
 
+#if defined(ORBIT_UI)
+#include <hbapplication.h>
+#endif
+
 #include <QDebug>
 
 #ifdef QTHIGHWAY
@@ -219,27 +222,14 @@
 //        }
 
 /* openurl should only work in Orbit UI application. */
-#ifdef ORBIT_UI
-#ifdef OPENURL
-#ifdef NO_QSTM_GESTURE
-    HbApplication app(AppFactoryL, argc, argv);
-#else
+
+#if defined(ORBIT_UI) && defined(OPENURL)
     BrowserApp app(AppFactoryL, argc, argv);
-#endif
-#else /* !OPENURL */
-#ifdef NO_QSTM_GESTURE
-  HbApplication app(argc, argv);
-#else // ORBIT_UI
+#else /* !(ORBIT_UI && OPENURL) */
   BrowserApp app(argc, argv);
-#endif
-#endif /* OPENURL */
-#else
-#ifdef NO_QSTM_GESTURE
-  QApplication app(argc, argv);
-#else
-  BrowserApp app(argc, argv);
-#endif
-#endif // ORBIT_UI
+#endif /* ORBIT_UI && OPENURL */
+
+    //  qDebug() << "main - after app";
 
 #ifdef QTHIGHWAY
     //qDebug() << "ServiceInfo:" << (XQServiceUtil::isService() ? "Service" : "Normal") << "launch";
@@ -250,9 +240,9 @@
 #endif
 
 //  qDebug() << "main - after app";
-#ifdef Q_OS_SYMBIAN
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
     //Object cache settings. NB: these need to be tuned per device
-    QWebSettings::globalSettings()->setObjectCacheCapacities(128*1024, 1024*1024, 1024*1024);
+    QWebSettings::globalSettings()->setObjectCacheCapacities(128*1024, 8*1024*1024, 10*1024*1024);
 #endif
 
     if (BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("DnsPrefetchEnabled").toBool())
@@ -268,17 +258,27 @@
 
     QString lang = QLocale::system().name();
 
-    //install the common translator from platform
+    // load the common translator
     QTranslator common;
+    #ifdef PLATFORM_LOCALIZATION
+    // load from platform
     common.load("z:/resource/qt/translations/common_" + lang);
+    #else
+    // load from Browser
+    common.load(":/resource/qt/translations/common_" + lang);
+    #endif
     QApplication::installTranslator(&common);
 
 
-    //install the translator from Browser
+    // install the translator from Browser
     QTranslator translator;
-    QString transFilePath = "Z:/resource/qt/translations/";
+    QString transFilePath = ":/translations";
+    #ifdef PLATFORM_LOCALIZATION
+    // install from platform
+    transFilePath = "Z:/resource/qt/translations/";
+    #endif
     QString transFile = QLatin1String("browserloc_") +  lang;
-    translator.load(transFile, transFilePath);
+    bool isLoaded2 = translator.load(transFile, transFilePath);
     QApplication::installTranslator(&translator);
 
 // To make the native urlsearch bar selection visible, the following lines have to be removed
@@ -306,9 +306,6 @@
 #if defined(NO_RESIZE_ON_LOAD)
     PERF_TRACE_OUT() << "NO_RESIZE_ON_LOAD\n";
 #endif
-#if defined(NO_QSTM_GESTURE)
-    PERF_TRACE_OUT() << "NO_QSTM_GESTURE\n";
-#endif
 #if defined(__gva_no_chrome__)
     PERF_TRACE_OUT() << "__gva_no_chrome__\n";
 #endif
--- a/ginebra2/ginebra2.pro	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/ginebra2.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -41,13 +41,9 @@
 
 
 # Gesture lib
-!contains(DEFINES,  NO_QSTM_GESTURE) {
-   message("Including qstmgesturelib.")
    INCLUDEPATH += $$PWD/../qstmgesturelib
    INCLUDEPATH += $$PWD/../qstmgesturelib/qstmfilelogger
    LIBS += -lqstmgesturelib
-   #LIBPATH += $$ROOT_DIR/app/browser/qstmgesturelib/output/bin
- }
 
 contains(DEFINES, ENABLE_PERF_TRACE) {
     message("ginebra2.pro: Tracing is ON")
@@ -60,7 +56,12 @@
 # include($$ROOT_DIR/app/common/platform/platform.pri)
 # include($$ROOT_DIR/app/common/common.pri)
 
-TRANSLATIONS += browserLoc.ts
+contains(br_platform_localization, no) {
+    TRANSLATIONS += $$PWD/translations/browserloc.ts
+}else{
+    DEFINES += PLATFORM_LOCALIZATION
+    TRANSLATIONS += browserLoc.ts
+}
 
 # ;;; Following can presumably go away if we will also use Qt's QtWebKit
 win32: {
@@ -84,14 +85,18 @@
 #
 ################################################################################
 
-RESOURCES = ginebra2.qrc
+RESOURCES = ./qrc/ginebra2.qrc
 
 contains(br_layout, tenone) {
-    RESOURCES += ginebra_tenone.qrc
+    RESOURCES = ./qrc/ginebraTenone.qrc
     DEFINES += BROWSER_LAYOUT_TENONE
 }
 
-HEADERS = \
+contains(br_layout, maemolayout) {
+    RESOURCES = ./qrc/ginebraMaemo.qrc
+}
+
+HEADERS += \
     Application.h \
     ActionButton.h \
     ActionButtonSnippet.h \
@@ -105,11 +110,13 @@
     ChromeWidget.h \
     ChromeWidgetJSObject.h \
     ChromeView.h \
+    ContentViews/ContentViewContextMenu.h \
     ContentViews/GWebContentViewJSObject.h \
     ContentViews/GWebContentViewWidget.h \
     ContentViews/GWebContentView.h \
     ContentViews/GContentViewTouchNavigation.h \
     ContentViews/SuperPageView.h \
+    ContextMenu.h \
     DeviceDelegate.h \
     NetworkDelegate.h \
     VisibilityAnimator.h \
@@ -135,7 +142,6 @@
     animators/FadeAnimator.h \
     animators/SlideAnimator.h \
     emulator/browser.h \
-    emulator/ChromeConsole.h \
     ViewController.h \
     ViewStack.h \
     GWebTouchNavigation.h \
@@ -155,27 +161,52 @@
     UrlSearchSnippet.h \
     Downloads.h \
     GAlternateFileChooser.h \
-    linearflowsnippet.h \
-    mostvisitedpageview.h \
-    mostvisitedsnippet.h \
     EditorWidget.h \
-    EditorSnippet.h
+    EditorSnippet.h \
+    ScaleThreePainter.h \
+    MostVisitedView.h \
+    GridView.h \
+    ScrollHelper.h \
+    CopyCutPasteSnippet.h
 
+CONFIG(maemo){
+   HEADERS+= ContentViews/WindowsView.h \
+             ContentViews/BrowserWindow.h
+}
+contains(br_layout, tenone) {
+    HEADERS += ScaleNinePainter.h
+}
+
+contains(br_layout, maemolayout) {
+    HEADERS += mostvisitedsnippetmaemo.h \
+    ScaleNinePainter.h
+}
+
+!contains(br_layout, maemolayout) {
+    HEADERS += linearflowsnippet.h \    
+    emulator/ChromeConsole.h \
+    mostvisitedsnippet.h
+}
 
 contains(br_tiled_backing_store, yes) {
     DEFINES += BEDROCK_TILED_BACKING_STORE
+    DEFINES += OWN_BACKING_STORE
 }
 
-!contains(DEFINES, NO_QSTM_GESTURE) {
-    HEADERS += WebGestureHelper.h \
-               WebTouchNavigation.h
+contains(DEFINES, OWN_BACKING_STORE) {
+DEFINES += BEDROCK_TILED_BACKING_STORE
+
+HEADERS += ContentViews/TiledWebView.h
+SOURCES += ContentViews/TiledWebView.cpp
 }
 
+    HEADERS += WebGestureHelper.h
+#WebTouchNavigation.h
+
 contains(DEFINES, BEDROCK_TILED_BACKING_STORE) {
     HEADERS += ContentViews/ScrollableWebContentView.h \
                ContentViews/ViewportMetaData.h \
                ContentViews/ViewportMetaDataParser.h \
-               ContentViews/WebContentAnimationItem.h \
                ContentViews/WebContentViewWidget.h \
                ContentViews/WebView.h \
                Gestures/GestureEvent.h \
@@ -184,10 +215,10 @@
                Gestures/GestureRecognizer_p.h \
                Kinetics/KineticScrollable.h \
                Kinetics/KineticScroller.h \
-               ScrollableViewBase.h
+               ScrollableViewBase.h                             
 }
 
-SOURCES = \
+SOURCES += \
     ActionButton.cpp \
     ActionButtonSnippet.cpp \
     Application.cpp \
@@ -206,6 +237,7 @@
     ContentViews/GWebContentView.cpp \
     ContentViews/GContentViewTouchNavigation.cpp \
     ContentViews/SuperPageView.cpp \
+    ContentViews/ContentViewContextMenu.cpp \
     DeviceDelegate.cpp \
     NetworkDelegate.cpp \
     VisibilityAnimator.cpp \
@@ -232,7 +264,6 @@
     animators/SlideAnimator.cpp \
     emulator/main.cpp \
     emulator/browser.cpp \
-    emulator/ChromeConsole.cpp \
     ViewController.cpp \
     ViewStack.cpp \
     GWebTouchNavigation.cpp \
@@ -251,22 +282,43 @@
     UrlSearchSnippet.cpp \
     Downloads.cpp \
     GAlternateFileChooser.cpp \
+    EditorWidget.cpp \
+    EditorSnippet.cpp \
+    ScaleThreePainter.cpp \
+    MostVisitedView.cpp \
+    GridView.cpp \
+    ScrollHelper.cpp \
+    CopyCutPasteSnippet.cpp
+
+CONFIG(maemo){
+    SOURCES += ContentViews/WindowsView.cpp \
+               ContentViews/BrowserWindow.cpp
+}
+
+contains(br_layout, maemolayout) {
+    SOURCES += mostvisitedsnippetmaemo.cpp \
+    ScaleNinePainter.cpp
+}
+
+!contains(br_layout, maemolayout) {
+    SOURCES += emulator/ChromeConsole.cpp \
     linearflowsnippet.cpp \
-    mostvisitedpageview.cpp \
-    mostvisitedsnippet.cpp \
-    EditorWidget.cpp \
-    EditorSnippet.cpp
+    mostvisitedsnippet.cpp
+}
+
+contains(br_layout, tenone) {
+    SOURCES += ScaleNinePainter.cpp
+}
 
 !contains(DEFINES, NO_QSTM_GESTURE) {
-    SOURCES += WebGestureHelper.cpp \
-               WebTouchNavigation.cpp
+    SOURCES += WebGestureHelper.cpp
+#    SOURCES += WebTouchNavigation.cpp
 }
 
 contains(DEFINES, BEDROCK_TILED_BACKING_STORE) {
     SOURCES += ContentViews/ScrollableWebContentView.cpp \
                ContentViews/ViewportMetaData.cpp \
                ContentViews/ViewportMetaDataParser.cpp \
-               ContentViews/WebContentAnimationItem.cpp \
                ContentViews/WebContentViewWidget.cpp \
                ContentViews/WebView.cpp \
                Gestures/GestureEvent.cpp \
@@ -275,11 +327,13 @@
                ScrollableViewBase.cpp
 }
 
-FORMS += emulator/ui/console.ui
+!contains(br_layout, maemolayout) {
+	FORMS += emulator/ui/console.ui
+}
 
 contains(br_mobility_sysinfo, yes) {
     CONFIG += mobility
-    MOBILITY = systeminfo
+    MOBILITY += systeminfo
     DEFINES += QT_MOBILITY_SYSINFO
 }
 
@@ -305,6 +359,11 @@
     DEFINES += QT_MOBILITY_SERVICE_FRAMEWORK
 }
 
+# Geolocation asychronous API should be support by Qt 4.7/QWebKit 2.1, but need to qulify for each platform
+contains(br_geolocation, yes) {
+   DEFINES += QT_GEOLOCATION
+}
+
 symbian: {
     TARGET.EPOCALLOWDLLDATA = 1
     TARGET.EPOCSTACKSIZE = 0x14000
@@ -332,7 +391,8 @@
         addMMPRules(MYCONDITIONS, MYVARIABLES)
     }
     
-    TARGET.CAPABILITY = All -TCB -DRM -AllFiles
+#    TARGET.CAPABILITY = All -TCB -DRM -AllFiles
+    TARGET.CAPABILITY = All -TCB -DRM
 
     contains(browser_addon, no) {
         TARGET.UID3 = 0x10008D39
@@ -348,7 +408,7 @@
     LIBS += -lcommdb
     LIBS += -lesock -lconnmon -linsock
     LIBS += -lavkon -lapparc -leikcore -lcone -lws32 -lapgrfx 
-
+    
 # QtHighway is used in TB10.1 for Application Interworking (AIW) support.
 contains(br_qthighway, yes) {
     DEFINES += QTHIGHWAY
@@ -381,36 +441,17 @@
 
     LIBS += -lhal -lsysutil
 
-    # localpages
-    localpages.sources =    ./chrome/localpages/*.htm* \
-                            ./chrome/localpages/*.js \
-                            ./chrome/localpages/*.css \
-                            ./chrome/localpages/*.jpg \
-                            ./chrome/localpages/*.png
-    localpages.path = ./localpages
-    DEPLOYMENT += localpages
-
-    # backup restore file 
-    backuprestore.sources = ./data/backup_registration.xml 
-    backuprestore.path = ./
-    DEPLOYMENT += backuprestore 
-    
-!contains(DEFINES, NO_QSTM_GESTURE) {
-    qstmgesturelib.sources = qstmgesturelib.dll
-    qstmgesturelib.path = /sys/bin
-    DEPLOYMENT += qstmgesturelib
-}
-
-contains(DEFINES, ENABLE_PERF_TRACE) {
-    brperftrace.sources = brperftrace.dll
-    brperftrace.path = /sys/bin
-    DEPLOYMENT += brperftrace
-}
-
     contains(browser_addon, no) {
         HEADERS += emulator/BrowserMainS60.h
         SOURCES += emulator/BrowserMainS60.cpp
 }
+
+include(deployment.pri)
+packageheader = "$${LITERAL_HASH}{\"NokiaBrowser\"},(0x10008D39),2,0,0,TYPE=SA,RU"
+  my_deployment.pkg_prerules =  packageheader
+  DEPLOYMENT += my_deployment
+DEPLOYMENT.installer_header = "$${LITERAL_HASH}{\"NokiaBrowser\"},(0x10008D39),2,0,0,TYPE=SA,RU"
+
 }
 
 #unix: {
--- a/ginebra2/ginebra2.qrc	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-    <file>chrome/localpages/bedrock_splash.png</file>
-    <file>chrome/js/3rdparty/jquery-ui/effects.core.js</file>
-    <file>chrome/js/3rdparty/jquery-ui/ui.core.js</file>
-    <file>chrome/js/3rdparty/jquery-ui/effects.blind.js</file>
-    <file>chrome/js/3rdparty/jquery-ui/ui.sortable.js</file>
-    <file>chrome/js/3rdparty/jquery-1.4.2.min.js</file>
-    <file>chrome/js/LongPress.js</file>
-    <file>chrome/js/Bind.js</file>
-    <file>chrome/js/SimpleButton.js</file>
-    <file>chrome/js/Test.js</file>
-    <file>chrome/js/ContextMenu.js</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/SettingsView.html</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/settingsview.css</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/LegalNotice.html</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerbg_open.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons.old/list_itembg.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerarrow_open.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerarrow_closed.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons.old/list_headerbg_closed.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/settingsview.js</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/no_selected.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/no_deselected.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/broom_sweep.gif</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/list_headerarrow_open.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/list_headerarrow_closed.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/yes_deselected.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/broom_sweep.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/yes_selected.png</file>    
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/delete_btn.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/delete_btn_pressed.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/yes_btn.png</file>
-    <file>chrome/bedrockchrome/settingsview.superpage/icons/yes_btn_pressed.png</file>    
-    <file>chrome/bedrockchrome/networkstatus.snippet/networkstatus.js</file>
-    <file>chrome/bedrockchrome/networkstatus.snippet/networkstatus.css</file>
-    <file>chrome/bedrockchrome/networkstatus.snippet/icons/button_dialog_ok_wait.png</file>
-    <file>chrome/bedrockchrome/networkstatus.snippet/icons/button_dialog_ok_press.png</file>
-    <file>chrome/bedrockchrome/networkstatus.snippet/icons/icon_dialog_error.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/stop_btn.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/stop_btn_pressed.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/refresh_btn.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/go_btn.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/refresh_btn_pressed.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/go_btn_pressed.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/com.svg</file>
-    <file>chrome/bedrockchrome/prompt.snippet/prompt.js</file>
-    <file>chrome/bedrockchrome/prompt.snippet/prompt.css</file>
-    <file>chrome/bedrockchrome/prompt.snippet/icons/button_dialog_ok_wait.png</file>
-    <file>chrome/bedrockchrome/prompt.snippet/icons/button_dialog_ok_press.png</file>
-    <file>chrome/bedrockchrome/prompt.snippet/icons/icon_dialog_error.png</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/ContextMenu.css</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/ViewContextMenu.js</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/ContextMenu.js</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/icons/menu_tail.png</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/icons/nav_selected.png</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/icons/nav_deselected.png</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/icons/links_deselected.png</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/icons/page_deselected.png</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/icons/page_selected.png</file>
-    <file>chrome/bedrockchrome/contextmenu.snippet/icons/links_selected.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_disabled.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_feedback_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_partialTB.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_fullTB.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_fullTB_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_menu.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall_disabled.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_menu_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_back_disabled.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_add_disabled.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_feedback.png</file>
-    <file>chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_partialTB_pressed.png</file>
-    <file>chrome/bedrockchrome/chrome.css</file>
-    <file>chrome/bedrockchrome/historyview.superpage/clearhistorydialog.css</file>
-    <file>chrome/bedrockchrome/historyview.superpage/historyview.css</file>
-    <file>chrome/bedrockchrome/historyview.superpage/clearhistorydialog.js</file>
-    <file>chrome/bedrockchrome/historyview.superpage/historyview.js</file>
-    <file>chrome/bedrockchrome/historyview.superpage/historyView.html</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/list_headerbg_open.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_cancel_press.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/list_itembg.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/clear_history_bg.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_cancel_wait.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/list_headerarrow_open.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_ok_wait.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/list_headerarrow_closed.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/list_headerbg_closed.png</file>
-    <file>chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_ok_press.png</file>
-    <file>chrome/bedrockchrome/chrome.html</file>
-    <file>chrome/bedrockchrome/windowcount.snippet/windowcount.css</file>
-    <file>chrome/bedrockchrome/windowcount.snippet/windowcount.js</file>
-    <file>chrome/bedrockchrome/windowcount.snippet/icons/emptycircle.png</file>
-    <file>chrome/bedrockchrome/windowcount.snippet/icons/filledcircle.png</file>
-    <file>chrome/bedrockchrome/chrome.js</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/zoombar.js</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/zoombar.css</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/icons/zoom_menu_bg.png</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+.png</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_disabled.png</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-.png</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_disabled.png</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_pressed.png</file>
-    <file>chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_pressed.png</file>
-    <file>chrome/bedrockchrome/download.snippet/download.js</file>
-    <file>chrome/bedrockchrome/download.snippet/download.css</file>
-    <file>chrome/bedrockchrome/download.snippet/icons/download_dialog_icon.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.css</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/BookmarkView.html</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.js</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.css</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.js</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dogear.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_open_bg.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_cross_pressed.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/cc0d0d-hatch.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/add_bookmark_bg.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/list_itembg.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_pressed.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_open_bg_pressed.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_cross.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/list_itembg_pressed.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/menu_icon_bookmarks.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_bottom.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/delete_btn.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_open.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_tick_pressed.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_center.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_tick.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_top.png</file>
-    <file>chrome/bedrockchrome/bookmarkview.superpage/icons/edit_btn.png</file>
-    <file>chrome/bedrockchrome/suggests.snippet/suggests.css</file>
-    <file>chrome/bedrockchrome/suggests.snippet/suggests.html</file>
-    <file>chrome/bedrockchrome/suggests.snippet/icons/divider.png</file>
-    <file>chrome/bedrockchrome/suggests.snippet/icons/topshadow.png</file>
-    <file>chrome/bedrockchrome/suggests.snippet/icons/bottomshadow.png</file>
-    <file>chrome/bedrockchrome/suggests.snippet/suggests.js</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/statusbar.css</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/statusbar.js</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/download_statusbar_icon.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/lock.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt40.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt100.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt90.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt10.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt80.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt70.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt60.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt30.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt100_charging.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt20.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/battery/batt50.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/signal/signal25.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/signal/signal50.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/signal/signal0.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/signal/signal100.png</file>
-    <file>chrome/bedrockchrome/statusbar.snippet/icons/signal/signal75.png</file>
-    <file>chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.css</file>
-    <file>chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.js</file>
-    <file>chrome/bedrockchrome/outofmemory.snippet/icons/button_dialog_out_of_memory_ok_press.png</file>
-    <file>chrome/bedrockchrome/outofmemory.snippet/icons/button_dialog_out_of_memory_ok_wait.png</file>
-    <file>chrome/bedrockchrome/outofmemory.snippet/icons/icon_dialog_error.png</file>
-</qresource>
-</RCC>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/ginebra_maemo.qrc	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,92 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource> 
+    <file>translations/browserloc.qm</file> 
+		<file>chrome/bedrockchrome/chrome_maemo.html</file>  
+		<file>chrome/bedrockchrome/chrome_maemo.css</file>  
+    <file>chrome/bedrockchrome/settingsview.superpage/SettingsViewMaemo.html</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.css</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.js</file>    
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross_pressed.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/cc0d0d-hatch.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/add_bookmark_bg.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_pressed.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg_pressed.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg_pressed.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/menu_icon_bookmarks.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_bottom.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/delete_btn.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick_pressed.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_center.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_top.png</file>
+    <file>chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/edit_btn.png</file>    
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom_disabled.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_disabled.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_disabled.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_disabled.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_disabled.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_pressed.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_disabled.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB_pressed.png</file>    
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/circle_bg.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topLeft.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topMiddle.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topRight.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_middleMiddle.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomLeft.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomMiddle.png</file>
+    <file>chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomRight.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_open.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_press.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_itembg.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/clear_history_bg.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_wait.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_open.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_wait.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_closed.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_closed.png</file>
+    <file>chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_press.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/no_selected.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/no_deselected.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/broom_sweep.gif</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerarrow_open.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerarrow_closed.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_deselected.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/broom_sweep.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_selected.png</file>    
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/delete_btn.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/delete_btn_pressed.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_btn.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/yes_btn_pressed.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_closed.png</file>    
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_open.png</file>    
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg_pressed.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg.png</file>
+    <file>chrome/bedrockchrome/settingsview.superpage/LegalNoticeMaemo.html</file>
+</qresource>
+</RCC>
--- a/ginebra2/ginebra_tenone.qrc	Thu Sep 23 15:32:11 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/backstep.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/backstep_pressed.png</file>
-    <file>chrome/bedrockchrome/urlsearch.snippet/icons/URL_search_divider.png</file>    
-    <file>chrome/bedrockchrome/chrome_tenone.html</file>
-</qresource>
-</RCC>
--- a/ginebra2/linearflowsnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/linearflowsnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -98,6 +98,14 @@
 const QString FadeOut       = "fo";//"fadeout";
 const QString ZoomIn        = "zi";//"zoomin";
 const QString ZoomOut       = "zo";//"zoomto";
+
+#ifdef Q_WS_MAEMO_5
+	  const QRgb BackgroundColorRgb = 0x000000;
+#else
+	  const QRgb BackgroundColorRgb = QColor(68,88,125).rgb();
+#endif
+	
+    
 // -------------------------------------------------------
 // Help functions
 
@@ -200,9 +208,8 @@
 
 class FilmstripFlowPrivate
 {
-public:
-    FilmstripFlowPrivate(): m_bgColor(QColor(68,88,125).rgb()), m_buffer(NULL), m_titleBuffer(NULL),m_closeIcon(NULL), m_centerTopSpace(0), m_sideTopSpace(0), m_space(0), m_incIndex(0), m_centerIndex(INVALID_INDEX) {}
-
+public:	 
+    FilmstripFlowPrivate(): m_bgColor(BackgroundColorRgb), m_buffer(NULL), m_titleBuffer(NULL),m_closeIcon(NULL), m_centerTopSpace(0), m_sideTopSpace(0), m_space(0), m_incIndex(0), m_centerIndex(INVALID_INDEX) {}   
     ~FilmstripFlowPrivate() {
         for (int i = 0; i < m_films.size(); i++)
             SAFE_DELETE(m_films[i]);
@@ -396,7 +403,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = ((w - 4 * m_filmstripFlowData->m_space) - cw) / 2.0 - sw + m_filmstripFlowData->m_space;
     qreal sx = ((w - 4 * m_filmstripFlowData->m_space) - cw) / 2.0 - 2 * sw;
@@ -416,7 +422,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = (w + 4 * m_filmstripFlowData->m_space + cw) / 2.0 - m_filmstripFlowData->m_space;
     qreal sx = ((w + 4 * m_filmstripFlowData->m_space + cw) / 2.0) + sw ;
@@ -436,7 +441,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = ((w - 4 * m_filmstripFlowData->m_space) - cw) / 2.0 - sw + m_filmstripFlowData->m_space;
     qreal sx = (((w - 4 * m_filmstripFlowData->m_space) - cw) / 2.0) - (2 *sw);
@@ -456,7 +460,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = (w + 4 * m_filmstripFlowData->m_space + cw) / 2.0 - m_filmstripFlowData->m_space;
     qreal sx = ((w + 4 * m_filmstripFlowData->m_space + cw) / 2.0) + sw ;
@@ -476,7 +479,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = ((w - 4 * m_filmstripFlowData->m_space) - cw) / 2.0 - sw + m_filmstripFlowData->m_space;
@@ -502,7 +504,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = ((w - 4 * m_filmstripFlowData->m_space) - cw) / 2.0 - sw + m_filmstripFlowData->m_space;
@@ -527,7 +528,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = (w + 4 * m_filmstripFlowData->m_space + cw) / 2.0 - m_filmstripFlowData->m_space;
@@ -553,7 +553,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = (w + 4 * m_filmstripFlowData->m_space + cw) / 2.0 - m_filmstripFlowData->m_space;
@@ -574,6 +573,7 @@
 
 void FilmstripMovieFactory::addRectByFrame(FilmstripMovie* movie, QRectF& startRect, QRectF& endRect, qreal x1, qreal y1, qreal x2, qreal y2, bool debug)
 {
+    Q_UNUSED(debug)
     movie->m_movieClips.append(startRect);
     for (int i = 1; i < ANIMATION_MAX_FRAME; i++) {
         movie->m_movieClips.append(movie->m_movieClips[i - 1].adjusted(x1, y1, x2, y2));
@@ -589,7 +589,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = (w - cw) / 2.0;
@@ -615,7 +614,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = (w - cw) / 2.0;
@@ -641,7 +639,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = (w - cw) / 2.0;
@@ -666,7 +663,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal step = ANIMATION_MAX_FRAME;
     qreal cx = (w - cw) / 2.0;
@@ -690,7 +686,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = (w - cw) / 2.0;
     qreal sx = (w * (1 - 2 * m_filmstripFlowData->m_space) - cw) / 2.0 - sw;
@@ -710,7 +705,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = (w - cw) / 2.0;
     qreal sx = (w * (1 - 2 * m_filmstripFlowData->m_space) - cw) / 2.0 - sw;
@@ -730,7 +724,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = (w - cw) / 2.0;
     qreal sx = (w * (1 + 2 * m_filmstripFlowData->m_space) + cw) / 2.0;
@@ -749,7 +742,6 @@
     int sw = m_filmstripFlowData->m_sideWindowSize.width();
     int sh = m_filmstripFlowData->m_sideWindowSize.height();
     int w = m_filmstripFlowData->m_widgetSize.width();
-    int h = m_filmstripFlowData->m_widgetSize.height();
 
     qreal cx = (w - cw) / 2.0;
     qreal sx = (w * (1 + 2 * m_filmstripFlowData->m_space) + cw) / 2.0;
@@ -1132,7 +1124,6 @@
     int cw = d->m_centerWindowSize.width();
     int ch = d->m_centerWindowSize.height();
     int w = size().width();
-    int h = size().height();
 
     qreal cx = (w - cw) / 2.0;
     qreal cy = d->m_centerTopSpace;
@@ -1509,7 +1500,6 @@
         int sw = d->m_sideWindowSize.width();
         int sh = d->m_sideWindowSize.height();
         int w = d->m_widgetSize.width();
-        int h = d->m_widgetSize.height();
 
         qreal leftLeftPageX = (((w - 4 * d->m_space) - cw) / 2.0) - (2 *sw);
         qreal rightRightPageX = (w + 4 * d->m_space + cw) / 2.0 + sw;
@@ -1596,6 +1586,8 @@
 
 void LinearFlowSnippet::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
+    Q_UNUSED(option)
+    Q_UNUSED(widget)
     Q_ASSERT(d);
     Q_ASSERT(d->m_buffer);
     Q_ASSERT(d->m_titleBuffer);
--- a/ginebra2/mostvisitedpageview.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/mostvisitedpageview.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -27,6 +27,7 @@
 #include "webpagecontroller.h"
 #include "HistoryManager.h"
 #include "webpagedata.h"
+#include "ChromeEffect.h"
 #include "ExternalEventCharm.h"
 #include "Utilities.h"
 #include "wrtbrowsercontainer.h"
@@ -91,7 +92,7 @@
     } else {
         displayMode = "Portrait";
     }
-    m_flowInterface->init(displayMode,qtTrId("txt_browser_most_visited_title"));
+    m_flowInterface->init(displayMode,qtTrId("txt_browser_most_visited_title_most_visited"));
 
     MostVisitedPageList mvPageList = m_mostVisitedPageStore->pageList();
 
@@ -138,14 +139,19 @@
     m_flowInterface->resize(QSize(m_parent->size().width(), KLinearSnippetHeight));
 }
 
-void MostVisitedPagesWidget::displayModeChanged(QString& newMode)
+void MostVisitedPagesWidget::displayModeChanged(QString& newMode, QSize sz)
 {
+    Q_UNUSED(sz);
     m_flowInterface->displayModeChanged(newMode);
 }
 
 void MostVisitedPagesWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 {
+	  #ifndef Q_WS_MAEMO_5
     painter->fillRect(0, 0, size().width(), size().height(), QColor(255, 255, 255));
+    #else
+    ChromeEffect::paintDisabledRect(painter, option->exposedRect);
+    #endif
     QGraphicsWidget::paint(painter, option, widget);
 }
 
@@ -206,7 +212,7 @@
  void MostVisitedPagesWidget::updateMVStore(WRT::WrtBrowserContainer *page)
   {
     Q_ASSERT(page);
-    Q_ASSERT(!page->mainFrame()->url().isEmpty());
+    if (page->mainFrame()->url().isEmpty()) return;
 
     QUrl pageUrl = page->mainFrame()->url();
     int pageRank = 0;
@@ -214,8 +220,8 @@
     //check if page exists in store along with its thumbnail
     if (!m_mostVisitedPageStore->contains(pageUrl.toString(), true)) {
         qreal scale = 200.0 / page->viewportSize().width();
-        QImage img = page->pageThumbnail(scale, scale);
-        pageThumbnail = new QImage(img);
+        QSize sz = page->viewportSize() * scale;
+        pageThumbnail = new QImage(page->thumbnail(sz));
     }
 
     //if it is a new page to the store, get its rank from history
@@ -241,7 +247,7 @@
 
 void MostVisitedPagesWidget::clearMVStore()
 {
-    m_mostVisitedPageStore->clearMostVisitedPageStore();
+    m_mostVisitedPageStore->clear(); 
 }
 
 } // endof namespace GVA
--- a/ginebra2/mostvisitedpageview.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/mostvisitedpageview.h	Fri Oct 15 17:30:59 2010 -0400
@@ -32,6 +32,8 @@
 
 namespace GVA {
 
+const QSize KSize(0,0);
+
 class ExternalEventCharm;
 class LinearFlowSnippet;
 
@@ -47,7 +49,7 @@
 
     void updatePos(QPointF pos, qreal &toolBarHeight);
     void resize(const QSize &size);
-    void displayModeChanged(QString& newMode);
+    void displayModeChanged(QString& newMode, QSize sz=KSize);
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
     void setCenterIndex(QString displayMode);
     void updateMVGeometry();
--- a/ginebra2/mostvisitedsnippet.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/mostvisitedsnippet.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -5,7 +5,7 @@
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, version 2.1 of the License.
-*
+* 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -19,33 +19,55 @@
 *
 */
 #include "mostvisitedsnippet.h"
-#include "mostvisitedpageview.h"
+#include "MostVisitedView.h"
+#include "Utilities.h"
+#include "ExternalEventCharm.h"
 
 namespace GVA {
 
 MostVisitedSnippet::MostVisitedSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element) :
-        ChromeSnippet(elementId, chrome, widget, element)
+        ChromeSnippet(elementId, chrome, widget, element),
+        m_externalEventCharm(0)
 {
     m_chrome = chrome;
+    
+}
+
+MostVisitedSnippet::~MostVisitedSnippet()
+{
+    disconnect(m_chrome , SIGNAL(aspectChanged(int)), this, SLOT(displayModeChanged(int)));
+    delete m_externalEventCharm;
 }
 
 MostVisitedSnippet * MostVisitedSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element)
 {
     MostVisitedSnippet* that = new MostVisitedSnippet(elementId, chrome, 0, element);
-    that->setChromeWidget( new MostVisitedPagesWidget(that, chrome) );
+    
+    that->setChromeWidget( new MostVisitedView(qtTrId("txt_browser_most_visited_title_most_visited"), chrome->layout()) );
     that->widget()->hide(); //TODO: Shouldn't be needed?
     return that;
 }
 
 void MostVisitedSnippet::toggleVisibility(bool animate)
 {
-    MostVisitedPagesWidget *mostVisitedPagesWidget = dynamic_cast<MostVisitedPagesWidget*>(widget());
+    QString displayMode;
+    MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget());
     if (!mostVisitedPagesWidget)
         return;
 
     if (!isVisible()) {
-         mostVisitedPagesWidget->open();
-         updateMVGeometry();
+    		 #ifdef Q_WS_MAEMO_5
+         mostVisitedPagesWidget->setGeometry(10, 10, 784, 335);
+         #else
+         
+         displayMode = m_chrome->layout()->getDisplayMode();
+         
+         if (displayMode == "portrait")
+         		mostVisitedPagesWidget->setGeometry(10, 20, 350, 553);
+         else
+         		mostVisitedPagesWidget->setGeometry(15, 10, 620, 284);
+         #endif
+         mostVisitedPagesWidget->update(displayMode);
          mostVisitedPagesWidget->show();
          ChromeSnippet::toggleVisibility(animate);
 
@@ -54,33 +76,26 @@
     }
 }
 
-
 void MostVisitedSnippet::setChromeWidget(QGraphicsWidget * widget)
 {
-    connect(m_chrome , SIGNAL(aspectChanged(int)), this, SLOT(displayModeChanged(int)));
+    safe_connect(m_chrome , SIGNAL(aspectChanged(int)), this, SLOT(displayModeChanged(int)));
     ChromeSnippet::setChromeWidget(widget);
-    MostVisitedPagesWidget *mostVisitedPagesWidget = dynamic_cast<MostVisitedPagesWidget*>(widget);
-    connect(mostVisitedPagesWidget, SIGNAL(closeComplete()), this, SIGNAL(mostVisitedSnippetCloseComplete()));
-}
-
-void MostVisitedSnippet::updateMVGeometry()
-{
-    MostVisitedPagesWidget *mostVisitedPagesWidget = dynamic_cast<MostVisitedPagesWidget*>(widget());
-    qreal toolBarHeight;
-
-    ChromeSnippet* visibleSnippet= m_chrome->getSnippet("WebViewToolbarId");
-    if (visibleSnippet)
-        toolBarHeight = visibleSnippet->widget()->rect().height();
-
-    //Resizing the widget to exclude the toolbar area so that it can handle events on toolbar as external event
-    mostVisitedPagesWidget->resize(QSize(m_chrome->layout()->size().width(),(m_chrome->layout()->size().height()- toolBarHeight - KSpaceToolbarMVP)));
-    mostVisitedPagesWidget->updatePos(QPointF(0, 0), toolBarHeight);
+    MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget);
+    safe_connect(mostVisitedPagesWidget, SIGNAL(closeComplete()), this, SLOT(onWidgetCloseComplete()));
+//    m_externalEventCharm = new ExternalEventCharm(widget);
+//    safe_connect(m_externalEventCharm, SIGNAL(externalMouseEvent(QEvent *, const QString &, const QString &)),
+//                 this, SIGNAL(externalMouseEvent(QEvent *, const QString &, const QString &)));
 }
 
 void MostVisitedSnippet::displayModeChanged(int newMode)
 {
+	  if (isVisible())
+        ChromeSnippet::toggleVisibility();
+    emit mostVisitedSnippetCloseComplete();
+    /*  TO DO: reenable this code.
+
     if (isVisible()) {
-        MostVisitedPagesWidget *mostVisitedPagesWidget = dynamic_cast<MostVisitedPagesWidget*>(widget());
+        MostVisitedView *mostVisitedView = dynamic_cast<MostVisitedView*>(widget());
 
         if (!mostVisitedPagesWidget)
             return;
@@ -90,32 +105,34 @@
         QString  displayMode = (newMode == landscape) ? "Landscape" : "Portrait";
         mostVisitedPagesWidget->displayModeChanged(displayMode);
     }
+    */
 }
 
 void MostVisitedSnippet::hide(bool animate)
  {
-     MostVisitedPagesWidget *mostVisitedPagesWidget = dynamic_cast<MostVisitedPagesWidget*>(widget());
-
+     MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget());
      if (!mostVisitedPagesWidget)
        return;
 
-     ChromeSnippet::hide(animate);
-     mostVisitedPagesWidget->closeAnimationCompleted();
+    ChromeSnippet::hide(false);    	
  }
 
 void MostVisitedSnippet::close()
 {
-     MostVisitedPagesWidget *mostVisitedPagesWidget = dynamic_cast<MostVisitedPagesWidget*>(widget());
+     MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget());
 
      if (mostVisitedPagesWidget) {
        mostVisitedPagesWidget->close();
-     }
+     }     
 }
 
-MostVisitedSnippet::~MostVisitedSnippet()
-{
-    disconnect(m_chrome , SIGNAL(aspectChanged(int)), this, SLOT(displayModeChanged(int)));
+void MostVisitedSnippet::onWidgetCloseComplete() {            // slot
+    if (isVisible())
+        ChromeSnippet::toggleVisibility();
+    emit mostVisitedSnippetCloseComplete();
 }
 
 
+
+
 }
--- a/ginebra2/mostvisitedsnippet.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/ginebra2/mostvisitedsnippet.h	Fri Oct 15 17:30:59 2010 -0400
@@ -21,12 +21,13 @@
 
 #ifndef MOSTVISITEDSNIPPET_H
 #define MOSTVISITEDSNIPPET_H
-
 #include "ChromeSnippet.h"
 #include "ChromeWidget.h"
 
 namespace GVA {
 
+class ExternalEventCharm;
+
 class MostVisitedSnippet : public ChromeSnippet
 {
     Q_OBJECT
@@ -35,7 +36,6 @@
     static MostVisitedSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element);
     void toggleVisibility(bool animate);
     void hide(bool animate);
-    void updateMVGeometry();
     void setChromeWidget(QGraphicsWidget * widget);
     virtual ~MostVisitedSnippet();
     void close();
@@ -43,9 +43,10 @@
     void mostVisitedSnippetCloseComplete();
 private slots :
     void displayModeChanged(int newMode);
+    void onWidgetCloseComplete();
 private:
     ChromeWidget *m_chrome;
+    ExternalEventCharm *m_externalEventCharm;
 };
 }
-
 #endif // MOSTVISITEDSNIPPET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/mostvisitedsnippetmaemo.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+#include "mostvisitedsnippetmaemo.h"
+#include "MostVisitedView.h"
+#include "Utilities.h"
+#include "ExternalEventCharm.h"
+
+namespace GVA {
+
+MostVisitedSnippet::MostVisitedSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element) :
+        ChromeSnippet(elementId, chrome, widget, element),
+        m_externalEventCharm(0)
+{
+    m_chrome = chrome;
+}
+
+MostVisitedSnippet::~MostVisitedSnippet()
+{
+    disconnect(m_chrome , SIGNAL(aspectChanged(int)), this, SLOT(displayModeChanged(int)));
+    delete m_externalEventCharm;
+}
+
+MostVisitedSnippet * MostVisitedSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element)
+{
+    MostVisitedSnippet* that = new MostVisitedSnippet(elementId, chrome, 0, element);
+    
+    that->setChromeWidget( new MostVisitedView(qtTrId("txt_browser_most_visited_title_most_visited"), chrome->layout()) );
+    that->widget()->hide(); //TODO: Shouldn't be needed?
+    return that;
+}
+
+void MostVisitedSnippet::toggleVisibility(bool animate)
+{
+    MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget());
+    if (!mostVisitedPagesWidget)
+        return;
+
+    if (!isVisible()) {
+         mostVisitedPagesWidget->setGeometry(10, 10, 784, 335);
+         mostVisitedPagesWidget->update("landscape"); // it does not matter for Maemo (landscape mode only for now)
+         mostVisitedPagesWidget->show();
+         ChromeSnippet::toggleVisibility(animate);
+
+    } else {
+        mostVisitedPagesWidget->close();
+    }
+}
+
+void MostVisitedSnippet::setChromeWidget(QGraphicsWidget * widget)
+{
+    //safe_connect(m_chrome , SIGNAL(aspectChanged(int)), this, SLOT(displayModeChanged(int)));
+    ChromeSnippet::setChromeWidget(widget);
+    MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget);
+    safe_connect(mostVisitedPagesWidget, SIGNAL(closeComplete()), this, SLOT(onWidgetCloseComplete()));
+//    m_externalEventCharm = new ExternalEventCharm(widget);
+//    safe_connect(m_externalEventCharm, SIGNAL(externalMouseEvent(QEvent *, const QString &, const QString &)),
+//                 this, SIGNAL(externalMouseEvent(QEvent *, const QString &, const QString &)));
+}
+
+void MostVisitedSnippet::displayModeChanged(int newMode)
+{
+    /*  TO DO: reenable this code.
+
+    if (isVisible()) {
+        MostVisitedView *mostVisitedView = dynamic_cast<MostVisitedView*>(widget());
+
+        if (!mostVisitedPagesWidget)
+            return;
+
+        updateMVGeometry();
+
+        QString  displayMode = (newMode == landscape) ? "Landscape" : "Portrait";
+        mostVisitedPagesWidget->displayModeChanged(displayMode);
+    }
+    */
+}
+
+void MostVisitedSnippet::hide(bool animate)
+ {
+     MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget());
+
+     if (!mostVisitedPagesWidget)
+       return;
+
+     ChromeSnippet::hide(animate);
+//     mostVisitedPagesWidget->closeAnimationCompleted();
+ }
+
+void MostVisitedSnippet::close()
+{
+     MostVisitedView *mostVisitedPagesWidget = dynamic_cast<MostVisitedView*>(widget());
+
+     if (mostVisitedPagesWidget) {
+       mostVisitedPagesWidget->close();
+     }
+}
+
+void MostVisitedSnippet::onWidgetCloseComplete() {            // slot
+    if (isVisible())
+        ChromeSnippet::toggleVisibility();
+    emit mostVisitedSnippetCloseComplete();
+}
+
+
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/mostvisitedsnippetmaemo.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+
+#ifndef MOSTVISITEDSNIPPETMAEMO_H
+#define MOSTVISITEDSNIPPETMAEMO_H
+
+#include "ChromeSnippet.h"
+#include "ChromeWidget.h"
+
+namespace GVA {
+
+class ExternalEventCharm;
+
+class MostVisitedSnippet : public ChromeSnippet
+{
+    Q_OBJECT
+public:
+    MostVisitedSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
+    static MostVisitedSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element);
+    void toggleVisibility(bool animate);
+    void hide(bool animate);
+    void setChromeWidget(QGraphicsWidget * widget);
+    virtual ~MostVisitedSnippet();
+    void close();
+Q_SIGNALS:
+    void mostVisitedSnippetCloseComplete();
+private slots :
+    void displayModeChanged(int newMode);
+    void onWidgetCloseComplete();
+private:
+    ChromeWidget *m_chrome;
+    ExternalEventCharm *m_externalEventCharm;
+};
+}
+
+#endif // MOSTVISITEDSNIPPETMAEMO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/qrc/ginebra2.qrc	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,256 @@
+<!DOCTYPE RCC><RCC version="1.0">
+
+<qresource prefix="/translations">
+    <file alias="browserloc.qm">../translations/browserloc.qm</file>
+</qresource>
+
+<qresource prefix="/chrome">
+	<file alias="chrome.css">../chrome/bedrockchrome/chrome.css</file>
+
+	<file alias="chrome.js">../chrome/bedrockchrome/chrome.js</file>
+	<file alias="effects.core.js">../chrome/js/3rdparty/jquery-ui/effects.core.js</file>
+	<file alias="ui.core.js">../chrome/js/3rdparty/jquery-ui/ui.core.js</file>
+	<file alias="effects.blind.js">../chrome/js/3rdparty/jquery-ui/effects.blind.js</file>
+	<file alias="ui.sortable.js">../chrome/js/3rdparty/jquery-ui/ui.sortable.js</file>
+	<file alias="jquery-1.4.2.min.js">../chrome/js/3rdparty/jquery-1.4.2.min.js</file>
+	<file alias="LongPress.js">../chrome/js/LongPress.js</file>
+	<file alias="Bind.js">../chrome/js/Bind.js</file>
+	<file alias="SimpleButton.js">../chrome/js/SimpleButton.js</file>
+	<file alias="Test.js">../chrome/js/Test.js</file>
+	<file alias="ContextMenu.js">../chrome/js/ContextMenu.js</file>
+
+	<file alias="chrome.html">../chrome/bedrockchrome/chrome.html</file>
+
+	<file alias="bedrock_splash.png">../chrome/localpages/bedrock_splash.png</file>
+</qresource>
+
+<qresource prefix="/bookmarkview">
+	<file alias="bookmarkview.css">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.css</file>
+	<file alias="bookmarkDialog.css">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.css</file>
+
+	<file alias="bookmarkDialog.js">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.js</file>
+	<file alias="bookmarkview.js">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.js</file>
+
+	<file alias="BookmarkView.html">../chrome/bedrockchrome/bookmarkview.superpage/BookmarkView.html</file>
+
+	<file alias="yes_selected.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/yes_selected.png</file>    
+	<file alias="yes_deselected.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/yes_deselected.png</file>
+
+	<file alias="dogear.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dogear.png</file>
+	<file alias="dogear_open_bg.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_open_bg.png</file>
+	<file alias="dialog_buttons_cross_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_cross_pressed.png</file>
+	<file alias="cc0d0d-hatch.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/cc0d0d-hatch.png</file>
+	<file alias="add_bookmark_bg.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/add_bookmark_bg.png</file>
+	<file alias="list_itembg.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/list_itembg.png</file>
+	<file alias="dogear_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_pressed.png</file>
+	<file alias="dogear_open_bg_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_open_bg_pressed.png</file>
+	<file alias="dialog_buttons_cross.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_cross.png</file>
+	<file alias="list_itembg_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/list_itembg_pressed.png</file>
+	<file alias="menu_icon_bookmarks.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/menu_icon_bookmarks.png</file>
+	<file alias="dialog_bottom.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_bottom.png</file>
+	<file alias="delete_btn.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/delete_btn.png</file>
+	<file alias="dogear_open.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_open.png</file>
+	<file alias="dialog_buttons_tick_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_tick_pressed.png</file>
+	<file alias="dialog_center.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_center.png</file>
+	<file alias="dialog_buttons_tick.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_buttons_tick.png</file>
+	<file alias="dialog_top.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dialog_top.png</file>
+	<file alias="edit_btn.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/edit_btn.png</file>
+</qresource>
+
+<qresource prefix="/contextmenu">
+	<file alias="ContextMenu.css">../chrome/bedrockchrome/contextmenu.snippet/ContextMenu.css</file>
+
+	<file alias="ViewContextMenu.js">../chrome/bedrockchrome/contextmenu.snippet/ViewContextMenu.js</file>
+	<file alias="ContextMenu.js">../chrome/bedrockchrome/contextmenu.snippet/ContextMenu.js</file>
+
+	<file alias="menu_tail.png">../chrome/bedrockchrome/contextmenu.snippet/icons/menu_tail.png</file>
+	<file alias="nav_selected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/nav_selected.png</file>
+	<file alias="nav_deselected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/nav_deselected.png</file>
+	<file alias="links_deselected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/links_deselected.png</file>
+	<file alias="page_deselected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/page_deselected.png</file>
+	<file alias="page_selected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/page_selected.png</file>
+	<file alias="links_selected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/links_selected.png</file>
+</qresource>
+
+<qresource prefix="/download">
+	<file alias="download.css">../chrome/bedrockchrome/download.snippet/download.css</file>
+
+	<file alias="download.js">../chrome/bedrockchrome/download.snippet/download.js</file>
+
+	<file alias="download_dialog_icon.png">../chrome/bedrockchrome/download.snippet/icons/download_dialog_icon.png</file>
+</qresource>
+
+<qresource prefix="/historyview">
+ 	<file alias="clearhistorydialog.css">../chrome/bedrockchrome/historyview.superpage/clearhistorydialog.css</file>
+	<file alias="historyview.css">../chrome/bedrockchrome/historyview.superpage/historyview.css</file>
+
+	<file alias="clearhistorydialog.js">../chrome/bedrockchrome/historyview.superpage/clearhistorydialog.js</file>
+	<file alias="historyview.js">../chrome/bedrockchrome/historyview.superpage/historyview.js</file>
+
+	<file alias="historyView.html">../chrome/bedrockchrome/historyview.superpage/historyView.html</file>
+
+	<file alias="list_headerbg_open.png">../chrome/bedrockchrome/historyview.superpage/icons/list_headerbg_open.png</file>
+	<file alias="button_dialog_history_clear_cancel_press.png">../chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_cancel_press.png</file>
+	<file alias="list_itembg.png">../chrome/bedrockchrome/historyview.superpage/icons/list_itembg.png</file>
+	<file alias="clear_history_bg.png">../chrome/bedrockchrome/historyview.superpage/icons/clear_history_bg.png</file>
+	<file alias="button_dialog_history_clear_cancel_wait.png">../chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_cancel_wait.png</file>
+	<file alias="list_headerarrow_open.png">../chrome/bedrockchrome/historyview.superpage/icons/list_headerarrow_open.png</file>
+	<file alias="button_dialog_history_clear_ok_wait.png">../chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_ok_wait.png</file>
+	<file alias="list_headerarrow_closed.png">../chrome/bedrockchrome/historyview.superpage/icons/list_headerarrow_closed.png</file>
+	<file alias="list_headerbg_closed.png">../chrome/bedrockchrome/historyview.superpage/icons/list_headerbg_closed.png</file>
+	<file alias="button_dialog_history_clear_ok_press.png">../chrome/bedrockchrome/historyview.superpage/icons/button_dialog_history_clear_ok_press.png</file>
+</qresource>
+
+<qresource prefix="/networkstatus">
+	<file alias="networkstatus.css">../chrome/bedrockchrome/networkstatus.snippet/networkstatus.css</file>
+
+	<file alias="networkstatus.js">../chrome/bedrockchrome/networkstatus.snippet/networkstatus.js</file>
+
+	<file alias="button_dialog_ok_wait.png">../chrome/bedrockchrome/networkstatus.snippet/icons/button_dialog_ok_wait.png</file>
+	<file alias="button_dialog_ok_press.png">../chrome/bedrockchrome/networkstatus.snippet/icons/button_dialog_ok_press.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/networkstatus.snippet/icons/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/outofmemory">
+	<file alias="outofmemorydialog.css">../chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.css</file>
+
+	<file alias="outofmemorydialog.js">../chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.js</file>
+
+	<file alias="button_dialog_out_of_memory_ok_press.png">../chrome/bedrockchrome/outofmemory.snippet/icons/button_dialog_out_of_memory_ok_press.png</file>
+	<file alias="button_dialog_out_of_memory_ok_wait.png">../chrome/bedrockchrome/outofmemory.snippet/icons/button_dialog_out_of_memory_ok_wait.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/outofmemory.snippet/icons/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/prompt">
+	<file alias="prompt.css">../chrome/bedrockchrome/prompt.snippet/prompt.css</file>
+
+	<file alias="prompt.js">../chrome/bedrockchrome/prompt.snippet/prompt.js</file>
+
+	<file alias="button_dialog_ok_wait.png">../chrome/bedrockchrome/prompt.snippet/icons/button_dialog_ok_wait.png</file>
+	<file alias="button_dialog_ok_press.png">../chrome/bedrockchrome/prompt.snippet/icons/button_dialog_ok_press.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/prompt.snippet/icons/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/settingsview">
+        <file alias="settingsview.css">../chrome/bedrockchrome/settingsview.superpage/settingsview.css</file>
+        <file alias="settingsview.js">../chrome/bedrockchrome/settingsview.superpage/settingsview.js</file>
+        <file alias="SettingsView.html">../chrome/bedrockchrome/settingsview.superpage/SettingsView.html</file>
+        <file alias="LegalNotice.html">../chrome/bedrockchrome/settingsview.superpage/LegalNotice.html</file>
+        <file alias="radio_on.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_on.png</file>
+    	<file alias="radio_off.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_off.png</file>
+        <file alias="no_selected.png">../chrome/bedrockchrome/settingsview.superpage/icons/no_selected.png</file>
+        <file alias="no_deselected.png">../chrome/bedrockchrome/settingsview.superpage/icons/no_deselected.png</file>
+        <file alias="broom_sweep.gif">../chrome/bedrockchrome/settingsview.superpage/icons/broom_sweep.gif</file>
+        <file alias="list_headerarrow_open.png">../chrome/bedrockchrome/settingsview.superpage/icons/list_headerarrow_open.png</file>
+        <file alias="list_headerarrow_closed.png">../chrome/bedrockchrome/settingsview.superpage/icons/list_headerarrow_closed.png</file>
+        <file alias="yes_deselected.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_deselected.png</file>
+        <file alias="broom_sweep.png">../chrome/bedrockchrome/settingsview.superpage/icons/broom_sweep.png</file>
+        <file alias="yes_selected.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_selected.png</file>
+        <file alias="delete_btn.png">../chrome/bedrockchrome/settingsview.superpage/icons/delete_btn.png</file>
+        <file alias="delete_btn_pressed.png">../chrome/bedrockchrome/settingsview.superpage/icons/delete_btn_pressed.png</file>
+        <file alias="yes_btn.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_btn.png</file>
+        <file alias="yes_btn_pressed.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_btn_pressed.png</file>
+</qresource>
+
+<qresource prefix="/statusbar">
+    <file alias="statusbar.css">../chrome/bedrockchrome/statusbar.snippet/statusbar.css</file>
+
+    <file alias="statusbar.js">../chrome/bedrockchrome/statusbar.snippet/statusbar.js</file>
+
+    <file alias="download_statusbar_icon.png">../chrome/bedrockchrome/statusbar.snippet/icons/download_statusbar_icon.png</file>
+    <file alias="lock.png">../chrome/bedrockchrome/statusbar.snippet/icons/lock.png</file>
+    <file alias="batt40.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt40.png</file>
+    <file alias="batt100.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt100.png</file>
+    <file alias="batt90.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt90.png</file>
+    <file alias="batt10.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt10.png</file>
+    <file alias="batt80.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt80.png</file>
+    <file alias="batt70.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt70.png</file>
+    <file alias="batt60.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt60.png</file>
+    <file alias="batt30.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt30.png</file>
+    <file alias="batt100_charging.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt100_charging.png</file>
+    <file alias="batt20.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt20.png</file>
+    <file alias="batt50.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt50.png</file>
+    <file alias="signal25.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal25.png</file>
+    <file alias="signal50.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal50.png</file>
+    <file alias="signal0.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal0.png</file>
+    <file alias="signal100.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal100.png</file>
+    <file alias="signal75.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal75.png</file>
+</qresource>
+
+<qresource prefix="/suggests">
+    <file alias="suggests.css">../chrome/bedrockchrome/suggests.snippet/suggests.css</file>
+
+    <file alias="suggests.js">../chrome/bedrockchrome/suggests.snippet/suggests.js</file>
+
+    <file alias="suggests.html">../chrome/bedrockchrome/suggests.snippet/suggests.html</file>
+
+    <file alias="divider.png">../chrome/bedrockchrome/suggests.snippet/icons/divider.png</file>
+    <file alias="topshadow.png">../chrome/bedrockchrome/suggests.snippet/icons/topshadow.png</file>
+    <file alias="bottomshadow.png">../chrome/bedrockchrome/suggests.snippet/icons/bottomshadow.png</file>
+</qresource>
+
+<qresource prefix="/toolbar">
+	<file alias="icon_zoom_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_disabled.png</file>
+	<file alias="icon_feedback_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_feedback_pressed.png</file>
+	<file alias="icon_back.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png</file>
+	<file alias="icon_back_bg.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png</file>
+	<file alias="icon_back_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png</file>
+	<file alias="icon_back_bg_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png</file>
+	<file alias="icon_toggle_partialTB.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_partialTB.png</file>
+	<file alias="icon_toggle_fullTB.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_fullTB.png</file>
+	<file alias="icon_clearall_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall_pressed.png</file>
+	<file alias="icon_toggle_fullTB_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_fullTB_pressed.png</file>
+	<file alias="icon_menu.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_menu.png</file>
+	<file alias="icon_mostvisited_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited_pressed.png</file>
+	<file alias="icon_clearall_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall_disabled.png</file>
+	<file alias="icon_zoom_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_pressed.png</file>
+	<file alias="icon_zoom.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom.png</file>
+	<file alias="icon_mostvisited.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited.png</file>
+	<file alias="icon_add.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png</file>
+	<file alias="icon_clearall.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_clearall.png</file>
+	<file alias="icon_menu_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_menu_pressed.png</file>
+	<file alias="icon_back_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_back_disabled.png</file>
+	<file alias="icon_add_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png</file>
+	<file alias="icon_add_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_add_disabled.png</file>
+	<file alias="icon_feedback.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_feedback.png</file>
+	<file alias="icon_toggle_partialTB_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_toggle_partialTB_pressed.png</file>
+</qresource>
+
+<qresource prefix="/windowcount">
+    <file alias="windowcount.css">../chrome/bedrockchrome/windowcount.snippet/windowcount.css</file>
+
+    <file alias="windowcount.js">../chrome/bedrockchrome/windowcount.snippet/windowcount.js</file>
+
+    <file alias="emptycircle.png">../chrome/bedrockchrome/windowcount.snippet/icons/emptycircle.png</file>
+    <file alias="filledcircle.png">../chrome/bedrockchrome/windowcount.snippet/icons/filledcircle.png</file>
+</qresource>
+
+<qresource prefix="/urlsearch">
+	<file alias="stop_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/stop_btn.png</file>
+	<file alias="refresh_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/refresh_btn.png</file>
+	<file alias="go_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/go_btn.png</file>
+
+	<file alias="com.svg">../chrome/bedrockchrome/urlsearch.snippet/icons/com.svg</file>
+</qresource>
+
+<qresource prefix="/zoombar">
+    <file alias="zoombar.css">../chrome/bedrockchrome/zoombar.snippet/zoombar.css</file>
+
+    <file alias="zoombar.js">../chrome/bedrockchrome/zoombar.snippet/zoombar.js</file>
+
+    <file alias="zoom_menu_bg.png">../chrome/bedrockchrome/zoombar.snippet/icons/zoom_menu_bg.png</file>
+    <file alias="icon_zoom+.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+.png</file>
+    <file alias="icon_zoom+_disabled.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_disabled.png</file>
+    <file alias="icon_zoom-.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-.png</file>
+    <file alias="icon_zoom-_disabled.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_disabled.png</file>
+    <file alias="icon_zoom+_pressed.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_pressed.png</file>
+    <file alias="icon_zoom-_pressed.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_pressed.png</file>
+</qresource>
+
+<qresource prefix="/mostvisited">
+    <file alias="most_visited_bac_left.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_left.png</file>
+    <file alias="most_visited_bac_middle.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_middle.png</file>
+    <file alias="most_visited_bac_right.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_right.png</file>
+</qresource>
+
+</RCC>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/qrc/ginebraMaemo.qrc	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,250 @@
+<!DOCTYPE RCC><RCC version="1.0">
+
+<!--
+<qresource prefix="/translations">
+    <file alias="browserloc.qm">../translations/browserloc.qm</file>
+</qresource>
+-->
+
+<qresource prefix="/chrome">
+	<file alias="chrome.css">../chrome/bedrockchrome/chrome_maemo.css</file>
+
+	<file alias="chrome.js">../chrome/bedrockchrome/chrome.js</file>
+	<file alias="effects.core.js">../chrome/js/3rdparty/jquery-ui/effects.core.js</file>
+	<file alias="ui.core.js">../chrome/js/3rdparty/jquery-ui/ui.core.js</file>
+	<file alias="effects.blind.js">../chrome/js/3rdparty/jquery-ui/effects.blind.js</file>
+	<file alias="ui.sortable.js">../chrome/js/3rdparty/jquery-ui/ui.sortable.js</file>
+	<file alias="jquery-1.4.2.min.js">../chrome/js/3rdparty/jquery-1.4.2.min.js</file>
+	<file alias="LongPress.js">../chrome/js/LongPress.js</file>
+	<file alias="Bind.js">../chrome/js/Bind.js</file>
+	<file alias="SimpleButton.js">../chrome/js/SimpleButton.js</file>
+	<file alias="Test.js">../chrome/js/Test.js</file>
+	<file alias="ContextMenu.js">../chrome/js/ContextMenu.js</file>
+
+	<file alias="chrome.html">../chrome/bedrockchrome/chrome_maemo.html</file>
+
+	<file alias="bedrock_splash.png">../chrome/localpagesmaemo/bedrock_splash.png</file>
+</qresource>
+
+<qresource prefix="/bookmarkview">
+	<file alias="bookmarkview.css">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.css</file>
+	<file alias="bookmarkDialog.css">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.css</file>
+
+	<file alias="bookmarkDialog.js">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.js</file>
+	<file alias="bookmarkview.js">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkview.js</file>
+
+	<file alias="BookmarkView.html">../chrome/bedrockchrome/bookmarkview.superpage/BookmarkView.html</file>
+
+	<file alias="dogear.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear.png</file>
+	<file alias="dogear_open_bg.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg.png</file>
+	<file alias="dialog_buttons_cross_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross_pressed.png</file>
+	<file alias="cc0d0d-hatch.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/cc0d0d-hatch.png</file>
+	<file alias="add_bookmark_bg.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/add_bookmark_bg.png</file>
+	<file alias="list_itembg.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg.png</file>
+	<file alias="dogear_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_pressed.png</file>
+	<file alias="dogear_open_bg_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open_bg_pressed.png</file>
+	<file alias="dialog_buttons_cross.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_cross.png</file>
+	<file alias="list_itembg_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/list_itembg_pressed.png</file>
+	<file alias="menu_icon_bookmarks.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/menu_icon_bookmarks.png</file>
+	<file alias="dialog_bottom.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_bottom.png</file>
+	<file alias="delete_btn.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/delete_btn.png</file>
+	<file alias="dogear_open.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dogear_open.png</file>
+	<file alias="dialog_buttons_tick_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick_pressed.png</file>
+	<file alias="dialog_center.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_center.png</file>
+	<file alias="dialog_buttons_tick.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_buttons_tick.png</file>
+	<file alias="dialog_top.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/dialog_top.png</file>
+	<file alias="edit_btn.png">../chrome/bedrockchrome/bookmarkview.superpage/iconsMaemo/edit_btn.png</file>
+</qresource>
+
+<qresource prefix="/download">
+	<file alias="download.css">../chrome/bedrockchrome/download.snippet/download.css</file>
+
+	<file alias="download.js">../chrome/bedrockchrome/download.snippet/download.js</file>
+
+	<file alias="download_dialog_icon.png">../chrome/bedrockchrome/download.snippet/icons/download_dialog_icon.png</file>
+</qresource>
+
+<qresource prefix="/historyview">
+ 	<file alias="clearhistorydialog.css">../chrome/bedrockchrome/historyview.superpage/clearhistorydialog.css</file>
+	<file alias="historyview.css">../chrome/bedrockchrome/historyview.superpage/historyview.css</file>
+
+	<file alias="clearhistorydialog.js">../chrome/bedrockchrome/historyview.superpage/clearhistorydialog.js</file>
+	<file alias="historyview.js">../chrome/bedrockchrome/historyview.superpage/historyview.js</file>
+
+	<file alias="historyView.html">../chrome/bedrockchrome/historyview.superpage/historyView.html</file>
+
+	<file alias="list_headerbg_open.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_open.png</file>
+	<file alias="button_dialog_history_clear_cancel_press.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_press.png</file>
+	<file alias="list_itembg.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_itembg.png</file>
+	<file alias="clear_history_bg.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/clear_history_bg.png</file>
+	<file alias="button_dialog_history_clear_cancel_wait.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_cancel_wait.png</file>
+	<file alias="list_headerarrow_open.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_open.png</file>
+	<file alias="button_dialog_history_clear_ok_wait.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_wait.png</file>
+	<file alias="list_headerarrow_closed.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerarrow_closed.png</file>
+	<file alias="list_headerbg_closed.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/list_headerbg_closed.png</file>
+	<file alias="button_dialog_history_clear_ok_press.png">../chrome/bedrockchrome/historyview.superpage/iconsMaemo/button_dialog_history_clear_ok_press.png</file>
+</qresource>
+
+<qresource prefix="/networkstatus">
+	<file alias="networkstatus.css">../chrome/bedrockchrome/networkstatus.snippet/networkstatus.css</file>
+
+	<file alias="networkstatus.js">../chrome/bedrockchrome/networkstatus.snippet/networkstatus.js</file>
+
+	<file alias="button_dialog_ok_wait.png">../chrome/bedrockchrome/networkstatus.snippet/icons/button_dialog_ok_wait.png</file>
+	<file alias="button_dialog_ok_press.png">../chrome/bedrockchrome/networkstatus.snippet/icons/button_dialog_ok_press.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/networkstatus.snippet/icons/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/outofmemory">
+	<file alias="outofmemorydialog.css">../chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.css</file>
+
+	<file alias="outofmemorydialog.js">../chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.js</file>
+
+	<file alias="button_dialog_out_of_memory_ok_press.png">../chrome/bedrockchrome/outofmemory.snippet/icons/button_dialog_out_of_memory_ok_press.png</file>
+	<file alias="button_dialog_out_of_memory_ok_wait.png">../chrome/bedrockchrome/outofmemory.snippet/icons/button_dialog_out_of_memory_ok_wait.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/outofmemory.snippet/icons/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/prompt">
+	<file alias="prompt.css">../chrome/bedrockchrome/prompt.snippet/prompt.css</file>
+
+	<file alias="prompt.js">../chrome/bedrockchrome/prompt.snippet/prompt.js</file>
+
+	<file alias="button_dialog_ok_wait.png">../chrome/bedrockchrome/prompt.snippet/icons/button_dialog_ok_wait.png</file>
+	<file alias="button_dialog_ok_press.png">../chrome/bedrockchrome/prompt.snippet/icons/button_dialog_ok_press.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/prompt.snippet/icons/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/settingsview">
+        <file alias="settingsview.css">../chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.css</file>
+        <file alias="settingsview.js">../chrome/bedrockchrome/settingsview.superpage/settingsviewmaemo.js</file>
+        <file alias="SettingsView.html">../chrome/bedrockchrome/settingsview.superpage/SettingsViewMaemo.html</file>
+        <file alias="LegalNotice.html">../chrome/bedrockchrome/settingsview.superpage/LegalNoticeMaemo.html</file>
+        <file alias="no_selected.png">../chrome/bedrockchrome/settingsview.superpage/icons/no_selected.png</file>
+        <file alias="no_deselected.png">../chrome/bedrockchrome/settingsview.superpage/icons/no_deselected.png</file>
+        <file alias="broom_sweep.gif">../chrome/bedrockchrome/settingsview.superpage/icons/broom_sweep.gif</file>
+        <file alias="list_headerarrow_open.png">../chrome/bedrockchrome/settingsview.superpage/icons/list_headerarrow_open.png</file>
+        <file alias="list_headerarrow_closed.png">../chrome/bedrockchrome/settingsview.superpage/icons/list_headerarrow_closed.png</file>
+        <file alias="radio_on.png">../chrome/bedrockchrome/settingsview.superpage/iconsMaemo/radio_on.png</file>
+        <file alias="radio_off.png">../chrome/bedrockchrome/settingsview.superpage/iconsMaemo/radio_off.png</file>
+        <file alias="yes_deselected.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_deselected.png</file>
+        <file alias="broom_sweep.png">../chrome/bedrockchrome/settingsview.superpage/icons/broom_sweep.png</file>
+        <file alias="yes_selected.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_selected.png</file>
+        <file alias="delete_btn.png">../chrome/bedrockchrome/settingsview.superpage/icons/delete_btn.png</file>
+        <file alias="delete_btn_pressed.png">../chrome/bedrockchrome/settingsview.superpage/icons/delete_btn_pressed.png</file>
+        <file alias="yes_btn.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_btn.png</file>
+        <file alias="yes_btn_pressed.png">../chrome/bedrockchrome/settingsview.superpage/icons/yes_btn_pressed.png</file>
+        <file alias="list_headerbg_closed.png">../chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_closed.png</file>
+        <file alias="list_headerbg_open.png">../chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_headerbg_open.png</file>
+        <file alias="list_itembg_pressed.png">../chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg_pressed.png</file>
+        <file alias="list_itembg.png">../chrome/bedrockchrome/settingsview.superpage/iconsMaemo/list_itembg.png</file>
+</qresource>
+
+<qresource prefix="/suggests">
+    <file alias="suggests.css">../chrome/bedrockchrome/suggests.snippet/suggests.css</file>
+
+    <file alias="suggests.js">../chrome/bedrockchrome/suggests.snippet/suggests.js</file>
+
+    <file alias="suggests.html">../chrome/bedrockchrome/suggests.snippet/suggests.html</file>
+
+    <file alias="divider.png">../chrome/bedrockchrome/suggests.snippet/icons/divider.png</file>
+    <file alias="topshadow.png">../chrome/bedrockchrome/suggests.snippet/icons/topshadow.png</file>
+    <file alias="bottomshadow.png">../chrome/bedrockchrome/suggests.snippet/icons/bottomshadow.png</file>
+</qresource>
+
+<qresource prefix="/toolbar">
+	<file alias="icon_zoom_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_disabled.png</file>
+
+	<file alias="icon_feedback_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback_pressed.png</file>
+	<file alias="icon_toggle_partialTB.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB.png</file>
+	<file alias="icon_toggle_fullTB.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB.png</file>
+	<file alias="icon_clearall_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_pressed.png</file>
+	<file alias="icon_toggle_fullTB_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_fullTB_pressed.png</file>
+	<file alias="icon_menu.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu.png</file>
+	<file alias="icon_mostvisited_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited_pressed.png</file>
+	<file alias="icon_clearall_disabled.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall_disabled.png</file>
+
+	<file alias="icon_zoom_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_pressed.png</file>
+	<file alias="icon_zoom.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom.png</file>
+
+	<file alias="icon_mostvisited.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_mostvisited.png</file>
+	<file alias="icon_add.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add.png</file>
+	<file alias="icon_clearall.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_clearall.png</file>
+           
+        <file alias="icon_back_bg.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back.png</file>
+	<file alias="icon_back_bg_disabled.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_disabled.png</file>
+	<file alias="icon_back_bg_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_pressed.png</file>
+
+	<file alias="icon_back.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back.png</file>	        
+	<file alias="icon_back_disabled.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_disabled.png</file>
+	<file alias="icon_back_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_back_pressed.png</file>
+
+	<file alias="icon_menu_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_menu_pressed.png</file>
+	<file alias="icon_add_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_pressed.png</file>
+	<file alias="icon_add_disabled.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_add_disabled.png</file>
+	<file alias="icon_feedback.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_feedback.png</file>
+	<file alias="icon_toggle_partialTB_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_toggle_partialTB_pressed.png</file>
+
+    <!-- Toolbar zoom... used in maemo? -->
+    <file alias="icon_zoom_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom_pressed.png</file>
+    <file alias="icon_zoom.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom.png</file>
+    <file alias="icon_zoom+.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+.png</file>
+    <file alias="icon_zoom+_disabled.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_disabled.png</file>
+    <file alias="icon_zoom+_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom+_pressed.png</file>
+    <file alias="icon_zoom-.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-.png</file>
+    <file alias="icon_zoom-_disabled.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_disabled.png</file>
+    <file alias="icon_zoom-_pressed.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/icon_zoom-_pressed.png</file>
+
+    <!-- Special maemo toolbar bits -->
+    <file alias="circle_bg.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/circle_bg.png</file>
+    <file alias="toolBar_bkg_topLeft.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topLeft.png</file>
+    <file alias="toolBar_bkg_topMiddle.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topMiddle.png</file>
+    <file alias="toolBar_bkg_topRight.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_topRight.png</file>
+    <file alias="toolBar_bkg_middleMiddle.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_middleMiddle.png</file>
+    <file alias="toolBar_bkg_bottomLeft.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomLeft.png</file>
+    <file alias="toolBar_bkg_bottomMiddle.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomMiddle.png</file>
+    <file alias="toolBar_bkg_bottomRight.png">../chrome/bedrockchrome/toolbar.snippet/iconsMaemo/toolBar_bkg_bottomRight.png</file>
+
+</qresource>
+
+<qresource prefix="/windowcount">
+    <file alias="windowcount.css">../chrome/bedrockchrome/windowcount.snippet/windowcount.css</file>
+
+    <file alias="windowcount.js">../chrome/bedrockchrome/windowcount.snippet/windowcount.js</file>
+
+    <file alias="emptycircle.png">../chrome/bedrockchrome/windowcount.snippet/icons/emptycircle.png</file>
+    <file alias="filledcircle.png">../chrome/bedrockchrome/windowcount.snippet/icons/filledcircle.png</file>
+</qresource>
+
+<qresource prefix="/urlsearch">
+	<file alias="stop_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/stop_btn.png</file>
+	<file alias="refresh_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/refresh_btn.png</file>
+	<file alias="go_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/go_btn.png</file>
+
+	<file alias="com.svg">../chrome/bedrockchrome/urlsearch.snippet/icons/com.svg</file>
+
+
+
+</qresource>
+
+<qresource prefix="/zoombar">
+    <file alias="zoombar.css">../chrome/bedrockchrome/zoombar.snippet/zoombar.css</file>
+
+    <file alias="zoombar.js">../chrome/bedrockchrome/zoombar.snippet/zoombar.js</file>
+
+    <file alias="zoom_menu_bg.png">../chrome/bedrockchrome/zoombar.snippet/icons/zoom_menu_bg.png</file>
+    <file alias="icon_zoom+.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+.png</file>
+    <file alias="icon_zoom+_disabled.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_disabled.png</file>
+    <file alias="icon_zoom-.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-.png</file>
+    <file alias="icon_zoom-_disabled.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_disabled.png</file>
+    <file alias="icon_zoom+_pressed.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom+_pressed.png</file>
+    <file alias="icon_zoom-_pressed.png">../chrome/bedrockchrome/zoombar.snippet/icons/icon_zoom-_pressed.png</file>
+</qresource>
+
+<qresource prefix="/mostvisited">
+    <file alias="most_visited_bac_left.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_left.png</file>
+    <file alias="most_visited_bac_middle.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_middle.png</file>
+    <file alias="most_visited_bac_right.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_right.png</file>
+</qresource>
+
+</RCC>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/qrc/ginebraTenone.qrc	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,292 @@
+<!DOCTYPE RCC><RCC version="1.0">
+
+<!--
+<qresource prefix="/translations">
+    <file alias="browserloc.qm">../translations/browserloc.qm</file>
+</qresource>
+-->
+
+<qresource prefix="/chrome">
+	<file alias="chrome.css">../chrome/bedrockchrome/chrome.css</file>
+
+	<file alias="chrome.js">../chrome/bedrockchrome/chrome.js</file>
+
+	<file alias="effects.core.js">../chrome/js/3rdparty/jquery-ui/effects.core.js</file>
+	<file alias="ui.core.js">../chrome/js/3rdparty/jquery-ui/ui.core.js</file>
+	<file alias="effects.blind.js">../chrome/js/3rdparty/jquery-ui/effects.blind.js</file>
+	<file alias="ui.sortable.js">../chrome/js/3rdparty/jquery-ui/ui.sortable.js</file>
+	<file alias="jquery-1.4.2.min.js">../chrome/js/3rdparty/jquery-1.4.2.min.js</file>
+
+	<file alias="LongPress.js">../chrome/js/LongPress.js</file>
+	<file alias="Bind.js">../chrome/js/Bind.js</file>
+	<file alias="SimpleButton.js">../chrome/js/SimpleButton.js</file>
+	<file alias="Test.js">../chrome/js/Test.js</file>
+	<file alias="ContextMenu.js">../chrome/js/ContextMenu.js</file>
+
+	<file alias="chrome.html">../chrome/bedrockchrome/chrome_tenone.html</file>
+
+	<file alias="bedrock_splash.png">../chrome/localpages/bedrock_splash.png</file>
+</qresource>
+
+<qresource prefix="/bookmarkview">
+	<file alias="bookmarkview.css">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewTenone.css</file>
+	<file alias="bookmarkDialog.css">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialogTenone.css</file>
+
+	<file alias="bookmarkDialog.js">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkDialog.js</file>
+	<file alias="bookmarkview.js">../chrome/bedrockchrome/bookmarkview.superpage/bookmarkviewTenone.js</file>
+
+	<file alias="BookmarkView.html">../chrome/bedrockchrome/bookmarkview.superpage/BookmarkView.html</file>
+
+	<file alias="dogear.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear.png</file>
+	<file alias="dogear_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_pressed.png</file>
+	<file alias="dogear_open.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open.png</file>
+	<file alias="dogear_open_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open_pressed.png</file>
+	<file alias="dogear_open_bg.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dogear_open_bg.png</file>
+	<file alias="edit_btn.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/edit_btn.png</file>
+	<file alias="delete_btn.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/delete_btn.png</file>
+	<file alias="list_itembg.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/list_itembg.png</file>
+	<file alias="list_itembg_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/list_itembg_pressed.png</file>
+
+	<file alias="menu_icon_bookmarks.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/menu_icon_bookmarks.png</file>
+	<file alias="dialog_buttons_tick.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_tick.png</file>
+	<file alias="dialog_buttons_tick_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_tick_pressed.png</file>
+	<file alias="dialog_buttons_cross.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_cross.png</file>
+	<file alias="dialog_buttons_cross_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/dialog_buttons_cross_pressed.png</file>
+
+	<file alias="yes_selected.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/yes_selected.png</file>    
+	<file alias="yes_deselected.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/iconsTenone/yes_deselected.png</file>
+
+	<file alias="cc0d0d-hatch.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/cc0d0d-hatch.png</file>
+	<file alias="add_bookmark_bg.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/add_bookmark_bg.png</file>
+	<file alias="dogear_open_bg_pressed.png">../chrome/bedrockchrome/bookmarkview.superpage/icons/dogear_open_bg_pressed.png</file>
+</qresource>
+
+<qresource prefix="/geolocation">
+  <file alias="geolocationDialog.css">../chrome/bedrockchrome/geolocation.snippet/geolocationDialog.css</file>
+  <file alias="geolocationDialog.js">../chrome/bedrockchrome/geolocation.snippet/geolocationDialog.js</file>
+  <file alias="dialog_buttons_cross.png">../chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_cross.png</file>
+  <file alias="dialog_buttons_cross_pressed.png">../chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_cross_pressed.png</file>
+  <file alias="dialog_buttons_tick.png">../chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_tick.png</file>
+  <file alias="dialog_buttons_tick_pressed.png">../chrome/bedrockchrome/geolocation.snippet/icons/dialog_buttons_tick_pressed.png</file>
+  <file alias="icon_dialog_error.png">../chrome/bedrockchrome/geolocation.snippet/icons/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/contextmenu">
+	<file alias="ContextMenu.css">../chrome/bedrockchrome/contextmenu.snippet/ContextMenuTenone.css</file>
+
+	<file alias="ViewContextMenu.js">../chrome/bedrockchrome/contextmenu.snippet/ViewContextMenu.js</file>
+	<file alias="ContextMenu.js">../chrome/bedrockchrome/contextmenu.snippet/ContextMenu.js</file>
+
+	<file alias="list_contextmenu.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/list_contextmenu.png</file>
+	<file alias="list_contextmenu_pressed.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/list_contextmenu_pressed.png</file>
+	<file alias="menu_tail.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/menu_tail.png</file>
+	<file alias="nav_selected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/nav_selected.png</file>
+	<file alias="nav_deselected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/nav_deselected.png</file>
+	<file alias="links_selected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/links_selected.png</file>
+	<file alias="links_deselected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/links_deselected.png</file>
+	<file alias="page_selected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/page_selected.png</file>
+	<file alias="page_deselected.png">../chrome/bedrockchrome/contextmenu.snippet/icons/iconsTenone/page_deselected.png</file>
+</qresource>
+
+<qresource prefix="/download">
+	<file alias="download.css">../chrome/bedrockchrome/download.snippet/downloadTenone.css</file>
+
+	<file alias="download.js">../chrome/bedrockchrome/download.snippet/download.js</file>
+
+	<file alias="download_dialog_icon.png">../chrome/bedrockchrome/download.snippet/icons/download_dialog_icon.png</file>
+</qresource>
+
+<qresource prefix="/historyview">
+ 	<file alias="clearhistorydialog.css">../chrome/bedrockchrome/historyview.superpage/clearhistorydialogTenone.css</file>
+	<file alias="historyview.css">../chrome/bedrockchrome/historyview.superpage/historyviewTenone.css</file>
+
+	<file alias="clearhistorydialog.js">../chrome/bedrockchrome/historyview.superpage/clearhistorydialog.js</file>
+	<file alias="historyview.js">../chrome/bedrockchrome/historyview.superpage/historyview.js</file>
+
+	<file alias="historyView.html">../chrome/bedrockchrome/historyview.superpage/historyView.html</file>
+
+	<file alias="list_itembg.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_itembg.png</file>
+	<file alias="list_itembg_pressed.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_itembg_pressed.png</file>
+	<file alias="list_headerbg_open.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerbg_open.png</file>
+	<file alias="list_headerbg_closed.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerbg_closed.png</file>
+	<file alias="list_headerarrow_open.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerarrow_open.png</file>
+	<file alias="list_headerarrow_closed.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/list_headerarrow_closed.png</file>
+	<file alias="button_dialog_history_clear_cancel_wait.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_cancel_wait.png</file>
+	<file alias="button_dialog_history_clear_cancel_press.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_cancel_press.png</file>
+	<file alias="button_dialog_history_clear_ok_wait.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_ok_wait.png</file>
+	<file alias="button_dialog_history_clear_ok_press.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/button_dialog_history_clear_ok_press.png</file>
+	<file alias="clear_history_bg.png">../chrome/bedrockchrome/historyview.superpage/icons/iconsTenone/clear_history_bg.png</file>
+</qresource>
+
+<qresource prefix="/networkstatus">
+	<file alias="networkstatus.css">../chrome/bedrockchrome/networkstatus.snippet/networkstatusTenone.css</file>
+
+	<file alias="networkstatus.js">../chrome/bedrockchrome/networkstatus.snippet/networkstatus.js</file>
+
+	<file alias="button_dialog_ok_wait.png">../chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/button_dialog_ok_wait.png</file>
+	<file alias="button_dialog_ok_press.png">../chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/button_dialog_ok_press.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/networkstatus.snippet/icons/iconsTenone/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/outofmemory">
+	<file alias="outofmemorydialog.css">../chrome/bedrockchrome/outofmemory.snippet/outofmemorydialogTenone.css</file>
+
+	<file alias="outofmemorydialog.js">../chrome/bedrockchrome/outofmemory.snippet/outofmemorydialog.js</file>
+
+	<file alias="button_dialog_out_of_memory_ok_press.png">../chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/button_dialog_out_of_memory_ok_press.png</file>
+	<file alias="button_dialog_out_of_memory_ok_wait.png">../chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/button_dialog_out_of_memory_ok_wait.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/outofmemory.snippet/icons/iconsTenone/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/prompt">
+	<file alias="prompt.css">../chrome/bedrockchrome/prompt.snippet/promptTenone.css</file>
+
+	<file alias="prompt.js">../chrome/bedrockchrome/prompt.snippet/prompt.js</file>
+
+	<file alias="button_dialog_ok_wait.png">../chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/button_dialog_ok_wait.png</file>
+	<file alias="button_dialog_ok_press.png">../chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/button_dialog_ok_press.png</file>
+	<file alias="icon_dialog_error.png">../chrome/bedrockchrome/prompt.snippet/icons/iconsTenone/icon_dialog_error.png</file>
+</qresource>
+
+<qresource prefix="/settingsview">
+	<file alias="settingsview.css">../chrome/bedrockchrome/settingsview.superpage/settingsviewTenone.css</file>
+
+	<file alias="settingsview.js">../chrome/bedrockchrome/settingsview.superpage/settingsviewTenone.js</file>
+
+	<file alias="SettingsView.html">../chrome/bedrockchrome/settingsview.superpage/SettingsViewTenone.html</file>
+	<file alias="LegalNotice.html">../chrome/bedrockchrome/settingsview.superpage/LegalNoticeTenone.html</file>
+
+    <file alias="radio_on.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_on.png</file>
+    <file alias="radio_off.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/radio_off.png</file>
+	<file alias="list_headerbg_open.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerbg_open.png</file>
+	<file alias="list_headerbg_closed.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerbg_closed.png</file>
+	<file alias="list_headerarrow_open.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerarrow_open.png</file>
+	<file alias="list_headerarrow_closed.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_headerarrow_closed.png</file>
+	<file alias="list_itembg.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg.png</file>
+	<file alias="list_itembg_pressed.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_pressed.png</file>
+	<file alias="list_itembg_general_ce.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_general_ce.png</file>
+	<file alias="list_itembg_about.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/list_itembg_about.png</file>
+	<file alias="yes_selected.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/yes_selected.png</file>    
+	<file alias="yes_deselected.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/yes_deselected.png</file>
+	<file alias="broom_sweep.png">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/broom_sweep.png</file>
+	<file alias="broom_sweep.gif">../chrome/bedrockchrome/settingsview.superpage/icons/iconsTenone/broom_sweep.gif</file>
+</qresource>
+
+<qresource prefix="/statusbar">
+    <file alias="statusbar.css">../chrome/bedrockchrome/statusbar.snippet/statusbar.css</file>
+
+    <file alias="statusbar.js">../chrome/bedrockchrome/statusbar.snippet/statusbar.js</file>
+
+    <file alias="download_statusbar_icon.png">../chrome/bedrockchrome/statusbar.snippet/icons/download_statusbar_icon.png</file>
+    <file alias="lock.png">../chrome/bedrockchrome/statusbar.snippet/icons/lock.png</file>
+    <file alias="batt40.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt40.png</file>
+    <file alias="batt100.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt100.png</file>
+    <file alias="batt90.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt90.png</file>
+    <file alias="batt10.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt10.png</file>
+    <file alias="batt80.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt80.png</file>
+    <file alias="batt70.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt70.png</file>
+    <file alias="batt60.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt60.png</file>
+    <file alias="batt30.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt30.png</file>
+    <file alias="batt100_charging.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt100_charging.png</file>
+    <file alias="batt20.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt20.png</file>
+    <file alias="batt50.png">../chrome/bedrockchrome/statusbar.snippet/icons/battery/batt50.png</file>
+    <file alias="signal25.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal25.png</file>
+    <file alias="signal50.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal50.png</file>
+    <file alias="signal0.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal0.png</file>
+    <file alias="signal100.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal100.png</file>
+    <file alias="signal75.png">../chrome/bedrockchrome/statusbar.snippet/icons/signal/signal75.png</file>
+</qresource>
+
+<qresource prefix="/suggests">
+    <file alias="suggests.css">../chrome/bedrockchrome/suggests.snippet/suggestsTenone.css</file>
+
+    <file alias="suggests.js">../chrome/bedrockchrome/suggests.snippet/suggests.js</file>
+
+    <file alias="suggests.html">../chrome/bedrockchrome/suggests.snippet/suggests.html</file>
+
+    <file alias="divider.png">../chrome/bedrockchrome/suggests.snippet/icons/iconsTenone/divider.png</file>
+    <file alias="topshadow.png">../chrome/bedrockchrome/suggests.snippet/icons/topshadow.png</file>
+    <file alias="bottomshadow.png">../chrome/bedrockchrome/suggests.snippet/icons/bottomshadow.png</file>
+</qresource>
+
+<qresource prefix="/toolbar">
+	<file alias="toolBar_bkg_topLeft.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topLeft.png</file>
+	<file alias="toolBar_bkg_topMiddle.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topMiddle.png</file>
+	<file alias="toolBar_bkg_topRight.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_topRight.png</file>
+	<file alias="toolBar_bkg_middleMiddle.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_middleMiddle.png</file>
+	<file alias="toolBar_bkg_bottomLeft.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomLeft.png</file>
+	<file alias="toolBar_bkg_bottomMiddle.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomMiddle.png</file>
+	<file alias="toolBar_bkg_bottomRight.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/toolBar_bkg_bottomRight.png</file>
+	<file alias="icon_add.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add.png</file>
+	<file alias="icon_add_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add_pressed.png</file>
+	<file alias="icon_add_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_add_disabled.png</file>
+	<file alias="icon_clearall.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall.png</file>
+	<file alias="icon_clearall_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall_disabled.png</file>
+	<file alias="icon_clearall_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_clearall_pressed.png</file>
+	<file alias="icon_feedback.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback.png</file>
+	<file alias="icon_feedback_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback_disabled.png</file>
+	<file alias="icon_feedback_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_feedback_pressed.png</file>
+	<file alias="icon_back.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back.png</file>
+	<file alias="icon_back_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_disabled.png</file>
+	<file alias="icon_back_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_pressed.png</file>
+	<file alias="icon_back_bg.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg.png</file>
+	<file alias="icon_back_bg_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg_disabled.png</file>
+	<file alias="icon_back_bg_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_back_bg_pressed.png</file>
+	<file alias="icon_toggle_partialTB.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_partialTB.png</file>
+	<file alias="icon_toggle_partialTB_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_partialTB_pressed.png</file>
+	<file alias="icon_toggle_fullTB.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_fullTB.png</file>
+	<file alias="icon_toggle_fullTB_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/icon_toggle_fullTB_pressed.png</file>
+	<file alias="circle_bg.png">../chrome/bedrockchrome/toolbar.snippet/icons/iconsTenone/circle_bg.png</file>
+
+	<file alias="icon_zoom.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom.png</file>
+	<file alias="icon_zoom_disabled.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_disabled.png</file>
+	<file alias="icon_zoom_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_zoom_pressed.png</file>
+	<file alias="icon_menu.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_menu.png</file>
+	<file alias="icon_menu_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_menu_pressed.png</file>
+	<file alias="icon_mostvisited.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited.png</file>
+	<file alias="icon_mostvisited_pressed.png">../chrome/bedrockchrome/toolbar.snippet/icons/icon_mostvisited_pressed.png</file>
+</qresource>
+
+<qresource prefix="/windowcount">
+    <file alias="windowcount.css">../chrome/bedrockchrome/windowcount.snippet/windowcount.css</file>
+
+    <file alias="windowcount.js">../chrome/bedrockchrome/windowcount.snippet/windowcount.js</file>
+
+    <file alias="emptycircle.png">../chrome/bedrockchrome/windowcount.snippet/icons/emptycircle.png</file>
+    <file alias="filledcircle.png">../chrome/bedrockchrome/windowcount.snippet/icons/filledcircle.png</file>
+</qresource>
+
+<qresource prefix="/urlsearch">
+	<file alias="url_title_ind_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/url_title_ind_btn.png</file>
+	<file alias="url_title_ind_btn_secure.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/url_title_ind_btn_secure.png</file>
+	<file alias="backstep.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep.png</file>
+	<file alias="backstep_no_bg.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep_no_bg.png</file>
+	<file alias="backstep_pressed.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/backstep_pressed.png</file>
+	<file alias="URL_search_divider.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/URL_search_divider.png</file>
+	<file alias="go_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/go_btn.png</file>
+	<file alias="stop_btn.png">../chrome/bedrockchrome/urlsearch.snippet/icons/iconsTenone/stop_btn.png</file>
+
+	<file alias="com.svg">../chrome/bedrockchrome/urlsearch.snippet/icons/com.svg</file>
+</qresource>
+
+<qresource prefix="/zoombar">
+    <file alias="zoombar.css">../chrome/bedrockchrome/zoombar.snippet/zoombar.css</file>
+
+    <file alias="zoombar.js">../chrome/bedrockchrome/zoombar.snippet/zoombar.js</file>
+
+    <file alias="zoom_menu_bg.png">../chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/zoom_menu_bg.png</file>
+    <file alias="icon_zoom+.png">../chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+.png</file>
+    <file alias="icon_zoom+_disabled.png">../chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+_disabled.png</file>
+    <file alias="icon_zoom+_pressed.png">../chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom+_pressed.png</file>
+    <file alias="icon_zoom-.png">../chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-.png</file>
+    <file alias="icon_zoom-_disabled.png">../chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-_disabled.png</file>
+    <file alias="icon_zoom-_pressed.png">../chrome/bedrockchrome/zoombar.snippet/icons/iconsTenone/icon_zoom-_pressed.png</file>
+</qresource>
+
+<qresource prefix="/mostvisited">
+    <file alias="most_visited_bac_left.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_left_tenone.png</file>
+    <file alias="most_visited_bac_middle.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_middle_tenone.png</file>
+    <file alias="most_visited_bac_right.png">../chrome/bedrockchrome/mostvisited.snippet/images/most_visited_bac_right_tenone.png</file>
+</qresource>
+
+</RCC>
Binary file ginebra2/translations/Browser.xls has changed
Binary file ginebra2/translations/Browser_textids_metrics_tenone.xls has changed
Binary file ginebra2/translations/browserloc.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ginebra2/translations/browserloc.ts	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,826 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="3.0" sourcelanguage="en_GB">
+<context>
+<message numerus="no" id="txt_browser_tag_error_tag_file_could_not_be_downloaded">
+    <comment>Info note for when there is a download error and item is not downloaded, %1 is the name of the item</comment>        
+    <source>Error: %1 could not be downloaded</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_downloading_file</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Downloads_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_browser">
+    <comment>Title of Content View.  Not used, this is a placeholder in case we need this string at some point.</comment>        
+    <source>Browser</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_new_window</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Title_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_windows_windows">
+    <comment>Title of Windows View</comment>        
+    <source>Windows</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_new_window</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Windows_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data_location">
+    <comment>In the Browser Settings, for clearing location permissions</comment>        
+    <source>Location Permissions</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data_cache</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_history_this_month">
+    <comment>Subheading Label in History List</comment>        
+    <source>This Month</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_history_today</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_History_001</extra-loc-viewid>
+    <extra-loc-positionid>subhead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_bookmarks_cancel">
+    <comment>Button text when adding/editing a bookmark</comment>        
+    <source>Cancel</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_bookmarks_done</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Bookmarks_001</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_page_title_web_page_failed">
+    <comment>Layout ID parent.  Error message shown for IDN homograph attack message.  This error message will be shown in a dialog and this is the dialog title.</comment>        
+    <source>Web page failed to load.</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_title_web_page_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Memory_Low_Dialog_001b</extra-loc-viewid>
+    <extra-loc-positionid>dpophead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_page_load_failed">
+    <comment>Layout ID parent. Error info notification message</comment>        
+    <source>Unable to load page</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_load_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Error_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_page_allow_popups">
+    <comment>Layout ID parent. Content View Context Menu Page tab Allow Pop-ups menu item</comment>        
+    <source>Allow Pop-ups</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_page_allow_popups</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001b</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_page_share_page">
+    <comment>Content View Context Menu Page tab Share Page menu item</comment>        
+    <source>Share Page</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_page_allow_popups</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001b</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings">
+    <comment>Subheader in Settings View for General Settings</comment>        
+    <source>General Settings</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>subhead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_windows_new_window">
+    <comment>Layout ID parent. Title displayed above a new, blank window in the Windows view.</comment>        
+    <source>New Window</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_windows_new_window</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Windows_001 </extra-loc-viewid>
+    <extra-loc-positionid>subhead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_nav_exit">
+    <comment>Content View Context Menu Navigation tab Exit menu item</comment>        
+    <source>Exit Browser</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_nav_bookmarks</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001a</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_short_caption_browser">
+    <comment>Caption for Application Library - grid view</comment>        
+    <source>Browser</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>qtl_grid_applications_sec</extra-loc-layout_id>    
+    <extra-loc-viewid>browser</extra-loc-viewid>
+    <extra-loc-positionid>grid</extra-loc-positionid>
+    <extra-loc-feature>br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_chrome_suggests_search_for">
+    <comment>Displayed in the URL bar search suggestions drop-down menu, %1 is the search string</comment>        
+    <source>Search for %1</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_chrome_suggests_search_for</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_URLbar_001</extra-loc-viewid>
+    <extra-loc-positionid>opt</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_nav_settings">
+    <comment>Content View Context Menu Navigation tab Settings menu item</comment>        
+    <source>Settings</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_nav_bookmarks</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001a</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_tab_link">
+    <comment>Content View Context Menu Link tab</comment>        
+    <source>Link</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_tab_navigation</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001c</extra-loc-viewid>
+    <extra-loc-positionid>tab</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_nav_bookmarks">
+    <comment>Layout ID parent. Content View Context Menu Navigation tab Bookmarks menu item</comment>        
+    <source>Bookmarks</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_nav_bookmarks</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001a</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_tab_link_image">
+    <comment>Content View Context Menu Link/Image tab - this tab is for images that are also links.  So under it are: &quot;open link in new window&quot;, &quot;share link&quot;, &quot;save image&quot;</comment>        
+    <source>Link/Image</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_tab_navigation</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001</extra-loc-viewid>
+    <extra-loc-positionid>tab</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data">
+    <comment>Layout ID parent. Subheader in Settings View for Clear Data</comment>        
+    <source>Clear Data</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>subhead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data_cache">
+    <comment>Layout ID parent. In the Browser Settings, for clearing cache</comment>        
+    <source>Cache</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data_cache</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_copy_link">
+    <comment>Menu option for copying a link, shown in contextual menu when user long-presses on content in content view.  Not implemented yet, so this is a placeholder.</comment>        
+    <source>Copy link</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_cut</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001e</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_dialog_link_not_associated">
+    <comment>Error message shown when the user clicks on an unsupported scheme link. </comment>        
+    <source>This link is not associated with any application on your phone.</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_load_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Error_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_bookmarks_bookmarks">
+    <comment>Page title in Bookmarks View</comment>        
+    <source>Bookmarks</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_new_window</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Bookmarks_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_new_window">
+    <comment>Layout ID parent.  Title of New Window in Content View</comment>        
+    <source>New Window</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_new_window</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Title_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_history_history">
+    <comment>Title of History View</comment>        
+    <source>History</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_windows_new_window</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_History_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_settings">
+    <comment>Title of Settings View</comment>        
+    <source>Settings</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_new_window</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_history_today">
+    <comment>Layout ID parent. Subheading Label in History List</comment>        
+    <source>Today</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_history_today</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_History_001</extra-loc-viewid>
+    <extra-loc-positionid>subhead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_dialog_application_not_responding">
+    <comment>Error message shown when there is an issue launching an application from the browser.</comment>        
+    <source>The application associated with this link is not responding.</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_load_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Error_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_most_visited_title_most_visited">
+    <comment>Layout ID parent. For the title of the Most Visited pages grid</comment>        
+    <source>Most Visited</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_most_visited_title_most_visited</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Most_Visited_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_no">
+    <comment>In the Browser Settings, for setting an option to No</comment>        
+    <source>No</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_yes</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>setlabel_1_2_val</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_page_add_bookmark">
+    <comment>Content View Context Menu Page tab Add Bookmark menu item</comment>        
+    <source>Add Bookmark</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_page_allow_popups</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001b</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_downloading_file">
+    <comment>Layout ID parent. Info note for when a new item starts downloading, %1 is the name of the item that is downloading</comment>        
+    <source>Downloading %1</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_downloading_file</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Downloads_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_page_block_popups">
+    <comment>Content View Context Menu Page tab Block Pop-ups menu item</comment>        
+    <source>Block Popups</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_page_allow_popups</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001b</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_tab_page">
+    <comment>Content View Context Menu label for Page tab</comment>        
+    <source>Page</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_tab_navigation</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001b</extra-loc-viewid>
+    <extra-loc-positionid>tab</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data_form_data">
+    <comment>In the Browser Settings, for clearing form data</comment>        
+    <source>Form Data</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data_cache</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_dialog_close_some">
+    <comment>Error dialog shown when device is running out of memory.</comment>        
+    <source>Close some browser windows or applications.</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_dialog_device_low</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Memory_Low_Dialog_001a</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_nav_history">
+    <comment>Content View Context Menu Navigation tab History menu item</comment>        
+    <source>History</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_nav_bookmarks</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001a</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_image_save_image">
+    <comment>Layout ID parent. Content View Context Menu Image tab Save Image menu item</comment>        
+    <source>Save Image</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_image_save_image</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001d</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_network_switch_connection">
+    <comment>Prompt shown when a new network is available to use as the browser&apos;s network connection, %1 is the network name</comment>        
+    <source>%1 is now in range.  Switch connection?</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_network_switch_connection</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Network_001</extra-loc-viewid>
+    <extra-loc-positionid>info</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_tab_navigation">
+    <comment>Layout ID parent. Content View Context Menu label for Navigation tab</comment>        
+    <source>Navigation</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_tab_navigation</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001a</extra-loc-viewid>
+    <extra-loc-positionid>tab</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_link_open_link">
+    <comment>Layout ID parent. Content View Context Menu Link tab Open Link in New Window menu item</comment>        
+    <source>Open Link in New Window</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_link_open_link</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001c</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data_cookies">
+    <comment>In the Browser Settings, for clearing cookies</comment>        
+    <source>Cookies</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data_cache</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_nav_windows">
+    <comment>Content View Context Menu Navigation tab Windows menu item</comment>        
+    <source>Windows</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_nav_bookmarks</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001a</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data_all">
+    <comment>In the Browser Settings, for clearing all at once</comment>        
+    <source>Clear All</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data_cache</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_image_share_image">
+    <comment>Content View Context Menu Image tab Share Image menu item</comment>        
+    <source>Share Image</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_image_save_image</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001d</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_location_dialog_location_permissions">
+    <comment>Layout ID parent.  Title of Location Permissions dialog</comment>        
+    <source>Location Permissions</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_location_dialog_location_permissions</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Location_Permissions_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>dpophead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_database_quota">
+    <comment>With HTML 5, site developers have the ability to store small databases on client devices/computers.  This text is shown as an error to the user when the site requests more space than has been allocated for this purpose.  It is used in a dialog box for which there is ONLY an OK checkmark and this one case is the only case for which this dialog is currently used.</comment>        
+    <source>Database memory quota for this website has been exceeded</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_load_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Error_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_select_text">
+    <comment>Menu option for selecting text, shown in contextual menu when user long-presses on content in content view.   Not implemented yet, so this is a placeholder.</comment>        
+    <source>Select text</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_cut</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001e</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_save_browser_history">
+    <comment>Layout ID parent. In the Browser Settings, for saving history</comment>        
+    <source>Save Browser History</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_save_browser_history</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>setlabel_1</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_long_caption_browser">
+    <comment>Caption for Application Library - list view</comment>        
+    <source>Nokia Browser</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>qtl_list_pri_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>browser</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_generic_error_msg">
+    <comment>Generic error message in dialog when the network does not send an error.</comment>        
+    <source>Network error</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_load_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Error_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_cut">
+    <comment>Layout ID parent.  Menu option for cutting text shown in contextual menu when user long-presses on content in content view.</comment>        
+    <source>Cut</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_cut</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001e</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_network_switch_connection_yes">
+    <comment>Layout ID parent. In the Browser Network switch connection dialog</comment>        
+    <source>Yes</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_network_switch_connection_yes</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Network_001</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_link_share_link">
+    <comment>Content View Context Menu Link tab Share Link menu item</comment>        
+    <source>Share Link</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_link_open_link</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001c</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_tab_image">
+    <comment>Content View Context Menu Image tab</comment>        
+    <source>Image</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_tab_navigation</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001d</extra-loc-viewid>
+    <extra-loc-positionid>tab</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_offline">
+    <comment>Status of browser connection, shown next to Page Title in Browser status bar in Content View</comment>        
+    <source>Offline</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_offline</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Title_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_file_has_finished_downloading">
+    <comment>Info note for when an item has finished downloading, %1 is the name of the item that has been downloaded</comment>        
+    <source>%1 has finished downloading</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_downloading_file</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Downloads_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_yes">
+    <comment>Layout ID parent. In the Browser Settings, for setting an option to Yes</comment>        
+    <source>Yes</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_yes</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>setlabel_1_2_val</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_character_encoding">
+    <comment>In the Browser Settings, for character encoding</comment>        
+    <source>Character Encoding</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_save_browser_history</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>formlabel_1</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_bookmarks_done">
+    <comment>Layout ID parent. Button text when adding/editing a bookmark</comment>        
+    <source>Done</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_bookmarks_done</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Bookmarks_001</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_network_switch_connection_no">
+    <comment>In the Browser Network switch connection dialog</comment>        
+    <source>No</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_network_switch_connection_yes</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Network_001</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_save_forms_passwords">
+    <comment>In the Browser Settings, for saving forms and passwords</comment>        
+    <source>Save Forms/Passwords</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_save_browser_history</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>setlabel_2</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_paste">
+    <comment>Menu option for pasting text, shown in contextual menu when user long-presses on content in content view.</comment>        
+    <source>Paste</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_cut</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001e</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_history_delete_are_you_sure">
+    <comment>Dialog displayed in the History View when a user clears their History</comment>        
+    <source>Are you sure you want to permanently delete your history?</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_history_delete_are_you_sure</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_History_001</extra-loc-viewid>
+    <extra-loc-positionid>info</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_location_dialog_save_setting">
+    <comment>Text for checkbox option for saving the setting for location permissions for a particular website</comment>        
+    <source>Save this setting</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_location_dialog_location_permissions</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Location_Permissions_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>formlabel_1_val</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_content_view_menu_copy">
+    <comment>Menu option for copying text, shown in contextual menu when user long-presses on content in content view.</comment>        
+    <source>Copy</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_content_view_menu_cut</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Content_Context_Menu_001e</extra-loc-viewid>
+    <extra-loc-positionid>menu</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data_history">
+    <comment>In the Browser Settings, for clearing history</comment>        
+    <source>History</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data_cache</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_location_dialog_allow">
+    <comment>Text in Location Permissions dialog</comment>        
+    <source>Allow %1 to use your location?</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_location_dialog_location_permissions</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Location_Permissions_Dialog_001</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_dialog_device_low">
+    <comment>Layout ID parent.  Error dialog shown when device is running out of memory.</comment>        
+    <source>Device Low On Memory</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_dialog_device_low</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Memory_Low_Dialog_001a</extra-loc-viewid>
+    <extra-loc-positionid>dpophead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_about">
+    <comment>In the Browser Settings, for info about the browser (version info etc)</comment>        
+    <source>About Browser</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_save_browser_history</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_clear_data_bookmarks">
+    <comment>In the Browser Settings, for clearing bookmarks</comment>        
+    <source>Bookmarks</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_clear_data_cache</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001a</extra-loc-viewid>
+    <extra-loc-positionid>list</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_history_yesterday">
+    <comment>Subheading Label in History List</comment>        
+    <source>Yesterday</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_history_today</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_History_001</extra-loc-viewid>
+    <extra-loc-positionid>subhead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_character_encoding_automatic">
+    <comment>Layout ID parent. In the Browser Settings, drop-down menu item for character encoding.  Automatic is the default item.</comment>        
+    <source>Automatic</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_character_encoding_automatic</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>formlabel_1_val</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_input_dial_add_bm">
+    <comment>Title for bookmarks dialog for adding a bm</comment>        
+    <source>Add Bookmark</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_bookmarks_done</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Bookmarks_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_page_content_if_you_wish">
+    <comment>Error message shown for IDN homograph attack message.  This error message will be shown in a dialog and this is the second line of dialog text.</comment>        
+    <source>Continue to this website anyway?</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_title_web_page_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Memory_Low_Dialog_001b</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_history_this_week">
+    <comment>Subheading Label in History List</comment>        
+    <source>This Week</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_history_today</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_History_001</extra-loc-viewid>
+    <extra-loc-positionid>subhead</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_tsw_caption_browser">
+    <comment>Caption for Task Switcher</comment>        
+    <source>Browser</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_tsw_caption_browser</extra-loc-layout_id>    
+    <extra-loc-viewid>tsw_01</extra-loc-viewid>
+    <extra-loc-positionid>caption</extra-loc-positionid>
+    <extra-loc-feature>ts</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_input_dial_edit_bm">
+    <comment>Title for bookmarks dialog for editing a bm</comment>        
+    <source>Edit Bookmark</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_bookmarks_done</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Bookmarks_001</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_error_page_content_browser_suspects">
+    <comment>Error message shown for IDN homograph attack message.  This error message will be shown in a dialog and this is the first line of dialog text.  %1 is a placeholder for the website that is suspected of being unsafe.</comment>        
+    <source>Browser suspects that this website may be unsafe: %1.</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_error_page_title_web_page_failed</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Memory_Low_Dialog_001b</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_bookmarks_also_add_to_home_screen">
+    <comment>Text for checkbox option for adding a bookmark to the home screen in Add Bookmarks dialog </comment>        
+    <source>Also add to home screen</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_bookmarks_done</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Bookmarks_001</extra-loc-viewid>
+    <extra-loc-positionid>formlabel_1_val</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_browser_settings_general_settings_character_encoding_unicode">
+    <comment>In the Browser Settings, drop-down menu item for character encoding</comment>        
+    <source>Unicode</source>
+    <translation variants="no" type="unfinished"></translation>
+    <extra-loc-layout_id>txt_browser_settings_general_settings_character_encoding_automatic</extra-loc-layout_id>    
+    <extra-loc-viewid>Browser_Settings_001b</extra-loc-viewid>
+    <extra-loc-positionid>formlabel_1_val</extra-loc-positionid>
+    <extra-loc-feature>Br</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+</context>
+</TS>
--- a/homescreen/widgetplugins/hsbookmarkwidgetplugin/hsbookmarkwidgetplugin.pro	Thu Sep 23 15:32:11 2010 -0400
+++ b/homescreen/widgetplugins/hsbookmarkwidgetplugin/hsbookmarkwidgetplugin.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -36,18 +36,6 @@
     TARGET.EPOCALLOWDLLDATA=1
     TARGET.CAPABILITY = ALL -TCB
     
-    plugins.path = $${DESTDIR}
-    plugins.sources = $${TARGET}.dll 
-    
-    widgetResources.path = $${DESTDIR}
-    widgetResources.sources += resource/$${TARGET}.xml    
-    widgetResources.sources += resource/$${TARGET}.manifest
-    widgetResources.sources += resource/nokiabrowser-bm-icon_70x70_ico.png
-    widgetResources.sources += resource/nokiabrowser-bm-icon_70x70_no_ico.png
-    widgetResources.sources += resource/nokiabrowser-bm-icon_50x50.png
-        
-    DEPLOYMENT += plugins \
-                  widgetResources
 }
 
 win32: {
--- a/homescreen/widgetplugins/hsbookmarkwidgetplugin/inc/hsbookmarkwidget.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/homescreen/widgetplugins/hsbookmarkwidgetplugin/inc/hsbookmarkwidget.h	Fri Oct 15 17:30:59 2010 -0400
@@ -23,7 +23,7 @@
 class HbFrameItem;    
 class HbIconItem;
 class HbTextItem;
-class HbTouchArea;
+class QGestureEvent;
 
 class HsBookmarkWidget : public HbWidget
 {
@@ -65,9 +65,10 @@
     QString faviconFileName() const;
     void setFaviconPath(const QString &faviconPath);
     QString faviconPath() const;
-    
-    bool eventFilter(QObject *watched, QEvent *event);
 
+protected:
+    void gestureEvent(QGestureEvent *event);
+	  
 public slots:
 
     void onInitialize();
@@ -75,11 +76,9 @@
     void onHide();
 
 private:
-    
-    void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
-    void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
-    void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-            
+
+    void launch();
+
     void createPrimitives();
 
     void setBackgroundToNormal();
@@ -98,7 +97,6 @@
     HbFrameItem *mBackground;
     HbIconItem *mIcon;
     HbTextItem *mText;
-    HbTouchArea *mTouchArea;
     
     QString mRootPath;
     QString mBookmarkTitle;
--- a/homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/hsbookmarkwidget.css	Thu Sep 23 15:32:11 2010 -0400
+++ b/homescreen/widgetplugins/hsbookmarkwidgetplugin/resource/hsbookmarkwidget.css	Fri Oct 15 17:30:59 2010 -0400
@@ -54,7 +54,3 @@
     color: var(qtc_hs_list_item_title_normal);
     zvalue: 2;
 }
-
-HsBookmarkWidget::toucharea {  
-    zvalue: 3;
-}
--- a/homescreen/widgetplugins/hsbookmarkwidgetplugin/src/hsbookmarkwidget.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/homescreen/widgetplugins/hsbookmarkwidgetplugin/src/hsbookmarkwidget.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -22,7 +22,7 @@
 #include <HbFrameDrawer>
 #include <HbIconItem>
 #include <HbTextItem>
-#include <HbTouchArea>
+#include <HbTapGesture>
 #include <HbInstantFeedback>
 
 #include <QDir>
@@ -45,8 +45,10 @@
 */
 HsBookmarkWidget::HsBookmarkWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
     : HbWidget(parent, flags),
-    	mBackground(0), mIcon(0), mText(0), mTouchArea(0)
+    	mBackground(0), mIcon(0), mText(0)
 {
+    grabGesture(Qt::TapGesture);
+
     HbStyleLoader::registerFilePath(":/hsbookmarkwidget.widgetml");
     HbStyleLoader::registerFilePath(":/hsbookmarkwidget.css");
     	
@@ -145,30 +147,29 @@
 }
 
 /*!
-    Filters touch area events.
+    Process gesture events.
 */
-bool HsBookmarkWidget::eventFilter(QObject *watched, QEvent *event)
+void HsBookmarkWidget::gestureEvent(QGestureEvent *event)
 {
-    Q_UNUSED(watched)
-
-    switch (event->type()) {
-        case QEvent::GraphicsSceneMousePress:
-            handleMousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
-            return true;
-        case QEvent::GraphicsSceneMouseMove:
-            handleMouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
-            return true;
-        case QEvent::GraphicsSceneMouseRelease:
-            handleMouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
-            return true;
-        case QEvent::UngrabMouse:
-            setBackgroundToNormal();
-            return true;
-        default:
-            break;
+    HbTapGesture *gesture = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture));
+    if (gesture) {
+        switch (gesture->state()) {
+            case Qt::GestureStarted:
+                setBackgroundToPressed();
+                break;            
+            case Qt::GestureCanceled:
+                setBackgroundToNormal();
+                break;
+            case Qt::GestureFinished:
+                setBackgroundToNormal();
+                if (gesture->tapStyleHint() == HbTapGesture::Tap) {
+                    launch();
+                }
+                break;
+            default:
+                break;
+        }
     }
-
-    return false;
 }
 
 void HsBookmarkWidget::onInitialize()
@@ -214,38 +215,13 @@
 {
 }
 
-/*!
-    \internal
-*/
-void HsBookmarkWidget::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
-{
-    Q_UNUSED(event)
-    setBackgroundToPressed();
-}
+
 
 /*!
     \internal
 */
-void HsBookmarkWidget::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void HsBookmarkWidget::launch()
 {
-    if (contains(event->pos())) {
-        setBackgroundToPressed();
-    } else {
-        setBackgroundToNormal();
-    }
-}
-
-/*!
-    \internal
-*/
-void HsBookmarkWidget::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
-    setBackgroundToNormal();
-
-    if (!contains(event->pos())) {
-        return;
-    }
-
     //HbInstantFeedback::play(HSCONFIGURATION_GET(bookmarkWidgetTapFeedbackEffect));
     
     QUrl url = QUrl(mBookmarkUrl);
@@ -278,13 +254,6 @@
         mText = new HbTextItem(this);
         HbStyle::setItemName(mText, QLatin1String("text"));
     }
-               
-    // Touch AreaOK
-    if (!mTouchArea) {
-        mTouchArea = new HbTouchArea(this);
-        mTouchArea->installEventFilter(this);
-        HbStyle::setItemName(mTouchArea, QLatin1String("toucharea"));
-    }
 }
 
 /*!
--- a/qstmgesturelib/qstmcallbacktimer.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmcallbacktimer.h	Fri Oct 15 17:30:59 2010 -0400
@@ -25,6 +25,7 @@
 
 
 #include <QTimer>
+#include "uitimer.h"
 
 namespace qstmUiEventEngine
 {
@@ -33,9 +34,9 @@
  * the timer is associated with (maybe some other solution could do this, but...)
  */
 class QStm_StateMachine ;
-typedef void (QStm_StateMachine::*CallbackFunction)(int );
+typedef void (*CallbackFunction)(QStm_StateMachine* obj, int);
 
-#define INVOKE_CALLBACK(obj, funcptr) ((obj)->*(funcptr))
+#define INVOKE_CALLBACK(obj, funcptr, param) (funcptr(obj, param))
 /**
  * CCallbackTimer to implement the timers.  This needs to be replaced
  * with something else if cross platform is needed.
@@ -51,9 +52,10 @@
                        m_delay(delay), m_isEnabled(isEnabled), m_pointerNumber(pointerNumber)
     {
         m_isTriggered = false;
-        m_timer = new QTimer(this);
+        m_timer = UiTimer::New();
+        m_timer->setPriority(300);
         m_timer->setSingleShot(true);
-        connect(m_timer, SIGNAL(timeout()), this, SLOT(callback())); 
+        //connect(m_timer, SIGNAL(timeout()), this, SLOT(callback())); 
     }
     
     /*
@@ -103,11 +105,11 @@
             m_timer->setSingleShot(true);
             if (newDelay != 0)
             {
-            	m_timer->start(newDelay);
+            	m_timer->start(newDelay, this);
             }
             else
             {
-            	m_timer->start(m_delay);
+            	m_timer->start(m_delay, this);
             }
         }
     }
@@ -124,11 +126,11 @@
     void stop() { m_timer->stop(); }
 
 public slots: 
-    void callback() 
+    void uiTimerCallback() 
     { 
     	
     	m_isTriggered = true;
-    	INVOKE_CALLBACK(m_helper, m_callbackFunction)(m_pointerNumber);
+    	INVOKE_CALLBACK(m_helper, m_callbackFunction, m_pointerNumber);
     	//CallbackFunction f = m_callbackFunction;
     	//(m_helper->*f)(m_pointerNumber); 
     	m_isTriggered = false;
@@ -136,7 +138,7 @@
     }
     
 private:
-    QTimer*         m_timer;
+    UiTimer*         m_timer;
     /// helper object that will be called back when timer is triggered
     QStm_StateMachine* m_helper;
     /// Function in the iHelper object call
--- a/qstmgesturelib/qstmfilelogger/qstmfilelogger.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmfilelogger/qstmfilelogger.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -23,28 +23,62 @@
 #include <QDateTime>
 #include "qstmfilelogger.h"
 
+#define BUF_SIZE  512*1004
 QStm_FileLogger* QStm_FileLogger::m_instance = 0;
 
-QStm_FileLogger::QStm_FileLogger()
+QStm_FileLogger::QStm_FileLogger() : QObject(), m_file(0), m_stream(0), m_enabled(0)
 {
+#ifdef GESTURES_LOGTOFILE
 	QString fname = getLogFileName();
 	m_file = new QFile(fname);
 	m_file->open(QIODevice::ReadWrite | QIODevice::Text);
 	m_stream = new QTextStream(m_file);
+#else
+	m_buffer = new QString();
+	m_buffer->reserve(BUF_SIZE);
+	m_debug = new QDebug(m_buffer);
+	m_noDebug = new QNoDebug();
+	connect(&m_flushTimer, SIGNAL(timeout()), this, SLOT(doFlush()));
+	m_flushTimer.start(5000);
+#endif
 }
 
 
 QStm_FileLogger::~QStm_FileLogger()
 {
+#ifdef GESTURES_LOGTOFILE
 	delete m_stream;
 	m_file->close();
 	delete m_file;
+#else
+	m_flushTimer.stop();
+	delete m_buffer;
+	delete m_debug;
+#endif
+}
+
+
+void QStm_FileLogger::enable(bool on) 
+{ 
+    m_enabled = on;
+    if (m_enabled) {
+        if (!m_buffer) {
+            m_buffer = new QString();
+            m_buffer->reserve(BUF_SIZE);   
+        }
+        m_flushTimer.start(5000);
+    }
+    else {
+        delete m_buffer;
+        m_buffer = NULL;
+        m_flushTimer.stop();
+    }
 }
 
 QString QStm_FileLogger::getLogFileName()
 {
 #ifdef Q_OS_SYMBIAN	
-    QString path = "E:/Others/Logs";
+    QString path = "c:/data/Others";
     QDir logdir(path);
     logdir.mkpath(path);
 #else 
@@ -63,32 +97,71 @@
 
 void QStm_FileLogger::log(const char* fmt,...)
 {
+    if (logger()->isEnabled()) {
 	va_list list;
 	QString logStr;
 	va_start(list, fmt);
 	logStr.vsprintf(fmt, list);
 	logger()->doLog(logStr);
 	va_end(list);
+    }
 }
 
 
 void QStm_FileLogger::log(const QString& text)
 {
+    if (logger()->isEnabled()) {
 	logger()->doLog(text);
+    }
 }
 
 void QStm_FileLogger::doLog(const QString& text) 
-{ 
-	*m_stream << QDateTime::currentDateTime().toString("dd-MM-yy hh:mm:ss.zzz") << " " << 
+{
+    if (m_enabled) {
+#ifdef GESTURES_LOGTOFILE
+	    *m_stream << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << " " << 
 			text << "\n"; 
+#else
+        if (m_buffer->size() >= BUF_SIZE) {
+	    //doFlush();
+	    }
+        *m_debug << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << " " << 
+                text << "\n"; 
+#endif
+    }
 }
 
 void QStm_FileLogger::doLog(const char* text) 
 { 
-	*m_stream << QDateTime::currentDateTime().toString("dd-MM-yy hh:mm:ss.zzz") << " " << 
+    if (m_enabled) {
+#ifdef GESTURES_LOGTOFILE
+	    *m_stream << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << " " << 
 			text << "\n"; 
+#else
+	    if (m_buffer->size() >= BUF_SIZE) {
+	        //doFlush();
+	    }
+        *m_debug << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << " " << 
+                text << "\n"; 
+#endif
+    }
 }
- 
+
+
+void QStm_FileLogger::doFlush() 
+{ 
+    if (m_enabled) {
+#ifdef GESTURES_LOGTOFILE
+        if (m_stream) m_stream->flush();
+#else
+        if (!m_buffer->isEmpty()) {
+            qDebug() << *m_buffer;
+            m_buffer->clear();
+        }
+#endif
+    }
+}
+
 QStm_FileLogger* QStm_FileLogger::logger()
 {
 	if (!m_instance) {
@@ -96,3 +169,11 @@
 	}
 	return m_instance;
 }
+
+QDebug QStm_FileLogger::debug() 
+{ 
+    if (logger()->isEnabled()) {
+        *logger()->m_debug << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << " "; 
+    }
+    return *logger()->m_debug;
+}
--- a/qstmgesturelib/qstmfilelogger/qstmfilelogger.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmfilelogger/qstmfilelogger.h	Fri Oct 15 17:30:59 2010 -0400
@@ -27,10 +27,12 @@
 #include <QDebug>
 #include <QString>
 #include <QStringBuilder>
+#include <QDateTime>
+#include <QTimer>
 
 #define LOGFLUSH            QStm_FileLogger::flush()
 #define LOGCLOSE            QStm_FileLogger::close()
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && defined(_MSC_VER)
 #define LOGARG()
 #else
 #define LOGARG(txt,parm...) {QStm_FileLogger::log(txt, parm);}
@@ -41,9 +43,14 @@
 #define LOGENTER            LOGARG("%s start", __PRETTY_FUNCTION__)
 #define LOGEXIT             LOGARG("%s end", __PRETTY_FUNCTION__)
 #define LOGMEM(ptr)         LOGARG("%s [0x%x]", #ptr, (uint)ptr)
+#define qstmDebug()         QStm_FileLogger::logger()->isEnabled() ? QStm_FileLogger::debug() : QStm_FileLogger::noDebug()
+#define qstmIODevice()      QStm_FileLogger::ioDevice()
+#define qstmEnableDebug(on) QStm_FileLogger::logger()->enable(on);
 
-class QSTMGESTURELIB_EXPORT QStm_FileLogger
+
+class QSTMGESTURELIB_EXPORT QStm_FileLogger : public QObject
 {
+    Q_OBJECT
 public:
 	static void log(const QString& text);
 	static void log(const char* fmt,...);
@@ -51,19 +58,29 @@
 	static void flush() { logger()->doFlush(); }
 	static QStm_FileLogger* logger();
 	static QIODevice* ioDevice() { return logger()->m_file; }
+	static QDebug debug();
+	static QNoDebug noDebug() { return *logger()->m_noDebug; }
+	void enable(bool on);
+	bool isEnabled() { return m_enabled; }
 private:
     QStm_FileLogger();
     ~QStm_FileLogger();
     void doLog(const QString& text);
     void doLog(const char* text);
-    void doClose() { m_file->close(); }
-    void doFlush() { m_stream->flush(); }   
+    void doClose() { if (m_file) m_file->close(); }
+    
     QString getLogFileName();
-
+public slots:
+    void doFlush();   
 private:
     QFile*                     m_file;    
     QTextStream*               m_stream;
     static QStm_FileLogger*    m_instance;
+    bool                       m_enabled;
+    QDebug*                    m_debug;
+    QNoDebug*                  m_noDebug;
+    QString*                   m_buffer;
+    QTimer                     m_flushTimer;
 };
 
 
--- a/qstmgesturelib/qstmgenericsimplegesture.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgenericsimplegesture.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -28,8 +28,9 @@
 
 
 QStm_GenericSimpleGesture::QStm_GenericSimpleGesture(
-    QStm_GestureUid uid, const QPoint& loc, int type, const QStm_UiEventSpeedIf* speedIf) :
-    m_location(loc), m_uid(uid), m_type(type), m_details(0), m_speed(speedIf), m_target(0)
+    QStm_GestureUid uid, const QPoint& loc, QTime timestamp, int type, const QStm_UiEventSpeedIf* speedIf) :
+    m_location(loc), m_uid(uid), m_type(type), m_details(0), m_speed(speedIf), m_target(0),
+    m_timestamp(timestamp)
 {
 }
 
@@ -38,6 +39,11 @@
     return m_location ;
 }
 
+QPoint QStm_GenericSimpleGesture::getLocation2()  const
+{
+    return m_location2 ;
+}
+
 int QStm_GenericSimpleGesture::getType()  const
 {
     return m_type ;
@@ -59,9 +65,9 @@
 }
 
 QStm_DirectionalGesture::QStm_DirectionalGesture(
-    QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc,
+    QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc, QTime timestamp,
     const QStm_UiEventSpeedIf* speedIf, bool logging) :
-    QStm_GenericSimpleGesture(uid, loc, 0, speedIf), m_loggingEnabled(logging)
+    QStm_GenericSimpleGesture(uid, loc, timestamp, 0, speedIf), m_loggingEnabled(logging)
 {
     setVector(loc, prevLoc);
 }
@@ -69,21 +75,21 @@
 void QStm_DirectionalGesture::setVector(const QPoint& last, const QPoint& previous)
 {
     m_vector = QPoint(last.x()-previous.x(), previous.y()-last.y()) ;  // x > 0 => east, y > 0 => north
-    if (m_loggingEnabled) {
-        LOGARG("CHoveringGesture: x: %d , %d prev: %d, %d", last.x(), last.y(), previous.x(), previous.y()) ;
-    }
 }
 
 QStm_GestureDirection QStm_DirectionalGesture::getDirection() const
 {
     QStm_GestureDirection dir = ENorth ;
     int x = ABS(m_vector.x()) ;
-    int y = ABS(m_vector.x()) ;
+    int y = ABS(m_vector.y()) ;
     
-    if (y <= x/2) {
+    if (y == 0 && x == 0) {
+        dir = ENoDirection;
+    }
+    else if (y <= x/2) {
         if (m_vector.x() < 0)
             dir = EWest ;
-        else
+        else 
             dir = EEast ;
     }
     else if (y > x/2 && y <= (x+x/2)) {
@@ -107,17 +113,14 @@
             dir = ENorth ;
     }
     
-    if (m_loggingEnabled) {
-        LOGARG("CHoveringGesture: x: %d y: %d direction: %d", m_vector.x(), m_vector.y(), dir) ;
-    }
-    
     return dir ;
 }
 
-QStm_TwoPointGesture::QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc) :
-    QStm_DirectionalGesture(uid, loc, prevLoc, NULL),
-    m_location2(prevLoc)
+QStm_TwoPointGesture::QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& loc,
+                                           const QPoint& prevLoc, QTime timestamp) :
+    QStm_DirectionalGesture(uid, loc, prevLoc, timestamp, NULL)
 {
+        m_location2 = prevLoc;
 }
 
 
--- a/qstmgesturelib/qstmgenericsimplegesture.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgenericsimplegesture.h	Fri Oct 15 17:30:59 2010 -0400
@@ -39,7 +39,7 @@
 {
 public:
     QStm_GenericSimpleGesture(
-        QStm_GestureUid uid, const QPoint& loc, int type = 0,
+        QStm_GestureUid uid, const QPoint& loc, QTime timestamp, int type = 0,
         const qstmUiEventEngine::QStm_UiEventSpeedIf* speedIf = NULL);
 
 public: // implementation of QStm_GestureIf
@@ -47,6 +47,7 @@
     QStm_GestureUid gestureUid() const { return m_uid; }
     void setDetails(void* details) { m_details = details;}  // additional info can be passed here.
     virtual QPoint getLocation() const ;  // Location where the gesture happened (if applicable)
+    virtual QPoint getLocation2() const;
     virtual int getType() const ;         // If the gesture can have different types
     
     virtual float getSpeed() const /*__SOFTFP*/
@@ -66,25 +67,28 @@
 
     virtual void setTarget(void* target) { m_target = target; }
     virtual void* target() { return m_target; }
+    virtual QTime timestamp() const { return m_timestamp; }
     
 public:
     void setType(int type) { m_type = type; }
 
 protected:
     QPoint              m_location ;
+    QPoint              m_location2 ;
     QStm_GestureUid     m_uid;
     int                 m_type ;
     void*               m_details ;
     const qstmUiEventEngine::QStm_UiEventSpeedIf* m_speed ;
     QString             m_name ;
     void*               m_target;
+    QTime               m_timestamp;
 };
 
 class QStm_DirectionalGesture : public QStm_GenericSimpleGesture
 {
 public:
     QStm_DirectionalGesture(
-        QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc,
+        QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc, QTime timestamp,
         const qstmUiEventEngine::QStm_UiEventSpeedIf* speedIf = NULL, bool logging = false);
 
     void setVector(const QPoint& last, const QPoint& previous) ;
@@ -105,10 +109,7 @@
 class QStm_TwoPointGesture : public QStm_DirectionalGesture
 {
 public:
-    QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& pos1, const QPoint& pos2);
-
-private:
-    QPoint m_location2 ;
+    QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& pos1, const QPoint& pos2, QTime timestamp);
 };
 
 } // namespace
--- a/qstmgesturelib/qstmgesture_if.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgesture_if.h	Fri Oct 15 17:30:59 2010 -0400
@@ -42,6 +42,7 @@
     EGestureUidEdgeScroll,
     EGestureUidPinch,
     EGestureUidCornerZoom,
+    EGestureUidMaybeTap,
     //
     EStmGestureUid_Count
 };
@@ -75,6 +76,7 @@
     EEnableFiltering,
     EWServMessageInterception, // TBool
     EMoveTolerance,
+    EAxisLockThreshold,
     //
     EGestureSettingsCount
 };
@@ -151,6 +153,8 @@
     virtual QStm_GestureDirection getDirection() const { return qstmGesture::ENoDirection; }
     virtual QPointF getSpeedVec() const = 0;
     virtual void* target() = 0;
+    virtual QPoint getLocation2() const = 0; // Location of the 2nd touch point in a multitouch gesture
+    virtual QTime timestamp() const = 0;
 };
 
 } // namespace
--- a/qstmgesturelib/qstmgestureapi.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgestureapi.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -37,6 +37,7 @@
 #include <qstmflickgesturerecogniser.h>
 #include <qstmunknowngesturerecogniser.h>
 #include <qstmzoomgesturerecogniser.h>
+#include <qstmmaybetapgesturerecogniser.h>
 
 #include <qstmgestureapi.h>
 #include <qstmgestureevent.h>
@@ -57,7 +58,7 @@
 }
 
 
-QStm_GestureEngineApi::QStm_GestureEngineApi()
+QStm_GestureEngineApi::QStm_GestureEngineApi() : m_gestureEngine(0), m_statemachine(0), m_config(0)
 {
 	init();
 }
@@ -68,7 +69,7 @@
 	m_gestureEngine = new QStm_GestureEngine();
 	m_statemachine = new QStm_StateMachine();
 	m_statemachine->addUiEventObserver(m_gestureEngine);
-	m_config = new QStm_GestureParameters();    
+	//m_config = new QStm_GestureParameters();    
 }
 
 QStm_GestureEngineApi::~QStm_GestureEngineApi()
@@ -79,7 +80,7 @@
     qDeleteAll(m_contexts.begin(), m_contexts.end());
     m_contexts.clear();
     m_ctxtStack.clear();
-    delete m_config;
+    //delete m_config;
     delete m_gestureEngine;
     delete m_statemachine;
 }
@@ -199,6 +200,8 @@
     int moveToleranceInMm = conf.param(qstmGesture::EMoveTolerance);
     m_statemachine->setMoveTolerance(moveToleranceInMm);
     
+    qreal axisLock = conf.param(qstmGesture::EAxisLockThreshold) /100.f;
+    
     QWidget* gestureContext = static_cast<QWidget*>(context.getOwner());
     QRect ctxtRect = gestureContext ? gestureContext->rect() : QRect();
     if(gestureContext) {
@@ -277,6 +280,8 @@
     if (conf.enabled(QStm_LeftrightGestureRecogniser::KUid)) {
         QStm_LeftrightGestureRecogniser* gesture = NULL;
         initRecognizer(gesture, context, isNewCtx);
+        gesture->setAxisLockThreshold(axisLock);
+        
     }
 
     // ===================================================== UP-DOWN
@@ -285,6 +290,7 @@
     if (conf.enabled(QStm_UpdownGestureRecogniser::KUid)) {
         QStm_UpdownGestureRecogniser* gesture = NULL;
         initRecognizer(gesture, context, isNewCtx);
+        gesture->setAxisLockThreshold(axisLock);
     }
 
     // ===================================================== HOVER
@@ -311,19 +317,28 @@
         }
     }
 
-    // ===================================================== RELEASE
-    using qstmGesture::QStm_ReleaseGestureRecogniser;
-
-    if (conf.enabled(QStm_ReleaseGestureRecogniser::KUid)) {
-        QStm_ReleaseGestureRecogniser* gesture = NULL;
-        initRecognizer(gesture, context, isNewCtx);
+    // ===================================================== MAYBE TAP
+    using qstmGesture::QStm_MaybeTapGestureRecogniser;
 
-        if(gesture) {
-            gesture->setArea(QRect());
+    if (conf.enabled(QStm_MaybeTapGestureRecogniser::KUid)) {
+        int pos = m_gestureEngine->findGesture(QStm_MaybeTapGestureRecogniser::KUid);
+        QStm_MaybeTapGestureRecogniser* gesture = NULL;
+        
+        if (pos > -1) {
+            gesture = static_cast<QStm_MaybeTapGestureRecogniser*>(m_gestureEngine->gestureAt(pos));
+            gesture->addTapListener(&context, context.getOwner());
         }
-    }
+        else {
+        initRecognizer(gesture, context, isNewCtx);
+        }
+        
+        if(gesture) {
+            gesture->setTapRange( touchAreaSizeInMm );
+        }
 
-
+    }
+    
+    
     // ===================================================== TAP / DOUBLE TAP
     // Add recognizer before any existing Flick, Release, Unknown
     // Add the gesture to the gesture engine
@@ -362,6 +377,18 @@
         }
     }
 
+    // ===================================================== RELEASE
+            using qstmGesture::QStm_ReleaseGestureRecogniser;
+
+            if (conf.enabled(QStm_ReleaseGestureRecogniser::KUid)) {
+                QStm_ReleaseGestureRecogniser* gesture = NULL;
+                initRecognizer(gesture, context, isNewCtx);
+
+                if(gesture) {
+                    gesture->setArea(QRect());
+                }
+            }
+
     // ===================================================== UNKNOWN
     using qstmGesture::QStm_UnknownGestureRecogniser;
 
@@ -395,8 +422,8 @@
     m_statemachine->setTouchTimeArea      ( !filter ? 0 : tTimeAreaSizeInMm );
 
     // Timeouts, Adjustments, etc.
-    m_statemachine->setTouchSuppressTimeout(!filter ? 0 : conf.param(qstmGesture::ESuppressTimeout)*1000) ;
-    m_statemachine->setMoveSuppressTimeout(!filter ? 0 : conf.param(qstmGesture::EMoveSuppressTimeout)*1000) ;
+    m_statemachine->setTouchSuppressTimeout(!filter ? 0 : conf.param(qstmGesture::ESuppressTimeout)) ;
+    m_statemachine->setMoveSuppressTimeout(!filter ? 0 : conf.param(qstmGesture::EMoveSuppressTimeout)) ;
     m_statemachine->enableCapacitiveUp    (!filter ? 0 : conf.param(qstmGesture::ECapacitiveUpUsed));
     m_statemachine->enableYadjustment     (!filter ? 0 : conf.param(qstmGesture::EAdjustYPos));
     m_statemachine->enableLogging(context.m_logging);
@@ -418,7 +445,7 @@
 {
     m_engine.m_contexts.append(this);
     m_config = new QStm_GestureParameters();
-    m_engine.getStateMachine()->addUiEventObserver(this);
+    //m_engine.getStateMachine()->addUiEventObserver(this);
     
     for(int i = 0; i < qstmGesture::EStmGestureUid_Count; ++i) {
         m_recognizers[i] = NULL;
@@ -625,6 +652,8 @@
         gest->setSpeed(gesture->getSpeed());
         QPoint pos = gesture->getLocation();
         gest->setPosition(pos);
+        QPoint pos2 = gesture->getLocation2();
+        gest->setPosition2(pos2);
         gest->setDetails(gesture->getDetails());
         gest->setSpeedVec(gesture->getSpeedVec());
         QWidget* w = static_cast<QWidget*>(gesture->target());
@@ -682,7 +711,7 @@
 
 void QStm_GestureContext::enableRecognizer(qstmGesture::QStm_GestureUid uid )
 {
-	qstmGesture::QStm_GestureRecogniserIf* rec = m_recognizers[uid];
+    qstmGesture::QStm_GestureRecogniserIf* rec = m_recognizers[uid];
     if(rec && !rec->isEnabled()) {
         rec->enable(true);
         // TODO: Notify listener
@@ -698,14 +727,27 @@
 
 bool QStm_GestureContext::handleSymbianPlatformEvent(const QSymbianEvent* platEvent) 
 { 
-    return	m_engine.getStateMachine()->handleSymbianPlatformEvent(platEvent); 
+    return m_engine.getStateMachine()->handleSymbianPlatformEvent(platEvent); 
 }
 
 
 bool QStm_GestureContext::handleX11PlatformEvent(const XEvent* platEvent)
 {
-	return	m_engine.getStateMachine()->handleX11PlatformEvent(platEvent);
+    return m_engine.getStateMachine()->handleX11PlatformEvent(platEvent);
+}
+
+bool QStm_GestureContext::handleWinPlatformEvent(const void* platEvent)
+{
+    return m_engine.getStateMachine()->handleWinPlatformEvent(platEvent);
 }
 
+void QStm_GestureContext::enableDblClick(bool enable)
+{
+    m_engine.getStateMachine()->enableDblClick(enable);
+}
 
-
+void QStm_GestureContext::setLogging(int enabled)
+{ 
+    m_logging = enabled;
+    m_engine.getGestureEngine()->enableLogging(enabled);
+}
--- a/qstmgesturelib/qstmgestureapi.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgestureapi.h	Fri Oct 15 17:30:59 2010 -0400
@@ -121,7 +121,7 @@
 
 //==================================================================
 
-class QStm_GestureParameters: public QObject, public QStm_GestureParametersApiIf
+class QStm_GestureParameters: public QStm_GestureParametersApiIf
 {
 public:
 
@@ -170,11 +170,11 @@
 
 //==================================================================
 
-class QStm_GestureEngineApi : public QObject
+class QStm_GestureEngineApi 
 {
-	Q_OBJECT
+
 public:
-    ~QStm_GestureEngineApi();
+    virtual ~QStm_GestureEngineApi();
 
     QSTMGESTURELIB_EXPORT QStm_GestureContext* createContext(int aId);
 
@@ -246,26 +246,26 @@
 
     const QList<QStm_GestureListenerApiIf*>& listeners() const { return m_listeners; }
 
-    QSTMGESTURELIB_EXPORT QStm_GestureParameters& config() { return *m_config; }
+    inline QStm_GestureParameters& config() { return *m_config; }
 
     QSTMGESTURELIB_EXPORT void setContext(void* control);
 
-    QSTMGESTURELIB_EXPORT void setLogging(int enabled) { m_logging = enabled; }
+    QSTMGESTURELIB_EXPORT void setLogging(int enabled);
 
-    QSTMGESTURELIB_EXPORT void* contextControl() { return m_ownerControl; }
+    inline void* contextControl() { return m_ownerControl; }
 
     QSTMGESTURELIB_EXPORT void activate();
     
     QSTMGESTURELIB_EXPORT void activate(void* control);
 
-    QSTMGESTURELIB_EXPORT bool isActive() { return m_isActivated; }
+    inline bool isActive() { return m_isActivated; }
 
     QSTMGESTURELIB_EXPORT void deactivate();
 
-    QSTMGESTURELIB_EXPORT int id() const { return m_ctxtId; }
+    inline int id() const { return m_ctxtId; }
 
     // TODO: hide implementation, check boundaries
-    QSTMGESTURELIB_EXPORT qstmGesture::QStm_GestureRecogniserIf* recognizer(qstmGesture::QStm_GestureUid aUid)
+    inline qstmGesture::QStm_GestureRecogniserIf* recognizer(qstmGesture::QStm_GestureUid aUid)
     {
         return m_recognizers[aUid];
     }
@@ -285,7 +285,9 @@
     QSTMGESTURELIB_EXPORT bool handleSymbianPlatformEvent(const QSymbianEvent* platEvent); 
     
     QSTMGESTURELIB_EXPORT bool handleX11PlatformEvent(const XEvent* platEvent);
-    
+    QSTMGESTURELIB_EXPORT bool handleWinPlatformEvent(const void* platEvent);
+
+    QSTMGESTURELIB_EXPORT void enableDblClick(bool enable);
     
 signals:
     void uiEvent(const qstmUiEventEngine::QStm_UiEventIf& event);
--- a/qstmgesturelib/qstmgestureengine.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgestureengine.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -129,7 +129,7 @@
 
 const qstmUiEventEngine::QStm_UiEventIf* QStm_GestureEngine::getUiEvents(int indexOfActiveStream) const
 {
-//#if defined(ADVANCED_POINTER_EVENTS)
+#if defined(ADVANCED_POINTER_EVENTS)
     // create temporary array of active event streams and initialize with zero
     const qstmUiEventEngine::QStm_UiEventIf* activeEventPointers[qstmUiEventEngine::KMaxNumberOfPointers] ;
     for (int x = 0; x < qstmUiEventEngine::KMaxNumberOfPointers; activeEventPointers[x++] = 0);
@@ -143,10 +143,10 @@
     }
     // then return the active event stream asked
     return activeEventPointers[indexOfActiveStream] ;
-//#else
+#else
     // in single touch it is enough to return the only possible pointer
-//    return m_uiEventStream[indexOfActiveStream] ;
-//#endif
+    return m_uiEventStream[indexOfActiveStream] ;
+#endif
 }
 
 /*!
@@ -194,6 +194,15 @@
  */
 void QStm_GestureEngine::walkTroughGestures()
 {
+    if (m_loggingEnabled) {
+        LOGTXT("\n======= walkTroughGestures: start ===================\n");
+    }
+    bool uknownGestureEnabled = false;
+    QStm_GestureRecogniserIf* uknownGesture = gestureAt(gestureCount() - 1);
+    if (uknownGesture->gestureUid() == EGestureUidUnknown) {
+        uknownGestureEnabled = uknownGesture->isEnabled();
+    }
+
     int newowner = -1 ;
     int newlocker =  -1; //m_currentLockedGesture ;
     // check if someone has locked the gesture
@@ -285,9 +294,11 @@
 						break;
 					}
                 }
+                if (m_loggingEnabled) {
                 LOGARG("walkTroughGestures: 0x%x, recognizers count %d, newowner %d, m_currentGestureOwner %d", 
                 		pgrif, gcount, newowner, m_currentGestureOwner);
             }
+            }
             if (controlObtained)  {
                 break; // do not process rest of the gestures
             }
@@ -306,6 +317,12 @@
         m_currentGestureOwner = newowner ;
     }
     m_currentLockedGesture = newlocker ;    // if someone locked it or released the lock
+    // some recognizers might turn it off - restore it.
+    uknownGesture->enable(uknownGestureEnabled);
+    
+    if (m_loggingEnabled) {
+        LOGTXT("\n=================== walkTroughGestures: end =========================\n");
+    }
 }
 
 void QStm_GestureEngine::updateUiEvents()
--- a/qstmgesturelib/qstmgestureengine.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgestureengine.h	Fri Oct 15 17:30:59 2010 -0400
@@ -39,8 +39,7 @@
  * by returning ELockToThisGesture. Then only that gesture recogniser will be called
  * until release is detected or the recogniser returns something else than ELockToThisGesture.
  */
-class QStm_GestureEngine : public QObject, 
-                           public QStm_GestureEngineIf, 
+class QStm_GestureEngine : public QStm_GestureEngineIf, 
                            public qstmUiEventEngine::QStm_UiEventObserverIf
 {
 public:
--- a/qstmgesturelib/qstmgestureengine_if.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgestureengine_if.h	Fri Oct 15 17:30:59 2010 -0400
@@ -219,6 +219,7 @@
 
 class QStm_GestureRecogniser : public QObject, public QStm_GestureRecogniserIf
 {
+
 public:
     virtual ~QStm_GestureRecogniser()
     {
--- a/qstmgesturelib/qstmgestureevent.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgestureevent.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -19,14 +19,97 @@
 *
 */
 
-#include <QWidget>
-#include <QApplication>
 #include "qstmgestureevent.h"
 #include "qstmuievent_if.h"
 
+#include <QGraphicsSceneMouseEvent>
+
 using namespace qstmUiEventEngine;
+using namespace qstmGesture;
+
+static Qt::GestureType s_assignedType = Qt::CustomGesture;
+static int s_stmGestureEventType = QEvent::User;
+static QGraphicsItem* s_gestureGrabberItem = NULL;
+static QGraphicsItem* s_gestureFocusedItem = NULL;
+
+
+QStm_GestureEventFilter* QStm_GestureEventFilter::m_instance = 0;
+
+QStm_GestureEventFilter* QStm_GestureEventFilter::instance()
+{
+    if (!m_instance) {
+        m_instance = new QStm_GestureEventFilter();
+    }
+    return m_instance;
+}
+
+bool QStm_GestureEventFilter::eventFilter(QObject* receiver, QEvent* evt)
+{
+    return qstmIsGraphicsSceneMouseEvent(evt) || qstmIsMouseEvent(evt) || 
+           qstmIsTouchEvent(evt) || qstmIsContextMenuEvent(evt);
+}
+
+
+
+
+bool QStm_GestureEventFilter::sendGraphicsSceneMouseEvent(QEvent* event, QGraphicsObject* go)
+{
+    bool ret = false;
+    if (event->type() == QEvent::Gesture) {
+        QStm_Gesture* gesture = getQStmGesture(event);
+        if (gesture) {
+            ret = gesture->sendGraphicsSceneMouseEvent(go);
+        }
+
+    }
+    return ret;
+}
+
 
-Qt::GestureType QStm_Gesture::s_assignedType = Qt::CustomGesture;
+bool QStm_GestureEventFilter::event(QEvent* event)
+{
+    if (event->type() == QEvent::Gesture) {
+        QStm_Gesture* gesture = getQStmGesture(event);
+        if (gesture) {
+            QStm_GestureType gtype = gesture->getGestureStmType();
+            
+            /*
+             * Touch mapped to mouse press, Tap mapped to mouse release
+             * UpDown, LeftRight and Pan are mapped to mouse move.
+             */
+            if (gtype == QStmMaybeTapGestureType) {// in case of tap send mouse release
+                gesture->setGestureStmType(QStmReleaseGestureType);
+            }
+            
+            bool ret = (gtype == QStmTouchGestureType ||
+                        gtype == QStmMaybeTapGestureType ||
+                        gtype == QStmLeftRightGestureType || 
+                        gtype == QStmUpDownGestureType ||
+                        gtype == QStmPanGestureType ||
+                        gtype == QStmReleaseGestureType ||
+                        gtype == QStmFlickGestureType ||
+                        gtype == QStmUknownGestureType) ;
+                         
+            if (ret) {
+                gesture->sendMouseEvents();
+                (static_cast<QGestureEvent*>(event))->accept(QStm_Gesture::assignedType());
+                (static_cast<QGestureEvent*>(event))->accept();
+            }
+            
+            if (gtype == QStmTapGestureType) {// restore gesture type. 
+                gesture->setGestureStmType(QStmTapGestureType);
+            }
+            
+            return ret;
+        }
+    }
+    return false;
+}
+
+
+
+
+
 
 QStm_GestureEvent::QStm_GestureEvent():
                    QEvent(QStm_GestureEvent::stmGestureEventType())
@@ -39,8 +122,47 @@
 }
 
 
+QEvent::Type QStm_GestureEvent::stmGestureEventType() 
+{ 
+    if (s_stmGestureEventType == QEvent::User) {
+        s_stmGestureEventType = QEvent::registerEventType(QStmGestureEventType);    
+    }
+    return static_cast<QEvent::Type>(QStmGestureEventType); 
+}
+
+
+
+void QStm_Gesture::setAssignedGestureType(Qt::GestureType type) 
+{ 
+    s_assignedType = type; 
+}
+
+Qt::GestureType QStm_Gesture::assignedType() 
+{ 
+    return s_assignedType; 
+} 
 
 
+QGraphicsItem* QStm_Gesture::gestureGrabberItem()
+{ 
+    return s_gestureGrabberItem; 
+}
+
+void QStm_Gesture::setGestureGrabberItem(QGraphicsItem* item)
+{ 
+    s_gestureGrabberItem = item; 
+}
+
+
+QGraphicsItem* QStm_Gesture::gestureFocusedItem()
+{
+    return s_gestureFocusedItem;
+}
+
+void QStm_Gesture::setGestureFocusedItem(QGraphicsItem* item)
+{
+    s_gestureFocusedItem = item;
+}
 
 QStm_Gesture::QStm_Gesture(QObject* parent) : QGesture(parent)
 {
@@ -51,9 +173,11 @@
 	    m_state = Qt::NoGesture;
 	    m_gstSubType = 0;
 	    m_pos = QPoint(INT_MIN,INT_MIN);
+        m_pos2 = QPoint(INT_MIN,INT_MIN);
 	    m_details = NULL;
 	    m_speedVec = QPointF(0.0, 0.0);
 	    m_target = NULL;
+        m_timestamp = QTime::currentTime();
 };
 
 
@@ -66,9 +190,12 @@
     m_state = other.gestureState();
     m_gstSubType = other.getGestureSubType();
     m_pos = other.position();
+    m_pos2 = other.position2();
     m_details = other.getDetails();
     m_speedVec = other.getSpeedVec();
-    m_target = other.m_target;
+    m_target = other.target();
+    m_timestamp = other.timestamp();
+    setHotSpot(other.hotSpot());
 	return *this;
 }
 
@@ -109,6 +236,104 @@
     }	
 }
 
+
+
+QStm_GestureType  QStm_Gesture::gestureUidToStmType(QStm_GestureUid uid, int stmGestSubType)
+{
+    QStm_GestureType  gtype = QStmUknownGestureType;
+    
+    switch (uid) {
+        case EGestureUidTap:
+        {
+            QStm_TapType type = qstmGesture::QStm_TapType(stmGestSubType);
+            if (type == qstmGesture::ETapTypeDouble) {
+                gtype = QStmDoubleTapGestureType;
+            }
+            else  {
+                gtype = QStmTapGestureType;
+            }
+            break;
+        }
+
+        case EGestureUidTouch:
+        {
+            gtype = QStmTouchGestureType;
+            break;
+        }
+
+        case EGestureUidRelease:
+        {
+            gtype = QStmReleaseGestureType;
+            break;
+        }
+
+        case EGestureUidFlick:
+        {
+            gtype = QStmFlickGestureType;
+            break;
+        }
+
+        case EGestureUidLeftRight:
+        {
+            gtype = QStmLeftRightGestureType;
+            break;
+        }
+
+        case EGestureUidUpDown:
+        {
+            gtype = QStmUpDownGestureType;
+            break;
+        }
+
+        case EGestureUidPan:
+        {
+            gtype = QStmPanGestureType;
+            break;
+        }
+
+        case EGestureUidHover:
+        {
+            gtype = QStmHoverGestureType;
+            break;
+        }
+
+        case EGestureUidLongPress:
+        {
+            gtype = QStmLongPressGestureType;
+            break;
+        }
+
+        case EGestureUidEdgeScroll:
+        {
+            gtype = QStmEdgeScrollGestureType;
+            break;
+        }
+
+        case EGestureUidCornerZoom:
+        {
+            gtype = QStmCornerZoomGestureType;
+            break;
+        }
+
+        case EGestureUidPinch:
+        {
+            gtype = QStmPinchGestureType;
+            break;
+        }
+        case EGestureUidMaybeTap:
+        {
+            gtype = QStmMaybeTapGestureType;
+            break;
+        }
+        default:
+        {
+            gtype = QStmUknownGestureType;
+            break;
+        }
+    }    
+    return gtype;
+}
+
 void QStm_Gesture::gestureTypeToMouseTypes(QVarLengthArray<int, 4>& types)
 {
 	switch (m_gstType) {
@@ -133,11 +358,13 @@
 			break;
 		}
 		case QStmReleaseGestureType:
+		case QStmFlickGestureType:
 		{
 			types.append(QEvent::MouseButtonRelease);
 			break;
 		}
 		case QStmTapGestureType:
+        //case QStmMaybeTapGestureType:
 		{
 			types.append(QEvent::MouseButtonPress);
 			types.append(QEvent::MouseButtonRelease); 
@@ -152,7 +379,6 @@
 		    }
 		    break;
 		}
-		case QStmFlickGestureType:
 		case QStmEdgeScrollGestureType:
 		case QStmPinchGestureType:
 		case QStmLongPressGestureType:
@@ -162,6 +388,9 @@
 	return;
 }
 
+
+
+
 bool QStm_Gesture::sendOrPostMouseEvents(QObject* receiver, Qt::KeyboardModifier modifier, bool send)
 {
     bool ret = false;
@@ -176,25 +405,37 @@
     buttons &= Qt::MouseButtonMask;
     
     if (receiver->isWidgetType()) {
-    	QWidget* w = static_cast<QWidget*>(receiver);
+        w = static_cast<QWidget*>(receiver);
     	pos = w->mapFromGlobal(gpos);
     }    
     
+
     QVarLengthArray<int, 4> mouseTypes;
     gestureTypeToMouseTypes(mouseTypes);   
     
     for (int i = 0; i < mouseTypes.size(); i++) {
     	QEvent::Type mtype = static_cast<QEvent::Type>(mouseTypes[i]);
-    	
+
+        if (mtype == QEvent::None) {
+            continue;
+        }
+        else if (mtype != QEvent::MouseButtonRelease && w) {
+            QPoint wtl = w->mapToGlobal(w->pos());
+            QRect wgeom = QRect(wtl, w->size());
+            if (!wgeom.contains(m_pos)) {
+                continue;
+            }
+        }
+
     	if (mtype == QEvent::MouseButtonRelease) {
     		buttons = 0;
     	}
     	
     	if (send) {
     	    QMouseEvent evt(mtype, pos, gpos, Qt::LeftButton, buttons, modifier);
-    	    if (w) w->grabMouse();
+            //if (w) w->grabMouse();
     	    QApplication::sendEvent(receiver, &evt);
-    	    if (w) w->releaseMouse();
+            //if (w) w->releaseMouse();
     	}
     	else {
     		QMouseEvent* evt = new QMouseEvent(mtype, pos, gpos, Qt::LeftButton, buttons, modifier);
@@ -210,6 +451,13 @@
 {
     QWidget* target = static_cast<QWidget*>(m_target);
     QWidget* w = NULL;
+    QWidget* modal = QApplication::activeModalWidget();
+
+    
+    
+    if (modal) {
+        target = modal;
+    }
     
     if (target) {
         QPoint pos = target->mapFromGlobal(m_pos);
@@ -220,26 +468,97 @@
     }
     
     if (w) {
-        if (event->type() == QStm_GestureEvent::stmGestureEventType() && 
+        if (modal) { //we send mouse events to modal dialogs.
+            return(sendMouseEvents(w));
+        }
+        /*
+        else if (event->type() == QStm_GestureEvent::stmGestureEventType() && 
             m_gstType == QStmUknownGestureType) {
             QStm_UiEventIf* uiEvent = static_cast<QStm_UiEventIf*>(m_details);
-            QWidget* modal = QApplication::activeModalWidget();
+            
             if (uiEvent && m_target == modal) {
             //re-generate mouse events
-                sendMouseEvents(w);
+                return(sendMouseEvents(w));
             }
-        }        
+
         else {
-            QApplication::sendEvent(w, event);
+                return(QApplication::sendEvent(w, event));
+        }
+    }
+		*/
+        else {
+            if (!target->hasFocus()) {
+                target->setFocus(Qt::MouseFocusReason);
+            }
+            return(QApplication::sendEvent(w, event));
         }
     }
+    return false;
+}
+
+
+bool QStm_Gesture::sendGraphicsSceneMouseEvent(QGraphicsObject* go)
+{
+    QEvent::Type eventType = gestureType2GraphicsSceneMouseType();
+    bool ret = false;
+
+    if (eventType != QEvent::None) {
+        QGraphicsSceneMouseEvent gsme(eventType);
+        QPointF scenePos = qstmMapToScene(m_pos, go);
+        qstmSetGraphicsSceneMouseEvent(scenePos, go, gsme);
+        ret = go->event(&gsme);
+    }
+    return ret;
 }
 
 
+QEvent::Type QStm_Gesture::gestureType2GraphicsSceneMouseType()
+{
+    QEvent::Type type = QEvent::None;
+    switch(m_gstType)
+    {
+        case QStmTouchGestureType:
+            type = QEvent::GraphicsSceneMousePress;
+            break;
+        case QStmMaybeTapGestureType:
+        case QStmReleaseGestureType:
+        case QStmFlickGestureType:
+            type = QEvent::GraphicsSceneMouseRelease;
+            break;
+        case QStmLeftRightGestureType:
+        case QStmUpDownGestureType:
+        case QStmPanGestureType:
+            type = QEvent::GraphicsSceneMouseMove;
+            break;
+        case  QStmUknownGestureType:
+        {
+            QVarLengthArray<int, 4> mouseTypes;
+            gestureTypeToMouseTypes(mouseTypes);
+            switch (mouseTypes[0])
+            {
+                case QEvent::MouseButtonPress:
+                    type = QEvent::GraphicsSceneMousePress;
+                    break;
+                case QEvent::MouseButtonRelease:
+                    type = QEvent::GraphicsSceneMouseRelease;
+                    break;
+                case QEvent::MouseMove:
+                    type = QEvent::GraphicsSceneMouseMove;
+                    break;
+            }
+        }
+    }
+    return type;
+}
+
 bool QStm_Gesture::sendMouseEvents(Qt::KeyboardModifier modifier)
 {
-    Q_ASSERT(m_target);
     QWidget* target = static_cast<QWidget*>(m_target);
+
+    if (!target) {
+        target = QApplication::widgetAt(m_pos);
+    }
+    if (!target) return false;
     QPoint pos = target->mapFromGlobal(m_pos);
     QWidget* w = target->childAt(pos);
     if (!w) {
@@ -283,6 +602,160 @@
 }
 
 
+bool QStm_Gesture::isGestureEnded()
+{
+    bool gestureEnded = false;
+    
+    if (m_gstType == QStmUknownGestureType) {
+        QStm_UiEventIf* uiEvent = static_cast<QStm_UiEventIf*>(m_details);
+        if (uiEvent) {
+            QEvent::Type evType = uiEvent->mapToMouseEventType();
+            gestureEnded = (evType == ERelease);
+        }
+    }
+    else if (m_gstType == QStmReleaseGestureType ||
+             m_gstType == QStmFlickGestureType ||
+             m_gstType == QStmTapGestureType ||
+             m_gstType == QStmDoubleTapGestureType) {
+        gestureEnded = true;
+    }
+    return gestureEnded;
+}
+
+bool QStm_Gesture::clearGestureFocusedItemIfNeeded()
+{
+    bool reset = isGestureEnded();
+    if (reset) {
+        QStm_Gesture::setGestureFocusedItem(NULL);
+    }
+    return reset;
+}
+
+void QStm_Gesture::updateGestureFocusedItemIfNeeded(QGraphicsItem* gi)
+{
+    if (isGestureEnded()) {
+        QStm_Gesture::setGestureFocusedItem(NULL);        
+    }
+    else if (gestureState() != Qt::GestureFinished) { 
+        QStm_Gesture::setGestureFocusedItem(gi);
+    }    
+}
+
+QPointF QStm_Gesture::scenePosition(QGraphicsItem* i)
+{
+    return qstmMapToScene(m_pos, static_cast<QGraphicsObject*>(i));
+}
+
+QPointF QStm_Gesture::scenePosition2(QGraphicsItem* i)
+{
+    return qstmMapToScene(m_pos2, static_cast<QGraphicsObject*>(i));
+}
+
+QPointF QStm_Gesture::sceneSpeedVec(QGraphicsItem* i)
+{
+    QGraphicsObject* o = static_cast<QGraphicsObject*>(i);
+
+    return qstmMapToScene(m_speedVec,o) - qstmMapToScene(QPointF(0, 0), o);
+}
+
+QPointF QStm_Gesture::sceneLengthAndDirection(QGraphicsItem* i)
+{
+    QGraphicsObject* o = static_cast<QGraphicsObject*>(i);
+
+    return qstmMapToScene(QPointF(-m_vector.x(), m_vector.y()),o) - qstmMapToScene(QPointF(0, 0), o);
+}
+
+int QStm_Gesture::sceneDirection(QGraphicsItem *i)
+{
+    QStm_GestureDirection dir = ENorth ;
+    QPointF v = sceneLengthAndDirection(i);
+
+    qreal x = qAbs(v.x()) ;
+    qreal y = qAbs(v.y()) ;
+
+    if (y == 0 && x == 0) {
+        dir = ENoDirection;
+    }
+    else if (y <= x/2) {
+        if (v.x() < 0)
+            dir = EWest ;
+        else
+            dir = EEast ;
+    }
+    else if (y > x/2 && y <= (x+x/2)) {
+        if (v.x() < 0)  {
+            if (v.y() < 0 )
+                dir = ESouthWest ;
+            else
+                dir = ENorthWest ;
+        }
+        else {
+            if (v.y() < 0 )
+                dir = ESouthEast ;
+            else
+                dir = ENorthEast ;
+        }
+    }
+    else if (y > x+x/2) {
+        if (v.y() < 0)
+            dir = ESouth ;
+        else
+            dir = ENorth ;
+    }
+
+    return dir ;
+}
+
+QSTMGESTURELIB_EXPORT QPoint qstmMapFromScene(const QPointF& gpos, QGraphicsObject* graphicsObj)
+{
+    QGraphicsView* grView = qstmGetGraphicsView(graphicsObj);
+    QPointF pos = QPointF(0.0, 0.0);
+    if (grView) {
+        pos = grView->mapFromScene(gpos);
+        return grView->mapToGlobal(pos.toPoint());
+    }
+    return QPoint(0, 0);
+}
+
+
+QSTMGESTURELIB_EXPORT QPointF qstmMapToScene(const QPointF& gpos, QGraphicsObject* graphicsObj)
+{
+    QGraphicsView* grView = qstmGetGraphicsView(graphicsObj);
+    QPointF pos = QPointF(0.0, 0.0);
+    if (grView) {
+        pos = grView->mapFromGlobal(gpos.toPoint());
+        pos = grView->mapToScene(pos.toPoint());
+    }
+    return pos;
+}
+
+
+QSTMGESTURELIB_EXPORT QPointF qstmMapFromGlobal(const QPointF& gpos, QGraphicsObject* graphicsObj)
+{
+    QGraphicsView* grView = qstmGetGraphicsView(graphicsObj);
+    QPointF pos = QPointF(0.0, 0.0);
+    if (grView) {
+        pos = grView->mapFromGlobal(gpos.toPoint());
+    }
+    return pos;
+}
+
+QSTMGESTURELIB_EXPORT QGraphicsView* qstmGetGraphicsView(QGraphicsObject* graphicsObj)
+{
+    QGraphicsScene* scene = graphicsObj->scene();
+    QList<QGraphicsView*> gvList = scene->views();
+    QList<QGraphicsView*>::iterator it;
+    
+    /*
+    for (it = gvList.begin(); it != gvList.end(); it++) {
+        if (static_cast<QGraphicsView*>(*it)->hasFocus()) {
+            return static_cast<QGraphicsView*>(*it);
+        }
+    }
+    */
+    return gvList.isEmpty() ? NULL : gvList[0];
+}
+
 QSTMGESTURELIB_EXPORT QStm_Gesture*  getQStmGesture(QEvent* event)
 {	
 	QStm_Gesture* gesture = NULL;
@@ -297,3 +770,120 @@
 	return gesture;
 }
 
+QSTMGESTURELIB_EXPORT bool qstmDeliverGestureEventToGraphicsItem(QGraphicsView* gv, QEvent* event)
+{
+    if (event->type() != QEvent::Gesture) return false;
+    
+    bool ret = false;
+    QStm_Gesture* gesture = getQStmGesture(event);
+    if (gesture) {
+
+        QGraphicsScene* gs = gv->scene();
+        QGraphicsItem* gestureGrabber = QStm_Gesture::gestureGrabberItem();
+        QGraphicsItem* gi = QStm_Gesture::gestureFocusedItem();
+        QGraphicsItem* mgItem = gs->mouseGrabberItem();
+        
+        if (gestureGrabber) {
+            gs->sendEvent(gestureGrabber, event);
+            ret = true; //no fallback to mouse events   
+        }
+        else {
+            if (!gi) {
+                gi = mgItem;
+            }
+            if (!gi) {
+                QPoint pos = gv->mapFromGlobal(gesture->position());
+                pos = gv->mapToScene(pos).toPoint();
+                QList<QGraphicsItem *> itemsList = gs->items(pos, Qt::IntersectsItemShape,
+                                                             Qt::DescendingOrder);
+                for(int i = 0; i < itemsList.size(); i++) {
+
+                    if (itemsList[i] && (itemsList[i])->opacity() < qreal(0.001)) {
+                        continue;
+                    }
+                    gi = itemsList[i];
+                    gs->setFocusItem(gi, Qt::MouseFocusReason);
+                    break;
+                }
+            }
+            if (gi) {
+                //gs->setFocusItem(gi, Qt::MouseFocusReason);
+                //ret = gs->sendEvent(gi, event);
+                //gs->setFocusItem(0, Qt::MouseFocusReason);
+
+                QGraphicsObject* go = gi->toGraphicsObject();
+                if (go) {
+                    ret = go->event(event);
+                }
+
+            }
+        }
+        
+        if (!ret) { // fallback to mouse events
+            QStm_GestureEventFilter::instance()->event(event);
+            ret = true;
+        }
+        else if (!gestureGrabber) {
+            gesture->updateGestureFocusedItemIfNeeded(gi);
+        }
+    }
+    return ret;
+}
+
+
+QSTMGESTURELIB_EXPORT void qstmSetGraphicsSceneMouseEvent(const QPointF& scenePos, QGraphicsObject* graphicsObj,
+                                                         QGraphicsSceneMouseEvent& event, bool select)
+{
+    QPointF pos = scenePos;
+    QPoint gpos = qstmMapFromScene(pos, graphicsObj);
+
+    event.setScenePos(pos);
+    event.setScreenPos(gpos);
+    event.setPos(graphicsObj->mapFromScene(pos));
+    if (!select && event.type() != QEvent::GraphicsSceneMouseMove) {
+        event.setButton(Qt::LeftButton);
+    }
+    else {
+        event.setButton(Qt::NoButton);
+    }
+    if (!select) {
+        event.setButtons(Qt::NoButton);
+    }
+    else {
+        event.setButtons(Qt::LeftButton);
+    }
+    event.setModifiers(Qt::NoModifier);
+}
+
+QSTMGESTURELIB_EXPORT bool qstmIsGraphicsSceneMouseEvent(QEvent* event)
+{
+    QEvent::Type  type = event->type();
+    return type == QEvent::GraphicsSceneMouseMove ||
+           type == QEvent::GraphicsSceneMousePress ||
+           type == QEvent::GraphicsSceneMouseRelease ||
+           type == QEvent::GraphicsSceneMouseDoubleClick;
+}
+
+QSTMGESTURELIB_EXPORT bool qstmIsMouseEvent(QEvent* event)
+{
+    QEvent::Type  type = event->type();
+    return type == QEvent::MouseButtonPress ||
+           type == QEvent::MouseButtonRelease ||
+           type == QEvent::MouseMove ||
+           type == QEvent::MouseButtonDblClick;
+}
+
+QSTMGESTURELIB_EXPORT bool qstmIsTouchEvent(QEvent* event)
+{
+    QEvent::Type  type = event->type();
+    return type == QEvent::TouchBegin ||
+           type == QEvent::TouchEnd ||
+           type == QEvent::TouchUpdate;
+}
+
+QSTMGESTURELIB_EXPORT bool qstmIsContextMenuEvent(QEvent* event)
+{
+    QEvent::Type  type = event->type();
+    return type == QEvent::ContextMenu ||
+           type == QEvent::GraphicsSceneContextMenu;
+}
--- a/qstmgesturelib/qstmgestureevent.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgestureevent.h	Fri Oct 15 17:30:59 2010 -0400
@@ -26,8 +26,13 @@
 #include <QString>
 #include <QVarLengthArray>
 #include <QMouseEvent>
+#include <QWidget>
+#include <QApplication>
+#include <QGraphicsScene>
+#include <QGraphicsView>
 #include <QGesture>
-#include <QWidget>
+#include <QString>
+#include <QGraphicsWidget>
 
 #include "qstmgesturedefs.h"
 #include "qstmgesture_if.h"
@@ -35,7 +40,6 @@
 #define QStmGestureEventType QEvent::User + 1 
 #define QStmGestureType Qt::CustomGesture
 
-
 enum QStm_GestureType
 	{
 	    QStmUknownGestureType = 0,
@@ -53,7 +57,8 @@
 	    QStmEdgeScrollGestureType,
 	    
 	    QStmPinchGestureType, 
-	    QStmCornerZoomGestureType
+	    QStmCornerZoomGestureType,
+	    QStmMaybeTapGestureType
 	};
 
 
@@ -70,10 +75,15 @@
     
     QStm_Gesture& operator=(QStm_Gesture& other);
     QPoint  position() const { return m_pos; }
+    QPointF scenePosition(QGraphicsItem* i);
     void setPosition(const QPoint &pos) { m_pos = pos; /*setHotSpot(QPointF(pos)); */}
+    QPoint  position2() const { return m_pos2; }
+    QPointF scenePosition2(QGraphicsItem* i);
+    void setPosition2(const QPoint &pos) { m_pos2 = pos; /*setHotSpot(QPointF(pos)); */}
     
     void setGestureStmType(QStm_GestureType type) { m_gstType = type; }    
     QStm_GestureType  getGestureStmType() const { return m_gstType; }
+    QStm_GestureType  gestureUidToStmType(qstmGesture::QStm_GestureUid uid, int stmGestSubType);
     
     void setGestureState(Qt::GestureState state) { m_state = state; }
     Qt::GestureState gestureState() { return m_state; }
@@ -85,31 +95,44 @@
     void setSpeed(qreal speed) { m_speed = speed; }
     
     QPointF getSpeedVec() { return m_speedVec; }
+    QPointF sceneSpeedVec(QGraphicsItem* i);
     void setSpeedVec(QPointF speedVec) { m_speedVec = speedVec; }
     
     QPoint getLengthAndDirection() { return m_vector; }
+    QPointF sceneLengthAndDirection(QGraphicsItem* i);
+
     void setLengthAndDirection(QPoint vec) { m_vector = vec; }
     
     int getDirection() { return m_direction; }
+    int sceneDirection(QGraphicsItem* i);
     void setDirection(int dir) { m_direction = dir; }
     QString  gestureName();
     
     void* getDetails() { return m_details; }
     void  setDetails(void* details ) { m_details = details; }
+    QTime timestamp() { return m_timestamp; }
+    void  setTimestamp(QTime ts) { m_timestamp.setHMS(ts.hour(),
+                                   ts.minute(), ts.second(), ts.msec()); }
     
     bool sendEvent(QEvent* event);
     QList<QMouseEvent*>   getMouseEvents();
     bool sendMouseEvents(QObject* receiver, Qt::KeyboardModifier modifier = Qt::NoModifier);
     bool sendMouseEvents(Qt::KeyboardModifier modifier = Qt::NoModifier);
     bool postMouseEvents(QObject* receiver, Qt::KeyboardModifier modifier = Qt::NoModifier);
-
+    bool sendGraphicsSceneMouseEvent(QGraphicsObject* go);
     void setTarget(QWidget* target) { m_target = target; }
     QWidget* target() { return m_target; }
     
-    static void setAssignedGestureType(Qt::GestureType type) { s_assignedType = type; }
-    static Qt::GestureType assignedType() { return s_assignedType; } 
-    
-    
+    static void setAssignedGestureType(Qt::GestureType type);
+    static Qt::GestureType assignedType(); 
+    static QGraphicsItem* gestureGrabberItem();
+    static void setGestureGrabberItem(QGraphicsItem* item);
+    static QGraphicsItem* gestureFocusedItem();
+    static void setGestureFocusedItem(QGraphicsItem* item);
+    bool clearGestureFocusedItemIfNeeded();
+    bool isGestureEnded();
+    void updateGestureFocusedItemIfNeeded(QGraphicsItem* gi);
+    QEvent::Type gestureType2GraphicsSceneMouseType();
 
 private:
     bool sendOrPostMouseEvents(QObject* receiver, Qt::KeyboardModifier modifier, bool send);
@@ -123,24 +146,51 @@
     Qt::GestureState  m_state;
     int               m_gstSubType;
     QPoint            m_pos;
+    QPoint            m_pos2;
     void*             m_details;
     QPointF           m_speedVec;
-    static Qt::GestureType   s_assignedType;
     QWidget*          m_target;
+    QTime             m_timestamp;
 };
 
+QSTMGESTURELIB_EXPORT QStm_Gesture* getQStmGesture(QEvent* event);
+QSTMGESTURELIB_EXPORT QPointF qstmMapFromGlobal(const QPointF& gpos, QGraphicsObject* graphicsObj);
+QSTMGESTURELIB_EXPORT QPoint qstmMapFromScene(const QPointF& gpos, QGraphicsObject* graphicsObj);
+QSTMGESTURELIB_EXPORT QPointF qstmMapToScene(const QPointF& gpos, QGraphicsObject* graphicsObj);
+QSTMGESTURELIB_EXPORT QGraphicsView* qstmGetGraphicsView(QGraphicsObject* graphicsObj);
+QSTMGESTURELIB_EXPORT bool qstmDeliverGestureEventToGraphicsItem(QGraphicsView* gv, QEvent* event);
+QSTMGESTURELIB_EXPORT void qstmSetGraphicsSceneMouseEvent(const QPointF& scenePos, QGraphicsObject* graphicsObj,
+                                                          QGraphicsSceneMouseEvent& event, bool select = false);
 
-QSTMGESTURELIB_EXPORT QStm_Gesture* getQStmGesture(QEvent* event);
-
-
+QSTMGESTURELIB_EXPORT bool qstmIsGraphicsSceneMouseEvent(QEvent* event);
+QSTMGESTURELIB_EXPORT bool qstmIsMouseEvent(QEvent* event);
+QSTMGESTURELIB_EXPORT bool qstmIsTouchEvent(QEvent* event);
+QSTMGESTURELIB_EXPORT bool qstmIsContextMenuEvent(QEvent* event);
 
 class QSTMGESTURELIB_EXPORT QStm_GestureEvent : public QEvent
 {
 public:	
 	QStm_GestureEvent();
 	virtual ~QStm_GestureEvent();
-	static QEvent::Type stmGestureEventType() { return static_cast<QEvent::Type>(QStmGestureEventType); }
+	static QEvent::Type stmGestureEventType();
 };
 
 
+class QSTMGESTURELIB_EXPORT QStm_GestureEventFilter : public QObject
+{
+public:
+    QStm_GestureEventFilter() {}
+    virtual ~QStm_GestureEventFilter() {}
+    static  QStm_GestureEventFilter* instance();
+    bool eventFilter(QObject* receiver, QEvent* event);
+    bool event(QEvent* event);
+    bool sendGraphicsSceneMouseEvent(QEvent* event, QGraphicsObject* go);
+
+
+private:
+    static QStm_GestureEventFilter* m_instance;
+};
+
+
+
 #endif /* QSTMGESTUREEVENT_H_ */
--- a/qstmgesturelib/qstmgesturelib.pro	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgesturelib.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -24,7 +24,7 @@
 INCLUDEPATH += qstmfilelogger
 INCLUDEPATH += recognisers
 
-ROOT_DIR = $$PWD/../..
+ROOT_DIR = $$PWD/..
 include($$ROOT_DIR/browserui.pri)
 
 QT += core 
@@ -36,6 +36,7 @@
     recognisers/qstmupdowngesturerecogniser.h \
     recognisers/qstmunknowngesturerecogniser.h \
     recognisers/qstmtapgesturerecogniser.h \
+    recognisers/qstmmaybetapgesturerecogniser.h \
     recognisers/qstmreleasegesturerecogniser.h \
     recognisers/qstmpinchgesturerecogniser.h \
     recognisers/qstmpangesturerecogniser.h \
@@ -59,14 +60,16 @@
     qstmtimerinterface.h \
     qstmstateengineconfig.h \
     qstmstateengine.h \
-    qstmfilelogger/qstmfilelogger.h
-
+    qstmfilelogger/qstmfilelogger.h \
+    uitimer.h
+    
 SOURCES += recognisers/qstmtouchgesturerecogniser.cpp \
     qstmgestureapi.cpp \
     recognisers/qstmzoomgesturerecogniser.cpp \
     recognisers/qstmupdowngesturerecogniser.cpp \
     recognisers/qstmunknowngesturerecogniser.cpp \
     recognisers/qstmtapgesturerecogniser.cpp \
+    recognisers/qstmmaybetapgesturerecogniser.cpp \
     recognisers/qstmreleasegesturerecogniser.cpp \
     recognisers/qstmpinchgesturerecogniser.cpp \
     recognisers/qstmpangesturerecogniser.cpp \
@@ -95,55 +98,20 @@
 
 CONFIG += dll
 
-#isEmpty(BEDROCK_OUTPUT_DIR): {
-#    CONFIG(release, debug|release):BEDROCKSETTINGSLIB_OUTPUT_DIR=$$PWD/../../../../WrtBuild/Release
-#    CONFIG(debug, debug|release):BEDROCKSETTINGSLIB_OUTPUT_DIR=$$PWD/../../../../WrtBuild/Debug
-#} else {
-#    BEDROCKSETTINGSLIB_OUTPUT_DIR = $$BEDROCK_OUTPUT_DIR
-#}
-
-GESTLIB_OUTPUT_DIR = $$ROOT_DIR/app/browser/qstmgesturelib/output
-OBJECTS_DIR = $$GESTLIB_OUTPUT_DIR/qstmgesturelib/tmp
-DESTDIR = $$GESTLIB_OUTPUT_DIR/bin
-MOC_DIR = $$GESTLIB_OUTPUT_DIR/qstmgesturelib/tmp
-RCC_DIR = $$GESTLIB_OUTPUT_DIR/qstmgesturelib/tmp
-TEMPDIR = $$GESTLIB_OUTPUT_DIR/qstmgesturelib/build
-
-
-
-
 symbian: {
-#INCLUDEPATH += /epoc32/include/oem/tgfw
-#EXPORT_DIR += /epoc32/include/oem/tgfw
-#EXPORT_FILES += qstmgestureapi.h \
-#                qstmgesturelistener_if.h \
-#                qstmgestureengine_if.h \
-#                qstmgesture_if.h \
-#                qstmutils.h \
-#                qstmuievent_if.h \
-#                qstmgesturedefs.h \
-#                qstmgestureevent.h \
-#                qstmfilelogger/qstmfilelogger.h
-
-
-
-#        for(exp_file, EXPORT_FILES) {
-#            BLD_INF_RULES.prj_exports += "$${exp_file}   $${EXPORT_DIR}/$$basename(exp_file)" 
-#        }
-
     #FIXME: These capabilities are way overkill
     TARGET.EPOCALLOWDLLDATA=1
-    TARGET.CAPABILITY = All -TCB -DRM -AllFiles 
+    TARGET.CAPABILITY = All -TCB -DRM 
     # NOTE: This is an not an OFFICIAL UID3
     TARGET.UID3 = 0x200267D7
     TARGET.VID = VID_DEFAULT
     
-    LIBS += -lcone
+    LIBS += -lcone -lws32
 
-    qstmgesturelib.sources = qstmgesturelib.dll
-    qstmgesturelib.path = /sys/bin
-    DEPLOYMENT += qstmgesturelib
+    DEFINES += ADVANCED_POINTER_EVENTS
+
 }
 
 
+
 symbian:MMP_RULES += SMPSAFE
--- a/qstmgesturelib/qstmstateengine.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmstateengine.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -585,11 +585,11 @@
     {
         QStm_HwEvent* hwe = m_dragPoints[m_dragPoints.count() - 1];
         QPoint delta = m_hwe.m_position - hwe->m_position; 
-        inside = (ABS(delta.x()) <= m_config->m_moveTolerance.x() / 2) &&
-                 (ABS(delta.y()) <= m_config->m_moveTolerance.y() / 2);
+        inside = (ABS(delta.x()) <= m_config->m_moveTolerance.x()) &&
+                 (ABS(delta.y()) <= m_config->m_moveTolerance.y());
         if (m_config->m_enableLogging) 
         {
-            LOGARG("insideMoveThreshold: delta(%d, %d), inside == %d", delta.x(), delta.y(), inside); LOGFLUSH;
+            LOGARG("insideMoveThreshold: delta(%d, %d), inside == %d", delta.x(), delta.y(), inside);
         }
     }
     return inside;
@@ -731,10 +731,6 @@
     m_wasFiltered = false ;
     QStm_UiEvent* cue = createUIEvent(qstmUiEventEngine::ERelease, m_uiEventXY) ;
     m_config->m_uiEventSender->addEvent(cue) ;
-    if (m_config->m_enableLogging)
-    {
-        LOGFLUSH ;
-    }
 }
 
 
--- a/qstmgesturelib/qstmstateengine.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmstateengine.h	Fri Oct 15 17:30:59 2010 -0400
@@ -58,10 +58,11 @@
     QTime   m_time ;
     void*   m_target ;
 	int	    m_pointerNumber ;
+	unsigned int    m_modifiers;
 };
 
 
-class QStm_StateEngine : public QObject
+class QStm_StateEngine
 {
 public:
     /**
@@ -178,7 +179,7 @@
 
 };
 
-class QStm_UiEventSender: public QObject
+class QStm_UiEventSender//: public QObject
 {
 public:
     enum EventSenderState
--- a/qstmgesturelib/qstmstateengineconfig.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmstateengineconfig.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -74,7 +74,10 @@
 
 void QStm_StateEngineConfiguration::setMoveTolerance(long fingersize_mm)
 {
-    setTolerance(fingersize_mm, m_moveTolerance, m_touchAreaShape);
+    //setTolerance(fingersize_mm, m_moveTolerance, m_touchAreaShape);
+   long px = QStm_Utils::mm2Pixels(fingersize_mm);
+   m_moveTolerance.setX(px);
+   m_moveTolerance.setY(px);
 }
 
 QStm_AreaShape QStm_StateEngineConfiguration::getTouchAreaShape()
--- a/qstmgesturelib/qstmstateengineconfig.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmstateengineconfig.h	Fri Oct 15 17:30:59 2010 -0400
@@ -32,10 +32,10 @@
 class QStm_UiEventSender;
 
 
-class QStm_StateEngineConfiguration : public QObject
+class QStm_StateEngineConfiguration
 {
 public:
-	QStm_StateEngineConfiguration() ;
+    QStm_StateEngineConfiguration() ;
     void construct();
     ~QStm_StateEngineConfiguration() ;
 
--- a/qstmgesturelib/qstmstatemachine.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmstatemachine.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -37,6 +37,11 @@
 #include <X11/Xlib.h>
 #endif
 
+#if defined(Q_WS_WIN)
+#include <windows.h>
+#include <winuser.h>
+#endif
+
 using namespace qstmUiEventEngine ;
 
 //int pointBufferTimerCB(TAny* prt);
@@ -65,9 +70,12 @@
 {
     m_WasMessageFiltered = false ;
     m_wseventmonitoringenabled = false ; // NB: enabled only if really used by application
-    m_loggingenabled = false ;
+    m_loggingenabled = true ;
     m_capacitiveup = false ;
     m_adjustYposition = false ;
+    m_dblClickEnabled = false;
+    m_currentNativeWin = NULL;
+    m_widget = 0;
     //m_pointBuffer = NULL;
     init();
 }
@@ -102,9 +110,9 @@
     {
         m_impl[i] = new QStm_StateEngine(m_config, this, i) ;
         
-        m_holdTimer[i] = new QStm_CallbackTimer(this, &qstmUiEventEngine::QStm_StateMachine::handleholdTimer, 0, i, true);
-        m_touchTimer[i] = new QStm_CallbackTimer(this, &qstmUiEventEngine::QStm_StateMachine::handletouchTimer, 0, i, true);
-        m_suppressTimer[i] = new QStm_CallbackTimer(this, &qstmUiEventEngine::QStm_StateMachine::handlesuppressTimer, 0, i, true);
+        m_holdTimer[i] = new QStm_CallbackTimer(this, &qstmUiEventEngine::QStm_StateMachine::s_handleholdTimer, 0, i, true);
+        m_touchTimer[i] = new QStm_CallbackTimer(this, &qstmUiEventEngine::QStm_StateMachine::s_handletouchTimer, 0, i, true);
+        m_suppressTimer[i] = new QStm_CallbackTimer(this, &qstmUiEventEngine::QStm_StateMachine::s_handlesuppressTimer, 0, i, true);
         /*
         m_holdTimer[i] = new QStm_CallbackTimer(this, SLOT(handleholdTimer(int)), 0, i, true);
         m_touchTimer[i] = new QStm_CallbackTimer(this, SLOT(handletouchTimer(int)), 0, i, true);
@@ -130,6 +138,10 @@
     return m_WasMessageFiltered ;
 }
 
+bool QStm_StateMachine::wasLastMessageFiltered()
+{
+    return m_WasMessageFiltered;
+}
 
 bool QStm_StateMachine::wasLastMessageFiltered(int aPointerNumber)
 {
@@ -305,11 +317,16 @@
         break ;
     }
     case QStm_PlatformPointerEvent::EDrag:
+    case QStm_PlatformPointerEvent::EMove:
     {
         event.m_type = qstmUiEventEngine::EDrag ;
         break ;
     }
     }
+    // TODO handle these events too with some kind of dummy event (or there will be a crash if they happen)
+    //          EButtonRepeat,
+    //          ESwitchOn,
+
 }
 
 
@@ -367,7 +384,7 @@
 {
     QStm_StateEngine* engine = m_impl[pointerNumber];
     createTimerEvent(engine->initEvent(), qstmUiEventEngine::ETouchTimer) ;
-    engine->handleStateEvent() ;
+    m_WasMessageFiltered = engine->handleStateEvent() ;
 }
 
 void QStm_StateMachine::canceltouchTimer(int pointerNumber)
@@ -391,9 +408,11 @@
     bool isPointerEvent = false;
 #if defined(Q_WS_X11)
     QStm_PlatformPointerEvent platPointerEvent;
+    unsigned long eventTime = -1;
     switch (platEvent->type) {
         case ButtonPress:
         {
+            eventTime = platEvent->xbutton.time;
             switch (platEvent->xbutton.button) {
                 case Button1:
                 {
@@ -410,12 +429,14 @@
                     platPointerEvent.m_type = QStm_PlatformPointerEvent::EButton3Down;
                     break;
                 }
+
             }
             isPointerEvent = true;
             break;
         }
         case ButtonRelease:
         {
+            eventTime = platEvent->xbutton.time;
             switch (platEvent->xbutton.button) {
                 case Button1:
                 {
@@ -438,6 +459,7 @@
         }
         case MotionNotify:
         {
+            eventTime = platEvent->xmotion.time;
             platPointerEvent.m_type = QStm_PlatformPointerEvent::EMove;
             isPointerEvent = true;
             break;
@@ -448,13 +470,14 @@
         QWidget* widget = QWidget::find((WId)platEvent->xany.window);
 
         platPointerEvent.m_target = widget;
-        int mds = platEvent->xbutton.time;
+
+        int mds = eventTime;
         int msec = mds % 1000;
         int sec =  (mds / 1000) % 60;
         int hr = mds / (1000 * 3600);
         int min = (mds % (1000 * 3600)) / 60000;
 
-        platPointerEvent.m_time = QTime(hr, min, sec, msec);
+        platPointerEvent.m_time = QTime::currentTime(); //QTime(hr, min, sec, msec);
         platPointerEvent.m_pointerNumber = 0;
         platPointerEvent.m_position = QPoint(platEvent->xbutton.x,
                                              platEvent->xbutton.y);
@@ -465,6 +488,58 @@
     return isPointerEvent;
 }
 
+bool QStm_StateMachine::handleWinPlatformEvent(const void* platEvent)
+{
+    bool ret = false;
+#ifdef Q_OS_WIN
+    struct tagMSG* msg = (struct tagMSG*)platEvent;
+    QStm_PlatformPointerEvent platPointerEvent;
+
+    switch(msg->message) {
+        case WM_LBUTTONDOWN:
+            platPointerEvent.m_type = QStm_PlatformPointerEvent::EButton1Down;
+            break;
+        case WM_MBUTTONDOWN:
+            platPointerEvent.m_type = QStm_PlatformPointerEvent::EButton2Down;
+            break;
+        case WM_RBUTTONDOWN:
+            platPointerEvent.m_type = QStm_PlatformPointerEvent::EButton3Down;
+            break;
+//        case WM_XBUTTONDOWN:
+//            break;
+        case WM_LBUTTONUP:
+            platPointerEvent.m_type = QStm_PlatformPointerEvent::EButton1Up;
+            break;
+        case WM_MBUTTONUP:
+            platPointerEvent.m_type = QStm_PlatformPointerEvent::EButton2Up;
+            break;
+        case WM_RBUTTONUP:
+            platPointerEvent.m_type = QStm_PlatformPointerEvent::EButton3Up;
+            break;
+//        case WM_XBUTTONUP:
+//            break;
+        case WM_MOUSEMOVE:
+            platPointerEvent.m_type = QStm_PlatformPointerEvent::EMove;
+            break;
+        default:
+            return false;
+    }
+
+    ret = true;
+    QWidget* widget = QWidget::find((WId)msg->hwnd);
+
+    platPointerEvent.m_target = widget;
+
+    platPointerEvent.m_time = QTime::currentTime(); //QTime(hr, min, sec, msec);
+    platPointerEvent.m_pointerNumber = 0;
+    platPointerEvent.m_position = QPoint(LOWORD(msg->lParam), HIWORD(msg->lParam));
+
+    handleStateEvent(platPointerEvent);
+#endif // Q_OS_WIN
+    return ret;
+}
+
+
 bool QStm_StateMachine::handleSymbianPlatformEvent(const QSymbianEvent* platEvent)
 {
     bool ret = false;
@@ -477,9 +552,18 @@
 		QStm_PlatformPointerEvent platPointerEvent;
 		
 		if (wse->Type() == EEventPointer) {
-		    QWidget* widget = QWidget::find(ctrl);
-		    ret = (widget != NULL);
-			TPointerEvent* tpe = wse->Pointer(); 
+		    if (static_cast<CCoeControl*>(m_currentNativeWin) != ctrl) {
+		        m_currentNativeWin = ctrl;
+		        m_widget = QWidget::find(ctrl);
+		    }
+		    ret = (m_widget != NULL);
+			TPointerEvent* tpe = wse->Pointer();
+            if (m_dblClickEnabled && (tpe->iModifiers & EModifierDoubleClick)) {
+                // We enabled platform double click so just
+                // return without filtering. Obviously Double Tap won't be recognized. 
+	            return false;  
+	        }
+
 			 // For Symbian it's one-to-one correspondence
 			platPointerEvent.m_type = static_cast<QStm_PlatformPointerEvent::PEType>(tpe->iType); 
 			platPointerEvent.m_modifiers = tpe->iModifiers;
@@ -492,7 +576,7 @@
 		        platPointerEvent.m_pointerNumber = tadvp->PointerNumber() ;
 		    }
 #endif
-		    platPointerEvent.m_target = widget;
+		    platPointerEvent.m_target = m_widget;
 		    int h = wse->Time().DateTime().Hour();
 		    int m = wse->Time().DateTime().Minute();
 		    int s = wse->Time().DateTime().Second();
@@ -500,7 +584,7 @@
 		    QTime time(h, m, s, ms);
 		    
 		    platPointerEvent.m_time = time;
-		    handleStateEvent(platPointerEvent);
+		    ret = handleStateEvent(platPointerEvent);
 		}
 	}
 #endif
@@ -621,4 +705,8 @@
     return KMaxNumberOfPointers ;
 }
 
+void QStm_StateMachine::enableDblClick(bool enable)
+{
+    m_dblClickEnabled = enable ;
+}
 
--- a/qstmgesturelib/qstmstatemachine.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmstatemachine.h	Fri Oct 15 17:30:59 2010 -0400
@@ -46,9 +46,8 @@
 class QStm_StateEngineConfiguration;
 
 
-class QStm_StateMachine : public QObject, public QStm_TimerInterfaceIf, public QStm_StateMachineIf
+class QSTMGESTURELIB_EXPORT QStm_StateMachine : public QStm_TimerInterfaceIf, public QStm_StateMachineIf
 {
-	Q_OBJECT
 public:
     virtual QRect getTouchArea(int pointerNumber) ;
     virtual void setTouchTimeArea(long fingersize_mm) ;
@@ -70,11 +69,12 @@
     virtual bool addUiEventObserver(QStm_UiEventObserverIf* observer) ;
     virtual bool removeUiEventObserver(QStm_UiEventObserverIf* observer) ;
     virtual bool wasLastMessageFiltered(int pointerNumber) ;
+    virtual bool wasLastMessageFiltered() ;
     virtual void enableCapacitiveUp(bool enable) ;
     virtual void enableLogging(bool aEnable) ;
     virtual void enableYadjustment(bool aEnable) ;
     virtual int getNumberOfPointers() ; 
-    
+    virtual void enableDblClick(bool aEnable) ;
     /*
     virtual void setPointerBuffer(TPoint* aBufferPtr, int aBufSize) { m_pointBuffer = aBufferPtr; m_pointBufferSize = aBufSize; }
     
@@ -90,6 +90,7 @@
     bool handleSymbianPlatformEvent(const QSymbianEvent* platEvent);     
 
     bool handleX11PlatformEvent(const XEvent* platEvent);
+    bool handleWinPlatformEvent(const void* platEvent);
 
     bool handleStateEvent(const QStm_PlatformPointerEvent& platPointerEvent) ;
     /*!
@@ -151,24 +152,20 @@
     bool m_loggingenabled ;
     bool m_capacitiveup ;
     bool m_pointerBufferSupported;
-    
+    bool m_dblClickEnabled;    
 
-    //TPoint*   m_pointBuffer;
-    //int       m_pointBufferSize;
-    //int       m_pointBufferRetrieved;
-    //int       m_currentPointBuffIdx;
-    //CCoeControl*  m_destination;
-    //CPeriodic*  m_pointBufferTimer;
-    //RArray<TPoint> m_pointBufferPoints;
     
     int m_3mminpixels ;
     bool m_adjustYposition ;
+    void* m_currentNativeWin;
+    QWidget* m_widget;
     // Use same naming scheme with the timers, and variables and methods
     // using macro expansion tricks (with multitouch support starts to look quite ugly):
 #define DECLARE_TIMER(x) \
             void start##x##Timer(int aPointerNumber) ;\
             QStm_CallbackTimer* m_##x##Timer[KMaxNumberOfPointers] ;\
             void handle##x##Timer(int aPointerNumber) ;\
+            static void s_handle##x##Timer(QStm_StateMachine* obj, int aPointerNumber) { obj->handle##x##Timer(aPointerNumber); } \
             void cancel##x##Timer(int aPointerNumber)
 
 //public slots:    
--- a/qstmgesturelib/qstmuievent.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmuievent.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -44,10 +44,10 @@
     QStm_UiEventCode code,
     const QPoint& start, const QPoint& xy, const QPoint& previousXY,
     bool timerExpired, void* target, long interval,
-    int index, QTime timestamp) :
+    int index, QTime timestamp, unsigned int modifiers) :
     m_code(code), m_start(start), m_XY(xy), m_previousXY(previousXY),
     m_statetransition(interval), m_target(target), m_timerExpired(timerExpired),
-    m_index(index), m_previousEvent(NULL), m_timestamp(timestamp)
+    m_index(index), m_previousEvent(NULL), m_timestamp(timestamp), m_modifiers(modifiers)
 {
 }
 
@@ -161,7 +161,7 @@
     QEvent::Type type = QEvent::None;
     switch (m_code) {
         case ETouch:
-        case EHold:    
+        //case EHold:
         {
             type = QEvent::MouseButtonPress;
             break;
--- a/qstmgesturelib/qstmuievent.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmuievent.h	Fri Oct 15 17:30:59 2010 -0400
@@ -49,7 +49,7 @@
     virtual void  setSpeedVec(QPointF speedVec) { m_speedVec = speedVec; }
     virtual QEvent::Type  mapToMouseEventType();
     virtual QEvent::Type  mapToTouchEventType();
-
+    virtual unsigned int  getModifiers() { return m_modifiers; }
     
     // for testing...
     virtual void logSpeed() const ;
@@ -58,7 +58,7 @@
         QStm_UiEventCode code,
         const QPoint& start, const QPoint& xy, const QPoint& previousXY,
         bool timerExpired, void* target, long interval,
-        int index, QTime timestamp) ;
+        int index, QTime timestamp, unsigned int modifiers = 0) ;
 
     ~QStm_UiEvent() ;
     /*!
@@ -78,6 +78,7 @@
     int    m_index ;
     QStm_UiEvent* m_previousEvent ;
     QTime  m_timestamp ;
+    unsigned int    m_modifiers;
 };
 }
 
--- a/qstmgesturelib/qstmuievent_if.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmuievent_if.h	Fri Oct 15 17:30:59 2010 -0400
@@ -27,7 +27,7 @@
 
 namespace qstmUiEventEngine
 {
-static const int KMaxNumberOfPointers(5) ;  // How many of these should we have in multi-touch case
+static const int KMaxNumberOfPointers(2) ;  // How many of these should we have in multi-touch case
 
 enum QStm_UiEventCode
 {
@@ -62,8 +62,13 @@
 			EDrag,
 			EMove,
 			EButtonRepeat,
-			ESwitchOn,
+			ESwitchOn
 			};
+		enum Modifiers {
+		    EModifierLeftCtrl=0x00000020,       /**< Left Control (Ctrl) key.*/
+		    EModifierRightCtrl=0x00000040,      /**< Right Control (Ctrl) key.*/
+		    EModifierCtrl=0x00000080,           /**< Single Control (Ctrl) key.*/
+		};
 		PEType          m_type;
 		unsigned int    m_modifiers;
 		QPoint          m_position;
@@ -165,6 +170,7 @@
     virtual void setSpeedVec(QPointF speedVec) = 0;
     virtual QEvent::Type  mapToMouseEventType() = 0;
     virtual QEvent::Type  mapToTouchEventType() = 0;
+    virtual unsigned int  getModifiers() = 0;
 
 };
 
--- a/qstmgesturelib/qstmuieventsender.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmuieventsender.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -157,10 +157,12 @@
         QStm_UiEvent* next = dynamic_cast<QStm_UiEvent*>(top->previousEvent()) ;
         if (next != 0 && next->code() == qstmUiEventEngine::EMove)
         {
-            // leave only the topmost to the stack
-            top->setPrevious(0) ;
-            delete next ;
+            QStm_UiEvent* nextPrev = dynamic_cast<QStm_UiEvent*>(next->previousEvent()) ;
+            if (nextPrev != 0 && nextPrev->code() == qstmUiEventEngine::EMove) {
+                next->setPrevious(0) ;
+                delete nextPrev ;
         }
     }
+    }
 }
 
--- a/qstmgesturelib/qstmutils.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmutils.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -32,7 +32,7 @@
 
 QRect QStm_Utils::toleranceRectMm( const QPoint& centerPoint, int size_mm )
 {
-	long toleranceLength = mm2Pixels(size_mm) / 2;
+	long toleranceLength = mm2Pixels(size_mm);
 	return toleranceRectPx(centerPoint, toleranceLength);
 }
 
@@ -48,7 +48,8 @@
 long QStm_Utils::mm2Pixels(long mm)
 {
 	//return Twips2Pixels(mm * KTwipsInMm);
-	return mm * QApplication::desktop()->height() / QApplication::desktop()->heightMM();
+    qreal r = QApplication::desktop()->height() / QApplication::desktop()->heightMM();
+	return mm * r;
 }
 
 long QStm_Utils::inches2Pixels(double inches)
--- a/qstmgesturelib/recognisers/qstmedgescrollgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmedgescrollgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -91,7 +91,7 @@
                 else  if (p.x() > m_area.x() + m_area.width() - m_rangesizeInPixels)
                     scrolltype = EEdgeScrollRight ;   // if X is big enough, it is always right
                 // issue the edge scroll gesture
-                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, scrolltype, puie) ;
+                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, puie->timestamp(), scrolltype, puie) ;
                 pgest.setTarget(puie->target());
                 // Call the listener to inform that a Tap has occurred...
                 m_listener->gestureEnter(pgest) ;
--- a/qstmgesturelib/recognisers/qstmedgescrollgesturerecogniser.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmedgescrollgesturerecogniser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -34,7 +34,7 @@
  * QStm_EdgeScrollGestureRecogniser handles edge scroll gesture: Hold event near the edges of the window
  *
  */
-class QStm_EdgeScrollGestureRecogniser : public QObject, public QStm_GestureRecogniser
+class QStm_EdgeScrollGestureRecogniser : public QStm_GestureRecogniser
 {
 public:
     static const QStm_GestureUid KUid = EGestureUidEdgeScroll;
--- a/qstmgesturelib/recognisers/qstmflickgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmflickgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -58,7 +58,7 @@
         if (m_powner == puie->target() && eventCode == qstmUiEventEngine::ERelease)
         {
             if (m_loggingenabled) {
-                LOGARG("QStm_FlickGestureRecogniser: 0x%x ERelease: num %d code %d, %d", 
+                LOGARG("QStm_FlickGestureRecogniser: 0x%x ERelease: num %d pos: [%d, %d]", 
                 		this, countOfEvents, puie->currentXY().x(), puie->currentXY().y());
             }
             // Check if the speed before release was fast enough for flick
@@ -66,7 +66,19 @@
             if (puieprev && puieprev->code() == qstmUiEventEngine::EMove) {
                 using qstmUiEventEngine::QStm_UiEventSpeed;
 
+                QPoint pos = puieprev->currentXY();
+                QPoint prevPos = puieprev->previousXY();
                 float thespeed = puieprev->speed() ;
+                if (thespeed == 0.0f && countOfEvents > 2) {
+                if (m_loggingenabled) {
+                        LOGTXT("QStm_FlickGestureRecogniser: speed is 0.0. Trying to get prev speed!");
+                    }
+                    // trye to get speed from puie->previousEvent()->previousEvent()
+                    puieprev = puieprev->previousEvent();
+                    if (puieprev && puieprev->code() == qstmUiEventEngine::EMove) {
+                        thespeed = puieprev->speed() ;
+                    }
+                }
                 if (m_loggingenabled) {
                     LOGARG("QStm_FlickGestureRecogniser: prev speed: %f (limit: %f)", double(thespeed), double(m_speed)) ;
                 }
@@ -78,8 +90,9 @@
                     // issue the flick gesture using the TDirectionalGesture (it has the speed and direction)
                     qstmGesture::QStm_DirectionalGesture pgest(
                             KUid,
-                            puieprev->currentXY(),
-                            puieprev->previousXY(),
+                            pos,
+                            prevPos,
+                            puie->timestamp(),
                             &speedIf,
                             m_loggingenabled);
                     pgest.setTarget(puie->target());
--- a/qstmgesturelib/recognisers/qstmhoveringgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmhoveringgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -82,6 +82,7 @@
                                         KUid,
                                         puie->currentXY(),
                                         puie->previousXY(),
+                                        puie->timestamp(),
                                         &speedIf,
                                         m_loggingenabled);
 
@@ -109,6 +110,7 @@
                                         KUid,
                                         puie->currentXY(),
                                         puie->previousXY(),
+                                        puie->timestamp(),
                                         puie,
                                         m_loggingenabled);
                 pgest.setTarget(puie->target());
@@ -135,6 +137,7 @@
                     KUid,
                     puie->currentXY(),
                     puie->previousXY(),
+                    puie->timestamp(),
                     puie,
                     m_loggingenabled);
     pgest.setTarget(puie->target());
--- a/qstmgesturelib/recognisers/qstmleftrightgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmleftrightgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -28,7 +28,7 @@
 using namespace qstmGesture ;
 
 QStm_LeftrightGestureRecogniser::QStm_LeftrightGestureRecogniser(QStm_GestureListenerIf* listener) : 
-		                         QStm_GestureRecogniser(listener)
+		                         QStm_GestureRecogniser(listener), m_axisLock(0.5)
 {
 }
 
@@ -62,9 +62,22 @@
                 // Is it leftright gesture in our window?
                 const QPoint& p = puie->currentXY();
                 QPoint dp = p - puie->previousXY();
-                if (ABS(dp.x()) > ABS(dp.y())) {
+                //double dist;
+                //SQRT(dist, (qreal)(dp.x() * dp.x() + dp.y() * dp.y()));
+                if ( (qAbs(dp.x()) > qAbs(dp.y())) && 
+                     ((qreal)qAbs(dp.y()) / (qreal)qAbs(dp.x()) < m_axisLock) ) {
                     state = EGestureActive;
-                    qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.x(), puie) ;
+                    //qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.x(), puie) ;
+                    QPoint curPos(puie->currentXY().x(), 0);
+                    QPoint prevPos(puie->previousXY().x(), 0);
+                    qstmGesture::QStm_DirectionalGesture pgest(
+                                                               KUid,
+                                                               puie->currentXY(),
+                                                               puie->previousXY(),
+                                                               puie->timestamp(),
+                                                               puie,
+                                                               m_loggingenabled); 
+                                        
                     pgest.setTarget(puie->target());
                     pgest.setName(QString("Leftlight")) ;
                     // Call the listener to inform that a Leftright has occurred...
@@ -83,7 +96,7 @@
     using qstmUiEventEngine::QStm_UiEventSpeed;
     const QPoint& p = puie->currentXY();
     QPoint dp = p - puie->previousXY();
-    qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.x(), puie) ;
+    qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, puie->timestamp(), dp.x(), puie) ;
     pgest.setTarget(puie->target());
     m_listener->gestureExit(pgest) ;
     m_state = ENotMyGesture;
--- a/qstmgesturelib/recognisers/qstmleftrightgesturerecogniser.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmleftrightgesturerecogniser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -40,6 +40,10 @@
 
     virtual QStm_GestureUid gestureUid() const { return KUid; }
     QStm_LeftrightGestureRecogniser(QStm_GestureListenerIf* listener) ;
+    void setAxisLockThreshold(qreal axisLock) { m_axisLock = axisLock; }
+
+private:
+    qreal m_axisLock;
 };
 
 }
--- a/qstmgesturelib/recognisers/qstmlongpressgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmlongpressgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -51,11 +51,14 @@
         const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
         int countOfEvents = puie->countOfEvents();
         qstmUiEventEngine::QStm_UiEventCode eventCode = puie->code();
-
+        const qstmUiEventEngine::QStm_UiEventIf* puieprev = puie->previousEvent() ;
+        
         if (m_loggingenabled) {
             LOGARG("QStm_LongPressGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
         }
-        if (puie->target() == m_powner && eventCode == qstmUiEventEngine::EHold) { 
+        
+        bool dontIgnore = (puieprev == NULL) || (puieprev->code() != qstmUiEventEngine::EMove);
+        if (puie->target() == m_powner && eventCode == qstmUiEventEngine::EHold && dontIgnore) {
         	// The last one is EHold, look if it is near our borders
             const QPoint& p = puie->currentXY() ;
             if (m_loggingenabled) {
@@ -66,7 +69,7 @@
             if (m_area.contains(p)) {
                 state = EGestureActive ;
                 // issue the long press gesture
-                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, 0, puie) ; // TODO: speed is 0?
+                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, puie->timestamp(), 0, puie) ; // TODO: speed is 0?
                 pgest.setTarget(puie->target());
                 // Call the listener to inform that the gesture has occurred...
                 m_listener->gestureEnter(pgest) ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qstmgesturelib/recognisers/qstmmaybetapgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not, 
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+#include "qstmgenericsimplegesture.h"
+#include "qstmmaybetapgesturerecogniser.h"
+#include "qstmuievent_if.h"
+#include "qstmutils.h"
+#include "qstmfilelogger.h"
+
+using namespace qstmGesture ;
+using namespace qstmUiEventEngine;
+
+QStm_MaybeTapGestureRecogniser::QStm_MaybeTapGestureRecogniser(QStm_GestureListenerIf* listener) :
+                                        QStm_GestureRecogniser(listener)
+{
+    m_powner = listener->getOwner() ;
+    if (listener) {
+        addTapListener(listener, m_powner) ;
+    }
+    m_gestureEnabled = true;
+    m_numOfActiveStreams = 0;
+
+}
+
+QStm_MaybeTapGestureRecogniser::~QStm_MaybeTapGestureRecogniser()
+{
+    m_tapListeners.clear() ;
+    m_tapListenerWindows.clear() ;
+}
+
+QStm_GestureRecognitionState QStm_MaybeTapGestureRecogniser::recognise(int numOfActiveStreams,
+                              QStm_GestureEngineIf* pge)
+{
+    QStm_GestureRecognitionState state = m_state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+    
+    // Look at the events to see if it looks like a tap or double tap
+    if (numOfActiveStreams == 1) {
+        m_numOfActiveStreams = numOfActiveStreams; 
+        // Then look at the event stream, it has to be tap and release
+        const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents() ;
+        qstmUiEventEngine::QStm_UiEventCode eventCode = puie->code() ;
+
+        if (m_loggingenabled) {
+            LOGARG("QStm_MaybeTapGestureRecogniser: event: %s, countOfEvents: %d, code: %d", 
+                   event_name(eventCode), countOfEvents, eventCode);
+        }
+        void* target = puie->target();
+        
+        if (countOfEvents == 2) { // Do we have touch and release in the stream, check if there are two events
+
+            // Then look at the events to see if they are suitable for us
+            if (target && eventCode == qstmUiEventEngine::ERelease) {// The last one is release
+
+                qstmUiEventEngine::QStm_UiEventIf* puieFirst = puie->previousEvent();
+
+                if (puieFirst != NULL && 
+                    (eventCode = puieFirst->code()) == qstmUiEventEngine::ETouch && // is the first one ETouch
+                    isPointClose(puie->currentXY(), puie->previousXY())) { // if system failed to deliver move event between 
+                	                                                       // down and up we can get tap with two points
+                	                                                       // too far from each other, so check for it
+
+                    if (m_loggingenabled) {
+                        LOGARG("QStm_MaybeTapGestureRecogniser: 0x%x TAP: countOfEvents: %d, event: %s", this, countOfEvents, event_name(eventCode));
+                    }
+                    
+                    m_firstTapXY = puieFirst->currentXY() ;
+                    m_firstTapTarget = target ;
+                    m_firstTapSpeed = puie->speed() ;
+                    int inx = m_tapListenerWindows.indexOf(m_firstTapTarget) ;
+                    if (inx == -1) {
+                        inx = 0;
+                    }
+                    qstmGesture::QStm_GenericSimpleGesture pgest(
+                                        qstmGesture::EGestureUidMaybeTap, 
+                                        m_firstTapXY, 
+                                        puie->timestamp(),
+                                        qstmGesture::ETapTypeSingle, 
+                                        puieFirst) ; // TODO: speed is 0?
+                                    pgest.setTarget(puie->target());
+                                    QStm_GestureListenerIf* plistener = m_tapListeners[inx] ;
+                                    plistener->gestureEnter(pgest) ;
+                }
+            }
+        }
+    }
+    m_state = state;
+    return state;
+}
+
+void QStm_MaybeTapGestureRecogniser::release(QStm_GestureEngineIf* /*ge*/)
+{
+    if (m_loggingenabled) {
+        LOGARG("QStm_MaybeTapGestureRecogniser: 0x%x release, %d %d", this, m_firstTapXY.x(), m_firstTapXY.y());
+    }
+    m_state = ENotMyGesture;
+}
+
+void QStm_MaybeTapGestureRecogniser::enableLogging(bool loggingOn)
+{
+    m_loggingenabled = loggingOn;
+}
+
+void QStm_MaybeTapGestureRecogniser::setOwner(void* owner)
+{
+    m_powner = owner;
+}
+
+
+void QStm_MaybeTapGestureRecogniser::enable(bool enabled)
+{
+    m_gestureEnabled = enabled ;
+}
+
+bool QStm_MaybeTapGestureRecogniser::isEnabled()
+{
+    return m_gestureEnabled ;
+}
+
+void QStm_MaybeTapGestureRecogniser::setTapRange(int rangeInMillimetres)
+{
+    m_rangesizeInPixels = QStm_Utils::mm2Pixels(rangeInMillimetres) ;
+}
+
+bool QStm_MaybeTapGestureRecogniser::isPointClose(const QPoint&  firstPoint, const QPoint& secondPoint)
+{
+    QRect tolerance = QStm_Utils::toleranceRectPx(secondPoint, m_rangesizeInPixels) ;
+    bool aretheyclose = tolerance.contains(firstPoint);
+    return aretheyclose ;
+}
+
+void QStm_MaybeTapGestureRecogniser::addTapListener(QStm_GestureListenerIf* listener, void* listenerOwner)
+{
+    m_tapListeners.append(listener) ;
+    m_tapListenerWindows.append(listenerOwner) ;
+}
+
+void QStm_MaybeTapGestureRecogniser::removeTapListener(QStm_GestureListenerIf* listener, void* /*listenerOwner*/)
+{
+    int inx = m_tapListeners.indexOf(listener) ;
+    if(inx != -1) {
+        m_tapListeners.removeAt(inx) ;
+        m_tapListenerWindows.removeAt(inx) ;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qstmgesturelib/recognisers/qstmmaybetapgesturerecogniser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not, 
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+
+#ifndef QSTMMAYBETAPGESTURERECOGNISER_H_
+#define QSTMAYBEMTAPGESTURERECOGNISER_H_
+
+#include <qstmgestureengine_if.h>
+#include <qstmgesture_if.h>
+#include <qstmgesturelistener_if.h>
+#include "uitimer.h"
+
+namespace qstmGesture
+{
+
+class QStm_MaybeTapGestureRecogniser : public QStm_GestureRecogniser
+{
+	Q_OBJECT
+public:
+    static const QStm_GestureUid KUid = EGestureUidMaybeTap;
+
+    virtual ~QStm_MaybeTapGestureRecogniser();
+
+    virtual QStm_GestureRecognitionState recognise(int numOfActiveStreams, QStm_GestureEngineIf* ge) ;
+    virtual void release(QStm_GestureEngineIf* ge) ;
+    virtual void enable(bool enabled) ;
+    virtual bool isEnabled() ;
+    virtual void setOwner(void* owner) ;
+
+    virtual QStm_GestureUid gestureUid() const { return KUid; }
+
+    void addTapListener(QStm_GestureListenerIf* listener, void* listenerOwner) ;
+    void removeTapListener(QStm_GestureListenerIf* listener, void* listenerOwner) ;
+    virtual void enableLogging(bool loggingOn) ;
+    void setTapRange(int rangeInMillimetres);
+    QStm_MaybeTapGestureRecogniser(QStm_GestureListenerIf* listener) ;
+    
+private:
+    bool m_loggingenabled ;
+    bool isPointClose(const QPoint& firstPoint, const QPoint& secondPoint) ;
+private:
+    void* m_powner ; // The owning control for this gesture
+
+    QPoint m_firstTapXY ;
+    void* m_firstTapTarget ;
+    float m_firstTapSpeed ;
+    bool m_gestureEnabled ;
+    int  m_rangesizeInPixels ;
+    // use simple arrays to store the listeners and corresponding windows
+    QList<QStm_GestureListenerIf*>  m_tapListeners ;
+    QList<void*>                    m_tapListenerWindows ;
+    int                             m_numOfActiveStreams;
+};
+
+} // namespace
+
+#endif /* QSTMTAPGESTURERECOGNISER_H_ */
--- a/qstmgesturelib/recognisers/qstmpangesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmpangesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -53,7 +53,7 @@
             // should we check that all of the events are targeted to our window?
             // currently we only check if the last one is for us and is EMove, then we pan if the speed is OK
             if (m_loggingenabled) {
-            	LOGARG("QStm_PanGestureRecogniser: Got: numer of events %d, event code %d", countOfEvents, eventCode);
+                LOGARG("QStm_PanGestureRecogniser: Got: numer of events %d, event  %s", countOfEvents, event_name(eventCode));
             }
         	
             if (puie->target() == m_powner &&
@@ -67,7 +67,8 @@
                 }
                 
                 // It is pan gesture in our window, handle it, if the speed is inside limits
-                if (speed > m_panningspeedlow && speed < m_panningspeedhigh) {
+                if (speed >= m_panningspeedlow && speed < m_panningspeedhigh && 
+                    (puie->currentXY() != puie->previousXY())) {
                     using qstmUiEventEngine::QStm_UiEventSpeed;
 
                     state = EGestureActive;
@@ -77,6 +78,7 @@
                                     KUid,
                                     puie->currentXY(),
                                     puie->previousXY(),
+                                    puie->timestamp(),
                                     &speedIf,
                                     m_loggingenabled);
                     pgest.setTarget(puie->target());
@@ -85,11 +87,8 @@
                     m_listener->gestureEnter(pgest);
                 }
             }
-            else if (eventCode == qstmUiEventEngine::ERelease) {
-            	LOGARG("QStm_PanGestureRecogniser::recognise: (0x%x) eventCode == ERelease", this);
             }
         }
-    }
     m_state = state;
     return state;
 }
@@ -106,6 +105,7 @@
                     KUid,
                     puie->currentXY(),
                     puie->previousXY(),
+                    puie->timestamp(),
                     &speedIf,
                     m_loggingenabled);
 	pgest.setTarget(puie->target());
--- a/qstmgesturelib/recognisers/qstmpinchgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmpinchgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -131,7 +131,7 @@
                         // the method also updates the m_ddistance
                         difference = adjustPinchMove(m_ddistance, newd) ;
                         // Now we have a pinch gesture with size as details
-                        qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                        qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend, puie->timestamp());
                         pgest.setLogging(m_loggingenabled);
                         pgest.setDetails(&difference) ;
                         pgest.setTarget(puie->target());
@@ -181,7 +181,7 @@
                         m_ddistance = calculateDistance();
                         state = ELockToThisGesture ;    // NOTE: once pinch is started, it will stay until release
                         // create the first pich gesture which does not yet resize anything
-                        qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                        qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend, tstamp);
                         pgest.setTarget(puie->target());
                         pgest.setLogging(m_loggingenabled);
                         pgest.setDetails(0) ;
@@ -226,7 +226,7 @@
             QPoint p2 = puie2->currentXY() ;
             LOGARG("QStm_PinchGestureRecogniser: two streams: %s at [%d,%d], %s at [%d,%d]",
                     qstmUiEventEngine::event_name(eventCode1), p1.x(), p1.y(),
-                    qstmUiEventEngine::event_name(eventCode1), p2.x(), p2.y()
+                    qstmUiEventEngine::event_name(eventCode2), p2.x(), p2.y()
                     ) ;
 
         }
@@ -243,6 +243,8 @@
             	
                 // This is valid pinching start
                 m_pinching = true ;
+                m_isReleased[0] = false;
+                m_isReleased[1] = false;
                 // get the start and end position for the picnhing vector
                 m_pinchstart = puie1->currentXY() ;
                 m_pinchend = puie2->currentXY() ;
@@ -255,10 +257,10 @@
 
                 }
                 // create the first pich gesture which does not yet resize anything
-                qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend, puie2->timestamp());
                 pgest.setLogging(m_loggingenabled);
                 pgest.setDetails(0) ;
-                pgest.setTarget(puie->target());
+                pgest.setTarget(puie1->target());
                 // inform the listener
                 m_listener->gestureEnter(pgest);
             }
@@ -267,8 +269,21 @@
             }
         }
         else  {
-            // We have entered pinching state, lets move one of the points unless it is a release
-            if (eventCode1 == qstmUiEventEngine::ERelease || eventCode2 == qstmUiEventEngine::ERelease) {
+
+            // Keep track of the state of both fingers
+            if (eventCode1 == qstmUiEventEngine::ERelease)
+                m_isReleased[0] = true;
+            else if (eventCode1 == qstmUiEventEngine::ETouch)
+                m_isReleased[0] = false;
+            if (eventCode2 == qstmUiEventEngine::ERelease)
+                m_isReleased[1] = true;
+            else if (eventCode2 == qstmUiEventEngine::ETouch)
+                m_isReleased[1] = false;
+
+            LOGARG("QStm_PinchGestureRecogniser: Checking for released[] %d %d", m_isReleased[0], m_isReleased[1]);
+            // Only if both fingers are "released" are we done pinching
+            if (m_isReleased[0] && m_isReleased[1]) {
+                release(pge);
                 m_pinching = false ;
             }
             else  {
@@ -288,16 +303,23 @@
 
                 }
 
-                qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend, puie2->timestamp());
                 pgest.setLogging(m_loggingenabled);
-                pgest.setDetails(difference) ;
-                pgest.setTarget(puie->target());
+                pgest.setDetails(&difference) ;
+                pgest.setTarget(puie1->target());
                 // inform the listener
                 m_listener->gestureEnter(pgest);
             }
         }
 
     }
+    else if (numOfActiveStreams == 1) {
+        const qstmUiEventEngine::QStm_UiEventIf* puie1 = pge->getUiEvents(0);
+        qstmUiEventEngine::QStm_UiEventCode eventCode1 = puie1->code() ;
+        if (m_pinching && eventCode1 == qstmUiEventEngine::ERelease) {
+            release(pge);
+        }
+    }
 #endif
 
     if (state == ENotMyGesture) {
@@ -306,6 +328,8 @@
         }
         // if it was not our gesture, then the state can not be pinching...
         m_pinching = false ;
+        m_isReleased[0] = true;
+        m_isReleased[1] = true;
     }
     m_state = state;
     
@@ -314,13 +338,18 @@
 
 void QStm_PinchGestureRecogniser::release(QStm_GestureEngineIf* pge)
 {
+    if (m_loggingenabled) {
+            LOGARG("QStm_PinchGestureRecogniser: release. m_pinchstart[%d, %d], m_pinchend[%d, %d]",  
+                m_pinchstart.x(), m_pinchstart.y(), m_pinchend.x(), m_pinchend.y());
+    }
     m_pinching = false ;
     const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
-    qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+    qstmGesture::QStm_TwoPointGesture pgest(KUid, m_pinchstart, m_pinchend, puie->timestamp());
     pgest.setDetails(0) ;
     pgest.setTarget(puie->target());
     m_listener->gestureExit(pgest) ;
     m_state = ENotMyGesture;
+    
 }
 
 
@@ -385,8 +414,8 @@
         float newdiff = previousDistance*0.1f ;
         if (previousDistance > newDistance) newdiff = -newdiff ;
         if (m_loggingenabled) {
-            LOGARG("QStm_PinchGestureRecogniser: adjustPinchMove from %f to %f : was, now %f %f",
-                double(logdiff), double(newdiff), double(previousDistance), double(newDistance));
+            LOGARG("QStm_PinchGestureRecogniser: adjustPinchMove from %f to %f : was %f, now %f, changePercentage %f",
+                double(logdiff), double(newdiff), double(previousDistance), double(newDistance), double(changePercentage));
         }
 
         previousDistance = previousDistance + newdiff ;
@@ -394,8 +423,8 @@
     }
     else {
         if (m_loggingenabled) {
-            LOGARG("QStm_PinchGestureRecogniser: adjustPinchMove from %f to %f : was, now %f %f",
-                double(logdiff), double(diff), double(previousDistance), double(newDistance));
+            LOGARG("QStm_PinchGestureRecogniser: adjustPinchMove from %f to %f : was %f, now %f, changePercentage %f",
+                double(logdiff), double(diff), double(previousDistance), double(newDistance), double(changePercentage));
         }
         previousDistance = newDistance ;  // accept the new value and update the new length
         diff = logdiff ;    // put the original back (this is why the logdiff can not be ABS(diff)!
--- a/qstmgesturelib/recognisers/qstmpinchgesturerecogniser.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmpinchgesturerecogniser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -74,6 +74,7 @@
     bool    m_holdseen ;
     QPoint  m_holdseenAtPos ;
     QTime   m_holdseenAtTime ;
+    bool    m_isReleased[2];
 };
 
 }
--- a/qstmgesturelib/recognisers/qstmreleasegesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmreleasegesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -76,9 +76,9 @@
                 produceGesture = (m_powner == puie->target()) ;  // no area defined, touch detected in the window
             }
             if (produceGesture) {
-                //state = EGestureActive ;
+                state = EGestureActive ;
                 // issue the release gesture using the GenericSimpleGesture
-                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, puie->currentXY());
+                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, puie->currentXY(), puie->timestamp());
                 // Give the gesture a name
                 pgest.setName(QString("Release")) ;
                 pgest.setTarget(puie->target());
--- a/qstmgesturelib/recognisers/qstmtapgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmtapgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -39,12 +39,16 @@
     m_waitingforsecondtap = false ;
     m_gestureEnabled = true ;
     m_ignorefirst = true ;  // by default ignore the first tap
-    connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeoutCallback()));
+    m_timer = UiTimer::New();
+    m_timer->setPriority(300);
+    m_numOfActiveStreams = 0;
+    //connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeoutCallback()));
 }
 
 QStm_TapGestureRecogniser::~QStm_TapGestureRecogniser()
 {
-    m_timer.stop();
+    m_timer->stop();
+    delete m_timer;
     m_tapListeners.clear() ;
     m_tapListenerWindows.clear() ;
     m_doubleTapListeners.clear() ;
@@ -59,16 +63,17 @@
                             (m_waitingforsecondtap) ? EGestureActive :ENotMyGesture;
     // Check if we are enabled or not
     if (!m_gestureEnabled) return state ;
-
+    
     // Look at the events to see if it looks like a tap or double tap
     if (numOfActiveStreams == 1) {
+        m_numOfActiveStreams = numOfActiveStreams; 
         // Then look at the event stream, it has to be tap and release
         const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
         int countOfEvents = puie->countOfEvents() ;
         qstmUiEventEngine::QStm_UiEventCode eventCode = puie->code() ;
 
         if (m_loggingenabled) {
-            LOGARG("QStm_TapGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
+            LOGARG("QStm_TapGestureRecogniser: event: %s, countOfEvents: %d, code: %d", event_name(eventCode), countOfEvents, eventCode);
         }
         void* target = puie->target();
         
@@ -86,7 +91,7 @@
                 	                                                       // too far from each other, so check for it
 
                     if (m_loggingenabled) {
-                        LOGARG("QStm_TapGestureRecogniser: 0x%x TAP: num %d code %d", this, countOfEvents, eventCode);
+                        LOGARG("QStm_TapGestureRecogniser: 0x%x TAP: countOfEvents: %d, event: %s", this, countOfEvents, event_name(eventCode));
                     }
                     // It is tap gesture in our window, handle it
                     state = EGestureActive;
@@ -95,13 +100,17 @@
 
                     if (m_waitingforsecondtap) {
                         m_waitingforsecondtap = false ;
-                        if (m_loggingenabled) {
-                            LOGARG("QStm_TapGestureRecogniser: 0x%x second tap: num %d code %d", this, countOfEvents, eventCode);
-                        }
+                        
                         
-                        m_timer.stop();  // The timer
+                        m_timer->stop();  // The timer
+                        const QPoint& secondPoint = puieFirst->currentXY() ;
+                        if (m_loggingenabled) {
+                            LOGARG("QStm_TapGestureRecogniser: 0x%x second tap: countOfEvents: %d, event: %s, tap1[%d, %d], tap2[%d, %d]", 
+                                this, countOfEvents, event_name(eventCode), 
+                                m_firstTapXY.x(), m_firstTapXY.y(), secondPoint.x(), secondPoint.y());
+                        }
 
-                        const QPoint& secondPoint = puieFirst->currentXY() ;
+                        
                         if (isPointClose(m_firstTapXY, secondPoint)) {
                             // Taps were close enough together, so issue a doubletap
 
@@ -113,6 +122,9 @@
                                 inx = m_doubleTapListenerWindows.indexOf(m_firstTapTarget) ;
                             }
                             // not found, check if the parent is in the listener list
+                            if (m_loggingenabled) {
+                                LOGARG("QStm_TapGestureRecogniser: 0x%x index of target: %d", this, inx);
+                            }
                             if (inx == -1)
                             {
                                 QObject* pc = static_cast<QObject*>(target) ;
@@ -122,11 +134,18 @@
                                     if (inx != -1) break ;
                                 }
                             }
+                            if (inx == -1) {
+                                inx = 0;     // HACK!!!!
+                            }
                             if (inx != -1) {
                                 // Tap gesture
+                                if (m_loggingenabled) {
+                                    LOGARG("QStm_TapGestureRecogniser: 0x%x index of target: %d, DOUBLETAP recognized", this, inx);
+                                }
                                 qstmGesture::QStm_GenericSimpleGesture pgest(
                                     qstmGesture::EGestureUidDoubleTap, 
                                     secondPoint, 
+                                    puie->timestamp(),
                                     qstmGesture::ETapTypeDouble, 
                                     puie) ;
                                 pgest.setTarget(puie->target());
@@ -137,6 +156,9 @@
                         else {
                             // Second tap is too far away, generate just tap
                             // and if configured, also the fist tap is generated
+                            if (m_loggingenabled) {
+                                LOGARG("QStm_TapGestureRecogniser: 0x%x Second tap to far", this);
+                            }
                             if (!m_ignorefirst) {
                                 // do not ignore the first tap, so issue it now using the stored location
                                 // Call the listener to inform that a Tap has occurred, if there was a listener in that window
@@ -146,6 +168,7 @@
                                     qstmGesture::QStm_GenericSimpleGesture pgest(
                                         qstmGesture::EGestureUidTap, 
                                         m_firstTapXY, 
+                                        puieFirst->timestamp(),
                                         qstmGesture::ETapTypeSingle, 
                                         puieFirst) ; // TODO: speed is 0?
                                     pgest.setTarget(puie->target());
@@ -159,6 +182,7 @@
                                 qstmGesture::QStm_GenericSimpleGesture pgest(
                                     qstmGesture::EGestureUidTap, 
                                     puie->currentXY(), 
+                                    puie->timestamp(),
                                     qstmGesture::ETapTypeSingle, puie) ; // TODO: speed is 0?
                                 pgest.setTarget(puie->target());
                                 QStm_GestureListenerIf* plistener = m_tapListeners[inx] ;
@@ -168,6 +192,7 @@
                     }
                     else {
                         m_firstTapXY = puieFirst->currentXY() ;
+                        m_firstTimestamp = puieFirst->timestamp();
                         m_firstTapTarget = target ;
                         m_firstTapSpeed = puie->speed() ;
                         // This was the first tap, start the timer...
@@ -175,19 +200,22 @@
                         if (m_loggingenabled) {
                             LOGARG("QStm_TapGestureRecogniser: 0x%x first tap: num %d code %d", this, countOfEvents, eventCode);
                         }
-                        m_timer.stop();
-                        m_timer.setSingleShot(true);
-                        m_timer.start(m_doubleTapTimeout) ;
+                        state = EGestureActive;
+                        m_timer->stop();
+                        m_timer->setSingleShot(true);
+                        m_timer->start(m_doubleTapTimeout, this) ;
                     }
 
                 }
             }
             else if (eventCode == qstmUiEventEngine::EMove) {
-                if (m_timer.isActive()) {
+                if (m_timer->isActive()) {
                     if (m_loggingenabled) {
                         LOGARG("QStm_TapGestureRecogniser: 0x%x: num %d code %d, Got EMove c- cancel timer.", this, countOfEvents, eventCode);
                     }
-                    m_timer.stop();
+                    m_waitingforsecondtap = false;
+                    m_timer->stop();
+                    state = ENotMyGesture;
                 }
             }
         }
@@ -198,7 +226,7 @@
 
 void QStm_TapGestureRecogniser::release(QStm_GestureEngineIf* /*ge*/)
 {
-    m_timer.stop() ;  // some other gesture took hold of the thing, do not send tap gesture
+    m_timer->stop() ;  // some other gesture took hold of the thing, do not send tap gesture
     m_waitingforsecondtap = false ;
     if (m_loggingenabled) {
         LOGARG("QStm_TapGestureRecogniser: 0x%x release, %d %d", this, m_firstTapXY.x(), m_firstTapXY.y());
@@ -206,15 +234,16 @@
     m_state = ENotMyGesture;
 }
 
-void QStm_TapGestureRecogniser::timeoutCallback()
+void QStm_TapGestureRecogniser::uiTimerCallback()
 {
     m_waitingforsecondtap = false ;
-    m_timer.stop();
+    m_timer->stop();
     if (m_loggingenabled) {
         LOGARG("QStm_TapGestureRecogniser: 0x%x timer, %d %d", this, m_firstTapXY.x(), m_firstTapXY.y());
     }
     // Double tap timer has been elapsed without new Touch/Release, generate the tap if there is a listener
     int inx = m_tapListenerWindows.indexOf(m_firstTapTarget) ;
+    if (inx < 0) inx = 0;
     if (inx != -1) {
         using qstmUiEventEngine::QStm_UiEventSpeed;
 
@@ -223,6 +252,7 @@
         qstmGesture::QStm_GenericSimpleGesture pgest(
                 qstmGesture::EGestureUidTap,
                 m_firstTapXY,
+                m_firstTimestamp,
                 qstmGesture::ETapTypeSingle,
                 &speedIf) ;
         pgest.setTarget(m_firstTapTarget);
--- a/qstmgesturelib/recognisers/qstmtapgesturerecogniser.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmtapgesturerecogniser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -25,6 +25,7 @@
 #include <qstmgestureengine_if.h>
 #include <qstmgesture_if.h>
 #include <qstmgesturelistener_if.h>
+#include "uitimer.h"
 
 namespace qstmGesture
 {
@@ -46,7 +47,7 @@
  */
 class QStm_TapGestureRecogniser : public QStm_GestureRecogniser
 {
-	Q_OBJECT
+    Q_OBJECT
 public:
     static const QStm_GestureUid KUid = EGestureUidTap;
 
@@ -111,7 +112,7 @@
     QStm_TapGestureRecogniser(QStm_GestureListenerIf* listener) ;
     
 public slots:
-    void timeoutCallback();
+    void uiTimerCallback();
     
 private:
     bool m_loggingenabled ;
@@ -120,6 +121,7 @@
     void* m_powner ; // The owning control for this gesture
     bool m_waitingforsecondtap ;
     QPoint m_firstTapXY ;
+    QTime  m_firstTimestamp;
     void* m_firstTapTarget ;
     float m_firstTapSpeed ;
     int m_doubleTapTimeout ;
@@ -131,7 +133,8 @@
     QList<void*>                    m_tapListenerWindows ;
     QList<QStm_GestureListenerIf*>  m_doubleTapListeners ;
     QList<void*>                    m_doubleTapListenerWindows ;
-    QTimer        m_timer;
+    UiTimer*                        m_timer;
+    int                             m_numOfActiveStreams;
 };
 
 } // namespace
--- a/qstmgesturelib/recognisers/qstmtouchgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmtouchgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -76,19 +76,24 @@
                 }
             }
             else {
-                produceGesture = (m_powner == puie->target()); // no area defined, touch detected in the window
+                produceGesture = (puie->target() != NULL);//(m_powner == puie->target()); // no area defined, touch detected in the window
             }
             
             if (produceGesture) {
                 // state = EGestureActive ; do not take ownership, all gestures anyway start with ETouch
                 // issue the touch gesture
-                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, tapPoint);
+                qstmGesture::QStm_GenericSimpleGesture pgest(KUid, tapPoint, puie->timestamp());
                 pgest.setTarget(puie->target());
                 // Call the listener to inform that a touch has occurred...
                 m_listener->gestureEnter(pgest);
+                
+                QStm_GestureRecogniserIf* uknownGesture = pge->gestureAt(pge->gestureCount() - 1);
+                if (uknownGesture->gestureUid() == EGestureUidUnknown) {
+                    uknownGesture->enable(false);
             }
         }
     }
+    }
     return state;
 }
 
--- a/qstmgesturelib/recognisers/qstmunknowngesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmunknowngesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -63,11 +63,11 @@
             }
             //state = EGestureActive ;
             // issue the gesture
-            qstmGesture::QStm_GenericSimpleGesture pgest(KUid, currentXY, 0, puie) ;
+            qstmGesture::QStm_GenericSimpleGesture pgest(KUid, currentXY, puie->timestamp(), 0, puie) ;
             pgest.setTarget(puie->target());
-            if (puie->target() != m_powner) {
+            //if (puie->target() != m_powner) {
                 pgest.setDetails((void*)puie);
-            }
+            //}
             // Call the listener to inform that a gesture has occurred...
             m_listener->gestureEnter(pgest) ;
 //        }
--- a/qstmgesturelib/recognisers/qstmupdowngesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmupdowngesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -28,7 +28,7 @@
 using namespace qstmGesture ;
 
 QStm_UpdownGestureRecogniser::QStm_UpdownGestureRecogniser(QStm_GestureListenerIf* listener) : 
-		                                       QStm_GestureRecogniser(listener)
+		                                       QStm_GestureRecogniser(listener), m_axisLock(0.5)
 {
 }
 
@@ -65,9 +65,22 @@
                 const QPoint& p = puie->currentXY() ;
                 QPoint dp = p - puie->previousXY() ;
                 // check that the Y movement is bigger
-                if (ABS(dp.x()) < ABS(dp.y())) {
+                //double dist;
+                //SQRT(dist, ((qreal)(dp.x() * dp.x() + dp.y() * dp.y())));
+                if ( (qAbs(dp.x()) < qAbs(dp.y())) && 
+                     ((qreal)qAbs(dp.x()) / (qreal)qAbs(dp.y()) < m_axisLock) ) {
                     state = EGestureActive;
-                    qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.y(), puie) ;
+                    //qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.y(), puie) ;
+                    QPoint curPos(0, puie->currentXY().y());
+                    QPoint prevPos(0, puie->previousXY().y());
+                    qstmGesture::QStm_DirectionalGesture pgest(
+                                                        KUid,
+                                                        puie->currentXY(),
+                                                        puie->previousXY(),
+                                                        puie->timestamp(),
+                                                        puie,
+                                                        m_loggingenabled); 
+                    
                     // Give the gesture a name
                     pgest.setName(QString("Updown")) ;
                     pgest.setTarget(puie->target());
@@ -87,7 +100,7 @@
     using qstmUiEventEngine::QStm_UiEventSpeed;
     const QPoint& p = puie->currentXY() ;
     QPoint dp = p - puie->previousXY() ;
-    qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.y(), puie) ;
+    qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, puie->timestamp(), dp.y(), puie) ;
     pgest.setTarget(puie->target());
     m_listener->gestureExit(pgest) ;
     m_state = ENotMyGesture;
--- a/qstmgesturelib/recognisers/qstmupdowngesturerecogniser.h	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmupdowngesturerecogniser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -41,6 +41,10 @@
     virtual QStm_GestureUid gestureUid() const  { return KUid;  }
 
     QStm_UpdownGestureRecogniser(QStm_GestureListenerIf* listener) ;
+    void setAxisLockThreshold(qreal axisLock) { m_axisLock = axisLock; }
+
+private:
+    qreal m_axisLock;
 };
 
 }
--- a/qstmgesturelib/recognisers/qstmzoomgesturerecogniser.cpp	Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/recognisers/qstmzoomgesturerecogniser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -91,7 +91,7 @@
                         m_zoomtype = EZoomOut ;
                     }
                     state = ELockToThisGesture ;    // keep zooming until release
-                    QStm_TwoPointGesture pgest(KUid, m_startingtouch, m_startingtouch);
+                    QStm_TwoPointGesture pgest(KUid, m_startingtouch, m_startingtouch, puie->timestamp());
                     pgest.setLogging(m_loggingenabled) ;
                     pgest.setDetails(&m_delta) ;
                     pgest.setName(m_zoomtype == EZoomIn ? QString("ZoomIn") : QString("ZoomOut")) ;
@@ -114,7 +114,7 @@
             if (eventCode == qstmUiEventEngine::ERelease) { // ERelease stops zooming
                 // We were zooming, but if there are multiple touches we are not any more
             	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
-            	QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch);
+                QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch, puie->timestamp());
                 m_listener->gestureExit(pgest) ; // should we call this or not?
             }
             else {   // all other UI events will keep on zooming
@@ -128,7 +128,7 @@
 
                 // Inform listener only if there is something to say
                 if (m_delta != 0) {
-                    QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, p, m_startingtouch);
+                    QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, p, m_startingtouch, puie->timestamp());
                     pgest.setLogging(m_loggingenabled) ;
                     pgest.setDetails(&m_delta) ;
                     pgest.setName(m_zoomtype == EZoomIn ? QString("ZoomIn") : QString("ZoomOut")) ;
@@ -144,7 +144,7 @@
         if (m_zooming) {
             // We were zooming, but if there are multiple touches we are not any more
         	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
-        	QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch);
+            QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch, puie->timestamp());
         	pgest.setTarget(puie->target());
             m_listener->gestureExit(pgest) ; // should we call this or not?
         }
@@ -159,7 +159,7 @@
     if (m_zooming) {
         m_zooming = false ;
     	const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
-    	QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch);
+        QStm_TwoPointGesture pgest = QStm_TwoPointGesture(KUid, puie->currentXY(), m_startingtouch, puie->timestamp());
     	pgest.setTarget(puie->target());
         m_listener->gestureExit(pgest) ; // should we call this or not?
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qstmgesturelib/uitimer.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,248 @@
+#ifndef UITIMER_H_
+#define UITIMER_H_
+
+#include <QDateTime>
+#include <QDebug>
+#include "qstmfilelogger.h"
+
+#define TIMESTAMP() QDateTime::currentDateTime().toString("hh:mm:ss:zzz")
+
+#ifdef Q_OS_SYMBIAN
+#include <e32base.h>
+#include <e32const.h>
+
+class CUiTimer : public CTimer
+{
+public:
+    enum CUiTimerType
+    {
+        AfterType,
+        HighResType,
+        LockType
+    };
+    
+    CUiTimer(int priority) : CTimer(priority), m_timerType(AfterType)
+    {
+    }
+    
+    
+    
+    static CUiTimer* New(int priority)
+    {
+        CUiTimer* uitao = new CUiTimer(priority);
+        if (uitao) {            
+            TRAPD(r, uitao->ConstructL());
+            if (r == KErrNone) {
+                CActiveScheduler::Add(uitao);
+            }
+            else {
+                delete uitao;
+                uitao = NULL;
+            }
+        }
+        return uitao;
+    }
+    
+    ~CUiTimer() {}
+    
+    void Start(TTimeIntervalMicroSeconds32 delay,TTimeIntervalMicroSeconds32 interval,TCallBack callBack)
+    {
+        __ASSERT_ALWAYS(interval.Int()>=0,User::Panic(_L("Interval < 0"), -1));
+        __ASSERT_ALWAYS(delay.Int()>=0,User::Panic(_L("Delay < 0"), -2));
+        m_interval = interval.Int();
+        m_callback = callBack;
+        m_timerType = AfterType;
+        After(delay);
+    }
+    
+    void StartHighRes(TTimeIntervalMicroSeconds32 delay,TTimeIntervalMicroSeconds32 interval,TCallBack callBack)
+    {
+        __ASSERT_ALWAYS(interval.Int()>=0,User::Panic(_L("Interval < 0"), -1));
+        __ASSERT_ALWAYS(delay.Int()>=0,User::Panic(_L("Delay < 0"), -2));
+        m_interval = interval.Int();
+        m_callback = callBack;
+        m_timerType = HighResType;
+        HighRes(delay);
+    }
+        
+    void StartLock(TTimerLockSpec lockSpec,TCallBack callBack)
+    {
+        m_lockSpec = lockSpec;
+        m_callback = callBack;
+        m_timerType = LockType;
+        Lock(m_lockSpec);
+    }
+
+    
+    void RunL()
+    {
+        switch (m_timerType) {
+        case HighResType:
+            HighRes(m_interval);
+            m_callback.CallBack();
+            break;
+        case LockType:
+            Lock(m_lockSpec);
+            m_callback.CallBack();
+            break;
+        case AfterType:
+            After(m_interval);
+            m_callback.CallBack();
+            break;
+        }
+    }
+    
+private:    
+    uint            m_interval; 
+    TCallBack       m_callback;
+    CUiTimerType    m_timerType;
+    TTimerLockSpec  m_lockSpec;
+};
+
+class UiTimer : QObject
+{
+    enum UiTimerType
+    {
+        AfterType,
+        HighResType,
+        LockType
+    };
+
+public:
+    static UiTimer*  New() 
+    { 
+        return new UiTimer(); 
+    }
+  
+    inline UiTimer(): QObject(), m_id(0), m_requestedTicks(-1), 
+                      m_ticksCount(0), m_cbName("uiTimerCallback") 
+    {    
+        m_timer = CUiTimer::New(20);
+    }
+  
+    inline void setPriority(int priority) { m_timer->SetPriority(priority); }
+    inline ~UiTimer() { m_timer->Cancel(); delete m_timer;}
+    
+    inline int timerId() const { return m_id; }
+
+    static int timercallback(TAny* ptr)
+    {
+        UiTimer* uitimer = static_cast<UiTimer*>(ptr);
+        uitimer->doTimerCallback();
+        return 0;
+    }
+    
+    void doTimerCallback()
+    {
+       if (isActive() && (m_requestedTicks < 0 || m_ticksCount++ < m_requestedTicks)) {  
+           
+           QMetaObject::invokeMethod(m_obj, m_cbName, Qt::DirectConnection);
+           if (m_ticksCount == m_requestedTicks) {
+               stop();
+           }
+       }
+       return;
+    }
+    
+    void start(int msec, QObject *obj, UiTimerType timerType = HighResType) 
+    {
+        m_delay = msec;
+        m_obj = obj;
+        m_ticksCount = 0;
+        switch (timerType)
+        {
+        case HighResType:
+            m_timer->StartHighRes((msec + 1) * 1000, (msec + 1) * 1000, TCallBack(timercallback, this));
+            break;
+        case AfterType:
+            m_timer->Start(msec * 1000, msec * 1000, TCallBack(timercallback, this));
+            break;
+        case LockType:
+            TTimerLockSpec lockSpec = static_cast<TTimerLockSpec>(msec);
+            m_timer->StartLock(lockSpec, TCallBack(timercallback, this));
+            break;
+        }
+    }
+    
+    void stop() 
+    { 
+        m_timer->Cancel(); 
+    }
+    
+    bool isActive() { return m_timer->IsActive(); }
+    
+    void setRequestedTicks(int ticksCount) { m_requestedTicks = ticksCount; }
+    int ticksCount() { return m_ticksCount; }
+    
+    void setSingleShot(bool isOneShot) { isOneShot ?  m_requestedTicks = 1 : m_requestedTicks = -1; }
+    bool isSingleShot() { return m_requestedTicks == 1; }
+    
+    void setTimerCallback(char* cbName) { m_cbName = cbName; }
+    
+private:
+    int         m_id;
+    int         m_delay;
+    QObject*    m_obj;
+    CUiTimer*   m_timer;
+    int         m_requestedTicks;
+    int         m_ticksCount;
+    char*       m_cbName;
+    
+};
+#else
+class UiTimer : public QObject
+{
+public:
+    static UiTimer* New() { return new UiTimer(); }
+    UiTimer() : QObject(), m_requestedTicks(-1), m_cbName(0)
+    {
+    }
+    inline void setPriority(int priority) {}
+    inline void start(int msec, QObject *obj) 
+    {
+        m_delay = msec;
+        m_obj = obj;
+        m_ticksCount = 0;
+        m_timer.start(msec, this);
+    }
+    inline ~UiTimer() {}
+        
+    inline int timerId() const { return m_timer.timerId(); }
+
+    inline void timerEvent(QTimerEvent *event)
+    {
+        if (m_requestedTicks < 0 || m_ticksCount++ < m_requestedTicks) {
+            QMetaObject::invokeMethod(m_obj, m_cbName ? m_cbName : "uiTimerCallback", Qt::DirectConnection);
+        }
+        else {
+            stop();
+        }
+        return;
+    }
+
+    inline void stop() { m_timer.stop(); }
+        
+    inline bool isActive() { return m_timer.isActive(); }
+
+    void setRequestedTicks(int ticksCount) { m_requestedTicks = ticksCount; }
+    int ticksCount() { return m_ticksCount; }
+    
+    void setSingleShot(bool isOneShot) { isOneShot ?  m_requestedTicks = 1 : m_requestedTicks = -1; }
+    bool isSingleShot() { return m_requestedTicks == 1; }
+    void setTimerCallback(char* cbName) { m_cbName = cbName; }
+
+private:
+    QBasicTimer  m_timer; 
+    int          m_delay;
+    QObject*     m_obj;
+    int         m_requestedTicks;
+    int         m_ticksCount;
+    char*       m_cbName;
+};
+
+#endif
+
+
+
+
+#endif /* UITIMER_H_ */
Binary file rom/NokiaBrowser_stub.sis has changed
--- a/rom/browser.iby	Thu Sep 23 15:32:11 2010 -0400
+++ b/rom/browser.iby	Fri Oct 15 17:30:59 2010 -0400
@@ -20,21 +20,11 @@
 #include <bldvariant.hrh>
 
 
-/* From sf\app\browserui\browsercore\core\browsercore_template.pkg ***********************/
-
-file=ABI_DIR\BUILD_DIR\BrowserCore.dll  SHARED_LIB_DIR\BrowserCore.dll
-
-/* From sf\app\browserui\bedrockProvisioning\bedrockProvisioning_template.pkg ***********************/
-
-file=ABI_DIR\BUILD_DIR\BedrockProvisioning.dll  SHARED_LIB_DIR\BedrockProvisioning.dll
-data=DATAZ_\data\.config\Nokia\200267EA.ini  data\.config\Nokia\200267EA.ini
-
-/* From sf\app\browserui\ginebra2\NokiaBrowser_template.pkg ***********************/
+/* From sf/app/browserui/ginebra2/NokiaBrowser_template.pkg ***********************/
 
 file=ABI_DIR\BUILD_DIR\NokiaBrowser.exe  SHARED_LIB_DIR\NokiaBrowser.exe
 data=DATAZ_\RESOURCE_FILES_DIR\apps\NokiaBrowser.rsc  resource\apps\NokiaBrowser.rsc
 data=DATAZ_\private\10003a3f\import\apps\NokiaBrowser_reg.rsc  private\10003a3f\import\apps\NokiaBrowser_reg.rsc
-data=DATAZ_\RESOURCE_FILES_DIR\apps\NokiaBrowser.mif  resource\apps\NokiaBrowser.mif
 data=DATAZ_\private\10008d39\localpages\installnotes.html  private\10008d39\localpages\installnotes.html
 data=DATAZ_\private\10008d39\localpages\relnotes.html  private\10008d39\localpages\relnotes.html
 data=DATAZ_\private\10008d39\localpages\startpage.html  private\10008d39\localpages\startpage.html
@@ -57,17 +47,13 @@
 data=DATAZ_\private\10008d39\localpages\button_survey.png  private\10008d39\localpages\button_survey.png
 data=DATAZ_\private\10008d39\localpages\google.png  private\10008d39\localpages\google.png
 data=DATAZ_\private\10008d39\localpages\nokia_logo.png  private\10008d39\localpages\nokia_logo.png
+data=DATAZ_\private\10008d39\localpages\mostvisitedpages.dat  private\10008d39\localpages\mostvisitedpages.dat
+data=DATAZ_\RESOURCE_FILES_DIR\apps\NokiaBrowser.mif  resource\apps\NokiaBrowser.mif
 data=DATAZ_\private\10008d39\backup_registration.xml  private\10008d39\backup_registration.xml
-
-/* From sf\mw\browser\bookmarksengine\browsercontentdll\browsercontentdll_template.pkg ***********************/
-
-file=ABI_DIR\BUILD_DIR\browsercontentdll.dll  SHARED_LIB_DIR\browsercontentdll.dll
-
-/* From sf/mw/browser/bookmarks/bookmarksapi_template.pkg ***********************/
-file=ABI_DIR\BUILD_DIR\bookmarksapi.dll  SHARED_LIB_DIR\bookmarksapi.dll
-
-/* From \sf\app\browserui\homescreen\widgetplugins\hsbookmarkwidgetplugin\hsbookmarkwidgetplugin_template.pkg ***********************/
-
+file=ABI_DIR\BUILD_DIR\qstmgesturelib.dll  SHARED_LIB_DIR\qstmgesturelib.dll
+file=ABI_DIR\BUILD_DIR\BedrockProvisioning.dll  SHARED_LIB_DIR\BedrockProvisioning.dll
+file=ABI_DIR\BUILD_DIR\BrowserCore.dll  SHARED_LIB_DIR\BrowserCore.dll
+data=DATAZ_\private\10008d39\BrowserCore.qtplugin  private\10008d39\BrowserCore.qtplugin
 file=ABI_DIR\BUILD_DIR\hsbookmarkwidgetplugin.dll  SHARED_LIB_DIR\hsbookmarkwidgetplugin.dll
 data=DATAZ_\private\20022F35\import\widgetregistry\200267BE\hsbookmarkwidgetplugin.qtplugin  private\20022F35\import\widgetregistry\200267BE\hsbookmarkwidgetplugin.qtplugin
 data=DATAZ_\private\20022F35\import\widgetregistry\200267BE\hsbookmarkwidgetplugin.xml  private\20022F35\import\widgetregistry\200267BE\hsbookmarkwidgetplugin.xml
@@ -75,9 +61,14 @@
 data=DATAZ_\private\20022F35\import\widgetregistry\200267BE\nokiabrowser-bm-icon_70x70_ico.png  private\20022F35\import\widgetregistry\200267BE\nokiabrowser-bm-icon_70x70_ico.png
 data=DATAZ_\private\20022F35\import\widgetregistry\200267BE\nokiabrowser-bm-icon_70x70_no_ico.png  private\20022F35\import\widgetregistry\200267BE\nokiabrowser-bm-icon_70x70_no_ico.png
 data=DATAZ_\private\20022F35\import\widgetregistry\200267BE\nokiabrowser-bm-icon_50x50.png  private\20022F35\import\widgetregistry\200267BE\nokiabrowser-bm-icon_50x50.png
+file=ABI_DIR\BUILD_DIR\brperftrace.dll  SHARED_LIB_DIR\brperftrace.dll
+file=ABI_DIR\BUILD_DIR\bookmarksapi.dll  SHARED_LIB_DIR\bookmarksapi.dll
+data=DATAZ_\private\10008d39\bookmarks.xml  private\10008d39\bookmarks.xml
+file=ABI_DIR\BUILD_DIR\browsercontentdll.dll  SHARED_LIB_DIR\browsercontentdll.dll
+data=ZSYSTEM\install\NokiaBrowser_stub.sis    System\Install\NokiaBrowser_stub.sis
 
 /* browser rfs plugin */ 
+ECOM_PLUGIN( browserrfsplugin.dll, browserrfsplugin.rsc )
 data=DATAZ_\RESOURCE_FILES_DIR\browserrfs.txt       RESOURCE_FILES_DIR\browserrfs.txt 
-ECOM_PLUGIN( browserrfsplugin.dll, browserrfsplugin.rsc )
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/OriginalSources.txt	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,8 @@
+https://trace1.isource-nokia.nokia.com/isource/svnroot/BrDo/cwrt/trunk/wrt/3rdparty/platform/symbian/wrtallocator
+r34453
+
+https://trace1.isource-nokia.nokia.com/isource/svnroot/BrDo/cwrt/trunk/wrt/ipc
+r26457
+
+https://trace1.isource-nokia.nokia.com/isource/svnroot/BrDo/cwrt/trunk/wrt/utilities/DownloadMgr
+r26457
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/DownloadManager.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,99 @@
+#
+# DownloadManager.pro
+#
+
+
+TEMPLATE = lib
+TARGET = BrDownloadMgr
+DEFINES += BUILD_DOWNLOAD_MGR_LIB
+DEFINES+=QT_BEARER=1
+DEFINES+=MAEMO_QT_BEARER=0
+QT += core network xml
+
+ROOT_DIR = $$PWD/../..
+
+symbian {
+    HEADERS += $$PWD/inc/drmstorage.h
+    HEADERS += $$PWD/inc/wmdrmdownloadbackend.h
+    SOURCES += $$PWD/src/drmstorage.cpp
+}
+else {
+    HEADERS += $$PWD/inc/progressivedownloadserver.h
+    SOURCES += $$PWD/src/progressivedownloadserver.cpp
+}
+
+INCLUDEPATH += $$PWD/inc $$PWD/../serviceipcclient
+LIBS +=  -lbrserviceipcclient 
+
+CONFIG(release, debug|release):!CONFIG(QTDIR_build){
+    !unix : contains(QT_CONFIG, reduce_exports): CONFIG += hide_symbols
+    unix : contains(QT_CONFIG, reduce_relocations): CONFIG += bsymbolic_functions
+}
+CONFIG -= warn_on
+*-g++* : QMAKE_CXXFLAGS += -Wreturn-type -fno-strict-aliasing
+
+symbian {
+    TARGET.UID3 = 0x200267E1
+    TARGET.VID = VID_DEFAULT
+    TARGET.EPOCALLOWDLLDATA = 1
+    TARGET.CAPABILITY = All -Tcb
+    INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+    LIBS += -lefsrv -lcaf -lcafutils 
+    myIncBlock = \
+    "$${LITERAL_HASH}include <bldvariant.hrh> " \
+    "$${LITERAL_HASH}if (defined RD_WMDRM_DLA_ENABLERS)" \
+    "SOURCE    wmdrmdownloadbackend.cpp" \
+    "LIBRARY   cameseutility.lib" \
+    "LIBRARY   charconv.lib" \
+    "$${LITERAL_HASH}endif"
+
+    MMP_RULES += myIncBlock
+    MMP_RULES += EXPORTUNFROZEN
+}
+
+HEADERS += $$PWD/inc/downloadmanager.h \
+                   $$PWD/inc/dmcommon.h \
+                   $$PWD/inc/dmcommoninternal.h \
+                   $$PWD/inc/download.h \
+                   $$PWD/inc/dmpimpl.h \
+                   $$PWD/inc/downloadbackend.h \
+                   $$PWD/inc/httpdownloadbackend.h \
+                   $$PWD/inc/omadownloadbackend.h \
+                   $$PWD/inc/downloadcore.h \
+                   $$PWD/inc/downloadcoremanager.h \
+                   $$PWD/inc/downloadevent.h \
+                   $$PWD/inc/downloadfactory.h \ 
+                   $$PWD/inc/downloadinfo.h \
+                   $$PWD/inc/omaddparser.h \
+                   $$PWD/inc/downloadstore.h \ 
+                   $$PWD/inc/filestorage.h \
+                   $$PWD/inc/oma2downloadbackend.h \
+                   $$PWD/inc/clientdownload.h \
+                   $$PWD/inc/paralleldownloadmanager.h \
+                   $$PWD/inc/sequentialdownloadmanager.h \ 
+                   $$PWD/inc/downloadmanagerclient.h \
+                   $$PWD/inc/backgrounddownloadmanager.h \
+                   $$PWD/inc/backgrounddownload.h \
+                   $$PWD/inc/storageutility.h
+
+SOURCES += $$PWD/src/downloadmanager.cpp \
+                   $$PWD/src/downloadcore.cpp \
+                   $$PWD/src/downloadbackend.cpp \
+                   $$PWD/src/httpdownloadbackend.cpp \
+                   $$PWD/src/omadownloadbackend.cpp \
+                   $$PWD/src/downloadcoremanager.cpp \
+                   $$PWD/src/downloadevent.cpp \
+                   $$PWD/src/downloadfactory.cpp \ 
+                   $$PWD/src/downloadinfo.cpp \ 
+                   $$PWD/src/omaddparser.cpp \ 
+                   $$PWD/src/filestorage.cpp \ 
+                   $$PWD/src/oma2downloadbackend.cpp \ 
+                   $$PWD/src/clientdownload.cpp \ 
+                   $$PWD/src/paralleldownloadmanager.cpp \ 
+                   $$PWD/src/sequentialdownloadmanager.cpp \ 
+                   $$PWD/src/downloadmanagerclient.cpp \ 
+                   $$PWD/src/backgrounddownloadmanager.cpp \ 
+                   $$PWD/src/backgrounddownload.cpp \ 
+                   $$PWD/src/storageutility.cpp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/bwins/BrDownloadMgru.def	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,21 @@
+EXPORTS
+	?createDownload@DownloadManager@@QAEPAVDownload@@PAVQNetworkReply@@@Z @ 1 NONAME ; class Download * DownloadManager::createDownload(class QNetworkReply *)
+	?createDownload@DownloadManager@@QAEPAVDownload@@ABVQString@@W4DownloadType@@W4DownloadScope@@@Z @ 2 NONAME ; class Download * DownloadManager::createDownload(class QString const &, enum DownloadType, enum DownloadScope)
+	?getId@DownloadEvent@@QAEHXZ @ 3 NONAME ; int DownloadEvent::getId(void)
+	?resumeAll@DownloadManager@@QAEXXZ @ 4 NONAME ; void DownloadManager::resumeAll(void)
+	?getAttribute@DownloadEvent@@QAE?AVQVariant@@W4DownloadEventAttribute@@@Z @ 5 NONAME ; class QVariant DownloadEvent::getAttribute(enum DownloadEventAttribute)
+	?removeAll@DownloadManager@@QAEXXZ @ 6 NONAME ; void DownloadManager::removeAll(void)
+	?removeOne@DownloadManager@@QAEXPAVDownload@@@Z @ 7 NONAME ; void DownloadManager::removeOne(class Download *)
+	?registerEventReceiver@DownloadManager@@QAEXPAVQObject@@@Z @ 8 NONAME ; void DownloadManager::registerEventReceiver(class QObject *)
+	?proxy@DownloadManager@@QAEPAVQNetworkProxy@@XZ @ 9 NONAME ; class QNetworkProxy * DownloadManager::proxy(void)
+	??0DownloadManager@@QAE@ABVQString@@@Z @ 10 NONAME ; DownloadManager::DownloadManager(class QString const &)
+	?pauseAll@DownloadManager@@QAEXXZ @ 11 NONAME ; void DownloadManager::pauseAll(void)
+	?findDownload@DownloadManager@@QAEPAVDownload@@H@Z @ 12 NONAME ; class Download * DownloadManager::findDownload(int)
+	?setAttribute@DownloadManager@@QAEHW4DownloadManagerAttribute@@ABVQVariant@@@Z @ 13 NONAME ; int DownloadManager::setAttribute(enum DownloadManagerAttribute, class QVariant const &)
+	?getAttribute@DownloadManager@@QAE?AVQVariant@@W4DownloadManagerAttribute@@@Z @ 14 NONAME ; class QVariant DownloadManager::getAttribute(enum DownloadManagerAttribute)
+	?currentDownloads@DownloadManager@@QAEAAV?$QList@PAVDownload@@@@XZ @ 15 NONAME ; class QList<class Download *> & DownloadManager::currentDownloads(void)
+	??1DownloadManager@@UAE@XZ @ 16 NONAME ; DownloadManager::~DownloadManager(void)
+	?setProxy@DownloadManager@@QAEXABVQString@@H@Z @ 17 NONAME ; void DownloadManager::setProxy(class QString const &, int)
+	?unregisterEventReceiver@DownloadManager@@QAEXPAVQObject@@@Z @ 18 NONAME ; void DownloadManager::unregisterEventReceiver(class QObject *)
+	?init@DownloadManager@@QAEXXZ @ 19 NONAME ; void DownloadManager::init(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/eabi/BrDownloadMgru.def	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,58 @@
+EXPORTS
+	_ZN13DownloadEvent12getAttributeE22DownloadEventAttribute @ 1 NONAME
+	_ZN13DownloadEvent5getIdEv @ 2 NONAME
+	_ZN15DownloadManager12findDownloadEi @ 3 NONAME
+	_ZN15DownloadManager12getAttributeE24DownloadManagerAttribute @ 4 NONAME
+	_ZN15DownloadManager12setAttributeE24DownloadManagerAttributeRK8QVariant @ 5 NONAME
+	_ZN15DownloadManager14createDownloadEP13QNetworkReply @ 6 NONAME
+	_ZN15DownloadManager14createDownloadERK7QString12DownloadType13DownloadScope @ 7 NONAME
+	_ZN15DownloadManager16currentDownloadsEv @ 8 NONAME
+	_ZN15DownloadManager21registerEventReceiverEP7QObject @ 9 NONAME
+	_ZN15DownloadManager23unregisterEventReceiverEP7QObject @ 10 NONAME
+	_ZN15DownloadManager4initEv @ 11 NONAME
+	_ZN15DownloadManager5proxyEv @ 12 NONAME
+	_ZN15DownloadManager8pauseAllEv @ 13 NONAME
+	_ZN15DownloadManager8setProxyERK7QStringi @ 14 NONAME
+	_ZN15DownloadManager9removeAllEv @ 15 NONAME
+	_ZN15DownloadManager9removeOneEP8Download @ 16 NONAME
+	_ZN15DownloadManager9resumeAllEv @ 17 NONAME
+	_ZN15DownloadManagerC1ERK7QString @ 18 NONAME
+	_ZN15DownloadManagerC2ERK7QString @ 19 NONAME
+	_ZN15DownloadManagerD0Ev @ 20 NONAME
+	_ZN15DownloadManagerD1Ev @ 21 NONAME
+	_ZN15DownloadManagerD2Ev @ 22 NONAME
+	_ZN3WRT12ServiceFwIPC10disconnectEv @ 23 NONAME
+	_ZN3WRT12ServiceFwIPC11qt_metacallEN11QMetaObject4CallEiPPv @ 24 NONAME
+	_ZN3WRT12ServiceFwIPC11qt_metacastEPKc @ 25 NONAME
+	_ZN3WRT12ServiceFwIPC11startServerERK7QStringS3_ @ 26 NONAME
+	_ZN3WRT12ServiceFwIPC11waitForReadEv @ 27 NONAME
+	_ZN3WRT12ServiceFwIPC12getSessionIdERi @ 28 NONAME
+	_ZN3WRT12ServiceFwIPC12setSessionIdEi @ 29 NONAME
+	_ZN3WRT12ServiceFwIPC14requestPendingEv @ 30 NONAME
+	_ZN3WRT12ServiceFwIPC16staticMetaObjectE @ 31 NONAME DATA 16
+	_ZN3WRT12ServiceFwIPC19getStaticMetaObjectEv @ 32 NONAME
+	_ZN3WRT12ServiceFwIPC5errorEi @ 33 NONAME
+	_ZN3WRT12ServiceFwIPC7connectERK7QString @ 34 NONAME
+	_ZN3WRT12ServiceFwIPC7readAllEv @ 35 NONAME
+	_ZN3WRT12ServiceFwIPC8sendSyncERK7QStringRK10QByteArray @ 36 NONAME
+	_ZN3WRT12ServiceFwIPC9readyReadEv @ 37 NONAME
+	_ZN3WRT12ServiceFwIPC9sendAsyncERK7QStringRK10QByteArray @ 38 NONAME
+	_ZN3WRT12ServiceFwIPCC1EP7QObjectNS_19TServiceIPCBackendsE @ 39 NONAME
+	_ZN3WRT12ServiceFwIPCC2EP7QObjectNS_19TServiceIPCBackendsE @ 40 NONAME
+	_ZN3WRT12ServiceFwIPCD0Ev @ 41 NONAME
+	_ZN3WRT12ServiceFwIPCD1Ev @ 42 NONAME
+	_ZN3WRT12ServiceFwIPCD2Ev @ 43 NONAME
+	_ZN3WRT19ServiceFwIPCFactory13createBackendENS_19TServiceIPCBackendsE @ 44 NONAME
+	_ZN3WRT19ServiceFwIPCFactory18isIPCTypeSupportedENS_19TServiceIPCBackendsE @ 45 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryC1Ev @ 46 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryC2Ev @ 47 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryD0Ev @ 48 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryD1Ev @ 49 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryD2Ev @ 50 NONAME
+	_ZNK3WRT12ServiceFwIPC10metaObjectEv @ 51 NONAME
+	_ZNK3WRT18RServiceIPCSession11SendReceiveEiR14TRequestStatus @ 52 NONAME
+	_ZTIN3WRT12ServiceFwIPCE @ 53 NONAME
+	_ZTIN3WRT19ServiceFwIPCFactoryE @ 54 NONAME
+	_ZTVN3WRT12ServiceFwIPCE @ 55 NONAME
+	_ZTVN3WRT19ServiceFwIPCFactoryE @ 56 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/backgrounddownload.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,75 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef BACKGROUNDDOWNLOAD_H
+#define BACKGROUNDDOWNLOAD_H
+
+#include "download.h"
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include <QObject>
+
+class DownloadManager;
+class BackgroundDownloadManager;
+class BackgroundDownloadPrivate;
+
+typedef QList<QObject*> EventReceiverList;
+
+// class declaration
+class BackgroundDownload : public Download
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(BackgroundDownload);
+public:
+    BackgroundDownload(DownloadManager* mgr, const QString& url, int dlId);
+    virtual ~BackgroundDownload();
+
+    // starts the download
+    int start();
+    // id of the download
+    int id();
+    // sets the attributes for the download
+    int setAttribute(DownloadAttribute attr, const QVariant& value);
+    // fetches the attributes of download
+    QVariant getAttribute(DownloadAttribute attr);
+    // pauses the download
+    int pause();
+    // resumes the download
+    int resume();
+    // cancels the download
+    int cancel();
+    // registers the event listener
+    void registerEventReceiver(QObject *receiver);
+    // unregisters the event listener
+    void unregisterEventReceiver(QObject *receiver);
+    // returns the download manager
+    DownloadManager* downloadManager();
+    // returns the list of child downloads
+    void getChildren(QList<Download*>& list);
+    // posts the event to recievers event loop
+    void postEvent(DEventType type, DlEventAttributeMap* attrMap);
+    // remove info of this download
+    void removeDownloadInfo();
+
+private: // copy constructor and assaignment operator
+    BackgroundDownload(const BackgroundDownload &);
+    BackgroundDownload &operator=(const BackgroundDownload &);
+
+    // returns the event listeners
+    EventReceiverList& eventReceivers();
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/backgrounddownloadmanager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,68 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef BACKGROUNDDOWNLOADMANAGER_H
+#define BACKGROUNDDOWNLOADMANAGER_H
+
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include <QObject>
+
+// forward declarations
+class DownloadManager;
+class Download;
+class DownloadManagerClient;
+class BackgroundDownloadManagerPrivate;
+
+// class declaration
+class BackgroundDownloadManager : public QObject
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(BackgroundDownloadManager); // private implementation
+public:
+    BackgroundDownloadManager(DownloadManager* downloadMgr);
+    virtual ~BackgroundDownloadManager();
+
+    // to initialise all the downloads which belongs to last
+    // download manager session
+    void init();
+    // creates new download by passing url
+    Download* createDownload(const QString& url, DownloadType type = Parallel);
+    // creates new download by reading from persistant download information
+    Download* createDownload(int dlId);
+    // sets the proxy
+    void setProxy(const QString& proxyServer, int port);
+    // sets download manager attributes
+    int setAttribute(DownloadManagerAttribute attr, const QVariant& value);
+    // fetches download manager attributes
+    QVariant getAttribute(DownloadManagerAttribute attr);
+    // returns all the current downloads
+    QList<Download*>& currentDownloads();
+    // finds a download provided id if exists
+    Download* findDownload(int dlId);
+    // cancels all the downloads and removes from the list
+    void removeAll();
+    // cancels and removes the download from list
+    void removeOne(Download *dl);
+    // pauses all the downloads which are in progress
+    void pauseAll();
+    // resumes all the downloads which are paused
+    void resumeAll();
+    // returns download manager client object
+    DownloadManagerClient* downloadManagerClient();
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/clientdownload.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,121 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CLIENTDOWNLOAD_H
+#define CLIENTDOWNLOAD_H
+
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include "downloadevent.h"
+#include "download.h"
+#include <QObject>
+
+class DownloadManager;
+class QNetworkReply;
+class DownloadInfo;
+class ClientDownloadPrivate;
+
+typedef QList<QObject*> EventReceiverList; 
+
+// class declaration
+class ClientDownload : public Download
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(ClientDownload);
+public:
+    // client download constructor
+    // note that parentdlId is applicable in parent-child relationship where
+    // parent download can be oma download and childs can be media downloads
+    ClientDownload(DownloadManager *mgr, const QString& url
+                                       , int dlId 
+                                       , DownloadType type = Parallel
+                                       , int parentdlId =INVALID_DL_ID); 
+    ClientDownload(DownloadManager *mgr, QNetworkReply *reply
+                                       ,int dlId
+                                       , int parentdlId =INVALID_DL_ID); 
+    ClientDownload(DownloadManager *mgr, int dlId, int parentdlId = INVALID_DL_ID); 
+    ~ClientDownload();
+
+    // starts the download
+    int start();
+    // id of the download
+    int id();
+    // sets the attributes for the download
+    int setAttribute(DownloadAttribute attr, const QVariant& value);
+    // fetches the attributes of download
+    QVariant getAttribute(DownloadAttribute attr);
+    // pauses the download
+    int pause();
+    // resumes the download
+    int resume();
+    // cancels the download
+    int cancel();
+    // registers the event listener
+    void registerEventReceiver(QObject *receiver);
+    // unregisters the event listener
+    void unregisterEventReceiver(QObject *receiver);
+    // returns the download manager
+    DownloadManager *downloadManager();
+    // returns the list of child downloads
+    void getChildren(QList<Download*>& list);
+    // to indicate download is created by perstistant stored info
+    bool isCreatedByDlInfo(void);
+   
+private:
+    // returns the event listeners
+    EventReceiverList& eventReceivers();
+    // returns the download info
+    DownloadInfo* downloadInfo();
+    // posts the event to recievers event loop
+    void postEvent(DEventType type, DlEventAttributeMap* attrMap);
+    // sets the error string
+    void setError(const QString& errorStr);
+    //sets the download state
+    void setDownloadState(DownloadState state);
+    // sets the id of the parent download
+    void setParentId(int parentId);
+    // parent id
+    int parentId();
+    // returns the attribute map
+    // note that these attributes are the only once which are 'set'able by clients
+    QMap<DownloadAttribute, QVariant>& attributes(void);
+    // actually starts the download
+    int startDownload();
+    // actually pauses the download
+    int pauseDownload();
+    // actually resumes the download
+    int resumeDownload();
+    // actually cancels the download
+    int cancelDownload();
+
+private slots:
+    // creates the concrete download implementation based on content type
+    void createDownloadImplementation();
+
+    friend class DownloadBackend; 
+    friend class OMADownloadBackend;
+    friend class HttpDownloadBackend;
+    friend class OMA2DownloadBackend;
+#if defined(RD_WMDRM_DLA_ENABLERS) && defined(Q_OS_SYMBIAN)
+    friend class WMDRMDownloadBackend;
+#endif
+    friend class FileStorage;
+    friend class DrmStorage;
+    friend class SequentialDownloadManager;
+    friend class ParallelDownloadManager;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/dmcommon.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,151 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOAD_COMMON_H_
+#define DOWNLOAD_COMMON_H_
+
+#define INVALID_DL_ID 0
+#define IPC_ERR_START_VALUE -5000
+
+// download states
+enum DownloadState
+{
+    DlNone = 0,
+    DlCreated,
+    DlStarted,
+    DlInprogress,
+    DlPaused,
+    DlCompleted,
+    DlFailed,
+    DlCancelled,
+    DlDescriptorUpdated
+};
+
+// download attributes
+enum DownloadAttribute
+{
+    /* general download attributes */
+    DlDestPath = 0,                  // destination path(set)
+    DlDownloadedSize,                // downloaded size(get)
+    DlTotalSize,                     // total size(get)
+    DlDownloadState,                 // download state(get)
+    DlFileName,                      // file name(set/get)
+    DlSourceUrl,                     // source url(get)
+    DlContentType,                   // content type(get)
+    DlLastError,                     // last error occured(get)
+    DlLastErrorString,               // last error string(get)
+    DlLastPausedSize,                // last download paused size(get)
+
+    /* OMA Download Attributes */
+    OMADownloadDescriptorName,       // "name" in OMA dd
+    OMADownloadDescriptorVersion,    // "version" in OMA dd
+    OMADownloadDescriptorType,       // "type" in OMA dd
+    OMADownloadDescriptorSize,       // "size" in OMA dd
+    OMADownloadDescriptorVendor,     // "vendor" in OMA dd
+    OMADownloadDescriptorDescription,// "description" in OMA dd
+    OMADownloadDescriptorNextURL,    // "nextURL" in OMA dd
+
+    DlDownloadType,                  // download type (get)
+    DlPriority,                      // download priority(set/get)
+    DlDownloadScope,                  // download scope i.e normal/background(get)
+
+    DlStartTime,                      // download start/resumed time in QDateTime (get)
+    DlEndTime,                        // download end time in QDateTime if successfully completed (get)
+    DlElapsedTime,                    // time elapsed since the download started/resumed( in secs (get)
+    DlRemainingTime,                  // remaining time to download in secs(get)
+    DlSpeed,                          // speed of the download in Bytes/sec(get)
+    DlPercentage,                     // percentage of download(get)
+    DlProgressInterval                // KiloBytes at which progress event has to be sent(set/get)
+};
+
+// download event attributes
+enum DownloadEventAttribute
+{
+    HeaderReceivedStatusCode = 0
+};
+
+// download manager attributes
+enum DownloadManagerAttribute
+{
+    DlMgrDestPath = 0,     // destination path
+    DlMgrDlCount,          // total number of downloads
+    DlMgrClientName,       // client name
+    DlMgrServerError,      // last server error
+    DlMgrProgressMode,     // quiet/nonquiet
+    DlMgrPersistantMode    // Active/InActive
+};
+
+// download manager event attributes
+enum DownloadManagerEventAttribute
+{
+};
+
+// event types
+enum DEventType
+{
+    DownloadCreated = 2000,        // atleast one dowload exists - DownloadManager event
+    DownloadsCleared,              // no more downloads exist - DownloadManager event
+    ConnectedToServer,             // connected to download manager server
+    DisconnectedFromServer,        // disconnected from download manager server
+    ServerError,                   // server error - DownloadManager event
+    Started,                       // download started - Download event
+    HeaderReceived,                // download headers recieved - Download event
+    Progress,                      // download is in progress, bytes recieved - Download event
+    Completed,                     // download is completed - Download event
+    Paused,                        // download is paused - Download event
+    Cancelled,                     // download is cancelled - Download event
+    Failed,                        // download is failed - Download event
+    DescriptorUpdated,             // download is restarted - Download event
+    NetworkLoss,                   // Network is lost - Download event
+    Error,                         // error occurred during download - Download event
+    OMADownloadDescriptorReady,    // OMA DD recieved and ready to be displayed - Download event
+    WMDRMLicenseAcquiring          // License acquisition in progress for wmdrm
+};
+
+// download manager type
+enum DownloadType
+{
+    Parallel = 0,
+    Sequential
+};
+
+// Sequential Download Priority
+enum DownloadPriority
+{
+    High = 0,
+    Low
+};
+
+// Download scope
+enum DownloadScope
+{
+    Normal = 0,
+    Background
+};
+
+enum DownloadMgrProgressMode
+{
+    Quiet = 0,
+    NonQuiet
+};
+
+enum DownloadMgrPersistantMode
+{
+    Active = 0,
+    InActive
+};
+
+#endif /*DOWNLOAD_COMMON_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/dmcommoninternal.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,111 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOAD_COMMON_INTERNAL_H_
+#define DOWNLOAD_COMMON_INTERNAL_H_
+
+#define OMA_CONTENT_TYPE "application/vnd.oma.dd+xml"
+#define OMA_VERSION_1 "1.0"
+#define OMA2_CONTENT_TYPE "application/vnd.oma.dd2+xml"
+#define OMA_VERSION_2 "2.0"
+#define OMA_DRM_MESSAGE_CONTENT_TYPE "application/vnd.oma.drm.message"
+#define WMDRM_CONTENT_TYPE "application/vnd.ms-wmdrm.lic-chlg-req"
+#define ROOT_PATH "/root/"
+
+// DownloadManagerServer definitions
+#define DM_FIELD_DELIMITER ";"
+#define DM_MSG_DELIMITER "&"
+#define CLIENTNAME_SUFFIX "_Background"
+#define DMSERVER "WrtDownloadManagerServer"
+#ifdef Q_OS_LINUX 
+#define DMSERVEREXE "./WrtDownloadManagerServer"
+#else
+#define DMSERVEREXE "WrtDownloadManagerServer.exe"
+#endif
+
+// DownloadManagerClient definitions
+#define EVENTS_REQUEST_INTERVAL 50
+
+// enum for progressive download operations supported
+enum ProgressiveOperation
+{
+    DlPause = 0,
+    DlResume,
+    DlCancel,
+    DlGetAttribute
+};
+
+// enum for operations supported
+enum ProgressiveResponse
+{
+    ProgressiveDlPaused = 0,
+    ProgressiveDlInprogress,
+    ProgressiveDlCompleted,
+    ProgressiveDlCancelled,
+    ProgressiveDlFailed,
+    ProgressiveDlGetAttribute,
+    ProgressiveDlServerDown
+};
+
+// enum for http status codes
+// NOTE: do not change order
+enum HttpStatusCode
+{
+    HttpOK = 200,                   // 200 = ok
+    HttpCreated,                    // 201 = created
+    HttpAccepted,                   // 202 = accepted
+    HttpNonAuthorativeInfo,         // 203 = non-authorative information
+    HttpNoContent,                  // 204 = no content
+    HttpResetContent,               // 205 = reset content
+    HttpPartialContent,             // 206 = partial content
+    HttpNotFound = 404,             // 404 = not found
+    HttpPreconditionFailed = 412    // 412 = precondition failed
+};
+
+enum ClientServerOpCode
+{
+    // Events
+    GetEvents = 0,                  // 0
+    // Download Manager operation
+    StartupInfo,                    // 1
+    SetDownloadManagerAttribute,    // 2
+    GetDownloadManagerAttribute,    // 3
+    SetProxy,                       // 4
+    CreateDownload,                 // 5
+    RemoveDownload,                 // 6
+    PauseAll,                       // 7
+    ResumeAll,                      // 8
+    RemoveAll,                      // 9
+    // Download operation
+    StartDownload,                  // 10
+    PauseDownload,                  // 11
+    ResumeDownload,                 // 12
+    CancelDownload,                 // 13
+    SetDownloadAttribute,           // 14
+    GetDownloadAttribute,           // 15
+    GetDownloadIds,                 // 16
+    AttachToDownload                // 17
+};
+
+enum ClientServerEventMessage
+{
+    EventDownloadManager = 0,       // 0
+    EventDownload                   // 1
+};
+
+#endif /*DOWNLOAD_COMMON_INTERNAL_H_ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/dmpimpl.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,48 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOADMGRPIMPL_H
+#define DOWNLOADMGRPIMPL_H
+
+#define DM_DECLARE_PRIVATE(Class) \
+        private: \
+                inline Class##Private* priv_func() { return reinterpret_cast<Class##Private *>(priv_ptr); } \
+                inline const Class##Private* priv_func() const { return reinterpret_cast<const Class##Private *>(priv_ptr); } \
+                friend class Class##Private; \
+                void* priv_ptr;
+
+#define DM_DECLARE_PUBLIC(Class) \
+        public: \
+                inline Class* pub_func() { return static_cast<Class *>(pub_ptr); } \
+                inline const Class* pub_func() const { return static_cast<const Class *>(pub_ptr); } \
+        private: \
+                friend class Class; \
+                void* pub_ptr;
+
+#define DM_PRIVATE(Class) Class##Private * const priv = priv_func()
+#define DM_PUBLIC(Class) Class * const pub = pub_func()
+
+#define DM_INITIALIZE(Class) \
+                priv_ptr = new Class##Private(); \
+                DM_PRIVATE(Class); \
+                priv->pub_ptr = this;
+
+#define DM_UNINITIALIZE(Class) \
+                DM_PRIVATE(Class); \
+                delete priv;
+
+#endif // DOWNLOADMGRPIMPL_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/download.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,62 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOAD_H
+#define DOWNLOAD_H
+
+#include "dmcommon.h"
+#include "downloadevent.h"
+#include <QObject>
+
+class DownloadManager;
+class QNetworkReply;
+class DownloadInfo;
+class DownloadPrivate;
+
+typedef QList<QObject*> EventReceiverList; 
+
+// class declaration
+class Download : public QObject
+{
+    Q_OBJECT
+public:
+    virtual ~Download() {};
+
+    // starts the download
+     virtual int start() = 0;
+    // id of the download
+     virtual int id() = 0;
+    // sets the attributes for the download
+     virtual int setAttribute(DownloadAttribute attr, const QVariant& value) = 0;
+    // fetches the attributes of download
+     virtual QVariant getAttribute(DownloadAttribute attr) = 0;
+    // pauses the download
+     virtual int pause() = 0;
+    // resumes the download
+     virtual int resume() = 0;
+    // cancels the download
+     virtual int cancel() = 0;
+    // registers the event listener
+     virtual void registerEventReceiver(QObject *receiver) = 0;
+    // unregisters the event listener
+     virtual void unregisterEventReceiver(QObject *receiver) = 0;
+    // returns the download manager
+     virtual DownloadManager *downloadManager() = 0;
+    // returns the list of child downloads
+     virtual void getChildren(QList<Download*>& list) = 0;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadbackend.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,111 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOADBACKEND_H
+#define DOWNLOADBACKEND_H
+
+#include "dmpimpl.h"
+#include "downloadinfo.h"
+#include "downloadevent.h"
+#include <QObject>
+#include <QNetworkReply>
+
+// forward declarations
+class DownloadBackendPrivate;
+class DownloadCore;
+class Download;
+class ClientDownload;
+
+// class declaration
+class DownloadBackend : public QObject
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(DownloadBackend);
+public:
+    DownloadBackend(DownloadCore *dlCore, ClientDownload *dl);
+    virtual ~DownloadBackend();
+
+    // pauses the download
+    virtual int pause() ;
+    // resumes the download
+    virtual int resume() ;
+    // cancels the download
+    virtual int cancel() ;
+    // fetches the attributes
+    virtual QVariant getAttribute(DownloadAttribute attr);
+    // sets the attributes
+    virtual int setAttribute(DownloadAttribute attr, const QVariant& value);
+    // stores the data in storage
+    // derived classes expected to have their own implementation
+    virtual void store(QByteArray data, bool lastChunk=false) = 0;
+    // deletes the storage
+    // derived classes expected to have their own implementation
+    virtual void deleteStore() = 0;
+    // returns the size of stored data
+    // derived classes expected to have their own implementation
+    virtual qint64 storedDataSize()= 0;
+    //returns the list of child downloads
+    virtual void getChildren(QList<Download*>&) { }
+    // initialises the download by reading from persistant storage
+    virtual void init() { return; }
+
+private: // copy constructor and assaignment operator
+      DownloadBackend(const DownloadBackend &);
+      DownloadBackend &operator=(const DownloadBackend &);
+
+public:
+    // functions which will store and retrieve the download persistant data
+    int setValue(DownloadInfo::Key aKey, const QString& aStrValue);
+    int setValue(DownloadInfo::Key aKey, long aIntValue);
+    int setValue(DownloadInfo::Key aKey, const QList<QVariant>& aChildIds);
+    int setValueForChild(DownloadInfo::Key aKey, const QString& aStrValue, int aChildId = INVALID_DL_ID);
+    int setValueForChild(DownloadInfo::Key aKey, long aIntValue, int aChildId = INVALID_DL_ID);
+
+    int getValue(DownloadInfo::Key aKey, QString& aStrValue);
+    int getValue(DownloadInfo::Key aKey, long& aIntValue);
+    int getValue(DownloadInfo::Key aKey, QList<QVariant>& aChildIds);
+    int getValueForChild(DownloadInfo::Key aKey, QString& aStrValue, int aChildId = INVALID_DL_ID);
+    int getValueForChild(DownloadInfo::Key aKey, long& aIntValue, int aChildId = INVALID_DL_ID);
+
+    // deletes the persistant data of download
+    int deleteInfo();
+    // posts the event to recievers event loop
+    void postEvent(DEventType type, DlEventAttributeMap* attrMap);
+    // download state
+    DownloadState downloadState(void);
+    // sets the download state
+    void setDownloadState(DownloadState state);
+    // sets the current downloaded data size
+    void setDownloadedDataSize(qint64 size);
+    // set total download size
+    void setTotalSize(qint64 size);
+    // returns the download object
+    ClientDownload* download(void);
+    // sets the start time
+    void setStartTime();
+
+private:
+    void postDownloadEvent(DEventType type, DlEventAttributeMap* attrMap);
+
+public slots:
+    virtual void bytesRecieved(qint64 bytesRecieved, qint64 bytesTotal);
+    virtual void handleFinished();
+    virtual void error(QNetworkReply::NetworkError);
+    virtual void headerReceived(){}
+    virtual void bytesUploaded(qint64, qint64){}
+};    
+
+#endif    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadcore.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,106 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOAD_CORE_H_
+#define DOWNLOAD_CORE_H_
+
+#include <QObject>
+#include <QNetworkReply>
+#include "dmpimpl.h"
+
+// forward declarations
+class QNetworkAccessManager;
+class DownloadCorePrivate; 
+class QNetworkProxy;
+
+// class declaration
+class  DownloadCore : public QObject
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(DownloadCore); // private implementation
+
+public:
+    // to start new download transaction
+    DownloadCore(const QString &aUrl);
+    // to carry forward the downloads transaction which has been started already
+    DownloadCore(QNetworkReply *reply);
+    virtual ~DownloadCore();
+private:
+    // default constructor made private to enforce creation of object only 
+    // by passing url or network reply
+    DownloadCore(void){};
+
+signals:
+    void finished(void);
+    void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
+    void metaDataChanged(); 
+    void error(QNetworkReply::NetworkError code);
+    void uploadProgress( qint64 bytesSent, qint64 bytesTotal );
+
+private slots:
+    void parseHeaders(void);
+
+private: // copy constructor and assaignment operator
+      DownloadCore(const DownloadCore &);
+      DownloadCore &operator=(const DownloadCore &);
+    
+public:
+    // starts the new download transaction if it is not started already addition with
+    // all necessary initialisarion or does initialisation if the transaction has been already started
+    int doDownload(void);
+    // for http "post" requests
+    int post(const QString& url, const QByteArray& data);
+    // pauses the download transaction
+    int resumeDownload(qint64 startOffeset);
+    // aborts the network transaction
+    int abort(void);
+    // sets the proxy
+    void setProxy(QNetworkProxy *proxy);
+    // returnts the url
+    QString& url(void);
+    // start download from given url
+    void changeUrl(QString& url);
+    // returns the network reply
+    QNetworkReply* reply(void);
+    // returns the network access manager
+    QNetworkAccessManager* networkAccessManager(void);
+    // returns the content type
+    QString& contentType(void);
+    // returns the content type
+    QString& entityTag(void);
+    // returns the total size
+    qint64 sizeInHeader(void);
+    // returns the last error occurred
+    QNetworkReply::NetworkError lastError(void);
+    // returns the last error string
+    QString lastErrorString();
+    // returns proxy
+    QNetworkProxy* proxy();
+    // returns file name from content disposition header
+    QString fileNameFromContentDispositionHeader();
+
+    // the following funtions used in the cases where 
+    // download has loaded from persistant state. Careful 
+    // while usig the following functions in normal cases
+    void setContentType(const QString& contentType);
+    void setEntityTag(const QString& entityTag);
+    // the folowing setLastError and setLastErrorString should be used
+    // together to keep the consistancy between error code and error string
+    void setLastError(QNetworkReply::NetworkError code);
+    void setLastErrorString(const QString& errStr); 
+};
+
+#endif /*DOWNLOAD_CORE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadcoremanager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,51 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOAD_CORE_MANAGER_H_
+#define DOWNLOAD_CORE_MANAGER_H_
+
+#include <QObject>
+#include "dmpimpl.h"
+
+// forward declarations
+class DownloadCore;
+class DownloadCoreManagerPrivate;  
+class QNetworkReply;
+
+// class declaration
+class  DownloadCoreManager : public QObject
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(DownloadCoreManager); // private implementation
+
+public:
+    DownloadCoreManager(const QString& clientName);
+    virtual ~DownloadCoreManager();
+
+private: // copy constructor and assaignment operator
+      DownloadCoreManager(const DownloadCoreManager &);
+      DownloadCoreManager &operator=(const DownloadCoreManager &);
+
+public:
+    // DownloadCore creation using url
+    DownloadCore* createDownloadCore(const QString &url);
+    // Download creation using network reply
+    DownloadCore* createDownloadCore(QNetworkReply *reply);
+    // retuns the client name
+    QString& clientName(); 
+};
+
+#endif /*DOWNLOAD_CORE_MANAGER_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadevent.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,62 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOADEVENT_H
+#define DOWNLOADEVENT_H
+
+#include <QEvent>
+#include <QVariant>
+#include "dmcommon.h"
+#include "dmpimpl.h"
+
+// forward declarations
+class DownloadEventPrivate;
+class DownloadManagerEventPrivate;
+
+// typedef
+typedef QMap<DownloadEventAttribute, QVariant> DlEventAttributeMap;
+typedef QMap<DownloadManagerEventAttribute, QVariant> DlManagerEventAttributeMap;
+
+
+// class declarations
+
+// DownloadEvent for download events
+class DownloadEvent : public QEvent
+{
+    DM_DECLARE_PRIVATE(DownloadEvent); // private implementation
+public:
+    DownloadEvent(DEventType type, DlEventAttributeMap* attrMap, int id);
+    ~DownloadEvent();
+
+    // to fetch the download event related attributes
+    Q_DECL_EXPORT QVariant getAttribute(DownloadEventAttribute attr);
+    // to fetch the id of download object which is the sender of this event
+    Q_DECL_EXPORT int getId();
+};  
+
+// DownloadManagerEvent for download manager events
+class DownloadManagerEvent : public QEvent
+{
+    DM_DECLARE_PRIVATE(DownloadManagerEvent); // private implementation
+public:
+    DownloadManagerEvent(DEventType type, DlManagerEventAttributeMap* attrMap);
+    ~DownloadManagerEvent();
+
+// to fetch the download manager event related attributes
+    QVariant getAttribute(DownloadManagerEventAttribute attr);
+};
+    
+#endif //DOWNLOADEVENT_H  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadfactory.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,36 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOADFACTORY_H_
+#define DOWNLOADFACTORY_H_
+
+class DownloadBackend;
+class DownloadCore;
+class ClientDownload;
+
+// class declaration
+
+// responsible for creating concrete download implementation class
+// based on the content type
+class DownloadAbstractFactory
+{
+public:
+    static DownloadBackend* createDownloadImplementation(DownloadCore *dlCore, ClientDownload *dl);
+};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadinfo.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,149 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOAD_INFO_H
+#define DOWNLOAD_INFO_H
+
+#include "dmpimpl.h"
+#include "dmcommon.h"
+#include <QString>
+#include <QVector>
+#include <QVariant>
+
+// forward declarations
+class QSettings;
+class DownloadInfoPrivate;
+
+// class declaration
+class DownloadInfo
+{
+    DM_DECLARE_PRIVATE(DownloadInfo); // private implementation
+public:
+    /*
+    InfoKey - key enumerations for the download info
+    */
+    enum Key 
+    {
+        EUrl = 0,           // 0    http://xyz.com/a.mp3
+        EFileName,          // 1    a.mp3
+        ETempPath,          // 2    ./com.nokia.browser/
+        EFinalPath,         // 3    /home/downloads/
+        ETempFullPath,      // 4    ./com.nokia.browser/a(1).mp3
+        ETotalSize,         // 5    xxx bytes <int>
+        EDlState,           // 6    int 
+        EContentType,       // 7    audio/mp3 
+        EETag,              // 8    ETag
+        EChildIdList,       // 9    list of child ids
+        EType,              // 10   sequential or parallel
+        EScope,             // 11   client side or background download
+        EPriority           // 12   priority of the download
+    };
+
+    DownloadInfo(const QString& aClientName);
+    ~DownloadInfo();
+
+public:
+    /*
+    Sets a string value.
+    Returns : 0 on success, non zero on error
+    */
+    int setValue(int aDlId, Key aKeyStr, const QString& aStrValue, int aParentId = INVALID_DL_ID);
+
+    /*
+    Sets a string value.
+    Returns : 0 on success, non zero on error
+    */
+    int setValue(int aDlId, Key aKeyStr, long aLongValue, int aParentId = INVALID_DL_ID);
+
+    /*
+    Sets a string value.
+    Returns : 0 on success, non zero on error
+    */
+    int setValueForChild(int aDlId, Key aKeyStr, const QString& aStrValue, int aChildId = INVALID_DL_ID);
+    
+    /*
+    Sets an int value.
+    Returns : 0 on success, non zero on error
+    */
+    int setValueForChild(int aDlId, Key aKeyInt, long aLongValue, int aChildId = INVALID_DL_ID);
+
+    /*
+    Sets the mediaObject list
+    Returns : 0 on success, non zero on error
+    */
+    int setValue(int aDlId, Key aKey, const QList<QVariant>& aChildIds);
+
+    /*
+    Updates(serializes) the info with all set values at once.
+    Returns : 0 on success, non zero on error
+    */
+    int update();
+
+    /*
+    Retrieves the string value
+    Returns : 0 on success, non zero on error
+    */
+    int getValue(int aDlId, Key aKeyStr, QString& aStrValue, int aParentId = INVALID_DL_ID);
+    
+    /*
+    Retrieves the int value
+    Returns : 0 on success, non zero on error
+    */
+    int getValue(int aDlId, Key aKeyInt, long& aLongValue, int aParentId = INVALID_DL_ID);
+
+    /*
+    Retrieves the string value
+    Returns : 0 on success, non zero on error
+    */
+    int getValueForChild(int aDlId, Key aKeyStr, QString& aStrValue, int aChildId = INVALID_DL_ID);
+    
+    /*
+    Retrieves the int value
+    Returns : 0 on success, non zero on error
+    */
+    int getValueForChild(int aDlId, Key aKeyInt, long& aLongValue, int aChildId = INVALID_DL_ID);
+
+    /*
+    Retrieves the mediaObject list
+    Returns : 0 on success, non zero on error
+    */
+    int getValue(int aParentId, Key aKey, QList<QVariant>& aChildIds);
+
+    /*
+    Deletes the download info of a particular download represented by aDlId.
+    Returns : 0 on success, non zero on error
+    */
+    int remove(int aDlId, int aParentId = INVALID_DL_ID);
+
+    /*
+    Returns all download ids in a vector
+    */
+    static QVector<int> getAllDownloads(const QString& aClientName);
+
+private:
+
+    /*
+    Helper function to generate a string key combining dlId and the InfoKey
+    */
+    QString genStrKey(int aDlId, Key aKey);
+
+    /*
+    Helper function to generate a string key combining parentId, childId and the InfoKey
+    */
+    QString genStrKey(int aParentId, int aChildId, Key aKey);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadmanager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,105 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOADMANAGER_H
+#define DOWNLOADMANAGER_H
+
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include "downloadevent.h"
+#include <QObject>
+
+#ifndef DOWNLOAD_MGR_EXPORT
+# ifdef BUILD_DOWNLOAD_MGR_LIB
+#  define DOWNLOAD_MGR_EXPORT Q_DECL_EXPORT
+# else
+#  define DOWNLOAD_MGR_EXPORT Q_DECL_IMPORT
+# endif
+#endif
+
+// forward declarations
+class Download;
+class QNetworkReply; 
+class QNetworkProxy;
+class DownloadInfo;
+class DownloadCoreManager;
+class BackgroundDownloadManager;
+class DownloadManagerPrivate;
+class SequentialDownloadManager;
+
+// class declaration
+class DownloadManager
+{
+    DM_DECLARE_PRIVATE(DownloadManager); // private implementation
+public:
+    DOWNLOAD_MGR_EXPORT DownloadManager(const QString& clientName);
+    DOWNLOAD_MGR_EXPORT virtual ~DownloadManager();
+
+    // to initialise all the downloads which belongs to last
+    // download manager session
+    DOWNLOAD_MGR_EXPORT void init();
+    // creates new download by passing url
+    DOWNLOAD_MGR_EXPORT Download* createDownload(const QString& url, DownloadType type = Parallel, DownloadScope scope = Normal);
+    // creates a download by passing network reply
+    DOWNLOAD_MGR_EXPORT Download* createDownload(QNetworkReply *reply);    
+    // sets the proxy
+    DOWNLOAD_MGR_EXPORT void setProxy(const QString& proxyServer, int port);
+    // registers event listener
+    DOWNLOAD_MGR_EXPORT void registerEventReceiver(QObject *receiver);
+    // unregister event listener
+    DOWNLOAD_MGR_EXPORT void unregisterEventReceiver(QObject *receiver);
+    // sets download manager attributes
+    DOWNLOAD_MGR_EXPORT int setAttribute(DownloadManagerAttribute attr, const QVariant& value);
+    // fetches download manager attributes
+    DOWNLOAD_MGR_EXPORT QVariant getAttribute(DownloadManagerAttribute attr);
+    // returns all the current downloads
+    DOWNLOAD_MGR_EXPORT QList<Download *>& currentDownloads();
+    // finds a download provided id if exists
+    DOWNLOAD_MGR_EXPORT Download* findDownload(int dlId);
+    // cancels all the downloads and removes from the list
+    DOWNLOAD_MGR_EXPORT void removeAll();
+    // cancels and removes the download from list
+    DOWNLOAD_MGR_EXPORT void removeOne(Download *dl);
+    // pauses all the downloads which are in progress
+    DOWNLOAD_MGR_EXPORT void pauseAll();
+    // resumes all the downloads which are paused
+    DOWNLOAD_MGR_EXPORT void resumeAll();
+    // returns the network proxy
+    DOWNLOAD_MGR_EXPORT QNetworkProxy* proxy();
+    
+    // returns downloadinfo object
+    DownloadInfo* downloadInfo();
+    // returns downloadcoremanager object
+    DownloadCoreManager* downloadCoreManager();
+    // returns sequentialmanager object
+    SequentialDownloadManager* sequentialManager();
+    // returns background download manager object
+    BackgroundDownloadManager* backgroundManager();
+
+    // post the events
+    void postEvent(DEventType type, DlManagerEventAttributeMap* attrMap);
+
+private:
+    // creates download by passing id
+    // used while loading the saved downloads
+    Download* createDownload(int dlId, DownloadScope scope);
+    // loads the saved downloads
+    void loadAllDownloads();
+    // generated unique id for download
+    long generateDlId();
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadmanagerclient.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,76 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef DOWNLOADMANAGERCLIENT_H
+#define DOWNLOADMANAGERCLIENT_H
+
+#include <QObject>
+#include "downloadmanager.h"
+#include "dmcommoninternal.h"
+#include "dmpimpl.h"
+
+class DownloadManagerClientPrivate;
+
+class DownloadManagerClient : public QObject
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(DownloadManagerClient);
+
+public:
+    DownloadManagerClient(DownloadManager* downloadManager);
+    ~DownloadManagerClient();
+    
+    // low-level implementation of functions present in BackgroundDownloadManager class
+    void setStartupInfo();
+    void setProxy(const QString& proxyServer, const int port);
+    int createDownload(const QString& url, DownloadType type);
+    bool attachToDownload(int dlId);
+    void removeDownload(int downloadId);
+    void pauseAll();
+    void resumeAll();
+    void removeAll();
+    QVariant getDownloadManagerAttribute(DownloadManagerAttribute attr);
+    int setDownloadManagerAttribute(DownloadManagerAttribute attr, const QVariant& value);
+
+    // low-level implementation of functions present in BackgroundDownload class
+    int startDownload(int dlId);
+    int pauseDownload(int dlId);
+    int resumeDownload(int dlId);
+    int cancelDownload(int dlId);
+    QVariant getDownloadAttribute(int dlId, DownloadAttribute attr);
+    int setDownloadAttribute(int dlId, DownloadAttribute attr, const QVariant& value);
+
+    // server error functions
+    int serverError();
+
+private:
+    // start server if required and connect to it; set proxy info in server
+    bool initServer();
+    // connect to download manager server
+    bool connectToServer();
+    // process Download and DownloadManager events
+    void processEvents(QString eventMsg);
+    // encodes the strings (client name, url, etc) so that it does not contain
+    // message delimiter (DM_DELIMITER)
+    QString encodeString(const QString& inputString);
+
+private slots:
+    // poll server for events
+    void getEvents();
+    // set server IPC error
+    void setServerError(int );
+};
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadstore.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,46 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DOWNLOADSTORE_H
+#define DOWNLOADSTORE_H
+
+#include <QObject>
+#include <QByteArray>
+#include <QIODevice>
+
+// class declaration
+
+// abstract class for all concrete storage implementations
+class DownloadStore 
+{
+public:
+    virtual ~DownloadStore(){}
+
+    // to write the data to storage
+    virtual int write(const QByteArray& data,bool lastChunk=0) = 0 ;
+    // closes storage
+    virtual int close() = 0 ;
+    // opens storage
+    virtual int open(QIODevice::OpenMode) = 0;
+    // creates the storage
+    virtual int createStore() = 0;
+    // deletes the storage
+    virtual int deleteStore() = 0;
+    // returns the size of stored data in the storage
+    virtual int storedDataSize() = 0;
+};    
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/drmstorage.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,69 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DRMSTORAGE_H
+#define DRMSTORAGE_H
+
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include "downloadstore.h"
+#include "clientdownload.h"
+#include <caf/caf.h>
+#include <e32cmn.h>
+#include <QObject>
+
+
+// class declaration
+// concrete implementation class
+class DrmStorage : public DownloadStore
+{
+
+public:
+    DrmStorage(const QString& clientName, ClientDownload* download);
+    virtual ~DrmStorage();
+
+    // writes to the file
+    int write(const QByteArray& data, bool lastChunk=0);
+    // closes the file
+    int close();
+    // opnes the file
+    int open(QIODevice::OpenMode mode);
+    // creates the storage
+    int createStore();
+    // deletes the file storage
+    int deleteStore();
+     //returns the size of loaded file
+    int storedDataSize();
+
+private:
+    // moves the file
+    void moveDlFile();
+    // convert symbian string to QString
+    QString SymbianStringToQtString(TDesC& symbianString);
+    // convert QString string to symbian string
+    TPtrC SymbianStringToQtString(QString& qtString);
+
+// member variables
+private:
+    // client name
+    QString m_clientName;
+    // folder paths
+    QString m_tempPath; // temporary path till dl completes
+    ClientDownload* m_download; // not owned
+    ContentAccess::CImportFile* m_file;
+};    
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/filestorage.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,57 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef FILESTORAGE_H
+#define FILESTORAGE_H
+
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include "downloadstore.h"
+#include "clientdownload.h"
+#include <QObject>
+
+// forward declarations
+class FileStoragePrivate;
+
+// class declaration
+
+// concrete implementation class
+class FileStorage : public DownloadStore
+{
+    DM_DECLARE_PRIVATE(FileStorage); // private implementation
+public:
+    FileStorage(const QString& clientName, ClientDownload* download);
+    virtual ~FileStorage();
+
+    // writes to the file
+    int write(const QByteArray& data, bool lastChunk=0);
+    // closes the file
+    int close();
+    // opnes the file
+    int open(QIODevice::OpenMode mode);
+    // creates the storage
+    int createStore();
+    // deletes the file storage
+    int deleteStore();
+     //returns the size of loaded file
+    int storedDataSize();
+
+private:
+    // moves the file
+    void moveDlFile();
+};    
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/httpdownloadbackend.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,57 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef HTTPDOWNLOADBACKEND_H
+#define HTTPDOWNLOADBACKEND_H
+
+#include "downloadbackend.h"
+#include "dmcommon.h"
+
+// forward declarations
+class DownloadCore;
+class ClientDownload;
+class DownloadStore;
+class HttpDownloadBackendPrivate;
+
+// class declaration
+
+// concrete download implementation class for normal http downloads
+class HttpDownloadBackend : public DownloadBackend
+{
+    DM_DECLARE_PRIVATE(HttpDownloadBackend); // private implementation
+public:
+    HttpDownloadBackend(DownloadCore *dlCore, ClientDownload *dl, DownloadStore* store);
+    ~HttpDownloadBackend();
+
+    // overloaded function for resuming download
+    int resume();
+    // overloaded function for storing the data
+    void store(QByteArray data, bool lastChunk=false);
+    // overloaded function for deleting the storage
+    void deleteStore();
+    // overloaded function which returns the stored data size
+    qint64 storedDataSize();
+    // fetches the attributes
+    QVariant getAttribute(DownloadAttribute attr);
+    // sets the attributes
+    int setAttribute(DownloadAttribute attr, const QVariant& value);
+public slots:
+    void headerReceived();
+};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/oma2downloadbackend.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,97 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef OMA2DOWNLOADBACKEND_H
+#define OMA2DOWNLOADBACKEND_H
+
+#include "dmcommon.h"
+#include "dmcommoninternal.h"
+#include "dmpimpl.h"
+#include "downloadbackend.h"
+
+// forward declarations
+class OMA2DownloadBackendPrivate;
+class DownloadCore;
+class ClientDownload;
+
+typedef QList<ClientDownload*> MediaDownloadList;
+
+// class declaration
+
+// concrete download implementation for OMA2 downloads
+class OMA2DownloadBackend : public DownloadBackend
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(OMA2DownloadBackend); // private implementation
+public:
+    OMA2DownloadBackend(DownloadCore *dlCore, ClientDownload *dl);
+    ~OMA2DownloadBackend();
+
+    // fetches the oma2 download attributes
+    QVariant getAttribute(DownloadAttribute attr);
+    // sets the oma2 download specific attributes
+    int setAttribute(DownloadAttribute attr, const QVariant& value);
+    // overloaded function for pausing the download
+    int pause();
+    // overloaded function for resuming paused download
+    int resume();
+    // overloaded function for cancelling the download
+    int cancel();
+    // overloaded function for getting child downloads
+    void getChildren(QList<Download*>& list);
+
+    // stores the data in storage
+    void store(QByteArray data, bool lastChunk=false);
+    // deletes the storage
+    void deleteStore();
+    // returns the size of stored data
+    qint64 storedDataSize();
+    // re-constructing all the values as part of persistent storage
+    void init();
+
+
+private slots:
+    void bytesRecieved(qint64 bytesRecieved, qint64 bytesTotal);
+    void handleFinished();    
+    void bytesUploaded(qint64, qint64); 
+private:
+    // parses download descriptor
+    bool parseDownloadDescriptor();
+    // does the capability check on receiving DD
+    bool checkDownloadDescriptor();
+    // event handler
+    bool event(QEvent *event);
+    // suppress user confirmation
+    bool suppressUserConfirmation();
+    // handle status code
+    void handleStatusCode(const int& statusCode);
+    // handle precondition failed
+    void handlePreconditionFailed();
+    // adds the downloads to downloadList
+    void addtoDownloadList(ClientDownload *dl);
+    // finds the download for the given id
+    ClientDownload* findDownload(int id);
+    // posting the install notify event to the web server
+    void postInstallNotifyEvent(const char* statusMessage);
+    // verifying downloads by going through the MediaObject map and setting OMA2'S state at the end.
+    void verifyDownloads();
+    // returns current MediaObject index
+    int currentIndex();
+    // setting values in QSettings for persistent storage
+    void serializeData(ClientDownload* dl, int index);
+};
+
+#endif   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/omaddparser.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,142 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef OMADDPARSER_H_
+#define OMADDPARSER_H_
+
+#include "dmcommon.h"
+#include "dmcommoninternal.h"
+#include "dmpimpl.h"
+#include <QtXml>
+#include <QVariant>
+#include <QStack>
+
+// forward declarations
+class QString;
+class OMADownloadDescriptor;
+class OMADownloadDescParserPrivate;
+class OMADownloadDescriptorPrivate;
+class OMA2DownloadProduct;
+class OMA2DownloadProductPrivate;
+class OMA2DownloadMediaObj;
+class OMA2DownloadMediaObjPrivate;
+
+typedef QList<OMA2DownloadProduct*> ProductList;
+typedef QList<OMA2DownloadMediaObj*> MediaObjectList;
+
+enum OMADownloadAttribute
+{
+    /* OMA Download Attributes */
+    OMADownloadDescName = 0,                  // "name" in OMA dd
+    OMADownloadDescVersion,                   // "version" in OMA dd
+    OMADownloadDescObjectURI,                 // "objectURI" in OMA dd
+    OMADownloadDescType,                      // "type" in OMA dd
+    OMADownloadDescSize,                      // "size" in OMA dd
+    OMADownloadDescVendor,                    // "vendor" in OMA dd
+    OMADownloadDescDescription,               // "description" in OMA dd
+    OMADownloadDescInstallNotifyURI,          // "installNotifyURI" in OMA dd
+    OMADownloadDescNextURL,                   // "nextURL" in OMA dd
+    OMADownloadDescInfoURL,                   // "infoURL" in OMA dd
+    OMADownloadDescIconURL,                   // "iconURL" in OMA dd
+    OMADownloadDescInstallParam,              // "instalParam" in OMA dd
+
+    /* OMA2 Download Attributes */
+    OMA2DownloadDescUpdatedDDURI,             // "updatedDDURI" in OMA dd2
+    OMA2DownloadDescProductName,              // "product" in OMA dd2
+    OMA2DownloadDescProductInstallNotifyURI,  // "installNotifyURI" of product in OMA dd2
+    OMA2DownloadDescProductSuppressConfirmation,  // "suppressuserconfirmation" of product in OMA dd2
+    OMA2DownloadDescMediaObjName,             // "mediaObject" in OMA dd2
+    OMA2DownloadDescMediaObjType,             // "type" in OMA dd2
+    OMA2DownloadDescMediaObjSize,             // "size" in OMA dd2
+    OMA2DownloadDescMediaObjProgressiveDl,    // "progressivedl" in OMA dd2
+    OMA2DownloadDescMediaObjServer,           // "server" in OMA dd2
+    OMA2DownloadDescMediaObjInstallNotifyURI, // "installNotifyURI" of mediaObj in OMA dd2
+    OMA2DownloadDescMediaObjSuppressConfirmation, // "suppressuserconfirmation" of mediaobj in OMA dd2
+    OMA2DownloadDescLicense,                  // "license" in OMA dd2
+    OMA2DownloadDescOrder,                    // "order" in OMA dd2
+    OMA2DownloadDescText                      // "text" in OMA dd2 
+};
+// class declaration
+
+// for parsing the OMA download descriptor
+class  OMADownloadDescParser : public QXmlDefaultHandler
+{
+    DM_DECLARE_PRIVATE(OMADownloadDescParser);
+
+public:
+    OMADownloadDescParser();
+    ~OMADownloadDescParser();
+    bool startDocument();
+    bool startElement(const QString&, const QString&, const QString& ,
+                       const QXmlAttributes&);
+    bool endElement(const QString&, const QString&, const QString&);
+    bool characters(const QString& ch);
+    QString errorString();
+    bool fatalError(const QXmlParseException &exception);
+    OMADownloadDescriptor* downloadDescriptor();
+};
+
+// represents OMA download descriptor
+class OMADownloadDescriptor
+{
+    DM_DECLARE_PRIVATE(OMADownloadDescriptor);
+public:
+    OMADownloadDescriptor();
+    ~OMADownloadDescriptor();
+    // fetches the OMA DD related attributes
+    QVariant getAttribute(OMADownloadAttribute attr);
+    // sets the attributes if any
+    void setAttribute(const QString&, const QVariant&);
+    // fetches the product List
+    QList<OMA2DownloadProduct*> productList();
+    // fetches the product count in a dd
+    int productCount();
+    // adding product to the list
+    void addProduct(OMA2DownloadProduct*);
+};
+
+class OMA2DownloadProduct
+{
+    DM_DECLARE_PRIVATE(OMA2DownloadProduct);
+public:
+    OMA2DownloadProduct();
+    ~OMA2DownloadProduct();
+    // fetches Product related attributes
+    QVariant getAttribute(OMADownloadAttribute attr);
+    // sets the Product attributes if any
+    void setAttribute(const QString&, const QVariant&);
+    // fetches the Media Object list
+    QList<OMA2DownloadMediaObj*> mediaObjList();
+    // fetches the number of media downloads in a product
+    int mediaCount();
+    // fetches the size of all the media objects present in dd
+    qint64 albumSize();
+    // adding media object to the media object list.
+    void addMediaObject(OMA2DownloadMediaObj*);
+};
+
+class OMA2DownloadMediaObj
+{
+    DM_DECLARE_PRIVATE(OMA2DownloadMediaObj);
+public:
+    OMA2DownloadMediaObj();
+    ~OMA2DownloadMediaObj();
+    // fetches the Media Object attributes
+    QVariant getAttribute(OMADownloadAttribute attr);
+    // sets the Media Object attributes if any
+    void setAttribute(const QString&, const QVariant&);
+};
+#endif       
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/omadownloadbackend.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,74 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef OMADOWNLOADBACKEND_H
+#define OMADOWNLOADBACKEND_H
+
+#include "dmcommon.h"
+#include "dmcommoninternal.h"
+#include "dmpimpl.h"
+#include "downloadbackend.h"
+
+// forward declarations
+class OMADownloadBackendPrivate;
+class DownloadCore;
+class ClientDownload;
+
+typedef QList<ClientDownload*> MediaDownloadList;
+
+// class declaration
+
+// concrete download implementation for OMA downloads
+class OMADownloadBackend : public DownloadBackend
+{
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(OMADownloadBackend); // private implementation
+public:
+    OMADownloadBackend(DownloadCore *dlCore, ClientDownload *dl);
+    ~OMADownloadBackend();
+
+    // fetches the oma download attributes
+    QVariant getAttribute(DownloadAttribute attr);
+    // sets the oma download specific attributes
+    int setAttribute(DownloadAttribute attr, const QVariant& value);
+    // overloaded function for pausing the download
+    int pause();
+    // overloaded function for resuming paused download
+    int resume();
+    // overloaded function for cancelling the download
+    int cancel();
+
+    // stores the data in storage
+    void store(QByteArray data, bool lastChunk=false);
+    // deletes the storage
+    void deleteStore();
+    // returns the size of stored data
+    qint64 storedDataSize();
+
+private slots:
+    void bytesRecieved(qint64 bytesRecieved, qint64 bytesTotal);
+    void handleFinished();    
+    void bytesUploaded(qint64, qint64); 
+private:
+    // parses download descriptor
+    bool parseDownloadDescriptor();
+    // does the capability check on receiving DD
+    bool checkDownloadDescriptor();
+    // event handler
+    bool event(QEvent *event);
+};
+
+#endif   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/paralleldownloadmanager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,54 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PARALLELDOWNLOADMANAGER_H
+#define PARALLELDOWNLOADMANAGER_H
+
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include "downloadevent.h"
+#include <QObject>
+
+// forward declarations
+class ClientDownload;
+class QNetworkReply; 
+class ParallelDownloadManagerPrivate;
+
+// class declaration
+class ParallelDownloadManager
+{
+    DM_DECLARE_PRIVATE(ParallelDownloadManager); // private implementation
+public:
+    ParallelDownloadManager();
+    virtual ~ParallelDownloadManager();
+    
+    // returns all the current downloads
+    QList<Download *>& currentDownloads();
+    // finds a download provided id if exists
+    Download* findDownload(int dlId);
+    // cancels all the downloads and removes from the list
+    void removeAll();
+    // cancels and removes the download from list
+    void removeOne(Download *dl);
+    // pauses all the downloads which are in progress
+    void pauseAll();
+    // resumes all the downloads which are paused
+    void resumeAll();
+    // Adds to the download list
+    void addToParallelDownload(Download* dl);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/progressivedownloadserver.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,62 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PROGRESSIVE_DOWNLOAD_SERVER_H
+#define PROGRESSIVE_DOWNLOAD_SERVER_H
+
+#include "dmpimpl.h"
+#include <QObject>
+#include <QTcpServer>
+
+typedef QAbstractSocket::SocketError ProgressiveDlServerError;
+
+// forward declarations
+class ProgressiveDownloadServerPrivate;
+class Download;
+
+// class declaration 
+class ProgressiveDownloadServer : public QObject {
+    Q_OBJECT
+    DM_DECLARE_PRIVATE(ProgressiveDownloadServer);
+public:
+    Q_DECL_EXPORT ProgressiveDownloadServer(Download* download); 
+    virtual ~ProgressiveDownloadServer();
+
+    // starts the server
+    Q_DECL_EXPORT int startServer(void);
+    // stops the server
+    Q_DECL_EXPORT int stopServer(void);
+    // returns the port number
+    Q_DECL_EXPORT quint16 serverPort(void);
+    // last error occurred
+    Q_DECL_EXPORT ProgressiveDlServerError lastError(void);
+    // last error occurred
+    Q_DECL_EXPORT QString lastErrorString(void);
+
+private: // copy constructor and assaignment operator
+    ProgressiveDownloadServer();
+    ProgressiveDownloadServer(const ProgressiveDownloadServer&);
+    ProgressiveDownloadServer &operator=(const ProgressiveDownloadServer&);
+    bool event(QEvent *event);
+signals:
+
+private slots:
+    void handleConnection(void);
+    void handleRequest(void);
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/sequentialdownloadmanager.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,75 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SEQUENTIALDOWNLOADMANAGER_H
+#define SEQUENTIALDOWNLOADMANAGER_H
+
+#include "dmcommon.h"
+#include "dmpimpl.h"
+#include "downloadevent.h"
+#include <QObject>
+#include <QQueue>
+
+// forward declarations
+class ClientDownload;
+class QNetworkReply; 
+class SequentialDownloadManagerPrivate;
+
+// class declaration
+class SequentialDownloadManager : public QObject
+{
+    DM_DECLARE_PRIVATE(SequentialDownloadManager); // private implementation
+public:
+    SequentialDownloadManager();
+    virtual ~SequentialDownloadManager();
+    
+    // returns all the current downloads
+    QList<Download *>& currentDownloads();
+    // finds a download provided id if exists
+    Download* findDownload(int dlId);
+    // cancels all the downloads and removes from the list
+    void removeAll();
+    // cancels and removes the download from list
+    void removeOne(Download *dl);
+    // pauses all the downloads which are in progress
+    void pauseAll();
+    // resumes all the downloads which are paused
+    void resumeAll();
+    // Adds to the download list
+    void addToSequentialDownload(Download* dl);
+
+private:
+    // removes adownload from created download list to download queue for downloading
+    void addToDownloadQueue(Download* dl);
+    // adds downloads to completed list of downloads
+    void addToCompletedList(Download* dl);
+    // processes a download when download start fired
+    void process(int dlId);
+    // event handler
+    bool event(QEvent *event);
+    // starts the next download in downloadQueue
+    void startNext();
+    // pauses the download if it is the first one in the queue
+    void pauseDownload(int dlId);
+    // resumes the download if it is the first one in the queue
+    void resumeDownload(int dlId);
+    // cancels the download if it is the first one in the queue
+    void cancelDownload(int dlId);
+
+    friend class ClientDownload;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/storageutility.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,40 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef STORAGEUTILITY_H
+#define STORAGEUTILITY_H
+
+#include <QObject>
+
+#define TEMPORARY_FOLDER "downloads"
+#define FILENAME_UNKNOWN "Unknown"
+
+// class declaration
+
+// utility class
+class StorageUtility
+{
+public:
+    // generate unique filename
+    static int generateUniqueFileName(const QString &fileName, const QString &tempPath,
+            const QString& permPath, QString &outFileName);
+    // validate filename
+    static void validateFileName(const QString &fileName, QString &outFileName);
+    // create temporary path for writing the data
+    static QString createTemporaryPath(const QString& clientName);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/wmdrmdownloadbackend.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,89 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef WMDRMDOWNLOADBACKEND_H
+#define WMDRMDOWNLOADBACKEND_H
+
+#include <bldvariant.hrh>
+#if defined(RD_WMDRM_DLA_ENABLERS)
+
+#include "dmcommon.h"
+#include "dmcommoninternal.h"
+#include "downloadbackend.h"
+#include <e32base.h>
+
+// forward declarations
+class DownloadCore;
+class ClientDownload;
+class CCameseUtility;
+
+// class declaration
+
+// concrete download implementation for WM DRM downloads
+class WMDRMDownloadBackend : public DownloadBackend, public CActive
+{
+    Q_OBJECT
+public:
+    WMDRMDownloadBackend(DownloadCore *dlCore, ClientDownload *dl);
+    ~WMDRMDownloadBackend();
+
+    // fetches the wmdrm download attributes
+    QVariant getAttribute(DownloadAttribute attr);
+    // sets the wmdrm download specific attributes
+    int setAttribute(DownloadAttribute attr, const QVariant& value);
+    // overloaded function for pausing the download
+    int pause();
+    // overloaded function for resuming paused download
+    int resume();
+    // overloaded function for cancelling the download
+    int cancel();
+
+    // stores the data in storage
+    void store(QByteArray data, bool lastChunk=false);
+    // deletes the storage
+    void deleteStore();
+    // returns the size of stored data
+    qint64 storedDataSize();
+ 
+    // from base class CActive
+    void RunL();
+    void DoCancel();
+
+
+private slots:
+    void bytesRecieved(qint64 bytesRecieved, qint64 bytesTotal);
+    void handleFinished();    
+private:
+    // event handler
+    bool event(QEvent *event);
+    // mark download failed
+    void markDownloadFailed(const QString& error);
+
+private:
+    DownloadCore *m_downloadCore;
+    ClientDownload *m_download;
+    ClientDownload *m_contentDownload; // not owned
+    CCameseUtility* m_utility;
+    HBufC8* m_contentUrl;
+    
+    // Error status for the synchronous request
+    TInt m_requestResult;
+
+    //Waiter for the synchronous request  
+    CActiveSchedulerWait m_wait;   
+};
+#endif
+#endif   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/backgrounddownload.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,232 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "backgrounddownload.h"
+#include "download.h"
+#include "downloadmanager.h"
+#include "backgrounddownloadmanager.h"
+#include "downloadmanagerclient.h"
+#include "downloadevent.h"
+#include "downloadinfo.h"
+#include <QNetworkReply>
+#include <QCoreApplication>
+
+// private implementation
+class BackgroundDownloadPrivate
+{
+    DM_DECLARE_PUBLIC(BackgroundDownload);
+public:
+    BackgroundDownloadPrivate();
+    ~BackgroundDownloadPrivate();
+    int m_downloadId;
+    QString m_url;
+    DownloadManager *m_downloadManager; // not owned
+    BackgroundDownloadManager* m_backgroundMgr; // not owned
+    EventReceiverList m_eventReceiverList; // list of event listeners
+    DownloadManagerClient* m_downloadMgrClient; // not owned
+    DownloadInfo *m_dlInfo;         // not owned
+};
+
+BackgroundDownloadPrivate::BackgroundDownloadPrivate()
+{
+    m_downloadId = INVALID_DL_ID;
+    m_downloadManager = 0;
+    m_backgroundMgr = 0;
+    m_downloadMgrClient = 0;
+}
+
+BackgroundDownloadPrivate::~BackgroundDownloadPrivate()
+{
+}
+
+/*!
+ * \class BackgroundDownload
+ *
+ * \brief The public APIs for managing a background download
+ *
+ * This class has the public APIs for managing a single background download
+ */
+
+BackgroundDownload::BackgroundDownload(DownloadManager *mgr, const QString& url, int dlId)
+{
+    DM_INITIALIZE(BackgroundDownload);
+    priv->m_downloadId = dlId;
+    priv->m_url = url;
+    priv->m_downloadManager = mgr;
+    priv->m_backgroundMgr = mgr->backgroundManager();
+    priv->m_downloadMgrClient = priv->m_backgroundMgr->downloadManagerClient();
+    if (mgr)
+        priv->m_dlInfo = mgr->downloadInfo();
+    if (priv->m_dlInfo) {
+        priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EUrl, (const QString&)url);
+        priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EScope, (long)Background);
+    }
+}
+
+BackgroundDownload::~BackgroundDownload()
+{
+    DM_UNINITIALIZE(BackgroundDownload);
+}
+
+/*!
+  starts the background download, returns the success status
+*/
+int BackgroundDownload::start()
+{
+    DM_PRIVATE(BackgroundDownload);
+    if (priv->m_downloadMgrClient)
+        return priv->m_downloadMgrClient->startDownload(priv->m_downloadId);
+    return -1;
+}
+
+/*!
+  returns id of the background download
+*/
+int BackgroundDownload::id()
+{
+    DM_PRIVATE(BackgroundDownload);
+    return priv->m_downloadId;
+}
+
+/*!
+  sets the attribute for the background download
+  \a attr indicates attribute
+  \a value indicates value for the download
+*/
+int BackgroundDownload::setAttribute(DownloadAttribute attr, const QVariant& value)
+{
+    DM_PRIVATE(BackgroundDownload);
+    if (priv->m_downloadMgrClient)
+        return priv->m_downloadMgrClient->setDownloadAttribute(priv->m_downloadId, attr, value);
+    return -1;
+}
+
+/*!
+  fetches the attribute of the background download
+  \a attr indicates download attribute
+*/
+QVariant BackgroundDownload::getAttribute(DownloadAttribute attr)
+{
+    DM_PRIVATE(BackgroundDownload);
+    if (priv->m_downloadMgrClient)
+        return priv->m_downloadMgrClient->getDownloadAttribute(priv->m_downloadId, attr);
+    return QVariant();
+}
+
+/*!
+  pauses the background download
+*/
+int BackgroundDownload::pause()
+{
+    DM_PRIVATE(BackgroundDownload);
+    if (priv->m_downloadMgrClient)
+        return priv->m_downloadMgrClient->pauseDownload(priv->m_downloadId);
+    return -1;
+}
+
+/*!
+  resumes the background download
+*/
+int BackgroundDownload::resume()
+{
+    DM_PRIVATE(BackgroundDownload);
+    if (priv->m_downloadMgrClient)
+        return priv->m_downloadMgrClient->resumeDownload(priv->m_downloadId);
+    return -1;
+}
+
+/*!
+  cancels the background download
+*/
+int BackgroundDownload::cancel()
+{
+    DM_PRIVATE(BackgroundDownload);
+    if (priv->m_downloadMgrClient)
+        return priv->m_downloadMgrClient->cancelDownload(priv->m_downloadId);
+    return -1;
+}
+
+/*!
+  registers receiver for the background download events
+  \a reciever indicates reciever which listen to download events
+*/
+void BackgroundDownload::registerEventReceiver(QObject *receiver)
+{
+    DM_PRIVATE(BackgroundDownload);
+    if (receiver)
+       if (!priv->m_eventReceiverList.contains(receiver))
+            priv->m_eventReceiverList.append(receiver);
+}
+
+/*!
+  unregisters the event listener
+  \a receiver indicates listener which will be unregistered
+*/
+void BackgroundDownload::unregisterEventReceiver(QObject *receiver)
+{
+    DM_PRIVATE(BackgroundDownload);
+    priv->m_eventReceiverList.removeOne(receiver);
+}
+
+/*!
+  returns download manager
+*/
+DownloadManager* BackgroundDownload::downloadManager()
+{
+    DM_PRIVATE(BackgroundDownload);
+    return priv->m_downloadManager;
+}
+
+/*!
+  returns the child downloads i.e if download has any media objects
+  \a list indicates list of child downloads
+*/
+void BackgroundDownload::getChildren(QList<Download*>& /*list*/)
+{
+    // This feature is not supported at present
+    return;
+}
+
+// posts the event to recievers event loop
+void BackgroundDownload::postEvent(DEventType type, DlEventAttributeMap* attrMap)
+{
+    DM_PRIVATE(BackgroundDownload);
+    if((type == Failed) || (type == Completed) || (type == Cancelled)) {
+        if (!(type == Completed && InActive == priv->m_downloadManager->getAttribute(DlMgrPersistantMode)))
+            removeDownloadInfo();
+    }
+    EventReceiverList list = eventReceivers();
+    for (int i=0; i<list.size(); i++) {
+        if (list[i]) {
+            DownloadEvent *event = new DownloadEvent(type, attrMap, priv->m_downloadId);
+            QCoreApplication::postEvent(list[i], event);
+        }
+    }
+}
+
+// returns the event listeners
+EventReceiverList& BackgroundDownload::eventReceivers()
+{
+    DM_PRIVATE(BackgroundDownload);
+    return priv->m_eventReceiverList;
+}
+
+// remove info of this download
+void BackgroundDownload::removeDownloadInfo()
+{
+    DM_PRIVATE(BackgroundDownload);
+    priv->m_dlInfo->remove(priv->m_downloadId);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/backgrounddownloadmanager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,264 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadmanager.h"
+#include "backgrounddownloadmanager.h"
+#include "download.h"
+#include "backgrounddownload.h"
+#include "downloadmanagerclient.h"
+#include "downloadevent.h"
+#include "downloadinfo.h"
+#include <QHash>
+#include <QCoreApplication>
+#include <QNetworkReply>
+
+class BackgroundDownloadManagerPrivate
+{
+    //declare public implementation
+    DM_DECLARE_PUBLIC(BackgroundDownloadManager);
+public:
+    BackgroundDownloadManagerPrivate();
+    ~BackgroundDownloadManagerPrivate();
+
+    QList<Download*> m_downloads; // list of downloads
+    QString m_clientName; // client name
+    QObject *m_receiver; // event reciever
+    DownloadManager* m_downloadMgr; // not owned
+    DownloadManagerClient* m_downloadMgrClient; // owned
+    DownloadInfo* m_dlInfo; // not owned
+};
+
+BackgroundDownloadManagerPrivate::BackgroundDownloadManagerPrivate()
+{
+    m_clientName = "";
+    m_receiver = 0;
+    m_downloadMgr = 0;
+    m_downloadMgrClient = 0;
+}
+
+BackgroundDownloadManagerPrivate::~BackgroundDownloadManagerPrivate()
+{
+    if (m_downloadMgrClient) {
+        delete m_downloadMgrClient;
+        m_downloadMgrClient = 0;
+    }
+    m_downloadMgr = 0;
+    m_downloads.clear();
+}
+
+BackgroundDownloadManager::BackgroundDownloadManager(DownloadManager* downloadMgr)
+{
+    DM_INITIALIZE(BackgroundDownloadManager);
+    priv->m_downloadMgr = downloadMgr;
+    if (downloadMgr) {
+        priv->m_clientName = downloadMgr->getAttribute(DlMgrClientName).toString();
+        priv->m_dlInfo = downloadMgr->downloadInfo();
+    }
+}
+
+// destructor for the download manager
+BackgroundDownloadManager::~BackgroundDownloadManager()
+{
+    DM_UNINITIALIZE(BackgroundDownloadManager);
+}
+
+// initialises all the downloads which belongs to last download manager session
+void BackgroundDownloadManager::init()
+{
+    //load all downloads which were created in the last session
+    return;
+}
+
+// returns new download
+// url indicates download url
+Download* BackgroundDownloadManager::createDownload(const QString& url, DownloadType type)
+{
+    if (url.isEmpty())
+        return NULL;
+
+    DM_PRIVATE(BackgroundDownloadManager);
+    // connection to server will be established whrn DownloadManagerClient object is created
+    // so we delay the constructon of this object till client calls some function
+    if (!priv->m_downloadMgrClient)
+        priv->m_downloadMgrClient = new DownloadManagerClient(priv->m_downloadMgr);
+    // create downlaod at server
+    int downloadId = priv->m_downloadMgrClient->createDownload(url, type);
+    if (downloadId == INVALID_DL_ID)
+        return NULL;
+    Download* dl = new BackgroundDownload(priv->m_downloadMgr, url, downloadId);
+    if (dl)
+        priv->m_downloads.append(dl);
+    return dl;
+}
+
+// creates the background download from the persistantly stored download info
+Download* BackgroundDownloadManager::createDownload(int id)
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+
+    if ((id == INVALID_DL_ID) || (!priv->m_dlInfo))
+        return NULL;
+
+    // connection to server will be established when DownloadManagerClient object is created
+    // so we delay the constructon of this object till client calls some function
+    if (!priv->m_downloadMgrClient)
+        priv->m_downloadMgrClient = new DownloadManagerClient(priv->m_downloadMgr);
+    QString url;
+    priv->m_dlInfo->getValue(id, DownloadInfo::EUrl, url);
+    // create downlaod at server
+    bool status = priv->m_downloadMgrClient->attachToDownload(id);
+    if (status == false) {
+        // this means, download no more exists in server side
+        priv->m_dlInfo->remove(id);
+        return NULL;
+    }
+    Download* dl = new BackgroundDownload(priv->m_downloadMgr, url, id);
+    if (dl)               
+        priv->m_downloads.append(dl);
+    return dl;
+}
+
+// sets the proxy
+// proxyServer indicates proxy server name
+// port indicates port number
+void BackgroundDownloadManager::setProxy(const QString& proxyServer, int port)
+{
+    if (!proxyServer.isEmpty()) {
+        DM_PRIVATE(BackgroundDownloadManager);
+        // connection to server will be established whrn DownloadManagerClient object is created
+    // so we delay the constructon of this object till client calls some function
+        if (!priv->m_downloadMgrClient)
+            priv->m_downloadMgrClient = new DownloadManagerClient(priv->m_downloadMgr);
+        priv->m_downloadMgrClient->setProxy(proxyServer, port);
+    }
+}
+
+// sets download manager attribute
+// attr indicates download manager attribute
+// value indicates value to be set
+int BackgroundDownloadManager::setAttribute(DownloadManagerAttribute attr, const QVariant& value)
+{
+    // remove build warnings
+    DM_PRIVATE(BackgroundDownloadManager);
+    if (!priv->m_downloadMgrClient)
+        return -1;
+    int returnValue = priv->m_downloadMgrClient->setDownloadManagerAttribute(attr, value);
+    return returnValue;
+}
+
+// fetches download manager attribute
+// attr indicates download manager attribute whos value to be returned
+QVariant BackgroundDownloadManager::getAttribute(DownloadManagerAttribute attr)
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+    if (!priv->m_downloadMgrClient)
+        return QVariant();
+
+    // if download manager error, return the last client-server error
+    switch(attr) {
+    case DlMgrServerError:
+        return QVariant(priv->m_downloadMgrClient->serverError());
+    default:
+        break;
+    }
+
+    QVariant value = priv->m_downloadMgrClient->getDownloadManagerAttribute(attr);
+    return value;
+}
+
+// returns all the current downloads
+QList<Download*>& BackgroundDownloadManager::currentDownloads()
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+    return priv->m_downloads;
+}
+
+// finds a download provided id if exists
+// id indicates identifier for download
+Download* BackgroundDownloadManager::findDownload(int dlId)
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+    for (int i=0; i<priv->m_downloads.count(); ++i) {
+        if (priv->m_downloads[i]->id() == dlId) {
+            return priv->m_downloads[i];
+        }
+    }
+    return 0;
+}
+
+// cancels all the downloads
+void BackgroundDownloadManager::removeAll()
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+    if (!priv->m_downloadMgrClient)
+        return;
+
+    // before removing all downloads, remove their downloadinfo
+    for (int i=0; i<priv->m_downloads.count(); ++i) {
+        BackgroundDownload* download = dynamic_cast<BackgroundDownload*>(priv->m_downloads[i]);
+        if (download)
+            download->removeDownloadInfo();
+    }
+
+    priv->m_downloadMgrClient->removeAll();
+    for (int i=0; i<priv->m_downloads.count(); ++i) {
+        delete (priv->m_downloads[i]);
+        priv->m_downloads[i] = 0;
+    }
+    priv->m_downloads.clear();
+}
+
+// cancels and removes the download
+// dl indicates the download to be canceled and removed
+void BackgroundDownloadManager::removeOne(Download* dl)
+{
+    // check if download exists
+    if (!dl)
+        return;
+
+    DM_PRIVATE(BackgroundDownloadManager);
+    // return if download manager client does not exist yet
+    if (!priv->m_downloadMgrClient)
+        return;
+    // if this is a background download, remove it
+    if (priv->m_downloads.contains(dl)) {
+        priv->m_downloadMgrClient->removeDownload(dl->id());
+        priv->m_downloads.removeOne(dl);
+    }
+}
+
+// pauses all the downloads which are in progress
+void BackgroundDownloadManager::pauseAll()
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+    if (priv->m_downloadMgrClient)
+        priv->m_downloadMgrClient->pauseAll();
+}
+
+// resumes all the downloads which are paused
+void BackgroundDownloadManager::resumeAll()
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+    if (priv->m_downloadMgrClient)
+        priv->m_downloadMgrClient->resumeAll();
+}
+
+// get download manager client object
+DownloadManagerClient* BackgroundDownloadManager::downloadManagerClient()
+{
+    DM_PRIVATE(BackgroundDownloadManager);
+    return priv->m_downloadMgrClient;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/clientdownload.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,573 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "clientdownload.h"
+#include "downloadbackend.h"
+#include "downloadfactory.h"
+#include "downloadcoremanager.h"
+#include "downloadcore.h"
+#include "downloadmanager.h"
+#include "downloadevent.h"
+#include "downloadinfo.h"
+#include "sequentialdownloadmanager.h"
+#include <QNetworkReply>
+#include <QFileInfo>
+#include <QCoreApplication>
+
+#define PROGRESS_MINKB 5120 //Minimum KB to send progress events
+
+// private implementation
+class ClientDownloadPrivate
+{
+    DM_DECLARE_PUBLIC(ClientDownload);
+public:
+    ClientDownloadPrivate();
+    ~ClientDownloadPrivate();
+    int m_downloadId;
+    QString m_url;  // url
+    DownloadManager *m_downloadManager; // not owned, only reference
+    DownloadBackend *m_downloadBackend;
+    DownloadCore *m_downloadCore; // not owned
+    EventReceiverList m_eventReceiverList; // list of event listeners
+    DownloadInfo *m_dlInfo;         // not owned  
+    bool m_createdByDlInfo; // flag to indicate persistant ClientDownload
+    int m_parentId; // to set parent id
+    QMap<DownloadAttribute, QVariant> m_downloadAttrMap; // the map of attributes can be set by client
+};
+
+ClientDownloadPrivate::ClientDownloadPrivate():m_downloadId(-1)
+                                              ,m_url("")
+                                              ,m_downloadManager(0)
+                                              ,m_downloadBackend(0)
+                                              ,m_downloadCore(0)
+                                              ,m_dlInfo(0)
+                                              ,m_createdByDlInfo(false)
+                                              ,m_parentId(INVALID_DL_ID)
+{ }
+
+ClientDownloadPrivate::~ClientDownloadPrivate()
+{
+    if(m_downloadBackend)
+    {
+         delete m_downloadBackend;
+         m_downloadBackend = 0;
+    }
+}
+
+/*!
+ * \class ClientDownload
+ *
+ * \brief The public APIs for managing a ClientDownload
+ *
+ * This class has the public APIs for managing a single ClientDownload
+ */
+
+// note that parentdlId is id of the parent download which is applicable in the case
+// where parent download is oma download and child is media download
+ClientDownload::ClientDownload(DownloadManager *mgr, const QString& url
+                                                   , int dlId
+                                                   , DownloadType type/*=Parallel*/
+                                                   , int parentdlId /*=INVALID_DL_ID*/)
+{
+    DM_INITIALIZE(ClientDownload);
+    priv->m_downloadId = dlId;
+    priv->m_downloadManager = mgr;
+    priv->m_url = url;
+    priv->m_dlInfo = priv->m_downloadManager->downloadInfo();
+    if (parentdlId > INVALID_DL_ID)
+        setParentId(parentdlId);
+
+    // set the default destination path
+    priv->m_downloadAttrMap.insert(DlDestPath, mgr->getAttribute(DlMgrDestPath));
+    // set the default filename from url
+    QUrl urlToDownload(url);
+    QFileInfo fileUrl(urlToDownload.path());
+    QString fileName = fileUrl.fileName();
+    priv->m_downloadAttrMap.insert(DlFileName, fileName);
+    priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EFileName, fileName, parentdlId);
+    // set 5Kb as minimum size to send the progress event
+    priv->m_downloadAttrMap.insert(DlProgressInterval, PROGRESS_MINKB);
+    // set the download type
+    priv->m_downloadAttrMap.insert(DlDownloadType, type);
+    priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EType, (long)type, parentdlId);
+    // set the download scope
+    priv->m_downloadAttrMap.insert(DlDownloadScope, Normal);
+    priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EScope, (long)Normal, parentdlId);
+
+    // create ClientDownload core for network transactions
+    priv->m_downloadCore = priv->m_downloadManager->downloadCoreManager()->createDownloadCore(url);
+    // set the proxy
+    priv->m_downloadCore->setProxy(mgr->proxy());
+    connect(priv->m_downloadCore, SIGNAL(metaDataChanged()), this, SLOT(createDownloadImplementation()));
+}
+
+// note that parentdlId is id of the parent download which is applicable in the case
+// where parent download is oma download and child is media download
+ClientDownload::ClientDownload(DownloadManager *mgr, QNetworkReply *reply
+                                                   , int dlId
+                                                   , int parentdlId /*=INVALID_DL_ID*/)
+{
+    DM_INITIALIZE(ClientDownload);
+    priv->m_downloadManager = mgr;
+    priv->m_downloadId = dlId;
+    priv->m_dlInfo = priv->m_downloadManager->downloadInfo();
+    if (parentdlId > INVALID_DL_ID)
+        setParentId(parentdlId);
+
+    // set the default destination path
+    priv->m_downloadAttrMap.insert(DlDestPath, mgr->getAttribute(DlMgrDestPath));
+    if (reply) {
+        // set the default filename from url
+        QUrl urlToDownload(reply->url());
+        QFileInfo fileUrl(urlToDownload.path());
+        QString fileName = fileUrl.fileName();
+        priv->m_downloadAttrMap.insert(DlFileName, fileName);
+        priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EFileName, fileName, parentdlId);
+    }
+    // set 5Kb as minimum size to send the progress event
+    priv->m_downloadAttrMap.insert(DlProgressInterval, PROGRESS_MINKB);
+    // set the download type as parallel
+    priv->m_downloadAttrMap.insert(DlDownloadType, Parallel);
+    priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EType, (long)Parallel, parentdlId);
+        // set the download scope
+    priv->m_downloadAttrMap.insert(DlDownloadScope, Normal);
+    priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EScope, (long)Normal, parentdlId);
+    // create ClientDownload core for network transactions
+    priv->m_downloadCore = priv->m_downloadManager->downloadCoreManager()->createDownloadCore(reply);
+    // create actual implementation class based on content type of the ClientDownload
+    priv->m_downloadBackend = DownloadAbstractFactory::createDownloadImplementation(priv->m_downloadCore, this);
+    priv->m_downloadBackend->setStartTime();
+ }
+
+// this is the case for reading the persistant  ClientDownload information of last session and 
+// creating ClientDownload object
+ClientDownload::ClientDownload(DownloadManager *mgr, int dlId, int parentdlId)
+{
+    DM_INITIALIZE(ClientDownload);
+    priv->m_downloadManager = mgr;
+    priv->m_downloadId = dlId;
+    priv->m_createdByDlInfo =  true;
+    priv->m_dlInfo = priv->m_downloadManager->downloadInfo();
+    if (parentdlId > INVALID_DL_ID)
+         setParentId(parentdlId);
+
+    // read the path from persistant
+    QString path;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::EFinalPath, path, parentdlId);
+    priv->m_downloadAttrMap.insert(DlDestPath, path);
+
+    // set 5Kb as minimum size to send the progress event
+    priv->m_downloadAttrMap.insert(DlProgressInterval, PROGRESS_MINKB);
+    
+    // set the download type parallel/sequential
+    long type;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::EType, type, parentdlId);
+    priv->m_downloadAttrMap.insert(DlDownloadType, (DownloadType)type);
+
+    // set the priority
+    long priority;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::EPriority, priority, parentdlId);
+    priv->m_downloadAttrMap.insert(DlPriority, (DownloadPriority)priority);
+
+    // fetching url
+    QString url;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::EUrl, url, parentdlId);
+    // create ClientDownload core for network transactions
+    priv->m_downloadCore = priv->m_downloadManager->downloadCoreManager()->createDownloadCore(url);
+    // set the proxy
+    QNetworkProxy *proxy = priv->m_downloadCore->proxy();
+    if(!proxy && priv->m_downloadCore && priv->m_downloadManager) {
+         //set ClientDownload core's proxy as ClientDownload manager's proxy, if its not already set
+         priv->m_downloadCore->setProxy(priv->m_downloadManager->proxy());
+    }
+    // fetch the content type
+    QString contentType;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::EContentType, contentType, parentdlId);
+    priv->m_downloadCore->setContentType(contentType);
+
+    // fetch ETag header value
+    QString entityTag;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::EETag, entityTag, parentdlId);
+    priv->m_downloadCore->setEntityTag(entityTag);
+
+    // create actual implementation class based on content type of the ClientDownload
+    priv->m_downloadBackend = DownloadAbstractFactory::createDownloadImplementation(priv->m_downloadCore, this);
+    priv->m_downloadBackend->init();
+
+    long size = 0;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::ETotalSize, size, parentdlId);
+    priv->m_downloadBackend->setTotalSize(size);
+
+    long state = 0;
+    priv->m_dlInfo->getValue(priv->m_downloadId, DownloadInfo::EDlState, state, parentdlId);
+    if (state == DlCompleted) 
+        priv->m_downloadBackend->setDownloadedDataSize(size);
+    else {
+        // fetch the already downloaded data size
+        qint64 currentSize = priv->m_downloadBackend->storedDataSize();    
+        priv->m_downloadBackend->setDownloadedDataSize(currentSize);
+    }
+    
+    if (state  == DlInprogress)
+        priv->m_downloadBackend->setDownloadState(DlPaused);
+    else
+        priv->m_downloadBackend->setDownloadState((DownloadState)state);       
+}
+ 
+ClientDownload::~ClientDownload()
+{ 
+    DM_UNINITIALIZE(ClientDownload);
+}
+
+/*!
+  returns id of the ClientDownload
+*/
+int ClientDownload::id()
+{
+    DM_PRIVATE(ClientDownload);
+    return priv->m_downloadId;
+}
+
+/*!
+  starts the ClientDownload, returns the success status
+*/
+int ClientDownload::start()
+{
+    DM_PRIVATE(ClientDownload);
+    DownloadType type = (DownloadType)((priv->m_downloadAttrMap.value(DlDownloadType)).toInt());
+    if(type == Sequential)
+        priv->m_downloadManager->sequentialManager()->process(priv->m_downloadId);
+    else
+        startDownload(); // starts the download parallely
+    return 0;
+}
+
+/*!
+  sets the attribute for the ClientDownload
+  \a attr indicates attribute
+  \a value indicates value for the ClientDownload
+*/
+int ClientDownload::setAttribute(DownloadAttribute attr, const QVariant& value)
+{
+    //sets the attribute to ClientDownload backend
+    DM_PRIVATE(ClientDownload);
+    switch(attr)
+    {
+        case DlFileName:
+        case DlDestPath:
+        {            
+            // download is just created but not started
+            // filename, destination path can be set only before the download has started
+            if(!priv->m_downloadBackend)
+            {
+                QString strValue = value.toString();       
+                if(strValue.length() != 0)
+                    priv->m_downloadAttrMap.insert(attr, value);
+                return 0;
+            }
+            else
+                return -1;
+        }
+        case DlPriority:
+            {
+                // cannot change the priority once the download has started
+                if(!priv->m_downloadBackend)
+                {
+                    priv->m_downloadAttrMap.insert(attr, value);
+                    priv->m_dlInfo->setValue(priv->m_downloadId, DownloadInfo::EPriority, (long)(value.toInt()), parentId());
+                    // reshuffle the download queue based on the priority
+                    if((DownloadType)(priv->m_downloadAttrMap.value(DlDownloadType).toInt()) == Sequential)
+                        priv->m_downloadManager->sequentialManager()->addToSequentialDownload(this);
+                    return 0;
+                }
+            }
+        case DlProgressInterval:
+        {
+            qlonglong val = value.toLongLong() * 1024;
+            if (val >= PROGRESS_MINKB) {
+                priv->m_downloadAttrMap.insert(attr, val);
+                return 0;
+            }
+        }
+                
+        default:
+            if(priv->m_downloadBackend)
+                return priv->m_downloadBackend->setAttribute(attr, value);
+    }
+    return 0;
+}
+
+/*!
+  fetches the attribute of the ClientDownload
+  \a attr indicates ClientDownload attribute
+*/
+QVariant ClientDownload::getAttribute(DownloadAttribute attr)
+{
+    //gets attribute
+    DM_PRIVATE(ClientDownload);
+    switch(attr)
+    {
+        case DlFileName:
+        {
+            if(priv->m_downloadBackend) // download is already started
+                return priv->m_downloadBackend->getAttribute(attr);
+            else
+                return priv->m_downloadAttrMap.value(DlFileName);
+        }
+        case DlDestPath:
+        {
+            return priv->m_downloadAttrMap.value(DlDestPath);
+        }
+        case DlPriority:
+        {
+            return priv->m_downloadAttrMap.value(DlPriority);
+        }
+        case DlDownloadType:
+        {
+            return priv->m_downloadAttrMap.value(DlDownloadType);
+        }
+        case DlProgressInterval:
+        {
+            qlonglong val = priv->m_downloadAttrMap.value(DlProgressInterval).toLongLong() / 1024;
+            return val;
+        }
+        default:
+        {
+            if(priv->m_downloadBackend)
+                return priv->m_downloadBackend->getAttribute(attr);
+        }
+    }  
+    return QVariant();
+}
+
+/*!
+  pauses the ClientDownload
+*/
+int ClientDownload::pause()
+{
+    DM_PRIVATE(ClientDownload);
+    DownloadType type = (DownloadType)((priv->m_downloadAttrMap.value(DlDownloadType)).toInt());
+    if(type == Sequential)
+        priv->m_downloadManager->sequentialManager()->pauseDownload(priv->m_downloadId);
+    else
+        pauseDownload(); // pauses the download parallely
+    return 0;
+}
+
+/*!
+  resumes the ClientDownload
+*/
+int ClientDownload::resume()
+{
+    DM_PRIVATE(ClientDownload);
+    DownloadType type = (DownloadType)((priv->m_downloadAttrMap.value(DlDownloadType)).toInt());
+    if(type == Sequential)
+        priv->m_downloadManager->sequentialManager()->resumeDownload(priv->m_downloadId);
+    else
+        resumeDownload(); // resumes the download parallely
+    return 0;
+}
+
+/*!
+  cancels the ClientDownload
+*/
+int ClientDownload::cancel()
+{
+    DM_PRIVATE(ClientDownload);
+    DownloadType type = (DownloadType)((priv->m_downloadAttrMap.value(DlDownloadType)).toInt());
+    if(type == Sequential)
+        priv->m_downloadManager->sequentialManager()->cancelDownload(priv->m_downloadId);
+    else
+        cancelDownload(); // cancels the download parallely
+    return 0;
+}
+
+/*!
+  registers receiver for the ClientDownload events
+  \a reciever indicates reciever which listen to ClientDownload events
+*/
+void ClientDownload::registerEventReceiver(QObject *receiver)
+{
+    DM_PRIVATE(ClientDownload);
+    if(receiver)
+        if (!priv->m_eventReceiverList.contains(receiver))
+            priv->m_eventReceiverList.append(receiver);
+}
+
+/*!
+  unregisters the event listener
+  \a receiver indicates listener which will be unregistered
+*/
+void ClientDownload::unregisterEventReceiver(QObject *receiver)
+{
+    DM_PRIVATE(ClientDownload);
+    priv->m_eventReceiverList.removeOne(receiver);
+}
+
+EventReceiverList& ClientDownload::eventReceivers()
+{
+    DM_PRIVATE(ClientDownload);
+    return priv->m_eventReceiverList;
+}
+
+/*!
+  returns ClientDownload manager
+*/
+DownloadManager* ClientDownload::downloadManager()
+{
+    DM_PRIVATE(ClientDownload);
+    return priv->m_downloadManager;
+}
+
+/*!
+  returns the child downloads i.e if ClientDownload has any media objects
+  \a list indicates list of child downloads
+*/
+void ClientDownload::getChildren(QList<Download*>& list)
+{
+    DM_PRIVATE(ClientDownload);
+    if(priv->m_downloadBackend)
+       priv->m_downloadBackend->getChildren(list);
+}
+
+DownloadInfo* ClientDownload::downloadInfo()
+{
+    DM_PRIVATE(ClientDownload);
+    return priv->m_dlInfo;
+}
+
+void ClientDownload::createDownloadImplementation()
+{
+    DM_PRIVATE(ClientDownload);
+    //ClientDownload backend is created based on the content type
+    if(!priv->m_downloadBackend) {
+        priv->m_downloadBackend = DownloadAbstractFactory::createDownloadImplementation(priv->m_downloadCore, this);
+        priv->m_downloadBackend->setStartTime();
+        postEvent(HeaderReceived, NULL);
+    }
+}
+
+void ClientDownload::postEvent(DEventType type, DlEventAttributeMap* attrMap)
+{
+    DM_PRIVATE(ClientDownload);
+    EventReceiverList list = eventReceivers();
+    for(int i=0; i<list.size(); i++) {
+        if(list[i]) {
+            DownloadEvent *event = new DownloadEvent(type, attrMap, priv->m_downloadId);
+            QCoreApplication::postEvent(list[i], event);
+        }
+    }
+}
+
+void ClientDownload::setError(const QString& errorStr)
+{
+    DM_PRIVATE(ClientDownload);
+    priv->m_downloadCore->setLastErrorString(errorStr);
+    priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+}
+
+void ClientDownload::setDownloadState(DownloadState state)
+{
+    DM_PRIVATE(ClientDownload);
+    priv->m_downloadBackend->setDownloadState(state);
+}
+
+bool ClientDownload::isCreatedByDlInfo(void)
+{
+    DM_PRIVATE(ClientDownload);
+    return priv->m_createdByDlInfo;
+}
+
+void ClientDownload::setParentId(int parentId)
+{
+    DM_PRIVATE(ClientDownload);
+    priv->m_parentId = parentId;
+}
+
+int ClientDownload::parentId()
+{
+    DM_PRIVATE(ClientDownload);
+    return priv->m_parentId;
+}
+
+QMap<DownloadAttribute, QVariant>& ClientDownload::attributes(void)
+{
+    DM_PRIVATE(ClientDownload);
+    return priv->m_downloadAttrMap;
+}
+
+// starts the ClientDownload, returns the success status
+int ClientDownload::startDownload()
+{
+    DM_PRIVATE(ClientDownload);
+    if (!(priv->m_downloadCore))
+        return -1;  
+    QNetworkProxy *proxy = priv->m_downloadCore->proxy();
+    if(!proxy && priv->m_downloadManager) {
+         //set ClientDownload core's proxy as ClientDownload manager's proxy, if its not already set
+         priv->m_downloadCore->setProxy(priv->m_downloadManager->proxy());
+    }
+    priv->m_downloadCore->doDownload();
+
+    return 0;
+}
+
+int ClientDownload::pauseDownload()
+{
+    DM_PRIVATE(ClientDownload);
+    if( priv->m_downloadBackend ) {
+        DownloadState state = (DownloadState)priv->m_downloadBackend->getAttribute(DlDownloadState).toInt();
+        if( state != DlInprogress)
+            return 0;
+        return priv->m_downloadBackend->pause();
+    }
+    else
+        priv->m_downloadCore->abort();
+    return 0;
+}
+
+int ClientDownload::resumeDownload()
+{
+    DM_PRIVATE(ClientDownload);
+    QNetworkProxy *proxy = priv->m_downloadCore->proxy();
+    if(!proxy && priv->m_downloadCore && priv->m_downloadManager) {
+         //set ClientDownload core's proxy as ClientDownload manager's proxy, if its not already set
+         priv->m_downloadCore->setProxy(priv->m_downloadManager->proxy());
+    }
+    if(priv->m_downloadBackend) {
+        DownloadState state = (DownloadState)priv->m_downloadBackend->getAttribute(DlDownloadState).toInt();
+        if((state != DlPaused) && (state != DlCancelled))
+            return 0;
+        return priv->m_downloadBackend->resume();
+    }
+    else
+        startDownload(); // This means, ClientDownload has just been created but never started
+    return 0;
+}
+
+int ClientDownload::cancelDownload()
+{
+    // cancels the ClientDownload
+    DM_PRIVATE(ClientDownload);
+    if( priv->m_downloadBackend ) {
+        DownloadState state = (DownloadState)priv->m_downloadBackend->getAttribute(DlDownloadState).toInt();
+        if((state == DlCompleted) || (state == DlFailed) || (state == DlCancelled))
+            return 0; 
+        return priv->m_downloadBackend->cancel();
+    }
+    return 0;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadbackend.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,486 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "clientdownload.h"
+#include "downloadmanager.h"
+#include "downloadbackend.h"
+#include "downloadcore.h"
+#include "downloadfactory.h"
+#include "downloadstore.h"
+#include <QCoreApplication>
+#include <QDateTime>
+
+//private implementation
+class DownloadBackendPrivate
+{
+    DM_DECLARE_PUBLIC(DownloadBackend);
+public:
+    DownloadBackendPrivate();
+    ~DownloadBackendPrivate();
+
+    DownloadCore *m_downloadCore; // not owned
+    ClientDownload *m_download; //// not owned, only reference 
+    DownloadInfo *m_dlInfo; // not owned
+    qint64 m_totalSize; // total size of the download
+    qint64 m_currentDownloadedSize; // current downloaded size
+    qint64 m_lastPausedSize;
+    DownloadState m_downloadState; // state of the download
+    bool m_infoDeleted; // flag to indicate the info deletion    
+    QDateTime m_startTime; // download start/resumed time
+    QDateTime m_endTime; // download completed time
+    int m_progressCounter;
+};  
+
+DownloadBackendPrivate::DownloadBackendPrivate()
+{
+    m_downloadCore = 0;
+    m_download = 0;
+    m_dlInfo = 0;
+    m_totalSize = 0;
+    m_currentDownloadedSize = 0;
+    m_lastPausedSize =0;
+    m_infoDeleted = false;
+    m_progressCounter = 1;
+}
+
+DownloadBackendPrivate::~DownloadBackendPrivate()
+{
+#if 0 //m_downloadCore may be stale.
+    if(m_downloadCore)
+    {     
+        // cancel if there is any transaction
+        m_downloadCore->abort();
+    }
+#endif
+}
+
+DownloadBackend::DownloadBackend(DownloadCore *dlCore, ClientDownload* dl)
+{
+    DM_INITIALIZE(DownloadBackend);
+    priv->m_downloadCore = dlCore;
+    priv->m_download = dl;
+    priv->m_dlInfo = dl->downloadInfo();
+    // connect all the signals from network
+    connect(dlCore, SIGNAL(downloadProgress(qint64 , qint64 )), this, SLOT(bytesRecieved(qint64 , qint64 )));
+    connect(dlCore, SIGNAL(finished()), this, SLOT(handleFinished()));
+    connect(dlCore, SIGNAL(metaDataChanged()), this, SLOT(headerReceived()));
+    connect(dlCore, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError)));
+    connect(dlCore, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(bytesUploaded(qint64, qint64)));
+
+    // save the content type and url
+    setValue(DownloadInfo::EContentType, priv->m_downloadCore->contentType()); 
+    setValue(DownloadInfo::EUrl, priv->m_downloadCore->url()); 
+    setValue(DownloadInfo::EETag, priv->m_downloadCore->entityTag());
+    postEvent(Started, NULL);
+}
+
+DownloadBackend::~DownloadBackend()
+{
+    DM_UNINITIALIZE(DownloadBackend);
+}
+
+int DownloadBackend::pause()
+{
+    DM_PRIVATE(DownloadBackend);
+    setDownloadState(DlPaused);
+    priv->m_downloadCore->abort();
+    return 0;
+}
+
+int DownloadBackend::resume()
+{
+    DM_PRIVATE(DownloadBackend);
+    setDownloadState(DlInprogress);
+    // save the content type and url
+    setValue(DownloadInfo::EUrl, priv->m_downloadCore->url());
+    setValue(DownloadInfo::EContentType, priv->m_downloadCore->contentType());
+    priv->m_lastPausedSize = priv->m_currentDownloadedSize;
+    priv->m_downloadCore->resumeDownload(priv->m_currentDownloadedSize);
+    priv->m_startTime = QDateTime::currentDateTime();
+    postEvent(Progress, NULL);
+    return 0;
+}
+
+int DownloadBackend::cancel()
+{
+    DM_PRIVATE(DownloadBackend);   
+    setDownloadState(DlCancelled);
+    // cancel the transaction
+    priv->m_downloadCore->abort();
+    // delete the temporary storage
+    deleteStore();
+    // reset the states
+    priv->m_totalSize = 0;
+    priv->m_currentDownloadedSize = 0;
+    priv->m_lastPausedSize = 0;
+    return 0;
+}
+
+QVariant DownloadBackend::getAttribute(DownloadAttribute attr)
+{
+    DM_PRIVATE(DownloadBackend); 
+    switch(attr)
+    {
+         case DlDownloadedSize:
+         {
+             return QVariant(priv->m_currentDownloadedSize);
+         }
+         case DlTotalSize:
+         {
+             return QVariant(priv->m_totalSize);
+         }
+         case DlDownloadState:
+         {
+             return QVariant(priv->m_downloadState);
+         }
+         case DlSourceUrl:
+         {
+             return QVariant(priv->m_downloadCore->url());
+         }
+         case DlContentType:
+         {
+             return QVariant(priv->m_downloadCore->contentType());
+         }
+         case DlStartTime:
+         {
+             return QVariant(priv->m_startTime);
+         }
+         case DlEndTime:
+         {
+             if (priv->m_downloadState == DlCompleted)
+                 return priv->m_endTime;
+             else 
+                 return QVariant();
+         }
+         case DlElapsedTime:
+         {
+             if (priv->m_downloadState == DlCompleted)
+                 return QVariant((priv->m_endTime.toTime_t()-priv->m_startTime.toTime_t()));
+
+             if (priv->m_downloadState != DlInprogress)
+                 return QVariant();
+             QDateTime currentTime = QDateTime::currentDateTime();
+             uint timeElasped = currentTime.toTime_t() - priv->m_startTime.toTime_t();
+             return QVariant(timeElasped);
+         }
+         case DlRemainingTime:
+         {
+             if (priv->m_downloadState != DlInprogress)
+                 return QVariant();
+             QDateTime currentTime = QDateTime::currentDateTime();
+             uint timeElasped = currentTime.toTime_t() - priv->m_startTime.toTime_t();
+             // total bytes recieved since last start/resume
+             qint64 totalBytesRecieved = priv->m_currentDownloadedSize - priv->m_lastPausedSize;
+             qint64 remainingSize = priv->m_totalSize - priv->m_currentDownloadedSize;
+             if (totalBytesRecieved > 0)
+                 return QVariant((timeElasped*remainingSize)/totalBytesRecieved);
+             else
+                 return QVariant();
+         }
+         case DlSpeed:
+         {
+             if (priv->m_downloadState != DlInprogress)
+                 return QVariant();
+             QDateTime currentTime = QDateTime::currentDateTime();
+             uint timeElasped = currentTime.toTime_t() - priv->m_startTime.toTime_t();
+             qint64 totalBytesRecieved = priv->m_currentDownloadedSize - priv->m_lastPausedSize;
+             if (timeElasped > 0)
+                 return QVariant(totalBytesRecieved/timeElasped);
+             else
+                 return QVariant();
+         }
+         case DlPercentage:
+         {
+             if (priv->m_totalSize > 0)
+                 return QVariant((priv->m_currentDownloadedSize*100)/priv->m_totalSize);
+             else
+                 return QVariant();
+         }
+         case DlLastError:
+         {
+             return QVariant(priv->m_downloadCore->lastError());
+         }
+         case DlLastErrorString:
+         {
+             return QVariant(priv->m_downloadCore->lastErrorString());
+         }
+         default:
+         {
+             break;
+         }
+     }
+    return QVariant();
+     
+}
+
+int DownloadBackend::setAttribute(DownloadAttribute /*attr*/, const QVariant& /*value*/)
+{
+    return -1;
+}
+
+void DownloadBackend::bytesRecieved(qint64 bytesRecieved, qint64 bytesTotal)
+{
+    DM_PRIVATE(DownloadBackend);
+    if((priv->m_downloadState == DlFailed) || (bytesRecieved == 0))
+    {
+        return;
+    }
+ 
+    // in case of resumed downloads, we recieve total size remained to download
+    setTotalSize(priv->m_lastPausedSize + bytesTotal);
+    priv->m_currentDownloadedSize = priv->m_lastPausedSize + bytesRecieved;
+    setDownloadState(DlInprogress);
+    // store the recieved chunk
+    store(priv->m_downloadCore->reply()->readAll(), false); 
+    postEvent(Progress, NULL);
+}
+
+void DownloadBackend::handleFinished()
+{
+    DM_PRIVATE(DownloadBackend);
+
+    DownloadState state = priv->m_downloadState;
+    if( state == DlFailed )
+    {
+        postEvent(Failed, NULL);  
+        return;
+    }
+    if( state == DlPaused )
+    {
+        postEvent(Paused, NULL);  
+        return;
+    }
+    if( state == DlCancelled )
+    {
+        postEvent(Cancelled, NULL);  
+        return;
+    }
+    if(priv->m_currentDownloadedSize < priv->m_totalSize)
+    {
+        // all packets are not recieved, so it is not last chunk 
+        // should be some network problem
+        store(priv->m_downloadCore->reply()->readAll(), false); 
+        postEvent(NetworkLoss, NULL);
+    }
+    else
+    {
+        //finish is successful
+        store(priv->m_downloadCore->reply()->readAll(), true);
+        //finish is successful
+        setDownloadState(DlCompleted);
+        priv->m_endTime = QDateTime::currentDateTime();
+        postEvent(Completed, NULL);
+    } 
+}
+
+void DownloadBackend::error(QNetworkReply::NetworkError code)
+{
+    DM_PRIVATE(DownloadBackend);
+    if((code == QNetworkReply::OperationCanceledError) && (priv->m_downloadState == DlCancelled))
+    { 
+        return;
+    }   
+    if(code == QNetworkReply::OperationCanceledError) 
+    {
+        // this means user has paused the download
+        setDownloadState(DlPaused);
+    }   
+    else if(code != QNetworkReply::NoError)
+    {
+        priv->m_downloadCore->setLastError(code);
+        if(priv->m_downloadCore->reply())
+        {
+            priv->m_downloadCore->setLastErrorString(priv->m_downloadCore->reply()->errorString());
+        }
+        setDownloadState(DlFailed);
+        postEvent(Error, NULL);
+    }
+}
+
+void DownloadBackend::postEvent(DEventType type, DlEventAttributeMap* attrMap)
+{
+    DM_PRIVATE(DownloadBackend);
+    // The client if it doesn't want progress events then it can set the DownloadMgrProgress mode as quiet
+    // If it wants progress events at regular intervals then it has to specify the KiloBytes at which it requires the progress event.
+    // By default, the DownloadMgrProgress Mode is non-quiet with progress events being sent at every 5KB downloaded. 
+    DownloadMgrProgressMode mode = (DownloadMgrProgressMode)(priv->m_download->downloadManager()->getAttribute(DlMgrProgressMode)).toInt();
+    if ((mode == Quiet) && (type == Progress))
+        return;
+
+    qlonglong kBytes = priv->m_download->getAttribute(DlProgressInterval).toLongLong() * 1024;
+    if (mode == NonQuiet && type == Progress)
+    {
+        if ((priv->m_currentDownloadedSize/(kBytes * priv->m_progressCounter)) > 0)
+        {
+            priv->m_progressCounter++;
+            postDownloadEvent(type, attrMap);
+        }
+    }
+    else
+        postDownloadEvent(type, attrMap);
+}
+
+DownloadState DownloadBackend::downloadState(void)
+{
+    DM_PRIVATE(DownloadBackend);
+    return priv->m_downloadState;
+}
+
+void DownloadBackend::setDownloadState(DownloadState state)
+{
+    DM_PRIVATE(DownloadBackend);
+    priv->m_downloadState = state;
+    // save the download state
+    setValue(DownloadInfo::EDlState, priv->m_downloadState);
+    if((state == DlFailed) || (state == DlCompleted) || (state == DlCancelled))
+    {
+        // remove dl info
+            deleteInfo();
+    }
+}
+
+void DownloadBackend::setDownloadedDataSize(qint64 size)
+{
+    DM_PRIVATE(DownloadBackend);
+    priv->m_currentDownloadedSize = size;
+    return;
+}
+
+void DownloadBackend::setTotalSize(qint64 size)
+{
+    DM_PRIVATE(DownloadBackend);
+    priv->m_totalSize = size;
+    setValue(DownloadInfo::ETotalSize, priv->m_totalSize);
+    return;
+}
+
+void DownloadBackend::setStartTime()
+{
+    DM_PRIVATE(DownloadBackend);
+    priv->m_startTime = QDateTime::currentDateTime();
+}
+
+ClientDownload* DownloadBackend::download(void)
+{
+    DM_PRIVATE(DownloadBackend);
+    return priv->m_download;
+}
+
+/* Helper functions to access download info */
+
+int DownloadBackend::setValue(DownloadInfo::Key aKey, const QString& aStrValue)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->setValue(priv->m_download->id(), aKey, aStrValue, priv->m_download->parentId());
+}
+
+int DownloadBackend::setValueForChild(DownloadInfo::Key aKey, const QString& aStrValue, int aChildId)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->setValueForChild(priv->m_download->id(), aKey, aStrValue, aChildId);
+}
+
+int DownloadBackend::setValue(DownloadInfo::Key aKey, long aIntValue)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->setValue(priv->m_download->id(), aKey, aIntValue, priv->m_download->parentId());
+}
+
+int DownloadBackend::setValueForChild(DownloadInfo::Key aKey, long aIntValue, int aChildId)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->setValueForChild(priv->m_download->id(), aKey, aIntValue, aChildId);
+}
+
+int DownloadBackend::setValue(DownloadInfo::Key aKey, const QList<QVariant>& aChildIds)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->setValue(priv->m_download->id(), aKey, aChildIds);
+}
+
+int DownloadBackend::getValue(DownloadInfo::Key aKey, QString& aStrValue)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->getValue(priv->m_download->id(), aKey, aStrValue, priv->m_download->parentId());
+}
+
+int DownloadBackend::getValueForChild(DownloadInfo::Key aKey, QString& aStrValue, int aChildId)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->getValueForChild(priv->m_download->id(), aKey, aStrValue, aChildId);
+}
+
+int DownloadBackend::getValue(DownloadInfo::Key aKey, long& aIntValue)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->getValue(priv->m_download->id(), aKey, aIntValue, priv->m_download->parentId());
+}
+
+int DownloadBackend::getValueForChild(DownloadInfo::Key aKey, long& aIntValue, int aChildId)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->getValueForChild(priv->m_download->id(), aKey, aIntValue, aChildId);
+ 
+}
+
+int DownloadBackend::getValue(DownloadInfo::Key aKey, QList<QVariant>& aChildIds)
+{
+    DM_PRIVATE(DownloadBackend);
+    if(priv->m_infoDeleted)
+        return 0;
+    return priv->m_dlInfo->getValue(priv->m_download->id(), aKey, aChildIds);
+}
+
+int DownloadBackend::deleteInfo()
+{
+    DM_PRIVATE(DownloadBackend);
+    if ((InActive == priv->m_download->downloadManager()->getAttribute(DlMgrPersistantMode))
+        && (DlCompleted == priv->m_downloadState))
+        return 0;
+    priv->m_infoDeleted = true;
+    return priv->m_dlInfo->remove(priv->m_download->id(), priv->m_download->parentId()); 
+}
+void DownloadBackend::postDownloadEvent(DEventType type, DlEventAttributeMap* attrMap)
+{
+    DM_PRIVATE(DownloadBackend);
+    EventReceiverList list = priv->m_download->eventReceivers();
+    for(int i=0; i<list.size(); i++)
+    {
+        if(list[i])
+        {
+            DownloadEvent *event = new DownloadEvent(type, attrMap, priv->m_download->id());
+            QCoreApplication::postEvent(list[i], event);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadcore.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,370 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <qnetworkaccessmanager.h>
+#include <QNetworkReply>
+#include <QNetworkProxy>
+#include "downloadcore.h"
+
+// Http Headers
+#define RANGE_HEADER "Range"
+#define ETAG_HEADER "ETag"
+#define ECONTENT_DISPOSITION_HEADER "Content-Disposition"
+#define IF_MATCH_HEADER "If-Match"
+
+enum DownloadMethod
+{
+    Invalid,
+    FromURL,
+    FromReply
+};
+
+// private implementation class
+class DownloadCorePrivate
+{
+    DM_DECLARE_PUBLIC(DownloadCore);
+public:
+    DownloadCorePrivate();
+    ~DownloadCorePrivate();
+
+    // member variables
+    QString m_url; // url
+    QNetworkReply *m_reply;
+    QNetworkAccessManager *m_networkAccessManager;
+    // content type
+    QString m_contentType;
+    // ETag header value
+    QString m_entityTag;
+    // total size
+    qint64 m_sizeInHeader;
+    // Last error code
+    QNetworkReply::NetworkError m_lastError;
+    QString m_lastErrorString;
+    QNetworkProxy *m_proxy;  //not owned
+    DownloadMethod m_dlMethod; 
+    bool networkAccessManagerOwned;
+    QString m_fileNameFromContentDisposition;
+};
+
+DownloadCorePrivate::DownloadCorePrivate()
+{
+    m_url = "";
+    m_reply = 0;
+    m_networkAccessManager = 0;
+    m_contentType = "";
+    m_entityTag = "";
+    m_sizeInHeader = 0;
+    m_lastError = QNetworkReply::NoError;
+    m_lastErrorString = "";
+    m_proxy = 0;
+    m_dlMethod = Invalid;
+    networkAccessManagerOwned = false;
+    m_fileNameFromContentDisposition ="";
+}
+
+DownloadCorePrivate::~DownloadCorePrivate()
+{
+    if(m_reply)
+    {
+        m_reply->deleteLater();
+        m_reply = 0;
+    }
+    if(networkAccessManagerOwned && m_networkAccessManager)
+    {
+        m_networkAccessManager->disconnect();    
+        delete m_networkAccessManager;
+        m_networkAccessManager = 0;
+    }
+}       
+
+DownloadCore::DownloadCore(const QString& url)
+{
+    DM_INITIALIZE(DownloadCore);
+    priv->m_url = url;
+    priv->m_dlMethod = FromURL;
+
+    if(!priv->m_networkAccessManager)
+    {
+        priv->m_networkAccessManager = new QNetworkAccessManager(this);
+        priv->networkAccessManagerOwned = true;
+    }
+}
+
+DownloadCore::DownloadCore(QNetworkReply *reply)
+{
+    DM_INITIALIZE(DownloadCore);
+    priv->m_reply = reply;
+    priv->m_dlMethod = FromReply;
+
+    priv->m_networkAccessManager = (priv->m_reply)->manager();
+    priv->m_url = (priv->m_reply)->url().toString(QUrl::None);
+
+    QVariant header = (priv->m_reply)->header(QNetworkRequest::ContentLengthHeader);
+    if(header.isValid())
+    {
+        priv->m_sizeInHeader = header.toInt();
+    }
+    
+    header = (priv->m_reply)->header(QNetworkRequest::ContentTypeHeader);
+    if(header.isValid())
+    {
+        priv->m_contentType = header.toString();
+    }
+}
+
+DownloadCore::~DownloadCore()
+{
+    DM_UNINITIALIZE(DownloadCore);
+}
+
+int DownloadCore::doDownload(void)
+{
+    DM_PRIVATE(DownloadCore);
+    switch(priv->m_dlMethod)
+    {
+        case FromURL:
+        {
+            if((priv->m_url).length() <= 0 )
+            {
+                return -1;
+            }
+            if(priv->m_proxy)
+            {
+                priv->m_networkAccessManager->setProxy(*(priv->m_proxy));
+            }
+            
+            /* submit the HTTP request */
+            QNetworkRequest req(priv->m_url);
+            priv->m_reply = (priv->m_networkAccessManager)->get(req);
+
+            /* establish all HTTP listeners */
+            connect(priv->m_reply, SIGNAL(metaDataChanged()),                     this, SLOT(parseHeaders()));    
+            connect(priv->m_reply, SIGNAL(downloadProgress(qint64 , qint64 )),    this, SIGNAL(downloadProgress(qint64 , qint64 )));
+            connect(priv->m_reply, SIGNAL(finished()),                            this, SIGNAL(finished()));
+            connect(priv->m_reply, SIGNAL(error(QNetworkReply::NetworkError)),    this, SIGNAL(error(QNetworkReply::NetworkError)));
+            break;
+        }
+        case FromReply:
+        { 
+            if(!priv->m_reply)
+            {
+                return -1;
+            }
+            /* establish all HTTP listeners */
+            connect(priv->m_reply, SIGNAL(downloadProgress(qint64 , qint64 )),this, SIGNAL(downloadProgress(qint64 , qint64 )));
+            connect(priv->m_reply, SIGNAL(finished()),                        this, SIGNAL(finished()));
+            connect(priv->m_reply, SIGNAL(error(QNetworkReply::NetworkError)),this, SIGNAL(error(QNetworkReply::NetworkError)));            
+            break;
+        }
+        default:
+        {
+            return -1;// error
+        }
+    }
+    return 0; // successful
+}
+
+int DownloadCore::post(const QString& url, const QByteArray& data)
+{
+    DM_PRIVATE(DownloadCore);
+    QNetworkRequest req(url); 
+    // cancel the ongoing transaction if any
+    abort();
+    // post the data
+    priv->m_reply = priv->m_networkAccessManager->post(req, data);
+    if(priv->m_reply)
+    {
+        connect(priv->m_reply, SIGNAL(uploadProgress(qint64, qint64)), this, SIGNAL(uploadProgress(qint64, qint64)));
+        return 0; // successful
+    }
+    else
+    {
+        return -1; // error
+    }
+}
+
+int DownloadCore::resumeDownload(qint64 startOffeset)
+{
+    DM_PRIVATE(DownloadCore);
+
+    QNetworkRequest req(priv->m_url);
+    // set the RANGE header
+    QString buf;
+    buf.sprintf("bytes=%ld-", (long int)startOffeset);
+    req.setRawHeader(RANGE_HEADER, buf.toAscii());
+    // set ETag header
+    if (!priv->m_entityTag.isEmpty())
+        req.setRawHeader(IF_MATCH_HEADER, (priv->m_entityTag).toAscii());
+
+    if(!priv->m_networkAccessManager)
+    {
+        priv->m_networkAccessManager = new QNetworkAccessManager(this);
+        priv->networkAccessManagerOwned = true;
+    }
+    if(priv->m_proxy)
+    {
+        priv->m_networkAccessManager->setProxy(*(priv->m_proxy));
+    }
+
+    /* submit the HTTP request */
+    priv->m_reply = (priv->m_networkAccessManager)->get(req);
+
+    /* establish all HTTP listeners */
+    connect(priv->m_reply, SIGNAL(metaDataChanged()),                     this, SLOT(parseHeaders()));
+    connect(priv->m_reply, SIGNAL(downloadProgress(qint64 , qint64 )),    this, SIGNAL(downloadProgress(qint64 , qint64 )));
+    connect(priv->m_reply, SIGNAL(finished()),                            this, SIGNAL(finished()));
+    connect(priv->m_reply, SIGNAL(error(QNetworkReply::NetworkError)),    this, SIGNAL(error(QNetworkReply::NetworkError)));
+    return 0; // successful
+}
+
+int DownloadCore::abort(void)
+{
+    DM_PRIVATE(DownloadCore);
+    if(priv->m_reply)
+    {
+        (priv->m_reply)->abort();
+        priv->m_reply->deleteLater();
+        priv->m_reply = 0;
+    }
+    return 0; // successful
+}
+
+QString& DownloadCore::url(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_url;
+}
+
+void DownloadCore::changeUrl(QString& url)
+{
+    DM_PRIVATE(DownloadCore);
+    priv->m_url = url;
+    priv->m_dlMethod = FromURL;
+}
+
+QNetworkReply* DownloadCore::reply(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_reply;
+}
+
+QNetworkAccessManager* DownloadCore::networkAccessManager(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_networkAccessManager;
+}
+
+QString& DownloadCore::contentType(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_contentType;
+}
+
+QString& DownloadCore::entityTag(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_entityTag;
+}
+
+void DownloadCore::setContentType(const QString& contentType)
+{
+    DM_PRIVATE(DownloadCore);
+    priv->m_contentType = contentType;
+    return;
+}
+
+void DownloadCore::setEntityTag(const QString& entityTag)
+{
+    DM_PRIVATE(DownloadCore);
+    priv->m_entityTag = entityTag;
+}
+
+qint64 DownloadCore::sizeInHeader(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_sizeInHeader;
+}
+
+QNetworkReply::NetworkError DownloadCore::lastError(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_lastError;
+}
+
+void DownloadCore::setLastError(QNetworkReply::NetworkError code)
+{
+    DM_PRIVATE(DownloadCore);
+    priv->m_lastError = code;
+}
+
+QString DownloadCore::lastErrorString(void)
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_lastErrorString;
+}
+
+void DownloadCore::setLastErrorString(const QString& errStr)
+{
+    DM_PRIVATE(DownloadCore);
+    priv->m_lastErrorString = errStr;
+}
+
+void DownloadCore::setProxy(QNetworkProxy *proxy)
+{
+    DM_PRIVATE(DownloadCore);
+    priv->m_proxy = proxy;
+}
+
+QNetworkProxy* DownloadCore::proxy()
+{
+    DM_PRIVATE(DownloadCore);
+    return priv->m_proxy;
+}
+
+QString DownloadCore::fileNameFromContentDispositionHeader()
+{
+     DM_PRIVATE(DownloadCore);
+     return priv->m_fileNameFromContentDisposition;
+}
+
+void DownloadCore::parseHeaders(void)
+{
+    DM_PRIVATE(DownloadCore);
+    QVariant lenHeader = (priv->m_reply)->header(QNetworkRequest::ContentLengthHeader);
+    if(lenHeader.isValid())
+    {
+        priv->m_sizeInHeader = lenHeader.toInt();
+    }                
+    priv->m_contentType = (priv->m_reply)->header(QNetworkRequest::ContentTypeHeader).toString();
+
+    // ETag
+    priv->m_entityTag = (priv->m_reply)->rawHeader(ETAG_HEADER);
+    
+    if (priv->m_reply->hasRawHeader(ECONTENT_DISPOSITION_HEADER)) {
+        const QString value = priv->m_reply->rawHeader(ECONTENT_DISPOSITION_HEADER);
+        const int pos = value.indexOf("filename=");
+        if (pos != -1) {
+            QString name = value.mid(pos + 9);
+            if (name.startsWith('"') && name.endsWith('"'))
+                name = name.mid(1, name.size() - 2);
+            priv->m_fileNameFromContentDisposition = name;
+        }
+    }
+    // emit the signal
+    emit metaDataChanged();
+    return;
+}
+   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadcoremanager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,81 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadcore.h"
+#include "downloadcoremanager.h"
+#include <QVector>
+
+// private implementation class
+class DownloadCoreManagerPrivate
+{
+    DM_DECLARE_PUBLIC(DownloadCoreManager);
+public:
+    DownloadCoreManagerPrivate();
+    ~DownloadCoreManagerPrivate();
+
+    QVector<DownloadCore*> m_downloadCores;
+    QString m_clientName;
+};
+
+DownloadCoreManagerPrivate::DownloadCoreManagerPrivate()
+{
+    m_clientName = "";
+}
+
+DownloadCoreManagerPrivate::~DownloadCoreManagerPrivate()
+{
+    int totalSize = m_downloadCores.size();
+    for( int i=0; i < totalSize; i++)
+    {
+       delete m_downloadCores[i];
+    }
+    m_downloadCores.clear();
+}
+
+DownloadCoreManager::DownloadCoreManager(const QString &clientName)
+{
+    DM_INITIALIZE(DownloadCoreManager);
+    priv->m_clientName = clientName;
+}
+
+DownloadCoreManager::~DownloadCoreManager()
+{
+   DM_UNINITIALIZE(DownloadCoreManager);
+}
+
+DownloadCore* DownloadCoreManager::createDownloadCore(const QString &aUrl)
+{
+    DM_PRIVATE(DownloadCoreManager);
+    // create download core by url
+    DownloadCore* dlCore = new DownloadCore(aUrl);
+    (priv->m_downloadCores).append(dlCore);
+    return dlCore;     
+}
+
+DownloadCore* DownloadCoreManager::createDownloadCore(QNetworkReply *reply)
+{
+    DM_PRIVATE(DownloadCoreManager);
+    // create download core by network reply
+    DownloadCore* dlCore = new DownloadCore(reply);
+    (priv->m_downloadCores).append(dlCore);
+    return dlCore;     
+}
+
+QString& DownloadCoreManager::clientName(void)
+{
+    DM_PRIVATE(DownloadCoreManager);
+    return priv->m_clientName;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadevent.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,135 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadevent.h"
+
+// private implementation for DownloadEvent
+class DownloadEventPrivate
+{
+    DM_DECLARE_PUBLIC(DownloadEvent);
+public:
+    DownloadEventPrivate();
+    ~DownloadEventPrivate();
+    DlEventAttributeMap *m_attrMap; // hold <key, value> pairs
+    DEventType m_type;
+    int m_id;
+};
+
+DownloadEventPrivate::DownloadEventPrivate()
+{
+    m_attrMap = 0;
+    m_id = -1;
+}
+
+DownloadEventPrivate::~DownloadEventPrivate()
+{
+    if(m_attrMap)
+    {
+        delete m_attrMap;
+        m_attrMap = 0;
+    }
+} 
+
+DownloadEvent::DownloadEvent(DEventType type, DlEventAttributeMap* attrMap, int id)
+    :QEvent((Type)type)
+{
+    DM_INITIALIZE(DownloadEvent);
+    priv->m_type = type;
+    priv->m_attrMap = attrMap;
+    priv->m_id = id;
+}
+
+DownloadEvent::~DownloadEvent()
+{
+    DM_UNINITIALIZE(DownloadEvent);
+}
+
+Q_DECL_EXPORT QVariant DownloadEvent::getAttribute(DownloadEventAttribute attr)
+{
+    DM_PRIVATE(DownloadEvent);
+    bool exists = (priv->m_attrMap) && (priv->m_attrMap->contains(attr));
+    if(exists)
+    {
+        return priv->m_attrMap->value(attr);
+    }
+    else
+    {
+        return QVariant();
+    }
+}
+
+Q_DECL_EXPORT int DownloadEvent::getId()
+{
+    DM_PRIVATE(DownloadEvent);
+    // returns the download id
+    return priv->m_id;
+}
+
+
+// private implementation for DownloadManagerEvent   
+class DownloadManagerEventPrivate
+{
+    DM_DECLARE_PUBLIC(DownloadManagerEvent);
+public:
+    DownloadManagerEventPrivate();
+    ~DownloadManagerEventPrivate();
+    DlManagerEventAttributeMap *m_attrMap;
+    DEventType type;
+};
+
+DownloadManagerEventPrivate::DownloadManagerEventPrivate()
+{
+    m_attrMap = 0;
+}
+
+DownloadManagerEventPrivate::~DownloadManagerEventPrivate()
+{
+    if(m_attrMap)
+    {
+        delete m_attrMap;
+        m_attrMap = 0;
+    }
+} 
+
+DownloadManagerEvent::DownloadManagerEvent(DEventType type, DlManagerEventAttributeMap* attrMap)
+    :QEvent((Type)type)
+{
+    DM_INITIALIZE(DownloadManagerEvent);
+    priv->type = type;
+    priv->m_attrMap = attrMap;
+}
+
+DownloadManagerEvent::~DownloadManagerEvent()
+{
+    DM_UNINITIALIZE(DownloadManagerEvent);
+}
+
+QVariant DownloadManagerEvent::getAttribute(DownloadManagerEventAttribute attr)
+{
+    DM_PRIVATE(DownloadManagerEvent);
+    bool exists = priv->m_attrMap->contains(attr);
+    if(exists)        
+    {
+        return priv->m_attrMap->value(attr);
+    }
+    else
+    {
+        return QVariant();
+    }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadfactory.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,83 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadmanager.h"
+#include "downloadfactory.h"
+#include "clientdownload.h"
+#include "downloadcore.h"
+#include "downloadstore.h"
+#include "filestorage.h"
+#include "downloadbackend.h"
+#include "httpdownloadbackend.h"
+#include "omadownloadbackend.h"
+#include "oma2downloadbackend.h"
+#include <QNetworkReply>
+#include <QNetworkRequest>
+
+#ifdef __SYMBIAN32__
+#include <bldvariant.hrh>
+#include "drmstorage.h"
+#ifdef RD_WMDRM_DLA_ENABLERS
+#include "wmdrmdownloadbackend.h"
+#endif
+#endif
+
+// This is responsible for creation of concrete download download implementation class
+// based on the content type
+DownloadBackend* DownloadAbstractFactory::createDownloadImplementation(DownloadCore *dlCore, ClientDownload *dl)
+{
+    QString contentType = dlCore->contentType();
+    if(contentType == "")
+    {
+        QNetworkReply *reply = dlCore->reply();
+        if(reply)
+        {
+            contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString();
+        }
+    }
+    
+    QString clientName = dl->downloadManager()->getAttribute(DlMgrClientName).toString();
+    DownloadBackend *dlBackend = NULL;
+    DownloadStore* store = NULL;
+    if(contentType == OMA_CONTENT_TYPE) {
+        dlBackend = new OMADownloadBackend(dlCore, dl);
+    }
+    else if(contentType == OMA2_CONTENT_TYPE) {
+        dlBackend = new OMA2DownloadBackend(dlCore, dl);
+    }
+
+#ifdef __SYMBIAN32__
+    else if(contentType == OMA_DRM_MESSAGE_CONTENT_TYPE) {
+        store = new DrmStorage(clientName, dl);
+        dlBackend = new HttpDownloadBackend(dlCore, dl, store);
+    }
+#ifdef RD_WMDRM_DLA_ENABLERS
+    else if(contentType.contains(WMDRM_CONTENT_TYPE, Qt::CaseInsensitive))
+        dlBackend = new WMDRMDownloadBackend(dlCore, dl);
+#endif
+#endif
+    //we can have other if-else cases for different type of downloads
+    // by default the download is http download
+    else {
+        store = new FileStorage(clientName, dl);
+        dlBackend = new HttpDownloadBackend(dlCore, dl, store);
+    }
+    return dlBackend;
+}
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadinfo.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,346 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadinfo.h"
+#include "dmcommon.h"
+#include <QStringList>
+#include <QSettings>
+#define ORGANIZATION "Nokia"
+
+class DownloadInfoPrivate
+{
+    DM_DECLARE_PUBLIC(DownloadInfo);
+public:
+    DownloadInfoPrivate();
+    ~DownloadInfoPrivate();
+
+    QSettings* m_dlInfo;
+    QString m_clientName;
+
+};
+
+DownloadInfoPrivate::DownloadInfoPrivate()
+{
+    m_dlInfo = 0;
+    m_clientName = "";
+}
+
+DownloadInfoPrivate::~DownloadInfoPrivate()
+{
+    if(m_dlInfo)
+    {
+         m_dlInfo->sync();
+         delete m_dlInfo;
+         m_dlInfo = 0;
+    }
+}
+
+/*
+Constructor
+*/
+DownloadInfo::DownloadInfo(const QString& clientName)
+{
+    DM_INITIALIZE(DownloadInfo);
+    priv->m_clientName = clientName;
+    priv->m_dlInfo = new QSettings(ORGANIZATION, clientName);
+}
+
+/*
+Destructor
+*/
+DownloadInfo::~DownloadInfo()
+{
+    DM_UNINITIALIZE(DownloadInfo);
+}
+
+/*
+Sets a string value. Gives option to updte the info file immediately or later
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::setValue(int aDlId, Key aKey, const QString& aStrValue, int aParentId /*= INVALID_DL_ID*/)
+{
+    DM_PRIVATE(DownloadInfo);
+    if(aParentId > INVALID_DL_ID)
+        priv->m_dlInfo->setValue(genStrKey(aParentId, aDlId, aKey), aStrValue);
+    else
+        priv->m_dlInfo->setValue(genStrKey(aDlId, aKey), aStrValue);
+    return 0;
+}
+
+/*
+Sets a string value. Gives option to updte the info file immediately or later
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::setValueForChild(int aDlId, Key aKey, const QString& aStrValue, int aChildId /*= INVALID_DL_ID*/)
+{
+    DM_PRIVATE(DownloadInfo);
+    if(aChildId > INVALID_DL_ID)
+        priv->m_dlInfo->setValue(genStrKey(aDlId, aChildId, aKey), aStrValue);
+    else
+        priv->m_dlInfo->setValue(genStrKey(aDlId, aKey), aStrValue);
+    return 0;
+}
+
+/*
+Sets an int value. Gives option to updte the info file immediately or later
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::setValue(int aDlId, Key aKeyInt, long aLongValue, int aParentId /*= INVALID_DL_ID*/)
+{
+    DM_PRIVATE(DownloadInfo);
+    QString strKey;
+    if(aParentId > INVALID_DL_ID)
+        strKey = genStrKey(aParentId, aDlId, aKeyInt);
+    else
+        strKey = genStrKey(aDlId, aKeyInt);
+    QVariant v((int)aLongValue);
+    priv->m_dlInfo->setValue(strKey, v);
+    return 0;
+}
+
+/*
+Sets an int value. Gives option to updte the info file immediately or later
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::setValueForChild(int aDlId, Key aKeyInt, long aLongValue, int aChildId /*= INVALID_DL_ID*/)
+{
+    DM_PRIVATE(DownloadInfo);
+    QString strKey;
+    if(aChildId > INVALID_DL_ID)
+        strKey = genStrKey(aDlId, aChildId, aKeyInt);
+    else
+        strKey = genStrKey(aDlId, aKeyInt);
+    QVariant v((int)aLongValue);
+    priv->m_dlInfo->setValue(strKey, v);
+    return 0;
+}
+
+/*
+Sets media object list belonging to the parent. Gives option to updte the info file immediately or later
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::setValue(int aDlId, Key aKey, const QList<QVariant>& aChildIds)
+{
+    DM_PRIVATE(DownloadInfo);
+    QString strKey = genStrKey(aDlId, aKey);
+    QVariant v(aChildIds);
+    priv->m_dlInfo->setValue(strKey, v);
+    return 0;
+}
+
+/*
+Updates(serializes) the info with all set values at once.
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::update()
+{
+    DM_PRIVATE(DownloadInfo);
+    priv->m_dlInfo->sync();
+    return 0;
+}
+
+/*
+Deletes the download info of a particular download represented by aDlId.
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::remove(int aDlId, int aParentId /*= INVALID_DL_ID*/)
+{
+    DM_PRIVATE(DownloadInfo);
+    QString strDlId;
+    strDlId = priv->m_clientName;
+    strDlId.append("/");
+
+    QString str;
+    if(aParentId > INVALID_DL_ID)
+    {
+        str.setNum(aParentId);
+        strDlId.append(str);
+        strDlId.append("/");
+    }
+
+    str.setNum(aDlId);
+    strDlId.append(str);
+    priv->m_dlInfo->remove(strDlId);
+    return 0;
+}
+
+/*
+Retrieves the string value
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::getValue(int aDlId, Key aKeyStr, QString& aStrValue, int aParentId)
+{
+    DM_PRIVATE(DownloadInfo);
+    aStrValue = "";
+    QString strDlId;
+    if (aParentId > INVALID_DL_ID)
+        strDlId = genStrKey(aParentId, aDlId, aKeyStr);
+    else
+        strDlId = genStrKey(aDlId, aKeyStr);
+
+    if(priv->m_dlInfo->contains(strDlId))
+    {
+        aStrValue = priv->m_dlInfo->value(strDlId).toString();
+        return 0;
+    }
+    return -1;
+}
+
+/*
+Retrieves the string value
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::getValueForChild(int aDlId, Key aKeyStr, QString& aStrValue, int aChildId /*= INVALID_DL_ID*/)
+{
+    DM_PRIVATE(DownloadInfo);
+    aStrValue = "";
+    QString strDlId;
+    if (aChildId > INVALID_DL_ID)
+        strDlId = genStrKey(aDlId, aChildId, aKeyStr);
+    else
+        strDlId = genStrKey(aDlId, aKeyStr);
+
+    if(priv->m_dlInfo->contains(strDlId))
+    {
+        aStrValue = priv->m_dlInfo->value(strDlId).toString();
+        return 0;
+    }
+    return -1;
+}
+
+/*
+Retrieves the int value
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::getValue(int aDlId, Key aKeyInt, long& aLongValue, int aParentId)
+{
+    DM_PRIVATE(DownloadInfo);
+    QString strDlId;
+    if(aParentId > INVALID_DL_ID)
+        strDlId = genStrKey(aParentId, aDlId, aKeyInt);
+    else
+        strDlId = genStrKey(aDlId, aKeyInt);
+
+    if(priv->m_dlInfo->contains(strDlId))
+    {
+        aLongValue = priv->m_dlInfo->value(strDlId).toInt();
+        return 0;
+    }
+    return -1;
+}
+
+/*
+Retrieves the int value
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::getValueForChild(int aDlId, Key aKeyInt, long& aLongValue, int aChildId /*= INVALID_DL_ID*/)
+{
+    DM_PRIVATE(DownloadInfo);
+    QString strDlId;
+    if(aChildId > INVALID_DL_ID)
+        strDlId = genStrKey(aDlId, aChildId, aKeyInt);
+    else
+        strDlId = genStrKey(aDlId, aKeyInt);
+
+    if(priv->m_dlInfo->contains(strDlId)) 
+    {
+        aLongValue = priv->m_dlInfo->value(strDlId).toInt();
+        return 0;
+    }
+    return -1;
+}
+
+/*
+Retrieves the mediaObject list
+Returns : 0 on success, non zero on error
+*/
+int DownloadInfo::getValue(int aDlId, Key aKey, QList<QVariant>& aChildIds)
+{
+    DM_PRIVATE(DownloadInfo);
+    QString strDlId = genStrKey(aDlId, aKey);
+    if(priv->m_dlInfo->contains(strDlId)) 
+    {
+        QStringList strList(priv->m_dlInfo->value(strDlId).toStringList());
+        for (int i = 0; i < strList.count(); i++) 
+            aChildIds.append(strList[i]);
+        return 0;
+    }
+    return -1;
+}
+
+/*
+Returns all download ids in a vector
+*/
+QVector<int> DownloadInfo::getAllDownloads(const QString& aClientName)
+{
+    QVector<int> ids;
+    QSettings *dlInfo = new QSettings(ORGANIZATION, aClientName);
+    dlInfo->beginGroup(aClientName);
+    QStringList idList = dlInfo->childGroups();
+    dlInfo->endGroup();
+    for(int i=0; i<idList.size(); i++)
+    {
+        ids.append(idList[i].toInt());
+    }
+    delete dlInfo;
+    return ids;
+}
+
+/*
+Helper function to generate a string key combining dlId and the InfoKey
+*/
+QString DownloadInfo::genStrKey(int aDlId, Key aKey)
+{   
+    DM_PRIVATE(DownloadInfo);
+    QString strDlId = "";
+    strDlId = priv->m_clientName;
+    strDlId.append("/");
+
+    QString str;
+    str.setNum(aDlId);
+    strDlId.append(str);
+
+    strDlId.append("/");
+    str.setNum((int)aKey);
+    strDlId.append(str);
+
+    return strDlId;
+}
+
+/*
+Helper function to generate a string key combining dlId, mediaObjdlId and the InfoKey
+*/
+QString DownloadInfo::genStrKey(int aParentId, int aChildId, Key aKey)
+{   
+    DM_PRIVATE(DownloadInfo);
+    QString strDlId = "";
+    strDlId = priv->m_clientName;
+    strDlId.append("/");
+
+    QString str;
+    str.setNum(aParentId);
+    strDlId.append(str);
+    strDlId.append("/");
+
+    str.setNum(aChildId);
+    strDlId.append(str);
+
+    strDlId.append("/");
+    str.setNum((int)aKey);
+    strDlId.append(str);
+
+    return strDlId;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadmanager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,564 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadmanager.h"
+#include "download.h"
+#include "clientdownload.h"
+#include "downloadevent.h"
+#include "downloadinfo.h"
+#include "downloadcoremanager.h"
+#include "backgrounddownloadmanager.h"
+#include "paralleldownloadmanager.h"
+#include "sequentialdownloadmanager.h"
+#include <QNetworkReply>
+#include <QNetworkProxy>
+#include <QList>
+#include <QDir>
+#include <QCoreApplication>
+
+// defualt download path
+#define DOWNLOAD_PATH QDir::homePath() + QObject::tr("/Downloads")
+
+class DownloadManagerPrivate
+{
+    //declare public implementation
+    DM_DECLARE_PUBLIC(DownloadManager);
+public:
+    DownloadManagerPrivate();
+    ~DownloadManagerPrivate();
+
+    QString m_clientName; // client name
+    QNetworkProxy *m_proxy;
+    QObject *m_receiver; // event reciever
+    DownloadInfo *m_dlInfo;
+    DownloadCoreManager *m_dlCoreManager; // manages all the download cores
+    QString m_destPath; // download destination path
+    BackgroundDownloadManager* m_backgroundManager;
+    ParallelDownloadManager *m_parallelManager; // manages parallel downloads
+    SequentialDownloadManager *m_sequentialManager; // manages sequential downloads
+    QList<Download*> m_totalDownloads; // has a list of both parallel and sequential downloads, but doesnt own it
+    DownloadMgrProgressMode m_progressMode;
+    DownloadMgrPersistantMode m_persistantMode;
+};
+
+DownloadManagerPrivate::DownloadManagerPrivate()
+{
+    m_clientName = "";
+    m_proxy = 0;
+    m_receiver = 0;
+    m_dlInfo = 0;
+    m_dlCoreManager = 0;
+    // set the download destination path to default path
+    m_destPath = DOWNLOAD_PATH;
+    m_backgroundManager = 0;
+    m_parallelManager = 0;
+    m_sequentialManager = 0;
+    m_progressMode = NonQuiet;
+    m_persistantMode = Active;
+}
+
+DownloadManagerPrivate::~DownloadManagerPrivate()
+{
+    if(m_sequentialManager)
+    {
+        delete m_sequentialManager;
+        m_sequentialManager = 0;
+    }
+    if(m_parallelManager)
+    {
+        delete m_parallelManager;
+        m_parallelManager = 0;
+    }
+    if (m_backgroundManager)
+    {
+        delete m_backgroundManager;
+        m_backgroundManager = 0;
+    }
+    if(m_proxy)
+    {
+        delete m_proxy;
+        m_proxy = 0;
+    }
+    if(m_dlInfo)
+    {
+        m_dlInfo->update();
+        delete m_dlInfo;
+        m_dlInfo = 0;
+    }
+    if(m_dlCoreManager)
+    {
+        delete m_dlCoreManager;
+        m_dlCoreManager = 0;
+    }
+}
+
+/*!
+ * \class DownloadManager
+ *
+ * \brief The public APIs for managing the downloads
+ *
+ * This class has the public APIs for managing the downloads
+ */
+
+/*!
+  creates an instance of download manager
+  \a clientName indicates the name of the client
+*/
+Q_DECL_EXPORT DownloadManager::DownloadManager(const QString& clientName)
+{
+    DM_INITIALIZE(DownloadManager);
+    priv->m_clientName = clientName;
+    //create a download info to save download informations
+    priv->m_dlInfo = new DownloadInfo(clientName);
+    // create download core manager
+    priv->m_dlCoreManager = new DownloadCoreManager(clientName);
+    // create background download manager
+    priv->m_backgroundManager = new BackgroundDownloadManager(this);
+    // create parallel download manager
+    priv->m_parallelManager = new ParallelDownloadManager();
+    // create sequential download manager
+    priv->m_sequentialManager = new SequentialDownloadManager();
+}
+
+/*!
+  destructor for the download manager
+*/
+Q_DECL_EXPORT DownloadManager::~DownloadManager()
+{
+    DM_UNINITIALIZE(DownloadManager);
+}
+
+/*!
+  initialises all the downloads which belongs to last download manager session
+*/
+Q_DECL_EXPORT void DownloadManager::init()
+{
+    //load all downloads which were created in the last session
+    loadAllDownloads();
+}
+
+/*!
+  returns new download
+  \a url indicates download url
+  \a type indicates whether it is sequential or parallel download
+*/
+Q_DECL_EXPORT Download* DownloadManager::createDownload(const QString& url, DownloadType type/*=Parallel*/, DownloadScope scope/*=Normal*/)
+{
+    DM_PRIVATE(DownloadManager);
+    if(url == "")
+        return NULL;
+    Download* dl(0);
+
+    if (scope == Normal) {
+        dl = new ClientDownload(this, url, generateDlId());
+        if(type == Parallel)
+            priv->m_parallelManager->addToParallelDownload(dl);
+        else if(type == Sequential) {
+            // by default the priority is low
+            dl->setAttribute(DlPriority, (int)Low);
+            priv->m_sequentialManager->addToSequentialDownload(dl);
+        }
+        postEvent(DownloadCreated, NULL);
+    }
+    else if (scope == Background) {
+        dl = priv->m_backgroundManager->createDownload(url, type);
+    }
+    return dl;
+}
+
+/*!
+  returns new download
+  \a reply indicates network reply which is already initiated
+*/
+Q_DECL_EXPORT Download* DownloadManager::createDownload(QNetworkReply *reply)
+{
+    DM_PRIVATE(DownloadManager);
+    if(!reply)
+        return NULL;
+    ClientDownload *dl = new ClientDownload(this, reply, generateDlId());
+    priv->m_parallelManager->addToParallelDownload(dl);
+    postEvent(DownloadCreated, NULL);
+    return dl;
+}
+
+Download* DownloadManager::createDownload(int dlId, DownloadScope scope)
+{
+    DM_PRIVATE(DownloadManager);
+    if(dlId == INVALID_DL_ID)
+        return NULL;
+    Download *dl = NULL;
+    if (scope == Normal){
+        dl = new ClientDownload(this, dlId);
+        DownloadType type = (DownloadType)(dl->getAttribute(DlDownloadType).toInt());
+        if(type == Parallel)
+            priv->m_parallelManager->addToParallelDownload(dl);
+        else
+            priv->m_sequentialManager->addToSequentialDownload(dl);
+    } else if (scope == Background){
+        dl = priv->m_backgroundManager->createDownload(dlId);
+    } else
+        return NULL;
+     
+    if (dl)
+         postEvent(DownloadCreated, NULL);
+    return dl;
+}
+
+/*!
+  sets the proxy
+  \a proxyServer indicates proxy server name
+  \a port indicates port number
+*/
+Q_DECL_EXPORT void DownloadManager::setProxy(const QString& proxyServer, int port)
+{
+    DM_PRIVATE(DownloadManager);
+    if(priv->m_proxy)
+    {
+        delete priv->m_proxy;
+        priv->m_proxy = 0;
+    }
+    priv->m_proxy = new QNetworkProxy(QNetworkProxy::HttpCachingProxy, proxyServer, port );
+    return;
+}
+
+/*!
+  registers event listener
+  \a reciever indicates reciever object to be registered for download events
+*/
+Q_DECL_EXPORT void DownloadManager::registerEventReceiver(QObject *receiver)
+{
+    DM_PRIVATE(DownloadManager);
+    if (receiver)
+        priv->m_receiver = receiver;
+    return;
+}
+
+/*!
+  unregister event listener
+  \a reciever indicates reciever object to be unregistered
+*/
+Q_DECL_EXPORT void DownloadManager::unregisterEventReceiver(QObject *receiver)
+{
+    DM_PRIVATE(DownloadManager);
+    if(receiver == priv->m_receiver)
+    {
+        priv->m_receiver = 0;
+    }
+    return;
+}
+
+/*!
+  sets download manager attribute
+  \a attr indicates download manager attribute
+  \a value indicates value to be set
+*/
+Q_DECL_EXPORT int DownloadManager::setAttribute(DownloadManagerAttribute attr, const QVariant& value)
+{
+    DM_PRIVATE(DownloadManager);
+    switch(attr)
+    {
+        case DlMgrDestPath:
+        {
+            priv->m_destPath = value.toString();
+            return 0;
+        }
+        case DlMgrProgressMode:
+        {
+            priv->m_progressMode = (DownloadMgrProgressMode)value.toInt();
+            return 0;
+        }
+        case DlMgrPersistantMode:
+        {
+            priv->m_persistantMode = (DownloadMgrPersistantMode)value.toInt();
+            return 0;
+        }
+        default :
+            return -1;
+    }
+    return -1;
+}
+
+/*!
+  fetches download manager attribute
+  \a attr indicates download manager attribute whos value to be returned
+*/
+Q_DECL_EXPORT QVariant DownloadManager::getAttribute(DownloadManagerAttribute attr)
+{
+    DM_PRIVATE(DownloadManager);
+    switch(attr)
+    {
+        case DlMgrDlCount:
+        {
+            int count(0);
+            if(priv->m_parallelManager)
+                count += priv->m_parallelManager->currentDownloads().count();
+            if(priv->m_sequentialManager)
+                count += priv->m_sequentialManager->currentDownloads().count();
+            if(priv->m_backgroundManager)
+                count += priv->m_backgroundManager->currentDownloads().count();
+            return QVariant(count);
+        }
+        case DlMgrClientName:
+        {
+            return QVariant(priv->m_clientName);
+        }
+        case DlMgrDestPath:
+        {
+            return QVariant(priv->m_destPath);
+        }
+        case DlMgrServerError:
+        {
+            // These cases apply only for Background Download Manager as this attribute
+            // is for getting download manager client-server communication related errors
+            QVariant value;
+            if(priv->m_backgroundManager)
+                value = priv->m_backgroundManager->getAttribute(attr);
+            return value;
+        }
+        case DlMgrProgressMode:
+        {
+            return QVariant(priv->m_progressMode);
+        }
+        case DlMgrPersistantMode:
+        {
+            return QVariant(priv->m_persistantMode);
+        }
+        default :
+            return QVariant();
+    }
+    return QVariant();
+}
+
+/*!
+  returns all the current downloads
+*/
+Q_DECL_EXPORT QList<Download*>& DownloadManager::currentDownloads()
+{
+    DM_PRIVATE(DownloadManager);
+    priv->m_totalDownloads.clear();
+    if(priv->m_parallelManager) {
+        for(int i = 0;i < priv->m_parallelManager->currentDownloads().size(); ++i)
+            priv->m_totalDownloads.append(priv->m_parallelManager->currentDownloads()[i]);
+    }
+    if(priv->m_sequentialManager) {
+        for(int i = 0;i < priv->m_sequentialManager->currentDownloads().size(); ++i)
+            priv->m_totalDownloads.append(priv->m_sequentialManager->currentDownloads()[i]);
+    }
+    if(priv->m_backgroundManager) {
+        for(int i = 0;i < priv->m_backgroundManager->currentDownloads().size(); ++i)
+            priv->m_totalDownloads.append(priv->m_backgroundManager->currentDownloads()[i]);
+    }
+    return priv->m_totalDownloads;
+}
+
+/*!
+  finds a download provided id if exists
+  \a id indicates identifier for download
+*/
+Q_DECL_EXPORT Download* DownloadManager::findDownload(int dlId)
+{
+    DM_PRIVATE(DownloadManager);
+    Download* dl = NULL;
+    if(priv->m_parallelManager)
+    {
+        dl = priv->m_parallelManager->findDownload(dlId);
+        if(dl)
+            return dl;
+    }
+    if(priv->m_sequentialManager)
+    {
+        dl = priv->m_sequentialManager->findDownload(dlId);
+        if(dl)
+            return dl;
+    }
+    if(priv->m_backgroundManager)
+    {
+        dl = priv->m_backgroundManager->findDownload(dlId);
+        if(dl)
+            return dl;
+    }
+    return NULL;
+}
+
+/*!
+  cancels all the downloads
+*/
+Q_DECL_EXPORT void DownloadManager::removeAll()
+{
+    DM_PRIVATE(DownloadManager);
+    if(priv->m_parallelManager)
+        priv->m_parallelManager->removeAll();
+    if(priv->m_sequentialManager)
+        priv->m_sequentialManager->removeAll();
+    if(priv->m_backgroundManager)
+        priv->m_backgroundManager->removeAll();
+    postEvent(DownloadsCleared, NULL);
+    return;
+}
+
+/*!
+  cancels and removes the download
+  \a dl indicates the download to be canceled and removed
+*/
+Q_DECL_EXPORT void DownloadManager::removeOne(Download *dl)
+{
+    if (!dl)
+        return;
+
+    DM_PRIVATE(DownloadManager);
+    if(priv->m_parallelManager)
+        priv->m_parallelManager->removeOne(dl);
+    if(priv->m_sequentialManager)
+        priv->m_sequentialManager->removeOne(dl);
+    if(priv->m_backgroundManager)
+        priv->m_backgroundManager->removeOne(dl);
+
+    if((priv->m_parallelManager->currentDownloads().count() == 0) &&
+        (priv->m_sequentialManager->currentDownloads().count() == 0) &&
+        (priv->m_backgroundManager->currentDownloads().count() == 0))
+        postEvent(DownloadsCleared, NULL);
+    return;
+}
+
+/*!
+  pauses all the downloads which are in progress
+*/
+Q_DECL_EXPORT void DownloadManager::pauseAll()
+{
+    DM_PRIVATE(DownloadManager);
+    if(priv->m_parallelManager)
+        priv->m_parallelManager->pauseAll();
+    if(priv->m_sequentialManager)
+        priv->m_sequentialManager->pauseAll();
+    if(priv->m_backgroundManager)
+        priv->m_backgroundManager->pauseAll();
+    return;
+}
+
+/*!
+  resumes all the downloads which are paused
+*/
+Q_DECL_EXPORT void DownloadManager::resumeAll()
+{
+    DM_PRIVATE(DownloadManager);
+    if(priv->m_parallelManager)
+        priv->m_parallelManager->resumeAll();
+    if(priv->m_sequentialManager)
+        priv->m_sequentialManager->resumeAll();
+    if(priv->m_backgroundManager)
+        priv->m_backgroundManager->resumeAll();
+    return;
+}
+
+/*!
+  returns the proxy used
+*/
+Q_DECL_EXPORT QNetworkProxy* DownloadManager::proxy()
+{
+    DM_PRIVATE(DownloadManager);
+    return priv->m_proxy;
+}
+
+DownloadInfo* DownloadManager::downloadInfo()
+{
+    DM_PRIVATE(DownloadManager);
+    return priv->m_dlInfo;
+}
+
+DownloadCoreManager* DownloadManager::downloadCoreManager()
+{
+    DM_PRIVATE(DownloadManager);
+    return priv->m_dlCoreManager;
+}
+
+SequentialDownloadManager* DownloadManager::sequentialManager()
+{
+    DM_PRIVATE(DownloadManager);
+    return priv->m_sequentialManager;
+}
+
+BackgroundDownloadManager* DownloadManager::backgroundManager()
+{
+    DM_PRIVATE(DownloadManager);
+    return priv->m_backgroundManager;
+}
+
+void DownloadManager::loadAllDownloads()
+{
+    DM_PRIVATE(DownloadManager);
+    // read the saved downloads information and create download
+    QVector<int> ids = DownloadInfo::getAllDownloads(priv->m_clientName);
+    for(int i=0; i<ids.size(); i++)
+    {
+        if(!findDownload(ids[i])) {
+            long scope;
+            priv->m_dlInfo->getValue(ids[i], DownloadInfo::EScope, scope);
+            createDownload(ids[i], (DownloadScope)scope);
+        }
+    }
+    return;
+}
+
+// generate unique id for download
+long DownloadManager::generateDlId()
+{
+    DM_PRIVATE(DownloadManager);
+    long id = 1;
+    long totDls = (priv->m_parallelManager->currentDownloads().count() + 
+                priv->m_sequentialManager->currentDownloads().count() +
+                priv->m_backgroundManager->currentDownloads().count());
+
+    if(totDls <= 0)
+    {
+        return id;
+    }
+    while(1)
+    {
+        int i;
+        for(i = 0; i <= totDls ; ++i)
+        {
+            Download* parallelDl = NULL;
+            parallelDl = priv->m_parallelManager ? priv->m_parallelManager->findDownload(i) : NULL;
+            Download* sequentialDl = NULL;
+            sequentialDl = priv->m_sequentialManager ? priv->m_sequentialManager->findDownload(i) : NULL;
+            Download* backgroundDl = NULL;
+            backgroundDl = priv->m_backgroundManager ? priv->m_backgroundManager->findDownload(i) : NULL;
+            if((parallelDl && (parallelDl->id() == id)) ||
+                (sequentialDl && (sequentialDl->id() == id)) ||
+                (backgroundDl && (backgroundDl->id() == id)))
+            {
+                break;
+            }
+        }
+        if(i>totDls)
+        {
+            return id;
+        }
+        id++;
+    }
+    return -1;
+}
+
+void DownloadManager::postEvent(DEventType type, DlManagerEventAttributeMap* attrMap)
+{
+    DM_PRIVATE(DownloadManager);
+    if(priv->m_receiver)
+    {
+        DownloadManagerEvent *event = new DownloadManagerEvent(type, attrMap);
+        QCoreApplication::postEvent(priv->m_receiver, event);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/downloadmanagerclient.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,714 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadmanagerclient.h"
+#include "backgrounddownloadmanager.h"
+#include "backgrounddownload.h"
+#include <serviceipc.h>
+#include <QTimer>
+#include <QtNetwork>
+
+class DownloadManagerClientPrivate
+{
+    DM_DECLARE_PUBLIC(DownloadManagerClient);
+public:
+    DownloadManagerClientPrivate();
+    ~DownloadManagerClientPrivate();
+    QString m_clientName;
+    bool m_isConnected;
+    int m_error;
+    WRT::ServiceFwIPC* m_session;
+    DownloadManager* m_downloadManager;
+    QTimer* m_timer;
+};
+
+DownloadManagerClientPrivate::DownloadManagerClientPrivate()
+{
+    m_clientName = "";
+    m_isConnected = false;
+    m_error = 0;
+    m_session = 0;
+    m_downloadManager = 0;
+    m_timer = 0;
+}
+
+DownloadManagerClientPrivate::~DownloadManagerClientPrivate()
+{
+    if (m_timer) {
+        if (m_timer->isActive())
+            m_timer->stop();
+        delete m_timer;
+        m_timer = 0;
+    }
+
+    if (m_session) {
+        m_session->disconnect();
+        delete m_session;
+        m_session = 0;
+    }
+}
+
+DownloadManagerClient::DownloadManagerClient(DownloadManager* downloadManager)
+{
+    DM_INITIALIZE(DownloadManagerClient);
+    priv->m_downloadManager = downloadManager;
+    priv->m_timer = new QTimer;
+    priv->m_clientName = downloadManager->getAttribute(DlMgrClientName).toString();
+    priv->m_session = new WRT::ServiceFwIPC(this);
+    connect(priv->m_session, SIGNAL(error(int aError)), this, SLOT(setServerError(int error)));
+    connect(priv->m_timer, SIGNAL(timeout()), this, SLOT(getEvents()));
+
+    // establish communication with server
+    initServer();
+}
+
+DownloadManagerClient::~DownloadManagerClient()
+{
+    DM_UNINITIALIZE(DownloadManagerClient);
+}
+
+bool DownloadManagerClient::initServer()
+{
+    DM_PRIVATE(DownloadManagerClient);
+
+    // start server (if required) and connect to it
+    connectToServer();
+
+    if (priv->m_isConnected) {
+        // set startup details - proxy, download path, progress mode
+        // and attach to downloads
+        setStartupInfo();
+
+        // start timer to get events from server
+        priv->m_timer->start(EVENTS_REQUEST_INTERVAL);
+        priv->m_downloadManager->postEvent(ConnectedToServer, NULL);
+    }
+
+    return priv->m_isConnected;
+}
+
+bool DownloadManagerClient::connectToServer()
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (priv->m_session) {
+        int retry(2);
+        for (;;)
+        {
+            priv->m_isConnected = priv->m_session->connect(DMSERVER);
+            if (priv->m_isConnected) {
+                break;
+            }
+            else {
+                if (!priv->m_session->startServer(DMSERVER, DMSERVEREXE)) {
+                    // start server failed.
+                    break;
+                }
+            }
+            if (0==--retry) {
+                break;
+            }
+        }
+    }
+    if (!priv->m_isConnected) {
+        delete priv->m_session;
+        priv->m_session = 0;
+    }
+
+    return priv->m_isConnected;
+}
+
+void DownloadManagerClient::setStartupInfo()
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (!priv->m_isConnected)
+        return;
+
+    if (priv->m_downloadManager) {
+        // get data from download manager
+        QNetworkProxy* proxy = priv->m_downloadManager->proxy();
+        QString dlPath = priv->m_downloadManager->getAttribute(DlMgrDestPath).toString();
+        int progressMode = priv->m_downloadManager->getAttribute(DlMgrProgressMode).toInt();
+        int persistantMode = priv->m_downloadManager->getAttribute(DlMgrPersistantMode).toInt();
+        QString data;
+
+        // client name
+        data.append(encodeString(priv->m_clientName));
+
+        // proxy info
+        if (proxy) {
+            data.append(DM_MSG_DELIMITER);
+            data.append(QString::number(SetProxy));
+            data.append(DM_FIELD_DELIMITER);
+            data.append(encodeString(proxy->hostName()));
+            data.append(DM_FIELD_DELIMITER);
+            data.append(QString::number(proxy->port()));
+        }
+
+        // download path
+        data.append(DM_MSG_DELIMITER);
+        data.append(QString::number(SetDownloadManagerAttribute));
+        data.append(DM_FIELD_DELIMITER);
+        data.append(QString::number(DlMgrDestPath));
+        data.append(DM_FIELD_DELIMITER);
+        data.append(encodeString(dlPath));
+
+        // progress mode (quiet/non-quiet)
+        data.append(DM_MSG_DELIMITER);
+        data.append(QString::number(SetDownloadManagerAttribute));
+        data.append(DM_FIELD_DELIMITER);
+        data.append(QString::number(DlMgrProgressMode));
+        data.append(DM_FIELD_DELIMITER);
+        data.append(encodeString(QString::number(progressMode)));
+
+        // persistant mode (active / inactive)
+        data.append(DM_MSG_DELIMITER);
+        data.append(QString::number(SetDownloadManagerAttribute));
+        data.append(DM_FIELD_DELIMITER);
+        data.append(QString::number(DlMgrPersistantMode));
+        data.append(DM_FIELD_DELIMITER);
+        data.append(encodeString(QString::number(persistantMode)));
+
+        // send to sever
+        if (priv->m_session->sendSync(QString::number(StartupInfo), data.toAscii()))
+            priv->m_session->readAll();
+    }
+}
+
+void DownloadManagerClient::setProxy(const QString& proxyServer, const int port)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(encodeString(proxyServer));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(port));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(SetProxy), data.toAscii()))
+        priv->m_session->readAll();
+    else
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+}
+
+int DownloadManagerClient::createDownload(const QString& url, DownloadType type)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    int downloadId(INVALID_DL_ID);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return downloadId;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(encodeString(url));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(type));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(CreateDownload), data.toAscii())) {
+        // expected response is
+        // list[0] -> downloadId
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 1)
+            downloadId = list[0].toInt();
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return downloadId;
+}
+
+bool DownloadManagerClient::attachToDownload(int dlId)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    bool status(false);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return status;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(dlId));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(AttachToDownload), data.toAscii())) {
+        // expected response is
+	// list[1] -> status
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 1) {
+            status = list[0].toInt();
+	}
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+	
+    return status;
+}
+
+void DownloadManagerClient::removeDownload(int downloadId)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(downloadId));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(RemoveDownload), data.toAscii()))
+        priv->m_session->readAll();
+    else
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+}
+
+void DownloadManagerClient::pauseAll()
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(PauseAll), data.toAscii()))
+        priv->m_session->readAll();
+    else
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+}
+
+void DownloadManagerClient::resumeAll()
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(ResumeAll), data.toAscii()))
+        priv->m_session->readAll();
+    else
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+}
+
+void DownloadManagerClient::removeAll()
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(RemoveAll), data.toAscii()))
+        priv->m_session->readAll();
+    else
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+}
+
+QVariant DownloadManagerClient::getDownloadManagerAttribute(DownloadManagerAttribute attr)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    QVariant returnValue;
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(attr));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(GetDownloadManagerAttribute), data.toAscii())) {
+        // expected response is
+        // list[0] -> attribute
+        // list[1] -> value
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 2) {
+            if (list[0] == QString::number(attr))
+                returnValue = QVariant(list[1]);
+        }
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+int DownloadManagerClient::setDownloadManagerAttribute(DownloadManagerAttribute attr, const QVariant& value)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    int returnValue(-1);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(attr));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(encodeString(value.toString()));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(SetDownloadManagerAttribute), data.toAscii())) {
+        // expected response is
+        // list[0] -> attribute
+        // list[1] -> returnValue
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 2) {
+            if (list[0] == QString::number(attr))
+                returnValue = list[1].toInt();
+        }
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+int DownloadManagerClient::startDownload(int dlId)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    int returnValue(-1);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(dlId));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(StartDownload), data.toAscii())) {
+        // expected response is
+        // list[0] -> downloadId
+        // list[1] -> returnValue
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 2) {
+            if (list[0] == QString::number(dlId))
+                returnValue = list[1].toInt();
+        }
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+int DownloadManagerClient::pauseDownload(int dlId)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    int returnValue(-1);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(dlId));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(PauseDownload), data.toAscii())) {
+        // expected response is
+        // list[0] -> downloadId
+        // list[1] -> returnValue
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 2) {
+            if (list[0] == QString::number(dlId))
+                returnValue = list[1].toInt();
+        }
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+int DownloadManagerClient::resumeDownload(int dlId)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    int returnValue(-1);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(dlId));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(ResumeDownload), data.toAscii())) {
+        // expected response is
+        // list[0] -> downloadId
+        // list[1] -> returnValue
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 2) {
+            if (list[0] == QString::number(dlId))
+                returnValue = list[1].toInt();
+        }
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+int DownloadManagerClient::cancelDownload(int dlId)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    int returnValue(-1);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(dlId));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(CancelDownload), data.toAscii())) {
+        // expected response is
+        // list[0] -> downloadId
+        // list[1] -> returnValue
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 2) {
+            if (list[0] == QString::number(dlId))
+                returnValue = list[1].toInt();
+        }
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+QVariant DownloadManagerClient::getDownloadAttribute(int dlId, DownloadAttribute attr)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    QVariant returnValue;
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(dlId));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(attr));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(GetDownloadAttribute), data.toAscii())) {
+        // expected response is
+        // list[0] -> downloadId
+        // list[1] -> attribute
+        // list[2] -> value
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 3) {
+            if ((list[0] == QString::number(dlId)) &&
+                (list[1] == QString::number(attr)))
+                returnValue = QVariant(list[2]);
+        }
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+int DownloadManagerClient::setDownloadAttribute(int dlId, DownloadAttribute attr, const QVariant& value)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    int returnValue(-1);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return returnValue;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(dlId));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(QString::number(attr));
+    data.append(DM_FIELD_DELIMITER);
+    data.append(encodeString(value.toString()));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(SetDownloadAttribute), data.toAscii())) {
+        // expected response is
+        // list[0] -> downloadId
+        // list[1] -> attribute
+        // list[2] -> returnValue
+        QByteArray bytes = priv->m_session->readAll();
+        QStringList list = QString(bytes).split(DM_FIELD_DELIMITER);
+        if (list.count() == 3) {
+            if ((list[0] == QString::number(dlId)) &&
+                (list[1] == QString::number(attr)))
+                returnValue = list[2].toInt();
+        }
+    }
+    else
+    {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+    return returnValue;
+}
+
+// poll server for events
+void DownloadManagerClient::getEvents()
+{
+    DM_PRIVATE(DownloadManagerClient);
+    if (!priv->m_isConnected) {
+        if (!initServer())
+            return;
+    }
+
+    // create string to send
+    QString data;
+    data.append(encodeString(priv->m_clientName));
+
+    // send to sever
+    if (priv->m_session->sendSync(QString::number(GetEvents), data.toAscii())) {
+        // expected response has a list of downloadmanager and download events
+        QString eventMsg = priv->m_session->readAll();
+        if (!eventMsg.isEmpty())
+            processEvents(eventMsg);
+
+        // start timer for getting next set of events
+        priv->m_timer->start(EVENTS_REQUEST_INTERVAL);
+    }
+    else {
+        setServerError(WRT::ServiceFwIPC::EIPCError);
+    }
+}
+
+// process Download and DownloadManager events
+void DownloadManagerClient::processEvents(QString eventMsg)
+{
+    DM_PRIVATE(DownloadManagerClient);
+
+    // Separate out the fields of an event
+    QStringList list = eventMsg.split(DM_FIELD_DELIMITER);
+    if (list.count() >= 2) {
+        QString eventName = list[0];
+        // // check type of event
+        if (list[0] == QString::number(EventDownloadManager)) {
+            // Download Manager event
+            DEventType type = (DEventType)list[1].toInt();
+            // post event
+            priv->m_downloadManager->postEvent(type, NULL);
+        }
+        else if (list[0] == QString::number(EventDownload)) {
+            // Download event
+            int dlId = list[1].toInt();
+            DEventType type = (DEventType)list[2].toInt();
+            BackgroundDownload* dl = dynamic_cast<BackgroundDownload*>(priv->m_downloadManager->findDownload(dlId));
+            // post event
+            if (dl)
+                dl->postEvent(type, NULL);
+        }
+    }
+}
+
+// encode string so that it does not contain any communication delimiter
+QString DownloadManagerClient::encodeString(const QString& inputString)
+{
+    QByteArray bytes = QUrl::toPercentEncoding(inputString);
+    return bytes.data();
+}
+
+// get server connection/communication error
+int DownloadManagerClient::serverError()
+{
+    DM_PRIVATE(DownloadManagerClient);
+    return priv->m_error;
+}
+
+// set server IPC error
+void DownloadManagerClient::setServerError(int error)
+{
+    DM_PRIVATE(DownloadManagerClient);
+    priv->m_error = error;
+    // client could have died
+    // mark client as disconnected so that it can reconnect again
+    priv->m_isConnected = false;
+    if (priv->m_timer->isActive())
+        priv->m_timer->stop();
+    priv->m_downloadManager->postEvent(DisconnectedFromServer, NULL);
+    priv->m_downloadManager->postEvent(ServerError, NULL);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/drmstorage.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,240 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "drmstorage.h"
+#include "storageutility.h"
+#include "dmcommoninternal.h"
+#include <QFile>
+#include <QDir>
+#include <QVariant>
+#include <qregexp.h>
+#include <f32file.h>
+
+
+DrmStorage::DrmStorage(const QString& clientName, ClientDownload* download)
+{
+    m_file = 0;
+    m_clientName = clientName;
+    m_download = download;
+    // create temporary path
+    m_tempPath = StorageUtility::createTemporaryPath(clientName);
+}
+
+DrmStorage::~DrmStorage()
+{
+    if (m_file) {
+        close();
+        delete m_file;
+        m_file = 0;
+    }
+}
+
+int DrmStorage::createStore()
+{
+    // validate filename
+    QString validFilename;
+    QString filename = m_download->attributes().value(DlFileName).toString();
+    StorageUtility::validateFileName(filename, validFilename);
+    // generate unique filename 
+    QString permPath = m_download->attributes().value(DlDestPath).toString();
+    QString uniqueFilename;
+    StorageUtility::generateUniqueFileName(validFilename, m_tempPath, permPath, uniqueFilename);  
+    
+    // set the new filename
+    m_download->attributes().insert(DlFileName, uniqueFilename);
+    
+    // convert to symbian descriptors
+    QString path = m_tempPath;
+    path.replace(QString("/"), QString("\\"));
+    TPtrC ptrPath = SymbianStringToQtString(path);
+    TPtrC ptrFileName = SymbianStringToQtString(uniqueFilename);
+    _LIT8(KOmaDrm1DrmMessageContentType, OMA_DRM_MESSAGE_CONTENT_TYPE);
+    
+    // create supplier and get importfile which will actually write to the file
+    QT_TRAP_THROWING(ContentAccess::CSupplier* supplier = ContentAccess::CSupplier::NewLC();
+                     ContentAccess::CMetaDataArray* metaData = ContentAccess::CMetaDataArray::NewLC();
+                     supplier->SetOutputDirectoryL(ptrPath);
+                     m_file = supplier->ImportFileL(KOmaDrm1DrmMessageContentType(), *metaData, ptrFileName));
+
+    // perform cleanup
+    CleanupStack::PopAndDestroy(2); // metaData, supplier
+    return 0;
+}
+
+
+int DrmStorage::open(QIODevice::OpenMode /*mode*/)
+{
+    // we cannot open an existing file, so we delete the
+    // store and create a new one. Download will start/resume
+    // from beginning
+    deleteStore();
+    if (!m_file)
+        createStore();
+    return 0;
+}
+
+int DrmStorage::write(const QByteArray& data, bool lastChunk)
+{
+    if (!m_file)
+        return -1;
+    
+    // convert the data chunk to 8 bit descriptor
+    QString strChunk(data);
+    TPtrC ptrChunk = SymbianStringToQtString(strChunk);
+    HBufC8* buf8 = q_check_ptr(HBufC8::New(ptrChunk.Length()));
+    buf8->Des().Copy(ptrChunk);
+    TPtrC8 ptrData8(*buf8);
+    
+    if (m_file) {
+        // write the data chunk
+        m_file->WriteData(ptrData8);
+        if (lastChunk) {
+            // close the file
+            close();
+            // move the file to permanent destination path
+            // note that moveDlFile uses m_file
+            moveDlFile();
+            // clean up memory
+            delete m_file;
+            m_file = 0;
+        }
+    }
+    
+    delete buf8;
+    buf8 = NULL;
+    return 0;
+}
+
+int DrmStorage::close()
+{
+    if (m_file) {    
+        // close storage and get filename
+        m_file->WriteDataComplete();
+    }
+    return 0;
+}
+
+int DrmStorage::deleteStore()
+{
+    // create filename (with path)
+    QDir tempFilePath(m_tempPath);
+    QFileInfo tempFileInfo(tempFilePath, m_download->attributes().value(DlFileName).toString());
+    QString tempFileName = tempFileInfo.filePath();
+    
+    // remove the temporary file
+    if (QFile::exists(tempFileName)) {
+        // close the store
+        close();
+        if (m_file) {
+            delete m_file;
+            m_file = 0;
+        }
+        // remove file
+        QFile::remove(tempFileName);
+    }
+
+    return 0;
+}
+
+int DrmStorage::storedDataSize()
+{
+    // build temporary path with filename
+    QDir tempFilePath(m_tempPath);
+    QFileInfo tempFileinfo(tempFilePath, m_download->attributes().value(DlFileName).toString());
+    QString tempFilename = tempFileinfo.filePath();
+    QFile tempFile(tempFilename);
+
+    // return file size if file exists
+    if(tempFile.exists())
+        return tempFile.size();
+    else
+        return 0;
+}
+
+void DrmStorage::moveDlFile()
+{
+    // source file
+    QString fileName = m_download->attributes().value(DlFileName).toString();
+    QFileInfo srcFileInfo(m_tempPath, fileName);
+    QString srcFile = srcFileInfo.filePath();
+    
+    // if source file does not exist, return
+    if (!QFile::exists(srcFile))
+        return;
+
+    // create the permanent directory
+    QString permPath = m_download->attributes().value(DlDestPath).toString();
+    QDir permDir(permPath);
+    if(!permDir.exists()) {
+        if(!permDir.mkpath(permPath))
+            return;
+    }
+
+    if (m_file) {
+        // name of the file to which 
+        TPtrC outputFileName(KNullDesC);
+        QT_TRAP_THROWING(outputFileName.Set(m_file->OutputFileL(0).FileName()));
+        // convert filename to Qt equivalent
+        srcFile = SymbianStringToQtString(outputFileName);
+        // check if file exists and update filename attribute
+        if (!QFile::exists(srcFile))
+            return;
+        
+        // name without extension
+        TParse p;
+        p.SetNoWild(outputFileName, NULL, NULL);
+        TPtrC namePtr = p.Name();
+        // suggested extension
+        TBuf<4> extension;
+        m_file->GetSuggestedOutputFileExtension(extension);
+    
+        // build filename with new extension and convert to Qt equivalent 
+        HBufC* name = q_check_ptr(HBufC::New(namePtr.Length() + extension.Length()));
+        TPtr newNamePtr(name->Des());
+        newNamePtr.Format(_L("%S%S"), &namePtr, &extension);
+        QString newFileName = SymbianStringToQtString(newNamePtr); 
+        delete name;
+        name = NULL;
+    
+        // extension has changed, generate unique filename
+        StorageUtility::generateUniqueFileName(newFileName, m_tempPath, permPath, fileName);
+    }
+    
+    // remove the file if it already exists
+    QFileInfo fileInfo(permPath, fileName);
+    QString destFile = fileInfo.filePath();
+    if (QFile::exists(destFile))
+        QFile::remove(destFile);
+    
+    // Copy the file to destination and remove old file
+    QFile::copy(srcFile, destFile);
+    QFile::remove(srcFile);
+    
+    // set the new filename
+    m_download->attributes().insert(DlFileName, fileName);
+}
+
+QString DrmStorage::SymbianStringToQtString(TDesC& symbianString)
+{
+    // convert symbian string to Qt string
+    return QString::fromUtf16(symbianString.Ptr(), symbianString.Length());
+}
+
+TPtrC DrmStorage::SymbianStringToQtString(QString& qtString)
+{
+    // convert QString string to symbian string
+    return reinterpret_cast<const TText*> (qtString.constData());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/filestorage.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,207 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "filestorage.h"
+#include "storageutility.h"
+#include <QFile>
+#include <QDir>
+#include <QVariant>
+#include <qregexp.h>
+
+class FileStoragePrivate
+{
+    DM_DECLARE_PUBLIC(FileStorage);
+public:
+    FileStoragePrivate();
+    ~FileStoragePrivate();
+    // client name
+    QString m_clientName;
+    // folder paths
+    QString m_tempPath;                     // temporary path till dl completes
+    QFile *m_file;
+    ClientDownload* m_download;
+};  
+
+FileStoragePrivate::FileStoragePrivate()
+{
+    m_tempPath = "";
+    m_file = 0;
+    m_download = 0;
+}
+
+FileStoragePrivate::~FileStoragePrivate()
+{
+    if(m_file)
+    {
+        // close the file if it is open
+        if(m_file->isOpen())
+        {
+            m_file->close();
+        }
+        delete m_file;
+        m_file = 0;
+    }
+}
+
+FileStorage::FileStorage(const QString& clientName, ClientDownload* download)
+{
+    DM_INITIALIZE(FileStorage);
+    priv->m_clientName = clientName;
+    priv->m_file = new QFile();
+    priv->m_download = download;
+    priv->m_tempPath = StorageUtility::createTemporaryPath(clientName);
+}
+
+FileStorage::~FileStorage()
+{
+    DM_UNINITIALIZE(FileStorage);
+}
+
+int FileStorage::createStore()
+{
+    DM_PRIVATE(FileStorage);
+
+    // validate filename
+    QString validFilename;
+    QString filename = priv->m_download->attributes().value(DlFileName).toString();
+    StorageUtility::validateFileName(filename, validFilename);
+    // generate unique filename
+    QString permPath = priv->m_download->attributes().value(DlDestPath).toString();
+    QString uniqueFilename;
+    StorageUtility::generateUniqueFileName(validFilename, priv->m_tempPath, permPath, uniqueFilename);  
+    
+    // set the new filename
+    QDir filePath(priv->m_tempPath);
+    priv->m_download->attributes().insert(DlFileName, uniqueFilename);
+    QFileInfo newFileinfo(filePath, uniqueFilename);
+    QString newFilename = newFileinfo.filePath();
+    priv->m_file->setFileName(newFilename);   
+    if (!priv->m_file->open(QIODevice::ReadWrite))
+        return -1;
+    else
+        return 0;
+}
+
+
+int FileStorage::open(QIODevice::OpenMode mode)
+{
+    DM_PRIVATE(FileStorage);
+
+    QDir filePath(priv->m_tempPath);
+    QFileInfo fileinfo(filePath, priv->m_download->attributes().value(DlFileName).toString());
+    QString filename = fileinfo.filePath();
+    // if already exists, open the file
+    if(priv->m_file && (QFile::exists(filename)) && !priv->m_file->isOpen())
+    {
+        priv->m_file->setFileName(filename);
+        if (!priv->m_file->open(mode))
+            return -1;
+        else
+            return 0;
+    }
+    return -1;  
+}
+
+int FileStorage::write(const QByteArray& data,bool lastChunk)
+{
+    DM_PRIVATE(FileStorage);
+    // write the data chunk
+    int value = priv->m_file->write(data);
+    if(lastChunk)
+    {
+        close();
+        // move the file to permanent destination path
+        moveDlFile();
+    }
+    return value;
+}
+
+int FileStorage::close()
+{
+    DM_PRIVATE(FileStorage);
+    if(priv->m_file && priv->m_file->isOpen())
+    {
+        priv->m_file->close();
+    }
+    return 0;
+}
+
+int FileStorage::deleteStore()
+{
+    DM_PRIVATE(FileStorage);
+    // remove the temporary file
+    QDir tempFilePath(priv->m_tempPath);
+    QFileInfo tempFileinfo(tempFilePath, priv->m_download->attributes().value(DlFileName).toString());
+    QString tempFileName = tempFileinfo.filePath();
+
+    // remove the temporary file
+    if(QFile::exists(tempFileName))
+    {
+        close();
+        QFile::remove(tempFileName); 
+    }
+
+    return 0;
+}
+
+int FileStorage::storedDataSize()
+{
+    DM_PRIVATE(FileStorage);
+    QDir tempFilePath(priv->m_tempPath);
+    QFileInfo tempFileinfo(tempFilePath, priv->m_download->attributes().value(DlFileName).toString());
+    QString tempFilename = tempFileinfo.filePath();
+    QFile tempFile(tempFilename);
+
+    if(tempFile.exists())
+        return tempFile.size();
+    else
+        return 0;
+}
+
+void FileStorage::moveDlFile()
+{
+    DM_PRIVATE(FileStorage);
+    QString permPath = priv->m_download->attributes().value(DlDestPath).toString();
+    QString filename = priv->m_download->attributes().value(DlFileName).toString();
+    QDir permDir(permPath);
+    if(!permDir.exists())
+    {
+        QDir tempDir;
+        if(!tempDir.mkpath (permPath))
+        {
+            return;
+        }
+    }
+    
+    QDir newFilePath(permPath);
+    QFileInfo newFileinfo(newFilePath, filename);
+    QString newFileName = newFileinfo.filePath();
+    
+    // remove the file if already exists
+    if(QFile::exists(newFileName)) {
+        QFile::remove(newFileName);    
+    }
+
+    QDir tempFilePath(priv->m_tempPath);
+    QFileInfo tempFileinfo(tempFilePath, filename);
+    QString tempFilename = tempFileinfo.filePath();
+    
+    QFile::copy(tempFilename, newFileName);
+
+    // remove the temporary file
+    QFile::remove(tempFilename);    
+    return;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/httpdownloadbackend.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,217 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "clientdownload.h"
+#include "downloadmanager.h"
+#include "downloadcore.h"
+#include "downloadstore.h"
+#include "httpdownloadbackend.h"
+#include "filestorage.h"
+#include "dmcommoninternal.h"
+#include <QFileInfo>
+#include <QString>
+#include <QMap>
+#include <QIODevice>
+
+// private implementation
+class HttpDownloadBackendPrivate
+{
+    DM_DECLARE_PUBLIC(HttpDownloadBackend);
+public:
+    HttpDownloadBackendPrivate();
+    ~HttpDownloadBackendPrivate();
+    DownloadCore *m_downloadCore; // for network operations
+    DownloadStore *m_storage; // responsible for handling the storage
+    ClientDownload *m_download; // not owned
+};  
+
+HttpDownloadBackendPrivate::HttpDownloadBackendPrivate()
+{
+    m_downloadCore = 0; 
+    m_storage = 0;
+    m_download = 0;
+}
+
+HttpDownloadBackendPrivate::~HttpDownloadBackendPrivate()
+{
+    if(m_storage)
+    {
+        delete m_storage;
+        m_storage = 0;
+    }
+}
+
+HttpDownloadBackend::HttpDownloadBackend(DownloadCore *dlCore, ClientDownload *dl, DownloadStore* store)
+    :DownloadBackend(dlCore, dl)
+{
+    DM_INITIALIZE(HttpDownloadBackend);
+    priv->m_downloadCore = dlCore;
+    priv->m_storage = store; 
+    priv->m_download = dl;
+    setValue(DownloadInfo::EFinalPath, dl->attributes().value(DlDestPath).toString());
+
+    QString fileName;
+    if(dl->isCreatedByDlInfo())
+    {
+        getValue(DownloadInfo::EFileName, fileName);
+        dl->attributes().insert(DlFileName, fileName);
+        priv->m_storage->open(QIODevice::Append);           
+    }
+    else
+    {
+        fileName = dl->attributes().value(DlFileName).toString();
+        // if filename is not set, take it from url
+        if(fileName.length() == 0) {
+            fileName = priv->m_downloadCore->fileNameFromContentDispositionHeader();
+            if(fileName.length() == 0) {
+                QUrl url(priv->m_downloadCore->url());
+                QFileInfo fileUrl(url.path());
+                fileName = fileUrl.fileName();     
+            }         
+        }
+        dl->attributes().insert(DlFileName, fileName);
+        // create the new storage
+        priv->m_storage->createStore();      
+    }
+    setValue(DownloadInfo::EFileName, download()->attributes().value(DlFileName).toString());
+}
+
+HttpDownloadBackend::~HttpDownloadBackend()
+{
+    DM_UNINITIALIZE(HttpDownloadBackend);
+}
+
+int HttpDownloadBackend::resume()
+{
+    DM_PRIVATE(HttpDownloadBackend);
+    // Open the file in append mode as we need to append the received chunks    
+    if(downloadState() != DlCancelled)
+    {
+        priv->m_storage->open(QIODevice::Append);               
+    }
+    else
+    {
+        QString fileName = download()->attributes().value(DlFileName).toString();
+        // if filename is not set, take it from url 
+        if(fileName.length() == 0) {
+            fileName = priv->m_downloadCore->fileNameFromContentDispositionHeader();
+            if(fileName.length() == 0) {
+                QUrl url(priv->m_downloadCore->url());
+                QFileInfo fileUrl(url.path());
+                fileName = fileUrl.fileName();     
+            }         
+        }
+        download()->attributes().insert(DlFileName, fileName);
+        // create the new storage
+        priv->m_storage->createStore(); 
+    }
+    setValue(DownloadInfo::EFileName, download()->attributes().value(DlFileName).toString());
+    return DownloadBackend::resume();
+}
+
+void HttpDownloadBackend::store(QByteArray data, bool lastChunk)
+{
+    DM_PRIVATE(HttpDownloadBackend); 
+    // write the chunks to the storage
+    priv->m_storage->write(data, lastChunk); 
+}
+
+void HttpDownloadBackend::deleteStore()
+{
+    DM_PRIVATE(HttpDownloadBackend);
+    if(priv->m_storage)
+    {
+        priv->m_storage->deleteStore();
+    }
+}
+
+qint64 HttpDownloadBackend::storedDataSize()
+{
+    DM_PRIVATE(HttpDownloadBackend);
+    // size of stored data chunk
+    return priv->m_storage->storedDataSize();
+}
+
+QVariant HttpDownloadBackend::getAttribute(DownloadAttribute attr)
+{
+    DM_PRIVATE(HttpDownloadBackend);
+    switch(attr)
+    {
+        case DlFileName:
+        {
+            if(priv->m_download)
+                return priv->m_download->attributes().value(attr);
+        }
+        case DlDestPath:
+        {
+            if(priv->m_download)
+                return priv->m_download->attributes().value(attr);
+        }
+        default:
+            break;
+    }  
+    return DownloadBackend::getAttribute(attr);
+}
+
+int HttpDownloadBackend::setAttribute(DownloadAttribute attr, const QVariant& value)
+{
+    return DownloadBackend::setAttribute(attr, value);
+}
+
+void HttpDownloadBackend::headerReceived()
+{
+    DM_PRIVATE(HttpDownloadBackend);
+    DlEventAttributeMap* attrMap = NULL;
+    HttpStatusCode status = (HttpStatusCode) priv->m_downloadCore->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
+    switch(status)
+    {
+        case HttpOK:                    // OK
+        case HttpCreated:               // Created
+        case HttpAccepted:              // Accepted
+        case HttpNonAuthorativeInfo:    // Non-Authorative Information
+        case HttpNoContent:             // No Content
+        case HttpResetContent:          // Reset Conetent
+        {
+            // get the content type and save it in dl info
+            QString contentType = priv->m_downloadCore->contentType();
+            setValue(DownloadInfo::EContentType, contentType);
+            setDownloadState(DlInprogress);
+            break;
+        }
+
+        case HttpPartialContent:        // Partial Conetent Download
+        {
+            setDownloadState(DlInprogress);
+            break;
+        }
+        
+        case HttpPreconditionFailed:    // Precondition Failed
+        {
+            // attrMap will be deleted in destructor of DownloadEventPrivate class
+            attrMap = new DlEventAttributeMap ;
+            attrMap->insert(HeaderReceivedStatusCode, QVariant(status));
+            break;
+        }
+
+        default:
+           break;
+    }
+
+    postEvent(HeaderReceived, attrMap);
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/oma2downloadbackend.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,723 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "oma2downloadbackend.h"
+#include "omaddparser.h"
+#include "downloadmanager.h"
+#include "download.h"
+#include "clientdownload.h"
+#include "downloadcore.h"
+#include "downloadevent.h"
+#include <QCoreApplication>
+#include <QFileInfo>
+
+#ifdef Q_OS_LINUX
+  #include <sys/statvfs.h>
+#endif
+
+#ifdef Q_OS_LINUX 
+static double freeSpace(const char *path)
+#else
+static double freeSpace(const char* /*path*/)
+#endif
+{
+#ifdef Q_OS_LINUX   
+    struct statvfs fiData;
+    if ((statvfs(path,&fiData)) < 0 ) 
+        return 0;
+    else {
+        qint64 blockSize = fiData.f_bsize/1024;
+        qint64 freeSize = (fiData.f_bavail)*blockSize;
+        freeSize = freeSize/1024;
+        return freeSize;
+    }
+#endif
+    return 0;
+}
+
+// Constants
+const char* const SuppressUserConfirmation_Never = "Never";
+
+// private implementation
+class OMA2DownloadBackendPrivate {
+    DM_DECLARE_PUBLIC(OMA2DownloadBackend);
+public:
+    OMA2DownloadBackendPrivate();
+    ~OMA2DownloadBackendPrivate();
+    DownloadCore *m_downloadCore;
+    ClientDownload *m_download;
+    OMADownloadDescParser *m_parser; // for parsing oma descriptor
+    OMADownloadDescriptor *m_downloadDesc;
+    bool m_isMediaDownload; // flag to indicate if media download is happening  
+    MediaDownloadList m_mediaDownloadList; // media downloads
+    int m_currDownloadIndex;
+    int m_currProductIndex;
+    qint64 m_dlCompletedSize;
+    QMap<int, int> m_mediaObjIdStateMap; // map to have the list of Media Objects' id and it's state.
+    QList<QVariant> m_childIds;
+    OMA2DownloadProduct *m_currProduct;
+    OMA2DownloadMediaObj *m_currMediaObj;
+};
+
+OMA2DownloadBackendPrivate::OMA2DownloadBackendPrivate():m_downloadCore(0)
+                                                        ,m_download(0)
+                                                        ,m_parser(0)
+                                                        ,m_downloadDesc(0)
+                                                        ,m_isMediaDownload(false)
+                                                        ,m_currDownloadIndex(-1)
+                                                        ,m_currProductIndex(0)
+                                                        ,m_dlCompletedSize(0)
+{ }
+
+OMA2DownloadBackendPrivate::~OMA2DownloadBackendPrivate()
+{
+    if (m_parser) {
+        delete m_parser;
+        m_parser = 0;
+        m_downloadDesc = 0;
+    }
+    // In case of persistent storage
+    if (m_downloadDesc) {
+        delete m_downloadDesc;
+        m_downloadDesc = 0;
+    }
+    
+    int count = m_mediaDownloadList.count();
+    for (int i = 0; i < count; i++)
+        delete m_mediaDownloadList[i];
+}
+
+OMA2DownloadBackend::OMA2DownloadBackend(DownloadCore *dlCore, ClientDownload *dl)
+    :DownloadBackend(dlCore, dl)
+{
+    DM_INITIALIZE(OMA2DownloadBackend);
+    priv->m_downloadCore = dlCore;
+    priv->m_download = dl;
+}
+
+OMA2DownloadBackend::~OMA2DownloadBackend()
+{
+    DM_UNINITIALIZE(OMA2DownloadBackend);
+}
+
+int OMA2DownloadBackend::pause()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    if (priv->m_isMediaDownload) {
+        priv->m_mediaDownloadList[priv->m_currDownloadIndex]->pause();
+        setDownloadState(DlPaused);
+    }
+    return 0;
+}
+
+int OMA2DownloadBackend::resume()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    if (priv->m_isMediaDownload)
+        return (priv->m_mediaDownloadList[priv->m_currDownloadIndex]->resume());
+
+    // Ready to download after the descriptor is parsed
+    // capability check on the descriptor information
+    if (checkDownloadDescriptor()) {
+        ProductList product = priv->m_downloadDesc->productList();
+        int count =  product[priv->m_currProductIndex]->mediaCount();
+        
+        for (int i=0; i < count; i++) {
+            QUrl baseUrl = priv->m_downloadCore->url();
+            QUrl relativeUrl = product[priv->m_currProductIndex]->mediaObjList()[i]->getAttribute(OMA2DownloadDescMediaObjServer).toString();
+            QString url = baseUrl.resolved(relativeUrl).toString();
+            // create download for media object
+            // id's of media downloads are unique under its parent oma download
+            ClientDownload *dl = new ClientDownload(priv->m_download->downloadManager(), url, (i+1), Parallel
+                                                                                            , priv->m_download->id() );
+            if (NULL == dl)
+                return -1;
+            // functions for persistent storage
+            serializeData(dl, i);
+            setValueForChild(DownloadInfo::EUrl, url, dl->id());
+            setValueForChild(DownloadInfo::EDlState, DlCreated, dl->id());
+            long state;
+            getValue(DownloadInfo::EDlState, state);
+            priv->m_mediaObjIdStateMap[dl->id()] = state;
+            addtoDownloadList(dl);
+        }
+        setValue(DownloadInfo::EChildIdList, priv->m_childIds);
+        qint64 tSize = product[priv->m_currProductIndex]->albumSize();
+        setTotalSize(tSize);
+        priv->m_currDownloadIndex = 0;
+        priv->m_mediaDownloadList[priv->m_currDownloadIndex]->start();
+        priv->m_isMediaDownload = true; 
+        return 0;         
+    }
+    return -1;
+}
+
+int OMA2DownloadBackend::cancel()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    if (priv->m_isMediaDownload)
+        priv->m_mediaDownloadList[priv->m_currDownloadIndex]->cancel();
+    else
+       DownloadBackend::cancel();
+    return 0;
+}
+
+QVariant OMA2DownloadBackend::getAttribute(DownloadAttribute attr)
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    // moIndex is zero because when product name is empty the name of 0th Mediaobject should be shown in dd and also the type is of the 0th Mediaobject
+    const int moIndex = 0;
+    QString text = "";
+    ProductList product;
+    if (priv->m_downloadDesc)
+        product = priv->m_downloadDesc->productList();
+    switch(attr) {
+    case OMADownloadDescriptorName:
+    {
+        if (product[priv->m_currProductIndex]) {
+            QString name = product[priv->m_currProductIndex]->getAttribute(OMA2DownloadDescProductName).toString();
+            if (!name.isEmpty())
+                return name;
+            if (product[priv->m_currProductIndex]->mediaCount() > 0)
+                return product[priv->m_currProductIndex]->mediaObjList()[moIndex]->getAttribute(OMA2DownloadDescMediaObjName);
+            return text;
+        }  
+        return text;
+    }
+
+    case OMADownloadDescriptorType:
+    {
+        if (product[priv->m_currProductIndex]) {
+            if (product[priv->m_currProductIndex]->mediaCount() > 0)
+                return product[priv->m_currProductIndex]->mediaObjList()[moIndex]->getAttribute(OMA2DownloadDescMediaObjType);
+            return text;
+        }
+        return text;
+    }
+
+    case OMADownloadDescriptorSize:
+    {
+        qint64 size = 0;
+        if (product[priv->m_currProductIndex])
+            return product[priv->m_currProductIndex]->albumSize();
+        return size;
+    }
+
+    case OMADownloadDescriptorNextURL:
+    {
+        return priv->m_downloadDesc->getAttribute(OMADownloadDescNextURL);
+    }
+
+    case DlFileName:
+    {
+        if (!priv->m_isMediaDownload) {
+            QString url = priv->m_downloadCore->url();
+            QFileInfo fileUrl(url);
+            return QVariant(fileUrl.fileName());
+        }
+        // If the product tag doesn't have a name then display the media object's name in the download list.
+        // This is helpful for single OMA2 download and is done for better user readability
+        if (product[priv->m_currProductIndex]) {
+            QString name = product[priv->m_currProductIndex]->getAttribute(OMA2DownloadDescProductName).toString();
+            if (!name.isEmpty())
+                return name;
+            if (product[priv->m_currProductIndex]->mediaCount() > 0)
+                return product[priv->m_currProductIndex]->mediaObjList()[priv->m_currDownloadIndex]->getAttribute(OMA2DownloadDescMediaObjName);
+            return text;
+        }  
+        return text;
+    }
+
+    case DlContentType:
+    {
+        if (!priv->m_isMediaDownload)
+            return DownloadBackend::getAttribute(DlContentType);
+        QString contentType = priv->m_mediaDownloadList[priv->m_currDownloadIndex]->getAttribute(DlContentType).toString();
+        if (contentType != "")
+            return contentType;
+        QString mediaObjContentType;
+        getValueForChild(DownloadInfo::EContentType, mediaObjContentType, priv->m_childIds[priv->m_currDownloadIndex].toInt());
+        return mediaObjContentType;
+    }
+
+    default:
+        return DownloadBackend::getAttribute(attr);
+    }
+    return QVariant();
+}
+
+int OMA2DownloadBackend::setAttribute(DownloadAttribute attr, const QVariant& value)
+{
+    return DownloadBackend::setAttribute(attr, value);
+}
+
+// stores the data in storage
+void OMA2DownloadBackend::store(QByteArray /*data*/, bool /*lastChunk=false*/)
+{
+    return;
+}
+
+// deletes the storage
+void OMA2DownloadBackend::deleteStore()
+{
+    return;
+}
+
+// returns the size of stored data
+qint64 OMA2DownloadBackend::storedDataSize()
+{
+    return 0;
+}
+
+void OMA2DownloadBackend::bytesRecieved(qint64 /*bytesRecieved*/, qint64 /*bytesTotal*/)
+{
+     //Do nothing. This is here to avoid this signal to reach to base class' slot.
+     return;
+}
+
+void OMA2DownloadBackend::bytesUploaded(qint64 bytesUploaded, qint64 bytesTotal)
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    // once data is uploaded, cancel the transaction
+    if (bytesUploaded == bytesTotal)
+        priv->m_downloadCore->abort() ;
+
+}
+
+void OMA2DownloadBackend::handleFinished()
+{
+     DM_PRIVATE(OMA2DownloadBackend);
+     QString contentType = priv->m_downloadCore->contentType();
+     if (contentType == OMA2_CONTENT_TYPE) {
+         bool bSucceeded = parseDownloadDescriptor();
+         priv->m_downloadDesc = priv->m_parser->downloadDescriptor();
+         if (bSucceeded) {
+             ProductList product = priv->m_downloadDesc->productList();
+             int count =  product[priv->m_currProductIndex]->mediaCount();
+             if (count == 0) {
+                 priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("906 Invalid descriptor"));
+                 priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+                 priv->m_downloadCore->setLastErrorString(tr("Invalid Descriptor"));
+                 setDownloadState(DlFailed);
+                 postEvent(Error, NULL);
+                 return;
+             }
+             for (int i=0; i < count; i++) {
+                 QString server = product[priv->m_currProductIndex]->mediaObjList()[i]->getAttribute(OMA2DownloadDescMediaObjServer).toString();
+                 QString size = product[priv->m_currProductIndex]->mediaObjList()[i]->getAttribute(OMA2DownloadDescMediaObjSize).toString();
+                 QString type = product[priv->m_currProductIndex]->mediaObjList()[i]->getAttribute(OMA2DownloadDescMediaObjType).toString();
+                 if (server.isEmpty() || size.isEmpty() || type.isEmpty()) {
+                     QString string;
+                     string = product[priv->m_currProductIndex]->mediaObjList()[i]->getAttribute(OMA2DownloadDescMediaObjInstallNotifyURI).toString();
+                     priv->m_downloadCore->post(string, QByteArray("905 Attribute Mismatch"));
+                     priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+                     priv->m_downloadCore->setLastErrorString(tr("Invalid Descriptor"));
+                     setDownloadState(DlFailed);
+                     postEvent(Error, NULL);
+                     return;
+                 }
+             }
+             // if download is restarted OR suppressUserConfirmation is true, do not show descriptor
+             if (suppressUserConfirmation() || (DlDescriptorUpdated == downloadState())) {
+                 resume();
+             } else {
+                 setDownloadState(DlPaused);
+                 postEvent(OMADownloadDescriptorReady, NULL);
+             }
+         } else {
+             priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("906 Invalid descriptor"));
+             priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+             priv->m_downloadCore->setLastErrorString(tr("Invalid Descriptor"));
+             setDownloadState(DlFailed);
+             postEvent(Error, NULL);
+        }
+    }
+}
+          
+bool OMA2DownloadBackend::parseDownloadDescriptor()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    priv->m_parser = new OMADownloadDescParser();
+    QXmlInputSource source(priv->m_downloadCore->reply());
+    QXmlSimpleReader reader;
+    reader.setContentHandler(priv->m_parser);
+    reader.setErrorHandler(priv->m_parser);
+    return reader.parse(source);
+}
+
+// capability check on the descriptor
+bool OMA2DownloadBackend::checkDownloadDescriptor()
+{
+#ifdef Q_OS_LINUX
+    DM_PRIVATE(OMA2DownloadBackend); 
+    ProductList product = priv->m_downloadDesc->productList();
+    double fileSize = product[priv->m_currProductIndex]->albumSize();
+    double mbFactor = 1024*1024;
+    fileSize = fileSize/mbFactor; //fileSize in MB
+    double spaceLeft = freeSpace(ROOT_PATH); //spaze left in MB
+    
+    if (fileSize > spaceLeft) {
+        priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("901 Insufficient memory"));
+        priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+        priv->m_downloadCore->setLastErrorString(tr("901 Insufficient Memory"));
+        setDownloadState(DlFailed);
+        postEvent(Error, NULL);
+        return false;       
+    } 
+#endif
+    return true;
+}
+
+bool OMA2DownloadBackend::event(QEvent *event)
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    ProductList product = priv->m_downloadDesc->productList();
+    DownloadEvent* downloadEvent =  dynamic_cast<DownloadEvent*>(event);
+    DEventType type = (DEventType)event->type();
+    switch(type) {
+    case Started:
+        break;
+    case HeaderReceived:
+    {
+        int dlId = ((DownloadEvent*)event)->getId();
+        if (downloadEvent) {
+            int statusCode = downloadEvent->getAttribute(HeaderReceivedStatusCode).toInt();
+            handleStatusCode(statusCode);
+        }
+        ClientDownload *dl = findDownload(dlId);
+        // Check the mismatch in total size returned by server with the size given in the descriptor.
+        //This piece of code is commented as-of-now. when needed in future , will be uncommented
+        /*qint64 totalSize = dl->getAttribute(DlTotalSize).toInt();
+        if(product[priv->m_currProductIndex]->mediaObjList()[priv->m_currDownloadIndex]->getAttribute(OMA2DownloadDescMediaObjSize).toInt() != totalSize) {
+            postInstallNotifyEvent("905 Attribut Mismatch");
+            priv->m_mediaObjIdStateMap[downloadEvent->getId()] = DlFailed;
+        } */
+        // Check the mismatch in content type returned by server with the content type given in the descriptor.
+        QString contentType = dl->getAttribute(DlContentType).toString();
+        if(product[priv->m_currProductIndex]->mediaObjList()[priv->m_currDownloadIndex]->getAttribute(OMA2DownloadDescMediaObjType).toString() != contentType) {
+            postInstallNotifyEvent("905 Attribute Mismatch");
+            priv->m_mediaObjIdStateMap[downloadEvent->getId()] = DlFailed;
+            if (priv->m_currDownloadIndex < product[priv->m_currProductIndex]->mediaCount()-1) {
+                priv->m_currDownloadIndex++;
+                priv->m_mediaDownloadList[priv->m_currDownloadIndex]->start();
+            }
+       }        
+        break;
+    }
+
+    case Progress:
+    {        
+        QVariant curDlsize = priv->m_mediaDownloadList[priv->m_currDownloadIndex]->getAttribute(DlDownloadedSize);
+        qint64 currentDlSize =  priv->m_dlCompletedSize + (curDlsize.toInt());
+        setDownloadedDataSize(currentDlSize);
+        setDownloadState(DlInprogress);
+        priv->m_mediaObjIdStateMap[downloadEvent->getId()] = DlInprogress;
+        setValueForChild(DownloadInfo::EDlState, DlInprogress, downloadEvent->getId());
+        postEvent(Progress, NULL);
+        break;
+    }
+    case Paused:
+    {
+        setDownloadState(DlPaused);
+        priv->m_mediaObjIdStateMap[downloadEvent->getId()] = DlPaused;
+        setValueForChild(DownloadInfo::EDlState, DlPaused, downloadEvent->getId());
+        postEvent(Paused, NULL);
+        break;
+    }
+    case NetworkLoss:
+    {
+        postEvent(NetworkLoss, NULL);
+        break;
+    }
+    case Cancelled:
+    {
+        postInstallNotifyEvent("902 User Cancelled");
+        priv->m_mediaObjIdStateMap[downloadEvent->getId()] = DlCancelled;
+        setValueForChild(DownloadInfo::EDlState, DlCancelled, downloadEvent->getId());
+        setDownloadState(DlCancelled);
+        postEvent(Cancelled, NULL);
+        break;
+    }
+    case Completed:
+    {
+        postInstallNotifyEvent("900 Success");
+        priv->m_mediaObjIdStateMap[downloadEvent->getId()] = DlCompleted;
+        setValueForChild(DownloadInfo::EDlState, DlCompleted, downloadEvent->getId());
+        QVariant curDlsize = priv->m_mediaDownloadList[priv->m_currDownloadIndex]->getAttribute(DlDownloadedSize);
+        priv->m_dlCompletedSize = priv->m_dlCompletedSize + (curDlsize.toInt());
+        if (priv->m_currDownloadIndex < product[priv->m_currProductIndex]->mediaCount()-1) {
+            priv->m_currDownloadIndex++;
+            priv->m_mediaDownloadList[priv->m_currDownloadIndex]->start();
+        } else if (priv->m_currDownloadIndex == product[priv->m_currProductIndex]->mediaCount()-1) 
+            verifyDownloads();
+        break;
+    }        
+    case Error:
+    {
+        priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+        priv->m_downloadCore->setLastErrorString(tr("905 Attribute Mismatch"));
+        setDownloadState(DlFailed);
+        postEvent(Error, NULL);
+        priv->m_mediaObjIdStateMap[downloadEvent->getId()] = DlFailed;
+        setValueForChild(DownloadInfo::EDlState, DlFailed, downloadEvent->getId());
+        break;
+    } 
+    default:
+        break;
+    }
+    return true;
+}
+
+void OMA2DownloadBackend::getChildren(QList<Download*>& list)
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    for (int i = 0; i < priv->m_mediaDownloadList.count(); i++) 
+        list.append(priv->m_mediaDownloadList[i]);
+
+}
+
+bool OMA2DownloadBackend::suppressUserConfirmation()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+
+    ProductList productList = priv->m_downloadDesc->productList();
+    QString suppressValue = productList[priv->m_currProductIndex]->getAttribute(OMA2DownloadDescProductSuppressConfirmation).toString();
+    QString suppressUserConfirmNever(SuppressUserConfirmation_Never);
+
+    // If suppressUserConfirmation attribute is present for Product tag, use it and don't check media objects
+    // for this attribute
+    if (!suppressValue.isEmpty()) {
+        if (suppressValue == suppressUserConfirmNever)
+            return false;
+        return true;
+    }
+    
+    int mediaCount = productList[priv->m_currProductIndex]->mediaCount();
+    // If suppressUserConfirmation is present and it is NOT "Never" for even a single media object,
+    // then treat this as true and do not display user confirmation.
+    QString suppressConfirmMediaObj = "";
+
+    for (int i=0; i<mediaCount; ++i) {
+        // If the mediaObject element in DD file has this attribute
+        suppressValue = productList[priv->m_currProductIndex]->mediaObjList()[i]->getAttribute(OMA2DownloadDescMediaObjSuppressConfirmation).toString();
+        if (!suppressValue.isEmpty()) {
+            // Check if two or more mediObjects have different values for this attribute.
+            // If so, then this is an invalid case. Hence we ignore this attribute.
+            if (suppressConfirmMediaObj.isEmpty())
+                suppressConfirmMediaObj = suppressValue;
+            else if (suppressConfirmMediaObj != suppressValue) {
+                // Two mediaObjects have different values of suppressUserConfirmation attribute.
+                // Ignore this attribute.
+                return false;
+            }
+        }
+    }
+    
+    // If string is empty OR its value is "Never", return false.
+    if (suppressConfirmMediaObj.isEmpty() || (suppressConfirmMediaObj == suppressUserConfirmNever))
+        return false;
+    
+    return true;
+}
+
+void OMA2DownloadBackend::handleStatusCode(const int& statusCode)
+{
+    HttpStatusCode status = (HttpStatusCode)statusCode;
+    switch(status) {
+    case HttpPreconditionFailed:    // Precondition Failed
+    {
+        handlePreconditionFailed();
+        postEvent(DescriptorUpdated, NULL);
+        return;
+    }
+    
+    default:
+        return;
+    }
+}
+
+void OMA2DownloadBackend::handlePreconditionFailed()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    QString updatedDDUri = priv->m_downloadDesc->getAttribute(OMA2DownloadDescUpdatedDDURI).toString();
+    if (updatedDDUri.isEmpty())
+        return;
+
+    DownloadManager* dlMgr = priv->m_download->downloadManager();
+    if (!dlMgr)
+        return;
+
+    // Delete all media objects
+    priv->m_isMediaDownload = false;
+    ProductList productList = priv->m_downloadDesc->productList();
+    int count =  productList[priv->m_currProductIndex]->mediaCount();
+
+    // Remove all media objects
+    for(int i=0; i<count; ++i) {
+        ClientDownload* dl = priv->m_mediaDownloadList[i];
+        QCoreApplication::removePostedEvents(this);
+        dl->unregisterEventReceiver(this);
+        priv->m_mediaDownloadList.removeOne(dl);
+        dlMgr->removeOne(dl);
+    }
+    
+    // start download of updated DD
+    priv->m_downloadCore->changeUrl(updatedDDUri);
+    priv->m_downloadCore->doDownload();
+    setDownloadState(DlDescriptorUpdated);
+}
+
+void OMA2DownloadBackend::addtoDownloadList(ClientDownload* dl)
+{
+    DM_PRIVATE(OMA2DownloadBackend); 
+    dl->registerEventReceiver(this);
+    priv->m_childIds.append(dl->id());
+    priv->m_mediaDownloadList.append(dl);
+}
+
+ClientDownload* OMA2DownloadBackend::findDownload(int id)
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    for (int i = 0; i < priv->m_mediaDownloadList.size(); ++i) {
+        if (priv->m_mediaDownloadList[i]->id() == id)
+            return priv->m_mediaDownloadList[i];
+    }
+    return 0; 
+}
+
+void OMA2DownloadBackend::postInstallNotifyEvent(const char* statusMessage)
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    ProductList product = priv->m_downloadDesc->productList();
+    QString string;
+    string = product[priv->m_currProductIndex]->mediaObjList()[priv->m_currDownloadIndex]->getAttribute(OMA2DownloadDescMediaObjInstallNotifyURI).toString();
+    priv->m_downloadCore->post(string, QByteArray(statusMessage));   
+}
+
+void OMA2DownloadBackend::verifyDownloads()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    // go throught the mediaObjmap of id, state value pair and if any dl is failed then set the state of parent as paused.
+    ProductList product = priv->m_downloadDesc->productList();
+    int counter = 0;
+    for (int i=0; i < priv->m_childIds.count(); i++) {
+        if (priv->m_mediaObjIdStateMap[priv->m_childIds[i].toInt()] == DlCompleted)
+            counter++;
+        else if (priv->m_mediaObjIdStateMap[priv->m_childIds[i].toInt()] == DlFailed) {
+            setDownloadState(DlFailed);
+            postEvent(Error, NULL);
+            break;
+        }
+    }
+    if (counter == priv->m_childIds.count()) {
+        setDownloadState(DlCompleted);
+        postEvent(Completed, NULL);
+    }
+}
+
+int OMA2DownloadBackend::currentIndex()
+{
+    // If a download is in progress and closed,  a track in an album is either paused or created.
+    // This function as part of persistant storage,returns the index of the download which is either in paused or created state
+    DM_PRIVATE(OMA2DownloadBackend);
+    ProductList product = priv->m_downloadDesc->productList();
+    for (int i=0; i < priv->m_childIds.count(); i++) {
+        if (priv->m_mediaObjIdStateMap[priv->m_childIds[i].toInt()] == DlPaused
+            || priv->m_mediaObjIdStateMap[priv->m_childIds[i].toInt()] == DlCreated) {
+            priv->m_currDownloadIndex = i;
+            break;
+        }
+    }
+    return priv->m_currDownloadIndex;
+}
+
+void OMA2DownloadBackend::init()
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    priv->m_isMediaDownload = true; // since init() is called during restoring the persistent info, the flag should be set to true.
+
+    priv->m_downloadDesc = new OMADownloadDescriptor();
+    priv->m_currProduct = new OMA2DownloadProduct();
+    priv->m_downloadDesc->addProduct(priv->m_currProduct);
+    // populating the product map
+    QString productName;
+    getValue(DownloadInfo::EFileName, productName);
+    priv->m_currProduct->setAttribute("name", QVariant(productName));
+
+    QList<QVariant> id;
+    getValue(DownloadInfo::EChildIdList, id);
+    QString oma2ContentType,mediaObjName,mediaObjUrl,mediaObjContentType;
+    long mediaObjSize;
+    long state;
+    priv->m_currProductIndex = 0;
+    for(int i=0; i<id.size(); i++) {
+        //populating the mediaobj map
+        priv->m_currMediaObj = new OMA2DownloadMediaObj();
+        priv->m_currProduct->addMediaObject(priv->m_currMediaObj);
+        
+        // getting all the values related to media object for populating descriptor's mediaobj map        
+        getValueForChild(DownloadInfo::EFileName, mediaObjName, id[i].toInt());
+        getValueForChild(DownloadInfo::ETotalSize, mediaObjSize, id[i].toInt());
+        getValueForChild(DownloadInfo::EUrl, mediaObjUrl, id[i].toInt());
+        getValueForChild(DownloadInfo::EContentType, mediaObjContentType, id[i].toInt());
+        getValueForChild(DownloadInfo::EDlState, state, id[i].toInt());
+        priv->m_mediaObjIdStateMap[id[i].toInt()] = state;
+
+        // creaating downloads for the media objects
+        ClientDownload *dl = NULL;
+        if (state == DlCreated) {
+            dl = new ClientDownload(priv->m_download->downloadManager(), mediaObjUrl, id[i].toInt(), Parallel
+                                                                                                   , priv->m_download->id() );
+        }
+        else
+            dl = new ClientDownload(priv->m_download->downloadManager(), id[i].toInt(), priv->m_download->id());
+
+        setValueForChild(DownloadInfo::EDlState, priv->m_mediaObjIdStateMap[id[i].toInt()], id[i].toInt());
+        addtoDownloadList(dl);
+        // re-constructing descriptor's mediaobj map
+        priv->m_currMediaObj->setAttribute("name", QVariant(mediaObjName));
+        int size = mediaObjSize;
+        priv->m_currMediaObj->setAttribute("size", QVariant(size));
+        priv->m_currMediaObj->setAttribute("type", QVariant(mediaObjContentType));
+        priv->m_currMediaObj->setAttribute("server",QVariant(mediaObjUrl));
+    }
+    ProductList product = priv->m_downloadDesc->productList();
+    getValue(DownloadInfo::EDlState,state);
+    if(state == DlCompleted)
+        priv->m_currDownloadIndex = product[priv->m_currProductIndex]->mediaCount()-1;
+    else
+        priv->m_currDownloadIndex = currentIndex();
+}
+
+void OMA2DownloadBackend::serializeData(ClientDownload* dl, int index)
+{
+    DM_PRIVATE(OMA2DownloadBackend);
+    ProductList product = priv->m_downloadDesc->productList();
+    // set OMA2 parent values in QSettings.
+    QString productName = product[priv->m_currProductIndex]->getAttribute(OMA2DownloadDescProductName).toString(); // contenttype,url being written in dlbackend's constructor
+    setValue(DownloadInfo::EFileName, productName);
+
+    // set minimal MediaObject attributes in QSettings like name, size, url and contentType as these are the ones required for persistent storage.
+    QString mediaObjName = product[priv->m_currProductIndex]->mediaObjList()[index]->getAttribute(OMA2DownloadDescMediaObjName).toString();
+    setValueForChild(DownloadInfo::EFileName, mediaObjName, dl->id());
+    long mediaObjSize = product[priv->m_currProductIndex]->mediaObjList()[index]->getAttribute(OMA2DownloadDescMediaObjSize).toInt();
+    setValueForChild(DownloadInfo::ETotalSize, mediaObjSize, dl->id());
+    QString mediaObjContentType = product[priv->m_currProductIndex]->mediaObjList()[index]->getAttribute(OMA2DownloadDescMediaObjType).toString();
+    setValueForChild(DownloadInfo::EContentType, mediaObjContentType, dl->id());
+    QString destPath = (download()->attributes().value(DlDestPath)).toString();
+    setValueForChild(DownloadInfo::EFinalPath, destPath, dl->id());
+    setValueForChild(DownloadInfo::EETag, priv->m_downloadCore->entityTag(), dl->id()); //not getting set check later
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/omaddparser.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,396 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "omaddparser.h"
+#include <QString>
+
+const QString nameTag = "name";
+const QString DDVersionTag = "DDVersion";
+const QString typeTag = "type";
+const QString sizeTag = "size";
+const QString vendorTag = "vendor";
+const QString descriptionTag = "description";
+const QString productTag = "product";
+const QString mediaObjectTag = "mediaObject";
+const QString progressiveDownloadFlagTag = "progressiveDownloadFlag";
+const QString serverTag = "server";
+const QString suppressUserConfirmTag = "suppressUserConfirmation";
+const QString updatedDDURITag = "updatedDDURI";
+const QString objectURITag = "objectURI";
+const QString installNotifyURITag = "installNotifyURI";
+const QString nextURLTag = "nextURL";
+
+// private implementation class
+class OMADownloadDescParserPrivate {
+    DM_DECLARE_PUBLIC(OMADownloadDescParser);
+public:
+    OMADownloadDescParserPrivate();
+    ~OMADownloadDescParserPrivate();
+    OMADownloadDescriptor *m_downloadDesc;
+    QStack<QString> m_stack;
+    QString m_characterData;
+    QString m_errorString;
+    bool m_isProductTag; // flag to indicate if it is product tag
+    bool m_isMediaObjTag; // flag to indicate if it is media object tag
+    OMA2DownloadProduct *m_currProduct;
+    OMA2DownloadMediaObj *m_currMediaObj;
+};
+
+class OMADownloadDescriptorPrivate {
+    DM_DECLARE_PUBLIC(OMADownloadDescriptor);
+public:
+    OMADownloadDescriptorPrivate();
+    ~OMADownloadDescriptorPrivate();
+    QMap<QString, QVariant> m_attrMap;
+    ProductList m_productList;
+};
+
+class OMA2DownloadProductPrivate {
+    DM_DECLARE_PUBLIC(OMA2DownloadProduct);
+public:
+    OMA2DownloadProductPrivate();
+    ~OMA2DownloadProductPrivate();
+    QMap<QString, QVariant> m_productAttrMap;
+    MediaObjectList m_mediaObjList;
+};
+
+class OMA2DownloadMediaObjPrivate {
+    DM_DECLARE_PUBLIC(OMA2DownloadMediaObj);
+public:
+    QMap<QString, QVariant> m_mediaObjAttrMap;
+};
+
+OMADownloadDescParserPrivate::OMADownloadDescParserPrivate():m_downloadDesc(0)
+                                                            ,m_isProductTag(false)
+                                                            ,m_isMediaObjTag(false)
+                                                            ,m_currProduct(0)
+                                                            ,m_currMediaObj(0)
+{ }
+
+OMADownloadDescParserPrivate::~OMADownloadDescParserPrivate()
+{
+    if (m_downloadDesc) {
+        delete m_downloadDesc;
+        m_downloadDesc = 0;
+    }
+}
+
+OMADownloadDescParser::OMADownloadDescParser()
+{
+    DM_INITIALIZE(OMADownloadDescParser);
+}
+
+OMADownloadDescParser::~OMADownloadDescParser()
+{
+    DM_UNINITIALIZE(OMADownloadDescParser);
+}
+
+bool OMADownloadDescParser::startDocument()
+{
+    DM_PRIVATE(OMADownloadDescParser);
+    priv->m_downloadDesc = new OMADownloadDescriptor();
+    return true;
+}
+
+bool OMADownloadDescParser::startElement(const QString&, const QString&, const QString& qName, const QXmlAttributes&)
+{
+    DM_PRIVATE(OMADownloadDescParser);
+    priv->m_characterData = "";
+    priv->m_stack.push(qName);
+    if (qName == productTag) {
+        priv->m_isProductTag = true;
+        priv->m_currProduct = new OMA2DownloadProduct();
+        if (priv->m_currProduct) {
+            priv->m_downloadDesc->addProduct(priv->m_currProduct);
+            return true;
+        }
+        return false;
+    }
+    if (qName == mediaObjectTag) {
+        priv->m_isMediaObjTag = true;
+        priv->m_currMediaObj = new OMA2DownloadMediaObj();
+        if (priv->m_currMediaObj) {
+            priv->m_currProduct->addMediaObject(priv->m_currMediaObj);
+            return true;
+        }
+        return false;
+    }
+    return true;
+}
+
+bool OMADownloadDescParser::endElement(const QString&, const QString&, const QString& qName)
+{
+    DM_PRIVATE(OMADownloadDescParser);
+    QString tagName = priv->m_stack.pop();
+    if (qName == tagName) {
+        if (tagName == productTag)
+            priv->m_isProductTag = false; 
+        else if (tagName == mediaObjectTag)
+            priv->m_isMediaObjTag = false;
+        else {
+            if ( priv->m_characterData != "") {
+                if (priv->m_isProductTag) {
+                    if (priv->m_isMediaObjTag) {
+                        priv->m_currMediaObj->setAttribute(qName, QVariant(priv->m_characterData));
+                        priv->m_characterData = "";
+                    } else {
+                        priv->m_currProduct->setAttribute(qName, QVariant(priv->m_characterData));
+                        priv->m_characterData = "";
+                    }
+                } else {
+                    priv->m_downloadDesc->setAttribute(qName, QVariant(priv->m_characterData));
+                    priv->m_characterData = "";
+                }
+            }
+        }
+    return true;
+    } else {
+        priv->m_errorString = QObject::tr("Tag Mismatch. Check content");
+        return false;
+    }
+}
+
+bool OMADownloadDescParser::characters(const QString& ch)
+{
+    DM_PRIVATE(OMADownloadDescParser);
+    QString str = ch.trimmed();
+    if (str != "")
+        priv->m_characterData += str;
+    return true;
+}
+
+QString OMADownloadDescParser::errorString() 
+{
+    DM_PRIVATE(OMADownloadDescParser);
+    return priv->m_errorString;
+}
+
+bool OMADownloadDescParser::fatalError(const QXmlParseException &/*exception*/)
+{
+    return false;
+}
+
+
+OMADownloadDescriptorPrivate::OMADownloadDescriptorPrivate()
+{
+}
+
+OMADownloadDescriptorPrivate::~OMADownloadDescriptorPrivate()
+{
+    if (!m_productList.isEmpty()) {
+        for (int i=0; i<m_productList.count(); i++)
+            delete m_productList[i];
+     }
+}
+
+OMADownloadDescriptor* OMADownloadDescParser::downloadDescriptor()
+{
+    DM_PRIVATE(OMADownloadDescParser);
+    return priv->m_downloadDesc;
+}
+
+OMADownloadDescriptor::OMADownloadDescriptor()
+{
+    DM_INITIALIZE(OMADownloadDescriptor);
+}
+
+OMADownloadDescriptor::~OMADownloadDescriptor()
+{
+    DM_UNINITIALIZE(OMADownloadDescriptor);
+}
+
+QVariant OMADownloadDescriptor::getAttribute(OMADownloadAttribute attr)
+{
+    DM_PRIVATE(OMADownloadDescriptor);
+    switch(attr) {
+    case OMADownloadDescName:
+        return QVariant(priv->m_attrMap[nameTag]);
+
+    case OMADownloadDescVersion:
+        return QVariant(priv->m_attrMap[DDVersionTag]);
+
+    case OMADownloadDescObjectURI:
+        return QVariant(priv->m_attrMap[objectURITag]);
+
+    case OMADownloadDescType:
+        return QVariant(priv->m_attrMap[typeTag]);
+
+    case OMADownloadDescSize:
+        return QVariant(priv->m_attrMap[sizeTag]);
+
+    case OMADownloadDescVendor:
+        return QVariant(priv->m_attrMap[vendorTag]);
+
+    case OMADownloadDescDescription:
+        return QVariant(priv->m_attrMap[descriptionTag]);
+
+    case OMADownloadDescInstallNotifyURI:
+        return QVariant(priv->m_attrMap[installNotifyURITag]);
+
+    case OMA2DownloadDescUpdatedDDURI:
+        return QVariant(priv->m_attrMap[updatedDDURITag]);
+
+    case OMADownloadDescNextURL:
+        return QVariant(priv->m_attrMap[nextURLTag]);
+
+    default:
+        return QVariant();
+    }
+}
+
+void OMADownloadDescriptor::setAttribute(const QString& attrName, const QVariant& value)
+{
+    DM_PRIVATE(OMADownloadDescriptor);
+    priv->m_attrMap[attrName] = value;
+}
+
+QList<OMA2DownloadProduct*> OMADownloadDescriptor::productList()
+{
+    DM_PRIVATE(OMADownloadDescriptor);
+    return (priv->m_productList); 
+}
+
+int OMADownloadDescriptor::productCount()
+{
+    DM_PRIVATE(OMADownloadDescriptor);
+    return priv->m_productList.count();
+}
+
+void OMADownloadDescriptor::addProduct(OMA2DownloadProduct *Obj)
+{
+    DM_PRIVATE(OMADownloadDescriptor);
+    priv->m_productList.append(Obj);
+}
+
+
+OMA2DownloadProductPrivate::OMA2DownloadProductPrivate()
+{ }
+
+OMA2DownloadProductPrivate::~OMA2DownloadProductPrivate()
+{
+    if (!m_mediaObjList.isEmpty()) {
+        for (int i=0; i<m_mediaObjList.count(); i++)
+            delete m_mediaObjList[i];
+     }
+}
+
+OMA2DownloadProduct::OMA2DownloadProduct()
+{
+    DM_INITIALIZE(OMA2DownloadProduct);
+}
+
+OMA2DownloadProduct::~OMA2DownloadProduct()
+{
+    DM_UNINITIALIZE(OMA2DownloadProduct);
+}
+
+QVariant OMA2DownloadProduct::getAttribute(OMADownloadAttribute attr)
+{
+    DM_PRIVATE(OMA2DownloadProduct);
+    switch(attr) {
+    case OMA2DownloadDescProductName:
+        return QVariant(priv->m_productAttrMap[nameTag]);
+
+    case OMA2DownloadDescProductInstallNotifyURI:
+        return QVariant(priv->m_productAttrMap[installNotifyURITag]);
+
+    case OMA2DownloadDescProductSuppressConfirmation:
+        return QVariant(priv->m_productAttrMap[suppressUserConfirmTag]);
+
+    default:
+        return QVariant();
+    }
+}
+
+void OMA2DownloadProduct::setAttribute(const QString& attrName, const QVariant& value)
+{
+    DM_PRIVATE(OMA2DownloadProduct);
+    priv->m_productAttrMap[attrName] = value;
+}
+
+QList<OMA2DownloadMediaObj*> OMA2DownloadProduct::mediaObjList()
+{
+    DM_PRIVATE(OMA2DownloadProduct);
+    return (priv->m_mediaObjList);
+}
+
+int OMA2DownloadProduct::mediaCount()
+{
+    DM_PRIVATE(OMA2DownloadProduct);
+    return priv->m_mediaObjList.count();
+}
+
+void OMA2DownloadProduct::addMediaObject(OMA2DownloadMediaObj *Obj)
+{
+    DM_PRIVATE(OMA2DownloadProduct);
+    priv->m_mediaObjList.append(Obj);
+}
+
+qint64 OMA2DownloadProduct::albumSize()
+{
+    DM_PRIVATE(OMA2DownloadProduct);
+    qint64 albumSize = 0;
+    for(int i=0; i<priv->m_mediaObjList.count(); i++)
+        albumSize = albumSize + priv->m_mediaObjList[i]->getAttribute(OMA2DownloadDescMediaObjSize).toInt();
+    return (albumSize);
+}
+
+
+OMA2DownloadMediaObj::OMA2DownloadMediaObj()
+{
+    DM_INITIALIZE(OMA2DownloadMediaObj);
+}
+
+OMA2DownloadMediaObj::~OMA2DownloadMediaObj()
+{
+    DM_UNINITIALIZE(OMA2DownloadMediaObj);
+}
+
+QVariant OMA2DownloadMediaObj::getAttribute(OMADownloadAttribute attr)
+{
+    DM_PRIVATE(OMA2DownloadMediaObj);
+    switch(attr) {
+    case OMA2DownloadDescMediaObjName:
+        return QVariant(priv->m_mediaObjAttrMap[nameTag]);
+
+    case OMA2DownloadDescMediaObjType:
+        return QVariant(priv->m_mediaObjAttrMap[typeTag]);
+
+    case OMA2DownloadDescMediaObjSize:
+        return QVariant(priv->m_mediaObjAttrMap[sizeTag]);
+        
+    case OMA2DownloadDescMediaObjProgressiveDl:
+        return QVariant(priv->m_mediaObjAttrMap[progressiveDownloadFlagTag]);
+
+    case OMA2DownloadDescMediaObjServer:
+        return QVariant(priv->m_mediaObjAttrMap[serverTag]);
+
+    case OMA2DownloadDescMediaObjInstallNotifyURI:
+        return QVariant(priv->m_mediaObjAttrMap[installNotifyURITag]); // need to add the rest of private attributes like license, text, order when implemented in future.
+
+    case OMA2DownloadDescMediaObjSuppressConfirmation:
+        return QVariant(priv->m_mediaObjAttrMap[suppressUserConfirmTag]);
+
+    default:
+        return QVariant();
+    }   
+}
+
+void OMA2DownloadMediaObj::setAttribute(const QString& attrName, const QVariant& value)
+{
+    DM_PRIVATE(OMA2DownloadMediaObj);
+    priv->m_mediaObjAttrMap[attrName] = value;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/omadownloadbackend.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,389 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "omadownloadbackend.h"
+#include "omaddparser.h"
+#include "downloadmanager.h"
+#include "clientdownload.h"
+#include "downloadcore.h"
+#include "downloadevent.h"
+#include <QCoreApplication>
+#include <QFileInfo>
+
+#ifdef Q_OS_LINUX
+  #include <sys/statvfs.h>
+#endif
+
+#ifdef Q_OS_LINUX 
+static double freeSpace(const char *path)
+#else
+static double freeSpace(const char* /*path*/)
+#endif
+{
+#ifdef Q_OS_LINUX   
+    struct statvfs fiData;
+    if ((statvfs(path,&fiData)) < 0 ) 
+        return 0;
+    else {
+        int blockSize = fiData.f_bsize/1024;
+        double freeSize = (fiData.f_bavail)*blockSize;
+        freeSize = freeSize/1024;
+        return freeSize;
+    }
+#endif
+    return 0;
+}
+
+// private implementation
+class OMADownloadBackendPrivate {
+    DM_DECLARE_PUBLIC(OMADownloadBackend);
+public:
+    OMADownloadBackendPrivate();
+    ~OMADownloadBackendPrivate();
+
+    DownloadCore *m_downloadCore;
+    ClientDownload *m_download;
+    OMADownloadDescParser *m_parser; // for parsing oma descriptor
+    OMADownloadDescriptor *m_downloadDesc;
+    bool m_isMediaDownload; // flag to indicate if media download is happening
+    ClientDownload *m_mediaDownload; // not owned
+    bool m_isUserCancelled;
+};
+
+OMADownloadBackendPrivate::OMADownloadBackendPrivate()
+{
+    m_downloadCore = 0;
+    m_download = 0;
+    m_parser = 0;
+    m_downloadDesc = 0;
+    m_isMediaDownload = false;
+    m_mediaDownload = 0;
+    m_isUserCancelled = false;
+}
+
+OMADownloadBackendPrivate::~OMADownloadBackendPrivate()
+{
+    if (m_parser) {
+        delete m_parser;
+        m_parser = 0;
+        m_downloadDesc = 0;
+    }
+    if (m_mediaDownload) {
+        delete m_mediaDownload;
+        m_mediaDownload = NULL;
+    }
+}
+
+OMADownloadBackend::OMADownloadBackend(DownloadCore *dlCore, ClientDownload *dl)
+    :DownloadBackend(dlCore, dl)
+{
+    DM_INITIALIZE(OMADownloadBackend);
+    priv->m_downloadCore = dlCore;
+    priv->m_download = dl;
+}
+
+OMADownloadBackend::~OMADownloadBackend()
+{
+     DM_UNINITIALIZE(OMADownloadBackend);
+}
+
+int OMADownloadBackend::pause()
+{
+    DM_PRIVATE(OMADownloadBackend);
+    if (priv->m_isMediaDownload) {
+        priv->m_mediaDownload->pause();
+        setDownloadState(DlPaused);
+    }
+    return 0;
+}
+
+int OMADownloadBackend::resume()
+{
+    DM_PRIVATE(OMADownloadBackend);
+    priv->m_isUserCancelled = false;
+    if (priv->m_isMediaDownload)
+        return (priv->m_mediaDownload->resume());
+
+    // Ready to download after the descriptor is parsed
+    // capability check on the descriptor information
+    if (checkDownloadDescriptor()) {
+         // create download for media object
+        priv->m_mediaDownload = new ClientDownload(priv->m_download->downloadManager(), 
+                priv->m_downloadDesc->getAttribute(OMADownloadDescObjectURI).toString(), priv->m_download->id()); 
+
+        if (!priv->m_mediaDownload) {
+            deleteInfo(); 
+            return -1;               
+        }
+        priv->m_mediaDownload->setAttribute(DlFileName, priv->m_downloadDesc->getAttribute(OMADownloadDescName));
+        priv->m_mediaDownload->registerEventReceiver(this);
+        priv->m_mediaDownload->start();
+        priv->m_isMediaDownload = true; 
+        deleteInfo(); 
+        return 0;         
+    }
+    return -1;
+}
+
+int OMADownloadBackend::cancel()
+{
+    DM_PRIVATE(OMADownloadBackend);
+    priv->m_isUserCancelled = true;
+    if (priv->m_isMediaDownload)
+        priv->m_mediaDownload->cancel();
+    else
+        DownloadBackend::cancel();
+    return 0;
+}
+
+QVariant OMADownloadBackend::getAttribute(DownloadAttribute attr)
+{
+    DM_PRIVATE(OMADownloadBackend);
+    switch(attr) {
+    case OMADownloadDescriptorName:
+        return priv->m_downloadDesc->getAttribute(OMADownloadDescName);
+    case OMADownloadDescriptorVersion:
+        return priv->m_downloadDesc->getAttribute(OMADownloadDescVersion);
+    case OMADownloadDescriptorType:
+        return priv->m_downloadDesc->getAttribute(OMADownloadDescType);
+    case OMADownloadDescriptorSize:
+        return priv->m_downloadDesc->getAttribute(OMADownloadDescSize);
+    case OMADownloadDescriptorVendor:
+        return priv->m_downloadDesc->getAttribute(OMADownloadDescVendor);
+    case OMADownloadDescriptorDescription:
+        return priv->m_downloadDesc->getAttribute(OMADownloadDescDescription);
+
+    case DlFileName:
+    {
+        if (!priv->m_isMediaDownload) {
+            QString url = priv->m_downloadCore->url();
+            QFileInfo fileUrl(url);
+            return QVariant(fileUrl.fileName());
+        } else
+            return priv->m_downloadDesc->getAttribute(OMADownloadDescName);
+    }
+    case DlContentType:
+    {
+        if (!priv->m_isMediaDownload)
+            return DownloadBackend::getAttribute(DlContentType);
+            
+        else
+            return priv->m_mediaDownload->getAttribute(DlContentType);
+    }
+    default:
+        return DownloadBackend::getAttribute(attr);
+    }    
+    return QVariant();
+}
+
+int OMADownloadBackend::setAttribute(DownloadAttribute attr, const QVariant& value)
+{
+    return DownloadBackend::setAttribute(attr, value);
+}
+
+// stores the data in storage
+void OMADownloadBackend::store(QByteArray /*data*/, bool /*lastChunk=false*/)
+{
+    return;
+}
+
+// deletes the storage
+void OMADownloadBackend::deleteStore()
+{
+    return;
+}
+
+// returns the size of stored data
+qint64 OMADownloadBackend::storedDataSize()
+{
+    return 0;
+}
+
+void OMADownloadBackend::bytesRecieved(qint64 /*bytesRecieved*/, qint64 /*bytesTotal*/)
+{
+     //Do nothing. This is here to avoid this signal to reach to base class' slot.
+     return;
+}
+
+void OMADownloadBackend::bytesUploaded(qint64 bytesUploaded, qint64 bytesTotal)
+{
+    DM_PRIVATE(OMADownloadBackend); 
+    // once data is uploaded, cancel the transaction
+    if (bytesUploaded == bytesTotal)
+        priv->m_downloadCore->abort() ;
+}
+
+void OMADownloadBackend::handleFinished()
+{
+     DM_PRIVATE(OMADownloadBackend);
+     QString contentType = priv->m_downloadCore->contentType();
+     if (contentType == OMA_CONTENT_TYPE) {
+         bool bSucceeded = parseDownloadDescriptor();
+         if (bSucceeded) {
+             priv->m_downloadDesc = priv->m_parser->downloadDescriptor();
+             
+             QString objectURI = priv->m_downloadDesc->getAttribute(OMADownloadDescObjectURI).toString();
+             if (objectURI.isEmpty()) {
+                 priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("905 Attribute Mismatch"));
+                 priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+                 priv->m_downloadCore->setLastErrorString(tr("No ObjectURI"));
+                 setDownloadState(DlFailed);
+                 postEvent(Error, NULL);
+                 return;
+             }
+             setDownloadState(DlPaused);
+             postEvent(OMADownloadDescriptorReady, NULL);
+         } else {
+             priv->m_downloadDesc = priv->m_parser->downloadDescriptor();
+             priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("906 Invalid descriptor"));
+             priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+             priv->m_downloadCore->setLastErrorString(tr("Invalid Descriptor"));
+             setDownloadState(DlFailed);
+             postEvent(Error, NULL);
+         }
+     }
+}
+          
+bool OMADownloadBackend::parseDownloadDescriptor()
+{
+    DM_PRIVATE(OMADownloadBackend);
+    priv->m_parser = new OMADownloadDescParser();
+    QXmlInputSource source(priv->m_downloadCore->reply());
+    QXmlSimpleReader reader;
+    reader.setContentHandler(priv->m_parser);
+    reader.setErrorHandler(priv->m_parser);
+    return reader.parse(source);
+}
+
+// capability check on the descriptor
+bool OMADownloadBackend::checkDownloadDescriptor()
+{
+    DM_PRIVATE(OMADownloadBackend);
+
+    QString version = priv->m_downloadDesc->getAttribute(OMADownloadDescVersion).toString();
+    if (! version.isEmpty() && (version != OMA_VERSION_1)) {
+        priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("951 Invalid DDVersion"));
+        priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+        priv->m_downloadCore->setLastErrorString(tr("951 Invalid DDVersion"));
+        setDownloadState(DlFailed); 
+        postEvent(Error, NULL);
+        return false; 
+    } 
+
+#ifdef Q_OS_LINUX
+    // "Size" check needs to be done
+    double fileSize =  priv->m_downloadDesc->getAttribute(OMADownloadDescSize).toDouble();
+    double mbFactor = 1024*1024;
+    fileSize = fileSize/mbFactor; //fileSize in MB
+    double spaceLeft = freeSpace(ROOT_PATH); //spaze left in MB
+    
+    if (fileSize > spaceLeft) {
+        priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("901 Insufficient memory"));
+        priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+        priv->m_downloadCore->setLastErrorString(tr("901 Insufficient Memory"));
+        setDownloadState(DlFailed);
+        postEvent(Error, NULL);
+        return false;       
+    } 
+#endif
+    return true;
+}
+
+bool OMADownloadBackend::event(QEvent *event)
+{
+    DM_PRIVATE(OMADownloadBackend);
+    DEventType type = (DEventType)event->type();
+    switch(type) {
+    case Started:
+        break;
+    case HeaderReceived:
+    {
+        // handling the events from media object downloads
+        // Check the mismatch in total size returned by server with the size given in the descriptor.
+        //This piece of code is commented as-of-now. when needed in future , will be uncommented
+        /*int totalSize = dl->getAttribute(DlTotalSize).toInt();
+        if (priv->m_downloadDesc->getAttribute(OMADownloadDescSize).toInt() != totalSize)
+        {
+            priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("905 Attribute Mismatch"));
+             
+            if (dl)
+            {
+                dl->setError("905 Attribute Mismatch");
+                dl->cancel();
+                dl->setDownloadState(DlFailed);
+                dl->postEvent(Error, NULL);
+            } 
+            return true;
+        }*/
+        // Check the mismatch in content type returned by server with the content type given in the descriptor.
+        QString contentType = priv->m_mediaDownload->getAttribute(DlContentType).toString();
+        if (priv->m_downloadDesc->getAttribute(OMADownloadDescType).toString() != contentType) {
+            // media object download cannot be proceeded
+            if (priv->m_mediaDownload) {
+                priv->m_mediaDownload->setError("905 Attribute Mismatch");
+                priv->m_mediaDownload->cancel();
+                priv->m_mediaDownload->setDownloadState(DlFailed);
+                priv->m_mediaDownload->postEvent(Error, NULL);
+            } 
+            break;
+        } 
+    }
+    case Progress:
+    {
+        QVariant tSize = priv->m_mediaDownload->getAttribute(DlTotalSize);
+        setTotalSize(tSize.toInt());
+        QVariant curDlsize = priv->m_mediaDownload->getAttribute(DlDownloadedSize);
+        setDownloadedDataSize(curDlsize.toInt());
+        setDownloadState(DlInprogress);
+        postEvent(Progress, NULL);
+        break;
+    }
+    case NetworkLoss:
+    {
+        postEvent(NetworkLoss, NULL);
+        break;
+    }
+    case Cancelled:
+    {
+        if (priv->m_isUserCancelled)
+            priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("902 User Cancelled"));
+        setDownloadState(DlCancelled);
+        postEvent(Cancelled, NULL);
+        break;
+    }
+    case Completed:
+    {
+        priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("900 Success "));
+        setDownloadState(DlCompleted);
+        postEvent(Completed, NULL); 
+        break;
+    }
+    case Error:
+    {
+        priv->m_downloadCore->post(priv->m_downloadDesc->getAttribute(OMADownloadDescInstallNotifyURI).toString(), QByteArray("905 Attribute Mismatch"));
+        priv->m_downloadCore->setLastError(QNetworkReply::UnknownContentError);
+        priv->m_downloadCore->setLastErrorString(tr("905 Attribute Mismatch"));
+        setDownloadState(DlFailed);
+        postEvent(Error, NULL);
+        break;
+    } 
+    default:
+        break;
+    }
+    return true;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/paralleldownloadmanager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,166 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadmanager.h"
+#include "download.h"
+#include "paralleldownloadmanager.h"
+#include "clientdownload.h"
+
+class ParallelDownloadManagerPrivate
+{
+    //declare public implementation
+    DM_DECLARE_PUBLIC(ParallelDownloadManager);
+public:
+    ParallelDownloadManagerPrivate();
+    ~ParallelDownloadManagerPrivate();
+   
+    QList<Download*> m_downloads; // list of downloads
+};
+
+ParallelDownloadManagerPrivate::ParallelDownloadManagerPrivate()
+{ }
+
+ParallelDownloadManagerPrivate::~ParallelDownloadManagerPrivate()
+{
+    int size = m_downloads.size();
+    for(int i=0; i<size; i++) {
+        DownloadState state = (DownloadState)((m_downloads[i]->getAttribute(DlDownloadState)).toInt());
+        if(state == DlInprogress) {
+            // pause the download if it is in progress
+            m_downloads[i]->pause();
+        } else if(state == DlFailed) {
+            // cancel the download if it has failed
+            m_downloads[i]->cancel();
+        }
+        delete (m_downloads[i]);
+    }
+    m_downloads.clear();
+}
+
+/*
+  constructor
+*/
+ParallelDownloadManager::ParallelDownloadManager()
+{
+    DM_INITIALIZE(ParallelDownloadManager);
+}
+
+/*
+  destructor
+*/
+ParallelDownloadManager::~ParallelDownloadManager()
+{
+    DM_UNINITIALIZE(ParallelDownloadManager);
+}
+
+/*
+  returns all the current downloads
+*/
+QList<Download*>& ParallelDownloadManager::currentDownloads()
+{
+    DM_PRIVATE(ParallelDownloadManager);
+    return priv->m_downloads;
+}
+
+/*
+  finds a download provided id if exists
+  \a id indicates identifier for download
+*/
+Download* ParallelDownloadManager::findDownload(int dlId)
+{
+    DM_PRIVATE(ParallelDownloadManager);
+    for (int i = 0; i < priv->m_downloads.size(); ++i) {
+        if (priv->m_downloads[i]->id() == dlId)
+            return priv->m_downloads[i];
+    }
+    return 0;
+}
+
+/*
+  cancels all the downloads
+*/
+void ParallelDownloadManager::removeAll()
+{
+    DM_PRIVATE(ParallelDownloadManager);
+    int count = priv->m_downloads.count();
+    //traverse the list and delete each download in the list
+    for(int i=0; i<count; i++) {
+        // cancel the download
+        priv->m_downloads[i]->cancel();
+        priv->m_downloads[i]->deleteLater();
+    }
+    priv->m_downloads.clear();
+}
+
+/*
+  cancels and removes the download
+  \a dl indicates the download to be canceled and removed
+*/
+void ParallelDownloadManager::removeOne(Download *dl)
+{
+    if(!dl)
+        return;
+    DM_PRIVATE(ParallelDownloadManager);
+    if (priv->m_downloads.contains(dl)) {
+        dl->cancel();
+        priv->m_downloads.removeOne(dl);
+        delete dl;
+        dl = 0;
+    }
+}
+
+/*
+  pauses all the downloads which are in progress
+*/
+void ParallelDownloadManager::pauseAll()
+{
+    DM_PRIVATE(ParallelDownloadManager);
+    int count = priv->m_downloads.size();
+    //traverse the list and pause downloads which are on-going
+    for(int i=0; i<count; i++) {
+        DownloadState state = (DownloadState)((priv->m_downloads[i]->getAttribute(DlDownloadState)).toInt());
+        if((state == DlInprogress) || (state == DlStarted))
+            priv->m_downloads[i]->pause();
+    }    
+}
+
+/*
+  resumes all the downloads which are paused
+*/
+void ParallelDownloadManager::resumeAll()
+{
+    DM_PRIVATE(ParallelDownloadManager);
+    int count = priv->m_downloads.size();
+    //traverse the list and resume downloads which are paused
+    for(int i=0; i<count; i++) {
+        DownloadState state = (DownloadState)((priv->m_downloads[i]->getAttribute(DlDownloadState)).toInt());
+        if((state == DlPaused) || (state == DlCancelled)) {
+            // note that in case of cancelled downloads, it will start from begining
+            priv->m_downloads[i]->resume();
+        }              
+    }
+}
+
+void ParallelDownloadManager::addToParallelDownload(Download* dl)
+{
+    DM_PRIVATE(ParallelDownloadManager);
+    // set the download type
+    ClientDownload* download;
+    download = dynamic_cast<ClientDownload*>(dl);
+    if(download)
+        download->attributes().insert(DlDownloadType, (int)Parallel);
+    priv->m_downloads.append(dl);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/progressivedownloadserver.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,239 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "progressivedownloadserver.h"
+#include "download.h"
+#include "dmcommon.h"
+#include "dmcommoninternal.h"
+#include <QTcpSocket>
+#include <QHostAddress>
+
+#define SERVER_WAIT_INTERVAL 1000
+
+// private implementation
+class ProgressiveDownloadServerPrivate
+{
+    DM_DECLARE_PUBLIC(ProgressiveDownloadServer);
+public:
+    ProgressiveDownloadServerPrivate();
+    ~ProgressiveDownloadServerPrivate();
+    QTcpServer* m_serverSocket;
+    QTcpSocket* m_clientConnection;
+    Download* m_download;
+    DownloadState m_previousDlState;
+};
+
+ProgressiveDownloadServerPrivate::ProgressiveDownloadServerPrivate()
+{
+    m_serverSocket = 0;
+    m_clientConnection = 0;
+    m_download = 0;
+    m_previousDlState = DlNone;
+}
+
+ProgressiveDownloadServerPrivate::~ProgressiveDownloadServerPrivate()
+{
+    if (m_serverSocket) {
+        delete m_serverSocket;
+        m_serverSocket = 0;
+    }
+}
+
+Q_DECL_EXPORT ProgressiveDownloadServer::ProgressiveDownloadServer(Download* download)
+{
+    DM_INITIALIZE(ProgressiveDownloadServer);
+    priv->m_download = download;
+
+    // create server socket
+    priv->m_serverSocket = new QTcpServer(this);
+    connect(priv->m_serverSocket, SIGNAL(newConnection()), this, SLOT(handleConnection()));
+}
+
+ProgressiveDownloadServer::~ProgressiveDownloadServer()
+{
+    stopServer();
+    DM_UNINITIALIZE(ProgressiveDownloadServer);
+}
+
+// starts the server
+Q_DECL_EXPORT int ProgressiveDownloadServer::startServer(void)
+{
+    DM_PRIVATE(ProgressiveDownloadServer);
+    if (!priv->m_serverSocket->isListening()) {
+        QHostAddress localHost(QHostAddress::LocalHost);
+        if (!priv->m_serverSocket->listen(localHost))
+            return -1;
+    }
+    return 0;
+}
+
+// stops the server
+Q_DECL_EXPORT int ProgressiveDownloadServer::stopServer(void)
+{
+    DM_PRIVATE(ProgressiveDownloadServer);
+    // unregister the event listener
+    priv->m_download->unregisterEventReceiver(this);
+
+    // send the server down signal
+    if ((priv->m_clientConnection) && (priv->m_clientConnection->state() == QAbstractSocket::ConnectedState)) {
+        QByteArray block;
+        QDataStream out(&block, QIODevice::WriteOnly);
+        out.setVersion(QDataStream::Qt_4_0);
+        out << (quint16)ProgressiveDlServerDown;
+        priv->m_clientConnection->write(block);
+        priv->m_clientConnection->flush();
+
+        // wait till the data is written
+        if (priv->m_clientConnection->waitForBytesWritten(SERVER_WAIT_INTERVAL))
+            return 0;
+        else
+            return -1;
+    }
+
+    if (priv->m_serverSocket->isListening())
+        priv->m_serverSocket->close();
+
+    return 0;
+}
+
+Q_DECL_EXPORT quint16 ProgressiveDownloadServer::serverPort(void)
+{
+    DM_PRIVATE(ProgressiveDownloadServer);
+    if (priv->m_serverSocket)
+        return priv->m_serverSocket->serverPort();
+    else
+        return 0;
+}
+
+// last error occurred
+Q_DECL_EXPORT ProgressiveDlServerError ProgressiveDownloadServer::lastError(void)
+{
+    DM_PRIVATE(ProgressiveDownloadServer);
+    return priv->m_serverSocket->serverError();
+}
+
+// last error occurred
+Q_DECL_EXPORT QString ProgressiveDownloadServer::lastErrorString(void)
+{
+    DM_PRIVATE(ProgressiveDownloadServer);
+    return priv->m_serverSocket->errorString();
+}
+
+void ProgressiveDownloadServer::handleConnection(void)
+{
+    DM_PRIVATE(ProgressiveDownloadServer);
+    priv->m_clientConnection = priv->m_serverSocket->nextPendingConnection();
+    connect(priv->m_clientConnection, SIGNAL(readyRead()),
+            this, SLOT(handleRequest()));
+    priv->m_download->registerEventReceiver(this);
+
+    // right now only one client is supported
+    priv->m_serverSocket->close();
+}
+
+void ProgressiveDownloadServer::handleRequest(void)
+{
+    // handles the request from client
+    DM_PRIVATE(ProgressiveDownloadServer);
+    quint16 requestCode;
+    QDataStream in(priv->m_clientConnection);
+    in.setVersion(QDataStream::Qt_4_0);
+
+    if (priv->m_clientConnection->bytesAvailable() < (int)sizeof(quint16))
+        return;
+
+    in >> requestCode;
+    // act according to the request
+    if ((ProgressiveOperation)requestCode == DlPause)
+        priv->m_download->pause();
+    else if ((ProgressiveOperation)requestCode == DlResume)
+        priv->m_download->resume();
+    else if ((ProgressiveOperation)requestCode == DlCancel)
+        priv->m_download->cancel();
+    else if ((ProgressiveOperation)requestCode == DlGetAttribute) {
+        // getAttribute is synchronous, so send the response here
+        quint16 attr;
+        in >> attr;
+        QVariant value;
+        value = priv->m_download->getAttribute((DownloadAttribute)attr);
+        QByteArray block;
+        QDataStream out(&block, QIODevice::WriteOnly);
+        out.setVersion(QDataStream::Qt_4_0);
+        out << (quint16)ProgressiveDlGetAttribute;
+        out << value;
+        priv->m_clientConnection->write(block);
+        priv->m_clientConnection->flush();
+    }
+}
+
+bool ProgressiveDownloadServer::event(QEvent *event)
+{
+    DM_PRIVATE(ProgressiveDownloadServer);
+    DEventType type = (DEventType)event->type();
+    QByteArray block;
+    QDataStream out(&block, QIODevice::WriteOnly);
+    out.setVersion(QDataStream::Qt_4_0);
+
+    // handle the events from the download and send the response to the client
+    switch(type) {
+    case Progress:
+        // send the response only once when it is resumed
+        // to avoid continueously writing to the response buffer and increasing the ipc overhead 
+        if (priv->m_previousDlState != DlInprogress) {
+            priv->m_previousDlState = DlInprogress;
+            out << (quint16)ProgressiveDlInprogress;
+            priv->m_clientConnection->write(block);
+            priv->m_clientConnection->flush();
+        }
+        break;
+    case Paused:
+        priv->m_previousDlState = DlPaused;
+        out << (quint16)ProgressiveDlPaused;
+        priv->m_clientConnection->write(block);
+        priv->m_clientConnection->flush();
+        break;
+    case Completed:
+        priv->m_previousDlState = DlCompleted;
+        out << (quint16)ProgressiveDlCompleted;
+        priv->m_clientConnection->write(block);
+        priv->m_clientConnection->flush();
+        break;
+    case Failed:
+        priv->m_previousDlState = DlFailed;
+        out << (quint16)ProgressiveDlFailed;
+        priv->m_clientConnection->write(block);
+        priv->m_clientConnection->flush();
+        break;
+    case Cancelled:
+        priv->m_previousDlState = DlCancelled;
+        out << (quint16)ProgressiveDlCancelled;
+        priv->m_clientConnection->write(block);
+        priv->m_clientConnection->flush();
+        break;
+    case NetworkLoss:
+        priv->m_previousDlState = DlPaused;
+        out << (quint16)ProgressiveDlPaused;
+        priv->m_clientConnection->write(block);
+        priv->m_clientConnection->flush();
+        break;
+    default:
+        break;
+    }
+    // event is consumed in any case.
+    return true;
+}
+       
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/sequentialdownloadmanager.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,366 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadmanager.h"
+#include "download.h"
+#include "sequentialdownloadmanager.h"
+#include "downloadevent.h"
+#include "clientdownload.h"
+
+class SequentialDownloadManagerPrivate
+{
+    //declare public implementation
+    DM_DECLARE_PUBLIC(SequentialDownloadManager);
+public:
+    SequentialDownloadManagerPrivate();
+    ~SequentialDownloadManagerPrivate();
+
+    QList<Download*> m_createdDownloads; // list of downloads which have been created by the client and owns them
+    QQueue<Download*> m_downloadsQueue; // queue of downloads scheduled for downloading and owns them
+    QList<Download*> m_completedDownloads; // list of downloads which have been completed and owns them
+    QList<Download*> m_failedDownloads; // list of failed downloads
+    QList<Download*> m_totalDownloads; // total of all the above downloads, but this doesnt own downloads
+};
+
+SequentialDownloadManagerPrivate::SequentialDownloadManagerPrivate()
+{ }
+
+SequentialDownloadManagerPrivate::~SequentialDownloadManagerPrivate()
+{
+    int createdSize = m_createdDownloads.size();
+    for (int i = 0; i < createdSize; i++)
+        delete m_createdDownloads[i];
+    m_createdDownloads.clear();
+
+    int completedSize = m_completedDownloads.size();
+    for (int i = 0; i < completedSize; i++)
+        delete m_completedDownloads[i];
+    m_completedDownloads.clear();
+
+    int size = m_downloadsQueue.size();
+    for (int i = 0; i < size; i++) {
+        DownloadState state = (DownloadState)((m_downloadsQueue[i]->getAttribute(DlDownloadState)).toInt());
+        if (state == DlInprogress) {
+            // pause the download if it is in progress
+            m_downloadsQueue[i]->pause();
+        } else if (state == DlFailed) {
+            // cancel the download if it has failed
+            m_downloadsQueue[i]->cancel();
+        }
+        delete (m_downloadsQueue[i]);
+    }
+    m_downloadsQueue.clear();
+}
+
+/*
+  constructor
+*/
+SequentialDownloadManager::SequentialDownloadManager()
+{
+    DM_INITIALIZE(SequentialDownloadManager);
+}
+
+/*
+  destructor
+*/
+SequentialDownloadManager::~SequentialDownloadManager()
+{
+    DM_UNINITIALIZE(SequentialDownloadManager);
+}
+
+/*
+  returns all the current downloads
+*/
+QList<Download*>& SequentialDownloadManager::currentDownloads()
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    priv->m_totalDownloads.clear();
+    for (int i = 0; i < priv->m_completedDownloads.size(); ++i)
+         priv->m_totalDownloads.append(priv->m_completedDownloads[i]);
+    for (int i = 0; i < priv->m_downloadsQueue.size(); ++i)
+        priv->m_totalDownloads.append(priv->m_downloadsQueue[i]);
+    for (int i = 0; i < priv->m_createdDownloads.size(); ++i)
+        priv->m_totalDownloads.append(priv->m_createdDownloads[i]);
+    for (int i = 0; i < priv->m_failedDownloads.size(); ++i)
+        priv->m_totalDownloads.append(priv->m_failedDownloads[i]);
+    return priv->m_totalDownloads;
+}
+
+/*
+  finds a download provided id if exists
+  \a id indicates identifier for download
+*/
+Download* SequentialDownloadManager::findDownload(int dlId)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    for (int i = 0; i < priv->m_completedDownloads.size(); ++i) {
+        if (priv->m_completedDownloads[i]->id() == dlId)
+            return priv->m_completedDownloads[i];
+    }
+    for (int i = 0; i < priv->m_downloadsQueue.size(); ++i) {
+        if (priv->m_downloadsQueue[i]->id() == dlId)
+            return priv->m_downloadsQueue[i];
+    }
+    for (int i = 0; i < priv->m_createdDownloads.size(); ++i) {
+        if (priv->m_createdDownloads[i]->id() == dlId)
+            return priv->m_createdDownloads[i];
+    }
+    return 0;
+}
+
+/*
+  cancels all the downloads
+*/
+void SequentialDownloadManager::removeAll()
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    //traverse the list and delete each download in the list
+    for(int i = 0; i < priv->m_downloadsQueue.count(); ) {
+        // cancel the download
+        priv->m_downloadsQueue[0]->cancel();
+        delete (priv->m_downloadsQueue[0]);
+        priv->m_downloadsQueue.removeAt(0);
+    }
+    priv->m_downloadsQueue.clear();
+
+    int createdDownloadsCount = priv->m_createdDownloads.count();
+    //traverse the list and delete each download in the list
+    for(int i = 0; i < createdDownloadsCount; i++)
+        delete (priv->m_createdDownloads[i]);
+    priv->m_createdDownloads.clear();
+
+    int completedDownloadsCount = priv->m_completedDownloads.count();
+    //traverse the list and delete each download in the list
+    for(int i = 0; i < completedDownloadsCount; i++)
+        delete (priv->m_completedDownloads[i]);
+    priv->m_completedDownloads.clear();
+
+    int failedDownloadsCount = priv->m_failedDownloads.count();
+    //traverse the list and delete each download in the list
+    for(int i = 0; i < failedDownloadsCount; i++)
+        delete (priv->m_failedDownloads[i]);
+    priv->m_failedDownloads.clear();
+}
+
+/*
+  cancels and removes the download
+  \a dl indicates the download to be canceled and removed
+*/
+void SequentialDownloadManager::removeOne(Download *dl)
+{
+    if(!dl)
+        return;
+    DM_PRIVATE(SequentialDownloadManager);
+    if (currentDownloads().contains(dl)) {
+        dl->cancel();
+        // download might be there in any of the following list
+        priv->m_downloadsQueue.removeOne(dl);
+        priv->m_createdDownloads.removeOne(dl);
+        priv->m_completedDownloads.removeOne(dl);
+        delete dl;
+        dl = 0;
+    }
+}
+
+/*
+  pauses all the downloads which are in progress
+*/
+void SequentialDownloadManager::pauseAll()
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    if (!priv->m_downloadsQueue.isEmpty()) {
+        QQueue<Download*>::iterator i;
+        i = priv->m_downloadsQueue.begin();
+        DownloadState state = (DownloadState)(((*i)->getAttribute(DlDownloadState)).toInt());
+        if ((state == DlInprogress || state == DlStarted))
+            dynamic_cast<ClientDownload*>(*i)->pauseDownload();
+    }
+}
+
+/*
+  resumes all the downloads which are paused
+*/
+void SequentialDownloadManager::resumeAll()
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    if (!priv->m_downloadsQueue.isEmpty()) {
+        QQueue<Download*>::iterator i;
+        i = priv->m_downloadsQueue.begin();
+        DownloadState state = (DownloadState)(((*i)->getAttribute(DlDownloadState)).toInt());
+        if (state == DlPaused)
+            dynamic_cast<ClientDownload*>(*i)->resumeDownload();
+    }
+}
+
+void SequentialDownloadManager::addToSequentialDownload(Download* dl)
+{
+    // Here the downloads are added first to a download list. When the downloads are in this list,
+    // the client can set some attributes on the download.
+    // Later the client has to explicitly call start() on the download after which,
+    // download gets added to the downloadsQueue and the download starts.
+
+    DM_PRIVATE(SequentialDownloadManager);
+
+    // set the download type
+    ClientDownload* download = dynamic_cast<ClientDownload*>(dl);
+    if(download)
+        download->attributes().insert(DlDownloadType, (int)Sequential);
+
+    // if the download is already in queue but the prority has been changed
+    if( findDownload(dl->id()))
+        priv->m_createdDownloads.removeOne(dl);
+
+    DownloadPriority priority = (DownloadPriority)(dl->getAttribute(DlPriority)).toInt();
+    if (priority == High) {
+        QList<Download*>::iterator i;
+        for (i = priv->m_createdDownloads.begin(); i != priv->m_createdDownloads.end(); i++) {
+            if ((*i)->getAttribute(DlPriority).toInt() == Low) {
+                priv->m_createdDownloads.insert(i, dl);
+                return;
+            }
+        }
+        priv->m_createdDownloads.insert(i, dl); // if no low priority download is found then just insert the high priority download
+    }
+    else
+        priv->m_createdDownloads.append(dl);
+}
+
+void SequentialDownloadManager::addToDownloadQueue(Download* dl)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    priv->m_downloadsQueue.append(dl);
+}
+
+void SequentialDownloadManager::addToCompletedList(Download* dl)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    priv->m_completedDownloads.append(dl);
+}
+
+void SequentialDownloadManager::process(int dlId)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    // Start() has been called on a download present in the createdDownloads list. Move that download from the list to the queue
+    ClientDownload* dl = dynamic_cast<ClientDownload*>(findDownload(dlId));
+    dl->registerEventReceiver(this);
+    priv->m_createdDownloads.removeOne(dl); // Once start() is called on download, add it to downloadQueue & remove it from createdDownloads list
+    if (priv->m_downloadsQueue.isEmpty()) {
+        addToDownloadQueue(dl);
+        dl->startDownload();
+        return;
+    }
+    DownloadPriority priority = (DownloadPriority)((dl->getAttribute(DlPriority)).toInt());
+    // checking for priority
+    if (priority == High) {
+        // Add the download before the first low priority item
+        QQueue<Download*>::iterator i;
+        for (i = priv->m_downloadsQueue.begin(); i != priv->m_downloadsQueue.end(); i++) {
+            if ((*i)->getAttribute(DlPriority).toInt() == Low) {
+                if (i == priv->m_downloadsQueue.begin()) {
+                    dynamic_cast<ClientDownload*>(*i)->pauseDownload();
+                    priv->m_downloadsQueue.insert(i, dl); // low priority dl is in progress so pause it, insert the high priority dl and start it.
+                    dl->startDownload();
+                }
+                else {
+                    // low priority download is present in the queue but it's not the first one as it is not yet started,
+                    // so there's already a high priority dl in progress. So this high priority dl should just be inserted into the queue.
+                    priv->m_downloadsQueue.insert(i, dl);
+                }
+                return;
+            }
+        }
+        priv->m_downloadsQueue.insert(i, dl); // insert the high priority download if there are no low priority downloads in the queue
+    }
+    else
+        addToDownloadQueue(dl); // If priority is low then just append to the queue.
+}
+
+bool SequentialDownloadManager::event(QEvent *event)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    DEventType type = (DEventType)event->type();
+    switch(type) {
+    case Completed:
+    {
+        int dlId = ((DownloadEvent*)event)->getId();
+        ClientDownload *dl = dynamic_cast<ClientDownload*>(findDownload(dlId));
+        addToCompletedList(dl);
+        // After adding the download to completed list, remove it from downloadQueue
+        priv->m_downloadsQueue.removeOne(dl);
+        startNext();
+        break;
+    }
+    case Error:
+    {
+        int dlId = ((DownloadEvent*)event)->getId();
+        ClientDownload *dl = dynamic_cast<ClientDownload*>(findDownload(dlId));
+        priv->m_failedDownloads.append(dl);
+        priv->m_downloadsQueue.removeOne(dl);
+        startNext();
+        break;
+    }
+    default:
+        break;
+    }
+    return true;
+}
+
+void SequentialDownloadManager::startNext()
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    QQueue<Download*>::iterator i;
+    if (!priv->m_downloadsQueue.isEmpty()) {
+        i = priv->m_downloadsQueue.begin();
+        DownloadState state = (DownloadState)(((*i)->getAttribute(DlDownloadState)).toInt());
+        if (state == DlPaused)
+            (*i)->resume();
+        else
+            dynamic_cast<ClientDownload*>(*i)->startDownload();
+    }
+}
+
+void SequentialDownloadManager::pauseDownload(int dlId)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    QQueue<Download*>::iterator i;
+    if (!priv->m_downloadsQueue.isEmpty()) {
+        i = priv->m_downloadsQueue.begin();
+        if (dlId == (*i)->id())
+            dynamic_cast<ClientDownload*>(*i)->pauseDownload();
+    }
+}
+
+void SequentialDownloadManager::resumeDownload(int dlId)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    QQueue<Download*>::iterator i;
+    if (!priv->m_downloadsQueue.isEmpty()) {
+        i = priv->m_downloadsQueue.begin();
+        if (dlId == (*i)->id())
+            dynamic_cast<ClientDownload*>(*i)->resumeDownload();
+    }
+}
+
+void SequentialDownloadManager::cancelDownload(int dlId)
+{
+    DM_PRIVATE(SequentialDownloadManager);
+    QQueue<Download*>::iterator i;
+    if (!priv->m_downloadsQueue.isEmpty()) {
+        i = priv->m_downloadsQueue.begin();
+        if (dlId == (*i)->id())
+            dynamic_cast<ClientDownload*>(*i)->cancelDownload();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/storageutility.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,86 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "storageutility.h"
+#include <QFile>
+#include <QDir>
+#include <qregexp.h>
+
+
+int StorageUtility::generateUniqueFileName(const QString &fileName, const QString &tempPath,
+        const QString& permPath, QString &outFileName)
+{
+    int uniqueExt = 0;
+    QString orgFilename = fileName;    
+    QFileInfo fileinfo(tempPath, fileName);
+    QFileInfo fileinfoPerm(permPath, fileName);
+
+    while(true)
+    {
+        uniqueExt++;
+        // check if file exists
+        if (fileinfo.exists() || fileinfoPerm.exists()) {
+            // a file with this name already exists in either temporary
+            // or permanent download location
+            QString tempFileName = orgFilename;
+            QString ext = fileinfo.suffix();
+            QString fileNoExt = tempFileName;
+            if (!ext.isEmpty())
+                fileNoExt = tempFileName.mid(0, tempFileName.length()-ext.length()-1);
+
+            // add index to filename
+            QString strExt;
+            strExt.setNum(uniqueExt);
+            tempFileName =  fileNoExt+"("+strExt+")";
+            if (!ext.isEmpty())
+                tempFileName = tempFileName+"."+ext;
+
+            // set fileinfo to check again if any file with 
+            // this new filename already exists
+            fileinfo.setFile(tempPath, tempFileName);
+            fileinfoPerm.setFile(permPath, tempFileName);
+        }
+        else {
+            // this is a unique filename
+            outFileName = fileinfo.fileName();
+            return 0;
+        }
+    }   
+    return -1;
+}
+
+void StorageUtility::validateFileName(const QString &fileName, QString &outFileName)
+{
+    QString orgFileName = fileName;
+    // Remove invalid filename characters
+    orgFileName.replace( QRegExp("[?:*\"\\/<>|]"), "" );
+
+    // Check if filename is empty
+    outFileName = orgFileName.trimmed();
+    if (outFileName.isEmpty())
+        outFileName = FILENAME_UNKNOWN;
+}
+
+QString StorageUtility::createTemporaryPath(const QString& clientName)
+{
+    /* create "downloads" folder : ./<clientname>/downloads */ 
+    QString orgClientName = clientName;
+    orgClientName.replace( QRegExp("[\\\\/:\\*\\?\"<>\\|]+"), "_" );
+    QDir currentDir(QDir::current());
+    QString tempPath = currentDir.absolutePath() + "/" + orgClientName + "/" + QObject::tr(TEMPORARY_FOLDER);
+    currentDir.mkpath(tempPath);
+    return tempPath;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/src/wmdrmdownloadbackend.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,288 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as 
+   published by the Free Software Foundation, version 2.1 of the License. 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+   (Lesser) General Public License for more details. You should have 
+   received a copy of the GNU (Lesser) General Public License along 
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "downloadmanager.h"
+#include "clientdownload.h"
+#include "downloadcore.h"
+#include "downloadevent.h"
+#include "wmdrmdownloadbackend.h"
+#include <cameseutility.h>
+#include <utf.h>
+#include <QFileInfo>
+#include <QUrl>
+
+WMDRMDownloadBackend::WMDRMDownloadBackend(DownloadCore *dlCore, ClientDownload *dl)
+    :DownloadBackend(dlCore, dl), CActive( EPriorityStandard )
+{    
+    m_downloadCore = dlCore;
+    m_download = dl;
+    m_contentDownload = NULL;
+    m_utility = NULL;
+    m_contentUrl = NULL;
+     
+    CActiveScheduler::Add( this );
+} 
+
+WMDRMDownloadBackend::~WMDRMDownloadBackend()
+{
+    if (m_utility) {
+        delete m_utility;
+        m_utility = NULL;
+    }
+    if (m_contentUrl) {
+        delete m_contentUrl;
+        m_contentUrl = NULL;
+    }
+    if (m_contentDownload) {
+        m_contentDownload->unregisterEventReceiver(this);
+        delete m_contentDownload;
+        m_contentDownload = NULL;
+    }  
+}
+
+int WMDRMDownloadBackend::pause()
+{
+    if (m_contentDownload) {
+        m_contentDownload->pause();
+        setDownloadState(DlPaused);
+    }
+    return 0;
+}
+
+int WMDRMDownloadBackend::resume()
+{
+    if (m_contentDownload)
+        return (m_contentDownload->resume());
+    return 0;
+}
+
+int WMDRMDownloadBackend::cancel()
+{
+    if (m_contentDownload) 
+        return (m_contentDownload->cancel());
+    
+    return 0;
+}
+
+QVariant WMDRMDownloadBackend::getAttribute(DownloadAttribute attr)
+{
+    switch(attr) {
+    case DlFileName:
+    {
+        if(m_contentDownload)
+            return m_contentDownload->getAttribute(DlFileName);
+    }
+    case DlContentType:
+    {
+        if(m_contentDownload) {
+            return m_contentDownload->getAttribute(DlContentType);
+        }
+    }
+    default:
+        return DownloadBackend::getAttribute(attr);
+    }    
+    return QVariant();
+}
+
+int WMDRMDownloadBackend::setAttribute(DownloadAttribute attr, const QVariant& value)
+{
+    return DownloadBackend::setAttribute(attr, value);
+}
+
+// stores the data in storage
+void WMDRMDownloadBackend::store(QByteArray /*data*/, bool /*lastChunk=false*/)
+{
+    return;
+}
+
+// deletes the storage
+void WMDRMDownloadBackend::deleteStore()
+{
+    return;
+}
+
+// returns the size of stored data
+qint64 WMDRMDownloadBackend::storedDataSize()
+{
+    return 0;
+}
+
+void WMDRMDownloadBackend::bytesRecieved(qint64 /*bytesRecieved*/, qint64 /*bytesTotal*/)
+{
+     //Do nothing. This is here to avoid this signal to reach to base class' slot.
+     return;
+}
+
+void WMDRMDownloadBackend::handleFinished()
+{
+    QByteArray data = m_downloadCore->reply()->readAll();
+    TPtrC8 drmHeader((TUint8 *)(data.constData()));
+    // delete the persistant information if saved any
+    deleteInfo(); 
+    
+    TRAPD(err, m_utility = CCameseUtility::NewL());
+    if (err != KErrNone) {
+        markDownloadFailed(tr("General Error"));
+        return;
+    }
+    // Use the Camese Interface, passing in
+    // the DRM header url. Camese uses it for
+    // error reporting.
+    ASSERT( !m_contentUrl );
+    QByteArray url = m_downloadCore->reply()->url().toEncoded();
+    TPtrC8 s60Url((TUint8 *)(url.constData()));
+
+    m_contentUrl = s60Url.Alloc();
+    if (!m_contentUrl) {
+        markDownloadFailed(tr("General Error"));
+        return;
+    }
+    // post the event
+    postEvent(WMDRMLicenseAcquiring, NULL);
+    m_requestResult = KErrNone;
+    m_utility->AcquireLicense( drmHeader, m_contentUrl, iStatus );
+    SetActive();
+    // Wait for completion of the license aquisition    
+    m_wait.Start();     
+    
+    // Check request results
+    if ( !m_requestResult ) {
+        if (!m_contentUrl || (m_contentUrl->Length() == 0)) {
+            markDownloadFailed(tr("File is corrupt"));
+            return;
+        } 
+    }
+    else if (m_requestResult == KErrCancel) {
+        // Check if the content URL was correctly set.                
+        markDownloadFailed(tr("Cancelled"));
+        return;
+    }
+    else {
+        // Check if the content URL was correctly set.                
+        markDownloadFailed(tr("General Error"));
+        return;
+    }
+    
+    if ( m_contentUrl && m_contentUrl->CompareF( s60Url ) ) {   
+        HBufC* s60str;  
+        TRAPD(error, s60str = CnvUtfConverter::ConvertToUnicodeFromUtf8L(m_contentUrl->Des()));
+        if (error != KErrNone) {
+            markDownloadFailed(tr("General Error"));
+            return;      
+        }
+        QString contentUrl = QString::fromUtf16(s60str->Ptr(),s60str->Length());
+        delete s60str;
+ 
+        QUrl qtUrl(contentUrl);
+        if (qtUrl.isValid()) {
+            deleteInfo(); 
+            m_contentDownload = new ClientDownload(m_download->downloadManager(), contentUrl, m_download->id()); 
+            if (!m_contentDownload) {                
+                markDownloadFailed(tr("General Error"));
+                return;               
+            }
+            // set the file name
+            m_download->attributes().insert(DlFileName, m_contentDownload->getAttribute(DlFileName));
+            m_contentDownload->registerEventReceiver(this);
+            m_contentDownload->start();            
+        } else {
+            markDownloadFailed(tr("Malformed Url"));
+            return; 
+        }
+    } else {
+        markDownloadFailed(tr("No valid redirection Url"));
+        return;  
+    }
+    
+    // reset
+    delete m_contentUrl;
+    m_contentUrl = NULL;
+    
+    return;     
+}          
+
+bool WMDRMDownloadBackend::event(QEvent *event)
+{
+    DEventType type = (DEventType)event->type();
+    switch(type) {
+    case Started:
+    case HeaderReceived:
+        break;
+    case Progress:
+    {
+        QVariant tSize = m_contentDownload->getAttribute(DlTotalSize);
+        setTotalSize(tSize.toInt());
+        QVariant curDlsize = m_contentDownload->getAttribute(DlDownloadedSize);
+        setDownloadedDataSize(curDlsize.toInt());
+        setDownloadState(DlInprogress);
+        postEvent(Progress, NULL);
+        break;
+    }
+    case NetworkLoss:
+    {
+        postEvent(NetworkLoss, NULL);
+        break;
+    }
+    case Cancelled:
+    { 
+        setDownloadState(DlCancelled);
+        postEvent(Cancelled, NULL);
+        break;
+    }
+    case Completed:
+    {
+        setDownloadState(DlCompleted);
+        postEvent(Completed, NULL); 
+        break;
+    }
+    case Error:
+    {
+        setDownloadState(DlFailed);
+        postEvent(Error, NULL);
+        break;
+    } 
+    default:
+        break;
+    }
+    return true;
+}
+
+void WMDRMDownloadBackend::markDownloadFailed(const QString& error)
+{
+    m_download->setError(error);
+    setDownloadState(DlFailed);
+    postEvent(Error, NULL);
+    return;
+}
+
+void WMDRMDownloadBackend::RunL()
+{
+    TInt result( iStatus.Int() );   
+    // Handle request completion
+    m_requestResult = result;
+    // Stop Wait loop                            
+    m_wait.AsyncStop();            
+}
+
+void WMDRMDownloadBackend::DoCancel()
+{   
+    m_utility->Cancel();    
+    // Cleanup
+    m_requestResult = KErrCancel;
+    // Stop Wait loop           
+    m_wait.AsyncStop();
+}
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/bwins/brserviceipcclientu.def	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,58 @@
+EXPORTS
+	?tr@ServiceFwIPC@WRT@@SA?AVQString@@PBD0@Z @ 1 NONAME ; class QString WRT::ServiceFwIPC::tr(char const *, char const *)
+	?startServer@ServiceIPCClient@WRT@@QAE_NABVQString@@0@Z @ 2 NONAME ; bool WRT::ServiceIPCClient::startServer(class QString const &, class QString const &)
+	?setSessionId@ServiceFwIPC@WRT@@QAE_NH@Z @ 3 NONAME ; bool WRT::ServiceFwIPC::setSessionId(int)
+	?connect@ServiceIPCClient@WRT@@QAE_NABVQString@@@Z @ 4 NONAME ; bool WRT::ServiceIPCClient::connect(class QString const &)
+	?getStaticMetaObject@ServiceFwIPC@WRT@@SAABUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const & WRT::ServiceFwIPC::getStaticMetaObject(void)
+	?error@ServiceIPCClient@WRT@@IAEXH@Z @ 6 NONAME ; void WRT::ServiceIPCClient::error(int)
+	?error@ServiceFwIPC@WRT@@IAEXH@Z @ 7 NONAME ; void WRT::ServiceFwIPC::error(int)
+	?waitForRead@ServiceFwIPC@WRT@@AAE_NXZ @ 8 NONAME ; bool WRT::ServiceFwIPC::waitForRead(void)
+	?staticMetaObject@ServiceIPCClient@WRT@@2UQMetaObject@@B @ 9 NONAME ; struct QMetaObject const WRT::ServiceIPCClient::staticMetaObject
+	?qt_metacall@ServiceIPCClient@WRT@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int WRT::ServiceIPCClient::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?isIPCTypeSupported@ServiceFwIPCFactory@WRT@@SA_NW4TServiceIPCBackends@2@@Z @ 11 NONAME ; bool WRT::ServiceFwIPCFactory::isIPCTypeSupported(enum WRT::TServiceIPCBackends)
+	?tr@ServiceIPCClient@WRT@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString WRT::ServiceIPCClient::tr(char const *, char const *)
+	?qt_metacast@ServiceIPCClient@WRT@@UAEPAXPBD@Z @ 13 NONAME ; void * WRT::ServiceIPCClient::qt_metacast(char const *)
+	??0ServiceFwIPCFactory@WRT@@QAE@XZ @ 14 NONAME ; WRT::ServiceFwIPCFactory::ServiceFwIPCFactory(void)
+	?SendReceive@RServiceIPCSession@WRT@@QBEXHAAVTRequestStatus@@@Z @ 15 NONAME ; void WRT::RServiceIPCSession::SendReceive(int, class TRequestStatus &) const
+	?sessionId@ServiceIPCClient@WRT@@QAEHXZ @ 16 NONAME ; int WRT::ServiceIPCClient::sessionId(void)
+	?handleMessage@ServiceIPCClient@WRT@@IAEXVQByteArray@@@Z @ 17 NONAME ; void WRT::ServiceIPCClient::handleMessage(class QByteArray)
+	?metaObject@ServiceFwIPC@WRT@@UBEPBUQMetaObject@@XZ @ 18 NONAME ; struct QMetaObject const * WRT::ServiceFwIPC::metaObject(void) const
+	?sendAsync@ServiceFwIPC@WRT@@QAEXABVQString@@ABVQByteArray@@@Z @ 19 NONAME ; void WRT::ServiceFwIPC::sendAsync(class QString const &, class QByteArray const &)
+	?trUtf8@ServiceFwIPC@WRT@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString WRT::ServiceFwIPC::trUtf8(char const *, char const *, int)
+	?trUtf8@ServiceFwIPC@WRT@@SA?AVQString@@PBD0@Z @ 21 NONAME ; class QString WRT::ServiceFwIPC::trUtf8(char const *, char const *)
+	?metaObject@ServiceIPCClient@WRT@@UBEPBUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const * WRT::ServiceIPCClient::metaObject(void) const
+	??0ServiceIPCClient@WRT@@QAE@PAVQObject@@W4TServiceIPCBackends@1@@Z @ 23 NONAME ; WRT::ServiceIPCClient::ServiceIPCClient(class QObject *, enum WRT::TServiceIPCBackends)
+	??_EServiceFwIPC@WRT@@UAE@I@Z @ 24 NONAME ; WRT::ServiceFwIPC::~ServiceFwIPC(unsigned int)
+	?getStaticMetaObject@ServiceIPCClient@WRT@@SAABUQMetaObject@@XZ @ 25 NONAME ; struct QMetaObject const & WRT::ServiceIPCClient::getStaticMetaObject(void)
+	??1ServiceIPCClient@WRT@@UAE@XZ @ 26 NONAME ; WRT::ServiceIPCClient::~ServiceIPCClient(void)
+	?readAsync@ServiceIPCClient@WRT@@IAEXVQByteArray@@@Z @ 27 NONAME ; void WRT::ServiceIPCClient::readAsync(class QByteArray)
+	?trUtf8@ServiceIPCClient@WRT@@SA?AVQString@@PBD0@Z @ 28 NONAME ; class QString WRT::ServiceIPCClient::trUtf8(char const *, char const *)
+	??1ServiceFwIPCFactory@WRT@@UAE@XZ @ 29 NONAME ; WRT::ServiceFwIPCFactory::~ServiceFwIPCFactory(void)
+	?disconnect@ServiceIPCClient@WRT@@QAEXXZ @ 30 NONAME ; void WRT::ServiceIPCClient::disconnect(void)
+	?trUtf8@ServiceIPCClient@WRT@@SA?AVQString@@PBD0H@Z @ 31 NONAME ; class QString WRT::ServiceIPCClient::trUtf8(char const *, char const *, int)
+	?qt_metacast@ServiceFwIPC@WRT@@UAEPAXPBD@Z @ 32 NONAME ; void * WRT::ServiceFwIPC::qt_metacast(char const *)
+	??_EServiceFwIPCFactory@WRT@@UAE@I@Z @ 33 NONAME ; WRT::ServiceFwIPCFactory::~ServiceFwIPCFactory(unsigned int)
+	??0ServiceFwIPC@WRT@@QAE@PAVQObject@@W4TServiceIPCBackends@1@@Z @ 34 NONAME ; WRT::ServiceFwIPC::ServiceFwIPC(class QObject *, enum WRT::TServiceIPCBackends)
+	?sendSync@ServiceFwIPC@WRT@@QAE_NABVQString@@ABVQByteArray@@@Z @ 35 NONAME ; bool WRT::ServiceFwIPC::sendSync(class QString const &, class QByteArray const &)
+	?readAll@ServiceIPCClient@WRT@@QAE?AVQByteArray@@XZ @ 36 NONAME ; class QByteArray WRT::ServiceIPCClient::readAll(void)
+	??1ServiceFwIPC@WRT@@UAE@XZ @ 37 NONAME ; WRT::ServiceFwIPC::~ServiceFwIPC(void)
+	?getSessionId@ServiceFwIPC@WRT@@QAE_NAAH@Z @ 38 NONAME ; bool WRT::ServiceFwIPC::getSessionId(int &)
+	?tr@ServiceFwIPC@WRT@@SA?AVQString@@PBD0H@Z @ 39 NONAME ; class QString WRT::ServiceFwIPC::tr(char const *, char const *, int)
+	?sendSync@ServiceIPCClient@WRT@@QAE_NABVQString@@ABVQByteArray@@@Z @ 40 NONAME ; bool WRT::ServiceIPCClient::sendSync(class QString const &, class QByteArray const &)
+	?readyRead@ServiceIPCClient@WRT@@IAEXXZ @ 41 NONAME ; void WRT::ServiceIPCClient::readyRead(void)
+	?qt_metacall@ServiceFwIPC@WRT@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 42 NONAME ; int WRT::ServiceFwIPC::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?tr@ServiceIPCClient@WRT@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString WRT::ServiceIPCClient::tr(char const *, char const *, int)
+	?subscribeBroadcastMsg@ServiceIPCClient@WRT@@AAEXXZ @ 44 NONAME ; void WRT::ServiceIPCClient::subscribeBroadcastMsg(void)
+	?createBackend@ServiceFwIPCFactory@WRT@@SAPAVServiceFwIPCPrivate@2@W4TServiceIPCBackends@2@@Z @ 45 NONAME ; class WRT::ServiceFwIPCPrivate * WRT::ServiceFwIPCFactory::createBackend(enum WRT::TServiceIPCBackends)
+	?handleAsyncMsg@ServiceIPCClient@WRT@@AAEXXZ @ 46 NONAME ; void WRT::ServiceIPCClient::handleAsyncMsg(void)
+	?handleBroadcastMsg@ServiceIPCClient@WRT@@AAEXXZ @ 47 NONAME ; void WRT::ServiceIPCClient::handleBroadcastMsg(void)
+	?staticMetaObject@ServiceFwIPC@WRT@@2UQMetaObject@@B @ 48 NONAME ; struct QMetaObject const WRT::ServiceFwIPC::staticMetaObject
+	?readyRead@ServiceFwIPC@WRT@@IAEXXZ @ 49 NONAME ; void WRT::ServiceFwIPC::readyRead(void)
+	?requestPending@ServiceFwIPC@WRT@@QAE_NXZ @ 50 NONAME ; bool WRT::ServiceFwIPC::requestPending(void)
+	?startServer@ServiceFwIPC@WRT@@QAE_NABVQString@@0@Z @ 51 NONAME ; bool WRT::ServiceFwIPC::startServer(class QString const &, class QString const &)
+	?readAll@ServiceFwIPC@WRT@@QAE?AVQByteArray@@XZ @ 52 NONAME ; class QByteArray WRT::ServiceFwIPC::readAll(void)
+	?disconnect@ServiceFwIPC@WRT@@QAEXXZ @ 53 NONAME ; void WRT::ServiceFwIPC::disconnect(void)
+	?sendAsync@ServiceIPCClient@WRT@@QAEXABVQString@@ABVQByteArray@@@Z @ 54 NONAME ; void WRT::ServiceIPCClient::sendAsync(class QString const &, class QByteArray const &)
+	?connect@ServiceFwIPC@WRT@@QAE_NABVQString@@@Z @ 55 NONAME ; bool WRT::ServiceFwIPC::connect(class QString const &)
+	??_EServiceIPCClient@WRT@@UAE@I@Z @ 56 NONAME ; WRT::ServiceIPCClient::~ServiceIPCClient(unsigned int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/eabi/brserviceipcclientu.def	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,61 @@
+EXPORTS
+	_ZN3WRT12ServiceFwIPC10disconnectEv @ 1 NONAME
+	_ZN3WRT12ServiceFwIPC11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+	_ZN3WRT12ServiceFwIPC11qt_metacastEPKc @ 3 NONAME
+	_ZN3WRT12ServiceFwIPC11startServerERK7QStringS3_ @ 4 NONAME
+	_ZN3WRT12ServiceFwIPC11waitForReadEv @ 5 NONAME
+	_ZN3WRT12ServiceFwIPC12getSessionIdERi @ 6 NONAME
+	_ZN3WRT12ServiceFwIPC12setSessionIdEi @ 7 NONAME
+	_ZN3WRT12ServiceFwIPC14requestPendingEv @ 8 NONAME
+	_ZN3WRT12ServiceFwIPC16staticMetaObjectE @ 9 NONAME DATA 16
+	_ZN3WRT12ServiceFwIPC19getStaticMetaObjectEv @ 10 NONAME
+	_ZN3WRT12ServiceFwIPC5errorEi @ 11 NONAME
+	_ZN3WRT12ServiceFwIPC7connectERK7QString @ 12 NONAME
+	_ZN3WRT12ServiceFwIPC7readAllEv @ 13 NONAME
+	_ZN3WRT12ServiceFwIPC8sendSyncERK7QStringRK10QByteArray @ 14 NONAME
+	_ZN3WRT12ServiceFwIPC9readyReadEv @ 15 NONAME
+	_ZN3WRT12ServiceFwIPC9sendAsyncERK7QStringRK10QByteArray @ 16 NONAME
+	_ZN3WRT12ServiceFwIPCC1EP7QObjectNS_19TServiceIPCBackendsE @ 17 NONAME
+	_ZN3WRT12ServiceFwIPCC2EP7QObjectNS_19TServiceIPCBackendsE @ 18 NONAME
+	_ZN3WRT12ServiceFwIPCD0Ev @ 19 NONAME
+	_ZN3WRT12ServiceFwIPCD1Ev @ 20 NONAME
+	_ZN3WRT12ServiceFwIPCD2Ev @ 21 NONAME
+	_ZN3WRT16ServiceIPCClient10disconnectEv @ 22 NONAME
+	_ZN3WRT16ServiceIPCClient11qt_metacallEN11QMetaObject4CallEiPPv @ 23 NONAME
+	_ZN3WRT16ServiceIPCClient11qt_metacastEPKc @ 24 NONAME
+	_ZN3WRT16ServiceIPCClient11startServerERK7QStringS3_ @ 25 NONAME
+	_ZN3WRT16ServiceIPCClient13handleMessageE10QByteArray @ 26 NONAME
+	_ZN3WRT16ServiceIPCClient14handleAsyncMsgEv @ 27 NONAME
+	_ZN3WRT16ServiceIPCClient16staticMetaObjectE @ 28 NONAME DATA 16
+	_ZN3WRT16ServiceIPCClient18handleBroadcastMsgEv @ 29 NONAME
+	_ZN3WRT16ServiceIPCClient19getStaticMetaObjectEv @ 30 NONAME
+	_ZN3WRT16ServiceIPCClient21subscribeBroadcastMsgEv @ 31 NONAME
+	_ZN3WRT16ServiceIPCClient5errorEi @ 32 NONAME
+	_ZN3WRT16ServiceIPCClient7connectERK7QString @ 33 NONAME
+	_ZN3WRT16ServiceIPCClient7readAllEv @ 34 NONAME
+	_ZN3WRT16ServiceIPCClient8sendSyncERK7QStringRK10QByteArray @ 35 NONAME
+	_ZN3WRT16ServiceIPCClient9readAsyncE10QByteArray @ 36 NONAME
+	_ZN3WRT16ServiceIPCClient9readyReadEv @ 37 NONAME
+	_ZN3WRT16ServiceIPCClient9sendAsyncERK7QStringRK10QByteArray @ 38 NONAME
+	_ZN3WRT16ServiceIPCClientC1EP7QObjectNS_19TServiceIPCBackendsE @ 39 NONAME
+	_ZN3WRT16ServiceIPCClientC2EP7QObjectNS_19TServiceIPCBackendsE @ 40 NONAME
+	_ZN3WRT16ServiceIPCClientD0Ev @ 41 NONAME
+	_ZN3WRT16ServiceIPCClientD1Ev @ 42 NONAME
+	_ZN3WRT16ServiceIPCClientD2Ev @ 43 NONAME
+	_ZN3WRT19ServiceFwIPCFactory13createBackendENS_19TServiceIPCBackendsE @ 44 NONAME
+	_ZN3WRT19ServiceFwIPCFactory18isIPCTypeSupportedENS_19TServiceIPCBackendsE @ 45 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryC1Ev @ 46 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryC2Ev @ 47 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryD0Ev @ 48 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryD1Ev @ 49 NONAME
+	_ZN3WRT19ServiceFwIPCFactoryD2Ev @ 50 NONAME
+	_ZNK3WRT12ServiceFwIPC10metaObjectEv @ 51 NONAME
+	_ZNK3WRT16ServiceIPCClient10metaObjectEv @ 52 NONAME
+	_ZNK3WRT18RServiceIPCSession11SendReceiveEiR14TRequestStatus @ 53 NONAME
+	_ZTIN3WRT12ServiceFwIPCE @ 54 NONAME
+	_ZTIN3WRT16ServiceIPCClientE @ 55 NONAME
+	_ZTIN3WRT19ServiceFwIPCFactoryE @ 56 NONAME
+	_ZTVN3WRT12ServiceFwIPCE @ 57 NONAME
+	_ZTVN3WRT16ServiceIPCClientE @ 58 NONAME
+	_ZTVN3WRT19ServiceFwIPCFactoryE @ 59 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/platform/qt/serviceipclocalsocket.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,289 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <QByteArray>
+#include "serviceipclocalsocket_p.h"
+
+namespace WRT
+{
+// CONSTANTS
+const char* REQUEST_COMPLETE_TOKEN = ";ROK";
+const int REQUEST_COMPLETE_TOKEN_LENGTH = 4;
+const char REQUEST_DELIMITER_TOKEN = ';';
+/*!
+ \class ServiceLocalSocketIPC
+ QLocalSocket based IPC client-side backend
+ */
+
+/*!
+ Constructor
+ */
+ServiceLocalSocketIPC::ServiceLocalSocketIPC() : m_BufferType( ENoBuffer )
+{
+    m_Socket = new QLocalSocket();
+    QObject::connect(m_Socket, SIGNAL( error( QLocalSocket::LocalSocketError ) ),
+    this, SLOT( handleError( QLocalSocket::LocalSocketError ) ) );
+}
+
+/*!
+ Destructor
+ */
+
+ServiceLocalSocketIPC::~ServiceLocalSocketIPC()
+{
+    delete m_Socket;
+}
+
+/*!
+ Connect to the server
+ @param aServerName name of the server to connect to
+ @return true if connected, false otherwise
+ */
+bool ServiceLocalSocketIPC::connect(const QString& aServerName)
+{
+    bool rtn;
+    m_Socket->connectToServer(aServerName);
+    rtn = m_Socket->waitForConnected();
+    return rtn;
+}
+
+/*!
+ Disconnect from the server
+ */
+void ServiceLocalSocketIPC::disconnect()
+{
+    m_Socket->close();
+}
+
+/*!
+ Starts the service
+ @param aServerName name of the server to connect to
+ @param aExeName name of the server executable
+ @return true if server started, false otherwise
+ */
+bool ServiceLocalSocketIPC::startServer(const QString& aServerName,
+                                        const QString& aExeName)
+{
+    bool started(true);
+
+    //Semaphore with 1 initial count,
+    //Use system semaphore to ensure no contention exists across multiple processes
+    //According to QT documentation for System Semaphores on Windows, 
+    //the semaphore is automatically cleaned up if a process crashes, thus preventing deadlock
+    //
+    QSystemSemaphore funcSem(aServerName + FUNCTIONSEM, 1);
+    funcSem.acquire();
+
+    // Shared chunk to check if the server has been started or not
+    QSharedMemory sharedMem(aServerName);
+    char* data(NULL);
+    bool attached = sharedMem.attach();
+    if (attached) {
+        data = (char*) sharedMem.data();
+    }
+
+    // Shared memory not created or the flag was not set properly
+    if (!attached || strcmp(data, SERVERNOTSTARTED) == 0) {
+        // Create the server wait semaphore. When the server has listened, 
+        // it will signaled after listen has started
+        //
+        QSystemSemaphore sem(aServerName + SERVERSEM, 0);
+
+        // Start the server, since this function is mutex'ed by the global semaphore 
+        // only 1 process/thread can reach here
+        //
+        started = QProcess::startDetached(aExeName);
+
+        // Wait until the server signals
+        if (started) {
+            sem.acquire();
+        }
+    }
+
+    // Test if server started successfully
+#if _DEBUG
+    attached = sharedMem.attach();
+    if( attached )
+    {
+        data = (char*)sharedMem.data();
+        if( strcmp( data, SERVERSTARTED ) == 0 )
+        {
+            qDebug() << "Server Started Successfully";
+        }
+    }
+#endif // _DEBUG
+    // Free shared memory
+    sharedMem.detach();
+
+    // Release the function semaphore
+    funcSem.release(1);
+    return started;
+}
+
+/*!
+ Send a request synchronously
+ @param aRequestType type of request, toAscii() will be called to serialize the data
+ @param aData aData data to send to the server
+ @return true if data is sent, false otherwise
+ */
+bool ServiceLocalSocketIPC::sendSync(const QString& aRequestType,
+                                     const QByteArray& aData)
+{
+    QByteArray data;
+    data.setNum(aData.length());
+    data.append(REQUEST_DELIMITER_TOKEN);
+    data.append(aRequestType.toAscii());
+    data.append(REQUEST_DELIMITER_TOKEN);
+    data.append(aData);
+    int count = m_Socket->write(data);
+    m_Socket->flush();
+    m_BufferType = ESyncBuffer;
+    return (count > 0);
+}
+
+/*!
+ Send a request asynchronously
+ @param aRequestType type of request, toAscii() will be called to serialize the data
+ @param aData data to send to the server
+ */
+void ServiceLocalSocketIPC::sendAsync(const QString& aRequestType,
+                                      const QByteArray& aData)
+{
+    QByteArray data;
+    data.setNum(aData.length());
+    data.append(REQUEST_DELIMITER_TOKEN);
+    data.append(aRequestType.toAscii());
+    data.append(REQUEST_DELIMITER_TOKEN);
+    data.append(aData);
+    m_Socket->write(data);
+
+    // Connect the signal and reset aync data buffer
+    m_AsyncData.clear();
+    QObject::connect(m_Socket, SIGNAL( readyRead() ),
+    this, SLOT( handleReadyRead() ) );
+    m_BufferType = EAsyncBuffer;
+}
+
+/*!
+ Reads all data pending in the buffer
+ @return QByteArray data that has been read
+ */
+QByteArray ServiceLocalSocketIPC::readAll()
+{
+    QByteArray result;
+
+    // If asynchronous read all data from the socket 
+    //
+    if ( m_BufferType == ESyncBuffer ) {
+        // Wait for all data to be completed before returning
+        //
+        bool done = false;
+        do {
+            result.append(m_Socket->readAll());
+            if (result.right(REQUEST_COMPLETE_TOKEN_LENGTH)
+                            == REQUEST_COMPLETE_TOKEN) {
+                // Chop the end token
+                result.chop(REQUEST_COMPLETE_TOKEN_LENGTH);
+                done = true;
+            }
+        } while (done == false);
+    }
+    // If async, return the internal databuffer
+    else if( m_BufferType == EAsyncBuffer ){
+        // Should be just a d-ptr copy
+        result = m_AsyncData;
+        QObject::disconnect(m_Socket, SIGNAL( readyRead() ),
+        this, SLOT( handleReadyRead() ) );
+    }
+    m_BufferType = ENoBuffer;
+
+    return result;
+}
+
+/*!
+ Waits until data is available for reading 
+ @return bool true if data can be read
+ */
+bool ServiceLocalSocketIPC::waitForRead()
+{
+    return m_Socket->waitForReadyRead();
+}
+
+/*!
+ Handle any socket errors
+ @param socketError error
+ */
+void ServiceLocalSocketIPC::handleError(QLocalSocket::LocalSocketError aSocketError)
+{
+    // Use base class to send this
+    emitError(doMapErrors(aSocketError));
+}
+
+/*!
+ Handle when data is ready to be read
+ */
+void ServiceLocalSocketIPC::handleReadyRead()
+{
+    m_AsyncData.append(m_Socket->readAll());
+    if (m_AsyncData.right(REQUEST_COMPLETE_TOKEN_LENGTH)
+                    == REQUEST_COMPLETE_TOKEN) {
+        // Chop the end token
+        m_AsyncData.chop(REQUEST_COMPLETE_TOKEN_LENGTH);
+
+        // Use base class to send signal when all the data has been assembled
+        emitReadyRead();
+    }
+}
+
+int ServiceLocalSocketIPC::doMapErrors( int aError )
+{
+    int error(0);
+    
+    // Map QT Local Socket error codes to custom error codes
+    //
+    switch( aError ) {
+    case QLocalSocket::ConnectionError:
+    case QLocalSocket::ConnectionRefusedError: {
+        error = ServiceFwIPC::EConnectionError;
+        break;
+        }
+    case QLocalSocket::PeerClosedError: {
+        error = ServiceFwIPC::EConnectionClosed;
+        break;
+        } 
+    case QLocalSocket::ServerNotFoundError: {
+        error = ServiceFwIPC::EServerNotFound;
+        break;
+        } 
+    case QLocalSocket::SocketAccessError:
+    case QLocalSocket::SocketResourceError:
+    case QLocalSocket::SocketTimeoutError:
+    case QLocalSocket::DatagramTooLargeError:
+    case QLocalSocket::UnsupportedSocketOperationError: {
+        error = ServiceFwIPC::EIPCError;
+        break;
+        }    
+    case QLocalSocket::UnknownSocketError: {
+        error = ServiceFwIPC::EUnknownError;
+        break;
+        }
+    }
+    return error;
+}
+
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/platform/qt/serviceipclocalsocket_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,74 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipclocalsocket_p_h
+#define serviceipclocalsocket_p_h
+
+#include <QtCore>
+#include <QtNetwork>
+#include "serviceipc_p.h"
+
+namespace WRT {
+
+    class ServiceLocalSocketIPC : public QObject, public ServiceFwIPCPrivate
+    {
+    Q_OBJECT
+    public:
+        ServiceLocalSocketIPC();
+    
+        virtual ~ServiceLocalSocketIPC();
+    
+    public:
+    
+        bool connect(const QString& aServerName);
+    
+        void disconnect();
+    
+        bool startServer(const QString& aServerName, const QString& aExeName);
+    
+        bool sendSync(const QString& aRequestType, const QByteArray& aData);
+    
+        void sendAsync(const QString& aRequestType, const QByteArray& aData);
+    
+        QByteArray readAll();
+    
+        bool waitForRead();
+    
+    private slots:
+    
+        void handleError(QLocalSocket::LocalSocketError socketError);
+    
+        void handleReadyRead();
+    
+    private:
+        int doMapErrors( int aError );
+    
+    private:
+        enum TBufferType {
+            ENoBuffer,
+            ESyncBuffer,
+            EAsyncBuffer
+        };
+    // Member Variables
+    private:
+        QLocalSocket* m_Socket;
+        QByteArray m_AsyncData;
+        TBufferType m_BufferType;
+    };
+
+}
+#endif // serviceipclocalsocket_p_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/platform/s60/serviceipcsymbian.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,282 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include "serviceipcsymbian_p.h"
+
+namespace WRT
+{
+const TInt KIPCOperation = 0;
+const TInt KIPCGetBuffer = 1;
+const TInt KServerMajorVersionNumber = 1;
+const TInt KServerMinorVersionNumber = 0;
+const TInt KServerBuildVersionNumber = 0;
+
+
+/*!
+ \class CServiceSymbianIPC
+
+ Symbian Client backend for the service IPC
+ */
+
+/*!
+ Constructor
+ */
+CServiceSymbianIPC::CServiceSymbianIPC() :
+    CActive(CActive::EPriorityStandard), iDataSize(0)
+{
+    CActiveScheduler::Add(this);
+}
+
+/*!
+ Destructor 
+ */
+CServiceSymbianIPC::~CServiceSymbianIPC()
+{
+    Cancel();
+    if (iSession.Handle()) {
+        iSession.Close();
+    }
+    delete iAsyncData;
+    delete iRequestData;
+}
+
+/*!
+ 2nd phased constructor
+ */
+void CServiceSymbianIPC::ConstructL()
+{
+}
+
+/*!
+ Two Phased Constructor
+ */
+CServiceSymbianIPC* CServiceSymbianIPC::NewL()
+{
+    CServiceSymbianIPC* self = new (ELeave) CServiceSymbianIPC();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+/*!
+ Connect to the server
+ @param aServerName name of the server to connect to
+ @return true if connected, false if not
+ */
+bool CServiceSymbianIPC::connect(const QString& aServerName)
+{
+    // Version informaton
+    TVersion version(KServerMajorVersionNumber, 
+                     KServerMinorVersionNumber, 
+                     KServerBuildVersionNumber);
+    TPtrC serverName(reinterpret_cast<const TUint16*> (aServerName.utf16()));
+    TInt err = iSession.Connect(serverName, version);
+
+    return (err == KErrNone);
+}
+
+/*!
+ Disconnect from the server
+ */
+void CServiceSymbianIPC::disconnect()
+{
+    iSession.Close();
+}
+
+/*!
+ Starts the service
+ @param aServerName server name
+ @param aExeName server executable name
+ */
+bool CServiceSymbianIPC::startServer(const QString& /*aServerName*/,
+                                     const QString& aExeName)
+{
+    TPtrC serverName(reinterpret_cast<const TUint16*> (aExeName.utf16()));
+    TInt err = iSession.StartServer(serverName);
+    return (err == KErrNone);
+}
+
+/*!
+ Send a request synchronously
+ @param aRequestType type of request to send to the server
+ @param aData data to send to the server
+ */
+bool CServiceSymbianIPC::sendSync(const QString& aRequestType,
+                                  const QByteArray& aData)
+{
+    // Convert from QString to TPtr
+    TPtrC request(reinterpret_cast<const TUint16*> (aRequestType.utf16()));
+    TPtrC8 data(reinterpret_cast<const TUint8*> (aData.constData()), aData.length());
+
+    // Send data, 0 is new op
+    TInt err;
+    TInt dataSize = 0;
+    TIpcArgs args(&request, &data);
+    TRAP( err, dataSize = iSession.SendReceiveL(KIPCOperation,args) );
+
+    // map return value
+    if (err == KErrNone) {
+        iDataSize = dataSize;
+    }
+    return (err == KErrNone);
+}
+
+/*!
+ Send a request asynchronously
+ @param aRequestType type of request to send to the server
+ @param aData data to send to the server
+ */
+void CServiceSymbianIPC::sendAsync(const QString& aRequestType,
+                                   const QByteArray& aData)
+{
+    delete iRequestData;
+    iRequestData = NULL;
+    TPtrC request(reinterpret_cast<const TUint16*> (aRequestType.utf16()));
+    iRequestData = request.Alloc();
+    delete iAsyncData;
+    iAsyncData = NULL;
+    TPtrC8 data(reinterpret_cast<const TUint8*> (aData.constData()), aData.length());
+    iAsyncData = data.Alloc();
+
+    // Send data
+    iRequestDataPtr.Set(*iRequestData);
+    iAsyncDataPtr.Set(*iAsyncData);
+    TIpcArgs args(&iRequestDataPtr, &iAsyncDataPtr);
+    iSession.SendReceive(KIPCOperation, args, iStatus);
+    SetActive();
+}
+
+/*!
+ Reads all data pending in the buffer
+ @return QByteArray containing the result data
+ */
+QByteArray CServiceSymbianIPC::readAll()
+{
+    QByteArray rtn;
+    TRAP_IGNORE( rtn = doReadAllL() );
+
+    return rtn;
+}
+
+/*!
+ Reads all data pending in the buffer, leaves if an error occurred
+ @return QByteArray containing the result data
+ */
+QByteArray CServiceSymbianIPC::doReadAllL()
+{
+    // Read the data via IPC
+    //
+    CBufBase* buf = CBufFlat::NewL(iDataSize);
+    CleanupStack::PushL(buf);
+    buf->ResizeL(iDataSize);
+    TPtr8 ptr(buf->Ptr(0));
+    iSession.SendReceiveL(KIPCGetBuffer, TIpcArgs(&ptr));
+
+    QByteArray convert((char *)ptr.Ptr(), ptr.Length());
+
+    CleanupStack::PopAndDestroy(buf);
+
+    // Deep copy, return variable is implicitly shared
+    return convert;
+}
+
+/*!
+ Maps error codes from Symbian error codes to Service IPC error codes
+ @param aError Symbian error code
+ @return mapped error code
+ */
+int CServiceSymbianIPC::doMapErrors(TInt aError)
+{
+    int error(0);
+    switch (aError) {
+    case KErrNone: {
+        error = 0;
+        break;
+    }
+    case KErrPermissionDenied:
+    case KErrServerTerminated: {
+        error = ServiceFwIPC::EConnectionClosed;
+        break;
+    }
+    case KErrServerBusy: {
+        error = ServiceFwIPC::EConnectionError;
+        break;
+    }
+    case KErrArgument:
+    case KErrNoMemory: {
+        error = ServiceFwIPC::EIPCError;
+        break;
+    }
+    default: {
+        error = ServiceFwIPC::EUnknownError;
+        break;
+    }
+    }
+    return error;
+}
+/*!
+ Waits until data is available for reading 
+ @return bool always true, no need to wait
+ */
+bool CServiceSymbianIPC::waitForRead()
+{
+    // Symbian Client-server is blocking, so no need to wait for read
+    return true;
+}
+
+/*!
+ Active object callback
+ */
+void CServiceSymbianIPC::RunL()
+{
+    TInt err = iStatus.Int();
+
+    // Callback to observers
+    //
+    if (err >= KErrNone) {
+        iDataSize = err;
+        emitReadyRead();
+    } else {
+        emitError(doMapErrors(err));
+    }
+
+    // Cleanup async request, no need to delete if client re-requested an async op
+    if( !asyncPending() ) {
+        delete iRequestData;
+        iRequestData = NULL;
+        delete iAsyncData;
+        iAsyncData = NULL;
+        iRequestDataPtr.Set(KNullDesC);
+        iAsyncDataPtr.Set(KNullDesC8);
+    }
+}
+
+/*!
+ Active object cancel
+ */
+void CServiceSymbianIPC::DoCancel()
+{
+    // We can't cancel in the IPC design.
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrCancel);
+}
+
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/platform/s60/serviceipcsymbian_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,81 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef C_SERVICEIPC_SYMBIAH_H
+#define C_SERVICEIPC_SYMBIAH_H
+
+#include <e32base.h>
+#include <serviceipc_p.h>
+#include "serviceipcsymbiansession.h"
+
+namespace WRT {
+    
+    class CServiceSymbianIPC : public CActive, public ServiceFwIPCPrivate
+    {
+    
+    public:
+    
+        virtual ~CServiceSymbianIPC();
+    
+        static CServiceSymbianIPC* NewL();
+    
+        // From ServiceFwIPCPrivate
+    protected:
+    
+        bool connect(const QString& aServerName);
+    
+        void disconnect();
+    
+        bool startServer(const QString& aServerName, const QString& aExeName);
+    
+        bool sendSync(const QString& aRequestType, const QByteArray& aData);
+    
+        void sendAsync(const QString& aRequestType, const QByteArray& aData);
+    
+        QByteArray readAll();
+    
+        bool waitForRead();
+    
+        // From CActive
+    protected:
+    
+        void RunL();
+    
+        void DoCancel();
+    
+    private:
+    
+        QByteArray doReadAllL();
+    
+        int doMapErrors( TInt aError );
+        
+    private:
+    
+        CServiceSymbianIPC();
+    
+        void ConstructL();
+    
+    private:
+        RServiceIPCSession iSession;
+        HBufC8* iAsyncData; // member variable to keep alive any data for async ops
+        TPtrC8 iAsyncDataPtr;
+        HBufC* iRequestData;
+        TPtrC iRequestDataPtr;
+        TInt iDataSize;
+    };
+}
+#endif // C_SERVICEIPC_SYMBIAH_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/platform/s60/serviceipcsymbiansession.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,122 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipcsymbiansession.h"
+
+namespace WRT
+{
+// ============================== MEMBER FUNCTIONS ============================
+
+/*!
+ \class RServiceIPCSession
+
+ Symbian class encapsulating RMessage2 interface
+ */
+
+/*!
+ Send a message
+ @param aFunction function code
+ @return message completion code
+ */
+TInt RServiceIPCSession::SendReceiveL(TInt aFunction) const
+{
+    return User::LeaveIfError(RSessionBase::SendReceive(aFunction));
+}
+
+/*!
+ Send a message
+ @param aFunction function code
+ @param aArgs parameter to server
+ @return message completion code
+ */
+TInt RServiceIPCSession::SendReceiveL(TInt aFunction, const TIpcArgs& aArgs) const
+{
+    return User::LeaveIfError(RSessionBase::SendReceive(aFunction, aArgs));
+}
+
+/*!
+ Send message asynchronously
+ @param aFunction function code
+ @param aStatus the request status object used to contain the 
+ completion status of the request
+ */
+EXPORT_C void RServiceIPCSession::SendReceive(TInt aFunction,
+                                              TRequestStatus& aStatus) const
+{
+    RSessionBase::SendReceive(aFunction, aStatus);
+}
+
+/*!
+ Send message asynchronously
+ @param aFunction function code
+ @param aArgs parameter to server
+ @param aStatus the request status object used to contain the 
+ completion status of the request
+ */
+void RServiceIPCSession::SendReceive(TInt aFunction,
+                                     const TIpcArgs& aArgs,
+                                     TRequestStatus& aStatus) const
+{
+    RSessionBase::SendReceive(aFunction, aArgs, aStatus);
+}
+
+/*!
+ Connect to server
+ @param aServer server name
+ @param aVersion version of the server
+ @return KErrNone success, otherwise system error code
+ */
+TInt RServiceIPCSession::Connect(const TDesC& aServer, const TVersion& aVersion)
+{
+    iVersion = aVersion;
+    return CreateSession(aServer, aVersion, 1);
+}
+
+/*!
+ Get version info
+ @return version info
+ */
+TVersion RServiceIPCSession::Version() const
+{
+    return iVersion;
+}
+
+/*!
+ Start the server 
+ @param aImage binary name to start
+ @return KErrNone if started properly
+ */
+TInt RServiceIPCSession::StartServer(const TDesC& aImage)
+{
+    RProcess server;
+    TInt ret = server.Create(aImage, KNullDesC);
+    if (ret == KErrNone) {
+        TRequestStatus status;
+        server.Rendezvous(status);
+        if (status != KRequestPending)
+            server.Kill(0);
+        else
+            server.Resume();
+        User::WaitForRequest(status);
+        ret = (server.ExitType() == EExitPanic) ? KErrGeneral : status.Int();
+        server.Close();
+    }
+    return ret;
+}
+}
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/platform/s60/serviceipcsymbiansession.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,51 @@
+/*
+ * =============================================================================
+ *  Name        : serviceipcsymbiansession.h
+ *  Part of     : Service Framework / Service IPC
+ *  Interface   : 
+ *  Description : Client session class to  server
+ *  Version     : %version: 1 %
+ *
+ *  Copyright © 2008 Nokia. All rights reserved.
+ *  This material, including documentation and any related 
+ *  computer programs, is protected by copyright controlled by 
+ *  Nokia. All rights are reserved. Copying, including 
+ *  reproducing, storing, adapting or translating, any 
+ *  or all of this material requires the prior written consent of 
+ *  Nokia. This material also contains confidential 
+ *  information which may not be disclosed to others without the 
+ *  prior written consent of Nokia.
+ * =============================================================================
+ */
+
+#ifndef C_SERVICEIPC_SYMBIANSESSION_H
+#define C_SERVICEIPC_SYMBIANSESSION_H
+
+#include <e32std.h>
+namespace WRT {
+    
+    class RServiceIPCSession : public RSessionBase
+    {
+    public:
+        TInt Connect(const TDesC& aServer, const TVersion& aVersion);
+    
+        TVersion Version() const;
+    
+        TInt SendReceiveL(TInt aFunction) const;
+    
+        TInt SendReceiveL(TInt aFunction, const TIpcArgs& aArgs) const;
+    
+        void SendReceive(TInt aFunction, TRequestStatus& aStatus) const;
+    
+        void SendReceive(TInt aFunction,
+                         const TIpcArgs& aArgs,
+                         TRequestStatus& aStatus) const;
+    
+        TInt StartServer(const TDesC& aImage);
+    
+    private:
+        TVersion iVersion;
+    };
+}
+#endif // C_SERVICEIPC_SYMBIANSESSION_H
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipc.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,198 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipc.h"
+#include "serviceipc_p.h"
+#include "serviceipcfactory.h"
+
+namespace WRT
+{
+
+/*!
+ \class ServiceFwIPC
+ Public interface class for IPC operations
+ */
+
+/*!
+ Destructor
+ */
+ServiceFwIPC::~ServiceFwIPC()
+{
+    delete d;
+}
+
+/*!
+ Constructor
+ @param aBackend IPC backend to use
+ @param aParent Parent to this QObject
+ */
+ServiceFwIPC::ServiceFwIPC(QObject* aParent, TServiceIPCBackends aBackend)
+    : QObject(aParent)
+    , m_AsyncRequestPending(false)
+{
+    // Private implementation pattern
+    //
+    d = ServiceFwIPCFactory::createBackend(aBackend);
+    d->q = this;
+}
+
+/*!
+ Connect to the server
+ @param aServerName name of the server to connect to
+ @return true if connected, false if not
+ */
+bool ServiceFwIPC::connect(const QString& aServerName)
+{
+    return d->connect(aServerName);
+}
+
+/*!
+ Disconnect from the server
+ @return void
+ */
+void ServiceFwIPC::disconnect()
+{
+    d->disconnect();
+}
+
+/*!
+ Starts the service
+ @param aServerName name of the server
+ @param aExeName executable of the server
+ @return true if connected
+ */
+bool ServiceFwIPC::startServer(const QString& aServerName,
+                               const QString& aExeName)
+{
+    return d->startServer(aServerName, aExeName);
+}
+
+/*!
+ Send a request synchronously
+ @param aRequestType name of the request
+ @param aData data to send
+ @return true if sent successful, otherwise false
+ */
+bool ServiceFwIPC::sendSync(const QString& aRequestType,
+                            const QByteArray& aData)
+{
+#ifdef _DEBUG
+    Q_ASSERT_X( aRequestType.contains(";") == false, "", "aRequestType cannot contain semicolons!" );
+#endif // _DEBUG
+    bool sent = d->sendSync(aRequestType, aData);
+    if (sent) {
+        sent = waitForRead();
+    }
+    return sent;
+}
+
+/*!
+ Send a request asynchronously
+ @param aRequestType name of the request
+ @param aData data to send
+ @note Errors will be emitted via errors() signal
+ @return void
+ */
+void ServiceFwIPC::sendAsync(const QString& aRequestType,
+                             const QByteArray& aData)
+{
+#ifdef _DEBUG
+    Q_ASSERT_X( aRequestType.contains(";") == false, "", "aRequestType cannot contain semicolons!" );
+#endif // _DEBUG
+    d->sendAsync(aRequestType, aData);
+    m_AsyncRequestPending = true;
+}
+
+/*!
+ Reads all data pending in the buffer.\n
+ For Sync version this will wait until all of the data is available.\n
+ For Async version it will return the currently read buffer.\n
+ Use only after readyRead() signal is emitted. However partial data can be read
+ @return QByteArray of results
+ */
+QByteArray ServiceFwIPC::readAll()
+{
+    return d->readAll();
+}
+
+/*!
+ Waits until data is available for reading
+ @return true if data is available for reading
+ */
+bool ServiceFwIPC::waitForRead()
+{
+    return d->waitForRead();
+}
+
+/*!
+ Check if an async request is already pending
+ @return true if an async request is pending
+ false otherwise
+ */
+bool ServiceFwIPC::requestPending()
+{
+    return m_AsyncRequestPending;
+}
+
+/*!
+ Retrieve the session id synchronously
+ @param aSessionId name of the request
+ @return true if retrieved successfully, otherwise false
+ */
+bool ServiceFwIPC::getSessionId(int& aSessionId)
+{
+    QByteArray data;
+    bool ret(sendSync(GETSESSIONID, data));
+    if (ret)
+        data = d->readAll();
+    aSessionId = data.toInt();
+    return ret;
+}
+
+/*!
+ Set the session id synchronously
+ @param aSessionId name of the request
+ @return true if set successfully, otherwise false
+ */
+bool ServiceFwIPC::setSessionId(int aSessionId)
+{
+    bool ret(sendSync(SETSESSIONINFO, QByteArray::number(aSessionId)));
+    if (ret)
+        d->readAll(); //clean buffer
+    return ret;
+}
+
+} // end of namespace
+
+/*!
+ \fn WRT::ServiceFwIPC::error( int aError )
+
+ Signal emitted to handle any errors
+ @param aError error code
+ @note: For local socket implementation, the error can be interpreted
+ as QLocalSocket::LocalSocketError
+ @return void
+ */
+
+/*!
+ \fn WRT::ServiceFwIPC::readyRead()
+
+ Handle when a reply has been received for async requests\n
+ Emitted when the entire data packet has been received
+ @return void
+ */
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipc.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,87 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipc_h
+#define serviceipc_h
+
+#include "serviceipcdefs.h"
+#include <QtCore>
+
+namespace WRT {
+    
+    class ServiceFwIPCPrivate;
+    
+    class SFWIPC_EXPORT ServiceFwIPC : public QObject
+    {
+    Q_OBJECT
+    public:
+
+        //! ServiceFwIPC::ServiceIPCErrors
+        /*!
+         This enum describes the errors that may be returned by the IPC.
+         */
+        enum ServiceIPCErrors
+            {
+            EConnectionError = -5000,               /*!< Error in IPC Connection */
+            EConnectionClosed,                      /*!< IPC Connection is closed */
+            EServerNotFound,                        /*!< Can not find server */
+            EIPCError,                              /*!< Known IPC error defined by SDK */
+            EUnknownError                           /*!< Unknown IPC error */
+            };
+
+    public:
+        virtual ~ServiceFwIPC();
+    
+        explicit ServiceFwIPC(QObject* aParent, TServiceIPCBackends aBackend = EDefaultIPC);
+    
+    public:
+        bool connect(const QString& aServerName);
+    
+        void disconnect();
+    
+        bool startServer(const QString& aServerName, const QString& aExeName);
+    
+        bool sendSync(const QString& aRequestType, const QByteArray& aData);
+    
+        void sendAsync(const QString& aRequestType, const QByteArray& aData);
+    
+        QByteArray readAll();
+    
+        bool requestPending();
+    
+        bool getSessionId(int& aSessionId);
+
+        bool setSessionId(int aSessionId);
+    private:
+        bool waitForRead();
+    
+        signals:
+    
+        void error(int aError);
+    
+        void readyRead();
+    
+        // Member Variables
+    protected:
+        bool m_AsyncRequestPending;
+
+        friend class ServiceFwIPCPrivate;
+        ServiceFwIPCPrivate* d;
+    };
+
+}
+#endif // serviceipc_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipc_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,124 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipc_p_h
+#define serviceipc_p_h
+
+#include "serviceipc.h"
+#include <QtCore>
+#include <QByteArray>
+
+namespace WRT {
+
+    /**
+     *  Private implementation class for IPC
+     */
+    class ServiceFwIPC;
+    class ServiceFwIPCPrivate
+    {
+    public:
+        /**
+         * Virtual destructor
+         */
+        virtual ~ServiceFwIPCPrivate() {};
+
+    
+        // Virtual functions 
+    
+        /**
+         * Connect to the server
+         * @param aServerName name of the server to connect to
+         * @return true if connected, false if not
+         */
+        virtual bool connect(const QString& aServerName) = 0;
+    
+        /**
+         * Disconnect from the server
+         */
+        virtual void disconnect() = 0;
+    
+        /**
+         * Starts the service
+         * @note: refer to public API ServiceFwIPC
+         */
+        virtual bool startServer(const QString& aServerName,
+                                 const QString& aExeName) = 0;
+    
+        /**
+         * Send a request synchronously
+         * @note: refer to public API ServiceFwIPC
+         */
+        virtual bool sendSync(const QString& aRequestType,
+                              const QByteArray& aData) = 0;
+    
+        /**
+         * Send a request asynchronously
+         * @note: refer to public API ServiceFwIPC
+         */
+        virtual void sendAsync(const QString& aRequestType,
+                               const QByteArray& aData) = 0;
+    
+        /**
+         * Reads all data pending in the buffer
+         * @note: refer to public API ServiceFwIPC
+         */
+        virtual QByteArray readAll() = 0;
+    
+        /**
+         * Waits until data is available for reading 
+         * @note: refer to public API ServiceFwIPC
+         */
+        virtual bool waitForRead() = 0;
+
+        /**
+         * Retrieves the session id synchronously
+         * @note: refer to public API ServiceFwIPC
+         */
+        bool getSessionId(int& aSessionId);
+
+        /**
+         * Sets the session id
+         * @note: refer to public API ServiceFwIPC
+         */
+        bool setSessionId(int aSessionId);
+
+    protected:
+        // TODO: Move to inl file
+        inline void emitReadyRead()
+        {
+            if (q->m_AsyncRequestPending) {
+                q->m_AsyncRequestPending = false;
+                emit q->readyRead();
+            }
+        };
+    
+        inline void emitError(int aError)
+        {
+            emit q->error(aError);
+        };
+    
+        inline bool asyncPending()
+        {
+            return q->requestPending();
+        }
+    private:
+        friend class ServiceFwIPC;
+        ServiceFwIPC* q;  // not owned
+    };
+
+}
+#endif // serviceipc_p_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcclient.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,227 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+ 
+#include "serviceipcclient.h"
+#include "serviceipc.h"
+
+namespace WRT
+{
+
+/*!
+ \class ServiceIPCClient
+  This class is an extension to the current ServiceIPCClient interface
+  with the additional functionality of receiving messages from the server 
+ */
+
+/*!
+ Destructor
+ */
+ServiceIPCClient::~ServiceIPCClient()
+{
+    delete m_syncIPC;
+    delete m_asyncIPC;
+    delete m_broadcastIPC;
+}
+
+/*!
+ Constructor 
+ @param aBackend IPC backend to use
+ @param aParent Parent to this QObject
+ */
+ServiceIPCClient::ServiceIPCClient(QObject* aParent, TServiceIPCBackends aBackend) :
+                                   QObject(aParent)
+{  
+    m_syncIPC = new ServiceFwIPC(aParent, aBackend);
+    m_asyncIPC = new ServiceFwIPC(aParent, aBackend);
+    m_broadcastIPC = new ServiceFwIPC(aParent, aBackend);
+    
+    QObject::connect(m_asyncIPC, SIGNAL(readyRead()), this, SLOT(handleAsyncMsg()));
+    QObject::connect(m_broadcastIPC, SIGNAL(readyRead()), this, SLOT(handleBroadcastMsg()));
+}
+
+/*!
+ Connect to the server
+ @param aServerName name of the server to connect to
+ @return true if connected, false if not
+ */
+bool ServiceIPCClient::connect(const QString& aServerName)
+{
+    bool ret;
+    ret = m_syncIPC->connect(aServerName);
+    if (ret) {
+        int sessionId;
+        ret = m_syncIPC->getSessionId(sessionId);
+        if (ret) {
+            m_sessionId = sessionId;
+            ret = m_asyncIPC->connect(aServerName);
+            if (ret) {
+                ret = m_asyncIPC->setSessionId(sessionId);
+                if (ret) {
+                    ret = m_broadcastIPC->connect(aServerName);
+                    if (ret) {
+                        ret = m_broadcastIPC->setSessionId(sessionId);
+                        if (!ret) {
+                            //async. IPC set session ID fail, disconnect broadcast IPC
+                            m_broadcastIPC->disconnect();
+                        }
+                        else {
+                            subscribeBroadcastMsg();
+                        }
+                    }
+                }
+                if (!ret)  {
+                    //async. IPC set session ID fail or broadcast IPC connect fail, disconnect async IPC
+                    m_asyncIPC->disconnect();
+                }
+            }
+        }
+        if (!ret) {
+            m_syncIPC->disconnect(); //get sessionId failed or async. IPC connect fail, disconnect sync IPC
+        }
+    }
+    return ret;
+}
+
+/*!
+ Disconnect from the server
+ @return void
+ */
+void ServiceIPCClient::disconnect()
+{
+    m_syncIPC->disconnect();
+    m_asyncIPC->disconnect();
+    m_broadcastIPC->disconnect();
+}
+
+/*!
+ Starts the service
+ @param aServerName name of the server
+ @param aExeName executable of the server
+ @return true if connected
+ */
+bool ServiceIPCClient::startServer(const QString& aServerName,
+                                   const QString& aExeName)
+{
+    return m_syncIPC->startServer(aServerName, aExeName);
+}
+
+/*!
+ Send a request synchronously
+ @param aRequestType name of the request
+ @param aData data to send
+ @return true if sent successful, otherwise false
+ */
+bool ServiceIPCClient::sendSync(const QString& aRequestType,
+                                const QByteArray& aData)
+{
+    return m_syncIPC->sendSync(aRequestType, aData);
+}
+
+/*!
+ Send a request asynchronously
+ @param aRequestType name of the request
+ @param aData data to send
+ @note Errors will be emitted via errors() signal
+ @return void                                              
+ */
+void ServiceIPCClient::sendAsync(const QString& aRequestType,
+                                 const QByteArray& aData)
+{
+    m_asyncIPC->sendAsync(aRequestType, aData);
+}
+
+/*!
+ Reads all data pending in the buffer.\n
+ For Sync version this will wait until all of the data is available.\n
+ @return QByteArray of results
+ */
+QByteArray ServiceIPCClient::readAll()
+{
+    return m_syncIPC->readAll();
+}
+
+/*!
+ Check if an async request is already pending
+ @return true if an async request is pending
+ false otherwise
+ */
+/*bool ServiceIPCClient::requestPending()
+{
+    return m_asyncIPC->requestPending();
+}*/
+
+/*!
+ Reads all data pending in the buffer.\n
+ For Async version it will return the currently read buffer.\n
+ Use only after readyRead() signal is emitted. However partial data can be read
+ */
+void ServiceIPCClient::handleAsyncMsg()
+{
+    // Read the results
+    QByteArray ipcResult(m_asyncIPC->readAll());
+    
+    if (!ipcResult.isEmpty()) {
+        emit readAsync(ipcResult);  
+    }
+}
+
+/*!
+ Client side interface to subscribe broadcast message
+ */
+void ServiceIPCClient::subscribeBroadcastMsg() 
+{
+    QString null;
+    m_broadcastIPC->sendAsync(SUBSCRIBEBROADCASTMSG, null.toAscii());
+}
+
+/*!
+ Reads all data pending in the buffer.\n
+ For broadcast version it will return the currently read buffer.\n
+ Use only after readyRead() signal is emitted. However partial data can be read
+ */
+void ServiceIPCClient::handleBroadcastMsg()
+{
+    // Read the results
+    QByteArray ipcResult(m_broadcastIPC->readAll());
+    
+    if (!ipcResult.isEmpty()) {
+        emit handleMessage(ipcResult);  
+        subscribeBroadcastMsg(); 
+    }
+}
+
+}
+
+
+/*!
+ \fn WRT::ServiceIPCClient::error( int aError )
+ 
+ Signal emitted to handle any errors
+ @param aError error code
+ @note: For local socket implementation, the error can be interpreted 
+ as QLocalSocket::LocalSocketError
+ @return void
+ */
+
+/*!
+ \fn WRT::ServiceIPCClient::readyRead()
+
+ Handle when a reply has been received for async requests\n
+ Emitted when the entire data packet has been received
+ @return void
+ */
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcclient.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,90 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef Q_SERVICEIPCCLIENT_H
+#define Q_SERVICEIPCCLIENT_H
+
+#include <QtCore>
+#include "serviceipcdefs.h"
+
+namespace WRT {
+    
+    class ServiceFwIPC;
+    
+    class SFWIPC_EXPORT ServiceIPCClient : public QObject
+    {
+    Q_OBJECT
+    public:
+        virtual ~ ServiceIPCClient();
+    
+        explicit ServiceIPCClient(QObject* aParent, TServiceIPCBackends aBackend = EDefaultIPC);
+    
+    public:
+        bool connect(const QString& aServerName);
+    
+        void disconnect();
+    
+        bool startServer(const QString& aServerName, const QString& aExeName);
+    
+        bool sendSync(const QString& aRequestType, const QByteArray& aData);
+    
+        void sendAsync(const QString& aRequestType, const QByteArray& aData);
+    
+        QByteArray readAll();
+    
+        //bool requestPending();
+        
+        inline qint32 sessionId() {return m_sessionId;}
+    
+    signals:
+    
+        void error(int aError);
+    
+        void readyRead(); //keep interface for ServiceFwIPC
+        
+        void readAsync(QByteArray ipcResult); //read async result
+
+        void handleMessage( QByteArray aMessage );  //send broadcast msg 
+        
+    private slots:
+    /**
+     * Handle the IPC client "readyRead" signal
+     */
+        void handleAsyncMsg(); 
+        void handleBroadcastMsg();
+        
+    private:    
+        void subscribeBroadcastMsg();
+            
+        // Member Variables
+    protected:        
+       // friend class ServiceFwIPC;
+        // One instance of the IPC endpoint to handle async messages
+        ServiceFwIPC* m_asyncIPC;
+        
+        // Another instance of the IPC endpoint to handle sync messages
+        ServiceFwIPC* m_syncIPC;
+        
+        // Another instance of the IPC endpoint to handle broadcast messages
+        ServiceFwIPC* m_broadcastIPC;
+        
+    private:
+        qint32 m_sessionId;
+    };
+
+}
+#endif // Q_SERVICEIPCCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcclient.loc	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,13 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.7.0) on: 2010-10-07T19:05:04
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#ifdef LANGUAGE_SC
+#define STRING_r_short_caption "serviceipcclient"
+#define STRING_r_caption "serviceipcclient"
+#else
+#define STRING_r_short_caption "serviceipcclient"
+#define STRING_r_caption "serviceipcclient"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcclient.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,78 @@
+#
+# ============================================================================
+#  Name        : serviceipc.pro
+#  Part of     : Service Framework / IPC
+#  Description : Service Framework IPC
+#  Version     : %version: 1 % 
+#
+#  Copyright © 2009 Nokia.  All rights reserved.
+#  This material, including documentation and any related computer
+#  programs, is protected by copyright controlled by Nokia.  All
+#  rights are reserved.  Copying, including reproducing, storing,
+#  adapting or translating, any or all of this material requires the
+#  prior written consent of Nokia.  This material also contains
+#  confidential information which may not be disclosed to others
+#  without the prior written consent of Nokia.
+# ============================================================================
+#
+TEMPLATE = lib
+TARGET = brserviceipcclient
+
+QT -=gui
+
+ROOT_DIR = $$PWD/../..
+
+#Sources
+HEADERS += serviceipcdefs.h \
+           serviceipc_p.h \
+           serviceipc.h \ 
+           serviceipcfactory.h \
+           serviceipcsharedmem_p.h \
+           serviceipcclient.h
+SOURCES += serviceipc.cpp \ 
+           serviceipcfactory.cpp \
+           serviceipcsharedmem.cpp \
+           serviceipcclient.cpp
+
+DEFINES += QT_MAKE_IPC_DLL
+DEFINES+=QT_BEARER=1
+DEFINES+=MAEMO_QT_BEARER=0
+###INCLUDEPATH += $$CWRT_INCLUDE 
+
+
+### EXPORT_FILES = serviceipcdefs.h serviceipc.h serviceipcclient.h
+
+# Symbian Specifics
+symbian {
+    TARGET.EPOCALLOWDLLDATA = 1
+    TARGET.UID3 = 0x200267E0
+    SYMBIAN_PUB_SDK = $$(SYMBIAN_PUB_SDK)
+    isEmpty(SYMBIAN_PUB_SDK) {
+        TARGET.VID = VID_DEFAULT
+    } else {
+        TARGET.VID = 0x00000000
+    }
+    TARGET.CAPABILITY = All -Tcb
+    MMP_RULES += EXPORTUNFROZEN
+
+    brserviceipcclientlibs.sources = brserviceipcclient.dll
+    brserviceipcclientlibs.path = /sys/bin
+    DEPLOYMENT += brserviceipcclientlibs
+
+    HEADERS += ./platform/s60/serviceipcsymbian_p.h \
+               ./platform/s60/serviceipcsymbiansession.h 
+    SOURCES += ./platform/s60/serviceipcsymbian.cpp \
+               ./platform/s60/serviceipcsymbiansession.cpp
+    INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE 
+}
+else {
+    QT +=network
+    HEADERS += ./platform/qt/serviceipclocalsocket_p.h
+    SOURCES += ./platform/qt/serviceipclocalsocket.cpp
+    INCLUDEPATH += $$PWD/platform/qt
+    
+    # Export headers on non-symbian systems
+###    EXPORT_DIR = $$CWRT_INCLUDE
+}
+
+###include($$WRT_DIR/cwrt-export.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcclient.rss	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,21 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.7.0) on: 2010-10-07T19:05:04
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#include <appinfo.rh>
+#include "serviceipcclient.loc"
+
+RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
+	{
+	short_caption = STRING_r_short_caption;
+	caption_and_icon =
+	CAPTION_AND_ICON_INFO
+		{
+		caption = STRING_r_caption;
+		number_of_icons = 0;
+		icon_file = "";
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcdefs.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,37 @@
+#ifndef serviceipcdefs_h
+#define serviceipcdefs_h
+
+#include <Qt/qglobal.h>
+
+namespace WRT {
+
+    #ifdef QT_MAKE_IPC_DLL
+        # define SFWIPC_EXPORT Q_DECL_EXPORT
+    #else
+        # define SFWIPC_EXPORT Q_DECL_IMPORT
+    #endif
+
+    #ifdef QT_MAKE_IPC_SERVER_DLL
+        # define SFWIPCSRV_EXPORT Q_DECL_EXPORT
+    #else
+        # define SFWIPCSRV_EXPORT Q_DECL_IMPORT
+    #endif
+
+    enum TServiceIPCBackends
+        {
+        EDefaultIPC, 
+        ELocalSocket, 
+        ESymbianServer, 
+        ESharedMemory
+        };
+
+    static const char FUNCTIONSEM[] = "_funclock";
+    static const char SERVERSEM[] = "_serverlock";
+    static const char SERVERNOTSTARTED[] = "0";
+    static const char SERVERSTARTED[] = "1";
+
+    #define GETSESSIONID   "GetSessionId"
+    #define SETSESSIONINFO   "SetSessionInfo"
+    #define SUBSCRIBEBROADCASTMSG "SubscribeBroadcastMsg"
+}
+#endif // serviceipcdefs_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcfactory.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,101 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipcfactory.h"
+#include "serviceipc_p.h"
+#ifndef __SYMBIAN32__
+#include "serviceipclocalsocket_p.h"
+#endif // Q_OS_WIN32
+#include "serviceipcsharedmem_p.h"
+
+#ifdef __SYMBIAN32__
+#include "serviceipcsymbian_p.h"
+#endif // __SYMBIAN32__
+namespace WRT
+{
+/*!
+ \class ServiceFwIPCFactory
+
+ Factory class for constructing the IPC backend
+ */
+
+/*!
+ Constructor
+ */
+ServiceFwIPCFactory::ServiceFwIPCFactory()
+{
+}
+
+/*!
+ Destructor
+ */
+ServiceFwIPCFactory::~ServiceFwIPCFactory()
+{
+}
+
+/*!
+ Check to see if the particular IPC type is supported
+ @param aIPCType type of the IPC
+ @return true if the IPC type is supported, false otherwise
+ */
+bool ServiceFwIPCFactory::isIPCTypeSupported(TServiceIPCBackends aIPCType)
+{
+    bool supported(false);
+
+#ifdef Q_OS_WIN32
+    if( aIPCType == ELocalSocket )
+    {
+        supported = true;
+    }
+#elif __SYMBIAN32__
+    if (aIPCType == ESymbianServer) {
+        supported = true;
+    }
+#else
+    //avoid compile warning
+    aIPCType = EDefaultIPC;
+    supported = false;
+#endif
+
+    return supported;
+}
+
+/*!
+ Create an instance of the Service IPC backend
+ @param aBackend Type of backend to create
+ @return ServiceFwIPCPrivate instance
+ */
+ServiceFwIPCPrivate* ServiceFwIPCFactory::createBackend(TServiceIPCBackends aBackend)
+{
+    ServiceFwIPCPrivate* backend(NULL);
+
+#ifndef __SYMBIAN32__
+    // Local socket is default
+    if( aBackend == ELocalSocket || aBackend == EDefaultIPC )
+    {
+        backend = new ServiceLocalSocketIPC();
+    }
+#else
+    // Symbian server is default
+    if (aBackend == ESymbianServer || aBackend == EDefaultIPC) {
+        TRAP_IGNORE( backend = CServiceSymbianIPC::NewL() );
+    }
+#endif
+    return backend;
+}
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcfactory.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,49 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcfactory_h
+#define serviceipcfactory_h
+
+#include <QtCore>
+#include "serviceipcdefs.h"
+
+namespace WRT {
+    
+    class ServiceFwIPCPrivate;
+    
+    class SFWIPC_EXPORT ServiceFwIPCFactory : public QObject
+    {
+    public:
+    
+        ServiceFwIPCFactory();
+    
+        virtual ~ServiceFwIPCFactory();
+    
+    public:
+    
+        static bool isIPCTypeSupported(TServiceIPCBackends aIPCType);
+    
+        static ServiceFwIPCPrivate* createBackend(TServiceIPCBackends aBackend =
+                                                                     EDefaultIPC);
+    
+    private:
+        // data
+    
+    };
+
+}
+#endif // serviceipcfactory_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcsharedmem.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,102 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <QByteArray>
+#include "serviceipcsharedmem_p.h"
+
+namespace WRT
+{
+
+/*!
+ \class ServiceSharedMemIPC
+
+ Shared memory backend for the service IPC
+ @note: THIS CLASS IS NOT FINISHED
+ */
+
+/*!
+ Constructor
+ */
+ServiceSharedMemIPC::ServiceSharedMemIPC()
+{
+}
+
+/*!
+ Destructor
+ */
+ServiceSharedMemIPC::~ServiceSharedMemIPC()
+{
+}
+
+/*!
+ Connect to the server
+ */
+bool ServiceSharedMemIPC::connect(const QString& /*aServerName*/)
+{
+    return false;
+}
+
+/*!
+ Disconnect from the server
+ */
+void ServiceSharedMemIPC::disconnect()
+{
+}
+
+/*!
+ Start the server
+ */
+bool ServiceSharedMemIPC::startServer(const QString& /*aServerName*/,
+                                      const QString& /*aExeName*/)
+{
+    return false;
+}
+
+/*!
+ Send data synchronously
+ */
+bool ServiceSharedMemIPC::sendSync(const QString& /*aRequestType*/,
+                                   const QByteArray& /*aData*/)
+{
+    return false;
+}
+
+/*!
+ Send data asynchronously
+ */
+void ServiceSharedMemIPC::sendAsync(const QString& /*aRequestType*/,
+                                    const QByteArray& /*aData*/)
+{
+}
+
+/*!
+ Read all data from the buffer
+ */
+QByteArray ServiceSharedMemIPC::readAll()
+{
+    return QByteArray();
+}
+
+/*!
+ Wait for data to be available in the buffer
+ */
+bool ServiceSharedMemIPC::waitForRead()
+{
+    return false;
+}
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcclient/serviceipcsharedmem_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,51 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcsharedmem_p_h
+#define serviceipcsharedmem_p_h
+
+#include <QtCore>
+#include "serviceipc_p.h"
+
+namespace WRT {
+
+    class ServiceSharedMemIPC : public ServiceFwIPCPrivate
+    {
+    public:
+        ServiceSharedMemIPC();
+    
+        virtual ~ServiceSharedMemIPC();
+    
+    public:
+    
+        bool connect(const QString& aServerName);
+    
+        void disconnect();
+    
+        bool startServer(const QString& aServerName, const QString& aExeName);
+    
+        bool sendSync(const QString& aRequestType, const QByteArray& aData);
+    
+        void sendAsync(const QString& aRequestType, const QByteArray& aData);
+    
+        QByteArray readAll();
+    
+        bool waitForRead();
+    };
+
+}
+#endif // serviceipcsharedmem_p_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/bwins/brserviceipcserveru.def	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,32 @@
+EXPORTS
+	??0ServiceIPCRequest@WRT@@QAE@PAVServiceIPCSession@1@_JABVQString@@@Z @ 1 NONAME ; WRT::ServiceIPCRequest::ServiceIPCRequest(class WRT::ServiceIPCSession *, long long, class QString const &)
+	?stopTimer@ServiceFwIPCServer@WRT@@AAEXXZ @ 2 NONAME ; void WRT::ServiceFwIPCServer::stopTimer(void)
+	?write@ServiceIPCRequest@WRT@@QAE_NABVQByteArray@@@Z @ 3 NONAME ; bool WRT::ServiceIPCRequest::write(class QByteArray const &)
+	?startTimer@ServiceFwIPCServer@WRT@@AAEXXZ @ 4 NONAME ; void WRT::ServiceFwIPCServer::startTimer(void)
+	?sendMessage@ServiceFwIPCServer@WRT@@QAEXHAAVQByteArray@@@Z @ 5 NONAME ; void WRT::ServiceFwIPCServer::sendMessage(int, class QByteArray &)
+	?tr@ServiceFwIPCServer@WRT@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString WRT::ServiceFwIPCServer::tr(char const *, char const *, int)
+	?staticMetaObject@ServiceFwIPCServer@WRT@@2UQMetaObject@@B @ 7 NONAME ; struct QMetaObject const WRT::ServiceFwIPCServer::staticMetaObject
+	?setClientInfo@ServiceIPCRequest@WRT@@QAEXPAVClientInfo@2@@Z @ 8 NONAME ; void WRT::ServiceIPCRequest::setClientInfo(class WRT::ClientInfo *)
+	?getStaticMetaObject@ServiceFwIPCServer@WRT@@SAABUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const & WRT::ServiceFwIPCServer::getStaticMetaObject(void)
+	??1ServiceIPCRequest@WRT@@UAE@XZ @ 10 NONAME ; WRT::ServiceIPCRequest::~ServiceIPCRequest(void)
+	?metaObject@ServiceFwIPCServer@WRT@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * WRT::ServiceFwIPCServer::metaObject(void) const
+	?qt_metacall@ServiceFwIPCServer@WRT@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 12 NONAME ; int WRT::ServiceFwIPCServer::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?tr@ServiceFwIPCServer@WRT@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString WRT::ServiceFwIPCServer::tr(char const *, char const *)
+	?broadcast@ServiceFwIPCServer@WRT@@QAEXABVQByteArray@@@Z @ 14 NONAME ; void WRT::ServiceFwIPCServer::broadcast(class QByteArray const &)
+	?clientInfo@ServiceIPCRequest@WRT@@QAEPBVClientInfo@2@XZ @ 15 NONAME ; class WRT::ClientInfo const * WRT::ServiceIPCRequest::clientInfo(void)
+	??_EServiceFwIPCServer@WRT@@UAE@I@Z @ 16 NONAME ; WRT::ServiceFwIPCServer::~ServiceFwIPCServer(unsigned int)
+	?addRequestdata@ServiceIPCRequest@WRT@@QAE_NABVQByteArray@@@Z @ 17 NONAME ; bool WRT::ServiceIPCRequest::addRequestdata(class QByteArray const &)
+	??_EServiceIPCRequest@WRT@@UAE@I@Z @ 18 NONAME ; WRT::ServiceIPCRequest::~ServiceIPCRequest(unsigned int)
+	?getOperation@ServiceIPCRequest@WRT@@QAEABVQString@@XZ @ 19 NONAME ; class QString const & WRT::ServiceIPCRequest::getOperation(void)
+	?trUtf8@ServiceFwIPCServer@WRT@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString WRT::ServiceFwIPCServer::trUtf8(char const *, char const *)
+	??1ServiceFwIPCServer@WRT@@UAE@XZ @ 21 NONAME ; WRT::ServiceFwIPCServer::~ServiceFwIPCServer(void)
+	?disconnect@ServiceFwIPCServer@WRT@@QAEXXZ @ 22 NONAME ; void WRT::ServiceFwIPCServer::disconnect(void)
+	?getData@ServiceIPCRequest@WRT@@QAEABVQByteArray@@XZ @ 23 NONAME ; class QByteArray const & WRT::ServiceIPCRequest::getData(void)
+	?handleExit@ServiceFwIPCServer@WRT@@IAEXXZ @ 24 NONAME ; void WRT::ServiceFwIPCServer::handleExit(void)
+	?trUtf8@ServiceFwIPCServer@WRT@@SA?AVQString@@PBD0H@Z @ 25 NONAME ; class QString WRT::ServiceFwIPCServer::trUtf8(char const *, char const *, int)
+	??0ServiceFwIPCServer@WRT@@QAE@PAVMServiceIPCObserver@1@PAVQObject@@W4TServiceIPCBackends@1@@Z @ 26 NONAME ; WRT::ServiceFwIPCServer::ServiceFwIPCServer(class WRT::MServiceIPCObserver *, class QObject *, enum WRT::TServiceIPCBackends)
+	?qt_metacast@ServiceFwIPCServer@WRT@@UAEPAXPBD@Z @ 27 NONAME ; void * WRT::ServiceFwIPCServer::qt_metacast(char const *)
+	?configIpcServerLifetime@ServiceFwIPCServer@WRT@@QAEX_N@Z @ 28 NONAME ; void WRT::ServiceFwIPCServer::configIpcServerLifetime(bool)
+	?listen@ServiceFwIPCServer@WRT@@QAE_NABVQString@@@Z @ 29 NONAME ; bool WRT::ServiceFwIPCServer::listen(class QString const &)
+	?completeRequest@ServiceIPCRequest@WRT@@QAE_NXZ @ 30 NONAME ; bool WRT::ServiceIPCRequest::completeRequest(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/clientinfo.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,79 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef clientinfo_h
+#define clientinfo_h
+
+#include <QObject>
+#include <QString>
+
+namespace WRT {
+
+    // FORWARD DECLARATIONS
+    class ClientInfo
+    {
+    public:    
+        /*!
+         * Sets the client's name
+         * @param aName - Client's name
+         */
+        inline void setName(const QString &aName) { iName = aName; }
+
+        /*!
+         * Gets the client's name
+         */
+        inline QString name() const { return iName; }
+
+        /*!
+         * Sets the client's process Id
+         */
+        inline void setProcessId(const qint64 aProcessId) { iProcessId = aProcessId; }
+
+        /*!
+         * Gets the client's process ID
+         */
+        inline qint64 processId() const { return iProcessId; }
+
+        /*!
+         * Sets the client's vendor ID 
+         */
+        inline void setVendorId(const qint64 aVendorId) { iVendorId = aVendorId; }
+
+        /*!
+         * Gets the client's vendor ID 
+         */
+        inline qint64 vendorId() const { return iVendorId; }
+
+        /*!
+         * Set the session ID
+         */
+        inline void setSessionId( qint32 aSessionId ) { iSessionId = aSessionId; }
+        
+        /*!
+         * Get the session ID
+         */ 
+        inline qint32 sessionId() const { return iSessionId; }
+        
+    private:
+        QString iName;
+        qint64 iProcessId;
+        qint64 iVendorId;
+        qint32 iSessionId;
+    };
+}
+
+#endif //clientinfo_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/eabi/brserviceipcserveru.def	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,36 @@
+EXPORTS
+	_ZN3WRT17ServiceIPCRequest10clientInfoEv @ 1 NONAME
+	_ZN3WRT17ServiceIPCRequest12getOperationEv @ 2 NONAME
+	_ZN3WRT17ServiceIPCRequest13setClientInfoEPNS_10ClientInfoE @ 3 NONAME
+	_ZN3WRT17ServiceIPCRequest14addRequestdataERK10QByteArray @ 4 NONAME
+	_ZN3WRT17ServiceIPCRequest15completeRequestEv @ 5 NONAME
+	_ZN3WRT17ServiceIPCRequest5writeERK10QByteArray @ 6 NONAME
+	_ZN3WRT17ServiceIPCRequest7getDataEv @ 7 NONAME
+	_ZN3WRT17ServiceIPCRequestC1EPNS_17ServiceIPCSessionExRK7QString @ 8 NONAME
+	_ZN3WRT17ServiceIPCRequestC2EPNS_17ServiceIPCSessionExRK7QString @ 9 NONAME
+	_ZN3WRT17ServiceIPCRequestD0Ev @ 10 NONAME
+	_ZN3WRT17ServiceIPCRequestD1Ev @ 11 NONAME
+	_ZN3WRT17ServiceIPCRequestD2Ev @ 12 NONAME
+	_ZN3WRT18ServiceFwIPCServer10disconnectEv @ 13 NONAME
+	_ZN3WRT18ServiceFwIPCServer10handleExitEv @ 14 NONAME
+	_ZN3WRT18ServiceFwIPCServer10startTimerEv @ 15 NONAME
+	_ZN3WRT18ServiceFwIPCServer11qt_metacallEN11QMetaObject4CallEiPPv @ 16 NONAME
+	_ZN3WRT18ServiceFwIPCServer11qt_metacastEPKc @ 17 NONAME
+	_ZN3WRT18ServiceFwIPCServer11sendMessageEiR10QByteArray @ 18 NONAME
+	_ZN3WRT18ServiceFwIPCServer16staticMetaObjectE @ 19 NONAME DATA 16
+	_ZN3WRT18ServiceFwIPCServer19getStaticMetaObjectEv @ 20 NONAME
+	_ZN3WRT18ServiceFwIPCServer23configIpcServerLifetimeEb @ 21 NONAME
+	_ZN3WRT18ServiceFwIPCServer6listenERK7QString @ 22 NONAME
+	_ZN3WRT18ServiceFwIPCServer9broadcastERK10QByteArray @ 23 NONAME
+	_ZN3WRT18ServiceFwIPCServer9stopTimerEv @ 24 NONAME
+	_ZN3WRT18ServiceFwIPCServerC1EPNS_19MServiceIPCObserverEP7QObjectNS_19TServiceIPCBackendsE @ 25 NONAME
+	_ZN3WRT18ServiceFwIPCServerC2EPNS_19MServiceIPCObserverEP7QObjectNS_19TServiceIPCBackendsE @ 26 NONAME
+	_ZN3WRT18ServiceFwIPCServerD0Ev @ 27 NONAME
+	_ZN3WRT18ServiceFwIPCServerD1Ev @ 28 NONAME
+	_ZN3WRT18ServiceFwIPCServerD2Ev @ 29 NONAME
+	_ZNK3WRT18ServiceFwIPCServer10metaObjectEv @ 30 NONAME
+	_ZTIN3WRT17ServiceIPCRequestE @ 31 NONAME
+	_ZTIN3WRT18ServiceFwIPCServerE @ 32 NONAME
+	_ZTVN3WRT17ServiceIPCRequestE @ 33 NONAME
+	_ZTVN3WRT18ServiceFwIPCServerE @ 34 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/qt/serviceipclocalsocketsession.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,204 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipclocalsocketsession.h"
+#include "serviceipcobserver.h"
+#include "serviceipcrequest.h"
+#include <QtNetwork>
+#include <clientinfo.h>
+
+namespace WRT
+{
+const char KIPCSeparator = ';';
+const char* REQUEST_COMPLETE_TOKEN = ";ROK";
+
+/*!
+ \class LocalSocketSession
+ Class managing local socket server side sessions
+ */
+
+/*!
+ Destructor
+ */
+LocalSocketSession::~LocalSocketSession()
+{
+    delete m_curRequest;
+    m_curRequest = NULL;
+    if (m_clientInfo) {
+        delete m_clientInfo;
+        m_clientInfo = NULL;
+    }
+}
+
+/*!
+ Constructor
+ @param aNewSocket new socket connection to be handled
+ @param aObserver observer to the IPC module
+ */
+LocalSocketSession::LocalSocketSession(QLocalSocket* aNewSocket,
+                                       MServiceIPCObserver* aObserver) 
+    : ServiceIPCSession(aObserver)
+    , m_socket(aNewSocket)
+{
+    // Take ownership of the socket
+    m_socket->setParent(this);
+    QObject::connect(m_socket, SIGNAL( readyRead() ),
+    this, SLOT( handleRequest() ) );
+
+    QObject::connect(m_socket, SIGNAL( disconnected() ),
+    this, SLOT( handleDisconnect() ) );
+}
+
+/*!
+ Handle a new request
+ */
+void LocalSocketSession::handleRequest()
+{
+    // Process data
+    QByteArray data = m_socket->readAll();
+    // TODO: Get Client info
+    ClientInfo *client = new ClientInfo();
+
+    // New Request
+    if (!m_curRequest) {
+        // Should be very fast, the sperator is at the front
+        int separator = data.indexOf(KIPCSeparator);
+        int separator2 = data.indexOf(KIPCSeparator, separator + 1);
+
+        // How long is the data, ensure separators are found, ie valid data
+        //
+        if (separator != -1 && separator2 != -1) {
+
+            bool lengthConverted;
+            QByteArray lengthData = data.left(separator);
+            qint64 length = lengthData.toLong(&lengthConverted);
+            if (lengthConverted) {
+                // Compute the data 
+                QByteArray operation = data.mid(separator + 1, separator2
+                                - separator - 1);
+                QByteArray requestData = data.right(data.length() - separator2
+                                - 1);
+
+                // New request
+                delete m_curRequest;
+                m_curRequest = NULL;
+                m_curRequest = new ServiceIPCRequest(this, length, operation);
+
+                // Call to observer with request if the length is correct
+                // Otherwise wait until the data packet is re-assembled
+                //
+                if (m_curRequest->addRequestdata(requestData)) {
+                    client->setSessionId(m_clientInfo->sessionId());
+                    m_curRequest->setClientInfo(client); // ownership passed
+                    //m_observer->handleRequest(m_curRequest);
+                    handleReq();
+                }
+            }
+        }
+    }
+    // More data available from the buffer
+    else {
+        // If all the data has been added, call back to the observer
+        //
+        if (m_curRequest->addRequestdata(data)) {
+            m_curRequest->setClientInfo(client); // ownership passed
+            //m_observer->handleRequest(m_curRequest);
+            handleReq();
+        }
+    }
+}
+
+/*!
+ Write data to the socket to send to the client
+ @param aData data to write to the socket
+ */
+bool LocalSocketSession::write(const QByteArray& aData)
+{
+    int written = m_socket->write(aData);
+    return (written != -1);
+}
+
+/*!
+ Complete the outstanding IPC request
+ */
+bool LocalSocketSession::completeRequest()
+{
+    // Write a request complete token and wait until all data has been written to the socket
+    m_socket->write(REQUEST_COMPLETE_TOKEN);
+    bool done = m_socket->waitForBytesWritten(-1);
+    delete m_curRequest;
+    m_curRequest = NULL;
+    return done;
+}
+
+/*!
+ Handles when a client disconnect
+ This slot function is connected to the underlying QLocalSocket
+ */
+void LocalSocketSession::handleDisconnect()
+{
+    if (m_appendToBList) {
+        ((ServiceFwIPCServerLocalSocket*) parent())->removeBroadcastList(m_clientInfo->sessionId());  
+    }
+    doCancelRequest();
+
+    // Emit signal back to server to cleanup
+    emit disconnected(this);
+    
+    m_observer->handleClientDisconnect(m_clientInfo);
+    
+    ((ServiceFwIPCServerLocalSocket*) parent())->releaseSessionId(m_clientInfo->sessionId()); //release sessionId
+}
+
+/*!
+ Closes and shutsdown the local socket session
+ */
+void LocalSocketSession::close()
+{
+    doCancelRequest();
+
+    // Close the socket connection
+    m_socket->abort();
+}
+
+/*! 
+ Sends the cancel request callback to the client if a request was pending
+ */
+void LocalSocketSession::doCancelRequest()
+{
+    // If we had a request pending, make sure the client handles this
+    // gracefully
+    if (m_curRequest) {
+        // TODO: Get client info
+        ClientInfo *client = new ClientInfo();
+        m_curRequest->setClientInfo(client); // ownership passed
+        m_observer->handleCancelRequest(m_curRequest);
+        delete m_curRequest;
+        m_curRequest = NULL;
+    }
+}
+
+}
+
+/*!
+ \fn WRT::LocalSocketSession::disconnected( ServiceIPCSession* aSession )
+ 
+ Signal emitted when the session has been disconnected by the client
+ @param aSession the session that is disconnected
+ */
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/qt/serviceipclocalsocketsession.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,81 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipclocalsocketsession_h
+#define serviceipclocalsocketsession_h
+
+#include "serviceipcserversession.h"
+#include "serviceipcserverlocalsocket_p.h"
+
+class MServiceIPCObserver;
+class QLocalSocket;
+
+namespace WRT {
+    
+    class MServiceIPCObserver;
+    
+    class LocalSocketSession : public ServiceIPCSession
+    {
+    Q_OBJECT
+    public:
+    
+        virtual ~LocalSocketSession();
+    
+                        LocalSocketSession(QLocalSocket* aNewSocket,
+                                           MServiceIPCObserver* aObserver);
+    
+        // From ServiceIPCSession
+    
+        bool write(const QByteArray& aData);
+    
+        bool completeRequest();
+    
+        void close();
+        
+        inline void releaseSessionId(int aSessionId) 
+        {
+            ((ServiceFwIPCServerLocalSocket* )parent())->releaseSessionId(aSessionId);
+        };
+        
+        inline void appendBroadcastList(int aSessionId, ServiceIPCSession * aSession)
+        {
+            ((ServiceFwIPCServerLocalSocket*) parent())->appendBroadcastList(aSessionId, aSession);
+        }; 
+    
+    public slots:
+    
+        void handleRequest();
+    
+    private slots:
+    
+        void handleDisconnect();
+    
+    private:
+    
+        void doCancelRequest();
+    
+        signals:
+    
+        void disconnected(ServiceIPCSession* aSession);
+    
+    private:
+        QLocalSocket* m_socket;
+    };
+
+}
+
+#endif // serviceipclocalsocketsession_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/qt/serviceipcserverlocalsocket.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,181 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipclocalsocketsession.h"
+#include "serviceipcserverlocalsocket_p.h"
+#include "serviceipcserver.h"
+#include <QLocalSocket>
+#include <QLocalServer>
+#include <serviceipcdefs.h>
+#include <clientinfo.h>
+
+namespace WRT
+{
+/*!
+ \class ServiceFwIPCServerLocalSocket
+ Service Framework IPC Server using QLocalSocket
+ */
+
+/*!
+ Constructor
+ @param aParent parent to this object
+ */
+ServiceFwIPCServerLocalSocket::ServiceFwIPCServerLocalSocket(QObject* aParent) 
+    : QObject(aParent)
+    , m_Listener(NULL)
+{
+    m_Listener = new QLocalServer(this);
+    QObject::connect(m_Listener, SIGNAL(newConnection()),
+    this, SLOT(handleNewConnection()) );
+    m_isValidSession = true;
+    m_isKeepServer = false;
+    m_sessionIdTable = new SessionIdTable();
+}
+
+/*!
+ Destructor
+ */
+ServiceFwIPCServerLocalSocket::~ServiceFwIPCServerLocalSocket()
+{
+    m_Listener->close();
+    if(m_isValidSession){
+        char* data = (char*) m_SharedMem.data();
+        if (data) {
+            strcpy(data, SERVERNOTSTARTED);
+        }
+    }
+    m_SharedMem.detach();
+
+    delete m_sessionIdTable;
+}
+
+/*!
+ Start listening for new service requests
+ @param aServerName name of this server
+ @return true if listen was successful
+ */
+bool ServiceFwIPCServerLocalSocket::listen(const QString& aServerName)
+{
+    m_isValidSession = false; 
+    bool firstLaunch(false);
+    // Create the global chunk that this process owns
+    m_SharedMem.setKey(aServerName);
+
+    if (!m_SharedMem.attach()) {
+        // Single byte of data + \0
+        m_SharedMem.create(2);
+        firstLaunch = true;
+    }
+
+    // Initial data is 0, ie server not started
+    // Check if data is NULL, this handles the case where shared mem cannot attach or create
+    //
+    char* data = (char*) m_SharedMem.data();
+    if ((data && (strcmp(data, SERVERNOTSTARTED)==0)) || firstLaunch) {
+        strcpy(data, SERVERNOTSTARTED);
+
+        //Try to listen
+        for (int i=2; i>0; i--) {
+            m_isValidSession = m_Listener->listen(aServerName);
+            if (m_isValidSession) {
+                // Server started flag
+                strcpy(data, SERVERSTARTED);
+                break;
+            } else {
+                QLocalServer::removeServer(aServerName);        
+            }
+        }
+
+        // Signal the client to continue and that server is started
+        QSystemSemaphore sem(aServerName + SERVERSEM, 0);
+        sem.release(1);
+    }
+    return m_isValidSession;
+}
+
+/*!
+ Shutdown the server and stop serving clients 
+ @return void
+ */
+void ServiceFwIPCServerLocalSocket::disconnect()
+{
+    m_Listener->close();
+
+    // Clean up all sessions
+    int count = m_Sessions.count();
+    for (int i = 0; i < count; ++i) {
+        QObject::disconnect(m_Sessions[i], SIGNAL(disconnected( ServiceIPCSession* ) ),
+        this, SLOT( handleSessionDisconnect( ServiceIPCSession* ) ) );
+        m_Sessions[i]->close();
+        delete m_Sessions[i];
+    }
+    m_Sessions.clear();
+}
+
+/*!
+ Handle a new connection, this slot is connected to the socket's newConnection() signal
+ @return void
+ */
+void ServiceFwIPCServerLocalSocket::handleNewConnection()
+{
+    // Create a new session to host the client
+    //
+    QLocalSocket* newSocket = m_Listener->nextPendingConnection();
+    ServiceIPCSession* session = new LocalSocketSession(newSocket, Observer());
+    if (session) {
+        session->setParent(this);
+
+        QObject::connect(session, SIGNAL(disconnected( ServiceIPCSession* ) ),
+        this, SLOT( handleSessionDisconnect( ServiceIPCSession* ) ) );
+        m_Sessions.append(session);
+        stopExitTimer(); 
+
+        ClientInfo *client = new ClientInfo();
+        client->setSessionId(m_sessionIdTable->allocate());
+        session->setClientInfo(client);
+    }
+}
+
+/*!
+ Handle the end of a session
+ @param aSession session to be disconnected
+ */
+void ServiceFwIPCServerLocalSocket::handleSessionDisconnect(ServiceIPCSession* aSession)
+{
+    int c = m_Sessions.removeAll(aSession);
+
+    if ((m_Sessions.count() == 0) && (!m_isKeepServer)) {
+        startExitTimer(); 
+    }  
+
+    qDebug() << "Session cleaned up: " << c;
+}
+ 
+/*!
+ Config IPC server Life time \n
+ Start the shutdown timer if it is the last session and aKeepServer is trues.
+ @param aKeepLife to keep or disconnect IPC server when all clients are shutdown. 
+*/
+void ServiceFwIPCServerLocalSocket::configIpcServerLifetime(bool aKeepServer)
+{
+    if ((m_isKeepServer) && (m_Sessions.count() == 0) && (!aKeepServer)) {
+        startExitTimer(); 
+    }  
+    m_isKeepServer = aKeepServer;
+}
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/qt/serviceipcserverlocalsocket_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,63 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcserverlocalsocket_p_h
+#define serviceipcserverlocalsocket_p_h
+
+#include <QtCore>
+#include "serviceipcserver_p.h"
+
+class QLocalServer;
+
+namespace WRT {
+    
+    class ServiceFwIPCServer;
+    
+    class ServiceFwIPCServerLocalSocket : public QObject,
+                    public ServiceFwIPCServerPrivate
+    {
+    Q_OBJECT
+    public:
+    
+        ServiceFwIPCServerLocalSocket(QObject* aParent);
+    
+        virtual ~ServiceFwIPCServerLocalSocket();
+    
+    // Inherited from ServiceFwIPCServerPrivate
+    public:
+    
+        bool listen(const QString& aServerName);
+    
+        void disconnect();
+        
+        void configIpcServerLifetime(bool aKeepServer);
+    
+    public slots:
+    
+        void handleNewConnection();
+    
+        void handleSessionDisconnect(ServiceIPCSession* aSession);
+    
+    private:
+        QLocalServer* m_Listener;
+        QSharedMemory m_SharedMem;
+        bool m_isValidSession;
+        bool m_isKeepServer;
+    };
+
+}
+#endif // serviceipcserverlocalsocket_p_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/s60/serviceipcserversymbianserver.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,189 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipcserversymbianserver_p.h"
+#include "serviceipcserversymbiansession.h"
+#include <clientinfo.h>
+
+namespace WRT
+{
+// Server Security Policy
+const TUint KServerRangeCount = 2;
+const TInt KServerRanges[KServerRangeCount] = { 
+                0, //range is [0-1)
+                2 //range is [2-KMaxTInt] 
+                };
+const TUint8 KSeverElementsIndex[KServerRangeCount] = { 
+                0,
+                CPolicyServer::ENotSupported };
+
+const CPolicyServer::TPolicyElement KServerPolicyElements[] = { {
+                _INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData),
+                CPolicyServer::EFailClient } };
+
+const CPolicyServer::TPolicy KServerPolicy = {
+                CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass
+                KServerRangeCount, KServerRanges, KSeverElementsIndex,
+                KServerPolicyElements };
+
+enum
+{
+    EServerPriority = CActive::EPriorityStandard
+};
+
+// ======== MEMBER FUNCTIONS ========
+
+/*!
+ \class CServiceSymbianServer
+ Symbian client server implementation
+ */
+
+/*!
+ Constructor
+ */
+CServiceSymbianServer::CServiceSymbianServer() :
+    CPolicyServer(EServerPriority, KServerPolicy), m_keepServer(false)
+{
+    m_sessionIdTable = new SessionIdTable();
+}
+
+/*!
+ 2nd phased constructor
+ */
+void CServiceSymbianServer::ConstructL()
+{
+}
+
+/*!
+ Two phased constructor
+ */
+CServiceSymbianServer* CServiceSymbianServer::NewL()
+{
+    CServiceSymbianServer* self = new (ELeave) CServiceSymbianServer;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+/*!
+ Destructor
+ */
+CServiceSymbianServer::~CServiceSymbianServer()
+{
+    delete m_sessionIdTable;
+}
+
+
+/*!
+ A new session is being created \n
+ Cancel the shutdown timer if it was running
+*/
+void CServiceSymbianServer::addSession()
+
+{
+    ++m_sessionCount;
+    stopExitTimer();
+}
+
+/*!
+ A session is being destroyed \n
+ Start the shutdown timer if it is the last session.
+*/
+void CServiceSymbianServer::closeSession()
+{
+    if ((--m_sessionCount==0) && (!m_keepServer))
+    {
+        startExitTimer();
+    }
+}
+
+/*!
+ Start listening for new service requests
+ @param aServerName name of the server
+ */
+bool CServiceSymbianServer::listen(const QString& aServerName)
+{
+    bool listening(true);
+
+    // Needs to be here because Q_Ptr isonly set after constructor of public
+    m_observer = Observer();
+    TPtrC serverName(reinterpret_cast<const TUint16*> (aServerName.utf16()));
+    TRAPD( err, StartL(serverName) );
+    if (err != KErrNone) {
+        listening = false;
+    }
+    // Complete the server rendezvous that th client started
+    RProcess::Rendezvous(KErrNone);
+    return listening;
+}
+
+/*!
+ Shutdown the server and stop serving clients 
+ */
+void CServiceSymbianServer::disconnect()
+{
+    // Symbian Servers do not have disconnect, 
+    // the process has to exit
+}
+
+/*!
+ A session is being destroyed \n
+ Start the shutdown timer if it is the last session and aKeepServer is trues.
+ @param aKeepLife to keep or disconnect IPC server when all clients are shutdown. 
+*/
+void CServiceSymbianServer::configIpcServerLifetime(bool aKeepServer)
+{
+    if ((m_keepServer) && (m_sessionCount==0) && (!aKeepServer))
+    {
+        startExitTimer();
+    }
+    m_keepServer = aKeepServer;
+}
+
+/*!
+ Create a new session, derived from CPolicyServer
+ @param aVersion version of the server
+ @param aMessage message object
+ */
+CSession2* CServiceSymbianServer::NewSessionL(const TVersion& aVersion,
+                                              const RMessage2& aMessage) const
+{
+    TVersion v(1, 0, 0);
+    if (!User::QueryVersionSupported(v, aVersion)) {
+        User::Leave(KErrNotSupported);
+    }
+
+    ClientInfo *client = new ClientInfo();
+    TSecureId sid(aMessage.Identity());
+    client->setProcessId(sid.iId);
+    client->setVendorId(aMessage.VendorId().iId);
+    RThread clientThread;
+    aMessage.ClientL(clientThread);
+    RProcess clientProc;
+    clientThread.Process(clientProc);
+    client->setName(QString::fromUtf16(clientProc.Name().Ptr(), 
+                                       clientProc.Name().Length()));
+    client->setSessionId(m_sessionIdTable->allocate());
+    // Create a new Symbian Session for the client
+    CServiceSymbianSession * session = CServiceSymbianSession::NewL(m_observer);
+    session->setClientInfo(client);
+    return session;
+}
+}
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/s60/serviceipcserversymbianserver_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,70 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcserversymbianserver_p_h
+#define serviceipcserversymbianserver_p_h
+
+#include <e32base.h>
+#include <QtCore>
+#include "serviceipcserver.h"
+#include "serviceipcserver_p.h"
+
+namespace WRT {
+    class MServiceIPCObserver;
+    
+    class CServiceSymbianServer : public CPolicyServer,
+                    public ServiceFwIPCServerPrivate
+    {
+    public:
+    
+        static CServiceSymbianServer* NewL();
+    
+        virtual ~CServiceSymbianServer();
+        
+        void addSession();
+        
+        void closeSession();  
+    
+        // From ServiceFwIPCServerPrivate
+    protected:
+    
+        bool listen(const QString& aServerName);
+    
+        void disconnect();
+        
+        void configIpcServerLifetime(bool aKeepServer);
+    
+        // From CPolicyServer
+    protected:
+    
+        CSession2* NewSessionL(const TVersion& aVersion,
+                               const RMessage2& aMessage) const;
+    
+    private:
+    
+        CServiceSymbianServer();
+    
+        void ConstructL();
+    
+    private:
+        // data
+        MServiceIPCObserver* m_observer;
+        int m_sessionCount;
+        bool m_keepServer;
+    };
+}
+#endif // serviceipcserversymbianserver_p_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/s60/serviceipcserversymbiansession.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,250 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <clientinfo.h>
+#include "serviceipcobserver.h"
+#include "serviceipcrequest.h"
+#include "serviceipcserversymbiansession.h"
+
+namespace WRT
+{
+
+// Constants for the IPC operation id
+const TInt KIPCNewOperation = 0;
+const TInt KIPCGetData = 1;
+
+/*!
+ \class CServiceSymbianSession
+ Symbian Session class
+ */
+
+/*!
+ Constructor
+ @param aObserver observer to the server
+ */
+CServiceSymbianSession::CServiceSymbianSession(MServiceIPCObserver* aObserver) :
+    ServiceIPCSession(aObserver)
+{
+}
+
+/*!
+ 2nd phased constructor
+ */
+void CServiceSymbianSession::ConstructL()
+{
+}
+
+void CServiceSymbianSession::CreateL()
+{
+    Server().addSession(); 
+}
+
+/*!
+ Two-Phased Constructor
+ @param aObserver observer to the server
+ */
+CServiceSymbianSession* CServiceSymbianSession::NewL(MServiceIPCObserver* aObserver)
+{
+    CServiceSymbianSession* self =
+                    new (ELeave) CServiceSymbianSession(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+/*!
+ Destructor
+ */
+CServiceSymbianSession::~CServiceSymbianSession()
+{
+    delete m_curRequest;
+    m_curRequest = NULL;
+    if (m_clientInfo) {
+        delete m_clientInfo;
+        m_clientInfo = NULL;
+    }
+}
+
+/*!
+ Write some data in response to a request
+ @param aData some data to write as response
+ @return bool if write was successful
+ */
+bool CServiceSymbianSession::write(const QByteArray& aData)
+{
+    // Implicitly shared
+    m_data = aData;
+    return false;
+}
+
+/*!
+ Complete a Request
+ @return bool if request completed 
+ */
+bool CServiceSymbianSession::completeRequest()
+{
+
+    m_message.Complete(m_data.count());
+    delete m_curRequest;
+    m_curRequest = NULL;
+    return true;
+}
+
+/*!
+ Close a session and gracefully shutdown
+ */
+void CServiceSymbianSession::close()
+{
+    // Symbian doesn't really do anything
+}
+
+/*!
+ From CSession2
+ Service request
+ @param aMessage message object
+ */
+void CServiceSymbianSession::ServiceL(const RMessage2& aMessage)
+{
+    // Default ServiceErrorL() will complete the message if this method leaves
+    TInt operation(aMessage.Function());
+    switch (operation) {
+    case KIPCNewOperation: {
+        handleRequestL(aMessage);
+        break;
+    }
+    case KIPCGetData: {
+        handleGetBufferL(aMessage);
+        break;
+    }
+    default: {
+        aMessage.Complete(KErrNotFound);
+        break;
+    }
+    }
+}
+
+/*!
+ From CSession2
+ Handle any disconnection from the client
+ @param aMessage message Object
+ */
+void CServiceSymbianSession::Disconnect(const RMessage2 &/*aMessage*/)
+{
+    if (m_appendToBList) {
+        Server().removeBroadcastList(m_clientInfo->sessionId());  
+    }
+    m_observer->handleClientDisconnect(m_clientInfo);
+    Server().releaseSessionId(m_clientInfo->sessionId()); //release sessionId
+    if (m_curRequest) {
+        completeRequest();
+    }
+    Server().closeSession();
+}
+
+/*!
+ Handle an IPC request
+ @param aMessage message Object
+ */
+void CServiceSymbianSession::handleRequestL(const RMessage2& aMessage)
+{
+    // Store the message
+    m_message = aMessage;
+
+    // Convert from Symbian to QT
+    HBufC* request = ReadDesLC(aMessage, 0);
+    HBufC8* data = ReadDes8LC(aMessage, 1);
+
+    // Shallow copy only, we want a deep copy
+    QString d = QString::fromUtf16(request->Ptr(), request->Length());
+    QString operation;
+    operation += d;
+
+    QByteArray convertData( reinterpret_cast<const char*>(data->Ptr()), data->Length() );
+
+    // New request
+    Q_ASSERT(!m_curRequest);
+    m_curRequest = new ServiceIPCRequest(this, 0, operation);
+    m_data.clear();
+
+    // Get client info
+    ClientInfo *client = new ClientInfo();
+    TSecureId sid(aMessage.Identity());
+    client->setProcessId(sid.iId);
+    client->setVendorId(aMessage.VendorId().iId);
+    RThread clientThread;
+    aMessage.ClientL(clientThread);
+    RProcess clientProc;
+    clientThread.Process(clientProc);
+    client->setName(QString::fromUtf16(clientProc.Name().Ptr(), 
+                                       clientProc.Name().Length()));
+    client->setSessionId(m_clientInfo->sessionId());
+    // Add data and callback to the observer
+    // 
+    m_curRequest->addRequestdata(convertData);
+    m_curRequest->setClientInfo(client); // ownership passed
+    //m_observer->handleRequest(m_curRequest);
+    handleReq();
+
+    CleanupStack::PopAndDestroy(2, request);
+}
+
+/*!
+ Handle getting the result buffer
+ */
+void CServiceSymbianSession::handleGetBufferL(const RMessage2& aMessage)
+{
+    TPtrC8 data(reinterpret_cast<const TUint8*> (m_data.constData()), m_data.count());
+    aMessage.Write(0, data);
+    aMessage.Complete(KErrNone);
+}
+
+/*!
+ Read a 16 bit descriptor from the message
+ @param aMessage message to read from, 
+ @param aMsgSlot slot to read from
+ */
+HBufC* CServiceSymbianSession::ReadDesLC(const RMessage2& aMessage,
+                                         TInt aMsgSlot)
+{
+    TInt length = aMessage.GetDesLengthL(aMsgSlot);
+    HBufC* des = HBufC::NewLC(length);
+    TPtr ptr = des->Des();
+    aMessage.ReadL(aMsgSlot, ptr);
+    return des;
+}
+
+/*!
+ Read a 8 bit descriptor from the message
+ @param aMessage message to read from, 
+ @param aMsgSlot slot to read from
+ */
+HBufC8* CServiceSymbianSession::ReadDes8LC(const RMessage2& aMessage,
+                                           TInt aMsgSlot)
+{
+    TInt length = aMessage.GetDesLengthL(aMsgSlot);
+    HBufC8* des = HBufC8::NewLC(length); 
+    TPtr8 ptr = des->Des();
+    aMessage.ReadL(aMsgSlot, ptr);
+    return des;
+}
+}
+
+// END OF FILE
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/platform/s60/serviceipcserversymbiansession.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,87 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcserversymbiansession_h
+#define serviceipcserversymbiansession_h
+
+#include <e32base.h>
+#include <e32cmn.h> 
+#include "serviceipcserversession.h"
+#include "serviceipcserversymbianserver_p.h"
+
+namespace WRT {
+    class CServiceSymbianSession : public CSession2, public ServiceIPCSession
+    {
+    public:
+    
+        static CServiceSymbianSession* NewL(MServiceIPCObserver* aObserver);
+    
+        virtual ~CServiceSymbianSession();
+    
+        // From ServiceIPCSession
+    protected:
+    
+        bool write(const QByteArray& aData);
+    
+        bool completeRequest();
+    
+        void close();
+    
+        // From CSession2
+    protected:
+    
+        void CreateL();
+        
+        void ServiceL(const RMessage2& aMessage);
+    
+        void Disconnect(const RMessage2 &aMessage);
+    
+        // Service methods
+    private:
+    
+        void handleRequestL(const RMessage2& aMessage);
+    
+        void handleGetBufferL(const RMessage2& aMessage);
+    
+        HBufC* ReadDesLC(const RMessage2& aMessage, TInt aMsgSlot);
+    
+        HBufC8* ReadDes8LC(const RMessage2& aMessage, TInt aMsgSlot);
+    private:
+    
+        CServiceSymbianSession(MServiceIPCObserver* aObserver);
+    
+        void ConstructL();
+        
+        inline CServiceSymbianServer& CServiceSymbianSession::Server()
+            {return *reinterpret_cast<CServiceSymbianServer*>(const_cast<CServer2*>(CSession2::Server()));}
+    
+        inline void releaseSessionId(int aSessionId) 
+        {
+            Server().releaseSessionId(aSessionId);
+        };
+        
+        inline void appendBroadcastList(int aSessionId, ServiceIPCSession * aSession)
+        {
+            Server().appendBroadcastList(aSessionId, aSession);
+        }; 
+    private:
+        // data
+        RMessage2 m_message;
+        QByteArray m_data;
+    };
+}
+#endif // serviceipcserversymbiansession_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcobserver.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,67 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcobserver_h
+#define serviceipcobserver_h
+
+#include <QtCore>
+#include "clientinfo.h"
+
+namespace WRT {
+    
+    class ServiceIPCRequest;
+    
+    /**
+     *  Interface Observer class to handle IPC related events
+     */
+    class MServiceIPCObserver
+    {
+    public:
+    
+        /**
+         * Handle a new request 
+         * @param aRequest request object, ownership NOT passed
+         * @return bool true if handled
+         */
+        virtual bool handleRequest(ServiceIPCRequest *aRequest) = 0;
+    
+        /**
+         * Handle any cancellation of an asynchronous request.
+         * @param aRequest request object that is going to be cancelled, ownership NOT passed
+         *                 Object will be cleaned up after callback returns
+         * @return void
+         */
+        virtual void handleCancelRequest(ServiceIPCRequest *aRequest) = 0;
+        
+        /**
+        * Handle the connection of a new client to the server
+        * @param aNewClient information about the new client, including session ID
+        * @return void
+        */
+        virtual void handleClientConnect( ClientInfo *aNewClient ) = 0;
+        
+        /**
+        * Handle the disconnection of a client from the server. 
+        * This callback is called when a client disconnects (ie closes a session)
+        * @param aClient information about the client that is disconected
+        * @return void
+        */
+        virtual void handleClientDisconnect( ClientInfo *aClient ) = 0;
+    };
+
+}
+#endif // serviceipcobserver_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcrequest.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,122 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipcrequest.h"
+#include "serviceipcserversession.h"
+#include <clientinfo.h>
+
+namespace WRT
+{
+/*!
+ \class ServiceIPCRequest
+ Class to encapsulate a service request
+ */
+
+/*!
+ Constructor
+ @param aSession session associated with this request
+ @param aDataLength amount of data to be received in this request
+ @param aRequestOp operaion name
+ */
+ServiceIPCRequest::ServiceIPCRequest(ServiceIPCSession* aSession,
+                                     qint64 aDataLength,
+                                     const QString& aRequestOp) 
+    : QObject(NULL)
+    , m_Session(aSession)
+    , m_ClientInfo(NULL)
+    , m_RequestOp(aRequestOp)
+    , m_Datalength(aDataLength)
+{
+
+}
+
+/*!
+ Destructor
+ */
+ServiceIPCRequest::~ServiceIPCRequest()
+{
+    delete m_ClientInfo;
+}
+
+/*!
+ Get the requested operation
+ @return QString operation ID
+ */
+const QString& ServiceIPCRequest::getOperation()
+{
+    return m_RequestOp;
+}
+
+/*!
+ Get the requested data
+ @return QByteArray data for this operation
+ */
+const QByteArray& ServiceIPCRequest::getData()
+{
+    return m_RequestData;
+}
+
+/*!
+ Write some data to the request
+ @param aData data to write to the socket
+ */
+bool ServiceIPCRequest::write(const QByteArray& aData)
+{
+    // Do we want to buffer the writes?
+    return m_Session->write(aData);
+}
+
+/*!
+ Complete the request
+ @return true if request completed successfully
+ */
+bool ServiceIPCRequest::completeRequest()
+{
+    return m_Session->completeRequest();
+}
+
+/*!
+ Append more data when creating the request
+ @arg aMoreData data to be appended to the request
+ @return true if m_Datalength now equals the full length
+ */
+bool ServiceIPCRequest::addRequestdata(const QByteArray& aMoreData)
+{
+    m_RequestData.append(aMoreData);
+    return (m_RequestData.length() == m_Datalength);
+}
+
+/*!
+ Sets the client info.  Onwership of the object is passed in.
+ @arg aClientInfo Client information
+ */
+void ServiceIPCRequest::setClientInfo(ClientInfo *aClientInfo)
+{
+    delete m_ClientInfo;
+    m_ClientInfo = aClientInfo;
+}
+
+/*!
+ Gets the client info.
+ @return Client Information object.  NULL if none is available
+ */
+const ClientInfo *ServiceIPCRequest::clientInfo()
+{
+    return m_ClientInfo;
+}
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcrequest.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,64 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcrequest_h
+#define serviceipcrequest_h
+
+#include <QtCore>
+#include <serviceipcdefs.h>
+
+namespace WRT {
+        
+    class ServiceIPCSession;
+    class ClientInfo;
+    
+    class SFWIPCSRV_EXPORT ServiceIPCRequest : public QObject
+    {
+    public:
+        virtual ~ServiceIPCRequest();
+    
+        ServiceIPCRequest(ServiceIPCSession* aSession,
+                          qint64 aDataLength,
+                          const QString& aRequestOp);
+    
+    public:
+        // New function
+    
+        const QString& getOperation();
+    
+        const QByteArray& getData();
+    
+        bool write(const QByteArray& aData);
+    
+        bool completeRequest();
+    
+        bool addRequestdata(const QByteArray& aMoreData);
+
+        void setClientInfo(ClientInfo *aClientInfo);
+
+        const ClientInfo *clientInfo();
+    
+    private:
+        ServiceIPCSession* m_Session; // not owned
+        ClientInfo *m_ClientInfo;
+        QString m_RequestOp;
+        QByteArray m_RequestData;
+        qint64 m_Datalength;
+    };
+
+}
+#endif // serviceipcrequest_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserver.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,172 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipcserver.h"
+#include "serviceipcserver_p.h"
+#include "serviceipcserverfactory.h"
+#include "serviceipcobserver.h"
+#include "serviceipcserversession.h"
+
+namespace WRT
+{
+
+const int KServerShutdownDelay=10000;
+/*!
+ \class ServiceFwIPCServer
+ Service Framework IPC Server public class
+ */
+
+/*!
+    Constructor
+    @param aBackend backend to instantiate
+    @param aObserver engine observer to call back to handle new requests
+    @param aParent QObject's parent
+*/
+ServiceFwIPCServer::ServiceFwIPCServer( MServiceIPCObserver* aObserver, 
+                                        QObject* aParent, 
+                                        TServiceIPCBackends aBackend ) 
+    : QObject(aParent )
+    , m_Observer( aObserver )
+{
+    d = ServiceFwIPCServerFactory::createBackend( aParent,aBackend );
+    d->q = this;
+    m_Timer = new QTimer();
+    connect(m_Timer, SIGNAL(timeout()), this, SIGNAL(handleExit()));
+}
+
+/*!
+ Destructor
+ */
+ServiceFwIPCServer::~ServiceFwIPCServer()
+{
+    delete d;
+    if(m_Timer){
+        if (m_Timer->isActive()) {
+            m_Timer->stop();          
+        }
+        delete m_Timer;
+        m_Timer = NULL;
+    }
+}
+
+/*!
+ Start listening for new service requests
+ @param aServerName name of the server
+ @return bool if connected
+ */
+bool ServiceFwIPCServer::listen(const QString& aServerName)
+{
+    return d->listen(aServerName);
+}
+
+/*!
+ Shutdown the server and stop serving clients 
+ @return void
+ */
+void ServiceFwIPCServer::disconnect()
+{
+    d->disconnect();
+}
+
+/*!
+ Start the server shutdown timer
+ @return void
+ */
+void ServiceFwIPCServer::startTimer()
+{
+   if (m_Timer){        
+       m_Timer->start(KServerShutdownDelay);
+   }
+}
+
+
+/*!
+ Stop the server shutdown timer
+ @return void
+ */
+void ServiceFwIPCServer::stopTimer()
+{
+    if (m_Timer){
+        if (m_Timer->isActive()){
+            m_Timer->stop();
+        }
+    }
+}
+
+/*!
+ IPC server lifetime should be configurable 
+ @param aKeepLife to keep or disconnect IPC server when all clients are shutdown. 
+ @return void
+ */
+void ServiceFwIPCServer::configIpcServerLifetime(bool aKeepServer)
+{
+    d->configIpcServerLifetime(aKeepServer);
+}
+
+/*!
+ * Send a message to all broadcast clients connected to this server
+ * @param aMessage the contents of the message
+ */ 
+void ServiceFwIPCServer::broadcast( const QByteArray& aMessage )
+{
+    QHash<int, ServiceIPCSession*> sessions = d->getBroadcastSessions(); 
+    for (int i = 0; i < sessions.count(); ++i) {
+        ServiceIPCSession* session = sessions[i];
+        if ((session->getReadyToSend()) && (session->messageListIsEmpty())) {
+            session->write(aMessage);
+            session->completeRequest();
+            session->setReadyToSend(false);
+        }
+        else {
+            //queue the aMessage to be sent
+            session->appendMessageList(aMessage);
+        }
+    }
+}
+ 
+/*!
+ * Send a message to a particular client connected to this server
+ * @param aSessionId, id of a session to broadcast to
+ * @param aMessage the contents of the message
+ */ 
+void ServiceFwIPCServer::sendMessage( qint32 aSessionId, QByteArray& aMessage )
+{
+    QHash<int, ServiceIPCSession*> sessions = d->getBroadcastSessions(); 
+    ServiceIPCSession* session = sessions.value(aSessionId);
+    if (session != NULL) {
+        if ((session->getReadyToSend()) && (session->messageListIsEmpty())) { 
+            session->write(aMessage);
+            session->completeRequest();
+            session->setReadyToSend(false);
+        }
+        else {
+            //queue the aMessage to be sent
+            session->appendMessageList(aMessage);
+        }
+    }
+}
+                                
+}
+
+/*!
+ \fn WRT::ServiceFwIPCServer::handleExit()
+
+ Handle server shutdown\n
+ Emitted when all client sessions were closed and server should shutdown
+ @return void
+ */
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserver.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,84 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcserver_h
+#define serviceipcserver_h
+
+#include <QtCore>
+#include <serviceipcdefs.h>
+
+namespace WRT {
+    
+    // Forward Declarations
+    class ServiceFwIPCServerPrivate;
+    class MServiceIPCObserver;
+    
+    class SFWIPCSRV_EXPORT ServiceFwIPCServer : public QObject
+    {
+	 Q_OBJECT
+    public:
+    
+        ServiceFwIPCServer(MServiceIPCObserver* aObserver,
+                           QObject* aParent,
+                           TServiceIPCBackends aBackend = EDefaultIPC);
+    
+        virtual ~ServiceFwIPCServer();
+    
+    // APIs provided
+    public:
+    
+        bool listen(const QString& aServerName);
+    
+        void disconnect();
+        
+        void configIpcServerLifetime(bool aKeepServer);
+   
+        /**
+        * Send a broadcast message to all clients connected to this server
+        * @param aMessage the contents of the message
+        */ 
+        void broadcast( const QByteArray& aMessage );
+        
+        /**
+        * Send a message to a particular client connected to this server
+        * @param aSessionId, id of a session to broadcast to
+        * @param aMessage the contents of the message
+        */ 
+        void sendMessage( qint32 aSessionId, QByteArray& aMessage );
+                             
+             
+    signals:
+        void handleExit();
+        
+    private:
+        void startTimer();
+        
+        void stopTimer();
+        
+    protected:
+        // data
+        MServiceIPCObserver* m_Observer;
+        
+    private:
+        friend class ServiceFwIPCServerPrivate;
+        ServiceFwIPCServerPrivate* d;
+        QTimer *m_Timer;
+        
+    };
+
+}
+#endif // serviceipcserver_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserver.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,90 @@
+#
+# ============================================================================
+#  Name        : serviceipcserver.pro
+#  Part of     : Service Framework / IPC Server
+#  Description : Service Framework IPC
+#  Version     : %version: 1 % 
+#
+#  Copyright © 2009 Nokia.  All rights reserved.
+#  This material, including documentation and any related computer
+#  programs, is protected by copyright controlled by Nokia.  All
+#  rights are reserved.  Copying, including reproducing, storing,
+#  adapting or translating, any or all of this material requires the
+#  prior written consent of Nokia.  This material also contains
+#  confidential information which may not be disclosed to others
+#  without the prior written consent of Nokia.
+# ============================================================================
+#
+TEMPLATE = lib
+TARGET = brserviceipcserver
+QT -= gui
+
+ROOT_DIR = $$PWD/../..
+###WRT_DIR = $$ROOT_DIR/wrt
+
+###include($$WRT_DIR/cwrt.pri)
+
+#Sources
+HEADERS += serviceipcserverfactory.h \
+           serviceipcserver.h \
+           serviceipcserver_p.h \ 
+           serviceipcobserver.h \
+           serviceipcserversession.h \
+           serviceipcrequest.h \
+           sessionidtable.h
+
+SOURCES += serviceipcserverfactory.cpp \
+           serviceipcserver.cpp \
+           serviceipcserversession.cpp \
+           serviceipcrequest.cpp \
+           sessionidtable.cpp
+           
+DEFINES += QT_MAKE_IPC_SERVER_DLL
+###INCLUDEPATH += $$CWRT_INCLUDE
+
+EXPORT_FILES = serviceipcserver.h \
+    serviceipcobserver.h \
+    serviceipcserversession.h \
+    serviceipcrequest.h \
+    clientinfo.h
+
+# Symbian Specifics
+symbian {
+    TARGET.EPOCALLOWDLLDATA = 1
+    TARGET.UID3 = 0x102829E8
+    SYMBIAN_PUB_SDK = $$(SYMBIAN_PUB_SDK)
+    isEmpty(SYMBIAN_PUB_SDK) {
+        TARGET.VID = VID_DEFAULT
+    } else {
+        TARGET.VID = 0x00000000
+    }
+    TARGET.CAPABILITY = All -Tcb
+    MMP_RULES += EXPORTUNFROZEN
+
+    brserviceipcserverlibs.sources = brserviceipcserver.dll
+    brserviceipcserverlibs.path = /sys/bin
+    DEPLOYMENT += brserviceipcserverlibs
+
+    HEADERS += ./platform/s60/serviceipcserversymbianserver_p.h \
+               ./platform/s60/serviceipcserversymbiansession.h
+    SOURCES += ./platform/s60/serviceipcserversymbianserver.cpp \
+               ./platform/s60/serviceipcserversymbiansession.cpp
+
+    INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE ../serviceipcclient
+}
+else {
+# Export headers on non-symbian systems
+    QT +=network
+    #Export directory    
+###    EXPORT_DIR = $$CWRT_INCLUDE
+    
+    HEADERS += ./platform/qt/serviceipcserverlocalsocket_p.h \
+               ./platform/qt/serviceipclocalsocketsession.h
+    SOURCES += ./platform/qt/serviceipcserverlocalsocket.cpp \
+               ./platform/qt/serviceipclocalsocketsession.cpp
+    
+    INCLUDEPATH += $$PWD/platform/qt
+}
+
+###include($$WRT_DIR/cwrt-export.pri)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserver_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,133 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcserver_p_h
+#define serviceipcserver_p_h
+
+#include <QtCore>
+#include "serviceipcserver_p.h"
+#include "serviceipcserver.h"
+#include "sessionidtable.h"
+
+namespace WRT {
+    
+    class ServiceFwIPCServer;
+    class ServiceIPCSession;
+    class MServiceIPCObserver;
+    
+    /**
+     *  Private implementation interface for service framework server
+     *  This class is the abstract interface for all server backends
+     */
+    class ServiceFwIPCServerPrivate
+    {
+    public:
+        /**
+        * Virtual destructor
+        */
+        virtual ~ServiceFwIPCServerPrivate() {};
+
+    public:
+    
+        /**
+         * Start listening for new service requests
+         * @param aServerName name of the server
+         * @return true if listen was successful
+         */
+        virtual bool listen(const QString& aServerName) = 0;
+    
+        /**
+         * Shutdown the server and stop serving clients 
+         * @return void
+         */
+        virtual void disconnect() = 0;
+    
+        /**
+         * IPC server lifetime should be configurable 
+         * @param aKeepServer to keep or disconnect IPC server when all clients are shutdown.
+         * @return void
+         */
+        virtual void configIpcServerLifetime(bool aKeepServer) = 0;
+        
+        //Keep session handle at high level, platform independent.
+        inline QHash<int, ServiceIPCSession*> getBroadcastSessions() { return m_broadcastSessions; }
+        
+        
+        inline void appendBroadcastList(int aSessionId, ServiceIPCSession * aSession) 
+        { 
+            m_broadcastSessions.insert(aSessionId, aSession); 
+        };
+        
+        inline void removeBroadcastList(int aSessionId) 
+        { 
+            m_broadcastSessions.remove(aSessionId); 
+        };
+        /*
+         Release session ID from iSessionIdTable
+         @param aSession
+         */   
+        inline void releaseSessionId(int aSessionId)
+        {
+            m_sessionIdTable->release(aSessionId);
+        };
+        
+        /*
+         Allocate session ID from iSessionIdTable
+         @return new Session ID
+         */   
+        inline int allocateSessionId()
+        {
+            return m_sessionIdTable->allocate();
+        };
+    
+    protected:
+    
+        /**
+         * Get the server observer
+         * @return MServiceIPCObserver* observer to this server
+         */
+        inline MServiceIPCObserver* Observer()
+        {
+            return q->m_Observer;
+        };
+        
+        inline void startExitTimer()
+        {
+            return q->startTimer();
+        };
+        
+        inline void stopExitTimer()
+        {
+            return q->stopTimer();
+        };
+           
+    
+    protected:
+        QList<ServiceIPCSession*> m_Sessions;
+        
+        //use for broadcast message to clients
+        QHash<int, ServiceIPCSession*> m_broadcastSessions;
+        
+        SessionIdTable* m_sessionIdTable;
+    
+    private:
+        friend class ServiceFwIPCServer;
+        ServiceFwIPCServer* q;
+    };
+
+}
+#endif // serviceipcserver_p_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserverfactory.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,71 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipcserverfactory.h"
+#ifndef __SYMBIAN32__
+#include "serviceipcserverlocalsocket_p.h"
+#else 
+#include "serviceipcserversymbianserver_p.h"
+#endif // __SYMBIAN32__
+namespace WRT
+{
+
+/*!
+ \class ServiceFwIPCServerFactory
+ Factory class to construct IPC server backend
+ */
+
+/*!
+ Destructor
+ */
+ServiceFwIPCServerFactory::~ServiceFwIPCServerFactory()
+{
+}
+
+/*!
+ Constructor
+ */
+ServiceFwIPCServerFactory::ServiceFwIPCServerFactory()
+{
+}
+
+/*!
+ Construct a backend 
+ @param aBackend backend to construct
+ @param aParent parent to this QObject
+ */
+ServiceFwIPCServerPrivate* ServiceFwIPCServerFactory::createBackend(QObject* aParent,
+                                                                    TServiceIPCBackends aBackend)
+{
+    ServiceFwIPCServerPrivate* backend(NULL);
+
+#ifndef __SYMBIAN32__
+    // Local socket is default
+    if( aBackend == ELocalSocket || aBackend == EDefaultIPC )
+    {
+        backend = new ServiceFwIPCServerLocalSocket( aParent );
+    }
+#else
+    // Symbian server is default
+    if (aBackend == ESymbianServer || aBackend == EDefaultIPC) {
+        TRAP_IGNORE( backend = CServiceSymbianServer::NewL(); );
+    }
+#endif
+    return backend;
+}
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserverfactory.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,46 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcserverfactory_h
+#define serviceipcserverfactory_h
+
+#include <QtCore>
+#include <serviceipcdefs.h>
+
+namespace WRT {
+    
+    // FORWARD DECLARATIONS
+    class ServiceFwIPCServerPrivate;
+    
+    class ServiceFwIPCServerFactory
+    {
+    
+    public:
+    
+        virtual ~ServiceFwIPCServerFactory();
+    
+        ServiceFwIPCServerFactory();
+    
+    public:
+    
+        static ServiceFwIPCServerPrivate* createBackend(QObject* aParent,
+                                                        TServiceIPCBackends aBackend);
+    
+    };
+
+}
+#endif // serviceipcserverfactory_h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserversession.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,113 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "serviceipcserversession.h"
+#include "serviceipcobserver.h"
+#include "serviceipcrequest.h"
+#include "serviceipcserver_p.h"
+
+namespace WRT
+{
+/*!
+ \class ServiceIPCSession
+ Session class to hold the state of each connected client
+ */
+
+/*!
+ Constructor
+ @param aObserver observer to the session
+ */
+ServiceIPCSession::ServiceIPCSession(MServiceIPCObserver* aObserver) 
+    : m_isPendingRequest(false)
+    , m_observer(aObserver)
+    , m_curRequest(NULL)
+    , m_clientInfo(NULL)
+    , m_appendToBList(false)
+    , m_readyToSend(false)
+{
+
+}
+
+/*!
+ Destructor
+ */
+ServiceIPCSession::~ServiceIPCSession()
+{
+    m_messageList.clear();
+}
+
+
+void ServiceIPCSession::handleReq()
+{
+    if (m_curRequest->getOperation() == GETSESSIONID) {
+        QByteArray sessionId;
+        sessionId.setNum(m_clientInfo->sessionId());
+        m_curRequest->write(sessionId);
+       
+        m_curRequest->completeRequest();
+        m_observer->handleClientConnect(m_clientInfo);
+    }
+    else if (m_curRequest->getOperation() == SETSESSIONINFO) {
+        qint32 sessionId = m_curRequest->getData().toInt();
+        // release session id which allocate during new session. 
+        // 3 ipc client in one client wrapper share same session id  
+        releaseSessionId(m_clientInfo->sessionId()); 
+        m_clientInfo->setSessionId(sessionId);
+
+        m_curRequest->completeRequest();
+        m_observer->handleClientConnect(m_clientInfo);
+    }
+    else if (m_curRequest->getOperation() == SUBSCRIBEBROADCASTMSG) {
+        m_readyToSend = true;
+        if (!m_appendToBList) {
+            //add to broadcast list
+            appendBroadcastList(m_clientInfo->sessionId(), this);
+            m_appendToBList = true;
+        }
+        if (!m_messageList.isEmpty()) {
+            write(m_messageList.takeFirst());
+            completeRequest();
+            m_readyToSend = false;
+        }
+    }
+    else {
+        m_observer->handleRequest(m_curRequest);
+    }
+}
+
+/*!
+ \fn WRT::ServiceIPCSession::write( const QByteArray& aData )
+ 
+ Write some data in response to a request
+ @param aData some data to write as response
+ @return bool if write was successful
+ */
+
+/*!
+ \fn WRT::ServiceIPCSession::completeRequest()
+ 
+ Complete a Request
+ @return bool if request completed 
+ */
+
+/*!
+ \fn WRT::ServiceIPCSession::close()
+ 
+ Close a session and gracefully shutdown
+ */
+}
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/serviceipcserversession.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,83 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef serviceipcserversession_h
+#define serviceipcserversession_h
+
+#include <QtCore>
+#include "clientinfo.h"
+
+namespace WRT {
+    
+    class MServiceIPCObserver;
+    class ServiceIPCRequest;
+    
+    class ServiceIPCSession : public QObject
+    {
+    Q_OBJECT
+    public:
+    
+        ServiceIPCSession(MServiceIPCObserver* aObserver);
+    
+        virtual ~ServiceIPCSession();
+    
+        virtual bool write(const QByteArray& aData) = 0;
+    
+        virtual bool completeRequest() = 0;
+    
+        virtual void close() = 0;
+        
+        virtual void releaseSessionId(int aSessionId) = 0;
+        
+        virtual void appendBroadcastList(int aSessionId, ServiceIPCSession * aSession) = 0; 
+    
+        inline void setClientInfo(ClientInfo* aClientInfo) 
+        {
+            m_clientInfo = aClientInfo;
+        };        
+        inline bool getReadyToSend() const
+        {
+            return m_readyToSend;
+        };
+        inline void setReadyToSend(bool readyToSend) 
+        {
+            m_readyToSend = readyToSend;
+        };       
+        inline void appendMessageList(const QByteArray& aMessage) 
+        {
+            m_messageList.append(aMessage);
+        };       
+        inline bool messageListIsEmpty() const
+        {
+            return m_messageList.isEmpty();
+        };                 
+    protected:
+        void handleReq();
+    protected:
+        // data
+        bool m_isPendingRequest;
+        MServiceIPCObserver* m_observer;
+        ServiceIPCRequest* m_curRequest;
+        ClientInfo* m_clientInfo;
+        bool m_appendToBList;
+    private:
+        QList<QByteArray> m_messageList;
+        bool m_readyToSend;
+    };
+
+}
+#endif // Q_SERVICE_IPC_SESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/sessionidtable.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,75 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "sessionidtable.h"
+#include <QDebug>
+
+/*!
+ \class SessionIdTable
+ Assign unique session id for each client session
+ */
+ 
+namespace WRT
+{
+const int KSessionIdNotDefined = -1;
+/*!
+ Default constructor
+ */
+SessionIdTable::SessionIdTable()
+{
+    for ( int i = 0; i < SessionIdTableSize; i++ ) {
+        m_data[i]  = false;
+    }
+}
+
+/*!
+ Reserve a session id.
+ @return int unique session id.
+ */
+int SessionIdTable::allocate()
+{
+    int sessionId = KSessionIdNotDefined;
+
+    // Search the table for free index
+    for ( int i = 0; i < SessionIdTableSize; ++i ) {
+        if ( !m_data[i] ) {
+            m_data[i]  = true;
+            sessionId = i;
+            break;
+        }
+    }
+
+    if( sessionId == KSessionIdNotDefined ){
+        //all session id being used??
+    }
+
+    return sessionId;
+}
+
+/*!
+ Release a session id.
+ @param aSessionId session id.
+ */ 
+void SessionIdTable::release( int aSessionId ) {
+    if( !m_data[aSessionId] ) {
+        qDebug() << "release sessionid " << aSessionId; 
+    } 
+    m_data[aSessionId] = false;
+}
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/serviceipcserver/sessionidtable.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,51 @@
+/**
+   This file is part of CWRT package **
+
+   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU (Lesser) General Public License as
+   published by the Free Software Foundation, version 2.1 of the License.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   (Lesser) General Public License for more details. You should have
+   received a copy of the GNU (Lesser) General Public License along
+   with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef SESSIONIDTABLE_H
+#define SESSIONIDTABLE_H
+
+namespace WRT
+{
+// CONSTANTS
+
+const int SessionIdTableSize = 65536;
+
+// CLASS DECLARATION
+
+/*!
+* Class for acquiring session Ids.
+*
+*/
+class SessionIdTable
+{
+
+    public:
+
+        SessionIdTable();
+        
+        int allocate();
+
+        void release( int aSessionId );
+
+    private: // Data
+
+        bool m_data[SessionIdTableSize];
+
+};
+}
+#endif // SESSIONIDTABLE_H
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/standaloneallocator/CHANGELOG.txt	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,24 @@
+
+<add new entries on top>
+
+March 23, 2010:
+- Patch to remove build warnings. Code drop from Robert Katta.
+
+Feburary 25, 2010:
+- Updated code-drop from Robert Katta
+- The fast allocator version currently in cwrt trunk is the latest ‘good’ one for the purpose
+of integration with cWRT for ninetwo.
+However, there was a memory optimisation applied to the implementation of FHA in S60 webkit:
+decommitting pages that are in the middle of larger free cells in the Doug Lea arena,
+and recommitting them if required for allocation. This was shown to free significant amounts of
+unused RAM in the S60 WRT when widgets are started and stopped (as in several MB) that would
+otherwise be tied into the heap. So, this updated code base is a merge of the ‘S60 webkit’ version
+(extra memory optimisations) with the ‘Qt’ version (instantiation & tracing).
+
+January 20, 2010:
+- Initial import from Shane Kearn's code-drop
+- Roughly updated to SHA1 8c0f9e8cf7e88c69e716e8e1270092f634928e7a
+(http://scm.dev.nokia.troll.no/projects/qt/repos/qt-s60-public/commits/8c0f9e8cf7e88c69e716e8e1270092f634928e7a)
+Working branch: http://scm.dev.nokia.troll.no/projects/qt/repos/qt-s60-public/logs/new-symbian-allocator
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/standaloneallocator/README.txt	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,32 @@
+------------------------------
+This is the custom memory allocator for use with QtWebkit based killer apps for Symbian/S60. 
+------------------------------
+
+Major features: 
+- faster than Symbian RHeap. O(1) operations vs. O(n) 
+- more space efficient for smaller allocations (i.e lower system RAM usage)
+- switches at run-time between 1 of 3 allocation algorithms based on requested alloc size
+
+* How Symbian OS process startup works: 
+(from http://developer.symbian.org/wiki/index.php/Symbian_OS_Internals/3._Threads,_Processes_and_Libraries ) 
+ * Process entry point (__E32Startup) -> RunThread() -> UserHeap::SetupThreadHeap(). 
+ * SetupThreadHeap() is where we initialize our custom (heap) allocator.
+ * If this is first thread in the process, constructors for static data are called, followed by E32Main(). 
+ * If NOT first thread in process, the thread's entry point is called straight away. 
+ * NOTE: UserHeap::SetupThreadHeap() is called BEFORE static data is initialized
+ 
+ 
+Debugging support:
+
+* To use standard Symbian/S60 memory analysis tools, comment out the call to UserHeap::SetupThreadHeap() and recompile the library. 
+  Then relink your application (.exe) with the updated library. This will make RHeap your default allocator once again. 
+
+(from Shane Kearns) 
+* With a 9.4 (5.0) or later RND environment, you can use BTRACE by defining the required BTRACE macros (in the source, commented out).
+  This emits the same BTRACE entries as the default allocator, so you can do memory leak analysis using existing tools based on BTRACE.
+  For example, the promising but cancelled SAW. (which is still available inside nokia). 
+* Memory analysis tools based on dumping the heap to a file and doing post-mortem analysis won't work unless specifically designed for this allocator.
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/standaloneallocator/dla_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,1092 @@
+/****************************************************************************
+**
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+#ifndef __DLA__
+#define __DLA__
+
+#define DEFAULT_TRIM_THRESHOLD ((size_t)4U * (size_t)1024U)
+
+#define __SYMBIAN__
+#define MSPACES 0
+#define HAVE_MORECORE 1
+#define MORECORE_CONTIGUOUS 1
+#define HAVE_MMAP 0
+#define HAVE_MREMAP 0
+#define DEFAULT_GRANULARITY (4096U)
+#define FOOTERS 0
+#define USE_LOCKS 0
+#define INSECURE 1
+#define NO_MALLINFO 0
+#define HAVE_GETPAGESIZE
+
+#define LACKS_SYS_TYPES_H
+#ifndef LACKS_SYS_TYPES_H
+#include <sys/types.h>  /* For size_t */
+#else
+#ifndef _SIZE_T_DECLARED
+typedef unsigned int size_t;
+#define _SIZE_T_DECLARED
+#endif
+#endif  /* LACKS_SYS_TYPES_H */
+
+/* The maximum possible size_t value has all bits set */
+#define MAX_SIZE_T           (~(size_t)0)
+
+#ifndef ONLY_MSPACES
+    #define ONLY_MSPACES 0
+#endif  /* ONLY_MSPACES */
+
+#ifndef MSPACES
+    #if ONLY_MSPACES
+        #define MSPACES 1
+    #else   /* ONLY_MSPACES */
+        #define MSPACES 0
+    #endif  /* ONLY_MSPACES */
+#endif  /* MSPACES */
+
+#ifndef MALLOC_ALIGNMENT
+    #define MALLOC_ALIGNMENT ((size_t)8U)
+#endif  /* MALLOC_ALIGNMENT */
+
+#ifndef FOOTERS
+    #define FOOTERS 0
+#endif  /* FOOTERS */
+
+#ifndef ABORT
+//  #define ABORT  abort()
+    #define ABORT  User::Invariant()// redefined so euser isn't dependant on oe
+#endif  /* ABORT */
+
+#ifndef ABORT_ON_ASSERT_FAILURE
+    #define ABORT_ON_ASSERT_FAILURE 1
+#endif  /* ABORT_ON_ASSERT_FAILURE */
+
+#ifndef PROCEED_ON_ERROR
+    #define PROCEED_ON_ERROR 0
+#endif  /* PROCEED_ON_ERROR */
+
+#ifndef USE_LOCKS
+    #define USE_LOCKS 0
+#endif  /* USE_LOCKS */
+
+#ifndef INSECURE
+    #define INSECURE 0
+#endif  /* INSECURE */
+
+#ifndef HAVE_MMAP
+    #define HAVE_MMAP 1
+#endif  /* HAVE_MMAP */
+
+#ifndef MMAP_CLEARS
+    #define MMAP_CLEARS 1
+#endif  /* MMAP_CLEARS */
+
+#ifndef HAVE_MREMAP
+    #ifdef linux
+        #define HAVE_MREMAP 1
+    #else   /* linux */
+        #define HAVE_MREMAP 0
+    #endif  /* linux */
+#endif  /* HAVE_MREMAP */
+
+#ifndef MALLOC_FAILURE_ACTION
+    //#define MALLOC_FAILURE_ACTION  errno = ENOMEM;
+    #define MALLOC_FAILURE_ACTION ;
+#endif  /* MALLOC_FAILURE_ACTION */
+
+#ifndef HAVE_MORECORE
+    #if ONLY_MSPACES
+        #define HAVE_MORECORE 1 /*AMOD: has changed */
+    #else   /* ONLY_MSPACES */
+        #define HAVE_MORECORE 1
+    #endif  /* ONLY_MSPACES */
+#endif  /* HAVE_MORECORE */
+
+#if !HAVE_MORECORE
+    #define MORECORE_CONTIGUOUS 0
+#else   /* !HAVE_MORECORE */
+    #ifndef MORECORE
+        #define MORECORE DLAdjust
+    #endif  /* MORECORE */
+    #ifndef MORECORE_CONTIGUOUS
+        #define MORECORE_CONTIGUOUS 0
+    #endif  /* MORECORE_CONTIGUOUS */
+#endif  /* !HAVE_MORECORE */
+
+#ifndef DEFAULT_GRANULARITY
+    #if MORECORE_CONTIGUOUS
+        #define DEFAULT_GRANULARITY 4096  /* 0 means to compute in init_mparams */
+    #else   /* MORECORE_CONTIGUOUS */
+        #define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
+    #endif  /* MORECORE_CONTIGUOUS */
+#endif  /* DEFAULT_GRANULARITY */
+
+#ifndef DEFAULT_TRIM_THRESHOLD
+    #ifndef MORECORE_CANNOT_TRIM
+        #define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
+    #else   /* MORECORE_CANNOT_TRIM */
+        #define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
+    #endif  /* MORECORE_CANNOT_TRIM */
+#endif  /* DEFAULT_TRIM_THRESHOLD */
+
+#ifndef DEFAULT_MMAP_THRESHOLD
+    #if HAVE_MMAP
+        #define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
+    #else   /* HAVE_MMAP */
+        #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
+    #endif  /* HAVE_MMAP */
+#endif  /* DEFAULT_MMAP_THRESHOLD */
+
+#ifndef USE_BUILTIN_FFS
+    #define USE_BUILTIN_FFS 0
+#endif  /* USE_BUILTIN_FFS */
+
+#ifndef USE_DEV_RANDOM
+    #define USE_DEV_RANDOM 0
+#endif  /* USE_DEV_RANDOM */
+
+#ifndef NO_MALLINFO
+    #define NO_MALLINFO 0
+#endif  /* NO_MALLINFO */
+#ifndef MALLINFO_FIELD_TYPE
+    #define MALLINFO_FIELD_TYPE size_t
+#endif  /* MALLINFO_FIELD_TYPE */
+
+/*
+  mallopt tuning options.  SVID/XPG defines four standard parameter
+  numbers for mallopt, normally defined in malloc.h.  None of these
+  are used in this malloc, so setting them has no effect. But this
+  malloc does support the following options.
+*/
+
+#define M_TRIM_THRESHOLD     (-1)
+#define M_GRANULARITY        (-2)
+#define M_MMAP_THRESHOLD     (-3)
+
+#if !NO_MALLINFO
+/*
+  This version of malloc supports the standard SVID/XPG mallinfo
+  routine that returns a struct containing usage properties and
+  statistics. It should work on any system that has a
+  /usr/include/malloc.h defining struct mallinfo.  The main
+  declaration needed is the mallinfo struct that is returned (by-copy)
+  by mallinfo().  The malloinfo struct contains a bunch of fields that
+  are not even meaningful in this version of malloc.  These fields are
+  are instead filled by mallinfo() with other numbers that might be of
+  interest.
+
+  HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
+  /usr/include/malloc.h file that includes a declaration of struct
+  mallinfo.  If so, it is included; else a compliant version is
+  declared below.  These must be precisely the same for mallinfo() to
+  work.  The original SVID version of this struct, defined on most
+  systems with mallinfo, declares all fields as ints. But some others
+  define as unsigned long. If your system defines the fields using a
+  type of different width than listed here, you MUST #include your
+  system version and #define HAVE_USR_INCLUDE_MALLOC_H.
+*/
+
+/* #define HAVE_USR_INCLUDE_MALLOC_H */
+
+#ifdef HAVE_USR_INCLUDE_MALLOC_H
+#include "/usr/include/malloc.h"
+#else /* HAVE_USR_INCLUDE_MALLOC_H */
+
+struct mallinfo {
+  MALLINFO_FIELD_TYPE arena;    /* non-mmapped space allocated from system */
+  MALLINFO_FIELD_TYPE ordblks;  /* number of free chunks */
+  MALLINFO_FIELD_TYPE smblks;   /* always 0 */
+  MALLINFO_FIELD_TYPE hblks;    /* always 0 */
+  MALLINFO_FIELD_TYPE hblkhd;   /* space in mmapped regions */
+  MALLINFO_FIELD_TYPE usmblks;  /* maximum total allocated space */
+  MALLINFO_FIELD_TYPE fsmblks;  /* always 0 */
+  MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
+  MALLINFO_FIELD_TYPE fordblks; /* total free space */
+  MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
+  MALLINFO_FIELD_TYPE cellCount;/* Number of chunks allocated*/
+  MALLINFO_FIELD_TYPE largestBlock;
+};
+
+#endif /* HAVE_USR_INCLUDE_MALLOC_H */
+#endif /* NO_MALLINFO */
+
+#if MSPACES
+    typedef void* mspace;
+#endif /* MSPACES */
+
+#ifndef __SYMBIAN__
+
+#include <stdio.h>/* for printing in malloc_stats */
+
+#ifndef LACKS_ERRNO_H
+    #include <errno.h>       /* for MALLOC_FAILURE_ACTION */
+#endif /* LACKS_ERRNO_H */
+
+#if FOOTERS
+    #include <time.h>        /* for magic initialization */
+#endif /* FOOTERS */
+
+#ifndef LACKS_STDLIB_H
+    #include <stdlib.h>      /* for abort() */
+#endif /* LACKS_STDLIB_H */
+
+#ifdef DEBUG
+    #if ABORT_ON_ASSERT_FAILURE
+        #define assert(x) if (!(x)) ABORT
+    #else /* ABORT_ON_ASSERT_FAILURE */
+        #include <assert.h>
+    #endif /* ABORT_ON_ASSERT_FAILURE */
+#else  /* DEBUG */
+        #define assert(x)
+#endif /* DEBUG */
+
+#ifndef LACKS_STRING_H
+    #include <string.h>      /* for memset etc */
+#endif  /* LACKS_STRING_H */
+
+#if USE_BUILTIN_FFS
+    #ifndef LACKS_STRINGS_H
+        #include <strings.h>     /* for ffs */
+    #endif /* LACKS_STRINGS_H */
+#endif /* USE_BUILTIN_FFS */
+
+#if HAVE_MMAP
+    #ifndef LACKS_SYS_MMAN_H
+        #include <sys/mman.h>    /* for mmap */
+    #endif /* LACKS_SYS_MMAN_H */
+    #ifndef LACKS_FCNTL_H
+        #include <fcntl.h>
+    #endif /* LACKS_FCNTL_H */
+#endif /* HAVE_MMAP */
+
+#if HAVE_MORECORE
+    #ifndef LACKS_UNISTD_H
+        #include <unistd.h>     /* for sbrk */
+    extern void*     sbrk(size_t);
+    #else /* LACKS_UNISTD_H */
+        #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+            extern void*     sbrk(ptrdiff_t);
+            /*Amod sbrk is not defined in WIN32 need to check in symbian*/
+        #endif /* FreeBSD etc */
+    #endif /* LACKS_UNISTD_H */
+#endif /* HAVE_MORECORE */
+
+#endif
+
+#define assert(x)   ASSERT(x)
+
+#ifndef WIN32
+    #ifndef malloc_getpagesize
+        #ifdef _SC_PAGESIZE         /* some SVR4 systems omit an underscore */
+            #ifndef _SC_PAGE_SIZE
+                #define _SC_PAGE_SIZE _SC_PAGESIZE
+            #endif
+        #endif
+        #ifdef _SC_PAGE_SIZE
+            #define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
+        #else
+            #if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
+                extern size_t getpagesize();
+                #define malloc_getpagesize getpagesize()
+            #else
+                #ifdef WIN32 /* use supplied emulation of getpagesize */
+                    #define malloc_getpagesize getpagesize()
+                #else
+                    #ifndef LACKS_SYS_PARAM_H
+                        #include <sys/param.h>
+                    #endif
+                    #ifdef EXEC_PAGESIZE
+                        #define malloc_getpagesize EXEC_PAGESIZE
+                    #else
+                        #ifdef NBPG
+                            #ifndef CLSIZE
+                                #define malloc_getpagesize NBPG
+                            #else
+                                #define malloc_getpagesize (NBPG * CLSIZE)
+                            #endif
+                        #else
+                            #ifdef NBPC
+                                #define malloc_getpagesize NBPC
+                            #else
+                                #ifdef PAGESIZE
+                                    #define malloc_getpagesize PAGESIZE
+                                #else /* just guess */
+                                    #define malloc_getpagesize ((size_t)4096U)
+                                #endif
+                            #endif
+                        #endif
+                    #endif
+                #endif
+            #endif
+        #endif
+    #endif
+#endif
+
+/* ------------------- size_t and alignment properties -------------------- */
+
+/* The byte and bit size of a size_t */
+#define SIZE_T_SIZE         (sizeof(size_t))
+#define SIZE_T_BITSIZE      (sizeof(size_t) << 3)
+
+/* Some constants coerced to size_t */
+/* Annoying but necessary to avoid errors on some plaftorms */
+#define SIZE_T_ZERO         ((size_t)0)
+#define SIZE_T_ONE          ((size_t)1)
+#define SIZE_T_TWO          ((size_t)2)
+#define TWO_SIZE_T_SIZES    (SIZE_T_SIZE<<1)
+#define FOUR_SIZE_T_SIZES   (SIZE_T_SIZE<<2)
+#define SIX_SIZE_T_SIZES    (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
+#define HALF_MAX_SIZE_T     (MAX_SIZE_T / 2U)
+
+/* The bit mask value corresponding to MALLOC_ALIGNMENT */
+#define CHUNK_ALIGN_MASK    (MALLOC_ALIGNMENT - SIZE_T_ONE)
+
+/* True if address a has acceptable alignment */
+//#define is_aligned(A)       (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
+#define is_aligned(A)       (((unsigned int)((A)) & (CHUNK_ALIGN_MASK)) == 0)
+
+/* the number of bytes to offset an address to align it */
+#define align_offset(A)\
+    ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
+    ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
+
+/* -------------------------- MMAP preliminaries ------------------------- */
+
+/*
+   If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and
+   checks to fail so compiler optimizer can delete code rather than
+   using so many "#if"s.
+*/
+
+
+/* MORECORE and MMAP must return MFAIL on failure */
+#define MFAIL                ((void*)(MAX_SIZE_T))
+#define CMFAIL               ((TUint8*)(MFAIL)) /* defined for convenience */
+
+#if !HAVE_MMAP
+    #define IS_MMAPPED_BIT       (SIZE_T_ZERO)
+    #define USE_MMAP_BIT         (SIZE_T_ZERO)
+    #define CALL_MMAP(s)         MFAIL
+    #define CALL_MUNMAP(a, s)    (-1)
+    #define DIRECT_MMAP(s)       MFAIL
+#else /* !HAVE_MMAP */
+    #define IS_MMAPPED_BIT       (SIZE_T_ONE)
+    #define USE_MMAP_BIT         (SIZE_T_ONE)
+        #ifndef WIN32
+            #define CALL_MUNMAP(a, s)    DLUMMAP((a),(s)) /*munmap((a), (s))*/
+            #define MMAP_PROT            (PROT_READ|PROT_WRITE)
+            #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+                #define MAP_ANONYMOUS        MAP_ANON
+            #endif /* MAP_ANON */
+            #ifdef MAP_ANONYMOUS
+                #define MMAP_FLAGS           (MAP_PRIVATE|MAP_ANONYMOUS)
+                #define CALL_MMAP(s)         mmap(0, (s), MMAP_PROT, (int)MMAP_FLAGS, -1, 0)
+            #else /* MAP_ANONYMOUS */
+                /*
+                   Nearly all versions of mmap support MAP_ANONYMOUS, so the following
+                   is unlikely to be needed, but is supplied just in case.
+                */
+                #define MMAP_FLAGS           (MAP_PRIVATE)
+                //static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
+                #define CALL_MMAP(s) DLMMAP(s)
+                /*#define CALL_MMAP(s) ((dev_zero_fd < 0) ? \
+                       (dev_zero_fd = open("/dev/zero", O_RDWR), \
+                        mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
+                        mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
+                        */
+                #define CALL_REMAP(a, s, d)    DLREMAP((a),(s),(d))
+            #endif /* MAP_ANONYMOUS */
+            #define DIRECT_MMAP(s)       CALL_MMAP(s)
+        #else /* WIN32 */
+            #define CALL_MMAP(s)         win32mmap(s)
+            #define CALL_MUNMAP(a, s)    win32munmap((a), (s))
+            #define DIRECT_MMAP(s)       win32direct_mmap(s)
+        #endif /* WIN32 */
+#endif /* HAVE_MMAP */
+
+#if HAVE_MMAP && HAVE_MREMAP
+    #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#else  /* HAVE_MMAP && HAVE_MREMAP */
+    #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
+#endif /* HAVE_MMAP && HAVE_MREMAP */
+
+#if HAVE_MORECORE
+    #define CALL_MORECORE(S)     SetBrk(S)
+#else  /* HAVE_MORECORE */
+    #define CALL_MORECORE(S)     MFAIL
+#endif /* HAVE_MORECORE */
+
+/* mstate bit set if continguous morecore disabled or failed */
+#define USE_NONCONTIGUOUS_BIT (4U)
+
+/* segment bit set in create_mspace_with_base */
+#define EXTERN_BIT            (8U)
+
+
+#if USE_LOCKS
+/*
+  When locks are defined, there are up to two global locks:
+  * If HAVE_MORECORE, morecore_mutex protects sequences of calls to
+    MORECORE.  In many cases sys_alloc requires two calls, that should
+    not be interleaved with calls by other threads.  This does not
+    protect against direct calls to MORECORE by other threads not
+    using this lock, so there is still code to cope the best we can on
+    interference.
+  * magic_init_mutex ensures that mparams.magic and other
+    unique mparams values are initialized only once.
+*/
+    #ifndef WIN32
+        /* By default use posix locks */
+        #include <pthread.h>
+        #define MLOCK_T pthread_mutex_t
+        #define INITIAL_LOCK(l)      pthread_mutex_init(l, NULL)
+        #define ACQUIRE_LOCK(l)      pthread_mutex_lock(l)
+        #define RELEASE_LOCK(l)      pthread_mutex_unlock(l)
+
+        #if HAVE_MORECORE
+            //static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER;
+        #endif /* HAVE_MORECORE */
+            //static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+    #else /* WIN32 */
+        #define MLOCK_T long
+        #define INITIAL_LOCK(l)      *(l)=0
+        #define ACQUIRE_LOCK(l)      win32_acquire_lock(l)
+        #define RELEASE_LOCK(l)      win32_release_lock(l)
+        #if HAVE_MORECORE
+            static MLOCK_T morecore_mutex;
+        #endif /* HAVE_MORECORE */
+        static MLOCK_T magic_init_mutex;
+    #endif /* WIN32 */
+    #define USE_LOCK_BIT               (2U)
+#else  /* USE_LOCKS */
+    #define USE_LOCK_BIT               (0U)
+    #define INITIAL_LOCK(l)
+#endif /* USE_LOCKS */
+
+#if USE_LOCKS && HAVE_MORECORE
+    #define ACQUIRE_MORECORE_LOCK(M)    ACQUIRE_LOCK((M->morecore_mutex)/*&morecore_mutex*/);
+    #define RELEASE_MORECORE_LOCK(M)    RELEASE_LOCK((M->morecore_mutex)/*&morecore_mutex*/);
+#else /* USE_LOCKS && HAVE_MORECORE */
+    #define ACQUIRE_MORECORE_LOCK(M)
+    #define RELEASE_MORECORE_LOCK(M)
+#endif /* USE_LOCKS && HAVE_MORECORE */
+
+#if USE_LOCKS
+        /*Currently not suporting this*/
+    #define ACQUIRE_MAGIC_INIT_LOCK(M)  ACQUIRE_LOCK(((M)->magic_init_mutex));
+    //AMOD: changed #define ACQUIRE_MAGIC_INIT_LOCK()
+    //#define RELEASE_MAGIC_INIT_LOCK()
+    #define RELEASE_MAGIC_INIT_LOCK(M)  RELEASE_LOCK(((M)->magic_init_mutex));
+#else  /* USE_LOCKS */
+    #define ACQUIRE_MAGIC_INIT_LOCK(M)
+    #define RELEASE_MAGIC_INIT_LOCK(M)
+#endif /* USE_LOCKS */
+
+/*CHUNK representation*/
+struct malloc_chunk {
+  size_t               prev_foot;  /* Size of previous chunk (if free).  */
+  size_t               head;       /* Size and inuse bits. */
+  struct malloc_chunk* fd;         /* double links -- used only if free. */
+  struct malloc_chunk* bk;
+};
+
+typedef struct malloc_chunk  mchunk;
+typedef struct malloc_chunk* mchunkptr;
+typedef struct malloc_chunk* sbinptr;  /* The type of bins of chunks */
+typedef unsigned int bindex_t;         /* Described below */
+typedef unsigned int binmap_t;         /* Described below */
+typedef unsigned int flag_t;           /* The type of various bit flag sets */
+
+
+/* ------------------- Chunks sizes and alignments ----------------------- */
+#define MCHUNK_SIZE         (sizeof(mchunk))
+
+#if FOOTERS
+    #define CHUNK_OVERHEAD      (TWO_SIZE_T_SIZES)
+#else /* FOOTERS */
+    #define CHUNK_OVERHEAD      (SIZE_T_SIZE)
+#endif /* FOOTERS */
+
+/* MMapped chunks need a second word of overhead ... */
+#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
+/* ... and additional padding for fake next-chunk at foot */
+#define MMAP_FOOT_PAD       (FOUR_SIZE_T_SIZES)
+
+/* The smallest size we can malloc is an aligned minimal chunk */
+#define MIN_CHUNK_SIZE ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* conversion from malloc headers to user pointers, and back */
+#define chunk2mem(p)        ((void*)((TUint8*)(p)       + TWO_SIZE_T_SIZES))
+#define mem2chunk(mem)      ((mchunkptr)((TUint8*)(mem) - TWO_SIZE_T_SIZES))
+/* chunk associated with aligned address A */
+#define align_as_chunk(A)   (mchunkptr)((A) + align_offset(chunk2mem(A)))
+
+/* Bounds on request (not chunk) sizes. */
+#define MAX_REQUEST         ((-MIN_CHUNK_SIZE) << 2)
+#define MIN_REQUEST         (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
+
+/* pad request bytes into a usable size */
+#define pad_request(req) (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* pad request, checking for minimum (but not maximum) */
+#define request2size(req) (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
+
+/* ------------------ Operations on head and foot fields ----------------- */
+
+/*
+  The head field of a chunk is or'ed with PINUSE_BIT when previous
+  adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in
+  use. If the chunk was obtained with mmap, the prev_foot field has
+  IS_MMAPPED_BIT set, otherwise holding the offset of the base of the
+  mmapped region to the base of the chunk.
+*/
+#define PINUSE_BIT          (SIZE_T_ONE)
+#define CINUSE_BIT          (SIZE_T_TWO)
+#define INUSE_BITS          (PINUSE_BIT|CINUSE_BIT)
+
+/* Head value for fenceposts */
+#define FENCEPOST_HEAD      (INUSE_BITS|SIZE_T_SIZE)
+
+/* extraction of fields from head words */
+#define cinuse(p)           ((p)->head & CINUSE_BIT)
+#define pinuse(p)           ((p)->head & PINUSE_BIT)
+#define chunksize(p)        ((p)->head & ~(INUSE_BITS))
+
+#define clear_pinuse(p)     ((p)->head &= ~PINUSE_BIT)
+#define clear_cinuse(p)     ((p)->head &= ~CINUSE_BIT)
+
+/* Treat space at ptr +/- offset as a chunk */
+#define chunk_plus_offset(p, s)  ((mchunkptr)(((TUint8*)(p)) + (s)))
+#define chunk_minus_offset(p, s) ((mchunkptr)(((TUint8*)(p)) - (s)))
+
+/* Ptr to next or previous physical malloc_chunk. */
+#define next_chunk(p) ((mchunkptr)( ((TUint8*)(p)) + ((p)->head & ~INUSE_BITS)))
+#define prev_chunk(p) ((mchunkptr)( ((TUint8*)(p)) - ((p)->prev_foot) ))
+
+/* extract next chunk's pinuse bit */
+#define next_pinuse(p)  ((next_chunk(p)->head) & PINUSE_BIT)
+
+/* Get/set size at footer */
+#define get_foot(p, s)  (((mchunkptr)((TUint8*)(p) + (s)))->prev_foot)
+#define set_foot(p, s)  (((mchunkptr)((TUint8*)(p) + (s)))->prev_foot = (s))
+
+/* Set size, pinuse bit, and foot */
+#define set_size_and_pinuse_of_free_chunk(p, s) ((p)->head = (s|PINUSE_BIT), set_foot(p, s))
+
+/* Set size, pinuse bit, foot, and clear next pinuse */
+#define set_free_with_pinuse(p, s, n) (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
+
+#define is_mmapped(p) (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT))
+
+/* Get the internal overhead associated with chunk p */
+#define overhead_for(p) (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
+
+/* Return true if malloced space is not necessarily cleared */
+#if MMAP_CLEARS
+    #define calloc_must_clear(p) (!is_mmapped(p))
+#else /* MMAP_CLEARS */
+    #define calloc_must_clear(p) (1)
+#endif /* MMAP_CLEARS */
+
+/* ---------------------- Overlaid data structures ----------------------- */
+struct malloc_tree_chunk {
+  /* The first four fields must be compatible with malloc_chunk */
+  size_t                                    prev_foot;
+  size_t                                    head;
+  struct malloc_tree_chunk* fd;
+  struct malloc_tree_chunk* bk;
+
+  struct malloc_tree_chunk* child[2];
+  struct malloc_tree_chunk* parent;
+  bindex_t                  index;
+  size_t            pageout;  /* chunk pageout flag  */
+  size_t            npages;   /* chunk pageout size */
+};
+
+typedef struct malloc_tree_chunk  tchunk;
+typedef struct malloc_tree_chunk* tchunkptr;
+typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */
+
+/* A little helper macro for trees */
+#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
+/*Segment structur*/
+struct malloc_segment {
+  TUint8*        base;             /* base address */
+  size_t       size;             /* allocated size */
+  struct malloc_segment* next;   /* ptr to next segment */
+  flag_t       sflags;           /* mmap and extern flag */
+};
+
+#define is_mmapped_segment(S)  ((S)->sflags & IS_MMAPPED_BIT)
+#define is_extern_segment(S)   ((S)->sflags & EXTERN_BIT)
+
+typedef struct malloc_segment  msegment;
+typedef struct malloc_segment* msegmentptr;
+
+/*Malloc State data structur*/
+
+#define NSMALLBINS        (32U)
+#define NTREEBINS         (32U)
+#define SMALLBIN_SHIFT    (3U)
+#define SMALLBIN_WIDTH    (SIZE_T_ONE << SMALLBIN_SHIFT)
+#define TREEBIN_SHIFT     (8U)
+#define MIN_LARGE_SIZE    (SIZE_T_ONE << TREEBIN_SHIFT)
+#define MAX_SMALL_SIZE    (MIN_LARGE_SIZE - SIZE_T_ONE)
+#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
+
+struct malloc_state {
+  binmap_t   smallmap;
+  binmap_t   treemap;
+  size_t     dvsize; // unused
+  size_t     topsize;
+  TUint8*      least_addr;
+  mchunkptr  dv; // unused
+  mchunkptr  top;
+  size_t     trim_check;
+  size_t     magic;
+  mchunkptr  smallbins[(NSMALLBINS+1)*2];
+  tbinptr    treebins[NTREEBINS];
+  size_t     footprint;
+  size_t     max_footprint;
+  flag_t     mflags;
+#if USE_LOCKS
+  MLOCK_T    mutex;     /* locate lock among fields that rarely change */
+  MLOCK_T   magic_init_mutex;
+  MLOCK_T   morecore_mutex;
+#endif /* USE_LOCKS */
+  msegment   seg;
+};
+
+typedef struct malloc_state*    mstate;
+
+/* ------------- Global malloc_state and malloc_params ------------------- */
+
+/*
+  malloc_params holds global properties, including those that can be
+  dynamically set using mallopt. There is a single instance, mparams,
+  initialized in init_mparams.
+*/
+
+struct malloc_params {
+  size_t magic;
+  size_t page_size;
+  size_t granularity;
+  size_t mmap_threshold;
+  size_t trim_threshold;
+  flag_t default_mflags;
+#if USE_LOCKS
+  MLOCK_T   magic_init_mutex;
+#endif /* USE_LOCKS */
+};
+
+/* The global malloc_state used for all non-"mspace" calls */
+/*AMOD: Need to check this as this will be the member of the class*/
+
+//static struct malloc_state _gm_;
+//#define gm                 (&_gm_)
+
+//#define is_global(M)       ((M) == &_gm_)
+/*AMOD: has changed*/
+#define is_global(M)       ((M) == gm)
+#define is_initialized(M)  ((M)->top != 0)
+
+/* -------------------------- system alloc setup ------------------------- */
+
+/* Operations on mflags */
+
+#define use_lock(M)           ((M)->mflags &   USE_LOCK_BIT)
+#define enable_lock(M)        ((M)->mflags |=  USE_LOCK_BIT)
+#define disable_lock(M)       ((M)->mflags &= ~USE_LOCK_BIT)
+
+#define use_mmap(M)           ((M)->mflags &   USE_MMAP_BIT)
+#define enable_mmap(M)        ((M)->mflags |=  USE_MMAP_BIT)
+#define disable_mmap(M)       ((M)->mflags &= ~USE_MMAP_BIT)
+
+#define use_noncontiguous(M)  ((M)->mflags &   USE_NONCONTIGUOUS_BIT)
+#define disable_contiguous(M) ((M)->mflags |=  USE_NONCONTIGUOUS_BIT)
+
+#define set_lock(M,L) ((M)->mflags = (L)? ((M)->mflags | USE_LOCK_BIT) :  ((M)->mflags & ~USE_LOCK_BIT))
+
+/* page-align a size */
+#define page_align(S) (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE))
+
+/* granularity-align a size */
+#define granularity_align(S)  (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE))
+
+#define is_page_aligned(S)   (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
+#define is_granularity_aligned(S)   (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
+
+/*  True if segment S holds address A */
+#define segment_holds(S, A)  ((TUint8*)(A) >= S->base && (TUint8*)(A) < S->base + S->size)
+
+#ifndef MORECORE_CANNOT_TRIM
+    #define should_trim(M,s)  ((s) > (M)->trim_check)
+#else  /* MORECORE_CANNOT_TRIM */
+    #define should_trim(M,s)  (0)
+#endif /* MORECORE_CANNOT_TRIM */
+
+/*
+  TOP_FOOT_SIZE is padding at the end of a segment, including space
+  that may be needed to place segment records and fenceposts when new
+  noncontiguous segments are added.
+*/
+#define TOP_FOOT_SIZE  (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
+
+/* -------------------------------  Hooks -------------------------------- */
+
+/*
+  PREACTION should be defined to return 0 on success, and nonzero on
+  failure. If you are not using locking, you can redefine these to do
+  anything you like.
+*/
+
+#if USE_LOCKS
+    /* Ensure locks are initialized */
+    #define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams())
+    #define PREACTION(M) (use_lock((M))?(ACQUIRE_LOCK((M)->mutex),0):0) /*Action to take like lock before alloc*/
+    #define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK((M)->mutex); }
+
+#else /* USE_LOCKS */
+    #ifndef PREACTION
+        #define PREACTION(M) (0)
+    #endif  /* PREACTION */
+    #ifndef POSTACTION
+        #define POSTACTION(M)
+    #endif  /* POSTACTION */
+#endif /* USE_LOCKS */
+
+/*
+  CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses.
+  USAGE_ERROR_ACTION is triggered on detected bad frees and
+  reallocs. The argument p is an address that might have triggered the
+  fault. It is ignored by the two predefined actions, but might be
+  useful in custom actions that try to help diagnose errors.
+*/
+
+#if PROCEED_ON_ERROR
+    /* A count of the number of corruption errors causing resets */
+    int malloc_corruption_error_count;
+    /* default corruption action */
+    static void reset_on_error(mstate m);
+    #define CORRUPTION_ERROR_ACTION(m)  reset_on_error(m)
+    #define USAGE_ERROR_ACTION(m, p)
+#else /* PROCEED_ON_ERROR */
+    #ifndef CORRUPTION_ERROR_ACTION
+        #define CORRUPTION_ERROR_ACTION(m) ABORT
+    #endif /* CORRUPTION_ERROR_ACTION */
+    #ifndef USAGE_ERROR_ACTION
+        #define USAGE_ERROR_ACTION(m,p) ABORT
+    #endif /* USAGE_ERROR_ACTION */
+#endif /* PROCEED_ON_ERROR */
+
+    /* -------------------------- Debugging setup ---------------------------- */
+
+#if ! DEBUG
+    #define check_free_chunk(M,P)
+    #define check_inuse_chunk(M,P)
+    #define check_malloced_chunk(M,P,N)
+    #define check_mmapped_chunk(M,P)
+    #define check_malloc_state(M)
+    #define check_top_chunk(M,P)
+#else /* DEBUG */
+    #define check_free_chunk(M,P)       do_check_free_chunk(M,P)
+    #define check_inuse_chunk(M,P)      do_check_inuse_chunk(M,P)
+    #define check_top_chunk(M,P)        do_check_top_chunk(M,P)
+    #define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N)
+    #define check_mmapped_chunk(M,P)    do_check_mmapped_chunk(M,P)
+    #define check_malloc_state(M)       do_check_malloc_state(M)
+    static void   do_check_any_chunk(mstate m, mchunkptr p);
+    static void   do_check_top_chunk(mstate m, mchunkptr p);
+    static void   do_check_mmapped_chunk(mstate m, mchunkptr p);
+    static void   do_check_inuse_chunk(mstate m, mchunkptr p);
+    static void   do_check_free_chunk(mstate m, mchunkptr p);
+    static void   do_check_malloced_chunk(mstate m, void* mem, size_t s);
+    static void   do_check_tree(mstate m, tchunkptr t);
+    static void   do_check_treebin(mstate m, bindex_t i);
+    static void   do_check_smallbin(mstate m, bindex_t i);
+    static void   do_check_malloc_state(mstate m);
+    static int    bin_find(mstate m, mchunkptr x);
+    static size_t traverse_and_check(mstate m);
+#endif /* DEBUG */
+
+/* ---------------------------- Indexing Bins ---------------------------- */
+
+#define is_small(s)         (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
+#define small_index(s)      ((s)  >> SMALLBIN_SHIFT)
+#define small_index2size(i) ((i)  << SMALLBIN_SHIFT)
+#define MIN_SMALL_INDEX     (small_index(MIN_CHUNK_SIZE))
+
+/* addressing by index. See above about smallbin repositioning */
+#define smallbin_at(M, i)   ((sbinptr)((TUint8*)&((M)->smallbins[(i)<<1])))
+#define treebin_at(M,i)     (&((M)->treebins[i]))
+
+
+/* Bit representing maximum resolved size in a treebin at i */
+#define bit_for_tree_index(i) (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
+
+/* Shift placing maximum resolved bit in a treebin at i as sign bit */
+#define leftshift_for_tree_index(i) ((i == NTREEBINS-1)? 0 : ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
+
+/* The size of the smallest chunk held in bin with index i */
+#define minsize_for_tree_index(i) ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) |  (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
+
+
+/* ------------------------ Operations on bin maps ----------------------- */
+/* bit corresponding to given index */
+#define idx2bit(i)              ((binmap_t)(1) << (i))
+/* Mark/Clear bits with given index */
+#define mark_smallmap(M,i)      ((M)->smallmap |=  idx2bit(i))
+#define clear_smallmap(M,i)     ((M)->smallmap &= ~idx2bit(i))
+#define smallmap_is_marked(M,i) ((M)->smallmap &   idx2bit(i))
+#define mark_treemap(M,i)       ((M)->treemap  |=  idx2bit(i))
+#define clear_treemap(M,i)      ((M)->treemap  &= ~idx2bit(i))
+#define treemap_is_marked(M,i)  ((M)->treemap  &   idx2bit(i))
+
+/* isolate the least set bit of a bitmap */
+#define least_bit(x)         ((x) & -(x))
+
+/* mask with all bits to left of least bit of x on */
+#define left_bits(x)         ((x<<1) | -(x<<1))
+
+/* mask with all bits to left of or equal to least bit of x on */
+#define same_or_left_bits(x) ((x) | -(x))
+
+    /* isolate the least set bit of a bitmap */
+#define least_bit(x)         ((x) & -(x))
+
+/* mask with all bits to left of least bit of x on */
+#define left_bits(x)         ((x<<1) | -(x<<1))
+
+/* mask with all bits to left of or equal to least bit of x on */
+#define same_or_left_bits(x) ((x) | -(x))
+
+#if !INSECURE
+    /* Check if address a is at least as high as any from MORECORE or MMAP */
+    #define ok_address(M, a) ((TUint8*)(a) >= (M)->least_addr)
+    /* Check if address of next chunk n is higher than base chunk p */
+    #define ok_next(p, n)    ((TUint8*)(p) < (TUint8*)(n))
+    /* Check if p has its cinuse bit on */
+    #define ok_cinuse(p)     cinuse(p)
+    /* Check if p has its pinuse bit on */
+    #define ok_pinuse(p)     pinuse(p)
+#else /* !INSECURE */
+    #define ok_address(M, a) (1)
+    #define ok_next(b, n)    (1)
+    #define ok_cinuse(p)     (1)
+    #define ok_pinuse(p)     (1)
+#endif /* !INSECURE */
+
+#if (FOOTERS && !INSECURE)
+    /* Check if (alleged) mstate m has expected magic field */
+    #define ok_magic(M)      ((M)->magic == mparams.magic)
+#else  /* (FOOTERS && !INSECURE) */
+    #define ok_magic(M)      (1)
+#endif /* (FOOTERS && !INSECURE) */
+
+/* In gcc, use __builtin_expect to minimize impact of checks */
+#if !INSECURE
+    #if defined(__GNUC__) && __GNUC__ >= 3
+        #define RTCHECK(e)  __builtin_expect(e, 1)
+    #else /* GNUC */
+        #define RTCHECK(e)  (e)
+    #endif /* GNUC */
+
+#else /* !INSECURE */
+    #define RTCHECK(e)  (1)
+#endif /* !INSECURE */
+/* macros to set up inuse chunks with or without footers */
+#if !FOOTERS
+    #define mark_inuse_foot(M,p,s)
+    /* Set cinuse bit and pinuse bit of next chunk */
+    #define set_inuse(M,p,s)  ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT)
+    /* Set cinuse and pinuse of this chunk and pinuse of next chunk */
+    #define set_inuse_and_pinuse(M,p,s) ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT)
+    /* Set size, cinuse and pinuse bit of this chunk */
+    #define set_size_and_pinuse_of_inuse_chunk(M, p, s) ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
+#else /* FOOTERS */
+    /* Set foot of inuse chunk to be xor of mstate and seed */
+    #define mark_inuse_foot(M,p,s) (((mchunkptr)((TUint8*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic))
+    #define get_mstate_for(p) ((mstate)(((mchunkptr)((TUint8*)(p)+(chunksize(p))))->prev_foot ^ mparams.magic))
+    #define set_inuse(M,p,s)\
+        ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
+        (((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT), \
+        mark_inuse_foot(M,p,s))
+    #define set_inuse_and_pinuse(M,p,s)\
+    ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+    (((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT),\
+    mark_inuse_foot(M,p,s))
+    #define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
+    ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+    mark_inuse_foot(M, p, s))
+#endif /* !FOOTERS */
+
+
+#if ONLY_MSPACES
+#define internal_malloc(m, b) mspace_malloc(m, b)
+#define internal_free(m, mem) mspace_free(m,mem);
+#else /* ONLY_MSPACES */
+    #if MSPACES
+        #define internal_malloc(m, b) (m == gm)? dlmalloc(b) : mspace_malloc(m, b)
+        #define internal_free(m, mem) if (m == gm) dlfree(mem); else mspace_free(m,mem);
+    #else /* MSPACES */
+        #define internal_malloc(m, b) dlmalloc(b)
+        #define internal_free(m, mem) dlfree(mem)
+    #endif /* MSPACES */
+#endif /* ONLY_MSPACES */
+/******CODE TO SUPORT SLAB ALLOCATOR******/
+
+    #ifndef NDEBUG
+    #define CHECKING 1
+    #endif
+
+    #if CHECKING
+    #ifndef ASSERT
+    #define ASSERT(x) {if (!(x)) abort();}
+    #endif
+    #define CHECK(x) x
+    #else
+    #ifndef ASSERT
+    #define ASSERT(x) (void)0
+    #endif
+    #define CHECK(x) (void)0
+    #endif
+
+    class slab;
+    class slabhdr;
+    #define maxslabsize     60
+    #define pageshift       12
+    #define pagesize        (1<<pageshift)
+    #define slabshift       10
+    #define slabsize        (1 << slabshift)
+    #define cellalign       8
+    const unsigned slabfull = 0;
+    const TInt  slabsperpage    =   (int)(pagesize/slabsize);
+    #define hibit(bits) (((unsigned)bits & 0xc) ? 2 + ((unsigned)bits>>3) : ((unsigned) bits>>1))
+
+    #define lowbit(bits)    (((unsigned) bits&3) ? 1 - ((unsigned)bits&1) : 3 - (((unsigned)bits>>2)&1))
+    #define maxslabsize 60
+    #define minpagepower    pageshift+2
+    #define cellalign   8
+    class slabhdr
+    {
+    public:
+        unsigned header;
+        // made up of
+        // bits   |    31    | 30..28 | 27..18 | 17..12 |  11..8  |   7..0   |
+        //        +----------+--------+--------+--------+---------+----------+
+        // field  | floating |  zero  | used-4 |  size  | pagemap | free pos |
+        //
+        slab** parent;      // reference to parent's pointer to this slab in tree
+        slab* child1;       // 1st child in tree
+        slab* child2;       // 2nd child in tree
+    };
+
+    inline unsigned header_floating(unsigned h)
+    {return (h&0x80000000);}
+    const unsigned maxuse = (slabsize - sizeof(slabhdr))>>2;
+    const unsigned firstpos = sizeof(slabhdr)>>2;
+    #define checktree(x) (void)0
+    template <class T> inline T floor(const T addr, unsigned aln)
+        {return T((unsigned(addr))&~(aln-1));}
+    template <class T> inline T ceiling(T addr, unsigned aln)
+        {return T((unsigned(addr)+(aln-1))&~(aln-1));}
+    template <class T> inline unsigned lowbits(T addr, unsigned aln)
+        {return unsigned(addr)&(aln-1);}
+    template <class T1, class T2> inline int ptrdiff(const T1* a1, const T2* a2)
+        {return reinterpret_cast<const unsigned char*>(a1) - reinterpret_cast<const unsigned char*>(a2);}
+    template <class T> inline T offset(T addr, signed ofs)
+        {return T(unsigned(addr)+ofs);}
+    class slabset
+    {
+    public:
+        void* initslab(slab* s);
+        unsigned size;
+        slab* partial;
+    };
+
+    class slab : public slabhdr
+    {
+    public:
+        void init(unsigned clz);
+        //static slab* slabfor( void* p);
+        static slab* slabfor(const void* p) ;
+    private:
+        unsigned char payload[slabsize-sizeof(slabhdr)];
+    };
+    class page
+    {
+    public:
+        inline static page* pagefor(slab* s);
+        //slab slabs;
+        slab slabs[slabsperpage];
+    };
+
+
+    inline page* page::pagefor(slab* s)
+        {return reinterpret_cast<page*>(floor(s, pagesize));}
+    struct pagecell
+    {
+        void* page;
+        unsigned size;
+    };
+    /******CODE TO SUPORT SLAB ALLOCATOR******/
+
+    /****** COMMON DEFS CHUNK PAGE MAP/UNMAP *****/
+#define CHUNK_PAGEOUT_THESHOLD (12*1024U)
+#define CHUNK_PAGE_OUT_FLAG (98989U)
+#define tchunk_page_align(p)    (char*)page_align((size_t)(p) + sizeof(tchunk) + TOP_FOOT_SIZE)
+#define address_offset(HIGH, LOW)    (size_t)((char*)(HIGH) - (char*)(LOW))
+
+/* tree_malloc_chunk pageout header operations */
+#define set_tchunk_mem_pageout(TP, NPAGES) \
+    { (TP)->pageout = CHUNK_PAGE_OUT_FLAG; (TP)->npages = (NPAGES); }
+#define reset_tchunk_mem_pageout(TP) \
+    { (TP)->pageout = 0;  (TP)->npages = 0; }
+#define page_not_in_memory(P, S) \
+    (  !is_small(S) &&  ( (((tchunkptr)(P))->pageout==CHUNK_PAGE_OUT_FLAG)?1:0 )  )
+
+
+#ifdef DL_CHUNK_MEM_DEBUG
+#define ASSERT_RCHUNK_SIZE() \
+    {RChunk rchunk; rchunk.SetHandle(iChunkHandle); assert(iChunkSize == rchunk.Size());}
+#define TRACE_DL_CHUNK_MAP(c_addr, csize, page_addr, page_size) \
+    MEM_LOGF(_L8("DL_CHUNK_MAP$$:: chunk_addr=%x, chunk_size=%d, page_addr=%x, page_size=%d"), c_addr, csize, page_addr, (page_size));
+#define TRACE_DL_CHUNK_UNMAP(c_addr, csize, page_addr, page_size) \
+    MEM_LOGF(_L8("DL_CHUNK_UNMAP:: chunk_addr=%x, chunk_size=%d, page_addr=%x, page_size=%d"), c_addr, csize, page_addr, (page_size));
+#else
+#define ASSERT_RCHUNK_SIZE()
+#define TRACE_DL_CHUNK_MAP(c_addr, csize, p_addr, psize)
+#define TRACE_DL_CHUNK_UNMAP(c_addr, csize, p_addr, psize)
+#endif
+
+#ifdef OOM_LOGGING
+#define TRACE_UNMAPPED_CHUNK(SZ) \
+    iUnmappedChunkSize += (SZ);
+#define MEM_DUMP_OOM_LOGS(NB, MSG) \
+    MEM_LOG(MSG); \
+    C_LOG(MSG); \
+    dump_heap_logs(NB)
+#else
+#define MEM_DUMP_OOM_LOGS(NB, MSG)
+#define TRACE_UNMAPPED_CHUNK(SZ)
+#endif
+
+    /****** COMMON DEFS PAGE MAP/UNMAP *****/
+#endif/*__DLA__*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/standaloneallocator/newallocator.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,3311 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+
+/****************************************************************************
+ *
+ * This file is part of the Symbian application wrapper of the Qt Toolkit.
+ *
+ * The memory allocator is backported from Symbian OS, and can eventually
+ * be removed from Qt once it is built in to all supported OS versions.
+ * The allocator is a composite of three allocators:
+ *  - A page allocator, for large allocations
+ *  - A slab allocator, for small allocations
+ *  - Doug Lea's allocator, for medium size allocations
+ *
+ ***************************************************************************/
+
+
+#include <e32std.h>
+#include <e32cmn.h>
+#include <hal.h>
+#include <e32panic.h>
+
+#ifndef QT_SYMBIAN_HAVE_U32STD_H
+struct SThreadCreateInfo
+    {
+    TAny* iHandle;
+    TInt iType;
+    TThreadFunction iFunction;
+    TAny* iPtr;
+    TAny* iSupervisorStack;
+    TInt iSupervisorStackSize;
+    TAny* iUserStack;
+    TInt iUserStackSize;
+    TInt iInitialThreadPriority;
+    TPtrC iName;
+    TInt iTotalSize;    // Size including any extras (must be a multiple of 8 bytes)
+    };
+
+struct SStdEpocThreadCreateInfo : public SThreadCreateInfo
+    {
+    RAllocator* iAllocator;
+    TInt iHeapInitialSize;
+    TInt iHeapMaxSize;
+    TInt iPadding;      // Make structure size a multiple of 8 bytes
+    };
+#else
+#include <u32std.h>
+#endif
+#include <e32svr.h>
+
+//Named local chunks require support from the kernel, which depends on Symbian^3
+#define NO_NAMED_LOCAL_CHUNKS
+//Reserving a minimum heap size is not supported, because the implementation does not know what type of
+//memory to use. DLA memory grows upwards, slab and page allocators grow downwards.
+//This would need kernel support to do properly.
+#define NO_RESERVE_MEMORY
+
+//The BTRACE debug framework requires Symbian OS 9.4 or higher.
+//Required header files are not included in S60 5.0 SDKs, but
+//they are available for open source versions of Symbian OS.
+//Note that although Symbian OS 9.3 supports BTRACE, the usage in this file
+//depends on 9.4 header files.
+
+//This debug flag uses BTRACE to emit debug traces to identify the heaps.
+//Note that it uses the ETest1 trace category which is not reserved
+//#define TRACING_HEAPS
+//This debug flag uses BTRACE to emit debug traces to aid with debugging
+//allocs, frees & reallocs. It should be used together with the KUSERHEAPTRACE
+//kernel trace flag to enable heap tracing.
+//#define TRACING_ALLOCS
+//This debug flag turns on tracing of the call stack for each alloc trace.
+//It is dependent on TRACING_ALLOCS.
+//#define TRACING_CALLSTACKS
+
+#if defined(TRACING_ALLOCS) || defined(TRACING_HEAPS)
+#include <e32btrace.h>
+#endif
+
+// Memory logging routines inherited from webkit allocator 9.2TB.
+// #define OOM_LOGGING
+// This debug flag logs error conditions when memory is unmapped/mapped from the system.
+// Also, exports routines to dump the internal state and memory usage of the DL allocator.
+// #define DL_CHUNK_MEM_DEBUG
+// Exports debug rouintes to assert/trace chunked memory access.
+#if defined(OOM_LOGGING) || defined(DL_CHUNK_MEM_DEBUG)
+#include "MemoryLogger.h"
+#endif
+
+
+#ifndef __WINS__
+#pragma push
+#pragma arm
+#endif
+
+#include "dla_p.h"
+#include "newallocator_p.h"
+
+// if non zero this causes the slabs to be configured only when the chunk size exceeds this level
+#define DELAYED_SLAB_THRESHOLD (64*1024)        // 64KB seems about right based on trace data
+#define SLAB_CONFIG (0xabe)
+
+_LIT(KDLHeapPanicCategory, "DL Heap");
+#define GET_PAGE_SIZE(x)            HAL::Get(HALData::EMemoryPageSize, x)
+#define __CHECK_CELL(p)
+#define __POWER_OF_2(x)             ((TUint32)((x)^((x)-1))>=(TUint32)(x))
+#define HEAP_PANIC(r)               Panic(r)
+
+LOCAL_C void Panic(TCdtPanic aPanic)
+// Panic the process with USER as the category.
+    {
+    User::Panic(_L("USER"),aPanic);
+    }
+
+    /* Purpose:     Map chunk memory pages from system RAM
+ * Arguments:   tp - tchunkptr in which memmory should be mapped
+ *              psize - incoming tchunk size
+ * Return:      KErrNone if successful, else KErrNoMemory
+ * Note:
+ */
+TInt RNewAllocator::map_chunk_pages(tchunkptr tp, size_t psize)
+{
+    if (page_not_in_memory(tp, psize)) {
+        char *a_addr = tchunk_page_align(tp);
+        size_t npages = tp->npages;
+
+#ifdef OOM_LOGGING
+        // check that npages matches the psize
+        size_t offset = address_offset(a_addr,tp);
+        if (offset < psize && (psize - offset) >= mparams.page_size )
+        {
+            size_t tpages = ( psize - offset) >> pageshift;
+            if (tpages != tp->npages) //assert condition
+                MEM_LOG("CHUNK_PAGE_ERROR:map_chunk_pages, error in npages");
+        }
+        else
+            MEM_LOG("CHUNK_PAGE_ERROR::map_chunk_pages: - Incorrect page-in-memmory flag");
+#endif
+
+        if (map(a_addr, npages*mparams.page_size)) {
+            TRACE_DL_CHUNK_MAP(tp, psize, a_addr, npages*mparams.page_size);
+            ASSERT_RCHUNK_SIZE();
+            TRACE_UNMAPPED_CHUNK(-1*npages*mparams.page_size);
+            return KErrNone;
+        }
+        else {
+#ifdef OOM_LOGGING
+
+            MEM_LOGF(_L8("CHUNK_PAGE_ERROR:: map_chunk_pages - Failed to Commit RAM, page_addr=%x, npages=%d, chunk_size=%d"), a_addr, npages, psize);
+            MEM_DUMP_OOM_LOGS(psize, "RSymbianDLHeap::map_chunk_pages - Failed to Commit RAM");
+#endif
+            return KErrNoMemory;
+        }
+    }
+    return KErrNone;
+}
+
+/* Purpose:     Map partial chunk memory pages from system RAM
+ * Arguments:   tp - tchunkptr in which memmory should be mapped
+ *              psize - incoming tchunk size
+ *              r - remainder chunk pointer
+ *              rsize - remainder chunk size
+ * Return:      Number of unmapped pages from remainder chunk if successful (0 or more), else KErrNoMemory
+ * Note:        Remainder chunk should be large enough to be mapped out (checked before invoking this function)
+ *              pageout headers will be set from insert_large_chunk(), not here.
+ */
+TInt RNewAllocator::map_chunk_pages_partial(tchunkptr tp, size_t psize, tchunkptr r, size_t rsize)
+{
+    if (page_not_in_memory(tp, psize)) {
+        size_t npages = tp->npages; // total no of pages unmapped in this chunk
+        char *page_addr_map = tchunk_page_align(tp); // address to begin page map
+        char *page_addr_rem = tchunk_page_align(r);  // address in remainder chunk to remain unmapped
+        assert(address_offset(page_addr_rem, r) < rsize);
+        size_t npages_map = address_offset(page_addr_rem, page_addr_map) >> pageshift; // no of pages to be mapped
+        if (npages_map > 0) {
+            if (map(page_addr_map, npages_map*mparams.page_size)) {
+#ifdef DL_CHUNK_MEM_DEBUG
+                TRACE_DL_CHUNK_MAP(tp, psize, page_addr_map, npages_map*mparams.page_size);
+                ASSERT_RCHUNK_SIZE();
+                TRACE_UNMAPPED_CHUNK(-1*npages_map*mparams.page_size);
+#endif
+                return (npages - npages_map);
+            }
+            else {
+#ifdef OOM_LOGGING
+                MEM_LOGF(_L8("CHUNK_PAGE_ERROR:: map_chunk_pages_partial - Failed to Commit RAM, page_addr=%x, npages=%d, chunk_size=%d"), page_addr_map, npages_map, psize);
+                MEM_DUMP_OOM_LOGS(psize, "RSymbianDLHeap::map_chunk_pages_partial - Failed to Commit RAM");
+#endif
+                return KErrNoMemory;
+            }
+        }
+        else {
+             // map not needed, first page is already mapped
+             return npages;
+        }
+    }
+
+    return 0;
+}
+
+
+/* Purpose:     Release (unmap) chunk memory pages to system RAM
+ * Arguments:   tp - tchunkptr from which memmory may be released
+ *              psize - incoming tchunk size
+ *              prev_npages - number of pages that has been already unmapped from this chunk
+ * Return:      total number of pages that has been unmapped from this chunk (new unmapped pages + prev_npages)
+ * Note:        pageout headers will be set from insert_large_chunk(), not here.
+ */
+TInt RNewAllocator::unmap_chunk_pages(tchunkptr tp, size_t psize, size_t prev_npages)
+{
+    size_t npages = 0;
+    char *a_addr = tchunk_page_align(tp);
+    size_t offset = address_offset(a_addr,tp);
+    if (offset < psize && (psize - offset) >= mparams.page_size)
+    { /* check for new pages to decommit */
+        npages = ( psize - offset) >> pageshift;
+        if (npages > prev_npages) {
+            unmap(a_addr, npages*mparams.page_size);    // assuming kernel takes care of already unmapped pages
+            TRACE_DL_CHUNK_UNMAP(tp, psize, a_addr, npages*mparams.page_size);
+            iChunkSize += prev_npages*mparams.page_size; //adjust actual chunk size
+            ASSERT_RCHUNK_SIZE();
+            TRACE_UNMAPPED_CHUNK((npages-prev_npages)*mparams.page_size);
+            assert((a_addr + npages*mparams.page_size - 1) < (char*)next_chunk(tp));
+        }
+    }
+
+#ifdef OOM_LOGGING
+    if (npages && (npages < prev_npages))
+        MEM_LOG("CHUNK_PAGE_ERROR:unmap_chunk_pages, error in npages");
+    if (npages > prev_npages) {
+        /* check that end of decommited address lie within this chunk */
+        if ((a_addr + npages*mparams.page_size - 1) >= (char*)next_chunk(tp))
+            MEM_LOG("CHUNK_PAGE_ERROR:unmap_chunk_pages, error chunk boundary");
+    }
+#endif
+#ifdef DL_CHUNK_MEM_DEBUG
+    mchunkptr next = next_chunk(tp);
+    do_check_any_chunk_access(next, chunksize(next));
+    if (!npages)  do_check_any_chunk_access((mchunkptr)tp, psize);
+#endif
+
+    return (npages);
+}
+
+/* Purpose:     Unmap all pages between previously unmapped and end of top chunk
+                and reset top to beginning of prev chunk
+ * Arguments:   fm - global malloc state
+ *              prev - previous chunk which has unmapped pages
+ *              psize - size of previous chunk
+ *              prev_npages - number of unmapped pages from previous chunk
+ * Return:      nonzero if sucessful, else 0
+ * Note:
+ */
+TInt RNewAllocator::sys_trim_partial(mstate m, mchunkptr prev, size_t psize, size_t prev_npages)
+{
+    size_t released = 0;
+    size_t extra = 0;
+    if (is_initialized(m)) {
+      psize += m->topsize;
+      char *a_addr = tchunk_page_align(prev); // includes space for TOP footer
+      size_t addr_offset = address_offset(a_addr, prev);
+      assert(addr_offset > TOP_FOOT_SIZE); //always assert?
+      assert((char*)iTop >= a_addr); //always assert?
+      if ((char*)iTop > a_addr)
+          extra = address_offset(iTop, a_addr);
+
+#ifdef OOM_LOGGING
+      if ((char*)iTop < a_addr)
+          MEM_LOGF(_L8("RSymbianDLHeap::sys_trim_partial - incorrect iTop value, top=%x, iTop=%x"), m->top, iTop);
+#endif
+        msegmentptr sp = segment_holding(m, (TUint8*)prev);
+        if (!is_extern_segment(sp)) {
+          if (is_mmapped_segment(sp)) {
+            if (HAVE_MMAP &&  sp->size >= extra && !has_segment_link(m, sp)) { /* can't shrink if pinned */
+             // size_t newsize = sp->size - extra;
+              /* Prefer mremap, fall back to munmap */
+              if ((CALL_MREMAP(sp->base, sp->size, sp->size - extra, 0) != MFAIL) ||
+                  (CALL_MUNMAP(sp->base + sp->size - extra, extra) == 0)) {
+                released = extra;
+              }
+            }
+          }
+          else if (HAVE_MORECORE) {
+            if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
+                extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - mparams.granularity;
+            ACQUIRE_MORECORE_LOCK(m);
+            {
+              /* Make sure end of memory is where we last set it. */
+              TUint8* old_br = (TUint8*)(CALL_MORECORE(0));
+              if (old_br == sp->base + sp->size) {
+                TUint8* rel_br = (TUint8*)(CALL_MORECORE(-extra));
+                TUint8* new_br = (TUint8*)(CALL_MORECORE(0));
+                if (rel_br != CMFAIL && new_br < old_br)
+                  released = old_br - new_br;
+              }
+            }
+            RELEASE_MORECORE_LOCK(m);
+          }
+        }
+
+        if (released != 0) {
+          TRACE_DL_CHUNK_UNMAP(prev, psize, a_addr, released);
+          iChunkSize += prev_npages*mparams.page_size; // prev_unmapped was already unmapped
+          TRACE_UNMAPPED_CHUNK(-1*prev_npages*mparams.page_size);
+          ASSERT_RCHUNK_SIZE();
+          sp->size -= released;
+          m->footprint -= released;
+        }
+
+        /* reset top to prev chunk */
+        init_top(m, prev, addr_offset - TOP_FOOT_SIZE);
+        check_top_chunk(m, m->top);
+    }
+
+    // DL region not initalized, do not reset top here
+    return (released != 0)? 1 : 0;
+}
+
+
+#define STACKSIZE 32
+inline void RNewAllocator::TraceCallStack()
+{
+#ifdef TRACING_CALLSTACKS
+    TUint32 filteredStack[STACKSIZE];
+    TThreadStackInfo info;
+    TUint32 *sp = (TUint32*)&sp;
+    RThread().StackInfo(info);
+    Lock();
+    TInt i;
+    for (i=0;i<STACKSIZE;i++) {
+        if ((TLinAddr)sp>=info.iBase) break;
+        while ((TLinAddr)sp < info.iBase) {
+            TUint32 cur = *sp++;
+            TUint32 range = cur & 0xF0000000;
+            if (range == 0x80000000 || range == 0x70000000) {
+                filteredStack[i] = cur;
+                break;
+            }
+        }
+    }
+    Unlock();
+    BTraceContextBig(BTrace::EHeap, BTrace::EHeapCallStack, (TUint32)this, filteredStack, i * 4);
+#endif
+}
+
+size_t getpagesize()
+{
+    TInt size;
+    TInt err = GET_PAGE_SIZE(size);
+    if (err != KErrNone)
+        return (size_t)0x1000;
+    return (size_t)size;
+}
+
+#define gm  (&iGlobalMallocState)
+
+RNewAllocator::RNewAllocator(TInt aMaxLength, TInt aAlign, TBool aSingleThread)
+// constructor for a fixed heap. Just use DL allocator
+    :iMinLength(aMaxLength), iMaxLength(aMaxLength), iOffset(0), iGrowBy(0), iChunkHandle(0),
+    iNestingLevel(0), iAllocCount(0), iFailType(ENone), iTestData(NULL), iChunkSize(aMaxLength)
+    {
+
+    if ((TUint32)aAlign>=sizeof(TAny*) && __POWER_OF_2(iAlign))
+        {
+        iAlign = aAlign;
+        }
+    else
+        {
+        iAlign = 4;
+        }
+    iPageSize = 0;
+    iFlags = aSingleThread ? (ESingleThreaded|EFixedSize) : EFixedSize;
+
+    Init(0, 0, 0);
+    }
+
+RNewAllocator::RNewAllocator(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy,
+            TInt aAlign, TBool aSingleThread)
+        : iMinLength(aMinLength), iMaxLength(aMaxLength), iOffset(aOffset), iChunkHandle(aChunkHandle), iAlign(aAlign), iNestingLevel(0), iAllocCount(0),
+            iFailType(ENone), iTestData(NULL), iChunkSize(aMinLength),iHighWaterMark(aMinLength)
+    {
+    iPageSize = malloc_getpagesize;
+    __ASSERT_ALWAYS(aOffset >=0, User::Panic(KDLHeapPanicCategory, ETHeapNewBadOffset));
+    iGrowBy = _ALIGN_UP(aGrowBy, iPageSize);
+    iFlags = aSingleThread ? ESingleThreaded : 0;
+
+    // Initialise
+    // if the heap is created with aMinLength==aMaxLength then it cannot allocate slab or page memory
+    // so these sub-allocators should be disabled. Otherwise initialise with default values
+    if (aMinLength == aMaxLength)
+        Init(0, 0, 0);
+    else
+        Init(0x3fff, 15, 0x10000);  // all slabs, page {32KB}, trim {64KB} // Andrew: Adopting Webkit config?
+        //Init(0xabe, 16, iPageSize*4); // slabs {48, 40, 32, 24, 20, 16, 12, 8}, page {64KB}, trim {16KB}
+#ifdef TRACING_HEAPS
+    RChunk chunk;
+    chunk.SetHandle(iChunkHandle);
+    TKName chunk_name;
+    chunk.FullName(chunk_name);
+    BTraceContextBig(BTrace::ETest1, 2, 22, chunk_name.Ptr(), chunk_name.Size());
+
+    TUint32 traceData[4];
+    traceData[0] = iChunkHandle;
+    traceData[1] = iMinLength;
+    traceData[2] = iMaxLength;
+    traceData[3] = iAlign;
+    BTraceContextN(BTrace::ETest1, 1, (TUint32)this, 11, traceData, sizeof(traceData));
+#endif
+
+    }
+
+TAny* RNewAllocator::operator new(TUint aSize, TAny* aBase) __NO_THROW
+    {
+    __ASSERT_ALWAYS(aSize>=sizeof(RNewAllocator), HEAP_PANIC(ETHeapNewBadSize));
+    RNewAllocator* h = (RNewAllocator*)aBase;
+    h->iAlign = 0x80000000; // garbage value
+    h->iBase = ((TUint8*)aBase) + aSize;
+    return aBase;
+    }
+
+void RNewAllocator::Init(TInt aBitmapSlab, TInt aPagePower, size_t aTrimThreshold)
+    {
+    __ASSERT_ALWAYS((TUint32)iAlign>=sizeof(TAny*) && __POWER_OF_2(iAlign), HEAP_PANIC(ETHeapNewBadAlignment));
+
+    /*Moved code which does initialization */
+    iTop = (TUint8*)this + iMinLength;
+    spare_page = 0;
+    iAllocCount = 0; // FIXME  -- not used anywhere - already initialized to 0 in constructor anyway
+    memset(&mparams,0,sizeof(mparams));
+
+    Init_Dlmalloc(iTop - iBase, 0, aTrimThreshold);
+
+    slab_init(aBitmapSlab);
+
+    /*10-1K,11-2K,12-4k,13-8K,14-16K,15-32K,16-64K*/
+    paged_init(aPagePower);
+
+#ifdef TRACING_ALLOCS
+        TUint32 traceData[3];
+        traceData[0] = aBitmapSlab;
+        traceData[1] = aPagePower;
+        traceData[2] = aTrimThreshold;
+        BTraceContextN(BTrace::ETest1, BTrace::EHeapAlloc, (TUint32)this, 0, traceData, sizeof(traceData));
+#endif
+
+    }
+
+RNewAllocator::SCell* RNewAllocator::GetAddress(const TAny* aCell) const
+//
+// As much as possible, check a cell address and backspace it
+// to point at the cell header.
+//
+    {
+
+    TLinAddr m = TLinAddr(iAlign - 1);
+    __ASSERT_ALWAYS(!(TLinAddr(aCell)&m), HEAP_PANIC(ETHeapBadCellAddress));
+
+    SCell* pC = (SCell*)(((TUint8*)aCell)-EAllocCellSize);
+    __CHECK_CELL(pC);
+
+    return pC;
+    }
+
+TInt RNewAllocator::AllocLen(const TAny* aCell) const
+{
+    if (ptrdiff(aCell, this) >= 0)
+    {
+        mchunkptr m = mem2chunk(aCell);
+        return chunksize(m) - CHUNK_OVERHEAD; // Andrew: Picking up webkit change.
+    }
+    if (lowbits(aCell, pagesize) > cellalign)
+        return header_size(slab::slabfor(aCell)->header);
+    if (lowbits(aCell, pagesize) == cellalign)
+        return *(unsigned*)(offset(aCell,-int(cellalign)))-cellalign;
+    return paged_descriptor(aCell)->size;
+}
+
+TAny* RNewAllocator::Alloc(TInt aSize)
+{
+    __ASSERT_ALWAYS((TUint)aSize<(KMaxTInt/2),HEAP_PANIC(ETHeapBadAllocatedCellSize));
+
+    TAny* addr;
+
+#ifdef TRACING_ALLOCS
+    TInt aCnt=0;
+#endif
+    Lock();
+    if (aSize < slab_threshold)
+    {
+        TInt ix = sizemap[(aSize+3)>>2];
+        ASSERT(ix != 0xff);
+        addr = slab_allocate(slaballoc[ix]);
+        if (addr) iTotalAllocSize += slaballoc[ix].size;
+    }else if ((aSize >> page_threshold)==0)
+        {
+#ifdef TRACING_ALLOCS
+        aCnt=1;
+#endif
+        addr = dlmalloc(aSize);
+        }
+    else
+        {
+#ifdef TRACING_ALLOCS
+        aCnt=2;
+#endif
+        addr = paged_allocate(aSize);
+        //attempt dlmalloc() if paged_allocate() fails. This can improve allocation chances if fragmentation is high in the heap.
+        if (!addr) { // paged_allocator failed, try in dlmalloc
+            addr = dlmalloc(aSize);
+        }
+    }
+
+    if (addr) {
+        iCellCount++;
+        // Increment iTotalAllocSize in memory segment specific code for more accuracy
+        //iTotalAllocSize += aSize;
+    }
+    Unlock();
+
+#ifdef TRACING_ALLOCS
+    if (iFlags & ETraceAllocs)
+        {
+        TUint32 traceData[3];
+        traceData[0] = AllocLen(addr);
+        traceData[1] = aSize;
+        traceData[2] = aCnt;
+        BTraceContextN(BTrace::EHeap, BTrace::EHeapAlloc, (TUint32)this, (TUint32)addr, traceData, sizeof(traceData));
+        TraceCallStack();
+        }
+#endif
+
+    return addr;
+}
+
+TInt RNewAllocator::Compress()
+    {
+    if (iFlags & EFixedSize)
+        return 0;
+
+    Lock();
+    dlmalloc_trim(0);
+    if (spare_page)
+        {
+        unmap(spare_page,pagesize);
+        spare_page = 0;
+        }
+    Unlock();
+    return 0;
+    }
+
+void RNewAllocator::Free(TAny* aPtr)
+{
+
+#ifdef TRACING_ALLOCS
+    TInt aCnt=0;
+#endif
+#ifdef ENABLE_DEBUG_TRACE
+    RThread me;
+    TBuf<100> thName;
+    me.FullName(thName);
+#endif
+    //if (!aPtr) return; //return in case of NULL pointer
+
+    Lock();
+
+    if (!aPtr)
+        ;
+    else if (ptrdiff(aPtr, this) >= 0)
+        {
+#ifdef TRACING_ALLOCS
+        aCnt = 1;
+#endif
+        dlfree( aPtr);
+        }
+    else if (lowbits(aPtr, pagesize) <= cellalign)
+        {
+#ifdef TRACING_ALLOCS
+        aCnt = 2;
+#endif
+        paged_free(aPtr);
+        }
+    else
+        {
+#ifdef TRACING_ALLOCS
+        aCnt = 0;
+#endif
+        slab_free(aPtr);
+        }
+    iCellCount--;
+    Unlock();
+
+#ifdef TRACING_ALLOCS
+    if (iFlags & ETraceAllocs)
+        {
+        TUint32 traceData;
+        traceData = aCnt;
+        BTraceContextN(BTrace::EHeap, BTrace::EHeapFree, (TUint32)this, (TUint32)aPtr, &traceData, sizeof(traceData));
+        TraceCallStack();
+        }
+#endif
+}
+
+
+void RNewAllocator::Reset()
+    {
+    // TODO free everything
+    User::Panic(_L("RNewAllocator"), 1); //this should never be called
+    }
+
+#ifdef TRACING_ALLOCS
+inline void RNewAllocator::TraceReAlloc(TAny* aPtr, TInt aSize, TAny* aNewPtr, TInt aZone)
+{
+    if (aNewPtr && (iFlags & ETraceAllocs)) {
+        TUint32 traceData[3];
+        traceData[0] = AllocLen(aNewPtr);
+        traceData[1] = aSize;
+        traceData[2] = (TUint32) aPtr;
+        BTraceContextN(BTrace::EHeap, BTrace::EHeapReAlloc, (TUint32) this, (TUint32) aNewPtr,
+            traceData, sizeof(traceData));
+        TraceCallStack();
+        //workaround for SAW not handling reallocs properly
+        if (aZone >= 0 && aPtr != aNewPtr) {
+            BTraceContextN(BTrace::EHeap, BTrace::EHeapFree, (TUint32) this, (TUint32) aPtr,
+                &aZone, sizeof(aZone));
+            TraceCallStack();
+        }
+    }
+}
+#else
+//Q_UNUSED generates code that prevents the compiler optimising out the empty inline function
+inline void RNewAllocator::TraceReAlloc(TAny* , TInt , TAny* , TInt )
+{}
+#endif
+
+TAny* RNewAllocator::ReAlloc(TAny* aPtr, TInt aSize, TInt /*aMode = 0*/)
+    {
+    if (ptrdiff(aPtr,this)>=0)
+    {
+        // original cell is in DL zone
+        if ((aSize>>page_threshold)==0 || aSize <= chunksize(mem2chunk(aPtr)) - CHUNK_OVERHEAD)
+            {
+            // new one is below page limit or smaller than old one (so can't be moved)
+            Lock();
+            TAny* addr = dlrealloc(aPtr,aSize);
+            Unlock();
+            TraceReAlloc(aPtr, aSize, addr, 2);
+            return addr;
+            }
+    }
+    else if (lowbits(aPtr,pagesize)<=cellalign)
+    {
+        // original cell is either NULL or in paged zone
+        if (!aPtr)
+            return Alloc(aSize);
+
+        // either the new size is larger (in which case it will still be in paged zone)
+        // or it is smaller, but we will never move a shrinking cell so in paged zone
+        // must handle [rare] case that aSize == 0, as paged_[re]allocate() will panic
+        if (aSize == 0)
+            aSize = 1;
+        Lock();
+        TAny* addr = paged_reallocate(aPtr,aSize);
+        Unlock();
+        TraceReAlloc(aPtr, aSize, addr, 2);
+        return addr;
+    }
+    else
+    {
+        // original cell is in slab zone
+        // return original if new one smaller
+        if (aSize <= header_size(slab::slabfor(aPtr)->header))
+            return aPtr;
+    }
+    // can't do better than allocate/copy/free
+    TAny* newp = Alloc(aSize);
+    if (newp)
+    {
+        TInt oldsize = AllocLen(aPtr);
+        memcpy(newp,aPtr,oldsize<aSize?oldsize:aSize);
+        Free(aPtr);
+    }
+    return newp;
+    }
+
+TInt RNewAllocator::Available(TInt& aBiggestBlock) const
+{
+    //TODO: consider page and slab allocators
+
+    //this gets free space in DL region - the C ported code doesn't respect const yet.
+    RNewAllocator* self = const_cast<RNewAllocator*> (this);
+    mallinfo info = self->dlmallinfo();
+    aBiggestBlock = info.largestBlock;
+    return info.fordblks;
+}
+TInt RNewAllocator::AllocSize(TInt& aTotalAllocSize) const
+{
+    aTotalAllocSize = iTotalAllocSize;
+    return iCellCount;
+}
+
+TInt RNewAllocator::DebugFunction(TInt aFunc, TAny* a1, TAny* /*a2*/)
+    {
+    TInt r = KErrNotSupported;
+    TInt* a1int = reinterpret_cast<TInt*>(a1);
+    switch (aFunc) {
+    case RAllocator::ECount:
+    {
+        struct mallinfo mi = dlmallinfo();
+        *a1int = mi.fordblks;
+        r = mi.uordblks;
+    }
+        break;
+    case RAllocator::EMarkStart:
+    case RAllocator::EMarkEnd:
+    case RAllocator::ESetFail:
+    case RAllocator::ECheck:
+        r = KErrNone;
+        break;
+    }
+    return r;
+    }
+
+TInt RNewAllocator::Extension_(TUint /* aExtensionId */, TAny*& /* a0 */, TAny* /* a1 */)
+    {
+    return KErrNotSupported;
+    }
+
+///////////////////////////////////////////////////////////////////////////////
+// imported from dla.cpp
+///////////////////////////////////////////////////////////////////////////////
+
+//#include <unistd.h>
+//#define DEBUG_REALLOC
+#ifdef DEBUG_REALLOC
+#include <e32debug.h>
+#endif
+int RNewAllocator::init_mparams(size_t aTrimThreshold /*= DEFAULT_TRIM_THRESHOLD*/)
+{
+    if (mparams.page_size == 0)
+    {
+        size_t s;
+        mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
+        mparams.trim_threshold = aTrimThreshold;
+        #if MORECORE_CONTIGUOUS
+            mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT;
+        #else  /* MORECORE_CONTIGUOUS */
+            mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT;
+        #endif /* MORECORE_CONTIGUOUS */
+
+            s = (size_t)0x58585858U;
+        ACQUIRE_MAGIC_INIT_LOCK(&mparams);
+        if (mparams.magic == 0) {
+          mparams.magic = s;
+          /* Set up lock for main malloc area */
+          INITIAL_LOCK(&gm->mutex);
+          gm->mflags = mparams.default_mflags;
+        }
+        RELEASE_MAGIC_INIT_LOCK(&mparams);
+
+        mparams.page_size = malloc_getpagesize;
+
+        mparams.granularity = ((DEFAULT_GRANULARITY != 0)?
+                               DEFAULT_GRANULARITY : mparams.page_size);
+
+        /* Sanity-check configuration:
+           size_t must be unsigned and as wide as pointer type.
+           ints must be at least 4 bytes.
+           alignment must be at least 8.
+           Alignment, min chunk size, and page size must all be powers of 2.
+        */
+
+        if ((sizeof(size_t) != sizeof(TUint8*)) ||
+            (MAX_SIZE_T < MIN_CHUNK_SIZE)  ||
+            (sizeof(int) < 4)  ||
+            (MALLOC_ALIGNMENT < (size_t)8U) ||
+            ((MALLOC_ALIGNMENT    & (MALLOC_ALIGNMENT-SIZE_T_ONE))    != 0) ||
+            ((MCHUNK_SIZE         & (MCHUNK_SIZE-SIZE_T_ONE))         != 0) ||
+            ((mparams.granularity & (mparams.granularity-SIZE_T_ONE)) != 0) ||
+            ((mparams.page_size   & (mparams.page_size-SIZE_T_ONE))   != 0))
+          ABORT;
+    }
+    return 0;
+}
+
+void RNewAllocator::init_bins(mstate m) {
+  /* Establish circular links for smallbins */
+  bindex_t i;
+  for (i = 0; i < NSMALLBINS; ++i) {
+    sbinptr bin = smallbin_at(m,i);
+    bin->fd = bin->bk = bin;
+  }
+}
+/* ---------------------------- malloc support --------------------------- */
+
+/* allocate a large request from the best fitting chunk in a treebin */
+void* RNewAllocator::tmalloc_large(mstate m, size_t nb) {
+  tchunkptr v = 0;
+  size_t rsize = -nb; /* Unsigned negation */
+  tchunkptr t;
+  bindex_t idx;
+  compute_tree_index(nb, idx);
+
+  if ((t = *treebin_at(m, idx)) != 0) {
+    /* Traverse tree for this bin looking for node with size == nb */
+    size_t sizebits =
+    nb <<
+    leftshift_for_tree_index(idx);
+    tchunkptr rst = 0;  /* The deepest untaken right subtree */
+    for (;;) {
+      tchunkptr rt;
+      size_t trem = chunksize(t) - nb;
+      if (trem < rsize) {
+        v = t;
+        if ((rsize = trem) == 0)
+          break;
+      }
+      rt = t->child[1];
+      t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
+      if (rt != 0 && rt != t)
+        rst = rt;
+      if (t == 0) {
+        t = rst; /* set t to least subtree holding sizes > nb */
+        break;
+      }
+      sizebits <<= 1;
+    }
+  }
+  if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */
+    binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap;
+    if (leftbits != 0) {
+      bindex_t i;
+      binmap_t leastbit = least_bit(leftbits);
+      compute_bit2idx(leastbit, i);
+      t = *treebin_at(m, i);
+    }
+  }
+  while (t != 0) { /* find smallest of tree or subtree */
+    size_t trem = chunksize(t) - nb;
+    if (trem < rsize) {
+      rsize = trem;
+      v = t;
+    }
+    t = leftmost_child(t);
+  }
+  /*  If dv is a better fit, return 0 so malloc will use it */
+   if (v != 0) {
+   if (RTCHECK(ok_address(m, v))) { /* split */
+      mchunkptr r = chunk_plus_offset(v, nb);
+      assert(chunksize(v) == rsize + nb);
+
+      /* check for chunk memory page-in */
+      size_t npages_out = 0;
+      if (page_not_in_memory(v, chunksize(v))) {
+          if (!is_small(rsize) && rsize>=CHUNK_PAGEOUT_THESHOLD) {
+              // partial chunk page mapping
+              TInt result = map_chunk_pages_partial(v, chunksize(v), (tchunkptr)r, rsize);
+              if (result < 0) return 0; // Failed to Commit RAM
+              else npages_out = (size_t)result;
+          }
+          else {
+              // full chunk page map needed
+              TInt err = map_chunk_pages(v, chunksize(v));
+              if (err != KErrNone)  return 0; // Failed to Commit RAM
+          }
+      }
+
+      if (RTCHECK(ok_next(v, r))) {
+        unlink_large_chunk(m, v);
+        if (rsize < free_chunk_threshold) // exaust if less than slab threshold
+          set_inuse_and_pinuse(m, v, (rsize + nb));
+        else {
+          set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+          set_size_and_pinuse_of_free_chunk(r, rsize);
+          insert_chunk(m, r, rsize, npages_out);
+        }
+        return chunk2mem(v);
+      }
+    }
+#if !INSECURE // conditional statement to keep compiler happy. code is reachable if RTCHECK evaluates to False
+    CORRUPTION_ERROR_ACTION(m);
+#endif
+  }
+  return 0;
+}
+
+/* allocate a small request from the best fitting chunk in a treebin */
+void* RNewAllocator::tmalloc_small(mstate m, size_t nb) {
+  tchunkptr t, v;
+  size_t rsize;
+  bindex_t i;
+  binmap_t leastbit = least_bit(m->treemap);
+  compute_bit2idx(leastbit, i);
+
+  v = t = *treebin_at(m, i);
+  rsize = chunksize(t) - nb;
+
+  while ((t = leftmost_child(t)) != 0) {
+    size_t trem = chunksize(t) - nb;
+    if (trem < rsize) {
+      rsize = trem;
+      v = t;
+    }
+  }
+
+  if (RTCHECK(ok_address(m, v))) {
+    mchunkptr r = chunk_plus_offset(v, nb);
+    assert(chunksize(v) == rsize + nb);
+
+    /* check for chunk memory page-in */
+      if (page_not_in_memory(v, chunksize(v))) {
+          TInt err = map_chunk_pages(v, chunksize(v));
+          if (err != KErrNone)  return 0; // Failed to Commit RAM
+      }
+
+    if (RTCHECK(ok_next(v, r))) {
+      unlink_large_chunk(m, v);
+      if (rsize < free_chunk_threshold) // exaust if less than slab threshold
+        set_inuse_and_pinuse(m, v, (rsize + nb));
+      else {
+        set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+        set_size_and_pinuse_of_free_chunk(r, rsize);
+        insert_chunk(m, r, rsize, 0);
+      }
+      return chunk2mem(v);
+    }
+  }
+#if !INSECURE // conditional statement to keep compiler happy. code is reachable if RTCHECK evaluates to False
+  CORRUPTION_ERROR_ACTION(m);
+  return 0;
+#endif
+}
+
+void RNewAllocator::init_top(mstate m, mchunkptr p, size_t psize)
+{
+    /* Ensure alignment */
+    size_t offset = align_offset(chunk2mem(p));
+    p = (mchunkptr)((TUint8*)p + offset);
+    psize -= offset;
+    m->top = p;
+    m->topsize = psize;
+    p->head = psize | PINUSE_BIT;
+    /* set size of fake trailing chunk holding overhead space only once */
+    mchunkptr chunkPlusOff = chunk_plus_offset(p, psize);
+    chunkPlusOff->head = TOP_FOOT_SIZE;
+    m->trim_check = mparams.trim_threshold; /* reset on each update */
+}
+
+void* RNewAllocator::internal_realloc(mstate m, void* oldmem, size_t bytes)
+{
+  if (bytes >= MAX_REQUEST) {
+    MALLOC_FAILURE_ACTION;
+    return 0;
+  }
+  if (!PREACTION(m)) {
+    mchunkptr oldp = mem2chunk(oldmem);
+    size_t oldsize = chunksize(oldp);
+    mchunkptr next = chunk_plus_offset(oldp, oldsize);
+    mchunkptr newp = 0;
+    void* extra = 0;
+
+    /* Try to either shrink or extend into top. Else malloc-copy-free */
+
+    if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) &&
+                ok_next(oldp, next) && ok_pinuse(next))) {
+      size_t nb = request2size(bytes);
+      if (is_mmapped(oldp))
+        newp = mmap_resize(m, oldp, nb);
+      else
+      if (oldsize >= nb) { /* already big enough */
+        size_t rsize = oldsize - nb;
+        newp = oldp;
+        if (rsize >= free_chunk_threshold) {
+          mchunkptr remainder = chunk_plus_offset(newp, nb);
+          set_inuse(m, newp, nb);
+          set_inuse(m, remainder, rsize);
+          extra = chunk2mem(remainder);
+          iTotalAllocSize -= rsize;
+  }
+      }
+        /*AMOD: Modified to optimized*/
+        else if (next == m->top && oldsize + m->topsize > nb)
+        {
+            /* Expand into top */
+            if (oldsize + m->topsize > nb)
+            {
+                size_t newsize = oldsize + m->topsize;
+                size_t newtopsize = newsize - nb;
+                mchunkptr newtop = chunk_plus_offset(oldp, nb);
+                set_inuse(m, oldp, nb);
+                newtop->head = newtopsize |PINUSE_BIT;
+                m->top = newtop;
+                m->topsize = newtopsize;
+                iTotalAllocSize += nb - oldsize;
+                newp = oldp;
+            }
+      }
+    }
+    else {
+      USAGE_ERROR_ACTION(m, oldmem);
+      POSTACTION(m);
+      return 0;
+    }
+
+    POSTACTION(m);
+
+    if (newp != 0) {
+      if (extra != 0) {
+        internal_free(m, extra);
+      }
+      check_inuse_chunk(m, newp);
+      return chunk2mem(newp);
+    }
+    else {
+      void* newmem = internal_malloc(m, bytes);
+      if (newmem != 0) {
+        size_t oc = oldsize - overhead_for(oldp);
+        memcpy(newmem, oldmem, (oc < bytes)? oc : bytes);
+        internal_free(m, oldmem);
+      }
+      return newmem;
+    }
+  }
+#if USE_LOCKS // keep the compiler happy
+  return 0;
+#endif
+}
+/* ----------------------------- statistics ------------------------------ */
+mallinfo RNewAllocator::internal_mallinfo(mstate m) {
+  struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+  TInt chunkCnt = 0;
+  if (!PREACTION(m)) {
+    check_malloc_state(m);
+    if (is_initialized(m)) {
+      size_t nfree = SIZE_T_ONE; /* top always free */
+      size_t mfree = m->topsize + TOP_FOOT_SIZE;
+      size_t sum = mfree;
+      msegmentptr s = &m->seg;
+      while (s != 0) {
+        mchunkptr q = align_as_chunk(s->base);
+        chunkCnt++;
+        while (segment_holds(s, q) &&
+               q != m->top && q->head != FENCEPOST_HEAD) {
+          size_t sz = chunksize(q);
+          sum += sz;
+          if (!cinuse(q)) {
+            if (sz > nm.largestBlock)
+              nm.largestBlock = sz;
+            mfree += sz;
+            ++nfree;
+          }
+          q = next_chunk(q);
+        }
+        s = s->next;
+      }
+      nm.arena    = sum;
+      nm.ordblks  = nfree;
+      nm.hblkhd   = m->footprint - sum;
+      nm.usmblks  = m->max_footprint;
+      nm.uordblks = m->footprint - mfree;
+      nm.fordblks = mfree;
+      nm.keepcost = m->topsize;
+      nm.cellCount= chunkCnt;/*number of chunks allocated*/
+    }
+    POSTACTION(m);
+  }
+  return nm;
+}
+
+void  RNewAllocator::internal_malloc_stats(mstate m) {
+if (!PREACTION(m)) {
+  size_t fp = 0;
+  size_t used = 0;
+  check_malloc_state(m);
+  if (is_initialized(m)) {
+    msegmentptr s = &m->seg;
+    //size_t maxfp = m->max_footprint;
+    fp = m->footprint;
+    used = fp - (m->topsize + TOP_FOOT_SIZE);
+
+    while (s != 0) {
+      mchunkptr q = align_as_chunk(s->base);
+      while (segment_holds(s, q) &&
+             q != m->top && q->head != FENCEPOST_HEAD) {
+        if (!cinuse(q))
+          used -= chunksize(q);
+        q = next_chunk(q);
+      }
+      s = s->next;
+    }
+  }
+  POSTACTION(m);
+}
+}
+/* support for mallopt */
+int RNewAllocator::change_mparam(int param_number, int value) {
+  size_t val = (size_t)value;
+  init_mparams(DEFAULT_TRIM_THRESHOLD);
+  switch (param_number) {
+  case M_TRIM_THRESHOLD:
+    mparams.trim_threshold = val;
+    return 1;
+  case M_GRANULARITY:
+    if (val >= mparams.page_size && ((val & (val-1)) == 0)) {
+      mparams.granularity = val;
+      return 1;
+    }
+    else
+      return 0;
+  case M_MMAP_THRESHOLD:
+    mparams.mmap_threshold = val;
+    return 1;
+  default:
+    return 0;
+  }
+}
+/* Get memory from system using MORECORE or MMAP */
+void* RNewAllocator::sys_alloc(mstate m, size_t nb)
+{
+    TUint8* tbase = CMFAIL;
+    size_t tsize = 0;
+    flag_t mmap_flag = 0;
+    //init_mparams();/*No need to do init_params here*/
+    /* Directly map large chunks */
+    if (use_mmap(m) && nb >= mparams.mmap_threshold)
+    {
+        void* mem = mmap_alloc(m, nb);
+        if (mem != 0)
+            return mem;
+    }
+  /*
+    Try getting memory in any of three ways (in most-preferred to
+    least-preferred order):
+    1. A call to MORECORE that can normally contiguously extend memory.
+       (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
+       or main space is mmapped or a previous contiguous call failed)
+    2. A call to MMAP new space (disabled if not HAVE_MMAP).
+       Note that under the default settings, if MORECORE is unable to
+       fulfill a request, and HAVE_MMAP is true, then mmap is
+       used as a noncontiguous system allocator. This is a useful backup
+       strategy for systems with holes in address spaces -- in this case
+       sbrk cannot contiguously expand the heap, but mmap may be able to
+       find space.
+    3. A call to MORECORE that cannot usually contiguously extend memory.
+       (disabled if not HAVE_MORECORE)
+  */
+  /*Trying to allocate the memory*/
+    if (MORECORE_CONTIGUOUS && !use_noncontiguous(m))
+    {
+    TUint8* br = CMFAIL;
+    msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (TUint8*)m->top);
+    size_t asize = 0;
+    ACQUIRE_MORECORE_LOCK(m);
+    if (ss == 0)
+    {  /* First time through or recovery */
+        TUint8* base = (TUint8*)CALL_MORECORE(0);
+        if (base != CMFAIL)
+        {
+            asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE);
+            /* Adjust to end on a page boundary */
+            if (!is_page_aligned(base))
+                asize += (page_align((size_t)base) - (size_t)base);
+            /* Can't call MORECORE if size is negative when treated as signed */
+            if (asize < HALF_MAX_SIZE_T &&(br = (TUint8*)(CALL_MORECORE(asize))) == base)
+            {
+                tbase = base;
+                tsize = asize;
+            }
+        }
+    }
+    else
+    {
+      /* Subtract out existing available top space from MORECORE request. */
+        asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE);
+    /* Use mem here only if it did continuously extend old space */
+      if (asize < HALF_MAX_SIZE_T &&
+          (br = (TUint8*)(CALL_MORECORE(asize))) == ss->base+ss->size) {
+        tbase = br;
+        tsize = asize;
+      }
+    }
+    if (tbase == CMFAIL) {    /* Cope with partial failure */
+      if (br != CMFAIL) {    /* Try to use/extend the space we did get */
+        if (asize < HALF_MAX_SIZE_T &&
+            asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) {
+          size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize);
+          if (esize < HALF_MAX_SIZE_T) {
+            TUint8* end = (TUint8*)CALL_MORECORE(esize);
+            if (end != CMFAIL)
+              asize += esize;
+            else {            /* Can't use; try to release */
+              CALL_MORECORE(-asize);
+              br = CMFAIL;
+            }
+          }
+        }
+      }
+      if (br != CMFAIL) {    /* Use the space we did get */
+        tbase = br;
+        tsize = asize;
+      }
+      else
+        disable_contiguous(m); /* Don't try contiguous path in the future */
+    }
+    RELEASE_MORECORE_LOCK(m);
+  }
+  if (HAVE_MMAP && tbase == CMFAIL) {  /* Try MMAP */
+    size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE;
+    size_t rsize = granularity_align(req);
+    if (rsize > nb) { /* Fail if wraps around zero */
+      TUint8* mp = (TUint8*)(CALL_MMAP(rsize));
+      if (mp != CMFAIL) {
+        tbase = mp;
+        tsize = rsize;
+        mmap_flag = IS_MMAPPED_BIT;
+      }
+    }
+  }
+  if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
+    size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE);
+    if (asize < HALF_MAX_SIZE_T) {
+      TUint8* br = CMFAIL;
+      TUint8* end = CMFAIL;
+      ACQUIRE_MORECORE_LOCK(m);
+      br = (TUint8*)(CALL_MORECORE(asize));
+      end = (TUint8*)(CALL_MORECORE(0));
+      RELEASE_MORECORE_LOCK(m);
+      if (br != CMFAIL && end != CMFAIL && br < end) {
+        size_t ssize = end - br;
+        if (ssize > nb + TOP_FOOT_SIZE) {
+          tbase = br;
+          tsize = ssize;
+        }
+      }
+    }
+  }
+  if (tbase != CMFAIL) {
+    if ((m->footprint += tsize) > m->max_footprint)
+      m->max_footprint = m->footprint;
+    if (!is_initialized(m)) { /* first-time initialization */
+      m->seg.base = m->least_addr = tbase;
+      m->seg.size = tsize;
+      m->seg.sflags = mmap_flag;
+      m->magic = mparams.magic;
+      init_bins(m);
+      if (is_global(m))
+        init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
+      else {
+        /* Offset top by embedded malloc_state */
+        mchunkptr mn = next_chunk(mem2chunk(m));
+        init_top(m, mn, (size_t)((tbase + tsize) - (TUint8*)mn) -TOP_FOOT_SIZE);
+      }
+    }else {
+      /* Try to merge with an existing segment */
+      msegmentptr sp = &m->seg;
+      while (sp != 0 && tbase != sp->base + sp->size)
+        sp = sp->next;
+      if (sp != 0 && !is_extern_segment(sp) &&
+          (sp->sflags & IS_MMAPPED_BIT) == mmap_flag &&
+          segment_holds(sp, m->top))
+          { /* append */
+        sp->size += tsize;
+        init_top(m, m->top, m->topsize + tsize);
+      }
+      else {
+        if (tbase < m->least_addr)
+          m->least_addr = tbase;
+        sp = &m->seg;
+        while (sp != 0 && sp->base != tbase + tsize)
+          sp = sp->next;
+        if (sp != 0 &&
+            !is_extern_segment(sp) &&
+            (sp->sflags & IS_MMAPPED_BIT) == mmap_flag) {
+          TUint8* oldbase = sp->base;
+          sp->base = tbase;
+          sp->size += tsize;
+          return prepend_alloc(m, tbase, oldbase, nb);
+        }
+        else
+          add_segment(m, tbase, tsize, mmap_flag);
+      }
+    }
+    if (nb < m->topsize) { /* Allocate from new or extended top space */
+      size_t rsize = m->topsize -= nb;
+      mchunkptr p = m->top;
+      mchunkptr r = m->top = chunk_plus_offset(p, nb);
+      r->head = rsize | PINUSE_BIT;
+      set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+      check_top_chunk(m, m->top);
+      check_malloced_chunk(m, chunk2mem(p), nb);
+      return chunk2mem(p);
+    }
+  }
+  /*need to check this*/
+  MEM_DUMP_OOM_LOGS(nb, "sys_alloc:: FAILED to get more memory");
+
+  //errno = -1;
+  return 0;
+}
+msegmentptr RNewAllocator::segment_holding(mstate m, TUint8* addr) {
+  msegmentptr sp = &m->seg;
+  for (;;) {
+    if (addr >= sp->base && addr < sp->base + sp->size)
+      return sp;
+    if ((sp = sp->next) == 0)
+      return 0;
+  }
+}
+/* Unlink the first chunk from a smallbin */
+inline void RNewAllocator::unlink_first_small_chunk(mstate M,mchunkptr B,mchunkptr P,bindex_t& I)
+{
+  mchunkptr F = P->fd;
+  assert(P != B);
+  assert(P != F);
+  assert(chunksize(P) == small_index2size(I));
+  if (B == F)
+    clear_smallmap(M, I);
+  else if (RTCHECK(ok_address(M, F))) {
+    B->fd = F;
+    F->bk = B;
+  }
+  else {
+    CORRUPTION_ERROR_ACTION(M);
+  }
+}
+/* Link a free chunk into a smallbin  */
+inline void RNewAllocator::insert_small_chunk(mstate M,mchunkptr P, size_t S)
+{
+  bindex_t I  = small_index(S);
+  mchunkptr B = smallbin_at(M, I);
+  mchunkptr F = B;
+  assert(S >= MIN_CHUNK_SIZE);
+  if (!smallmap_is_marked(M, I))
+    mark_smallmap(M, I);
+  else if (RTCHECK(ok_address(M, B->fd)))
+    F = B->fd;
+  else {
+    CORRUPTION_ERROR_ACTION(M);
+  }
+  B->fd = P;
+  F->bk = P;
+  P->fd = F;
+  P->bk = B;
+}
+
+
+inline void RNewAllocator::insert_chunk(mstate M,mchunkptr P,size_t S,size_t NPAGES)
+{
+    if (is_small(S))
+        insert_small_chunk(M, P, S);
+    else{
+        tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S, NPAGES);
+     }
+}
+
+inline void RNewAllocator::unlink_large_chunk(mstate M,tchunkptr X)
+{
+  tchunkptr XP = X->parent;
+  tchunkptr R;
+  reset_tchunk_mem_pageout(X); // clear chunk pageout flag
+  if (X->bk != X) {
+    tchunkptr F = X->fd;
+    R = X->bk;
+    if (RTCHECK(ok_address(M, F))) {
+      F->bk = R;
+      R->fd = F;
+    }
+    else {
+      CORRUPTION_ERROR_ACTION(M);
+    }
+  }
+  else {
+    tchunkptr* RP;
+    if (((R = *(RP = &(X->child[1]))) != 0) ||
+        ((R = *(RP = &(X->child[0]))) != 0)) {
+      tchunkptr* CP;
+      while ((*(CP = &(R->child[1])) != 0) ||
+             (*(CP = &(R->child[0])) != 0)) {
+        R = *(RP = CP);
+      }
+      if (RTCHECK(ok_address(M, RP)))
+        *RP = 0;
+      else {
+        CORRUPTION_ERROR_ACTION(M);
+      }
+    }
+  }
+  if (XP != 0) {
+    tbinptr* H = treebin_at(M, X->index);
+    if (X == *H) {
+      if ((*H = R) == 0)
+        clear_treemap(M, X->index);
+    }
+    else if (RTCHECK(ok_address(M, XP))) {
+      if (XP->child[0] == X)
+        XP->child[0] = R;
+      else
+        XP->child[1] = R;
+    }
+    else
+      CORRUPTION_ERROR_ACTION(M);
+    if (R != 0) {
+      if (RTCHECK(ok_address(M, R))) {
+        tchunkptr C0, C1;
+        R->parent = XP;
+        if ((C0 = X->child[0]) != 0) {
+          if (RTCHECK(ok_address(M, C0))) {
+            R->child[0] = C0;
+            C0->parent = R;
+          }
+          else
+            CORRUPTION_ERROR_ACTION(M);
+        }
+        if ((C1 = X->child[1]) != 0) {
+          if (RTCHECK(ok_address(M, C1))) {
+            R->child[1] = C1;
+            C1->parent = R;
+          }
+          else
+            CORRUPTION_ERROR_ACTION(M);
+        }
+      }
+      else
+        CORRUPTION_ERROR_ACTION(M);
+    }
+  }
+}
+
+/* Unlink a chunk from a smallbin  */
+inline void RNewAllocator::unlink_small_chunk(mstate M, mchunkptr P,size_t S)
+{
+  mchunkptr F = P->fd;
+  mchunkptr B = P->bk;
+  bindex_t I = small_index(S);
+  assert(P != B);
+  assert(P != F);
+  assert(chunksize(P) == small_index2size(I));
+  if (F == B)
+    clear_smallmap(M, I);
+  else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&
+                   (B == smallbin_at(M,I) || ok_address(M, B)))) {
+    F->bk = B;
+    B->fd = F;
+  }
+  else {
+    CORRUPTION_ERROR_ACTION(M);
+  }
+}
+
+inline void RNewAllocator::unlink_chunk(mstate M, mchunkptr P, size_t S)
+{
+  if (is_small(S))
+    unlink_small_chunk(M, P, S);
+  else
+  {
+      tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP);
+  }
+}
+
+inline void RNewAllocator::compute_tree_index(size_t S, bindex_t& I)
+{
+  size_t X = S >> TREEBIN_SHIFT;
+  if (X == 0)
+    I = 0;
+  else if (X > 0xFFFF)
+    I = NTREEBINS-1;
+  else {
+    unsigned int Y = (unsigned int)X;
+    unsigned int N = ((Y - 0x100) >> 16) & 8;
+    unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;
+    N += K;
+    N += K = (((Y <<= K) - 0x4000) >> 16) & 2;
+    K = 14 - N + ((Y <<= K) >> 15);
+    I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));
+  }
+}
+
+/* ------------------------- Operations on trees ------------------------- */
+
+/* Insert chunk into tree */
+inline void RNewAllocator::insert_large_chunk(mstate M,tchunkptr X,size_t S,size_t NPAGES)
+{
+  tbinptr* H;
+  bindex_t I;
+  compute_tree_index(S, I);
+  H = treebin_at(M, I);
+  X->index = I;
+  X->child[0] = X->child[1] = 0;
+
+  if (NPAGES) { set_tchunk_mem_pageout(X, NPAGES) }
+  else  { reset_tchunk_mem_pageout(X) }
+
+  if (!treemap_is_marked(M, I)) {
+    mark_treemap(M, I);
+    *H = X;
+    X->parent = (tchunkptr)H;
+    X->fd = X->bk = X;
+  }
+  else {
+    tchunkptr T = *H;
+    size_t K = S << leftshift_for_tree_index(I);
+    for (;;) {
+      if (chunksize(T) != S) {
+        tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);
+        K <<= 1;
+        if (*C != 0)
+          T = *C;
+        else if (RTCHECK(ok_address(M, C))) {
+          *C = X;
+          X->parent = T;
+          X->fd = X->bk = X;
+          break;
+        }
+        else {
+          CORRUPTION_ERROR_ACTION(M);
+          break;
+        }
+      }
+      else {
+        tchunkptr F = T->fd;
+        if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {
+          T->fd = F->bk = X;
+          X->fd = F;
+          X->bk = T;
+          X->parent = 0;
+          break;
+        }
+        else {
+          CORRUPTION_ERROR_ACTION(M);
+          break;
+        }
+      }
+    }
+  }
+}
+
+/*
+  Unlink steps:
+
+  1. If x is a chained node, unlink it from its same-sized fd/bk links
+     and choose its bk node as its replacement.
+  2. If x was the last node of its size, but not a leaf node, it must
+     be replaced with a leaf node (not merely one with an open left or
+     right), to make sure that lefts and rights of descendents
+     correspond properly to bit masks.  We use the rightmost descendent
+     of x.  We could use any other leaf, but this is easy to locate and
+     tends to counteract removal of leftmosts elsewhere, and so keeps
+     paths shorter than minimally guaranteed.  This doesn't loop much
+     because on average a node in a tree is near the bottom.
+  3. If x is the base of a chain (i.e., has parent links) relink
+     x's parent and children to x's replacement (or null if none).
+*/
+
+/* Replace dv node, binning the old one */
+/* Used only when dvsize known to be small */
+inline void RNewAllocator::replace_dv(mstate M, mchunkptr P, size_t S)
+{
+  size_t DVS = M->dvsize;
+  if (DVS != 0) {
+    mchunkptr DV = M->dv;
+    assert(is_small(DVS));
+    insert_small_chunk(M, DV, DVS);
+  }
+  M->dvsize = S;
+  M->dv = P;
+}
+
+inline void RNewAllocator::compute_bit2idx(binmap_t X,bindex_t& I)
+{
+    unsigned int Y = X - 1;
+    unsigned int K = Y >> (16-4) & 16;
+    unsigned int N = K;        Y >>= K;
+    N += K = Y >> (8-3) &  8;  Y >>= K;
+    N += K = Y >> (4-2) &  4;  Y >>= K;
+    N += K = Y >> (2-1) &  2;  Y >>= K;
+    N += K = Y >> (1-0) &  1;  Y >>= K;
+    I = (bindex_t)(N + Y);
+}
+
+void RNewAllocator::add_segment(mstate m, TUint8* tbase, size_t tsize, flag_t mmapped) {
+  /* Determine locations and sizes of segment, fenceposts, old top */
+  TUint8* old_top = (TUint8*)m->top;
+  msegmentptr oldsp = segment_holding(m, old_top);
+  TUint8* old_end = oldsp->base + oldsp->size;
+  size_t ssize = pad_request(sizeof(struct malloc_segment));
+  TUint8* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+  size_t offset = align_offset(chunk2mem(rawsp));
+  TUint8* asp = rawsp + offset;
+  TUint8* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp;
+  mchunkptr sp = (mchunkptr)csp;
+  msegmentptr ss = (msegmentptr)(chunk2mem(sp));
+  mchunkptr tnext = chunk_plus_offset(sp, ssize);
+  mchunkptr p = tnext;
+  int nfences = 0;
+
+  /* reset top to new space */
+  init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
+
+  /* Set up segment record */
+  assert(is_aligned(ss));
+  set_size_and_pinuse_of_inuse_chunk(m, sp, ssize);
+  *ss = m->seg; /* Push current record */
+  m->seg.base = tbase;
+  m->seg.size = tsize;
+  m->seg.sflags = mmapped;
+  m->seg.next = ss;
+
+  /* Insert trailing fenceposts */
+  for (;;) {
+    mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE);
+    p->head = FENCEPOST_HEAD;
+    ++nfences;
+    if ((TUint8*)(&(nextp->head)) < old_end)
+      p = nextp;
+    else
+      break;
+  }
+  assert(nfences >= 2);
+
+  /* Insert the rest of old top into a bin as an ordinary free chunk */
+  if (csp != old_top) {
+    mchunkptr q = (mchunkptr)old_top;
+    size_t psize = csp - old_top;
+    mchunkptr tn = chunk_plus_offset(q, psize);
+    set_free_with_pinuse(q, psize, tn);
+    insert_chunk(m, q, psize, 0);
+  }
+
+  check_top_chunk(m, m->top);
+}
+
+
+void* RNewAllocator::prepend_alloc(mstate m, TUint8* newbase, TUint8* oldbase,
+                           size_t nb) {
+  mchunkptr p = align_as_chunk(newbase);
+  mchunkptr oldfirst = align_as_chunk(oldbase);
+  size_t psize = (TUint8*)oldfirst - (TUint8*)p;
+  mchunkptr q = chunk_plus_offset(p, nb);
+  size_t qsize = psize - nb;
+  set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+
+  assert((TUint8*)oldfirst > (TUint8*)q);
+  assert(pinuse(oldfirst));
+  assert(qsize >= MIN_CHUNK_SIZE);
+
+  /* consolidate remainder with first chunk of old base */
+  if (oldfirst == m->top) {
+    size_t tsize = m->topsize += qsize;
+    m->top = q;
+    q->head = tsize | PINUSE_BIT;
+    check_top_chunk(m, q);
+  }
+  else {
+    if (!cinuse(oldfirst)) {
+      size_t nsize = chunksize(oldfirst);
+
+      /* check for chunk memory page-in */
+      if (page_not_in_memory(oldfirst, nsize))
+        map_chunk_pages((tchunkptr)oldfirst, nsize);       //Err Ignored, branch not reachable.
+
+      unlink_chunk(m, oldfirst, nsize);
+      oldfirst = chunk_plus_offset(oldfirst, nsize);
+      qsize += nsize;
+    }
+    set_free_with_pinuse(q, qsize, oldfirst);
+    insert_chunk(m, q, qsize, 0);
+    check_free_chunk(m, q);
+  }
+
+  check_malloced_chunk(m, chunk2mem(p), nb);
+  return chunk2mem(p);
+}
+
+void* RNewAllocator::mmap_alloc(mstate m, size_t nb) {
+  size_t mmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+  if (mmsize > nb) {     /* Check for wrap around 0 */
+    TUint8* mm = (TUint8*)(DIRECT_MMAP(mmsize));
+    if (mm != CMFAIL) {
+      size_t offset = align_offset(chunk2mem(mm));
+      size_t psize = mmsize - offset - MMAP_FOOT_PAD;
+      mchunkptr p = (mchunkptr)(mm + offset);
+      p->prev_foot = offset | IS_MMAPPED_BIT;
+      (p)->head = (psize|CINUSE_BIT);
+      mark_inuse_foot(m, p, psize);
+      chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
+      chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0;
+
+      if (mm < m->least_addr)
+        m->least_addr = mm;
+      if ((m->footprint += mmsize) > m->max_footprint)
+        m->max_footprint = m->footprint;
+      assert(is_aligned(chunk2mem(p)));
+      check_mmapped_chunk(m, p);
+      return chunk2mem(p);
+    }
+  }
+  return 0;
+}
+
+    int RNewAllocator::sys_trim(mstate m, size_t pad)
+    {
+      size_t released = 0;
+      if (pad < MAX_REQUEST && is_initialized(m)) {
+        pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
+
+        if (m->topsize > pad) {
+          /* Shrink top space in granularity-size units, keeping at least one */
+          size_t unit = mparams.granularity;
+                size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - SIZE_T_ONE) * unit;
+          msegmentptr sp = segment_holding(m, (TUint8*)m->top);
+
+          if (!is_extern_segment(sp)) {
+            if (is_mmapped_segment(sp)) {
+              if (HAVE_MMAP &&
+                  sp->size >= extra &&
+                  !has_segment_link(m, sp)) { /* can't shrink if pinned */
+                /*size_t newsize = sp->size - extra; */
+                /* Prefer mremap, fall back to munmap */
+                if ((CALL_MREMAP(sp->base, sp->size, sp->size - extra, 0) != MFAIL) ||
+                    (CALL_MUNMAP(sp->base + sp->size - extra, extra) == 0)) {
+                  released = extra;
+                }
+              }
+            }
+            else if (HAVE_MORECORE) {
+              if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
+                extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit;
+              ACQUIRE_MORECORE_LOCK(m);
+              {
+                /* Make sure end of memory is where we last set it. */
+                TUint8* old_br = (TUint8*)(CALL_MORECORE(0));
+                if (old_br == sp->base + sp->size) {
+                  TUint8* rel_br = (TUint8*)(CALL_MORECORE(-extra));
+                  TUint8* new_br = (TUint8*)(CALL_MORECORE(0));
+                  if (rel_br != CMFAIL && new_br < old_br)
+                    released = old_br - new_br;
+                }
+              }
+              RELEASE_MORECORE_LOCK(m);
+            }
+          }
+
+          if (released != 0) {
+            sp->size -= released;
+            m->footprint -= released;
+            init_top(m, m->top, m->topsize - released);
+            check_top_chunk(m, m->top);
+          }
+        }
+
+        /* Unmap any unused mmapped segments */
+        if (HAVE_MMAP)
+          released += release_unused_segments(m);
+
+        /* On failure, disable autotrim to avoid repeated failed future calls */
+        if (released == 0)
+          m->trim_check = MAX_SIZE_T;
+      }
+
+      return (released != 0)? 1 : 0;
+    }
+
+    inline int RNewAllocator::has_segment_link(mstate m, msegmentptr ss)
+    {
+      msegmentptr sp = &m->seg;
+      for (;;) {
+        if ((TUint8*)sp >= ss->base && (TUint8*)sp < ss->base + ss->size)
+          return 1;
+        if ((sp = sp->next) == 0)
+          return 0;
+      }
+    }
+
+    /* Unmap and unlink any mmapped segments that don't contain used chunks */
+    size_t RNewAllocator::release_unused_segments(mstate m)
+    {
+      size_t released = 0;
+      msegmentptr pred = &m->seg;
+      msegmentptr sp = pred->next;
+      while (sp != 0) {
+        TUint8* base = sp->base;
+        size_t size = sp->size;
+        msegmentptr next = sp->next;
+        if (is_mmapped_segment(sp) && !is_extern_segment(sp)) {
+          mchunkptr p = align_as_chunk(base);
+          size_t psize = chunksize(p);
+          /* Can unmap if first chunk holds entire segment and not pinned */
+          if (!cinuse(p) && (TUint8*)p + psize >= base + size - TOP_FOOT_SIZE) {
+            tchunkptr tp = (tchunkptr)p;
+            size_t npages_out = tp->npages;
+            assert(segment_holds(sp, (TUint8*)sp));
+            unlink_large_chunk(m, tp);
+            if (CALL_MUNMAP(base, size) == 0) {
+              released += size;
+              m->footprint -= size;
+              /* unlink obsoleted record */
+              sp = pred;
+              sp->next = next;
+            }
+            else { /* back out if cannot unmap */
+              insert_large_chunk(m, tp, psize, npages_out);
+            }
+          }
+        }
+        pred = sp;
+        sp = next;
+      }/*End of while*/
+      return released;
+    }
+    /* Realloc using mmap */
+    inline  mchunkptr RNewAllocator::mmap_resize(mstate m, mchunkptr oldp, size_t nb)
+    {
+      size_t oldsize = chunksize(oldp);
+      if (is_small(nb)) /* Can't shrink mmap regions below small size */
+        return 0;
+      /* Keep old chunk if big enough but not too big */
+      if (oldsize >= nb + SIZE_T_SIZE &&
+          (oldsize - nb) <= (mparams.granularity << 1))
+        return oldp;
+      else {
+        size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT;
+        size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
+        size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES +
+                                             CHUNK_ALIGN_MASK);
+        TUint8* cp = (TUint8*)CALL_MREMAP((char*)oldp - offset,
+                                      oldmmsize, newmmsize, 1);
+        if (cp != CMFAIL) {
+          mchunkptr newp = (mchunkptr)(cp + offset);
+          size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
+          newp->head = (psize|CINUSE_BIT);
+          mark_inuse_foot(m, newp, psize);
+          chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD;
+          chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0;
+
+          if (cp < m->least_addr)
+            m->least_addr = cp;
+          if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint)
+            m->max_footprint = m->footprint;
+          check_mmapped_chunk(m, newp);
+          return newp;
+        }
+      }
+      return 0;
+    }
+
+
+void RNewAllocator::Init_Dlmalloc(size_t capacity, int locked, size_t aTrimThreshold)
+    {
+        memset(gm,0,sizeof(malloc_state));
+        init_mparams(aTrimThreshold); /* Ensure pagesize etc initialized */
+        // The maximum amount that can be allocated can be calculated as:-
+        // 2^sizeof(size_t) - sizeof(malloc_state) - TOP_FOOT_SIZE - page size (all accordingly padded)
+        // If the capacity exceeds this, no allocation will be done.
+        gm->seg.base = gm->least_addr = iBase;
+        gm->seg.size = capacity;
+        gm->seg.sflags = !IS_MMAPPED_BIT;
+        set_lock(gm, locked);
+        gm->magic = mparams.magic;
+        init_bins(gm);
+        init_top(gm, (mchunkptr)iBase, capacity - TOP_FOOT_SIZE);
+    }
+
+void* RNewAllocator::dlmalloc(size_t bytes) {
+  /*
+     Basic algorithm:
+     If a small request (< 256 bytes minus per-chunk overhead):
+       1. If one exists, use a remainderless chunk in associated smallbin.
+          (Remainderless means that there are too few excess bytes to represent as a chunk.)
+       2. If one exists, split the smallest available chunk in a bin, saving remainder in bin.
+       4. If it is big enough, use the top chunk.
+       5. If available, get memory from system and use it
+     Otherwise, for a large request:
+       1. Find the smallest available binned chunk that fits, splitting if necessary.
+       3. If it is big enough, use the top chunk.
+       4. If request size >= mmap threshold, try to directly mmap this chunk.
+       5. If available, get memory from system and use it
+
+     The ugly goto's here ensure that postaction occurs along all paths.
+  */
+  if (!PREACTION(gm)) {
+    void* mem;
+    size_t nb;
+    if (bytes <= MAX_SMALL_REQUEST) {
+      bindex_t idx;
+      binmap_t smallbits;
+      nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
+      idx = small_index(nb);
+      smallbits = gm->smallmap >> idx;
+
+      if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
+        mchunkptr b, p;
+        idx += ~smallbits & 1;       /* Uses next bin if idx empty */
+        b = smallbin_at(gm, idx);
+        p = b->fd;
+        assert(chunksize(p) == small_index2size(idx));
+        unlink_first_small_chunk(gm, b, p, idx);
+        set_inuse_and_pinuse(gm, p, small_index2size(idx));
+        mem = chunk2mem(p);
+        check_malloced_chunk(gm, mem, nb);
+        goto postaction;
+      } else {
+        if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
+          mchunkptr b, p, r;
+          size_t rsize;
+          bindex_t i;
+          binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
+          binmap_t leastbit = least_bit(leftbits);
+          compute_bit2idx(leastbit, i);
+          b = smallbin_at(gm, i);
+          p = b->fd;
+          assert(chunksize(p) == small_index2size(i));
+          unlink_first_small_chunk(gm, b, p, i);
+          rsize = small_index2size(i) - nb;
+          /* Fit here cannot be remainderless if 4byte sizes */
+          if (rsize < free_chunk_threshold)
+            set_inuse_and_pinuse(gm, p, small_index2size(i));
+          else {
+            set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+            r = chunk_plus_offset(p, nb);
+            set_size_and_pinuse_of_free_chunk(r, rsize);
+            insert_chunk(gm, r, rsize, 0);
+          }
+          mem = chunk2mem(p);
+          check_malloced_chunk(gm, mem, nb);
+          goto postaction;
+        }
+
+        else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) {
+          check_malloced_chunk(gm, mem, nb);
+          goto postaction;
+        }
+      }
+    } /* else - large alloc request */
+    else if (bytes >= MAX_REQUEST)
+      nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
+    else {
+      nb = pad_request(bytes);
+      if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) {
+        check_malloced_chunk(gm, mem, nb);
+        goto postaction;
+      }
+    }
+
+    if (nb < gm->topsize) { /* Split top */
+      size_t rsize = gm->topsize -= nb;
+      mchunkptr p = gm->top;
+      mchunkptr r = gm->top = chunk_plus_offset(p, nb);
+      r->head = rsize | PINUSE_BIT;
+      set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+      mem = chunk2mem(p);
+      check_top_chunk(gm, gm->top);
+      check_malloced_chunk(gm, mem, nb);
+      goto postaction;
+    }
+
+    mem = sys_alloc(gm, nb);
+
+  postaction:
+    POSTACTION(gm);
+#ifdef DL_CHUNK_MEM_DEBUG
+    if (mem) {
+        mchunkptr pp = mem2chunk(mem);
+        do_check_any_chunk_access(pp, chunksize(pp));
+    }
+#endif
+
+    if (mem) {
+        mchunkptr pp = mem2chunk(mem);
+        iTotalAllocSize += chunksize(pp);
+    }
+
+    return mem;
+  }
+#if USE_LOCKS // keep the compiler happy
+  return 0;
+#endif
+}
+
+void RNewAllocator::dlfree(void* mem) {
+  /*
+     Consolidate freed chunks with preceeding or succeeding bordering
+     free chunks, if they exist, and then place in a bin.  Intermixed
+     with special cases for top, dv, mmapped chunks, and usage errors.
+  */
+
+    if (mem != 0)
+    {
+        size_t unmapped_pages = 0;
+        int prev_chunk_unmapped = 0;
+        mchunkptr p  = mem2chunk(mem);
+#if FOOTERS
+        mstate fm = get_mstate_for(p);
+        if (!ok_magic(fm))
+        {
+            USAGE_ERROR_ACTION(fm, p);
+            return;
+        }
+#else /* FOOTERS */
+#define fm gm
+#endif /* FOOTERS */
+
+        if (!PREACTION(fm))
+        {
+            check_inuse_chunk(fm, p);
+            if (RTCHECK(ok_address(fm, p) && ok_cinuse(p)))
+            {
+                size_t psize = chunksize(p);
+                iTotalAllocSize -= psize;
+                mchunkptr next = chunk_plus_offset(p, psize);
+                if (!pinuse(p))
+                {
+                    size_t prevsize = p->prev_foot;
+                    if ((prevsize & IS_MMAPPED_BIT) != 0)
+                    {
+                        prevsize &= ~IS_MMAPPED_BIT;
+                        psize += prevsize + MMAP_FOOT_PAD;
+                            if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
+                                fm->footprint -= psize;
+                            goto postaction;
+                    }
+                    else
+                    {
+                        mchunkptr prev = chunk_minus_offset(p, prevsize);
+                        if (page_not_in_memory(prev, prevsize)) {
+                            prev_chunk_unmapped = 1;
+                            unmapped_pages = ((tchunkptr)prev)->npages;
+                        }
+
+                        psize += prevsize;
+                        p = prev;
+                        if (RTCHECK(ok_address(fm, prev)))
+                        { /* consolidate backward */
+                            unlink_chunk(fm, p, prevsize);
+                        }
+                        else
+                            goto erroraction;
+                    }
+                }
+
+                if (RTCHECK(ok_next(p, next) && ok_pinuse(next)))
+                {
+                    if (!cinuse(next))
+                    {  /* consolidate forward */
+                        if (next == fm->top)
+                        {
+                            if (prev_chunk_unmapped) { // previous chunk is unmapped
+                            /* unmap all pages between previously unmapped and end of top chunk
+                               and reset top to beginning of prev chunk - done in sys_trim_partial() */
+                                sys_trim_partial(fm, p, psize, unmapped_pages);
+                                do_check_any_chunk_access(fm->top, fm->topsize);
+                                goto postaction;
+                            }
+                            else { // forward merge to top
+                                size_t tsize = fm->topsize += psize;
+                                fm->top = p;
+                                p->head = tsize | PINUSE_BIT;
+                                if (should_trim(fm, tsize))
+                                    sys_trim(fm, 0);
+                                do_check_any_chunk_access(fm->top, fm->topsize);
+                                goto postaction;
+                            }
+                        }
+                        else
+                        {
+                            size_t nsize = chunksize(next);
+                            //int next_chunk_unmapped = 0;
+                            if ( page_not_in_memory(next, nsize) ) {
+                                //next_chunk_unmapped = 1;
+                                unmapped_pages += ((tchunkptr)next)->npages;
+                            }
+
+                            psize += nsize;
+                            unlink_chunk(fm, next, nsize);
+                            set_size_and_pinuse_of_free_chunk(p, psize);
+                        }
+                    }
+                    else
+                        set_free_with_pinuse(p, psize, next);
+
+                    /* check if chunk memmory can be released */
+                    size_t npages_out = 0;
+                    if (!is_small(psize) && psize>=CHUNK_PAGEOUT_THESHOLD)
+                        npages_out = unmap_chunk_pages((tchunkptr)p, psize, unmapped_pages);
+
+                    insert_chunk(fm, p, psize, npages_out);
+                    check_free_chunk(fm, p);
+                    do_chunk_page_release_check(p, psize, fm, npages_out);
+                    goto postaction;
+                }
+            }
+erroraction:
+        USAGE_ERROR_ACTION(fm, p);
+postaction:
+        POSTACTION(fm);
+        }
+    }
+#if !FOOTERS
+#undef fm
+#endif /* FOOTERS */
+}
+
+void* RNewAllocator::dlrealloc(void* oldmem, size_t bytes) {
+  if (oldmem == 0)
+    return dlmalloc(bytes);
+#ifdef REALLOC_ZERO_BYTES_FREES
+  if (bytes == 0) {
+    dlfree(oldmem);
+    return 0;
+  }
+#endif /* REALLOC_ZERO_BYTES_FREES */
+  else {
+#if ! FOOTERS
+    mstate m = gm;
+#else /* FOOTERS */
+    mstate m = get_mstate_for(mem2chunk(oldmem));
+    if (!ok_magic(m)) {
+      USAGE_ERROR_ACTION(m, oldmem);
+      return 0;
+    }
+#endif /* FOOTERS */
+    return internal_realloc(m, oldmem, bytes);
+  }
+}
+
+
+int RNewAllocator::dlmalloc_trim(size_t pad) {
+  int result = 0;
+  if (!PREACTION(gm)) {
+    result = sys_trim(gm, pad);
+    POSTACTION(gm);
+  }
+  return result;
+}
+
+size_t RNewAllocator::dlmalloc_footprint(void) {
+  return gm->footprint;
+}
+
+size_t RNewAllocator::dlmalloc_max_footprint(void) {
+  return gm->max_footprint;
+}
+
+#if !NO_MALLINFO
+struct mallinfo RNewAllocator::dlmallinfo(void) {
+  return internal_mallinfo(gm);
+}
+#endif /* NO_MALLINFO */
+
+void RNewAllocator::dlmalloc_stats() {
+  internal_malloc_stats(gm);
+}
+
+int RNewAllocator::dlmallopt(int param_number, int value) {
+  return change_mparam(param_number, value);
+}
+
+//inline slab* slab::slabfor(void* p)
+slab* slab::slabfor( const void* p)
+{
+return (slab*)(floor(p, slabsize));
+}
+
+
+void RNewAllocator::tree_remove(slab* s)
+{
+    slab** r = s->parent;
+    slab* c1 = s->child1;
+    slab* c2 = s->child2;
+    for (;;)
+    {
+        if (!c2)
+        {
+            *r = c1;
+            if (c1)
+                c1->parent = r;
+            return;
+        }
+        if (!c1)
+        {
+            *r = c2;
+            c2->parent = r;
+            return;
+        }
+        if (c1 > c2)
+        {
+            slab* c3 = c1;
+            c1 = c2;
+            c2 = c3;
+        }
+        slab* newc2 = c1->child2;
+        *r = c1;
+        c1->parent = r;
+        c1->child2 = c2;
+        c2->parent = &c1->child2;
+        s = c1;
+        c1 = s->child1;
+        c2 = newc2;
+        r = &s->child1;
+    }
+}
+void RNewAllocator::tree_insert(slab* s,slab** r)
+    {
+        slab* n = *r;
+        for (;;)
+        {
+            if (!n)
+            {   // tree empty
+                *r = s;
+                s->parent = r;
+                s->child1 = s->child2 = 0;
+                break;
+            }
+            if (s < n)
+            {   // insert between parent and n
+                *r = s;
+                s->parent = r;
+                s->child1 = n;
+                s->child2 = 0;
+                n->parent = &s->child1;
+                break;
+            }
+            slab* c1 = n->child1;
+            slab* c2 = n->child2;
+            if ((c1 - 1) > (c2 - 1))
+            {
+                r = &n->child1;
+                n = c1;
+            }
+            else
+            {
+                r = &n->child2;
+                n = c2;
+            }
+        }
+    }
+void* RNewAllocator::allocnewslab(slabset& allocator)
+//
+// Acquire and initialise a new slab, returning a cell from the slab
+// The strategy is:
+// 1. Use the lowest address free slab, if available. This is done by using the lowest slab
+//    in the page at the root of the partial_page heap (which is address ordered). If the
+//    is now fully used, remove it from the partial_page heap.
+// 2. Allocate a new page for slabs if no empty slabs are available
+//
+{
+    page* p = page::pagefor(partial_page);
+    if (!p)
+        return allocnewpage(allocator);
+
+    unsigned h = p->slabs[0].header;
+    unsigned pagemap = header_pagemap(h);
+    ASSERT(&p->slabs[hibit(pagemap)] == partial_page);
+
+    unsigned slabix = lowbit(pagemap);
+    p->slabs[0].header = h &~ (0x100<<slabix);
+    if (!(pagemap &~ (1<<slabix)))
+    {
+        tree_remove(partial_page);  // last free slab in page
+    }
+    return allocator.initslab(&p->slabs[slabix]);
+}
+
+/**Defination of this functionis not there in proto code***/
+#if 0
+void RNewAllocator::partial_insert(slab* s)
+    {
+        // slab has had first cell freed and needs to be linked back into partial tree
+        slabset& ss = slaballoc[sizemap[s->clz]];
+
+        ASSERT(s->used == slabfull);
+        s->used = ss.fulluse - s->clz;      // full-1 loading
+        tree_insert(s,&ss.partial);
+        checktree(ss.partial);
+    }
+/**Defination of this functionis not there in proto code***/
+#endif
+
+void* RNewAllocator::allocnewpage(slabset& allocator)
+//
+// Acquire and initialise a new page, returning a cell from a new slab
+// The partial_page tree is empty (otherwise we'd have used a slab from there)
+// The partial_page link is put in the highest addressed slab in the page, and the
+// lowest addressed slab is used to fulfill the allocation request
+//
+{
+    page* p  = spare_page;
+    if (p)
+        spare_page = 0;
+    else
+    {
+        p = static_cast<page*>(map(0,pagesize));
+        if (!p)
+            return 0;
+    }
+    ASSERT(p == floor(p,pagesize));
+    p->slabs[0].header = ((1<<3) + (1<<2) + (1<<1))<<8;     // set pagemap
+    p->slabs[3].parent = &partial_page;
+    p->slabs[3].child1 = p->slabs[3].child2 = 0;
+    partial_page = &p->slabs[3];
+    return allocator.initslab(&p->slabs[0]);
+}
+
+void RNewAllocator::freepage(page* p)
+//
+// Release an unused page to the OS
+// A single page is cached for reuse to reduce thrashing
+// the OS allocator.
+//
+{
+    ASSERT(ceiling(p,pagesize) == p);
+    if (!spare_page)
+    {
+        spare_page = p;
+        return;
+    }
+    unmap(p,pagesize);
+}
+
+void RNewAllocator::freeslab(slab* s)
+//
+// Release an empty slab to the slab manager
+// The strategy is:
+// 1. The page containing the slab is checked to see the state of the other slabs in the page by
+//    inspecting the pagemap field in the header of the first slab in the page.
+// 2. The pagemap is updated to indicate the new unused slab
+// 3. If this is the only unused slab in the page then the slab header is used to add the page to
+//    the partial_page tree/heap
+// 4. If all the slabs in the page are now unused the page is release back to the OS
+// 5. If this slab has a higher address than the one currently used to track this page in
+//    the partial_page heap, the linkage is moved to the new unused slab
+//
+{
+    tree_remove(s);
+    checktree(*s->parent);
+    ASSERT(header_usedm4(s->header) == header_size(s->header)-4);
+    CHECK(s->header |= 0xFF00000);          // illegal value for debug purposes
+    page* p = page::pagefor(s);
+    unsigned h = p->slabs[0].header;
+    int slabix = s - &p->slabs[0];
+    unsigned pagemap = header_pagemap(h);
+    p->slabs[0].header = h | (0x100<<slabix);
+    if (pagemap == 0)
+    {   // page was full before, use this slab as link in empty heap
+        tree_insert(s, &partial_page);
+    }
+    else
+    {   // find the current empty-link slab
+        slab* sl = &p->slabs[hibit(pagemap)];
+        pagemap ^= (1<<slabix);
+        if (pagemap == 0xf)
+        {   // page is now empty so recycle page to os
+            tree_remove(sl);
+            freepage(p);
+            return;
+        }
+        // ensure the free list link is in highest address slab in page
+        if (s > sl)
+        {   // replace current link with new one. Address-order tree so position stays the same
+            slab** r = sl->parent;
+            slab* c1 = sl->child1;
+            slab* c2 = sl->child2;
+            s->parent = r;
+            s->child1 = c1;
+            s->child2 = c2;
+            *r = s;
+            if (c1)
+                c1->parent = &s->child1;
+            if (c2)
+                c2->parent = &s->child2;
+        }
+        CHECK(if (s < sl) s=sl);
+    }
+    ASSERT(header_pagemap(p->slabs[0].header) != 0);
+    ASSERT(hibit(header_pagemap(p->slabs[0].header)) == unsigned(s - &p->slabs[0]));
+}
+
+void RNewAllocator::slab_init(unsigned slabbitmap)
+{
+    ASSERT((slabbitmap & ~okbits) == 0);
+    ASSERT(maxslabsize <= 60);
+
+    slab_threshold=0;
+    partial_page = 0;
+    unsigned char ix = 0xff;
+    unsigned bit = 1<<((maxslabsize>>2)-1);
+    for (int sz = maxslabsize; sz >= 0; sz -= 4, bit >>= 1)
+    {
+        if (slabbitmap & bit)
+        {
+            if (++ix == 0)
+                slab_threshold=sz+1;
+            slabset& c = slaballoc[ix];
+            c.size = sz;
+            c.partial = 0;
+        }
+        sizemap[sz>>2] = ix;
+    }
+
+    free_chunk_threshold = pad_request(slab_threshold);
+}
+
+void* RNewAllocator::slab_allocate(slabset& ss)
+//
+// Allocate a cell from the given slabset
+// Strategy:
+// 1. Take the partially full slab at the top of the heap (lowest address).
+// 2. If there is no such slab, allocate from a new slab
+// 3. If the slab has a non-empty freelist, pop the cell from the front of the list and update the slab
+// 4. Otherwise, if the slab is not full, return the cell at the end of the currently used region of
+//    the slab, updating the slab
+// 5. Otherwise, release the slab from the partial tree/heap, marking it as 'floating' and go back to
+//    step 1
+//
+{
+    for (;;)
+    {
+        slab *s = ss.partial;
+        if (!s)
+            break;
+        unsigned h = s->header;
+        unsigned free = h & 0xff;       // extract free cell positiong
+        if (free)
+        {
+            ASSERT(((free<<2)-sizeof(slabhdr))%header_size(h) == 0);
+            void* p = offset(s,free<<2);
+            free = *(unsigned char*)p;  // get next pos in free list
+            h += (h&0x3C000)<<6;        // update usedm4
+            h &= ~0xff;
+            h |= free;                  // update freelist
+            s->header = h;
+            ASSERT(header_free(h) == 0 || ((header_free(h)<<2)-sizeof(slabhdr))%header_size(h) == 0);
+            ASSERT(header_usedm4(h) <= 0x3F8u);
+            ASSERT((header_usedm4(h)+4)%header_size(h) == 0);
+            return p;
+        }
+        unsigned h2 = h + ((h&0x3C000)<<6);
+        if (h2 < 0xfc00000)
+        {
+            ASSERT((header_usedm4(h2)+4)%header_size(h2) == 0);
+            s->header = h2;
+            return offset(s,(h>>18) + sizeof(unsigned) + sizeof(slabhdr));
+        }
+        h |= 0x80000000;                // mark the slab as full-floating
+        s->header = h;
+        tree_remove(s);
+        checktree(ss.partial);
+        // go back and try the next slab...
+    }
+    // no partial slabs found, so allocate from a new slab
+    return allocnewslab(ss);
+}
+
+void RNewAllocator::slab_free(void* p)
+//
+// Free a cell from the slab allocator
+// Strategy:
+// 1. Find the containing slab (round down to nearest 1KB boundary)
+// 2. Push the cell into the slab's freelist, and update the slab usage count
+// 3. If this is the last allocated cell, free the slab to the main slab manager
+// 4. If the slab was full-floating then insert the slab in it's respective partial tree
+//
+{
+    ASSERT(lowbits(p,3)==0);
+    slab* s = slab::slabfor(p);
+
+    unsigned pos = lowbits(p, slabsize);
+    unsigned h = s->header;
+    ASSERT(header_usedm4(h) != 0x3fC);      // slab is empty already
+    ASSERT((pos-sizeof(slabhdr))%header_size(h) == 0);
+    *(unsigned char*)p = (unsigned char)h;
+    h &= ~0xFF;
+    h |= (pos>>2);
+    unsigned size = h & 0x3C000;
+    unsigned allocSize = (h & 0x3F000) >> 12; // size is stored in bits 12...17 in slabhdr
+    iTotalAllocSize -= allocSize;
+    if (int(h) >= 0)
+    {
+        h -= size<<6;
+        if (int(h)>=0)
+        {
+            s->header = h;
+            return;
+        }
+        freeslab(s);
+        return;
+    }
+    h -= size<<6;
+    h &= ~0x80000000;
+    s->header = h;
+    slabset& ss = slaballoc[sizemap[size>>14]];
+    tree_insert(s,&ss.partial);
+    checktree(ss.partial);
+}
+
+void* slabset::initslab(slab* s)
+//
+// initialise an empty slab for this allocator and return the fist cell
+// pre-condition: the slabset has no partial slabs for allocation
+//
+{
+    ASSERT(partial==0);
+    unsigned h = s->header & 0xF00; // preserve pagemap only
+    h |= (size<<12);                    // set size
+    h |= (size-4)<<18;                  // set usedminus4 to one object minus 4
+    s->header = h;
+    partial = s;
+    s->parent = &partial;
+    s->child1 = s->child2 = 0;
+    return offset(s,sizeof(slabhdr));
+}
+
+TAny* RNewAllocator::SetBrk(TInt32 aDelta)
+{
+    if (iFlags & EFixedSize)
+        return MFAIL;
+
+    if (aDelta < 0)
+        {
+        unmap(offset(iTop, aDelta), -aDelta);
+        }
+    else if (aDelta > 0)
+        {
+        if (!map(iTop, aDelta))
+            return MFAIL;
+        }
+    void * p =iTop;
+    iTop = offset(iTop, aDelta);
+    return p;
+}
+
+void* RNewAllocator::map(void* p,unsigned sz)
+//
+// allocate pages in the chunk
+// if p is NULL, find and allocate the required number of pages (which must lie in the lower half)
+// otherwise commit the pages specified
+//
+{
+ASSERT(p == floor(p, pagesize));
+ASSERT(sz == ceiling(sz, pagesize));
+ASSERT(sz > 0);
+
+    if (iChunkSize + sz > iMaxLength)
+        return 0;
+
+    RChunk chunk;
+    chunk.SetHandle(iChunkHandle);
+    if (p)
+    {
+        TInt r = chunk.Commit(iOffset + ptrdiff(p, this),sz);
+        if (r < 0)
+            return 0;
+        iChunkSize += sz;
+        return p;
+    }
+
+    TInt r = chunk.Allocate(sz);
+    if (r < 0)
+        return 0;
+    if (r > iOffset)
+    {
+        // can't allow page allocations in DL zone
+        chunk.Decommit(r, sz);
+        return 0;
+    }
+    iChunkSize += sz;
+#ifdef TRACING_HEAPS
+    if (iChunkSize > iHighWaterMark)
+        {
+            iHighWaterMark = ceiling(iChunkSize,16*pagesize);
+
+
+            RChunk chunk;
+            chunk.SetHandle(iChunkHandle);
+            TKName chunk_name;
+            chunk.FullName(chunk_name);
+            BTraceContextBig(BTrace::ETest1, 4, 44, chunk_name.Ptr(), chunk_name.Size());
+
+            TUint32 traceData[6];
+            traceData[0] = iChunkHandle;
+            traceData[1] = iMinLength;
+            traceData[2] = iMaxLength;
+            traceData[3] = sz;
+            traceData[4] = iChunkSize;
+            traceData[5] = iHighWaterMark;
+            BTraceContextN(BTrace::ETest1, 3, (TUint32)this, 33, traceData, sizeof(traceData));
+        }
+#endif
+
+    return offset(this, r - iOffset);
+    // code below does delayed initialisation of the slabs.
+    /*
+    if (iChunkSize >= slab_init_threshold)
+    {   // set up slab system now that heap is large enough
+        slab_config(slab_config_bits);
+        slab_init_threshold = KMaxTUint;
+    }
+    return p;
+    */
+}
+
+void* RNewAllocator::remap(void* p,unsigned oldsz,unsigned sz)
+{
+    if (oldsz > sz)
+        {   // shrink
+        unmap(offset(p,sz), oldsz-sz);
+        }
+    else if (oldsz < sz)
+        {   // grow, try and do this in place first
+        if (!map(offset(p, oldsz), sz-oldsz))
+            {
+            // need to allocate-copy-free
+            void* newp = map(0, sz);
+            if (newp) {
+                memcpy(newp, p, oldsz);
+                unmap(p,oldsz);
+            }
+            return newp;
+            }
+        }
+    return p;
+}
+
+void RNewAllocator::unmap(void* p,unsigned sz)
+{
+    ASSERT(p == floor(p, pagesize));
+    ASSERT(sz == ceiling(sz, pagesize));
+    ASSERT(sz > 0);
+
+    RChunk chunk;
+    chunk.SetHandle(iChunkHandle);
+    TInt r = chunk.Decommit(ptrdiff(p, offset(this,-iOffset)), sz);
+    //TInt offset = (TUint8*)p-(TUint8*)chunk.Base();
+    //TInt r = chunk.Decommit(offset,sz);
+
+    ASSERT(r >= 0);
+    iChunkSize -= sz;
+#ifdef TRACING_HEAPS
+    if (iChunkSize > iHighWaterMark)
+        {
+            iHighWaterMark = ceiling(iChunkSize,16*pagesize);
+
+
+            RChunk chunk;
+            chunk.SetHandle(iChunkHandle);
+            TKName chunk_name;
+            chunk.FullName(chunk_name);
+            BTraceContextBig(BTrace::ETest1, 4, 44, chunk_name.Ptr(), chunk_name.Size());
+
+            TUint32 traceData[6];
+            traceData[0] = iChunkHandle;
+            traceData[1] = iMinLength;
+            traceData[2] = iMaxLength;
+            traceData[3] = sz;
+            traceData[4] = iChunkSize;
+            traceData[5] = iHighWaterMark;
+            BTraceContextN(BTrace::ETest1, 3, (TUint32)this, 33, traceData, sizeof(traceData));
+        }
+#endif
+}
+
+void RNewAllocator::paged_init(unsigned pagepower)
+    {
+        if (pagepower == 0)
+            pagepower = 31;
+        else if (pagepower < minpagepower)
+            pagepower = minpagepower;
+        page_threshold = pagepower;
+        for (int i=0;i<npagecells;++i)
+        {
+            pagelist[i].page = 0;
+            pagelist[i].size = 0;
+        }
+    }
+
+void* RNewAllocator::paged_allocate(unsigned size)
+{
+    unsigned nbytes = ceiling(size, pagesize);
+    if (nbytes < size + cellalign)
+    {   // not enough extra space for header and alignment, try and use cell list
+        for (pagecell *c = pagelist,*e = c + npagecells;c < e;++c)
+            if (c->page == 0)
+            {
+                void* p = map(0, nbytes);
+                if (!p)
+                    return 0;
+                c->page = p;
+                c->size = nbytes;
+                iTotalAllocSize += nbytes;
+                return p;
+            }
+    }
+    // use a cell header
+    nbytes = ceiling(size + cellalign, pagesize);
+    void* p = map(0, nbytes);
+    if (!p)
+        return 0;
+    *static_cast<unsigned*>(p) = nbytes;
+    iTotalAllocSize += nbytes;
+    return offset(p, cellalign);
+}
+
+void* RNewAllocator::paged_reallocate(void* p, unsigned size)
+{
+    if (lowbits(p, pagesize) == 0)
+    {   // continue using descriptor
+        pagecell* c = paged_descriptor(p);
+        unsigned nbytes = ceiling(size, pagesize);
+        void* newp = remap(p, c->size, nbytes);
+        if (!newp)
+            return 0;
+        c->page = newp;
+        c->size = nbytes;
+        iTotalAllocSize += nbytes-c->size;
+        return newp;
+    }
+    else
+    {   // use a cell header
+        ASSERT(lowbits(p,pagesize) == cellalign);
+        p = offset(p,-int(cellalign));
+        unsigned nbytes = ceiling(size + cellalign, pagesize);
+        unsigned obytes = *static_cast<unsigned*>(p);
+        void* newp = remap(p, obytes, nbytes);
+        if (!newp)
+            return 0;
+        *static_cast<unsigned*>(newp) = nbytes;
+        iTotalAllocSize += nbytes-obytes;
+        return offset(newp, cellalign);
+    }
+}
+
+void RNewAllocator::paged_free(void* p)
+{
+    if (lowbits(p,pagesize) == 0)
+    {   // check pagelist
+        pagecell* c = paged_descriptor(p);
+
+        iTotalAllocSize -= c->size;
+
+        unmap(p, c->size);
+        c->page = 0;
+        c->size = 0;
+    }
+    else
+    {   // check page header
+        unsigned* page = static_cast<unsigned*>(offset(p,-int(cellalign)));
+        unsigned size = *page;
+
+        iTotalAllocSize -= size;
+
+        unmap(page,size);
+    }
+}
+
+pagecell* RNewAllocator::paged_descriptor(const void* p) const
+{
+    ASSERT(lowbits(p,pagesize) == 0);
+    // Double casting to keep the compiler happy. Seems to think we can trying to
+    // change a non-const member (pagelist) in a const function
+    pagecell* c = (pagecell*)((void*)pagelist);
+#ifdef _DEBUG
+    pagecell* e = c + npagecells;
+#endif
+    for (;;)
+    {
+        ASSERT(c!=e);
+        if (c->page == p)
+            return c;
+        ++c;
+    }
+}
+
+RNewAllocator* RNewAllocator::FixedHeap(TAny* aBase, TInt aMaxLength, TInt aAlign, TBool aSingleThread)
+/**
+Creates a fixed length heap at a specified location.
+
+On successful return from this function, aMaxLength bytes are committed by the chunk.
+The heap cannot be extended.
+
+@param aBase         A pointer to the location where the heap is to be constructed.
+@param aMaxLength    The length of the heap. If the supplied value is less
+                     than KMinHeapSize, it is discarded and the value KMinHeapSize
+                     is used instead.
+@param aAlign        The alignment of heap cells.
+@param aSingleThread Indicates whether single threaded or not.
+
+@return A pointer to the new heap, or NULL if the heap could not be created.
+
+@panic USER 56 if aMaxLength is negative.
+*/
+//
+// Force construction of the fixed memory.
+//
+    {
+
+    __ASSERT_ALWAYS(aMaxLength>=0, ::Panic(ETHeapMaxLengthNegative));
+    if (aMaxLength<KMinHeapSize)
+        aMaxLength=KMinHeapSize;
+
+    RNewAllocator* h = new(aBase) RNewAllocator(aMaxLength, aAlign, aSingleThread);
+
+    if (!aSingleThread)
+        {
+        TInt r = h->iLock.CreateLocal();
+        if (r!=KErrNone)
+            return NULL;
+        h->iHandles = (TInt*)&h->iLock;
+        h->iHandleCount = 1;
+        }
+    return h;
+    }
+
+RNewAllocator* RNewAllocator::ChunkHeap(const TDesC* aName, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign, TBool aSingleThread)
+/**
+Creates a heap in a local or global chunk.
+
+The chunk hosting the heap can be local or global.
+
+A local chunk is one which is private to the process creating it and is not
+intended for access by other user processes.
+A global chunk is one which is visible to all processes.
+
+The hosting chunk is local, if the pointer aName is NULL, otherwise
+the hosting chunk is global and the descriptor *aName is assumed to contain
+the name to be assigned to it.
+
+Ownership of the host chunk is vested in the current process.
+
+A minimum and a maximum size for the heap can be specified. On successful
+return from this function, the size of the heap is at least aMinLength.
+If subsequent requests for allocation of memory from the heap cannot be
+satisfied by compressing the heap, the size of the heap is extended in
+increments of aGrowBy until the request can be satisfied. Attempts to extend
+the heap causes the size of the host chunk to be adjusted.
+
+Note that the size of the heap cannot be adjusted by more than aMaxLength.
+
+@param aName         If NULL, the function constructs a local chunk to host
+                     the heap.
+                     If not NULL, a pointer to a descriptor containing the name
+                     to be assigned to the global chunk hosting the heap.
+@param aMinLength    The minimum length of the heap.
+@param aMaxLength    The maximum length to which the heap can grow.
+                     If the supplied value is less than KMinHeapSize, then it
+                     is discarded and the value KMinHeapSize used instead.
+@param aGrowBy       The increments to the size of the host chunk. If a value is
+                     not explicitly specified, the value KMinHeapGrowBy is taken
+                     by default
+@param aAlign        The alignment of heap cells.
+@param aSingleThread Indicates whether single threaded or not.
+
+@return A pointer to the new heap or NULL if the heap could not be created.
+
+@panic USER 41 if aMinLength is greater than the supplied value of aMaxLength.
+@panic USER 55 if aMinLength is negative.
+@panic USER 56 if aMaxLength is negative.
+*/
+//
+// Allocate a Chunk of the requested size and force construction.
+//
+    {
+
+    __ASSERT_ALWAYS(aMinLength>=0, ::Panic(ETHeapMinLengthNegative));
+    __ASSERT_ALWAYS(aMaxLength>=aMinLength, ::Panic(ETHeapCreateMaxLessThanMin));
+    if (aMaxLength<KMinHeapSize)
+        aMaxLength=KMinHeapSize;
+    RChunk c;
+    TInt r;
+    if (aName)
+        r = c.CreateDisconnectedGlobal(*aName, 0, 0, aMaxLength*2, aSingleThread ? EOwnerThread : EOwnerProcess);
+    else
+        r = c.CreateDisconnectedLocal(0, 0, aMaxLength*2, aSingleThread ? EOwnerThread : EOwnerProcess);
+    if (r!=KErrNone)
+        return NULL;
+
+    RNewAllocator* h = ChunkHeap(c, aMinLength, aGrowBy, aMaxLength, aAlign, aSingleThread, UserHeap::EChunkHeapDuplicate);
+    c.Close();
+    return h;
+    }
+
+RNewAllocator* RNewAllocator::ChunkHeap(RChunk aChunk, TInt aMinLength, TInt aGrowBy, TInt aMaxLength, TInt aAlign, TBool aSingleThread, TUint32 aMode)
+/**
+Creates a heap in an existing chunk.
+
+This function is intended to be used to create a heap in a user writable code
+chunk as created by a call to RChunk::CreateLocalCode().
+This type of heap can be used to hold code fragments from a JIT compiler.
+
+The maximum length to which the heap can grow is the same as
+the maximum size of the chunk.
+
+@param aChunk        The chunk that will host the heap.
+@param aMinLength    The minimum length of the heap.
+@param aGrowBy       The increments to the size of the host chunk.
+@param aMaxLength    The maximum length to which the heap can grow.
+@param aAlign        The alignment of heap cells.
+@param aSingleThread Indicates whether single threaded or not.
+@param aMode         Flags controlling the reallocation. The only bit which has any
+                     effect on reallocation is that defined by the enumeration
+                     ENeverMove of the enum RAllocator::TReAllocMode.
+                     If this is set, then any successful reallocation guarantees not
+                     to have changed the start address of the cell.
+                     By default, this parameter is zero.
+
+@return A pointer to the new heap or NULL if the heap could not be created.
+*/
+//
+// Construct a heap in an already existing chunk
+//
+    {
+
+    return OffsetChunkHeap(aChunk, aMinLength, 0, aGrowBy, aMaxLength, aAlign, aSingleThread, aMode);
+    }
+
+RNewAllocator* RNewAllocator::OffsetChunkHeap(RChunk aChunk, TInt aMinLength, TInt aOffset, TInt aGrowBy, TInt aMaxLength, TInt aAlign, TBool aSingleThread, TUint32 aMode)
+/**
+Creates a heap in an existing chunk, offset from the beginning of the chunk.
+
+This function is intended to be used to create a heap where a fixed amount of
+additional data must be stored at a known location. The additional data can be
+placed at the base address of the chunk, allowing it to be located without
+depending on the internals of the heap structure.
+
+The maximum length to which the heap can grow is the maximum size of the chunk,
+minus the offset.
+
+@param aChunk        The chunk that will host the heap.
+@param aMinLength    The minimum length of the heap.
+@param aOffset       The offset from the start of the chunk, to the start of the heap.
+@param aGrowBy       The increments to the size of the host chunk.
+@param aMaxLength    The maximum length to which the heap can grow.
+@param aAlign        The alignment of heap cells.
+@param aSingleThread Indicates whether single threaded or not.
+@param aMode         Flags controlling the reallocation. The only bit which has any
+                     effect on reallocation is that defined by the enumeration
+                     ENeverMove of the enum RAllocator::TReAllocMode.
+                     If this is set, then any successful reallocation guarantees not
+                     to have changed the start address of the cell.
+                     By default, this parameter is zero.
+
+@return A pointer to the new heap or NULL if the heap could not be created.
+*/
+//
+// Construct a heap in an already existing chunk
+//
+    {
+
+    TInt page_size = malloc_getpagesize;
+    if (!aAlign)
+        aAlign = RNewAllocator::ECellAlignment;
+    TInt maxLength = aChunk.MaxSize();
+    TInt round_up = Max(aAlign, page_size);
+    TInt min_cell = _ALIGN_UP(Max((TInt)RNewAllocator::EAllocCellSize, (TInt)RNewAllocator::EFreeCellSize), aAlign);
+    aOffset = _ALIGN_UP(aOffset, 8);
+
+#ifdef NO_RESERVE_MEMORY
+#ifdef TRACING_HEAPS
+    TKName chunk_name;
+    aChunk.FullName(chunk_name);
+    BTraceContextBig(BTrace::ETest1, 0xF, 0xFF, chunk_name.Ptr(), chunk_name.Size());
+
+    TUint32 traceData[4];
+    traceData[0] = aChunk.Handle();
+    traceData[1] = aMinLength;
+    traceData[2] = aMaxLength;
+    traceData[3] = aAlign;
+    BTraceContextN(BTrace::ETest1, 0xE, 0xEE, 0xEE, traceData, sizeof(traceData));
+#endif
+    //modifying the aMinLength because not all memory is the same in the new allocator. So it cannot reserve it properly
+    if ( aMinLength<aMaxLength)
+        aMinLength = 0;
+#endif
+
+    if (aMaxLength && aMaxLength+aOffset<maxLength)
+        maxLength = _ALIGN_UP(aMaxLength+aOffset, round_up);
+    __ASSERT_ALWAYS(aMinLength>=0, ::Panic(ETHeapMinLengthNegative));
+    __ASSERT_ALWAYS(maxLength>=aMinLength, ::Panic(ETHeapCreateMaxLessThanMin));
+    aMinLength = _ALIGN_UP(Max(aMinLength, (TInt)sizeof(RNewAllocator) + min_cell) + aOffset, round_up);
+
+    // the new allocator uses a disconnected chunk so must commit the initial allocation
+    // with Commit() instead of Adjust()
+    //  TInt r=aChunk.Adjust(aMinLength);
+    //TInt r = aChunk.Commit(aOffset, aMinLength);
+
+    aOffset = maxLength;
+    //TInt MORE_CORE_OFFSET = maxLength/2;
+    //TInt r = aChunk.Commit(MORE_CORE_OFFSET, aMinLength);
+    TInt r = aChunk.Commit(aOffset, aMinLength);
+
+    if (r!=KErrNone)
+        return NULL;
+
+    RNewAllocator* h = new (aChunk.Base() + aOffset) RNewAllocator(aChunk.Handle(), aOffset, aMinLength, maxLength, aGrowBy, aAlign, aSingleThread);
+    //RNewAllocator* h = new (aChunk.Base() + MORE_CORE_OFFSET) RNewAllocator(aChunk.Handle(), aOffset, aMinLength, maxLength, aGrowBy, aAlign, aSingleThread);
+
+    TBool duplicateLock = EFalse;
+    if (!aSingleThread)
+        {
+        duplicateLock = aMode & UserHeap::EChunkHeapSwitchTo;
+        if (h->iLock.CreateLocal(duplicateLock ? EOwnerThread : EOwnerProcess)!=KErrNone)
+            {
+            h->iChunkHandle = 0;
+            return NULL;
+            }
+        }
+
+    if (aMode & UserHeap::EChunkHeapSwitchTo)
+        User::SwitchHeap(h);
+
+    h->iHandles = &h->iChunkHandle;
+    if (!aSingleThread)
+        {
+        // now change the thread-relative chunk/semaphore handles into process-relative handles
+        h->iHandleCount = 2;
+        if (duplicateLock)
+            {
+            RHandleBase s = h->iLock;
+            r = h->iLock.Duplicate(RThread());
+            s.Close();
+            }
+        if (r==KErrNone && (aMode & UserHeap::EChunkHeapDuplicate))
+            {
+            r = ((RChunk*)&h->iChunkHandle)->Duplicate(RThread());
+            if (r!=KErrNone)
+                h->iLock.Close(), h->iChunkHandle=0;
+            }
+        }
+    else
+        {
+        h->iHandleCount = 1;
+        if (aMode & UserHeap::EChunkHeapDuplicate)
+            r = ((RChunk*)&h->iChunkHandle)->Duplicate(RThread(), EOwnerThread);
+        }
+
+    // return the heap address
+    return (r==KErrNone) ? h : NULL;
+    }
+
+    /* Only for debugging purpose - start*/
+#ifdef DL_CHUNK_MEM_DEBUG
+void RNewAllocator::debug_check_small_chunk_access(mchunkptr p, size_t psize)
+{
+    size_t sz = chunksize(p);
+    char ch = *((char*)chunk_plus_offset(p, psize-1));
+}
+
+void RNewAllocator::debug_check_any_chunk_access(mchunkptr p, size_t psize)
+{
+    if (p==0 || psize==0) return;
+
+    mchunkptr next = chunk_plus_offset(p, psize);
+    char* t = (char*)chunk_plus_offset(p, mparams.page_size);
+    char ch = *((char*)p);
+    while ((size_t)t<(size_t)next)
+    {
+        ch = *t;
+        t = (char*)chunk_plus_offset(t, mparams.page_size);
+    };
+}
+
+void RNewAllocator::debug_check_large_chunk_access(tchunkptr p, size_t psize)
+{
+    mchunkptr next = chunk_plus_offset(p, psize);
+    char* t = (char*)chunk_plus_offset(p, mparams.page_size);
+    char ch = *((char*)p);
+    while ((size_t)t<(size_t)next)
+    {
+        ch = *t;
+        t = (char*)chunk_plus_offset(t, mparams.page_size);
+    };
+}
+
+void RNewAllocator::debug_chunk_page_release_check(mchunkptr p, size_t psize, mstate fm, int mem_released)
+{
+    if (mem_released)
+    {
+        if (!page_not_in_memory(p, psize) )
+            MEM_LOG("CHUNK_PAGE_ERROR::dlfree, error - page_in_mem flag is corrupt");
+        if (chunk_plus_offset(p, psize) > fm->top)
+            MEM_LOG("CHUNK_PAGE_ERROR: error Top chunk address invalid");
+        if (fm->dv >= p && fm->dv < chunk_plus_offset(p, psize))
+            MEM_LOG("CHUNK_PAGE_ERROR: error DV chunk address invalid");
+    }
+}
+#endif
+
+#ifdef OOM_LOGGING
+#include <hal.h>
+void RNewAllocator::dump_large_chunk(mstate m, tchunkptr t) {
+    tchunkptr u = t;
+    bindex_t tindex = t->index;
+    size_t tsize = chunksize(t);
+    bindex_t idx;
+    compute_tree_index(tsize, idx);
+
+    size_t free = 0;
+    int nfree = 0;
+    do
+        {   /* traverse through chain of same-sized nodes */
+        if (u->child[0] != 0)
+            {
+            dump_large_chunk(m, u->child[0]);
+            }
+
+        if (u->child[1] != 0)
+            {
+            dump_large_chunk(m, u->child[1]);
+            }
+
+        free += chunksize(u);
+        nfree++;
+        u = u->fd;
+        }
+    while (u != t);
+    C_LOGF(_L8("LARGE_BIN,%d,%d,%d"), tsize, free, nfree);
+}
+
+void RNewAllocator::dump_dl_free_chunks()
+{
+    C_LOG("");
+    C_LOG("------------ dump_dl_free_chunks start -------------");
+    C_LOG("BinType,BinSize,FreeSize,FreeCount");
+
+    // dump small bins
+    for (int i = 0; i < NSMALLBINS; ++i)
+        {
+        sbinptr b = smallbin_at(gm, i);
+        unsigned int empty = (gm->smallmap & (1 << i)) == 0;
+        int nfree = 0;
+        if (!empty)
+            {
+            int nfree = 0;
+            size_t free = 0;
+            mchunkptr p = b->bk;
+            size_t size = chunksize(p);
+            for (; p != b; p = p->bk)
+                {
+                free += chunksize(p);
+                nfree++;
+                }
+
+            C_LOGF(_L8("SMALL_BIN,%d,%d,%d"), size, free, nfree);
+            }
+        }
+
+    // dump large bins
+    for (int i = 0; i < NTREEBINS; ++i)
+        {
+        tbinptr* tb = treebin_at(gm, i);
+        tchunkptr t = *tb;
+        int empty = (gm->treemap & (1 << i)) == 0;
+        if (!empty)
+            dump_large_chunk(gm, t);
+        }
+
+    C_LOG("------------ dump_dl_free_chunks end -------------");
+    C_LOG("");
+    }
+
+void RNewAllocator::dump_heap_logs(size_t fail_size)
+{
+    MEM_LOG("");
+    if (fail_size) {
+        MEM_LOG("MEMDEBUG::RSymbianDLHeap OOM Log dump *************** start");
+        MEM_LOGF(_L8("Failing to alloc size: %d"), fail_size);
+    }
+    else
+        MEM_LOG("MEMDEBUG::RSymbianDLHeap Log dump *************** start");
+
+    TInt dl_chunk_size = ptrdiff(iTop,iBase);
+    TInt slabp_chunk_size = iChunkSize + iUnmappedChunkSize - dl_chunk_size;
+    TInt freeMem = 0;
+    HAL::Get(HALData::EMemoryRAMFree, freeMem);
+    MEM_LOGF(_L8("System Free RAM Size: %d"), freeMem);
+    MEM_LOGF(_L8("Allocator Commited Chunk Size: %d"), iChunkSize);
+    MEM_LOGF(_L8("DLHeap Arena Size=%d"), dl_chunk_size);
+    MEM_LOGF(_L8("DLHeap unmapped chunk size: %d"), iUnmappedChunkSize);
+    MEM_LOGF(_L8("Slab-Page Allocator Chunk Size=%d"), slabp_chunk_size);
+
+    mallinfo info = dlmallinfo();
+    TUint heapAlloc = info.uordblks;
+    TUint heapFree = info.fordblks;
+    MEM_LOGF(_L8("DLHeap allocated size: %d"), heapAlloc);
+    MEM_LOGF(_L8("DLHeap free size: %d"), heapFree);
+
+    if (fail_size) {
+        MEM_LOG("MEMDEBUG::RSymbianDLHeap OOM Log dump *************** end");
+    }else {
+        MEM_LOG("MEMDEBUG::RSymbianDLHeap Log dump *************** end");
+    }
+    MEM_LOG("");
+}
+
+#endif
+/* Only for debugging purpose - end*/
+
+
+#define UserTestDebugMaskBit(bit) (TBool)(UserSvr::DebugMask(bit>>5) & (1<<(bit&31)))
+
+#ifndef NO_NAMED_LOCAL_CHUNKS
+//this class requires Symbian^3 for ElocalNamed
+
+// Hack to get access to TChunkCreateInfo internals outside of the kernel
+class TFakeChunkCreateInfo: public TChunkCreateInfo
+    {
+public:
+     void SetThreadNewAllocator(TInt aInitialSize, TInt aMaxSize, const TDesC& aName)
+        {
+        iType = TChunkCreate::ENormal | TChunkCreate::EDisconnected | TChunkCreate::EData;
+        iMaxSize = aMaxSize * 2;
+
+        iInitialBottom = 0;
+        iInitialTop = aInitialSize;
+        iAttributes = TChunkCreate::ELocalNamed;
+        iName = &aName;
+        iOwnerType = EOwnerThread;
+        }
+    };
+#endif
+
+#ifndef NO_NAMED_LOCAL_CHUNKS
+_LIT(KLitDollarHeap,"$HEAP");
+#endif
+TInt RNewAllocator::CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RNewAllocator*& aHeap, TInt aAlign, TBool aSingleThread)
+/**
+@internalComponent
+*/
+//
+// Create a user-side heap
+//
+    {
+    TInt page_size = malloc_getpagesize;
+    TInt minLength = _ALIGN_UP(aInfo.iHeapInitialSize, page_size);
+    TInt maxLength = Max(aInfo.iHeapMaxSize, minLength);
+#ifdef TRACING_ALLOCS
+    if (UserTestDebugMaskBit(96)) // 96 == KUSERHEAPTRACE in nk_trace.h
+        aInfo.iFlags |= ETraceHeapAllocs;
+#endif
+    // Create the thread's heap chunk.
+    RChunk c;
+#ifndef NO_NAMED_LOCAL_CHUNKS
+    TFakeChunkCreateInfo createInfo;
+    createInfo.SetThreadNewAllocator(0, maxLength, KLitDollarHeap());   // Initialise with no memory committed.
+    TInt r = c.Create(createInfo);
+#else
+    TInt r = c.CreateDisconnectedLocal(0, 0, maxLength * 2);
+#endif
+    if (r!=KErrNone)
+        return r;
+    aHeap = ChunkHeap(c, minLength, page_size, maxLength, aAlign, aSingleThread, UserHeap::EChunkHeapSwitchTo|UserHeap::EChunkHeapDuplicate);
+    c.Close();
+    if (!aHeap)
+        return KErrNoMemory;
+#ifdef TRACING_ALLOCS
+    if (aInfo.iFlags & ETraceHeapAllocs)
+        {
+        aHeap->iFlags |= RAllocator::ETraceAllocs;
+        BTraceContext8(BTrace::EHeap, BTrace::EHeapCreate,(TUint32)aHeap, RNewAllocator::EAllocCellSize);
+        TInt handle = aHeap->ChunkHandle();
+        TInt chunkId = ((RHandleBase&)handle).BTraceId();
+        BTraceContext8(BTrace::EHeap, BTrace::EHeapChunkCreate, (TUint32)aHeap, chunkId);
+        }
+#endif
+    return KErrNone;
+    }
+
+/*
+ * \internal
+ * Called from the qtmain.lib application wrapper.
+ * Create a new heap as requested, but use the new allocator
+ */
+TInt _symbian_SetupThreadHeap(TBool /*aNotFirst*/, SStdEpocThreadCreateInfo& aInfo)
+    {
+    TInt r = KErrNone;
+    if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
+        {
+        // new heap required
+        RNewAllocator* pH = NULL;
+        r = RNewAllocator::CreateThreadHeap(aInfo, pH);
+        }
+    else if (aInfo.iAllocator)
+        {
+        // sharing a heap
+        RAllocator* pA = aInfo.iAllocator;
+        r = pA->Open();
+        if (r == KErrNone)
+            {
+            User::SwitchAllocator(pA);
+            }
+        }
+    return r;
+    }
+
+#ifndef __WINS__
+#pragma pop
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/standaloneallocator/newallocator_hook.cpp	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+#include <e32std.h>
+
+extern TInt _symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo);
+
+/*
+ * \internal
+ *
+ * Uses link-time symbol preemption to capture a call from the application
+ * startup. On return, there is some kind of heap allocator installed on the
+ * thread.
+ */
+TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
+{
+    return _symbian_SetupThreadHeap(aNotFirst, aInfo);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/standaloneallocator/newallocator_p.h	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+
+/****************************************************************************
+ *
+ * This file is part of the Symbian application wrapper of the Qt Toolkit.
+ *
+ * The memory allocator is backported from Symbian OS, and can eventually
+ * be removed from Qt once it is built in to all supported OS versions.
+ * The allocator is a composite of three allocators:
+ *  - A page allocator, for large allocations
+ *  - A slab allocator, for small allocations
+ *  - Doug Lea's allocator, for medium size allocations
+ *
+ ***************************************************************************/
+
+
+#ifndef NEWALLOCATOR_H
+#define NEWALLOCATOR_H
+
+class RNewAllocator : public RAllocator
+    {
+public:
+    enum{EAllocCellSize = 8};
+
+    virtual TAny* Alloc(TInt aSize);
+    virtual void Free(TAny* aPtr);
+    virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
+    virtual TInt AllocLen(const TAny* aCell) const;
+    virtual TInt Compress();
+    virtual void Reset();
+    virtual TInt AllocSize(TInt& aTotalAllocSize) const;
+    virtual TInt Available(TInt& aBiggestBlock) const;
+    virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
+protected:
+    virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
+
+public:
+    TInt Size() const
+    { return iChunkSize; }
+
+    inline TInt MaxLength() const;
+    inline TUint8* Base() const;
+    inline TInt Align(TInt a) const;
+    inline const TAny* Align(const TAny* a) const;
+    inline void Lock() const;
+    inline void Unlock() const;
+    inline TInt ChunkHandle() const;
+
+    /**
+    @internalComponent
+    */
+    struct _s_align {char c; double d;};
+
+    /**
+    The structure of a heap cell header for a heap cell on the free list.
+    */
+    struct SCell {
+                 /**
+                 The length of the cell, which includes the length of
+                 this header.
+                 */
+                 TInt len;
+
+
+                 /**
+                 A pointer to the next cell in the free list.
+                 */
+                 SCell* next;
+                 };
+
+    /**
+    The default cell alignment.
+    */
+    enum {ECellAlignment = sizeof(_s_align)-sizeof(double)};
+
+    /**
+    Size of a free cell header.
+    */
+    enum {EFreeCellSize = sizeof(SCell)};
+
+    /**
+    @internalComponent
+    */
+    enum TDefaultShrinkRatios {EShrinkRatio1=256, EShrinkRatioDflt=512};
+
+public:
+    RNewAllocator(TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue);
+    RNewAllocator(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign=0, TBool aSingleThread=EFalse);
+    inline RNewAllocator();
+
+    TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
+    inline void operator delete(TAny*, TAny*);
+
+protected:
+    SCell* GetAddress(const TAny* aCell) const;
+
+public:
+    TInt iMinLength;
+    TInt iMaxLength;            // maximum bytes used by the allocator in total
+    TInt iOffset;                   // offset of RNewAllocator object from chunk base
+    TInt iGrowBy;
+
+    TInt iChunkHandle;          // handle of chunk
+    RFastLock iLock;
+    TUint8* iBase;              // bottom of DL memory, i.e. this+sizeof(RNewAllocator)
+    TUint8* iTop;                   // top of DL memory (page aligned)
+    TInt iAlign;
+    TInt iMinCell;
+    TInt iPageSize;
+    SCell iFree;
+protected:
+    TInt iNestingLevel;
+    TInt iAllocCount;
+    TAllocFail iFailType;
+    TInt iFailRate;
+    TBool iFailed;
+    TInt iFailAllocCount;
+    TInt iRand;
+    TAny* iTestData;
+protected:
+    TInt iChunkSize;                // currently allocated bytes in the chunk (== chunk.Size())
+    malloc_state iGlobalMallocState;
+    malloc_params mparams;
+    TInt iHighWaterMark;
+private:
+    void Init(TInt aBitmapSlab, TInt aPagePower, size_t aTrimThreshold);/*Init internal data structures*/
+    inline int init_mparams(size_t aTrimThreshold /*= DEFAULT_TRIM_THRESHOLD*/);
+    void init_bins(mstate m);
+    void init_top(mstate m, mchunkptr p, size_t psize);
+    void* sys_alloc(mstate m, size_t nb);
+    msegmentptr segment_holding(mstate m, TUint8* addr);
+    void add_segment(mstate m, TUint8* tbase, size_t tsize, flag_t mmapped);
+    int sys_trim(mstate m, size_t pad);
+    int has_segment_link(mstate m, msegmentptr ss);
+    size_t release_unused_segments(mstate m);
+    void* mmap_alloc(mstate m, size_t nb);/*Need to check this function*/
+    void* prepend_alloc(mstate m, TUint8* newbase, TUint8* oldbase, size_t nb);
+    void* tmalloc_large(mstate m, size_t nb);
+    void* tmalloc_small(mstate m, size_t nb);
+    /*MACROS converted functions*/
+    static inline void unlink_first_small_chunk(mstate M,mchunkptr B,mchunkptr P,bindex_t& I);
+    static inline void insert_small_chunk(mstate M,mchunkptr P, size_t S);
+    static inline void insert_chunk(mstate M,mchunkptr P,size_t S,size_t NPAGES);
+    static inline void unlink_large_chunk(mstate M,tchunkptr X);
+    static inline void unlink_small_chunk(mstate M, mchunkptr P,size_t S);
+    static inline void unlink_chunk(mstate M, mchunkptr P, size_t S);
+    static inline void compute_tree_index(size_t S, bindex_t& I);
+    static inline void insert_large_chunk(mstate M,tchunkptr X,size_t S,size_t NPAGES);
+    static inline void replace_dv(mstate M, mchunkptr P, size_t S);
+    static inline void compute_bit2idx(binmap_t X,bindex_t& I);
+    /*MACROS converted functions*/
+    TAny* SetBrk(TInt32 aDelta);
+    void* internal_realloc(mstate m, void* oldmem, size_t bytes);
+    void  internal_malloc_stats(mstate m);
+    int change_mparam(int param_number, int value);
+#if !NO_MALLINFO
+        mallinfo internal_mallinfo(mstate m);
+#endif
+    void Init_Dlmalloc(size_t capacity, int locked, size_t aTrimThreshold);
+    void* dlmalloc(size_t);
+    void  dlfree(void*);
+    void* dlrealloc(void*, size_t);
+    int dlmallopt(int, int);
+    size_t dlmalloc_footprint(void);
+    size_t dlmalloc_max_footprint(void);
+    #if !NO_MALLINFO
+        struct mallinfo dlmallinfo(void);
+    #endif
+    int  dlmalloc_trim(size_t);
+    size_t dlmalloc_usable_size(void*);
+    void  dlmalloc_stats(void);
+    inline  mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb);
+
+        /****************************Code Added For DL heap**********************/
+    friend TInt _symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo);
+private:
+    unsigned short slab_threshold;
+    unsigned short page_threshold;      // 2^n is smallest cell size allocated in paged allocator
+    unsigned slab_init_threshold;
+    unsigned slab_config_bits;
+    slab* partial_page;// partial-use page tree
+    page* spare_page;                   // single empty page cached
+    unsigned char sizemap[(maxslabsize>>2)+1];  // index of slabset based on size class
+private:
+    static void tree_remove(slab* s);
+    static void tree_insert(slab* s,slab** r);
+public:
+    enum {okbits = (1<<(maxslabsize>>2))-1};
+    void slab_init(unsigned slabbitmap);
+    void slab_config(unsigned slabbitmap);
+    void* slab_allocate(slabset& allocator);
+    void slab_free(void* p);
+    void* allocnewslab(slabset& allocator);
+    void* allocnewpage(slabset& allocator);
+    void* initnewslab(slabset& allocator, slab* s);
+    void freeslab(slab* s);
+    void freepage(page* p);
+    void* map(void* p,unsigned sz);
+    void* remap(void* p,unsigned oldsz,unsigned sz);
+    void unmap(void* p,unsigned sz);
+    /**I think we need to move this functions to slab allocator class***/
+    static inline unsigned header_free(unsigned h)
+    {return (h&0x000000ff);}
+    static inline unsigned header_pagemap(unsigned h)
+    {return (h&0x00000f00)>>8;}
+    static inline unsigned header_size(unsigned h)
+    {return (h&0x0003f000)>>12;}
+    static inline unsigned header_usedm4(unsigned h)
+    {return (h&0x0ffc0000)>>18;}
+    /***paged allocator code***/
+    void paged_init(unsigned pagepower);
+    void* paged_allocate(unsigned size);
+    void paged_free(void* p);
+    void* paged_reallocate(void* p, unsigned size);
+    pagecell* paged_descriptor(const void* p) const ;
+
+    /* Dl heap log dump functions*/
+#ifdef OOM_LOGGING
+    void dump_heap_logs(size_t fail_size);
+    void dump_dl_free_chunks();
+    void dump_large_chunk(mstate m, tchunkptr t);
+    size_t iUnmappedChunkSize;
+#endif
+private:
+     /* Dubug checks for chunk page support*/
+#ifdef DL_CHUNK_MEM_DEBUG
+#define do_chunk_page_release_check(p, psize, fm, mem_released) debug_chunk_page_release_check(p, psize, fm, mem_released)
+#define do_check_large_chunk_access(p, psize) debug_check_large_chunk_access(p, psize)
+#define do_check_small_chunk_access(p, psize) debug_check_small_chunk_access(p, psize)
+#define do_check_any_chunk_access(p, psize) debug_check_any_chunk_access(p, psize)
+    void debug_check_large_chunk_access(tchunkptr p, size_t psize);
+    void debug_check_small_chunk_access(mchunkptr p, size_t psize);
+    void debug_check_any_chunk_access(mchunkptr p, size_t psize);
+    void debug_chunk_page_release_check(mchunkptr p, size_t psize, mstate fm, int mem_released);
+#else
+#define do_chunk_page_release_check(p, psize, fm, mem_released)
+#define do_check_large_chunk_access(p, psize)
+#define do_check_small_chunk_access(p, psize)
+#define do_check_any_chunk_access(p, psize)
+#endif
+
+    /* Chunk page release mechanism support */
+    TInt map_chunk_pages(tchunkptr p, size_t psize);
+    TInt unmap_chunk_pages(tchunkptr p, size_t psize, size_t prev_npages);
+    TInt map_chunk_pages_partial(tchunkptr tp, size_t psize, tchunkptr r, size_t rsize);
+    TInt sys_trim_partial(mstate m, mchunkptr prev, size_t psize, size_t prev_npages);
+    size_t free_chunk_threshold;
+
+    // paged allocator structures
+    enum {npagecells=4};
+    pagecell pagelist[npagecells];      // descriptors for page-aligned large allocations
+    inline void TraceReAlloc(TAny* aPtr, TInt aSize, TAny* aNewPtr, TInt aZone);
+    inline void TraceCallStack();
+    // to track maximum used
+    //TInt iHighWaterMark;
+
+
+private:
+    static RNewAllocator* FixedHeap(TAny* aBase, TInt aMaxLength, TInt aAlign, TBool aSingleThread);
+    static RNewAllocator* ChunkHeap(const TDesC* aName, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign, TBool aSingleThread);
+    static RNewAllocator* ChunkHeap(RChunk aChunk, TInt aMinLength, TInt aGrowBy, TInt aMaxLength, TInt aAlign, TBool aSingleThread, TUint32 aMode);
+    static RNewAllocator* OffsetChunkHeap(RChunk aChunk, TInt aMinLength, TInt aOffset, TInt aGrowBy, TInt aMaxLength, TInt aAlign, TBool aSingleThread, TUint32 aMode);
+    static TInt CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RNewAllocator*& aHeap, TInt aAlign = 0, TBool aSingleThread = EFalse);
+
+
+private:
+    /**
+     *always keep this variable at the bottom of the class as its used as
+     * array of more than 1 objest though it declared a single.
+     *  TODO: dynamic sizing of heap object based on slab configuration.
+     *             Just allocate maximum number of slabsets for now
+     * */
+    slabset slaballoc[maxslabsize>>2];
+
+};
+
+inline RNewAllocator::RNewAllocator()
+    {}
+
+/**
+@return The maximum length to which the heap can grow.
+
+@publishedAll
+@released
+*/
+inline TInt RNewAllocator::MaxLength() const
+    {return iMaxLength;}
+
+inline void RNewAllocator::operator delete(TAny*, TAny*)
+/**
+Called if constructor issued by operator new(TUint aSize, TAny* aBase) throws exception.
+This is dummy as corresponding new operator does not allocate memory.
+*/
+    {}
+
+
+inline TUint8* RNewAllocator::Base() const
+/**
+Gets a pointer to the start of the heap.
+
+Note that because of the small space overhead incurred by all allocated cells,
+no cell will have the same address as that returned by this function.
+
+@return A pointer to the base of the heap.
+*/
+    {return iBase;}
+
+
+inline TInt RNewAllocator::Align(TInt a) const
+/**
+@internalComponent
+*/
+    {return _ALIGN_UP(a, iAlign);}
+
+
+
+
+inline const TAny* RNewAllocator::Align(const TAny* a) const
+/**
+@internalComponent
+*/
+    {return (const TAny*)_ALIGN_UP((TLinAddr)a, iAlign);}
+
+
+
+inline void RNewAllocator::Lock() const
+/**
+@internalComponent
+*/
+    {((RFastLock&)iLock).Wait();}
+
+
+
+
+inline void RNewAllocator::Unlock() const
+/**
+@internalComponent
+*/
+    {((RFastLock&)iLock).Signal();}
+
+
+inline TInt RNewAllocator::ChunkHandle() const
+/**
+@internalComponent
+*/
+    {
+    return iChunkHandle;
+    }
+
+#endif // NEWALLOCATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/standaloneallocator/standaloneallocator.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,44 @@
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+#
+# This file is part of Qt Web Runtime.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#
+
+# Custom memory allocator lib for Symbian only
+TEMPLATE = lib
+TARGET   = standaloneallocator
+# We might want to change this later to project-specific output area
+DESTDIR  = $$QMAKE_LIBDIR_QT
+# No need for any Qt libs here, pure Symbian C++
+QT       =
+
+CONFIG  += staticlib warn_on
+CONFIG  -= qt shared
+
+symbian {
+    # Note: UID only needed for ensuring that no filename generation conflicts occur
+    TARGET.UID3 = 0x200267B8
+    INCLUDEPATH += . $${EPOCROOT}epoc32/include
+    INCLUDEPATH += . $${EPOCROOT}epoc32/include/platform
+    SOURCEPATH = .
+    SOURCES  =  newallocator_hook.cpp newallocator.cpp
+    MMP_RULES += EXPORTUNFROZEN
+    
+    # This seems not to work, some hard coded libs are still added as dependency
+    LIBS =
+} else {
+    error("$$_FILE_ is intended only for Symbian!")
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/utilities.pro	Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+# All rights reserved.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, version 2.1 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, 
+# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+CONFIG += ordered
+
+# FYI, Qt 4.7.2 and above will provide a fast memory allocator for
+# Symbian applications, so we may not need the standaloneallocator
+# library anymore at that time.  See:
+#
+#   https://qtrequirements.europe.nokia.com/browse/QT-3967
+#   https://qtrequirements.europe.nokia.com/browse/QT-4080
+#
+symbian {
+    SUBDIRS += standaloneallocator
+}
+
+SUBDIRS += serviceipcserver
+SUBDIRS += serviceipcclient
+SUBDIRS += downloadmanager