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

2014-07-11 Thread Rachit Gupta
 cui/source/options/personalization.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9f15a103b627682aeabf1e87f0b3323ed671e236
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Fri Jul 11 21:50:54 2014 +0530

Fixed crash when cancel is clicked without searching.

Change-Id: I67ca901270874794ec55d5b7db2cd18e6d3a997d

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index d69076e..905801d 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -159,7 +159,8 @@ IMPL_LINK( SelectPersonaDialog, ActionOK, PushButton*, /* 
pButton */ )
 
 IMPL_LINK( SelectPersonaDialog, ActionCancel, PushButton*, /* pButton */ )
 {
-m_rSearchThread-StopExecution();
+if( m_rSearchThread.is() )
+m_rSearchThread-StopExecution();
 
 EndDialog( RET_CANCEL );
 return 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-07-10 Thread Rachit Gupta
 cui/source/options/personalization.cxx |   28 +++-
 cui/source/options/personalization.hxx |3 +++
 2 files changed, 26 insertions(+), 5 deletions(-)

New commits:
commit bba5ba8a7e02e8f35d1a5f9e65723a19fdc57d28
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Thu Jul 10 23:23:12 2014 +0530

Fixed thread related issues.

Added a data member m_bExecute which defaults to true but is set to
false when StopExecution is called. During execution, the member's value
is checked at various positions, if it is false, the execution is stopped
by returning from the execute method.

Following issues have been resolved:

* Multiple searches can be performed. The previous search is halted.
* Cancel button can be pressed in between any search or application of
  the persona.
* A theme can be selected and applied by clicking on OK while the search
  is being done.

Change-Id: Ic76c224ca0d317a6e1a44b3e8933a3ba50b371cb

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index e67318a..d69076e 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -112,7 +112,10 @@ OUString SelectPersonaDialog::GetSelectedPersona() const
 IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, pButton )
 {
 OUString searchTerm;
-if( pButton ==  m_pSearchButton)
+if( m_rSearchThread.is() )
+m_rSearchThread-StopExecution();
+
+if( pButton ==  m_pSearchButton )
 searchTerm = m_pEdit-GetText();
 else
 {
@@ -146,14 +149,17 @@ IMPL_LINK( SelectPersonaDialog, ActionOK, PushButton*, /* 
pButton */ )
 }
 
 else
+{
+if( m_rSearchThread.is() )
+m_rSearchThread-StopExecution();
 EndDialog( RET_OK );
+}
 return 0;
 }
 
 IMPL_LINK( SelectPersonaDialog, ActionCancel, PushButton*, /* pButton */ )
 {
-if( m_rSearchThread.is() )
-m_rSearchThread-terminate();
+m_rSearchThread-StopExecution();
 
 EndDialog( RET_CANCEL );
 return 0;
@@ -161,6 +167,9 @@ IMPL_LINK( SelectPersonaDialog, ActionCancel, PushButton*, 
/* pButton */ )
 
 IMPL_LINK( SelectPersonaDialog, SelectPersona, PushButton*, pButton )
 {
+if( m_rSearchThread.is() )
+m_rSearchThread-StopExecution();
+
 for( sal_Int32 index = 0; index  9; index++ )
 {
 if( pButton == m_vResultList[index] )
@@ -526,7 +535,8 @@ SearchAndParseThread::SearchAndParseThread( 
SelectPersonaDialog* pDialog,
   const OUString rURL ) :
 Thread( cuiPersonasSearchThread ),
 m_pPersonaDialog( pDialog ),
-m_aURL( rURL )
+m_aURL( rURL ),
+m_bExecute( true )
 {
 }
 
@@ -587,6 +597,9 @@ void SearchAndParseThread::execute()
 aFilter.ImportGraphic( aGraphic, aURLObj );
 Bitmap aBmp = aGraphic.GetBitmap();
 
+if( !m_bExecute )
+return;
+
 // for VCL to be able to do visual changes in the thread
 SolarMutexGuard aGuard;
 m_pPersonaDialog-SetImages( Image( aBmp ), nIndex++ );
@@ -594,8 +607,10 @@ void SearchAndParseThread::execute()
 m_pPersonaDialog-AddPersonaSetting( aPersonaSetting );
 }
 
-SolarMutexGuard aGuard;
+if( !m_bExecute )
+return;
 
+SolarMutexGuard aGuard;
 sProgress = ;
 m_pPersonaDialog-SetProgress( sProgress );
 m_pPersonaDialog-setOptimalLayoutSize();
@@ -657,6 +672,9 @@ void SearchAndParseThread::execute()
 return;
 }
 
+if( !m_bExecute )
+return;
+
 SolarMutexGuard aGuard;
 
 aPersonaSetting = aHeaderFile + ; + aFooterFile + ; + aTextColor + 
; + aAccentColor;
diff --git a/cui/source/options/personalization.hxx 
b/cui/source/options/personalization.hxx
index a09226e..92ce3de 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -116,6 +116,7 @@ private:
 
 SelectPersonaDialog *m_pPersonaDialog;
 OUString m_aURL;
+bool m_bExecute;
 
 virtual ~SearchAndParseThread();
 virtual void execute() SAL_OVERRIDE;
@@ -125,6 +126,8 @@ public:
 
 SearchAndParseThread( SelectPersonaDialog* pDialog,
   const OUString rURL );
+
+void StopExecution() { m_bExecute = false; }
 };
 
 #endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-07-01 Thread Rachit Gupta
 cui/source/options/personalization.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 5cbfed7b2633c21abaaf84b4fda0e2e384845c41
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Tue Jul 1 13:34:39 2014 +0530

Fixed Bug: Persona info is deleted if No Persona is selected.

If the user selects 'Plain look..' and clicks OK, the previous persona
information is removed from the registry so that if the user selects either
of the other option and clicks OK, the previous theme is not applied.

Change-Id: I5f6a707e5f2724d2a3c39965d155cf47c898d392

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 0a431f0..dd96fd4 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -285,6 +285,8 @@ bool SvxPersonalizationTabPage::FillItemSet( SfxItemSet  )
 
 // write
 boost::shared_ptr comphelper::ConfigurationChanges  batch( 
comphelper::ConfigurationChanges::create() );
+if( aPersona == no )
+m_aPersonaSettings = ;
 officecfg::Office::Common::Misc::Persona::set( aPersona, batch );
 officecfg::Office::Common::Misc::PersonaSettings::set( m_aPersonaSettings, 
batch );
 batch-commit();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-07-01 Thread Rachit Gupta
 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 rachitgupta1...@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::SequenceOUString 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=visibleTrue/property
 property name=can_focusFalse/property
-property name=row_spacing6/property
-property name=column_spacing6/property
 child
   object class=GtkButton id=default1
 property name=can_focusTrue/property
@@ -71,10 +69,9 @@
 property name=vexpandTrue/property
   /object
   packing
-property name=left_attach0/property
-property name=top_attach0/property
-property name=width1/property
-property name=height1/property
+property name=expandFalse/property
+property name=fillTrue/property
+   

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

2014-07-01 Thread Rachit Gupta
 cui/source/options/personalization.cxx |   63 +++--
 cui/source/options/personalization.hxx |   19 +
 cui/uiconfig/ui/personalization_tab.ui |   29 +++
 3 files changed, 46 insertions(+), 65 deletions(-)

New commits:
commit 7b6d0027af81b406014226bc0172d0646be545c5
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Tue Jul 1 18:27:42 2014 +0530

Changed Personas installed through extensions procedure.

The UI now consists of a TreeView that lists all the personas that were
installed through extensions. When the user selects any name from the
list, the preview is shown in a button besides the list.

If there are no extensions installed, the list stays hidden.

Change-Id: I030d99549fd5b15d1104224116257ad62cdd1891

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 616fd14..0bc8fb5 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -21,6 +21,7 @@
 #include tools/urlobj.hxx
 #include vcl/edit.hxx
 #include vcl/msgbox.hxx
+#include vcl/lstbox.hxx
 #include vcl/svapp.hxx
 #include vcl/settings.hxx
 #include vcl/graphicfilter.hxx
