summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@pardus.org.tr>2018-09-22 17:31:30 +0300
committerMuhammet Kara <muhammet.kara@pardus.org.tr>2018-09-22 23:39:53 +0200
commit98530f4dfe13fd379ab0c2d55b90914b6738dad9 (patch)
tree578bd9179487d36334561762c0b37f61d72771ee
parent2a052cc921ee819c44794f5762023816e4c4343c (diff)
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@pardus.org.tr>
-rw-r--r--cui/source/options/personalization.cxx20
-rw-r--r--cui/source/options/personalization.hxx13
2 files changed, 25 insertions, 8 deletions
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();