From 3278c011a0178c8f27287935d137a02a5590da72 Mon Sep 17 00:00:00 2001 From: Rachit Gupta Date: Thu, 1 May 2014 23:55:41 +0530 Subject: select_persona_dialog.ui changed to include search. The entered text is searched on Mozilla's test server and the result is parsed. Change-Id: I2be660b0f7f60d2bdb2c54cbc958084b87ad1e05 --- cui/source/options/personalization.cxx | 14 ++++--- cui/uiconfig/ui/select_persona_dialog.ui | 71 +++++++++----------------------- 2 files changed, 28 insertions(+), 57 deletions(-) diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 5374773f9261..cb318a371487 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -57,11 +57,11 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) : ModalDialog( pParent, "SelectPersonaDialog", "cui/ui/select_persona_dialog.ui" ) { PushButton *pButton; - get( pButton, "visit_personas" ); + get( pButton, "search_personas" ); pButton->SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) ); - get( m_pEdit, "persona_url" ); - m_pEdit->SetPlaceholderText( "https://addons.mozilla.org/firefox/themes/" ); + get( m_pEdit, "search_term" ); + m_pEdit->SetPlaceholderText( "Search term..." ); } OUString SelectPersonaDialog::GetPersonaURL() const @@ -84,10 +84,14 @@ IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ ) PersonasDocHandler* pHandler = new PersonasDocHandler(); Reference< xml::sax::XDocumentHandler > xDocHandler = pHandler; uno::Reference< ucb::XSimpleFileAccess3 > xFileAccess( ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), uno::UNO_QUERY ); + uno::Reference< io::XInputStream > xStream; xParser->setDocumentHandler( xDocHandler ); - OUString rURL = "file:////home/rachit/test.xml"; - Reference< io::XInputStream > xStream; + OUString searchTerm = m_pEdit->GetText(); + OUString rURL = "https://addons.allizom.org/en-US/firefox/api/1.5/search/" + searchTerm + "/9/"; + if ( !xFileAccess.is() ) + return false; + try { xStream = xFileAccess->openFileRead( rURL ); } diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui index 84b1201972b3..fd3ca9bbe3c9 100644 --- a/cui/uiconfig/ui/select_persona_dialog.ui +++ b/cui/uiconfig/ui/select_persona_dialog.ui @@ -11,7 +11,7 @@ False vertical 12 - + "e True False @@ -79,7 +79,7 @@ True False 0 - First visit Firefox Themes (https://addons.mozilla.org/firefox/themes). Find the Theme you like, and want to choose for %PRODUCTNAME. + Search for themes that you wish to apply: True 54 @@ -90,16 +90,29 @@ - + + True + True + + False + False + + + True + True + 1 + + + + True False - True - - Visit Firefox Themes + + Search True True True @@ -114,58 +127,12 @@ - - True - True - 10 - 1 - - - - - True - False - 0 - Then, in your web browser's location bar, copy the address of the page that contains the Theme to clipboard, and paste it to the input field below. - True - 54 - True True 2 - - - True - False - 0 - Theme address: - True - persona_url - - - False - False - 3 - - - - - True - True - - True - False - False - - - True - True - 4 - - False -- cgit