@@ -244,17 +245,13 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( 
Window *pParent, const Sfx
 get( m_vDefaultPersonaImages[2], default3 );
 m_vDefaultPersonaImages[2]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, DefaultPersona ) );
 
-get( m_vExtensionPersonas[0], extension1 );
-m_vExtensionPersonas[0]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, InstalledPersona ) );
+get( m_pPersonaList, installed_personas );
+m_pPersonaList-SetSelectHdl( LINK( this, SvxPersonalizationTabPage, 
SelectInstalledPersona ) );
 
-get( m_vExtensionPersonas[1], extension2 );
-m_vExtensionPersonas[1]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, InstalledPersona ) );
-
-get( m_vExtensionPersonas[2], extension3 );
-m_vExtensionPersonas[2]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, InstalledPersona ) );
+get( m_pExtensionPersonaPreview, persona_preview );
 
 LoadDefaultImages();
-LoadExtensionImages();
+LoadExtensionThemes();
 }
 
 SvxPersonalizationTabPage::~SvxPersonalizationTabPage()
@@ -363,37 +360,28 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
 }
 }
 
-void SvxPersonalizationTabPage::LoadExtensionImages()
+void SvxPersonalizationTabPage::LoadExtensionThemes()
 {
 // See if any extensions are used to install personas. If yes, load them.
 
-GraphicFilter aFilter;
-Graphic aGraphic;
-sal_Int32 nIndex = 0;
 css::uno::SequenceOUString installedPersonas( 
officecfg::Office::Common::Misc::PersonasList::get()-getElementNames() );
 sal_Int32 nLength = installedPersonas.getLength();
-sal_Int32 nCount = 0;
 
 if( nLength == 0 )
 return;
 
-if( nLength  3 )
-nIndex = nLength - 3;
+m_pPersonaList-Show();
 
-for( ; nIndex  nLength; nIndex++ )
+for( sal_Int32 nIndex = 0; nIndex  nLength; nIndex++ )
 {
 Reference XPropertySet  xPropertySet( 
officecfg::Office::Common::Misc::PersonasList::get()-getByName( 
installedPersonas[nIndex] ), UNO_QUERY_THROW );
 OUString aPersonaName, aPreviewFile, aHeaderFile, aFooterFile, 
aTextColor, aAccentColor, aPersonaSettings;
-Any aValue = xPropertySet-getPropertyValue( Preview );
-aValue = aPreviewFile;
-INetURLObject aURLObj( aPreviewFile );
-aFilter.ImportGraphic( aGraphic, aURLObj );
-Bitmap aBmp = aGraphic.GetBitmap();
-m_vExtensionPersonas[nCount]-Show();
-m_vExtensionPersonas[nCount++]-SetModeImage( Image( aBmp ) );
-
-aValue = xPropertySet-getPropertyValue( Name );
+Any aValue = xPropertySet-getPropertyValue( Name );
 aValue = aPersonaName;
+m_pPersonaList-InsertEntry( aPersonaName );
+
+aValue = xPropertySet-getPropertyValue( Preview );
+aValue = aPreviewFile;
 
 aValue = xPropertySet-getPropertyValue( Header );
 aValue = aHeaderFile;
@@ -407,7 +395,7 @@ void SvxPersonalizationTabPage::LoadExtensionImages()
 aValue = xPropertySet-getPropertyValue( AccentColor );
 aValue = aAccentColor;
 
-aPersonaSettings = aHeaderFile + ; + aFooterFile + ; + aTextColor 
+ ; + aAccentColor;
+aPersonaSettings = aPreviewFile + ; + aHeaderFile + ; + 
aFooterFile + ; + aTextColor + ; + aAccentColor;
 rtl::Bootstrap::expandMacros( aPersonaSettings );
 m_vExtensionPersonaSettings.push_back( aPersonaSettings );
 }
@@ -451,14 +439,23 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, 
PushButton*, pButton )
 return 0;
 }
 
