[Libreoffice-commits] core.git: cui/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Sep 22 21:40:13 UTC 2018


 cui/source/options/personalization.cxx |   20 ++++++++++++--------
 cui/source/options/personalization.hxx |   13 +++++++++++++
 2 files changed, 25 insertions(+), 8 deletions(-)

New commits:
commit 98530f4dfe13fd379ab0c2d55b90914b6738dad9
Author:     Muhammet Kara <muhammet.kara at pardus.org.tr>
AuthorDate: Sat Sep 22 17:31:30 2018 +0300
Commit:     Muhammet Kara <muhammet.kara at pardus.org.tr>
CommitDate: Sat Sep 22 23:39:53 2018 +0200

    Ensure settings consistency for default personas
    
    Change-Id: I7610e890a8b49c50bf23ed07daa5517c33edcb8d
    Reviewed-on: https://gerrit.libreoffice.org/60897
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at pardus.org.tr>

diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index e839de754d23..6ac90e7fea3b 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -450,21 +450,25 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
     while( aStream.IsOpen() && !aStream.eof() && nIndex < MAX_DEFAULT_PERSONAS )
     {
         OString aLine;
+        OUString aPersonaSetting, aPreviewFile;
+        sal_Int32 nPreviewIndex = 0;
+
         aStream.ReadLine( aLine );
-        OUString aPersonaSetting( OStringToOUString( aLine, RTL_TEXTENCODING_UTF8 ) );
-        OUString aPreviewFile;
-        sal_Int32 nNewIndex = aPersonaSetting.indexOf( ';' );
-        if( nNewIndex < 0 )
+        aPersonaSetting = OStringToOUString( aLine, RTL_TEXTENCODING_UTF8 );
+        aPreviewFile = aPersonaSetting.getToken( 2, ';', nPreviewIndex );
+
+        if (aPreviewFile.isEmpty())
             break;
-        aPreviewFile = aPersonaSetting.copy( 0, nNewIndex );
-        aPersonaSetting = aPersonaSetting.copy( nNewIndex + 1 );
+
+        // There is no room for the preview file in the PersonaSettings currently
+        aPersonaSetting = aPersonaSetting.replaceFirst( aPreviewFile + ";", "" );
         m_vDefaultPersonaSettings.push_back( aPersonaSetting );
 
         INetURLObject aURLObj( gallery + aPreviewFile );
         aFilter.ImportGraphic( aGraphic, aURLObj );
         BitmapEx aBmp = aGraphic.GetBitmapEx();
-        m_vDefaultPersonaImages[nIndex]->Show();
-        m_vDefaultPersonaImages[nIndex++]->SetModeImage( Image( aBmp ) );
+        m_vDefaultPersonaImages[nIndex]->SetModeImage( Image( aBmp ) );
+        m_vDefaultPersonaImages[nIndex++]->Show();
         foundOne = true;
     }
 
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index 006f7dfced1a..9ee91e875015 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -62,6 +62,19 @@ public:
     void CheckAppliedTheme();
     void ShowAppliedThemeLabel( const OUString& );
 
+    /*
+     * Loads the default personas from the shared personas directory
+     * which resides in the shared gallery.
+     * There needs to be a separate subdirectory for each default persona,
+     * which includes the preview, header, and footer images.
+     * And there needs to be a personas_list.txt file in the personas directory
+     * which keeps the index/info of the default personas, one persona per line.
+     * A line should look like this:
+     * persona_slug;Persona Name;subdir/preview.jpg;subdir/header.jpg;subdir/footer.jpg;#textcolor;#accentcolor
+     * (It is recommended to keep the subdir name the same as the slug)
+     * Example line:
+     *  abstract;Abstract;abstract/preview.jpg;abstract/Header2.jpg;abstract/Footer2.jpg;#ffffff;#000000
+     */
     void LoadDefaultImages();
     void LoadExtensionThemes();
 


More information about the Libreoffice-commits mailing list