[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig vcl/source

Rachit Gupta rachitgupta1792 at gmail.com
Tue Jul 1 03:03:00 PDT 2014


 cui/source/options/personalization.cxx |   20 +++-
 cui/source/options/personalization.hxx |    4 
 cui/uiconfig/ui/personalization_tab.ui |  137 ++++++++++++++++++---------------
 vcl/source/app/settings.cxx            |    4 
 4 files changed, 99 insertions(+), 66 deletions(-)

New commits:
commit e23bd6a56c5f9868d042ee79c4810ac47d41745b
Author: Rachit Gupta <rachitgupta1792 at gmail.com>
Date:   Tue Jul 1 15:30:44 2014 +0530

    Moved the personas installed through extensions handling to 'own'.
    
    Change-Id: I12baaf22bfad73e228d3ed55dcf365f8eba9cf0a

diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index dd96fd4..616fd14 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -245,15 +245,16 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx
     m_vDefaultPersonaImages[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) );
 
     get( m_vExtensionPersonas[0], "extension1" );
-    m_vExtensionPersonas[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) );
+    m_vExtensionPersonas[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) );
 
     get( m_vExtensionPersonas[1], "extension2" );
-    m_vExtensionPersonas[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) );
+    m_vExtensionPersonas[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) );
 
     get( m_vExtensionPersonas[2], "extension3" );
-    m_vExtensionPersonas[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) );
+    m_vExtensionPersonas[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) );
 
     LoadDefaultImages();
+    LoadExtensionImages();
 }
 
 SvxPersonalizationTabPage::~SvxPersonalizationTabPage()
@@ -360,13 +361,18 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
         m_vDefaultPersonaImages[nIndex]->Show();
         m_vDefaultPersonaImages[nIndex++]->SetModeImage( Image( aBmp ) );
     }
+}
 
+void SvxPersonalizationTabPage::LoadExtensionImages()
+{
     // See if any extensions are used to install personas. If yes, load them.
 
+    GraphicFilter aFilter;
+    Graphic aGraphic;
+    sal_Int32 nIndex = 0;
     css::uno::Sequence<OUString> installedPersonas( officecfg::Office::Common::Misc::PersonasList::get()->getElementNames() );
     sal_Int32 nLength = installedPersonas.getLength();
     sal_Int32 nCount = 0;
-    nIndex = 0;
 
     if( nLength == 0 )
         return;
@@ -442,6 +448,12 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton )
             m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex];
     }
 
+    return 0;
+}
+
+IMPL_LINK( SvxPersonalizationTabPage, InstalledPersona, PushButton*, pButton )
+{
+    m_pOwnPersona->Check();
     for( sal_Int32 nIndex = 0; nIndex < 3; nIndex++ )
     {
         if( pButton == m_vExtensionPersonas[nIndex] )
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index 0865037..d5e4bcf 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -52,6 +52,7 @@ public:
     void SetPersonaSettings( const OUString );
 
     void LoadDefaultImages();
+    void LoadExtensionImages();
 
 private:
     /// Handle the Persona selection
@@ -62,6 +63,9 @@ private:
 
     /// Handle the default Persona selection
     DECL_LINK( DefaultPersona, PushButton* );
+
+    /// Handle the Personas installed through extensions selection
+    DECL_LINK( InstalledPersona, PushButton* );
 };
 
 /** Dialog that will allow the user to choose a Persona to use.
diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui
index e2f4332..2b53e02 100644
--- a/cui/uiconfig/ui/personalization_tab.ui
+++ b/cui/uiconfig/ui/personalization_tab.ui
@@ -58,11 +58,9 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkGrid" id="grid1">
+                  <object class="GtkBox" id="box1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">6</property>
                     <child>
                       <object class="GtkButton" id="default1">
                         <property name="can_focus">True</property>
@@ -71,10 +69,9 @@
                         <property name="vexpand">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
@@ -85,10 +82,9 @@
                         <property name="vexpand">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
@@ -99,55 +95,9 @@
                         <property name="vexpand">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">2</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="extension1">
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="extension2">
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="extension3">
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">2</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                   </object>
@@ -199,6 +149,73 @@
                     <property name="position">3</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Or, select from the personas installed via extensions</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkButton" id="extension1">
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="extension2">
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="extension3">
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">5</property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index b358125..fbcb7a6 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2147,13 +2147,13 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot
     {
         OUString gallery("");
         // try the gallery first, then the program path:
-        if ( aPersona == "own")
+        if ( aPersona == "own" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) )
         {
             gallery = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
             rtl::Bootstrap::expandMacros( gallery );
             gallery += "/user/gallery/personas/";
         }
-        else if ( aPersona == "default" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) )
+        else if ( aPersona == "default" )
         {
             gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER;
             gallery += "/gallery/personas/";


More information about the Libreoffice-commits mailing list