-IMPL_LINK( SvxPersonalizationTabPage, InstalledPersona, PushButton*, pButton )
+IMPL_LINK( SvxPersonalizationTabPage, SelectInstalledPersona, ListBox*, )
 {
-m_pOwnPersona-Check();
-for( sal_Int32 nIndex = 0; nIndex  3; 

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

2014-07-01 Thread Rachit Gupta
 cui/source/options/personalization.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit a848adedd0eb6adf46b7bb70734a4264bee53a87
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Wed Jul 2 10:11:04 2014 +0530

Minor fix: Own persona selected when user selects installed persona.

Change-Id: I5ecd9e3b4a9b878cf5aeb2ccce2e51b45ce9a70a

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 0bc8fb5..69afe39 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -441,6 +441,8 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, 
PushButton*, pButton )
 
 IMPL_LINK( SvxPersonalizationTabPage, SelectInstalledPersona, ListBox*, )
 {
+m_pOwnPersona-Check();
+
 // Get the details of the selected theme.
 m_pExtensionPersonaPreview-Show();
 sal_Int32 nSelectedPos = m_pPersonaList-GetSelectEntryPos();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-30 Thread Rachit Gupta
 cui/source/options/personalization.cxx |   25 ---
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   29 +++--
 2 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit 888a0e4ceb8d379f6c44d449863ea8c1b5a599e2
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Mon Jun 30 15:28:05 2014 +0530

Changed application of personas through extensions procedure.

The PersonasEntry template in the registry now stores the setting as
splitted values rather than ';' separated terms. The corresponding ';'
separated setting is prepared and stored.

Change-Id: I154d519c475a48763a75b5c35ad20f170c1d7996

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 1cc8b75..e78c779 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -375,8 +375,8 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
 for( ; nIndex  nLength; nIndex++ )
 {
 Reference XPropertySet  xPropertySet( 
officecfg::Office::Common::Misc::PersonasList::get()-getByName( 
installedPersonas[nIndex] ), UNO_QUERY_THROW );
+OUString aPersonaName, aPreviewFile, aHeaderFile, aFooterFile, 
aTextColor, aAccentColor, aPersonaSettings;
 Any aValue = xPropertySet-getPropertyValue( PersonaPreview );
-OUString aPreviewFile;
 aValue = aPreviewFile;
 INetURLObject aURLObj( aPreviewFile );
 aFilter.ImportGraphic( aGraphic, aURLObj );
@@ -384,11 +384,24 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
 m_vExtensionPersonas[nCount]-Show();
 m_vExtensionPersonas[nCount++]-SetModeImage( Image( aBmp ) );
 
-aValue = xPropertySet-getPropertyValue( PersonaSettings );
-OUString sPersonaSettings;
-aValue = sPersonaSettings;
-rtl::Bootstrap::expandMacros( sPersonaSettings );
-m_vExtensionPersonaSettings.push_back( sPersonaSettings );
+aValue = xPropertySet-getPropertyValue( PersonaName );
+aValue = aPersonaName;
+
+aValue = xPropertySet-getPropertyValue( PersonaHeader );
+aValue = aHeaderFile;
+
+aValue = xPropertySet-getPropertyValue( PersonaFooter );
+aValue = aFooterFile;
+
+aValue = xPropertySet-getPropertyValue( PersonaTextColor );
+aValue = aTextColor;
+
+aValue = xPropertySet-getPropertyValue( PersonaAccentColor );
+aValue = aAccentColor;
+
+aPersonaSettings = aHeaderFile + ; + aFooterFile + ; + aTextColor 
+ ; + aAccentColor;
+rtl::Bootstrap::expandMacros( aPersonaSettings );
+m_vExtensionPersonaSettings.push_back( aPersonaSettings );
 }
 }
 
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d5e926b..6548445 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -810,16 +810,37 @@
   info
 descStores the details of the installed personas./desc
   /info
+  prop oor:name=PersonaName oor:type=xs:string oor:nillable=false
+info
+  descThe Persona's name/desc
+/info
+  /prop
   prop oor:name=PersonaPreview oor:type=xs:string 
oor:nillable=false
 info
   descName of the preview file for the Persona to show in the 
UI/desc
 /info
   /prop
-  prop oor:name=PersonaSettings oor:type=xs:string 
oor:nillable=false
+  prop oor:name=PersonaHeader oor:type=xs:string oor:nillable=false
 info
-  descNames of the header and footer images, and colors for text and
-accent.  When set, the value has form
-header.jpg;footer.jpg;#RGBTXT;#RGBACC./desc
+  descName of the header file for the Persona/desc
+/info
+value/
+  /prop
+  prop oor:name=PersonaFooter oor:type=xs:string oor:nillable=false
+info
+  descName of the footer file for the Persona/desc
+/info
+value/
+  /prop
+  prop oor:name=PersonaTextColor oor:type=xs:string 
oor:nillable=false
+info
+  descValue of the text color for the Persona/desc
+/info
+value/
+  /prop
+  prop oor:name=PersonaAccentColor oor:type=xs:string 
oor:nillable=false
+info
+  descValue of the accent color for the Persona/desc
 /info
 value/
   /prop
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-30 Thread Rachit Gupta
 cui/source/options/personalization.cxx |   12 ++--
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   12 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit c64c61ff06e27791e38f36fed7cda3d283ac5115
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Mon Jun 30 18:46:47 2014 +0530

Dropped 'Persona' from the properties in PersonasEntry template.

Change-Id: Ic662f59c084eacc7e99762c3e94fbcc191629557

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index e78c779..0a431f0 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -376,7 +376,7 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
 {
 Reference XPropertySet  xPropertySet( 
officecfg::Office::Common::Misc::PersonasList::get()-getByName( 
installedPersonas[nIndex] ), UNO_QUERY_THROW );
 OUString aPersonaName, aPreviewFile, aHeaderFile, aFooterFile, 
aTextColor, aAccentColor, aPersonaSettings;
-Any aValue = xPropertySet-getPropertyValue( PersonaPreview );
+Any aValue = xPropertySet-getPropertyValue( Preview );
 aValue = aPreviewFile;
 INetURLObject aURLObj( aPreviewFile );
 aFilter.ImportGraphic( aGraphic, aURLObj );
@@ -384,19 +384,19 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
 m_vExtensionPersonas[nCount]-Show();
 m_vExtensionPersonas[nCount++]-SetModeImage( Image( aBmp ) );
 
-aValue = xPropertySet-getPropertyValue( PersonaName );
+aValue = xPropertySet-getPropertyValue( Name );
 aValue = aPersonaName;
 
-aValue = xPropertySet-getPropertyValue( PersonaHeader );
+aValue = xPropertySet-getPropertyValue( Header );
 aValue = aHeaderFile;
 
-aValue = xPropertySet-getPropertyValue( PersonaFooter );
+aValue = xPropertySet-getPropertyValue( Footer );
 aValue = aFooterFile;
 
-aValue = xPropertySet-getPropertyValue( PersonaTextColor );
+aValue = xPropertySet-getPropertyValue( TextColor );
 aValue = aTextColor;
 
-aValue = xPropertySet-getPropertyValue( PersonaAccentColor );
+aValue = xPropertySet-getPropertyValue( AccentColor );
 aValue = aAccentColor;
 
 aPersonaSettings = aHeaderFile + ; + aFooterFile + ; + aTextColor 
+ ; + aAccentColor;
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 6548445..408874f 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -810,35 +810,35 @@
   info
 descStores the details of the installed personas./desc
   /info
-  prop oor:name=PersonaName oor:type=xs:string oor:nillable=false
+  prop oor:name=Name oor:type=xs:string oor:nillable=false
 info
   descThe Persona's name/desc
 /info
   /prop
-  prop oor:name=PersonaPreview oor:type=xs:string 
oor:nillable=false
+  prop oor:name=Preview oor:type=xs:string oor:nillable=false
 info
   descName of the preview file for the Persona to show in the 
UI/desc
 /info
   /prop
-  prop oor:name=PersonaHeader oor:type=xs:string oor:nillable=false
+  prop oor:name=Header oor:type=xs:string oor:nillable=false
 info
   descName of the header file for the Persona/desc
 /info
 value/
   /prop
-  prop oor:name=PersonaFooter oor:type=xs:string oor:nillable=false
+  prop oor:name=Footer oor:type=xs:string oor:nillable=false
 info
   descName of the footer file for the Persona/desc
 /info
 value/
   /prop
-  prop oor:name=PersonaTextColor oor:type=xs:string 
oor:nillable=false
+  prop oor:name=TextColor oor:type=xs:string oor:nillable=false
 info
   descValue of the text color for the Persona/desc
 /info
 value/
   /prop
-  prop oor:name=PersonaAccentColor oor:type=xs:string 
oor:nillable=false
+  prop oor:name=AccentColor oor:type=xs:string oor:nillable=false
 info
   descValue of the accent color for the Persona/desc
 /info
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-27 Thread Rachit Gupta
 cui/source/options/personalization.cxx |   54 +
 cui/source/options/personalization.hxx |2 
 cui/uiconfig/ui/personalization_tab.ui |   76 +
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   23 +++
 vcl/source/app/settings.cxx|2 
 5 files changed, 137 insertions(+), 20 deletions(-)

New commits:
commit e62172ebbe41e0fe184e8a65c84dbd06f87bb01b
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Fri Jun 27 23:52:42 2014 +0530

The Personas can be install through oxt extensions.

The user can install an oxt extension and choose his/her theme from
the Personalization page.

* Created a template in Common.xcs registry to hold the values for the
  PersonasList set.
* Added 3 buttons to personalization_tab.ui to incorporate the latest 3
  personas installed through extensions.
* Currently, only 3 installed personas are shown alongwith the default
  available personas.

Change-Id: I30a40ae48d17f4ed8caef33854ef88afcbec5a54

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index ec7..1cc8b75 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -14,6 +14,8 @@
 
 #include comphelper/processfactory.hxx
 #include officecfg/Office/Common.hxx
+#include com/sun/star/container/XNameAccess.hpp
+#include com/sun/star/beans/XPropertySet.hpp
 #include osl/file.hxx
 #include rtl/bootstrap.hxx
 #include tools/urlobj.hxx
@@ -31,6 +33,7 @@
 using namespace com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::beans;
 
 SelectPersonaDialog::SelectPersonaDialog( Window *pParent )
 : ModalDialog( pParent, SelectPersonaDialog, 
cui/ui/select_persona_dialog.ui )
@@ -241,6 +244,15 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( 
Window *pParent, const Sfx
 get( m_vDefaultPersonaImages[2], default3 );
 m_vDefaultPersonaImages[2]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, DefaultPersona ) );
 
+get( m_vExtensionPersonas[0], extension1 );
+m_vExtensionPersonas[0]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, DefaultPersona ) );
+
+get( m_vExtensionPersonas[1], extension2 );
+m_vExtensionPersonas[1]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, DefaultPersona ) );
+
+get( m_vExtensionPersonas[2], extension3 );
+m_vExtensionPersonas[2]-SetClickHdl( LINK( this, 
SvxPersonalizationTabPage, DefaultPersona ) );
+
 LoadDefaultImages();
 }
 
@@ -273,7 +285,6 @@ bool SvxPersonalizationTabPage::FillItemSet( SfxItemSet  )
 
 // write
 boost::shared_ptr comphelper::ConfigurationChanges  batch( 
comphelper::ConfigurationChanges::create() );
-
 officecfg::Office::Common::Misc::Persona::set( aPersona, batch );
 officecfg::Office::Common::Misc::PersonaSettings::set( m_aPersonaSettings, 
batch );
 batch-commit();
