summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachit Gupta <rachitgupta1792@gmail.com>2014-05-01 23:55:41 +0530
committerRachit Gupta <rachitgupta1792@gmail.com>2014-05-21 18:35:50 +0530
commit3278c011a0178c8f27287935d137a02a5590da72 (patch)
treeb8c9b99e88b89ae124917fde590b91c9726314b2
parent5d3d078dbb7375e4862a02800566bdd2456ae95e (diff)
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
-rw-r--r--cui/source/options/personalization.cxx14
-rw-r--r--cui/uiconfig/ui/select_persona_dialog.ui71
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 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
- <child internal-child="action_area">
+ <child internal-child="action_area">"e
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -79,7 +79,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">First visit Firefox Themes (https://addons.mozilla.org/firefox/themes). Find the Theme you like, and want to choose for %PRODUCTNAME.</property>
+ <property name="label" translatable="yes">Search for themes that you wish to apply:</property>
<property name="wrap">True</property>
<property name="max_width_chars">54</property>
</object>
@@ -90,16 +90,29 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkEntry" id="search_term">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="homogeneous">True</property>
<child>
<placeholder/>
</child>
<child>
- <object class="GtkButton" id="visit_personas">
- <property name="label" translatable="yes">Visit Firefox Themes</property>
+ <object class="GtkButton" id="search_personas">
+ <property name="label" translatable="yes">Search</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -117,55 +130,9 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="padding">10</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">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.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">54</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Theme address:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">persona_url</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="persona_url">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>