diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2018-10-17 20:35:47 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2018-10-17 21:57:47 +0200 |
commit | 7e3ee1673c3e59f5e98158c4edd14a57df95e1cd (patch) | |
tree | 1fa96ee05b3d35d0dc6c6d5da701d1e6873a8e88 /cui | |
parent | 4fb3e08a9a9f057708c530faec853993e8972029 (diff) |
Increase number of default personas to 6
Also:
* Prepare the ui file for up to 9 default personas
* And make the click handlers future-proof for different numbers
Change-Id: Iddf3b1c07feff12dc1fbba3e8a881ddf04923ced
Reviewed-on: https://gerrit.libreoffice.org/61891
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@pardus.org.tr>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/personalization.cxx | 24 | ||||
-rw-r--r-- | cui/source/options/personalization.hxx | 2 | ||||
-rw-r--r-- | cui/uiconfig/ui/personalization_tab.ui | 91 |
3 files changed, 93 insertions, 24 deletions
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index e745b56976a3..fb4032fa76fd 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -439,14 +439,12 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( vcl::Window *pParent, cons get( m_pSelectPersona, "select_persona" ); m_pSelectPersona->SetClickHdl( LINK( this, SvxPersonalizationTabPage, SelectPersona ) ); - get( m_vDefaultPersonaImages[0], "default1" ); - m_vDefaultPersonaImages[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); - - get( m_vDefaultPersonaImages[1], "default2" ); - m_vDefaultPersonaImages[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); - - get( m_vDefaultPersonaImages[2], "default3" ); - m_vDefaultPersonaImages[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + for (sal_uInt32 i = 0; i < MAX_DEFAULT_PERSONAS; ++i) + { + OUString sDefaultId("default" + OUString::number(i)); + get( m_vDefaultPersonaImages[i], OUStringToOString(sDefaultId, RTL_TEXTENCODING_UTF8) ); + m_vDefaultPersonaImages[i]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + } get( m_pPersonaList, "installed_personas" ); m_pPersonaList->SetSelectHdl( LINK( this, SvxPersonalizationTabPage, SelectInstalledPersona ) ); @@ -601,12 +599,13 @@ void SvxPersonalizationTabPage::LoadDefaultImages() while( aStream.IsOpen() && !aStream.eof() && nIndex < MAX_DEFAULT_PERSONAS ) { OString aLine; - OUString aPersonaSetting, aPreviewFile; - sal_Int32 nPreviewIndex = 0; + OUString aPersonaSetting, aPreviewFile, aName; + sal_Int32 nParseIndex = 0; aStream.ReadLine( aLine ); aPersonaSetting = OStringToOUString( aLine, RTL_TEXTENCODING_UTF8 ); - aPreviewFile = aPersonaSetting.getToken( 2, ';', nPreviewIndex ); + aName = aPersonaSetting.getToken( 1, ';', nParseIndex ); + aPreviewFile = aPersonaSetting.getToken( 0, ';', nParseIndex ); if (aPreviewFile.isEmpty()) break; @@ -619,6 +618,7 @@ void SvxPersonalizationTabPage::LoadDefaultImages() aFilter.ImportGraphic( aGraphic, aURLObj ); BitmapEx aBmp = aGraphic.GetBitmapEx(); m_vDefaultPersonaImages[nIndex]->SetModeImage( Image( aBmp ) ); + m_vDefaultPersonaImages[nIndex]->SetQuickHelpText(aName); m_vDefaultPersonaImages[nIndex++]->Show(); foundOne = true; } @@ -694,7 +694,7 @@ IMPL_LINK( SvxPersonalizationTabPage, ForceSelect, Button*, pButton, void ) IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, Button*, pButton, void ) { m_pDefaultPersona->Check(); - for( sal_Int32 nIndex = 0; nIndex < MAX_DEFAULT_PERSONAS; nIndex++ ) + for( sal_Int32 nIndex = 0; nIndex < MAX_DEFAULT_PERSONAS; ++nIndex ) { if( pButton == m_vDefaultPersonaImages[nIndex] ) m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex]; diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index cbdcec569fa8..e05a27842b7b 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -20,7 +20,7 @@ #define CATEGORYCOUNT 6 // Number of persona categories #define MAX_RESULTS 9 // Maximum number of search results -#define MAX_DEFAULT_PERSONAS 3 // Maximum number of default personas +#define MAX_DEFAULT_PERSONAS 6 // Maximum number of default personas /* * The category which will be loaded initially. Should be a non-negative integer lower than CATEGORYCOUNT diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index 588583ab4328..36f41a4ef423 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -61,7 +61,7 @@ </packing> </child> <child> - <object class="GtkBox" id="box1"> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can_focus">False</property> <child> @@ -72,9 +72,20 @@ <property name="vexpand">True</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="default0"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> </packing> </child> <child> @@ -85,9 +96,8 @@ <property name="vexpand">True</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="left_attach">2</property> + <property name="top_attach">0</property> </packing> </child> <child> @@ -98,9 +108,68 @@ <property name="vexpand">True</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="default4"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="default5"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="default6"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="default7"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="default8"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">2</property> </packing> </child> </object> @@ -135,7 +204,7 @@ </child> <child> <object class="GtkLinkButton" id="applied_theme_link"> - <property name="label" translatable="no">Applied persona's name and URL</property> + <property name="label">Applied persona's name and URL</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="relief">none</property> |