@@ -316,6 +327,8 @@ void SvxPersonalizationTabPage::SetPersonaSettings( const 
OUString aPersonaSetti
 
 void SvxPersonalizationTabPage::LoadDefaultImages()
 {
+// Load the pre saved personas
+
 OUString gallery(  );
 gallery = $BRAND_BASE_DIR/ LIBO_SHARE_FOLDER;
 gallery += /gallery/personas/;
@@ -345,6 +358,38 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
 m_vDefaultPersonaImages[nIndex]-Show();
 m_vDefaultPersonaImages[nIndex++]-SetModeImage( Image( aBmp ) );
 }
+
+// See if any extensions are used to install personas. If yes, load them.
+
+css::uno::SequenceOUString installedPersonas( 
officecfg::Office::Common::Misc::PersonasList::get()-getElementNames() );
+sal_Int32 nLength = installedPersonas.getLength();
+sal_Int32 nCount = 0;
+nIndex = 0;
+
+if( nLength == 0 )
+return;
+
+if( nLength  3 )
+nIndex = nLength - 3;
+
+for( ; nIndex  nLength; nIndex++ )
+{
+Reference XPropertySet  xPropertySet( 
officecfg::Office::Common::Misc::PersonasList::get()-getByName( 
installedPersonas[nIndex] ), UNO_QUERY_THROW );
+Any aValue = xPropertySet-getPropertyValue( PersonaPreview );
+OUString aPreviewFile;
+aValue = aPreviewFile;
+INetURLObject aURLObj( aPreviewFile );
+aFilter.ImportGraphic( aGraphic, aURLObj );
+Bitmap aBmp = aGraphic.GetBitmap();
+m_vExtensionPersonas[nCount]-Show();
+m_vExtensionPersonas[nCount++]-SetModeImage( Image( aBmp ) );
+
+aValue = xPropertySet-getPropertyValue( PersonaSettings );
+OUString sPersonaSettings;
+aValue = sPersonaSettings;
+rtl::Bootstrap::expandMacros( sPersonaSettings );
+m_vExtensionPersonaSettings.push_back( sPersonaSettings );
+}
 }
 
 IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ )
@@ -381,6 +426,13 @@ IMPL_LINK( 

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

2014-06-20 Thread Rachit Gupta
 cui/source/options/personalization.cxx   |   21 +
 cui/source/options/personalization.hxx   |2 +-
 cui/uiconfig/ui/select_persona_dialog.ui |4 
 3 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 84deacb87c1437d8409e4b7df4e182275f9723b8
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Fri Jun 20 15:38:26 2014 +0530

Improved search: the images are displayed as they are downloaded.

Previously, all the search result images were displayed in one go,
but now the images are shown as they are downloaded.

Change-Id: I95990f36c242a0c90bd2b2fd65fd76953f46bcc2

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index e592126..f708d43 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -166,15 +166,10 @@ void SelectPersonaDialog::SetProgress( OUString 
rProgress )
 }
 }
 
-void SelectPersonaDialog::SetImages( std::vectorImage rImageList )
+void SelectPersonaDialog::SetImages( Image aImage, sal_Int32 nIndex )
 {
-sal_Int32 nCount = 0;
-for( std::vectorImage::iterator it=rImageList.begin(); 
it!=rImageList.end(); ++it )
-{
-m_vResultList[nCount]-Show();
-m_vResultList[nCount]-SetModeImage( *it );
-nCount++;
-}
+m_vResultList[nIndex]-Show();
+m_vResultList[nIndex]-SetModeImage( aImage );
 }
 
 void SelectPersonaDialog::AddPersonaSetting( OUString rPersonaSetting )
@@ -465,7 +460,7 @@ void SearchAndParseThread::execute()
 
 std::vectorOUString vLearnmoreURLs = pHandler-getLearnmoreURLs();
 std::vectorOUString::iterator it;
-std::vectorImage vResultList;
+sal_Int32 nIndex = 0;
 GraphicFilter aFilter;
 Graphic aGraphic;
 
@@ -476,14 +471,16 @@ void SearchAndParseThread::execute()
 INetURLObject aURLObj( sPreviewFile );
 aFilter.ImportGraphic( aGraphic, aURLObj );
 Bitmap aBmp = aGraphic.GetBitmap();
-vResultList.push_back( Image( aBmp ) );
+
+// for VCL to be able to do visual changes in the thread
+SolarMutexGuard aGuard;
+m_pPersonaDialog-SetImages( Image( aBmp ), nIndex++ );
+m_pPersonaDialog-setOptimalLayoutSize();
 m_pPersonaDialog-AddPersonaSetting( aPersonaSetting );
 }
 
-// for VCL to be able to do visual changes in the thread
 SolarMutexGuard aGuard;
 
-m_pPersonaDialog-SetImages( vResultList );
 sProgress = ;
 m_pPersonaDialog-SetProgress( sProgress );
 m_pPersonaDialog-setOptimalLayoutSize();
diff --git a/cui/source/options/personalization.hxx 
b/cui/source/options/personalization.hxx
index fb26c70..da17122 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -87,7 +87,7 @@ public:
 
 OUString GetSelectedPersona() const;
 void SetProgress( OUString );
-void SetImages( std::vectorImage);
+void SetImages( Image, sal_Int32 );
 void AddPersonaSetting( OUString );
 void ClearSearchResults();
 void SetAppliedPersonaSetting( OUString );
diff --git a/cui/uiconfig/ui/select_persona_dialog.ui 
b/cui/uiconfig/ui/select_persona_dialog.ui
index cf551dc..51d8bcb 100644
--- a/cui/uiconfig/ui/select_persona_dialog.ui
+++ b/cui/uiconfig/ui/select_persona_dialog.ui
@@ -154,6 +154,10 @@
 property name=vexpandTrue/property
 property name=row_spacing6/property
 property name=column_spacing6/property
+property name=width_request624/property
+property name=height_request219/property
+property name=row_homogeneousTrue/property
+property name=column_homogeneousTrue/property
 child
   object class=GtkButton id=result1
 property name=can_focusTrue/property
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-20 Thread Rachit Gupta
 cui/source/options/personalization.cxx   |   38 ++
 cui/source/options/personalization.hxx   |1 
 cui/uiconfig/ui/select_persona_dialog.ui |  110 +--
 3 files changed, 142 insertions(+), 7 deletions(-)

New commits:
commit cb5236f244cc7231816af3c191be3987daf3c673
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Fri Jun 20 21:20:37 2014 +0530

Added some pre-defined search terms.

The user can now enter his/her own search term or can use the commonly
used search terms to browse for themes.

Change-Id: Ife4ad6b820784a6321f5b916a0069a915c114c7e

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index f708d43..ec7 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -38,6 +38,26 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent )
 get( m_pSearchButton, search_personas );
 m_pSearchButton-SetClickHdl( LINK( this, SelectPersonaDialog, 
SearchPersonas ) );
 
+get( m_vSearchSuggestions[0], suggestion1 );
+m_vSearchSuggestions[0]-SetText( libreoffice );
+m_vSearchSuggestions[0]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SearchPersonas ) );
+
+get( m_vSearchSuggestions[1], suggestion2 );
+m_vSearchSuggestions[1]-SetText( science );
+m_vSearchSuggestions[1]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SearchPersonas ) );
+
+get( m_vSearchSuggestions[2], suggestion3 );
+m_vSearchSuggestions[2]-SetText( firefox );
+m_vSearchSuggestions[2]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SearchPersonas ) );
+
+get( m_vSearchSuggestions[3], suggestion4 );
+m_vSearchSuggestions[3]-SetText( nasa );
+m_vSearchSuggestions[3]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SearchPersonas ) );
+
+get( m_vSearchSuggestions[4], suggestion5 );
+m_vSearchSuggestions[4]-SetText( harry potter );
+m_vSearchSuggestions[4]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SearchPersonas ) );
+
 get( m_pEdit, search_term );
 m_pEdit-SetPlaceholderText( Search term... );
 
@@ -85,9 +105,23 @@ OUString SelectPersonaDialog::GetSelectedPersona() const
 return OUString();
 }
 
-IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, /*pButton*/ )
+IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, pButton )
 {
-OUString searchTerm = m_pEdit-GetText();
+OUString searchTerm;
+if( pButton ==  m_pSearchButton)
+searchTerm = m_pEdit-GetText();
+else
+{
+for( sal_Int32 nIndex = 0; nIndex  5; nIndex++ )
+{
+if( pButton == m_vSearchSuggestions[nIndex] )
+{
+searchTerm = m_vSearchSuggestions[nIndex]-GetDisplayText();
+break;
+}
+}
+}
+
 if( searchTerm.isEmpty( ) )
 return 0;
 
diff --git a/cui/source/options/personalization.hxx 
b/cui/source/options/personalization.hxx
index da17122..8e0520e 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -74,6 +74,7 @@ private:
 PushButton *m_pSearchButton;/// The search button
 FixedText *m_pProgressLabel;/// The label for showing 
progress of search
 PushButton *m_vResultList[9];   /// List of buttons to show 
search results
+PushButton *m_vSearchSuggestions[9];/// List of buttons for the 
search suggestions
 PushButton *m_pOkButton;/// The OK button
 PushButton *m_pCancelButton;/// The Cancel button
 
diff --git a/cui/uiconfig/ui/select_persona_dialog.ui 
b/cui/uiconfig/ui/select_persona_dialog.ui
index 51d8bcb..7497c5f 100644
--- a/cui/uiconfig/ui/select_persona_dialog.ui
+++ b/cui/uiconfig/ui/select_persona_dialog.ui
@@ -104,7 +104,6 @@
 property name=can_focusTrue/property
 property name=hexpandTrue/property
 property name=invisible_char●/property
-property name=invisible_char_setTrue/property
 property name=primary_icon_activatableFalse/property
 property 
name=secondary_icon_activatableFalse/property
   /object
@@ -136,9 +135,12 @@
   /packing
 /child
 child
-  object class=GtkLabel id=progress_label
+  object class=GtkLabel id=label2
 property name=visibleTrue/property
 property name=can_focusFalse/property
+property name=xalign0/property
+property name=label translatable=yesOr, use these 
commonly used terms to _browse themes:/property
+property name=use_underlineTrue/property
   /object
   packing
 property name=expandFalse/property
@@ -147,15 +149,113 @@
   /packing
 /child
 child
+  object class=GtkBox 

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

2014-06-20 Thread Rachit Gupta
 cui/source/options/personalization.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8f1e214887adf28e7ae2f5aceb409038684cdbe8
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Sat Jun 21 09:16:16 2014 +0530

Fixed Typo.

Change-Id: I8d0b34e0c34c349baaa7c9a56fd1e6cfe3ad6934

diff --git a/cui/source/options/personalization.hxx 
b/cui/source/options/personalization.hxx
index 8e0520e..1254e82 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -74,7 +74,7 @@ private:
 PushButton *m_pSearchButton;/// The search button
 FixedText *m_pProgressLabel;/// The label for showing 
progress of search
 PushButton *m_vResultList[9];   /// List of buttons to show 
search results
-PushButton *m_vSearchSuggestions[9];/// List of buttons for the 
search suggestions
+PushButton *m_vSearchSuggestions[5];/// List of buttons for the 
search suggestions
 PushButton *m_pOkButton;/// The OK button
 PushButton *m_pCancelButton;/// The Cancel button
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-19 Thread Rachit Gupta
 cui/source/options/personalization.cxx |   81 +++--
 cui/source/options/personalization.hxx |   10 +++-
 cui/uiconfig/ui/personalization_tab.ui |   66 ++
 vcl/source/app/settings.cxx|8 ---
 4 files changed, 142 insertions(+), 23 deletions(-)

New commits:
commit dc7092fe6e48e5d50a438bf27332cf151d86b2ca
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Thu Jun 19 18:49:36 2014 +0530

Added functionality to apply default themes.

* The themes are stored in the share folder under the personas directory
  in the gallery. The information is stored in a personas_list.txt which
  contains the info in the form headerFile;footerFile;textColor;AccentColor
  for the default themes.
* Changed the personalization_tab.ui to include _three_ buttons to show
  the default images.
* Changed the vcl/source/app/settings.cxx to read the persona information
  properly in the case of default personas.
* Some variable name changes.

Change-Id: Ib5f2167729a5fb7eb8061925679560accb934a44

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index e6307f4..e592126 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -202,6 +202,17 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( 
Window *pParent, const Sfx
 
 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 ) );
+
+LoadDefaultImages();
 }
 
 SvxPersonalizationTabPage::~SvxPersonalizationTabPage()
@@ -268,6 +279,45 @@ void SvxPersonalizationTabPage::Reset( const SfxItemSet  )
 m_pDefaultPersona-Check();
 }
 
+void SvxPersonalizationTabPage::SetPersonaSettings( const OUString 
aPersonaSettings )
+{
+m_aPersonaSettings = aPersonaSettings;
+m_pOwnPersona-Check();
+}
+
+void SvxPersonalizationTabPage::LoadDefaultImages()
+{
+OUString gallery(  );
+gallery = $BRAND_BASE_DIR/ LIBO_SHARE_FOLDER;
+gallery += /gallery/personas/;
+rtl::Bootstrap::expandMacros( gallery );
+OUString aPersonasList = gallery + personas_list.txt;
+SvFileStream aStream( aPersonasList, STREAM_READ );
+GraphicFilter aFilter;
+Graphic aGraphic;
+sal_Int32 nIndex = 0;
+
+while( aStream.IsOpen()  !aStream.IsEof() )
+{
+OString aLine;
+aStream.ReadLine( aLine );
+OUString aPersonaSetting( OStringToOUString( aLine, 
RTL_TEXTENCODING_UTF8 ) );
+OUString aPreviewFile;
+sal_Int32 nNewIndex = aPersonaSetting.indexOf( ';', 0 );
+if( nNewIndex  0 )
+break;
+aPreviewFile = aPersonaSetting.copy( 0, nNewIndex );
+aPersonaSetting = aPersonaSetting.copy( nNewIndex + 1 );
+m_vDefaultPersonaSettings.push_back( aPersonaSetting );
+
+INetURLObject aURLObj( gallery + aPreviewFile );
+aFilter.ImportGraphic( aGraphic, aURLObj );
+Bitmap aBmp = aGraphic.GetBitmap();
+m_vDefaultPersonaImages[nIndex]-Show();
+m_vDefaultPersonaImages[nIndex++]-SetModeImage( Image( aBmp ) );
+}
+}
+
 IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ )
 {
 SelectPersonaDialog aDialog( NULL );
@@ -277,7 +327,7 @@ IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, 
PushButton*, /*pButton*/ )
 OUString aPersonaSetting( aDialog.GetAppliedPersonaSetting() );
 if ( !aPersonaSetting.isEmpty() )
 {
-setPersonaSettings( aPersonaSetting );
+SetPersonaSettings( aPersonaSetting );
 }
 
 break;
@@ -294,6 +344,17 @@ IMPL_LINK( SvxPersonalizationTabPage, ForceSelect, 
RadioButton*, pButton )
 return 0;
 }
 
+IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton )
+{
+m_pDefaultPersona-Check();
+for( sal_Int32 nIndex = 0; nIndex  3; nIndex++ )
+{
+if( pButton == m_vDefaultPersonaImages[nIndex] )
+m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex];
+}
+return 0;
+}
+
 /// Find the value on the Persona page, and convert it to a usable form.
 static OUString searchValue( const OString rBuffer, sal_Int32 from, const 
OString rIdentifier )
 {
@@ -351,12 +412,6 @@ static bool parsePersonaInfo( const OString rBuffer, 
OUString *pHeaderURL, OUSt
 return true;
 }
 
-void SvxPersonalizationTabPage::setPersonaSettings( const OUString 
aPersonaSettings )
-{
-

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

2014-06-18 Thread Rachit Gupta
 cui/source/options/personalization.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit b3ed6f893c1b2839d176977cd82ad88a9c9d9905
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Wed Jun 18 12:09:56 2014 +0530

The selected theme is shown in the progress label.

The name of the theme is displayed in the progress label whenever
the user clicks on one of the results.

Change-Id: I4810c9e5faec1b1a5156716b9a62b1256951425c

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index fa5b1a3..e6307f4 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -128,8 +128,15 @@ IMPL_LINK( SelectPersonaDialog, SelectPersona, 
PushButton*, pButton )
 if( pButton == m_vResultList[index] )
 {
 if( !m_vPersonaSettings[index].isEmpty() )
+{
 m_aSelectedPersona = m_vPersonaSettings[index];
-
+// get the persona name from the setting variable to show in 
the progress.
+sal_Int32 nNameIndex = m_aSelectedPersona.indexOf( ';' );
+OUString aName = m_aSelectedPersona.copy( 0, nNameIndex );
+OUString aProgress( Selected Persona:  );
+aProgress += aName;
+SetProgress( aProgress );
+}
 break;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-17 Thread Rachit Gupta
 cui/source/options/personalization.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 94099ca3e03af26e9209ca586d0303c16575947b
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Tue Jun 17 18:08:55 2014 +0530

Minor Fixes.

Changed number of search results from 1 (development code) to
9 (production code).

Change-Id: I9229f1db1df21bde3df60fd9d80e02307286b305

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index dab1925..4646f1a 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -91,7 +91,7 @@ IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, 
/*pButton*/ )
 if( searchTerm.isEmpty( ) )
 return 0;
 
-OUString rSearchURL = 
https://addons.allizom.org/en-US/firefox/api/1.5/search/; + searchTerm + 
/9/1;
+OUString rSearchURL = 
https://addons.allizom.org/en-US/firefox/api/1.5/search/; + searchTerm + 
/9/9;
 m_rSearchThread = new SearchAndParseThread( this, rSearchURL );
 m_rSearchThread-launch();
 return 0;
@@ -314,7 +314,7 @@ IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, 
PushButton*, /*pButton*/ )
 OUString aPersonaSetting( aDialog.GetAppliedPersonaSetting() );
 if ( !aPersonaSetting.isEmpty() )
 {
-m_aPersonaSettings = aPersonaSetting;
+setPersonaSettings( aPersonaSetting );
 }
 
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-17 Thread Rachit Gupta
 cui/source/options/personalization.cxx |   76 ++---
 1 file changed, 16 insertions(+), 60 deletions(-)

New commits:
commit 87999291caecde2f8fede6743705aeca5e1a0bf9
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Wed Jun 18 11:13:43 2014 +0530

Code cleanup.

Change-Id: Ifefc528b425ed9ae7f1cdba47282a4f0875bd728

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 4646f1a..fa5b1a3 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -49,31 +49,31 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent )
 get( m_pCancelButton, cancel );
 m_pCancelButton-SetClickHdl( LINK( this, SelectPersonaDialog, 
ActionCancel ) );
 
-get(m_vResultList[0], result1);
+get( m_vResultList[0], result1 );
 m_vResultList[0]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[1], result2);
+get( m_vResultList[1], result2 );
 m_vResultList[1]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[2], result3);
+get( m_vResultList[2], result3 );
 m_vResultList[2]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[3], result4);
+get( m_vResultList[3], result4 );
 m_vResultList[3]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[4], result5);
+get( m_vResultList[4], result5 );
 m_vResultList[4]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[5], result6);
+get( m_vResultList[5], result6 );
 m_vResultList[5]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[6], result7);
+get( m_vResultList[6], result7 );
 m_vResultList[6]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[7], result8);
+get( m_vResultList[7], result8 );
 m_vResultList[7]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 
-get(m_vResultList[8], result9);
+get( m_vResultList[8], result9 );
 m_vResultList[8]-SetClickHdl( LINK( this, SelectPersonaDialog, 
SelectPersona ) );
 }
 
