[PATCH libreoffice-4-0-3] Personas: Now they are called 'Themes', and changed location...

Jan Holesovsky (via Code Review) gerrit at gerrit.libreoffice.org
Fri Apr 19 08:07:23 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3483

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/83/3483/1

Personas: Now they are called 'Themes', and changed location.

Updated the URL's + the code that works with them & parses the page
accordingly.

Change-Id: Iba1414c749bdf227b3945162da83e3d35ce86244
---
M cui/source/options/personalization.cxx
1 file changed, 12 insertions(+), 22 deletions(-)



diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 10ee48b..0878db4 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -33,7 +33,7 @@
 /** Dialog that will allow the user to choose a Persona to use.
 
 So far there is no better possibility than just to paste the URL from
-http://www.getpersona.com ...
+https://addons.mozilla.org/firefox/themes ...
 */
 class SelectPersonaDialog : public ModalDialog
 {
@@ -59,34 +59,24 @@
     pButton->SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) );
 
     get( m_pEdit, "persona_url" );
-    m_pEdit->SetPlaceholderText( "http://www.getpersonas.com/persona/" );
+    m_pEdit->SetPlaceholderText( "https://addons.mozilla.org/firefox/themes/" );
 }
 
 OUString SelectPersonaDialog::GetPersonaURL() const
 {
     OUString aText( m_pEdit->GetText() );
 
-    if ( !aText.startsWith( "http://www.getpersonas.com/" ) &&
-         !aText.startsWith( "https://www.getpersonas.com/" ) )
-    {
-        return OUString();
-    }
+    if ( aText.startsWith( "https://addons.mozilla.org/" ) )
+        return aText;
 
-    // canonicalize the URL
-    OUString aPersona( "persona/" );
-    sal_Int32 nPersona = aText.lastIndexOf( aPersona );
-
-    if ( nPersona < 0 )
-        return OUString();
-
-    return "http://www.getpersonas.com/persona/" + aText.copy( nPersona + aPersona.getLength() );
+    return OUString();
 }
 
 IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ )
 {
     uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShell( com::sun::star::system::SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) );
 
-    xSystemShell->execute( "http://www.getpersonas.com", OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
+    xSystemShell->execute( "https://addons.mozilla.org/firefox/themes/", OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
 
     return 0;
 }
@@ -291,7 +281,7 @@
 
     where += rIdentifier.getLength();
 
-    sal_Int32 end = rBuffer.indexOf( """, where );
+    sal_Int32 end = rBuffer.indexOf( """, where );
     if ( end < 0 )
         return OUString();
 
@@ -305,24 +295,24 @@
 static bool parsePersonaInfo( const OString &rBuffer, OUString *pHeaderURL, OUString *pFooterURL, OUString *pTextColor, OUString *pAccentColor )
 {
     // it is the first attribute that contains "persona="
-    sal_Int32 persona = rBuffer.indexOf( "persona=\"{" );
+    sal_Int32 persona = rBuffer.indexOf( "data-browsertheme=\"{" );
     if ( persona < 0 )
         return false;
 
     // now search inside
-    *pHeaderURL = searchValue( rBuffer, persona, ""headerURL":"" );
+    *pHeaderURL = searchValue( rBuffer, persona, ""headerURL":"" );
     if ( pHeaderURL->isEmpty() )
         return false;
 
-    *pFooterURL = searchValue( rBuffer, persona, ""footerURL":"" );
+    *pFooterURL = searchValue( rBuffer, persona, ""footerURL":"" );
     if ( pFooterURL->isEmpty() )
         return false;
 
-    *pTextColor = searchValue( rBuffer, persona, ""textcolor":"" );
+    *pTextColor = searchValue( rBuffer, persona, ""textcolor":"" );
     if ( pTextColor->isEmpty() )
         return false;
 
-    *pAccentColor = searchValue( rBuffer, persona, ""accentcolor":"" );
+    *pAccentColor = searchValue( rBuffer, persona, ""accentcolor":"" );
     if ( pAccentColor->isEmpty() )
         return false;
 

-- 
To view, visit https://gerrit.libreoffice.org/3483
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba1414c749bdf227b3945162da83e3d35ce86244
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0-3
Gerrit-Owner: Jan Holesovsky <kendy at suse.cz>



More information about the LibreOffice mailing list