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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 17 19:58:41 UTC 2018


 cui/source/options/personalization.cxx |   24 ++++----
 cui/source/options/personalization.hxx |    2 
 cui/uiconfig/ui/personalization_tab.ui |   91 +++++++++++++++++++++++++++++----
 solenv/sanitizers/ui/cui.suppr         |    6 ++
 4 files changed, 99 insertions(+), 24 deletions(-)

New commits:
commit 7e3ee1673c3e59f5e98158c4edd14a57df95e1cd
Author:     Muhammet Kara <muhammet.kara at pardus.org.tr>
AuthorDate: Wed Oct 17 20:35:47 2018 +0300
Commit:     Muhammet Kara <muhammet.kara at pardus.org.tr>
CommitDate: Wed Oct 17 21:57:47 2018 +0200

    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 at pardus.org.tr>

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>
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index d9eed42d3e83..827ff319ed1e 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -380,9 +380,15 @@ cui/uiconfig/ui/patterntabpage.ui://GtkLabel[@id='label4'] orphan-label
 cui/uiconfig/ui/patterntabpage.ui://GtkMenuButton[@id='LB_COLOR'] button-no-label
 cui/uiconfig/ui/patterntabpage.ui://GtkMenuButton[@id='LB_BACKGROUND_COLOR'] button-no-label
 cui/uiconfig/ui/percentdialog.ui://GtkSpinButton[@id='margin'] no-labelled-by
+cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default0'] button-no-label
 cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default1'] button-no-label
 cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default2'] button-no-label
 cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default3'] button-no-label
+cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default4'] button-no-label
+cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default5'] button-no-label
+cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default6'] button-no-label
+cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default7'] button-no-label
+cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default8'] button-no-label
 cui/uiconfig/ui/personalization_tab.ui://GtkLabel[@id='applied_theme'] orphan-label
 cui/uiconfig/ui/personalization_tab.ui://GtkLabel[@id='extensions_label'] orphan-label
 cui/uiconfig/ui/personalization_tab.ui://GtkTreeView[@id='installed_personas:border'] no-labelled-by


More information about the Libreoffice-commits mailing list