@@ -123,60 +123,16 @@ IMPL_LINK( SelectPersonaDialog, ActionCancel, 
PushButton*, /* pButton */ )
 
 IMPL_LINK( SelectPersonaDialog, SelectPersona, PushButton*, pButton )
 {
-if( pButton == m_vResultList[0] )
+for( sal_Int32 index = 0; index  9; index++ )
 {
-if( !m_vPersonaSettings[0].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[0];
-}
-
-else if( pButton == m_vResultList[1] )
-{
-if( !m_vPersonaSettings[1].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[1];
-}
-
-else if( pButton == m_vResultList[2] )
-{
-if( !m_vPersonaSettings[2].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[2];
-}
-
-else if( pButton == m_vResultList[3] )
-{
-if( !m_vPersonaSettings[3].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[3];
-}
-
-else if( pButton == m_vResultList[4] )
-{
-if( !m_vPersonaSettings[4].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[4];
-}
-
-else if( pButton == m_vResultList[5] )
-{
-if( !m_vPersonaSettings[5].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[5];
-}
-
-else if( pButton == m_vResultList[6] )
-{
-if( !m_vPersonaSettings[6].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[6];
-}
-
-else if( pButton == m_vResultList[7] )
-{
-if( !m_vPersonaSettings[7].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[7];
-}
+if( pButton == m_vResultList[index] )
+{
+if( !m_vPersonaSettings[index].isEmpty() )
+m_aSelectedPersona = m_vPersonaSettings[index];
 
-else if( pButton == m_vResultList[8] )
-{
-if( !m_vPersonaSettings[8].isEmpty() )
-m_aSelectedPersona = m_vPersonaSettings[8];
+break;
+}
 }
-
 return 0;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-14 Thread Rachit Gupta
 cui/source/options/personalization.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit c57b0961cf9337436f14a4d6c51619bfe4924325
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Sat Jun 14 21:30:20 2014 +0530

Added error message to the progess label if something goes wrong.

Change-Id: If9e7a76bea49fa681e3fc7b3586b04fbbcbe279d

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index dadb88f..2cc6cf8 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -426,6 +426,8 @@ void SearchAndParseThread::execute()
 }
 catch (...)
 {
+sProgress = Something went wrong. Please try again.;
+m_pPersonaDialog-SetProgress( sProgress );
 return;
 }
 
@@ -510,6 +512,8 @@ void SearchAndParseThread::execute()
 }
 catch ( const uno::Exception  )
 {
+sProgress = Something went wrong. Please try again.;
+m_pPersonaDialog-SetProgress( sProgress );
 return;
 }
 
@@ -533,6 +537,8 @@ void SearchAndParseThread::getPreviewFile( const OUString 
rURL, OUString *pHead
 }
 catch (...)
 {
+sProgress = Something went wrong. Please try again.;
+m_pPersonaDialog-SetProgress( sProgress );
 return;
 }
 if ( !xStream.is() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-12 Thread Rachit Gupta
 cui/source/options/personalization.cxx |  221 ++---
 cui/source/options/personalization.hxx |   10 +
 2 files changed, 130 insertions(+), 101 deletions(-)

New commits:
commit cdd2b7aa6ed57e0e1090cc65c292ffe943f5457e
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Thu Jun 12 17:13:33 2014 +0530

The theme is download and applied in a separate thread.

Changed the SearchAndPersonaThread to include an instance of
SvxPersonalizationTabPage along with an instance of
SelectPersonaDialog. The constructor sets one of the instance and
the other one as null. In the execute() method, whichever instance
is null, the other one's process is done in the thread.

Change-Id: Iabfbdba63ce532ab794d3697977b6fab3fdaa832

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 3e04336..f428230 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -85,9 +85,9 @@ IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, 
/*pButton*/ )
 if( searchTerm.isEmpty( ) )
 return 0;
 
-OUString rSearchURL = 
https://addons.allizom.org/en-US/firefox/api/1.5/search/; + searchTerm + 
/9/9;
-m_aSearchThread = new SearchAndParseThread( this, rSearchURL );
-m_aSearchThread-launch();
+OUString rSearchURL = 
https://addons.allizom.org/en-US/firefox/api/1.5/search/; + searchTerm + 
/9/1;
+m_rSearchThread = new SearchAndParseThread( this, rSearchURL );
+m_rSearchThread-launch();
 return 0;
 }
 
@@ -261,11 +261,9 @@ IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, 
PushButton*, /*pButton*/ )
 OUString aURL( aDialog.GetSelectedPersona() );
 if ( !aURL.isEmpty() )
 {
-if ( CopyPersonaToGallery( aURL ) )
-m_pOwnPersona-Check();
+CopyPersonaToGallery( aURL );
 break;
 }
-// else TODO msgbox that the URL did not match
 }
 
 return 0;
@@ -336,67 +334,32 @@ static bool parsePersonaInfo( const OString rBuffer, 
OUString *pHeaderURL, OUSt
 return true;
 }
 
-bool SvxPersonalizationTabPage::CopyPersonaToGallery( const OUString rURL )
+void SvxPersonalizationTabPage::CopyPersonaToGallery( const OUString rURL )
 {
-// init the input stream
-uno::Reference ucb::XSimpleFileAccess3  xFileAccess( 
ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), 
uno::UNO_QUERY );
-if ( !xFileAccess.is() )
-return false;
-
-OUString aName, aHeaderURL, aFooterURL, aTextColor, aAccentColor;
-
-// get the required fields from rURL
-sal_Int32 nOldIndex = 0;
-sal_Int32 nNewIndex = rURL.indexOf( ';', nOldIndex );
-aName = rURL.copy( nOldIndex, ( nNewIndex - nOldIndex ) );
-
-nOldIndex = nNewIndex + 1;
-nNewIndex = rURL.indexOf( ';', nOldIndex );
-aHeaderURL = rURL.copy(nOldIndex , ( nNewIndex - nOldIndex ) );
-
-nOldIndex = nNewIndex + 1;
-nNewIndex = rURL.indexOf( ';', nOldIndex );
-aFooterURL = rURL.copy( nOldIndex,  ( nNewIndex - nOldIndex ) );
-
-nOldIndex = nNewIndex + 1;
-nNewIndex = rURL.indexOf( ';', nOldIndex );
-aTextColor = rURL.copy( nOldIndex, ( nNewIndex - nOldIndex ) );
-
-nOldIndex = nNewIndex + 1;
-nNewIndex = rURL.getLength();
-aAccentColor = rURL.copy( nOldIndex, ( nNewIndex - nOldIndex ) );
-
-// copy the images to the user's gallery
-OUString gallery = ${$BRAND_BASE_DIR/ LIBO_ETC_FOLDER / 
SAL_CONFIGFILE( bootstrap) ::UserInstallation};
-rtl::Bootstrap::expandMacros( gallery );
-gallery += /user/gallery/personas/;
-osl::Directory::createPath( gallery );
-
-OUString aHeaderFile( INetURLObject( aHeaderURL ).getName() );
-OUString aFooterFile( INetURLObject( aFooterURL ).getName() );
-
-aHeaderFile = aName + / + aHeaderFile;
-aFooterFile = aName + / + aFooterFile;
-
-try {
-xFileAccess-copy( aHeaderURL, gallery + aHeaderFile );
-xFileAccess-copy( aFooterURL, gallery + aFooterFile );
-}
-catch ( const uno::Exception  )
-{
-return false;
-}
-
-m_aPersonaSettings = aHeaderFile + ; + aFooterFile + ; + aTextColor + 
; + aAccentColor;
-
-return true;
+m_rApplyThread = new SearchAndParseThread( this, rURL );
+m_rApplyThread-launch();
 }
 
+void SvxPersonalizationTabPage::setPersonaSettings( const OUString 
aPersonaSettings )
+{
+m_aPersonaSettings = aPersonaSettings;
+m_pOwnPersona-Check();
+}
 
 SearchAndParseThread::SearchAndParseThread( SelectPersonaDialog* pDialog,
   const OUString rURL ) :
 Thread( cuiPersonasSearchThread ),
 m_pPersonaDialog( pDialog ),
+m_pPersonalizationTabPage( NULL ),
+m_aURL( rURL )
+{
+}
+
+SearchAndParseThread::SearchAndParseThread( SvxPersonalizationTabPage* pDialog,
+  const OUString rURL ) :
+Thread( 

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

2014-06-11 Thread Rachit Gupta
 cui/source/options/personalization.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 14f72d1e6a05484007e2ae4d9bcc89b3859083b7
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Wed Jun 11 22:42:12 2014 +0530

Changed the Persona application process a bit.

The header and footer files of the selected theme are downloaded and
saved in the Theme's own folder and applied.

Change-Id: Ie974c9bedc01a20c70cb342196fb60550cb39a0f

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 5ef6ff1..3e04336 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -370,12 +370,14 @@ bool SvxPersonalizationTabPage::CopyPersonaToGallery( 
const OUString rURL )
 OUString gallery = ${$BRAND_BASE_DIR/ LIBO_ETC_FOLDER / 
SAL_CONFIGFILE( bootstrap) ::UserInstallation};
 rtl::Bootstrap::expandMacros( gallery );
 gallery += /user/gallery/personas/;
-// gallery += aName + /;
 osl::Directory::createPath( gallery );
 
 OUString aHeaderFile( INetURLObject( aHeaderURL ).getName() );
 OUString aFooterFile( INetURLObject( aFooterURL ).getName() );
 
+aHeaderFile = aName + / + aHeaderFile;
+aFooterFile = aName + / + aFooterFile;
+
 try {
 xFileAccess-copy( aHeaderURL, gallery + aHeaderFile );
 xFileAccess-copy( aFooterURL, gallery + aFooterFile );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-03 Thread Jan Holesovsky
 cui/source/options/personalization.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit e28749854b89a596f4da7aa710b2a5daf588c4f7
Author: Jan Holesovsky ke...@collabora.com
Date:   Sun Jun 1 13:15:02 2014 +0200

Acquire the solar mutex, otherwise we cannot access vcl in the thread.

Change-Id: I02fdbbfd4c9516597df395163e28f1d616aa390d

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 9c8d345..c619624 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -371,6 +371,10 @@ void SearchAndParseThread::execute()
 Bitmap aBmp = aGraphic.GetBitmap();
 vResultList.push_back( Image( aBmp ) );
 }
+
+// for VCL to be able to do visual changes in the thread
+SolarMutexGuard aGuard;
+
 m_pPersonaDialog-SetImages( vResultList );
 sProgress = ;
 m_pPersonaDialog-SetProgress( sProgress );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-02 Thread Rachit Gupta
 cui/source/options/personalization.cxx   |   28 +-
 cui/source/options/personalization.hxx   |2 
 cui/uiconfig/ui/select_persona_dialog.ui |   83 ---
 3 files changed, 72 insertions(+), 41 deletions(-)

New commits:
commit 8c5811cc945fea05d75f52bf917f315b1a09069d
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Mon Jun 2 23:26:11 2014 +0530

Changed images to buttons so they are clickable.

Changed some variable names too.

Change-Id: I166d996389c84d00782cba42169c991f8f0f923e

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index e4d82ef..9c8d345 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -43,15 +43,15 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent )
 
 get( m_pProgressLabel, progress_label );
 
-get(m_vImageList[0], image1);
-get(m_vImageList[1], image2);
-get(m_vImageList[2], image3);
-get(m_vImageList[3], image4);
-get(m_vImageList[4], image5);
-get(m_vImageList[5], image6);
-get(m_vImageList[6], image7);
-get(m_vImageList[7], image8);
-get(m_vImageList[8], image9);
+get(m_vResultList[0], result1);
+get(m_vResultList[1], result2);
+get(m_vResultList[2], result3);
+get(m_vResultList[3], result4);
+get(m_vResultList[4], result5);
+get(m_vResultList[5], result6);
+get(m_vResultList[6], result7);
+get(m_vResultList[7], result8);
+get(m_vResultList[8], result9);
 }
 
 OUString SelectPersonaDialog::GetPersonaURL() const
@@ -86,7 +86,9 @@ void SelectPersonaDialog::SetImages( std::vectorImage 
rImageList )
 sal_Int32 nCount = 0;
 for( std::vectorImage::iterator it=rImageList.begin(); 
it!=rImageList.end(); ++it )
 {
-m_vImageList[nCount++]-SetImage( *it );
+m_vResultList[nCount]-Show();
+m_vResultList[nCount]-SetModeImage( *it );
+nCount++;
 }
 }
 
@@ -357,7 +359,7 @@ void SearchAndParseThread::execute()
 
 std::vectorOUString vLearnmoreURLs = pHandler-getLearnmoreURLs();
 std::vectorOUString::iterator it;
-std::vectorImage vImageList;
+std::vectorImage vResultList;
 GraphicFilter aFilter;
 Graphic aGraphic;
 
@@ -367,9 +369,9 @@ void SearchAndParseThread::execute()
 INetURLObject aURLObj( sHeaderFile );
 aFilter.ImportGraphic( aGraphic, aURLObj );
 Bitmap aBmp = aGraphic.GetBitmap();
-vImageList.push_back( Image( aBmp ) );
+vResultList.push_back( Image( aBmp ) );
 }
