diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2018-09-21 23:44:27 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2018-09-22 12:42:27 +0200 |
commit | ac2dff01460f8ef0c23fbf51f3666218b00c0c66 (patch) | |
tree | 1bb62ba3c0af9afdc037b4cf0cfbd8abdaab69de | |
parent | d3e6b3e4c15c57f876b4e7e22a1e7ba25e0cd18d (diff) |
tdf#60543: Remember the URL of the currently applied persona
Change-Id: I21bc9353dc37825967bdca3329568990907928b4
Reviewed-on: https://gerrit.libreoffice.org/60888
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@pardus.org.tr>
-rw-r--r-- | cui/source/options/personalization.cxx | 28 | ||||
-rw-r--r-- | cui/source/options/personalization.hxx | 3 | ||||
-rw-r--r-- | cui/uiconfig/ui/personalization_tab.ui | 12 |
3 files changed, 29 insertions, 14 deletions
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 27c0b2e836f4..e839de754d23 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -21,6 +21,8 @@ #include <rtl/strbuf.hxx> #include <tools/urlobj.hxx> #include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/fixedhyper.hxx> #include <vcl/weld.hxx> #include <vcl/lstbox.hxx> #include <vcl/svapp.hxx> @@ -278,7 +280,7 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( vcl::Window *pParent, cons // persona get( m_pNoPersona, "no_persona" ); get( m_pDefaultPersona, "default_persona" ); - get( m_pAppliedThemeLabel, "applied_theme" ); + get( m_pAppliedThemeLabel, "applied_theme_link" ); get( m_pOwnPersona, "own_persona" ); m_pOwnPersona->SetClickHdl( LINK( this, SvxPersonalizationTabPage, ForceSelect ) ); @@ -411,14 +413,24 @@ void SvxPersonalizationTabPage::CheckAppliedTheme() void SvxPersonalizationTabPage::ShowAppliedThemeLabel(const OUString& aPersonaSetting) { - sal_Int32 nSlugIndex, nNameIndex; - OUString aName; + OUString aSlug, aName; + sal_Int32 nIndex = 0; + + aSlug = aPersonaSetting.getToken( 0, ';', nIndex ); - nSlugIndex = aPersonaSetting.indexOf( ';' ) + 1; - nNameIndex = aPersonaSetting.indexOf( ';', nSlugIndex ); - aName = "(" + aPersonaSetting.copy( nSlugIndex, nNameIndex ) +")"; - m_pAppliedThemeLabel->Show(); - m_pAppliedThemeLabel->SetText( aName ); + if ( nIndex > 0 ) + aName = "(" + aPersonaSetting.getToken( 0, ';', nIndex ) + ")"; + + if ( !aName.isEmpty() ) + { + m_pAppliedThemeLabel->SetText( aName ); + m_pAppliedThemeLabel->SetURL( "https://addons.mozilla.org/en-US/firefox/addon/" + aSlug + "/" ); + m_pAppliedThemeLabel->Show(); + } + else + { + SAL_WARN("cui.options", "Applied persona doesn't have a name!"); + } } void SvxPersonalizationTabPage::LoadDefaultImages() diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index b1b91d917f25..006f7dfced1a 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -23,6 +23,7 @@ #define MAX_DEFAULT_PERSONAS 3 // Maximum number of default personas class FixedText; +class FixedHyperlink; class SearchAndParseThread; class SvxPersonalizationTabPage : public SfxTabPage @@ -39,7 +40,7 @@ private: VclPtr<ListBox> m_pPersonaList; ///< The ListBox to show the list of installed personas OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings. VclPtr<FixedText> m_pExtensionLabel; ///< The "select persona installed via extensions" label - VclPtr<FixedText> m_pAppliedThemeLabel; ///< The label for showing applied custom theme + VclPtr<FixedHyperlink> m_pAppliedThemeLabel; ///< The label for showing applied custom theme std::vector<OUString> m_vDefaultPersonaSettings; std::vector<OUString> m_vExtensionPersonaSettings; diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index eb2338232521..a5990c1b1c8f 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <object class="GtkVBox" id="PersonalizationTabPage"> @@ -134,9 +134,11 @@ </packing> </child> <child> - <object class="GtkLabel" id="applied_theme"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkLinkButton" id="applied_theme_link"> + <property name="label" translatable="no">Applied persona's name and URL</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="relief">none</property> </object> <packing> <property name="expand">True</property> @@ -167,8 +169,8 @@ <child> <object class="GtkLabel" id="extensions_label"> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="personalization_tab|extensions_label">Or, select from the Themes installed via extensions:</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">True</property> |