summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachit Gupta <rachitgupta1792@gmail.com>2014-06-20 21:20:37 +0530
committerRachit Gupta <rachitgupta1792@gmail.com>2014-06-20 21:20:37 +0530
commitcb5236f244cc7231816af3c191be3987daf3c673 (patch)
tree1e148cf3987553ff9173968e3c9367e3574350b4
parent84deacb87c1437d8409e4b7df4e182275f9723b8 (diff)
Added some pre-defined search terms.
The user can now enter his/her own search term or can use the commonly used search terms to browse for themes. Change-Id: Ife4ad6b820784a6321f5b916a0069a915c114c7e
-rw-r--r--cui/source/options/personalization.cxx38
-rw-r--r--cui/source/options/personalization.hxx1
-rw-r--r--cui/uiconfig/ui/select_persona_dialog.ui110
3 files changed, 142 insertions, 7 deletions
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index f708d43408a3..ccccec74118d 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -38,6 +38,26 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent )
get( m_pSearchButton, "search_personas" );
m_pSearchButton->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) );
+ get( m_vSearchSuggestions[0], "suggestion1" );
+ m_vSearchSuggestions[0]->SetText( "libreoffice" );
+ m_vSearchSuggestions[0]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) );
+
+ get( m_vSearchSuggestions[1], "suggestion2" );
+ m_vSearchSuggestions[1]->SetText( "science" );
+ m_vSearchSuggestions[1]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) );
+
+ get( m_vSearchSuggestions[2], "suggestion3" );
+ m_vSearchSuggestions[2]->SetText( "firefox" );
+ m_vSearchSuggestions[2]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) );
+
+ get( m_vSearchSuggestions[3], "suggestion4" );
+ m_vSearchSuggestions[3]->SetText( "nasa" );
+ m_vSearchSuggestions[3]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) );
+
+ get( m_vSearchSuggestions[4], "suggestion5" );
+ m_vSearchSuggestions[4]->SetText( "harry potter" );
+ m_vSearchSuggestions[4]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) );
+
get( m_pEdit, "search_term" );
m_pEdit->SetPlaceholderText( "Search term..." );
@@ -85,9 +105,23 @@ OUString SelectPersonaDialog::GetSelectedPersona() const
return OUString();
}
-IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, /*pButton*/ )
+IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, pButton )
{
- OUString searchTerm = m_pEdit->GetText();
+ OUString searchTerm;
+ if( pButton == m_pSearchButton)
+ searchTerm = m_pEdit->GetText();
+ else
+ {
+ for( sal_Int32 nIndex = 0; nIndex < 5; nIndex++ )
+ {
+ if( pButton == m_vSearchSuggestions[nIndex] )
+ {
+ searchTerm = m_vSearchSuggestions[nIndex]->GetDisplayText();
+ break;
+ }
+ }
+ }
+
if( searchTerm.isEmpty( ) )
return 0;
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index da1712229d20..8e0520e58c3f 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -74,6 +74,7 @@ private:
PushButton *m_pSearchButton; ///< The search button
FixedText *m_pProgressLabel; ///< The label for showing progress of search
PushButton *m_vResultList[9]; ///< List of buttons to show search results
+ PushButton *m_vSearchSuggestions[9]; ///< List of buttons for the search suggestions
PushButton *m_pOkButton; ///< The OK button
PushButton *m_pCancelButton; ///< The Cancel button
diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui
index 51d8bcb9e00d..7497c5f70b45 100644
--- a/cui/uiconfig/ui/select_persona_dialog.ui
+++ b/cui/uiconfig/ui/select_persona_dialog.ui
@@ -104,7 +104,6 @@
<property name="can_focus">True</property>
<property name="hexpand">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>
@@ -136,9 +135,12 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="progress_label">
+ <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">Or, use these commonly used terms to _browse themes:</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -147,15 +149,113 @@
</packing>
</child>
<child>
+ <object class="GtkBox" id="box3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="suggestion1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="suggestion2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="suggestion3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="suggestion4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="suggestion5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </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>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="progress_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkGrid" id="grid1">
+ <property name="width_request">624</property>
+ <property name="height_request">219</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
- <property name="width_request">624</property>
- <property name="height_request">219</property>
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<child>
@@ -288,7 +388,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">5</property>
</packing>
</child>
</object>