-m_pPersonaDialog-SetImages( vImageList );
+m_pPersonaDialog-SetImages( vResultList );
 sProgress = ;
 m_pPersonaDialog-SetProgress( sProgress );
 m_pPersonaDialog-setOptimalLayoutSize();
diff --git a/cui/source/options/personalization.hxx 
b/cui/source/options/personalization.hxx
index e7f02c9..9bc99a7 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -65,7 +65,7 @@ private:
 Edit *m_pEdit;  /// The input line for the 
Persona URL
 PushButton *m_pButton;
 FixedText *m_pProgressLabel;
-FixedImage *m_vImageList[9];
+PushButton *m_vResultList[9];
 
 public:
 SelectPersonaDialog( Window *pParent );
diff --git a/cui/uiconfig/ui/select_persona_dialog.ui 
b/cui/uiconfig/ui/select_persona_dialog.ui
index ab4c89c..2c9f5a1 100644
--- a/cui/uiconfig/ui/select_persona_dialog.ui
+++ b/cui/uiconfig/ui/select_persona_dialog.ui
@@ -132,11 +132,16 @@
   object class=GtkGrid id=grid1
 property name=visibleTrue/property
 property name=can_focusFalse/property
+property name=row_spacing6/property
+property name=column_spacing6/property
 child
-  object class=GtkImage id=image1
+  object class=GtkButton id=result1
 property name=visibleTrue/property
-property name=can_focusFalse/property
-property name=stockgtk-missing-image/property
+property name=can_focusTrue/property
+property name=receives_defaultTrue/property
+child
+  placeholder/
+/child
   /object
   packing
 property name=left_attach0/property
@@ -146,10 +151,13 @@
   /packing
 /child
 child
-  object class=GtkImage id=image2
+  object class=GtkButton id=result2
 property name=visibleTrue/property
-property name=can_focusFalse/property
-property name=stockgtk-missing-image/property
+property name=can_focusTrue/property
+property name=receives_defaultTrue/property
+child
+  

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

2014-05-25 Thread Rachit Gupta
 cui/source/options/personalization.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 1e5ae6180a65ff5dfe7371a8e0a3240319da1e81
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Sun May 25 17:29:21 2014 +0530

Added setOptimalLayoutSize() to resize the dialog after images load.

Change-Id: If85d4baacbffb6b7e6bf8feceb9c58697ee158d8

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index 357d5ab..e4d82ef 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -372,6 +372,7 @@ void SearchAndParseThread::execute()
 m_pPersonaDialog-SetImages( vImageList );
 sProgress = ;
 m_pPersonaDialog-SetProgress( sProgress );
+m_pPersonaDialog-setOptimalLayoutSize();
 }
 
 // TODO: Think of some way to retrieve only the preview image and skip the 
rest!
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-22 Thread Rachit Gupta
 cui/source/options/personalization.cxx|  129 -
 cui/source/options/personalization.hxx|   10 +
 cui/source/options/personasdochandler.hxx |1 
 cui/uiconfig/ui/select_persona_dialog.ui  |  151 +++---
 4 files changed, 269 insertions(+), 22 deletions(-)

New commits:
commit 62df0a31f5298843586c3c4936434761fdf4268c
Author: Rachit Gupta rachitgupta1...@gmail.com
Date:   Thu May 22 20:48:34 2014 +0530

The search result images are shown in the dialog.

1. Changed the UI to include a 3x3 grid of images
2. The preview images are downloaded in the thread
3. The images are downloaded in their respective folders
4. A progress label is shown

Change-Id: Id87e72343d28e03b37e0c422e5ebfe1a9a37c1b5

diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index b454d17..357d5ab 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -35,11 +35,23 @@ using namespace ::com::sun::star::ucb;
 SelectPersonaDialog::SelectPersonaDialog( Window *pParent )
 : ModalDialog( pParent, SelectPersonaDialog, 
cui/ui/select_persona_dialog.ui )
 {
-get( pButton, search_personas );
-pButton-SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) );
+get( m_pButton, search_personas );
+m_pButton-SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) );
 
 get( m_pEdit, search_term );
 m_pEdit-SetPlaceholderText( Search term... );
+
+get( m_pProgressLabel, progress_label );
+
+get(m_vImageList[0], image1);
+get(m_vImageList[1], image2);
+get(m_vImageList[2], image3);
+get(m_vImageList[3], image4);
+get(m_vImageList[4], image5);
+get(m_vImageList[5], image6);
+get(m_vImageList[6], image7);
+get(m_vImageList[7], image8);
+get(m_vImageList[8], image9);
 }
 
 OUString SelectPersonaDialog::GetPersonaURL() const
@@ -55,12 +67,29 @@ OUString SelectPersonaDialog::GetPersonaURL() const
 IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ )
 {
 OUString searchTerm = m_pEdit-GetText();
-OUString rURL = https://addons.allizom.org/en-US/firefox/api/1.5/search/; 
+ searchTerm + /9/;
+OUString rURL = https://addons.allizom.org/en-US/firefox/api/1.5/search/; 
+ searchTerm + /9/9;
 m_aSearchThread = new SearchAndParseThread( this, rURL );
 m_aSearchThread-launch();
 return 0;
 }
 
+void SelectPersonaDialog::SetProgress( OUString rProgress )
+{
+if(rProgress.isEmpty())
+m_pProgressLabel-Hide();
+else
+m_pProgressLabel-SetText( rProgress );
+}
+
+void SelectPersonaDialog::SetImages( std::vectorImage rImageList )
+{
+sal_Int32 nCount = 0;
+for( std::vectorImage::iterator it=rImageList.begin(); 
it!=rImageList.end(); ++it )
+{
+m_vImageList[nCount++]-SetImage( *it );
+}
+}
+
 SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const 
SfxItemSet rSet )
 : SfxTabPage( pParent, PersonalizationTabPage, 
cui/ui/personalization_tab.ui, rSet )
 {
@@ -187,7 +216,9 @@ static OUString searchValue( const OString rBuffer, 
sal_Int32 from, const OStri
 }
 
 /// Parse the Persona web page, and find where to get the bitmaps + the color 
values.
-static bool parsePersonaInfo( const OString rBuffer, OUString *pHeaderURL, 
OUString *pFooterURL, OUString *pTextColor, OUString *pAccentColor )
+static bool parsePersonaInfo( const OString rBuffer, OUString *pHeaderURL, 
OUString *pFooterURL,
+  OUString *pTextColor, OUString *pAccentColor, 
OUString *pPreviewURL,
+  OUString *pName )
 {
 // it is the first attribute that contains persona=
 sal_Int32 persona = rBuffer.indexOf( data-browsertheme=\{ );
@@ -211,6 +242,14 @@ static bool parsePersonaInfo( const OString rBuffer, 
OUString *pHeaderURL, OUSt
 if ( pAccentColor-isEmpty() )
 return false;
 
+*pPreviewURL = searchValue( rBuffer, persona, #34;previewURL#34;:#34; 
);
+if ( pAccentColor-isEmpty() )
+return false;
+
+*pName = searchValue( rBuffer, persona, #34;name#34;:#34; );
+if ( pAccentColor-isEmpty() )
+return false;
+
 return true;
 }
 
@@ -249,9 +288,9 @@ bool SvxPersonalizationTabPage::CopyPersonaToGallery( const 
OUString rURL )
 xStream-closeInput();
 
 // get the important bits of info
-OUString aHeaderURL, aFooterURL, aTextColor, aAccentColor;
+OUString aHeaderURL, aFooterURL, aTextColor, aAccentColor, aPreviewURL, 
aName;
 
-if ( !parsePersonaInfo( aBuffer.makeStringAndClear(), aHeaderURL, 
aFooterURL, aTextColor, aAccentColor ) )
+if ( !parsePersonaInfo( aBuffer.makeStringAndClear(), aHeaderURL, 
aFooterURL, aTextColor, aAccentColor, aPreviewURL, aName ) ) // Temp
 return false;
 
 // copy the images to the user's gallery
@@ -292,6 +331,8 @@ SearchAndParseThread::~SearchAndParseThread()
 
 void